Bmag incl gps rettelse

Dependencies:   mbed WDT MODSERIAL BME280

Committer:
MAA
Date:
Thu Apr 05 08:32:10 2018 +0000
Branch:
MbedBMAGThrRev
Revision:
51:dbd8e6c2211b
Parent:
28:ed0d29f63b55
Child:
55:06c5f76e1a8c
Child:
63:168f5498a3c5
new file generation at midnight removed.; generated sps filename changed to date_time_BMAG_sn

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MAA 11:d3d26d0e71ea 1 #pragma once
MAA 2:39c4a85dc2a4 2 #include <string>
MAA 5:11782a2008c2 3 #include "mbed.h"
MAA 2:39c4a85dc2a4 4
MAA 0:b3313c5ffca3 5 #define LINESTART '>'
MAA 0:b3313c5ffca3 6 #define LINESTOP '<'
MAA 0:b3313c5ffca3 7 #define HEADEREND '|'
MAA 0:b3313c5ffca3 8 #define SPACE ' '
MAA 0:b3313c5ffca3 9
MAA 4:c70ef089a3fd 10 #define P_16 0xA001
MAA 4:c70ef089a3fd 11
MAA 2:39c4a85dc2a4 12 using std::string;
MAA 2:39c4a85dc2a4 13
MAA 19:5d25cffef662 14
MAA 19:5d25cffef662 15 //! An *.SPS format handler class
MAA 19:5d25cffef662 16 /*!
MAA 19:5d25cffef662 17 This class is used to create and handle creation of *.sps strings for *.sps files.
MAA 19:5d25cffef662 18 */
MAA 0:b3313c5ffca3 19 class SPS{
MAA 0:b3313c5ffca3 20 public:
MAA 0:b3313c5ffca3 21 //default constructor
MAA 0:b3313c5ffca3 22 SPS();
MAA 4:c70ef089a3fd 23
MAA 4:c70ef089a3fd 24 //Updates current string
MAA 28:ed0d29f63b55 25 void UpdateCurrentString(string tag, string identifier_id, string group_id, string date, string time, string ZZZ,string encoding, string source_id, string interpreter_id, string data_line_version, string source_firmware_version, string interpreter_firmware_version, string barcode, string latitude, string longitude, bool gpsFixFlag, string batteryvoltage, string preassure, string temperature, string humidity, string mag_time, string mag_nt, string mag_sq, Serial * dbg);
MAA 24:099df3fa2b13 26
MAA 24:099df3fa2b13 27 //Updates current header string
MAA 24:099df3fa2b13 28 void UpdateHeaderString(string barcode, string identifier_id, string group_id, string ZZZ, string encoding,string source_id, string interpreter_id, string data_line_version, string source_firmware_version, string interpreter_firmware_version);
MAA 7:872984a67d5b 29
MAA 7:872984a67d5b 30 //Updates current ERR
MAA 24:099df3fa2b13 31 void UpdateCurrentErrString(string tag, string identifier_id, string group_id, string date, string time, string ZZZ,string encoding, string source_id, string interpreter_id, string data_line_version, string source_firmware_version, string interpreter_firmware_version, string latitude, string longitude, bool gpsFixFlag, string mag_time, string mag_nt, string mag_sq, Serial * dbg);
MAA 2:39c4a85dc2a4 32
MAA 4:c70ef089a3fd 33 //Fills the array for calculation of the CRC-16 with values
MAA 4:c70ef089a3fd 34 void init_crc16_tab();
MAA 2:39c4a85dc2a4 35
MAA 5:11782a2008c2 36 //The function update_crc_16 calculates a new CRC-16 value based on the
MAA 5:11782a2008c2 37 //previous value of the CRC and the next byte of the data to be checked.
MAA 5:11782a2008c2 38 unsigned short update_crc_16(unsigned short crc, char c);
MAA 5:11782a2008c2 39
MAA 5:11782a2008c2 40 //Gets / returns current sps data string
MAA 5:11782a2008c2 41 string getCurrentString(void);
MAA 5:11782a2008c2 42
MAA 7:872984a67d5b 43 //Gets / returns current sps err string
MAA 7:872984a67d5b 44 string getCurrentErrString(void);
MAA 7:872984a67d5b 45
MAA 5:11782a2008c2 46 //get headerstring
MAA 5:11782a2008c2 47 string getHeaderString(void);
MAA 4:c70ef089a3fd 48
MAA 5:11782a2008c2 49 //Get error status
MAA 5:11782a2008c2 50 bool getErrStatus(void);
MAA 4:c70ef089a3fd 51
MAA 5:11782a2008c2 52 //set Error status
MAA 5:11782a2008c2 53 void setErrStatus(bool status);
MAA 5:11782a2008c2 54
MAA 5:11782a2008c2 55 //add data to current string
MAA 5:11782a2008c2 56 void addToCurrentString(string data);
MAA 5:11782a2008c2 57 void addToCurrentString(char data);
MAA 6:6d1683c8b26b 58
MAA 7:872984a67d5b 59 //add data to current Errstring
MAA 7:872984a67d5b 60 void addToCurrentErrString(string data);
MAA 24:099df3fa2b13 61 void addToCurrentErrString(char data);
MAA 24:099df3fa2b13 62
MAA 24:099df3fa2b13 63 //add data to current Header string
MAA 24:099df3fa2b13 64 void addToCurrentHeaderString(string data);
MAA 24:099df3fa2b13 65 void addToCurrentHeaderString(char data);
MAA 7:872984a67d5b 66
MAA 6:6d1683c8b26b 67 //generate sps filename
MAA 51:dbd8e6c2211b 68 void generateSpsFilename(string formattedDate, string barcode, string time);
MAA 6:6d1683c8b26b 69
MAA 6:6d1683c8b26b 70 //get sps filename
MAA 6:6d1683c8b26b 71 string getSpsFileName(void);
MAA 5:11782a2008c2 72
MAA 6:6d1683c8b26b 73 private:
MAA 6:6d1683c8b26b 74 string fileNameString;
MAA 2:39c4a85dc2a4 75 string currentString;
MAA 6:6d1683c8b26b 76 string lastString;
MAA 2:39c4a85dc2a4 77 string currentErrString;
MAA 4:c70ef089a3fd 78 string headerString;
MAA 5:11782a2008c2 79 bool errStatus;
MAA 21:325cb82f1838 80 int crc_tab16_init;
MAA 4:c70ef089a3fd 81 unsigned short crc_tab16[256];
MAA 0:b3313c5ffca3 82
MAA 0:b3313c5ffca3 83 };