Bmag incl gps rettelse

Dependencies:   mbed WDT MODSERIAL BME280

Revision:
2:39c4a85dc2a4
Parent:
0:b3313c5ffca3
Child:
4:c70ef089a3fd
--- a/SPS/SPS.cpp	Fri Feb 17 09:33:57 2017 +0000
+++ b/SPS/SPS.cpp	Thu Feb 23 13:01:35 2017 +0000
@@ -1,5 +1,73 @@
 #include "SPS.h"
 
 SPS::SPS(){
+
+    currentString = "";
+    currentErrString = "";
+    headerString = "/>tag identifier_id group_id date time zzz | s1 source_id interpreter_id data_line_version encoding source_firmware_version interpreter_firmware_version | latitude longitude gpsFixFlag mag_time mag_nt mag_sq checksum<";
+           
+};
+
+void SPS::UpdateCurrentString(string tag, string identifier_id, string group_id, string date, string time, string ZZZ,string s1, string source_id, string interpreter_id, string data_line_version, string encoding, string source_firmware_version, string interpreter_firmware_version, string latitude, string longitude, char gpsFixFlag, string mag_time, string mag_nt, string mag_sq){
+
+    currentString = "";
+    string checkSum = "";
     
+    //create current string
+    currentString.push_back(LINESTART);
+    currentString.append(tag);
+    currentString.push_back(SPACE);
+    currentString.append(identifier_id);
+    currentString.push_back(SPACE);
+    currentString.append(group_id);
+    currentString.push_back(SPACE);
+    currentString.append(date);
+    currentString.push_back(SPACE);
+    currentString.append(time);
+    currentString.push_back(SPACE); 
+    currentString.append("ZZZ");
+    currentString.push_back(SPACE);
+    currentString.push_back(HEADEREND);
+    currentString.push_back(SPACE);
+    currentString.append(s1);
+    currentString.push_back(SPACE);
+    currentString.append(source_id);
+    currentString.push_back(SPACE);
+    currentString.append(interpreter_id);
+    currentString.push_back(SPACE);
+    currentString.append(data_line_version);
+    currentString.push_back(SPACE);
+    currentString.append(encoding);
+    currentString.push_back(SPACE);
+    currentString.append(source_firmware_version);
+    currentString.push_back(SPACE);
+    currentString.append(interpreter_firmware_version);
+    currentString.push_back(SPACE);
+    currentString.push_back(HEADEREND);
+    currentString.push_back(SPACE);
+    currentString.append(latitude);
+    currentString.push_back(SPACE);
+    currentString.append(longitude);
+    currentString.push_back(SPACE);
+    currentString.push_back(gpsFixFlag);
+    currentString.push_back(SPACE);
+    currentString.append(mag_time);
+    currentString.push_back(SPACE);
+    currentString.append(mag_nt);
+    currentString.push_back(SPACE);
+    currentString.append(mag_sq);
+    
+    //calculate checksum
+    checkSum = this->checkSumCalc();
+    
+    //append rest of string
+    currentString.push_back(SPACE);
+    currentString.append(checkSum);
+    currentString.push_back(LINESTOP);
+ 
+};
+
+string SPS::checkSumCalc(){
+    
+    return "XXXX";
 };
\ No newline at end of file