16 #include <sys/types.h> 33 m_chunk.m_hdr.pHandle = pHandle;
62 int snOffset = offsetof(
dev_info_t, serialNumber);
65 if (start <= snOffset && (
int)(snOffset +
sizeof(uint32_t)) <= end)
67 m_chunk.m_hdr.devSerialNum = m_devInfo.serialNumber;
73 if (dataBytes > m_chunk.GetBuffFree())
76 if (!WriteChunkToFile())
80 else if (m_fileSize >= m_maxFileSize)
87 if (!m_chunk.PushBack((
unsigned char*)dataHdr,
sizeof(
p_data_hdr_t), (
unsigned char*)dataBuf, dataHdr->
size))
99 if (m_chunk.GetDataSize() == 0)
117 int fileBytes = m_chunk.WriteToFile(m_pFile, 0);
118 if (!m_pFile->good())
124 m_fileSize += fileBytes;
125 m_logSize += fileBytes;
136 while (!(data = ReadDataFromChunk()))
139 if (!ReadChunkFromFile())
154 if (m_chunk.GetDataSize() <= 0)
161 if (m_chunk.PopFront(size))
175 while (m_chunk.ReadFromFile(m_pFile) < 0)
177 if (!OpenNextReadFile())
189 m_devInfo.serialNumber = serialNumber;
190 m_chunk.m_hdr.devSerialNum = serialNumber;
196 if (WriteChunkToFile())
p_data_t * ReadDataFromChunk()
void OnReadData(p_data_t *data)
virtual bool CloseAllFiles()
void InitDeviceForWriting(int pHandle, std::string timestamp, std::string directory, uint64_t maxDiskSpace, uint32_t maxFilesize) OVERRIDE
virtual bool SaveData(p_data_hdr_t *dataHdr, const uint8_t *dataBuf)
void CloseISLogFile(cISLogFileBase *&logFile)
bool CloseAllFiles() OVERRIDE
void SetSerialNumber(uint32_t serialNumber) OVERRIDE
virtual void InitDeviceForWriting(int pHandle, string timestamp, string directory, uint64_t maxDiskSpace, uint32_t maxFileSize)
p_data_t * ReadData() OVERRIDE
USBInterfaceDescriptor data
char copyDataPToStructP2(void *sptr, const p_data_hdr_t *dataHdr, const uint8_t *dataBuf, const unsigned int maxsize)
bool SaveData(p_data_hdr_t *dataHdr, const uint8_t *dataBuf) OVERRIDE