Bmag incl gps rettelse

Dependencies:   mbed WDT MODSERIAL BME280

SPS/SPS.h

Committer:
MAA
Date:
2017-03-09
Revision:
5:11782a2008c2
Parent:
4:c70ef089a3fd
Child:
6:6d1683c8b26b

File content as of revision 5:11782a2008c2:

#include <string>
#include "mbed.h"

#define LINESTART '>'
#define LINESTOP '<' 
#define HEADEREND '|'
#define SPACE ' '

#define P_16 0xA001 

using std::string;

class SPS{
public:
    //default constructor
    SPS();    
    
    
    //Updates current string     
    void 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 source_firmware_version, string interpreter_firmware_version, string latitude, string longitude, bool gpsFixFlag, string mag_time, string mag_nt, string mag_sq, Serial * dbg);
    
    //Fills the array for calculation of the CRC-16 with values
    void init_crc16_tab();
    
    //The function update_crc_16 calculates a new CRC-16 value based on the 
    //previous value of the CRC and the next byte of the data to be checked.
    unsigned short update_crc_16(unsigned short crc, char c);    
    
    //Gets / returns current sps data string
    string getCurrentString(void);
    
    //get headerstring
    string getHeaderString(void);
    
    //Get error status
    bool getErrStatus(void);    
    
    //set Error status
    void setErrStatus(bool status);
    
    //add data to current string
    void addToCurrentString(string data);
    void addToCurrentString(char data);
            
private:    
    string currentString;
    string currentErrString;
    string headerString;
    bool errStatus;
    int crc_tab16_init;              
    unsigned short crc_tab16[256];  
                     
};