|
@@ -27,6 +27,7 @@
|
|
|
#include <string.h>
|
|
|
#include <time.h>
|
|
|
#include <ctype.h>
|
|
|
+#include <stdint.h>
|
|
|
#include "define.h"
|
|
|
|
|
|
#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
|
|
@@ -120,8 +121,9 @@ struct dongle_info
|
|
|
int cnt_pppFail;
|
|
|
int cnt_SearchModuleFail;
|
|
|
int cnt_ReadSimInfoFail;
|
|
|
- int bytesTx;
|
|
|
- int bytesRx;
|
|
|
+ uint64_t bytesTx;
|
|
|
+ uint64_t bytesRx;
|
|
|
+ uint32_t lastCounter;
|
|
|
}Dongle;
|
|
|
|
|
|
struct SysConfigAndInfo *ShmSysConfigAndInfo;
|
|
@@ -487,7 +489,7 @@ int isReadInfo(int connectStep)
|
|
|
Length = at_command(uart, "at+qgdcnt?\r", rx);
|
|
|
if(Length > 0)
|
|
|
{
|
|
|
- if(sscanf(rx, "%*[^:]:%d,%d", &Dongle.bytesTx, &Dongle.bytesRx) != 2)
|
|
|
+ if(sscanf(rx, "%*[^:]:%lld,%lld", &Dongle.bytesTx, &Dongle.bytesRx) != 2)
|
|
|
{
|
|
|
DEBUG_WARN("at+qgdcnt response can not parse.\n");
|
|
|
}
|
|
@@ -1012,7 +1014,7 @@ int isReachableInternet(void)
|
|
|
|
|
|
for(int idx=0;idx<ARRAY_SIZE(valid_Internet);idx++)
|
|
|
{
|
|
|
- sprintf(cmd, "ping -c 1 -w 3 -I ppp0 %s", valid_Internet[idx]);
|
|
|
+ sprintf(cmd, "ping -c 1 -w 3 -s 8 -I ppp0 %s", valid_Internet[idx]);
|
|
|
fp = popen(cmd, "r");
|
|
|
if(fp != NULL)
|
|
|
{
|
|
@@ -1027,6 +1029,7 @@ int isReachableInternet(void)
|
|
|
else
|
|
|
{
|
|
|
result = PASS;
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1603,15 +1606,25 @@ int main(void)
|
|
|
delayInterval = DisconnInterval;
|
|
|
}
|
|
|
|
|
|
- ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi = csq2rssi(Dongle.CSQ);
|
|
|
- ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode = Dongle.MODE;
|
|
|
- DEBUG_INFO("Device RSSI: %d dBm (CSQ:%d)\n", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi, Dongle.CSQ);
|
|
|
- DEBUG_INFO("Device MODE: %d\n", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode);
|
|
|
- DEBUG_INFO("Device Act: %s\n", Dongle.act);
|
|
|
- DEBUG_INFO("Device Band: %s\n", Dongle.band);
|
|
|
- DEBUG_INFO("Device Channel: %d\n", Dongle.channel);
|
|
|
- DEBUG_INFO("Device TX counter: %d bytes\n", Dongle.bytesTx);
|
|
|
- DEBUG_INFO("Device RX counter: %d bytes\n", Dongle.bytesRx);
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi != csq2rssi(Dongle.CSQ))
|
|
|
+ {
|
|
|
+ ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi = csq2rssi(Dongle.CSQ);
|
|
|
+ DEBUG_INFO("RSSI: %d dBm (CSQ:%d)\n", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomRssi, Dongle.CSQ);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode != Dongle.MODE)
|
|
|
+ {
|
|
|
+ ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode = Dongle.MODE;
|
|
|
+ DEBUG_INFO("Device MODE: %d\n", ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomModemMode);
|
|
|
+ DEBUG_INFO("Device Act: %s\n", Dongle.act);
|
|
|
+ DEBUG_INFO("Device Band: %s\n", Dongle.band);
|
|
|
+ DEBUG_INFO("Device Channel: %d\n", Dongle.channel);
|
|
|
+ }
|
|
|
+
|
|
|
+ DEBUG_INFO("TX counter: %d bytes\n", Dongle.bytesTx);
|
|
|
+ DEBUG_INFO("RX counter: %d bytes\n", Dongle.bytesRx);
|
|
|
+ DEBUG_INFO("Delta counter: %d bytes\n", (Dongle.bytesTx+Dongle.bytesRx)-Dongle.lastCounter);
|
|
|
+ Dongle.lastCounter = (Dongle.bytesTx+Dongle.bytesRx);
|
|
|
DEBUG_INFO("++++++++++++++++++++++++++++++++++++++++\n");
|
|
|
|
|
|
break;
|