Sample code for Data Statistics
//--------------------------------------------------------------------------------------------------/*** Test the connectivity.*///--------------------------------------------------------------------------------------------------void TestConnectivity(le_mdc_ProfileRef_t profileRef){int status;char systemCmd[200] = {0};le_mdc_DataBearerTechnology_t downlinkDataBearerTech;le_mdc_DataBearerTechnology_t uplinkDataBearerTech;uint64_t rxBytes = 0, txBytes = 0;uint64_t latestRxBytes = 0, latestTxBytes = 0;LE_ASSERT_OK(le_mdc_GetDataBearerTechnology(profileRef,&downlinkDataBearerTech,&uplinkDataBearerTech));LE_INFO("downlinkDataBearerTech %d, uplinkDataBearerTech %d",downlinkDataBearerTech, uplinkDataBearerTech);// Get interface nameif (le_mdc_IsIPv4(profileRef)){snprintf(systemCmd, sizeof(systemCmd), "ping -c 4 www.sierrawireless.com -I %s", itfName);}else{// TODO ping6 needs raw access to socket and therefore root permissions => find a different// way to test the connectivitysnprintf(systemCmd, sizeof(systemCmd), "ping6 -c 4 www.sierrawireless.com -I %s", itfName);}// Ping to test the connectivitystatus = system(systemCmd);if (WEXITSTATUS(status)){le_mdc_StopSession(profileRef);}LE_ASSERT(!WEXITSTATUS(status));// Get data countersLE_ASSERT_OK(le_mdc_GetBytesCounters(&rxBytes, &txBytes));latestRxBytes = rxBytes;latestTxBytes = txBytes;// Stop data counters and ping to test the connectivitystatus = system(systemCmd);if (WEXITSTATUS(status)){le_mdc_StopSession(profileRef);}LE_ASSERT(!WEXITSTATUS(status));// Get data countersLE_ASSERT_OK(le_mdc_GetBytesCounters(&rxBytes, &txBytes));LE_ASSERT(latestRxBytes == rxBytes);LE_ASSERT(latestTxBytes == txBytes);// Start data counters}