From ce182f64f76aed09517aa4f89b5f5393740daf58 Mon Sep 17 00:00:00 2001 From: Bertrand Lemasle Date: Thu, 29 Mar 2018 00:04:06 +1300 Subject: [PATCH] Fixed intermediate timeout and data being incomplete / malformed --- GpsTracker/Config.h | 2 +- GpsTracker/NetworkPositionsBackup.cpp | 7 +- GpsTracker/~AutoRecover.GpsTracker.vcxproj0 | 143 ++++++++++++++++++++ 3 files changed, 148 insertions(+), 4 deletions(-) create mode 100644 GpsTracker/~AutoRecover.GpsTracker.vcxproj0 diff --git a/GpsTracker/Config.h b/GpsTracker/Config.h index bc04f9e..4a41270 100644 --- a/GpsTracker/Config.h +++ b/GpsTracker/Config.h @@ -30,7 +30,7 @@ #define GPS_DEFAULT_INTERMEDIATE_TIMEOUT_MS 10000L #define GPS_DEFAULT_TOTAL_TIMEOUT_MS 80000L -#define NETWORK_DEFAULT_INTERMEDIATE_TIMEOUT_MS 1000L +#define NETWORK_DEFAULT_INTERMEDIATE_TIMEOUT_MS 10000L #define NETWORK_DEFAULT_TOTAL_TIMEOUT_MS 80000L #define NETWORK_DEFAULT_NO_NETWORK_QUALITY_THRESHOLD 8 #define NETWORK_DEFAULT_NO_NETWORK_TRIES 5 diff --git a/GpsTracker/NetworkPositionsBackup.cpp b/GpsTracker/NetworkPositionsBackup.cpp index 7ab1fc6..5cc0a4c 100644 --- a/GpsTracker/NetworkPositionsBackup.cpp +++ b/GpsTracker/NetworkPositionsBackup.cpp @@ -23,20 +23,21 @@ namespace positions { bool NetworkPositionsBackup::appendPosition(PositionEntry &entry) { char buffer[BUFFER_SIZE]; - snprintf(buffer, BUFFER_SIZE, "%d,%d,%d,%d,%d,%d,", + snprintf(buffer, BUFFER_SIZE, "%d,%d,%d,%d,%d,%d,%d,", debug::freeRam(), hardware::sim808::device.getSignalQuality().attenuation, entry.metadata.batteryLevel, entry.metadata.batteryVoltage, static_cast(entry.metadata.temperature * 100), - static_cast(entry.metadata.status)); + static_cast(entry.metadata.status), + entry.metadata.timeToFix); strcat(buffer, entry.position); NOTICE_FORMAT("appendPosition", "Sending : %s", buffer); uint16_t responseCode = hardware::sim808::device.httpPost( config::main::value.network.url, - F("text/csv"), + F("text/gpstracker"), buffer, buffer, BUFFER_SIZE diff --git a/GpsTracker/~AutoRecover.GpsTracker.vcxproj0 b/GpsTracker/~AutoRecover.GpsTracker.vcxproj0 new file mode 100644 index 0000000..1555d93 --- /dev/null +++ b/GpsTracker/~AutoRecover.GpsTracker.vcxproj0 @@ -0,0 +1,143 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {C5F80730-F44F-4478-BDAE-6634EFC2CA88} + GpsTracker + GpsTracker + + + + Application + true + + + MultiByte + + + Application + false + + + true + MultiByte + + + + + + + + + + + + + + + + + + + + Level3 + Disabled + true + $(ProjectDir)..\GpsTracker;$(ProjectDir)..\..\libraries\E24;$(ProjectDir)..\..\libraries\SIM808;$(ProjectDir)..\..\libraries\uDS3231;$(ProjectDir)..\..\libraries\ArduinoLog;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src;$(ProjectDir)..\..\libraries\Low-Power;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial\src;$(ProjectDir)..\..\libraries\SdFat\src;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\libraries;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\arduino\avr\libraries;$(ProjectDir)..\..\libraries;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\arduino\avr\variants\eightanaloginputs;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\avr\include\;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\avr\include\avr\;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\lib\gcc\avr\4.8.1\include;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\lib\gcc\avr\4.9.2\include;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\lib\gcc\avr\4.9.3\include;%(AdditionalIncludeDirectories) + $(ProjectDir)__vm\.GpsTracker.vsarduino.h;%(ForcedIncludeFiles) + false + __AVR_ATmega328p__;__AVR_ATmega328P__;_DEBUG=1;_VMDEBUG=1;F_CPU=8000000L;ARDUINO=10805;ARDUINO_AVR_PRO;ARDUINO_ARCH_AVR;__cplusplus=201103L;_VMICRO_INTELLISENSE;%(PreprocessorDefinitions) + + + true + + + + + Level3 + Disabled + true + true + true + $(ProjectDir)..\GpsTracker;$(ProjectDir)..\..\libraries\E24;$(ProjectDir)..\..\libraries\SIM808;$(ProjectDir)..\..\libraries\uDS3231;$(ProjectDir)..\..\libraries\ArduinoLog;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial\src;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src;$(ProjectDir)..\..\libraries\Low-Power;$(ProjectDir)..\..\libraries\SdFat\src;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI\src;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src\utility;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\libraries;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\arduino\avr\libraries;$(ProjectDir)..\..\libraries;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\arduino\avr\variants\eightanaloginputs;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\avr\include\;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\avr\include\avr\;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\lib\gcc\avr\4.8.1\include;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\lib\gcc\avr\4.9.2\include;$(ProjectDir)..\..\..\..\..\..\..\..\Program Files (x86)\Arduino\hardware\tools\avr\lib\gcc\avr\4.9.3\include;%(AdditionalIncludeDirectories) + $(ProjectDir)__vm\.GpsTracker.vsarduino.h;%(ForcedIncludeFiles) + false + __AVR_ATmega328p__;__AVR_ATmega328P__;F_CPU=8000000L;ARDUINO=10805;ARDUINO_AVR_PRO;ARDUINO_ARCH_AVR;__cplusplus=201103L;_VMICRO_INTELLISENSE;%(PreprocessorDefinitions) + + + true + true + true + + + + + + + VisualMicroDebugger + + + + CppCode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file