cltool.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 __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;
85 
87  string logType; // -lt=dat
88  string logPath; // -lp=path
89  float maxLogSpacePercent; // -lms=max_space_mb
90  uint32_t maxLogFileSize; // -lmf=max_file_size
91  string logSubFolder; // -lts=1
92  int baudRate; // -baud=3000000
94 
95  string serverConnection; // -svr=type:host:port:url:user:password
96  string host; // -host=ip:port
97 
98  string flashConfig;
100 
102 } cmd_options_t;
103 
107 extern bool g_ctrlCPressed;
108 
109 int cltool_main(int argc, char* argv[]);
110 int cltool_serialPortSendComManager(CMHANDLE cmHandle, int pHandle, buffer_t* bufferToSend);
111 
112 // returns false if failure
113 bool cltool_setupLogger(InertialSense& inertialSenseInterface);
114 bool cltool_parseCommandLine(int argc, char* argv[]);
115 bool cltool_replayDataLog();
116 void cltool_outputUsage();
117 void cltool_outputHelp();
118 bool cltool_updateFlashConfig(InertialSense& inertialSenseInterface, string flashConfig); // true if should continue
119 bool cltool_updateEvbFlashConfig(InertialSense& inertialSenseInterface, string evbFlashConfig); // true if should continue
120 
121 #endif // __CLTOOL_H__
122 
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:88
string updateBootloaderFilename
Definition: cltool.h:53
int streamIMU1
Definition: cltool.h:71
int streamRtkPosRel
Definition: cltool.h:75
void cltool_outputUsage()
Definition: cltool.cpp:456
int streamIMU2
Definition: cltool.h:72
bool softwareReset
Definition: cltool.h:56
bool cltool_updateEvbFlashConfig(InertialSense &inertialSenseInterface, string evbFlashConfig)
Definition: cltool.cpp:598
bool g_ctrlCPressed
float maxLogSpacePercent
Definition: cltool.h:89
int streamRTOS
Definition: cltool.h:82
double replaySpeed
Definition: cltool.h:61
int baudRate
Definition: cltool.h:92
int streamSensorsADC
Definition: cltool.h:83
bool persistentMessages
Definition: cltool.h:65
bool cltool_replayDataLog()
Definition: cltool.cpp:424
int streamINS2
Definition: cltool.h:67
bool enableLogging
Definition: cltool.h:86
string evbFlashConfig
Definition: cltool.h:99
bool magRecal
Definition: cltool.h:57
string logType
Definition: cltool.h:87
cInertialSenseDisplay g_inertialSenseDisplay
Definition: cltool.cpp:18
bool disableBroadcastsOnClose
Definition: cltool.h:93
string logSubFolder
Definition: cltool.h:91
string updateAppFirmwareFilename
Definition: cltool.h:52
bool cltool_updateFlashConfig(InertialSense &inertialSenseInterface, string flashConfig)
Definition: cltool.cpp:548
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:98
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:90
int streamINS3
Definition: cltool.h:68
uint32_t timeoutFlushLoggerSeconds
Definition: cltool.h:101
bool replayDataLog
Definition: cltool.h:55
int streamWheelEncoder
Definition: cltool.h:84
string host
Definition: cltool.h:96
void cltool_outputHelp()
Definition: cltool.cpp:543
string serverConnection
Definition: cltool.h:95
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 Sun Feb 28 2021 03:17:57