16 #include <sys/types.h> 43 m_altClampToGround =
true;
45 m_showPointTimestamps =
true;
46 m_pointUpdatePeriodSec = 1.0f;
60 m_timeStamp = timestamp;
63 m_maxDiskSpace = maxDiskSpace;
64 m_maxFileSize = maxFileSize;
80 string str = m_directory +
"/stats_SN" + to_string(m_devInfo.serialNumber) +
".txt";
81 m_logStats->WriteToFile(str);
82 #else // stringstream not working on embedded platform 83 ostringstream serialNumString;
84 serialNumString << m_devInfo.serialNumber;
85 m_logStats->WriteToFile(m_directory +
"/stats_SN" + serialNumString.str() +
".txt");
94 #if PLATFORM_IS_WINDOWS 96 std::wstring stemp = std::wstring(m_fileName.begin(), m_fileName.end());
98 ShellExecuteW(0, 0, filename, 0, 0, SW_SHOW);
111 m_logStats->LogDataAndTimestamp(dataHdr->
id, timestamp);
120 m_timeStamp = timeStamp;
122 vector<ISFileManager::file_info_t> fileInfos;
123 SetSerialNumber((uint32_t)strtoul(serialNum.c_str(),
NULL, 10));
125 if (fileInfos.size() != 0)
127 m_fileName = fileInfos[0].name;
128 for (
size_t i = 0; i < fileInfos.size(); i++)
130 m_fileNames.push_back(fileInfos[i].
name);
143 if (m_directory.empty())
149 _MKDIR(m_directory.c_str());
151 #if !PLATFORM_IS_EMBEDDED 154 if (m_maxDiskSpace != 0)
156 vector<ISFileManager::file_info_t> files;
158 unsigned int index = 0;
161 while (spaceUsed > m_maxDiskSpace && index < files.size())
163 spaceUsed -= files[index].size;
172 uint32_t serNum = m_devInfo.serialNumber;
177 string fileName = GetNewFileName(serNum, m_fileCount,
NULL);
181 if (m_pFile && m_pFile->isOpened())
203 if (m_fileCount == m_fileNames.size())
208 m_fileName = m_fileNames[m_fileCount++];
215 printf(
"File opened: %s\n", m_fileName.c_str());
222 printf(
"FAILED to open file: %s\n", m_fileName.c_str());
233 SNPRINTF(filename,
sizeof(filename),
"%s/%s%d_%s_%04d%s%s",
238 (int)(fileCount % 10000),
239 (suffix ==
NULL || *suffix == 0 ?
"" : (string(
"_") + suffix).c_str()),
240 LogFileExtention().c_str());
244 ostringstream filename;
246 serialNumber <<
"_" <<
247 m_timeStamp <<
"_" <<
248 setfill(
'0') << setw(4) << (fileCount % 10000) <<
249 (suffix ==
NULL || *suffix == 0 ?
"" :
string(
"_") + suffix) <<
251 return filename.str();
272 m_logStats->LogDataAndTimestamp(data->
hdr.
id, timestamp);
void OnReadData(p_data_t *data)
virtual bool CloseAllFiles()
bool SetupReadInfo(const string &directory, const string &deviceName, const string &timeStamp)
cISLogFileBase * CreateISLogFile()
virtual bool SaveData(p_data_hdr_t *dataHdr, const uint8_t *dataBuf)
void CloseISLogFile(cISLogFileBase *&logFile)
static double GetTimestamp(const p_data_hdr_t *hdr, const uint8_t *buf)
void SetDeviceInfo(const dev_info_t *info)
virtual void InitDeviceForWriting(int pHandle, string timestamp, string directory, uint64_t maxDiskSpace, uint32_t maxFileSize)
#define IS_LOG_FILE_PREFIX
bool DeleteFile(const std::string &fullFilePath)
USBInterfaceDescriptor data
virtual void InitDeviceForReading()
uint64_t GetDirectorySpaceUsed(const std::string &directory, bool recursive)
uint8_t buf[MAX_DATASET_SIZE]
string GetNewFileName(uint32_t serialNumber, uint32_t fileCount, const char *suffix)
virtual bool OpenWithSystemApp()