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)
285 cout <<
"Failed to connect to server." << endl;
316 cout << endl <<
"Results:" << endl;
318 for (
size_t i = 0; i < results.size(); i++)
320 cout << results[i].port <<
": " << (results[i].error.size() == 0 ?
"Success\n" : results[i].error);
321 errorCount += (int)(results[i].error.size() != 0);
325 cout << endl << errorCount <<
" ports failed." << endl;
327 return (errorCount == 0 ? 0 : -1);
341 cout << endl <<
"Results:" << endl;
343 for (
size_t i = 0; i < results.size(); i++)
345 cout << results[i].port <<
": " << (results[i].error.size() == 0 ?
"Success\n" : results[i].error);
346 errorCount += (int)(results[i].error.size() != 0);
350 cout << endl << errorCount <<
" ports failed." << endl;
352 return (errorCount == 0 ? 0 : -1);
365 cout <<
"Failed to update flash config" << endl;
370 cout <<
"Failed to update EVB flash config" << endl;
383 inertialSenseInterface.
Update();
387 cout <<
"Shutting down..." << endl;
390 inertialSenseInterface.
Close();
412 cout <<
"Incorrect file extension." << endl;
424 cout <<
"Incorrect file extension." << endl;
442 unsigned char line[512];
443 unsigned char* asciiData;
449 printf(
"%s", (
char*)asciiData);
474 cout <<
"Failed to setup logger!" << endl;
475 inertialSenseInterface.
Close();
484 if (!inertialSenseInterface.
Update())
493 cout <<
"Unknown exception...";
497 cout <<
"Shutting down..." << endl;
501 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)
int serialPortOpen(serial_port_t *serialPort, const char *port, int baudRate, int blocking)
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)
#define DID_GPS2_RTK_CMP_REL
uint32_t communicationErrorCount
bool OpenServerConnection(const string &connectionString)
uint64_t GetClientServerByteCount()
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
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)
int serialPortReadAsciiTimeout(serial_port_t *serialPort, unsigned char *buffer, int bufferLength, int timeoutMilliseconds, unsigned char **asciiData)
#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_WHEEL_ENCODER
#define DID_GPS1_RTK_POS_REL
uint32_t timeoutFlushLoggerSeconds
int serialPortWriteAscii(serial_port_t *serialPort, const char *buffer, int bufferLength)
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)