DeviceLog.h
Go to the documentation of this file.
1 /*
2 MIT LICENSE
3 
4 Copyright (c) 2014-2021 Inertial Sense, Inc. - http://inertialsense.com
5 
6 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
7 
8 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 
10 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11 */
12 
13 #ifndef DEVICE_LOG_H
14 #define DEVICE_LOG_H
15 
16 #include <stdio.h>
17 #include <string.h>
18 #include <vector>
19 #include "ISLogFileBase.h"
20 
21 extern "C"
22 {
23  #include "com_manager.h"
24 }
25 
26 using namespace std;
27 
28 // never change these!
29 #define IS_LOG_FILE_PREFIX "LOG_SN"
30 #define IS_LOG_FILE_PREFIX_LENGTH 6
31 #define IS_LOG_TIMESTAMP_LENGTH 15
32 
33 class cLogStats;
34 
36 {
37 public:
38  cDeviceLog();
39  virtual ~cDeviceLog();
40  virtual void InitDeviceForWriting(int pHandle, string timestamp, string directory, uint64_t maxDiskSpace, uint32_t maxFileSize);
41  virtual void InitDeviceForReading();
42  virtual bool CloseAllFiles();
43  virtual bool OpenWithSystemApp();
44  virtual bool SaveData(p_data_hdr_t *dataHdr, const uint8_t* dataBuf);
45  virtual p_data_t* ReadData() = 0;
46  virtual void SetSerialNumber(uint32_t serialNumber) = 0;
47  virtual string LogFileExtention() = 0;
48  virtual void Flush() {}
49  bool SetupReadInfo(const string& directory, const string& deviceName, const string& timeStamp);
50  void SetDeviceInfo(const dev_info_t *info);
51  const dev_info_t* GetDeviceInfo() { return &m_devInfo; }
52  uint64_t FileSize() { return m_fileSize; }
53  uint64_t LogSize() { return m_logSize; }
54  uint32_t FileCount() { return m_fileCount; }
55  void SetKmlConfig(bool showTracks =true, bool showPoints =true, bool showPointTimestamps =true, double pointUpdatePeriodSec=1.0, bool altClampToGround=true)
56  {
57  m_showTracks = showTracks;
58  m_showPoints = showPoints;
59  m_showPointTimestamps = showPointTimestamps;
60  m_pointUpdatePeriodSec = pointUpdatePeriodSec;
61  m_altClampToGround = altClampToGround;
62  }
63 
64 protected:
65  bool OpenNewSaveFile();
66  bool OpenNextReadFile();
67  string GetNewFileName(uint32_t serialNumber, uint32_t fileCount, const char* suffix);
68  void OnReadData(p_data_t* data);
69 
70  vector<string> m_fileNames;
72  string m_directory;
73  string m_timeStamp;
74  string m_fileName;
76  int m_pHandle;
77  uint64_t m_fileSize;
78  uint64_t m_logSize;
79  uint32_t m_fileCount;
80  uint64_t m_maxDiskSpace;
81  uint32_t m_maxFileSize;
87 
88 private:
90 };
91 
92 #endif // DEVICE_LOG_H
string m_timeStamp
Definition: DeviceLog.h:73
ros::Time * timeStamp(M &m)
bool m_showPoints
Definition: DeviceLog.h:84
uint64_t m_logSize
Definition: DeviceLog.h:78
cISLogFileBase * m_pFile
Definition: DeviceLog.h:71
void SetKmlConfig(bool showTracks=true, bool showPoints=true, bool showPointTimestamps=true, double pointUpdatePeriodSec=1.0, bool altClampToGround=true)
Definition: DeviceLog.h:55
uint32_t FileCount()
Definition: DeviceLog.h:54
cLogStats * m_logStats
Definition: DeviceLog.h:89
const dev_info_t * GetDeviceInfo()
Definition: DeviceLog.h:51
uint64_t FileSize()
Definition: DeviceLog.h:52
dev_info_t m_devInfo
Definition: DeviceLog.h:75
uint32_t m_maxFileSize
Definition: DeviceLog.h:81
uint64_t m_maxDiskSpace
Definition: DeviceLog.h:80
virtual void Flush()
Definition: DeviceLog.h:48
bool m_showPointTimestamps
Definition: DeviceLog.h:85
uint32_t m_fileCount
Definition: DeviceLog.h:79
bool m_altClampToGround
Definition: DeviceLog.h:82
USBInterfaceDescriptor data
uint64_t m_fileSize
Definition: DeviceLog.h:77
double m_pointUpdatePeriodSec
Definition: DeviceLog.h:86
string m_directory
Definition: DeviceLog.h:72
vector< string > m_fileNames
Definition: DeviceLog.h:70
int m_pHandle
Definition: DeviceLog.h:76
uint64_t LogSize()
Definition: DeviceLog.h:53
bool m_showTracks
Definition: DeviceLog.h:83
string m_fileName
Definition: DeviceLog.h:74


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:17:57