cltool.h
Go to the documentation of this file.
1 /*
2 MIT LICENSE
3 
4 Copyright (c) 2014-2020 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 __CLTOOL_H__
14 #define __CLTOOL_H__
15 
16 #include <stdio.h>
17 #include <iostream>
18 #include <iomanip> // std::setw
19 #include <algorithm>
20 #include <string>
21 
22 // change these includes to be the correct path for your system
23 #include "InertialSense.h" // best to include this file first
24 #include "ISDisplay.h"
25 #include "ISUtilities.h"
26 
27 using namespace std;
28 
29 #define APP_NAME "cltool"
30 #if PLATFORM_IS_WINDOWS
31 #define APP_EXT ".exe"
32 #define EXAMPLE_PORT "COM5"
33 #define EXAMPLE_LOG_DIR "c:\\logs\\20170117_222549 "
34 #define EXAMPLE_FIRMWARE_FILE "c:\\fw\\IS_uINS-3.hex"
35 #define EXAMPLE_BOOTLOADER_FILE "c:\\fw\\SAMx70-Bootloader.bin"
36 #define EXAMPLE_SPACE_1 " "
37 #define EXAMPLE_SPACE_2 ""
38 #else
39 #define APP_EXT ""
40 #define EXAMPLE_PORT "/dev/ttyS2"
41 #define EXAMPLE_LOG_DIR "logs/20170117_222549 "
42 #define EXAMPLE_FIRMWARE_FILE "fw/IS_uINS-3.hex "
43 #define EXAMPLE_BOOTLOADER_FILE "fw/SAMx70-Bootloader.bin "
44 #define EXAMPLE_SPACE_1 " "
45 #define EXAMPLE_SPACE_2 " "
46 #endif
47 
48 typedef struct
49 {
50  // parsed
51  string comPort; // -c=com_port
52  string updateAppFirmwareFilename; // -b=file_name
53  string updateBootloaderFilename; // -ub=file_name
54  bool bootloaderVerify; // -bv
57  bool magRecal;
58  uint32_t magRecalMode;
60  string asciiMessages;
61  double replaySpeed;
63 
64  uint64_t rmcPreset;
73  int streamGPS;
84 
86  string logType; // -lt=dat
87  string logPath; // -lp=path
88  float maxLogSpacePercent; // -lms=max_space_mb
89  uint32_t maxLogFileSize; // -lmf=max_file_size
90  string logSubFolder; // -lts=1
91  int baudRate; // -baud=3000000
93 
94  string serverConnection; // -svr=type:host:port:url:user:password
95  string host; // -host=ip:port
96 
97  string flashConfig;
98 
100 } cmd_options_t;
101 
105 extern bool g_ctrlCPressed;
106 
107 int cltool_main(int argc, char* argv[]);
108 int cltool_serialPortSendComManager(CMHANDLE cmHandle, int pHandle, buffer_t* bufferToSend);
109 
110 // returns false if failure
111 bool cltool_setupLogger(InertialSense& inertialSenseInterface);
112 bool cltool_parseCommandLine(int argc, char* argv[]);
113 bool cltool_replayDataLog();
114 void cltool_outputUsage();
115 void cltool_outputHelp();
116 bool cltool_updateFlashConfig(InertialSense& inertialSenseInterface, string flashConfig); // true if should continue
117 
118 #endif // __CLTOOL_H__
119 
cmd_options_t g_commandLineOptions
Definition: cltool.cpp:16
string asciiMessages
Definition: cltool.h:60
int streamRtkCmpRel
Definition: cltool.h:76
serial_port_t g_serialPort
Definition: cltool.cpp:17
bool bootloaderVerify
Definition: cltool.h:54
string logPath
Definition: cltool.h:87
string updateBootloaderFilename
Definition: cltool.h:53
int streamIMU1
Definition: cltool.h:71
int streamRtkPosRel
Definition: cltool.h:75
void cltool_outputUsage()
Definition: cltool.cpp:444
int streamIMU2
Definition: cltool.h:72
bool softwareReset
Definition: cltool.h:56
bool g_ctrlCPressed
float maxLogSpacePercent
Definition: cltool.h:88
int streamRTOS
Definition: cltool.h:82
double replaySpeed
Definition: cltool.h:61
int baudRate
Definition: cltool.h:91
int streamSensorsADC
Definition: cltool.h:83
bool persistentMessages
Definition: cltool.h:65
bool cltool_replayDataLog()
Definition: cltool.cpp:412
int streamINS2
Definition: cltool.h:67
bool enableLogging
Definition: cltool.h:85
bool magRecal
Definition: cltool.h:57
string logType
Definition: cltool.h:86
cInertialSenseDisplay g_inertialSenseDisplay
Definition: cltool.cpp:18
bool disableBroadcastsOnClose
Definition: cltool.h:92
string logSubFolder
Definition: cltool.h:90
string updateAppFirmwareFilename
Definition: cltool.h:52
bool cltool_updateFlashConfig(InertialSense &inertialSenseInterface, string flashConfig)
Definition: cltool.cpp:534
int streamGPS
Definition: cltool.h:73
void * CMHANDLE
Definition: com_manager.h:119
int streamDThetaVel
Definition: cltool.h:81
int streamSysSensors
Definition: cltool.h:80
survey_in_t surveyIn
Definition: cltool.h:59
int streamRtkPos
Definition: cltool.h:74
uint64_t rmcPreset
Definition: cltool.h:64
int streamMag1
Definition: cltool.h:77
string comPort
Definition: cltool.h:51
int displayMode
Definition: cltool.h:62
int streamDualIMU
Definition: cltool.h:70
int streamBaro
Definition: cltool.h:79
string flashConfig
Definition: cltool.h:97
bool cltool_setupLogger(InertialSense &inertialSenseInterface)
Definition: cltool.cpp:27
uint32_t magRecalMode
Definition: cltool.h:58
int cltool_main(int argc, char *argv[])
int streamINS4
Definition: cltool.h:69
uint32_t maxLogFileSize
Definition: cltool.h:89
int streamINS3
Definition: cltool.h:68
uint32_t timeoutFlushLoggerSeconds
Definition: cltool.h:99
bool replayDataLog
Definition: cltool.h:55
string host
Definition: cltool.h:95
void cltool_outputHelp()
Definition: cltool.cpp:529
string serverConnection
Definition: cltool.h:94
int cltool_serialPortSendComManager(CMHANDLE cmHandle, int pHandle, buffer_t *bufferToSend)
Definition: cltool.cpp:20
bool cltool_parseCommandLine(int argc, char *argv[])
Definition: cltool.cpp:63
int streamMag2
Definition: cltool.h:78
int streamINS1
Definition: cltool.h:66


inertial_sense_ros
Author(s):
autogenerated on Sat Sep 19 2020 03:19:04