16 #define _FILE_OFFSET_BITS 64 25 #if !defined(PLATFORM_IS_EVB_2) || !PLATFORM_IS_EVB_2 43 #define DEFAULT_LOGS_DIRECTORY "IS_logs" 68 bool InitSave(
eLogType logType = LOGTYPE_DAT,
const string& directory = g_emptyString,
int numDevices = 1,
float maxDiskSpacePercent = 0.5
f, uint32_t maxFileSize = 1024 * 1024 * 5,
bool useSubFolderTimestamp =
true);
69 bool InitSaveTimestamp(
const string& timeStamp,
const string& directory = g_emptyString,
const string& subDirectory = g_emptyString,
int numDevices = 1,
eLogType logType = LOGTYPE_DAT,
float maxDiskSpacePercent = 0.5
f, uint32_t maxFileSize = 1024 * 1024 * 5,
bool useSubFolderTimestamp =
true);
73 bool LogData(
unsigned int device,
p_data_hdr_t* dataHdr,
const uint8_t* dataBuf);
74 p_data_t* ReadData(
unsigned int device = 0);
75 p_data_t* ReadNextData(
unsigned int& device);
79 void OpenWithSystemApp();
82 uint64_t LogSizeAll();
83 uint64_t LogSize(
unsigned int device = 0);
85 float LogSizeMB(
unsigned int device = 0);
86 float FileSizeMB(
unsigned int device = 0);
87 uint32_t FileCount(
unsigned int device = 0);
89 bool SetDeviceInfo(
const dev_info_t *info,
unsigned int device = 0);
90 const dev_info_t* GetDeviceInfo(
unsigned int device = 0);
91 bool CopyLog(
cISLogger&
log,
const string& timestamp = g_emptyString,
const string& outputDir = g_emptyString,
eLogType logType = LOGTYPE_DAT,
float maxDiskSpacePercent = 0.5
f, uint32_t maxFileSize = 1024 * 1024 * 5,
bool useSubFolderTimestamp =
true);
108 static bool LogHeaderIsCorrupt(
const p_data_hdr_t* hdr);
111 static string CreateCurrentTimestamp();
118 static bool ReadAllLogDataIntoMemory(
const string& directory,
map<uint32_t, vector<vector<uint8_t>>>& data);
120 void SetKmlConfig(
bool showPath =
true,
bool showSample =
false,
bool showTimeStamp =
true,
double updatePeriodSec = 1.0,
bool altClampToGround =
true)
122 m_showPath = showPath;
123 m_showSample = showSample;
124 m_showTimeStamp = showTimeStamp;
125 m_iconUpdatePeriodSec = updatePeriodSec;
126 m_altClampToGround = altClampToGround;
128 for (
unsigned int dev = 0; dev < GetDeviceCount(); dev++)
130 m_devices[dev]->SetKmlConfig(m_showPath, m_showSample, m_showTimeStamp, m_iconUpdatePeriodSec, m_altClampToGround);
136 if (logTypeString ==
"csv")
138 return cISLogger::eLogType::LOGTYPE_CSV;
140 else if (logTypeString ==
"kml")
142 return cISLogger::eLogType::LOGTYPE_KML;
144 else if (logTypeString ==
"sdat")
146 return cISLogger::eLogType::LOGTYPE_SDAT;
148 else if (logTypeString ==
"json")
150 return cISLogger::eLogType::LOGTYPE_JSON;
152 return cISLogger::eLogType::LOGTYPE_DAT;
162 bool InitSaveCommon(
eLogType logType,
const string& directory,
const string& subDirectory,
int numDevices,
float maxDiskSpacePercent, uint32_t maxFileSize,
bool useSubFolderTimestamp);
163 bool InitDevicesForWriting(
int numDevices = 1);
168 #if PLATFORM_IS_EVB_2 169 return static_cast<time_t
>(
time_msec() / 1000);
209 void LogTimestamp(
double timestamp);
223 void LogData(uint32_t dataId);
224 void LogDataAndTimestamp(uint32_t dataId,
double timestamp);
226 void WriteToFile(
const string& fileName);
229 #endif // IS_LOGGER_H
void SetKmlConfig(bool showPath=true, bool showSample=false, bool showTimeStamp=true, double updatePeriodSec=1.0, bool altClampToGround=true)
vector< cDeviceLog * > m_devices
uint32_t GetDeviceCount()
uint64_t timestampDropCount
void EnableLogging(bool enabled)
cISLogFileBase * m_errorFile
static eLogType ParseLogType(const string &logTypeString)
double m_iconUpdatePeriodSec
USBInterfaceDescriptor data
time_t m_timeoutFlushSeconds
double lastTimestampDelta
void SetTimeoutFlushSeconds(time_t timeoutFlushSeconds)
uint64_t timestampDeltaCount
GeneratorWrapper< T > map(Func &&function, GeneratorWrapper< U > &&generator)
static const string g_emptyString
const cLogStats & GetStats()
time_t GetTimeoutFlushSeconds()