40 static float serverKBps = 0;
41 static uint64_t serverByteCount = 0;
42 static uint64_t updateCount = 0;
43 static uint64_t serverByteRateTimeMsLast = 0;
44 static uint64_t serverByteCountLast = 0;
49 if (serverByteCount != newServerByteCount)
51 serverByteCount = newServerByteCount;
55 uint64_t dtMs = timeMs - serverByteRateTimeMsLast;
58 uint64_t serverBytesDelta = serverByteCount - serverByteCountLast;
59 serverKBps = ((float)serverBytesDelta / (
float)dtMs);
62 serverByteCountLast = serverByteCount;
63 serverByteRateTimeMsLast = timeMs;
65 printf(
"%sServer: %02" PRIu64
" (%3.1f KB/s : %lld) %s", prefix, (++updateCount) % 100, serverKBps, (
long long)i->
GetClientServerByteCount(), suffix);
91 cout << endl << suffix;
116 switch (data->
hdr.
id)
281 cout <<
"Failed to connect to server." << endl;
308 cout << endl <<
"Results:" << endl;
310 for (
size_t i = 0; i < results.size(); i++)
312 cout << results[i].port <<
": " << (results[i].error.size() == 0 ?
"Success\n" : results[i].error);
313 errorCount += (int)(results[i].error.size() != 0);
317 cout << endl << errorCount <<
" ports failed." << endl;
319 return (errorCount == 0 ? 0 : -1);
333 cout << endl <<
"Results:" << endl;
335 for (
size_t i = 0; i < results.size(); i++)
337 cout << results[i].port <<
": " << (results[i].error.size() == 0 ?
"Success\n" : results[i].error);
338 errorCount += (int)(results[i].error.size() != 0);
342 cout << endl << errorCount <<
" ports failed." << endl;
344 return (errorCount == 0 ? 0 : -1);
357 cout <<
"Failed to update flash config" << endl;
370 inertialSenseInterface.
Update();
374 cout <<
"Shutting down..." << endl;
377 inertialSenseInterface.
Close();
399 cout <<
"Incorrect file extension." << endl;
411 cout <<
"Incorrect file extension." << endl;
429 unsigned char line[512];
430 unsigned char* asciiData;
436 printf(
"%s", (
char*)asciiData);
461 cout <<
"Failed to setup logger!" << endl;
462 inertialSenseInterface.
Close();
471 if (!inertialSenseInterface.
Update())
480 cout <<
"Unknown exception...";
484 cout <<
"Shutting down..." << endl;
488 inertialSenseInterface.
Close();
void StopBroadcasts(bool allPorts=true)
static vector< bootloader_result_t > BootloadFile(const string &comPort, const string &fileName, const string &bootloaderFileName, int baudRate=IS_BAUD_RATE_BOOTLOADER, pfnBootloadProgress uploadProgress=NULLPTR, pfnBootloadProgress verifyProgress=NULLPTR, pfnBootloadStatus infoProgress=NULLPTR, bool updateBootloader=false)
static int cltool_updateBootloader()
com_manager_status_t * comManagerGetStatus(int pHandle)
string updateBootloaderFilename
void ProcessData(p_data_t *data, bool enableReplay=false, double replaySpeedX=1.0)
static int cltool_updateAppFirmware()
static void output_client_bytes(InertialSense *i)
int serialPortOpen(serial_port_t *serialPort, const char *port, int baudRate, int blocking)
#define DID_GPS2_RTK_CMP_REL
uint32_t communicationErrorCount
bool OpenServerConnection(const string &connectionString)
uint64_t GetClientServerByteCount()
int serialPortWriteAscii(serial_port_t *serialPort, const char *buffer, int bufferLength)
size_t count(InputIterator first, InputIterator last, T const &item)
int bootloadUploadProgress(const void *port, float percent)
int bootloadVerifyProgress(const void *port, float percent)
char copyDataPToStructP(void *sptr, const p_data_t *data, const unsigned int maxsize)
void SetTimeoutFlushLoggerSeconds(time_t timeoutFlushLoggerSeconds)
uint64_t getTickCount(void)
#define DID_PREINTEGRATED_IMU
int serialPortReadAsciiTimeout(serial_port_t *serialPort, unsigned char *buffer, int bufferLength, int timeoutMilliseconds, unsigned char **asciiData)
void SetDisplayMode(eDisplayMode mode)
#define RMC_OPTIONS_PRESERVE_CTRL
bool CreateHost(const string &ipAndPort)
void bootloadStatusInfo(const void *port, const char *str)
#define DID_MAGNETOMETER_2
void SendRawData(eDataIDs dataId, uint8_t *data, uint32_t length=0, uint32_t offset=0)
bool ControlCWasPressed()
bool disableBroadcastsOnClose
string updateAppFirmwareFilename
int cltool_main(int argc, char *argv[])
static bool cltool_setupCommunications(InertialSense &inertialSenseInterface)
#define DID_MAGNETOMETER_1
USBInterfaceDescriptor data
bool BroadcastBinaryData(uint32_t dataId, int periodMultiple, pfnHandleBinaryData callback=NULL)
eDisplayMode GetDisplayMode()
bool Open(const char *port, int baudRate=IS_COM_BAUDRATE_DEFAULT, bool disableBroadcastsOnClose=false)
serial_port_t * GetSerialPort(int pHandle=0)
static void cltool_dataCallback(InertialSense *i, p_data_t *data, int pHandle)
#define DID_GPS1_RTK_POS_REL
uint32_t timeoutFlushLoggerSeconds
static bool output_server_bytes(InertialSense *i, const char *prefix="", const char *suffix="")
static int inertialSenseMain()
static int cltool_createHost()
void BroadcastBinaryDataRmcPreset(uint64_t rmcPreset=RMC_PRESET_INS_BITS, uint32_t rmcOptions=0)