Bmag incl gps rettelse
Dependencies: mbed WDT MODSERIAL BME280
Diff: SPS/SPS.cpp
- Revision:
- 19:5d25cffef662
- Parent:
- 8:d6287c33b54a
- Child:
- 20:73fa202c73db
diff -r 87f243168f05 -r 5d25cffef662 SPS/SPS.cpp --- a/SPS/SPS.cpp Wed Apr 19 11:45:58 2017 +0000 +++ b/SPS/SPS.cpp Thu Apr 20 13:10:28 2017 +0000 @@ -1,5 +1,9 @@ #include "SPS.h" +//! SPS, class default constructor +/*! + Initializing different class member values, creating a header string. +*/ SPS::SPS(){ fileNameString = ""; @@ -12,6 +16,33 @@ }; + +//! UpdateCurrentString, sps string creation method, taking data and info as parameters. +/*! + + Generates an sps string containing everything needed in a BMAG sps string including crc, brackets etc. + + \param tag: string containing the tag for the sps logging unit eg. "BMAG" + \param identifier_id: string containing the identifier id of the unit. + \param group_id: string containing the group id of the unit. + \param date: string containing the date in the format "YYYY/MM/DD" + \param time: string containing the current time in format "HH:MM:SS.FFF" + \param ZZZ: string containing "ZZZ" :) + \param s1: string containing s1 as described in the *.sps documentation + \param source_id: string containing the source id of the unit eg. "0000" + \param interpreter_id: string containing the interpreter id of the unit eg. "00" + \param data_line_version: string containing data line version as described in the *.sps documentation, eg. "01" + \param source_firmware_version: string containing the firmware version of the unit eg. "1.2" + \param barcode: string containing the barcode of the unit, eg. "12345" + \param latitude: string containing the latitude of the unit in decimal degrees. For further info read the *.sps documentation. + \param longitude: string containing the longitude of the unit in decimal degrees. For further info read the *.sps documentation. + \param gpsFixFlag: bool containing the gps fix status, 1 if gps fix is present, else 0. + \param batteryvoltage: string containing the battery voltage of the units battery pack, eg. "14.2" + \param mag_time: string containing the last timestamp received from GSM-19 device eg. "000048.0" + \param mag_nt: string containing the last mag measurement in nT eg. "036418.77" + \param mag_sq: string containing info about the measurement quality of the last mag measurement eg. "99" + +*/ 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 source_firmware_version, string interpreter_firmware_version, string barcode, string latitude, string longitude, bool gpsFixFlag, string batteryvoltage, string mag_time, string mag_nt, string mag_sq, Serial * dbg){ currentString = ""; @@ -89,7 +120,33 @@ addToCurrentString(LINESTOP); }; -//Updates current ERR string + + +//! UpdateCurrentErrString, sps ERR string creation method, taking data and info as parameters. +/*! + + Generates the current sps ERR string containing everything needed in a BMAG sps string including crc, brackets etc. + + \param tag: string containing the tag for the sps logging unit eg. "BMAG" + \param identifier_id: string containing the identifier id of the unit. + \param group_id: string containing the group id of the unit. + \param date: string containing the date in the format "YYYY/MM/DD" + \param time: string containing the current time in format "HH:MM:SS.FFF" + \param ZZZ: string containing "ZZZ" :) + \param s1: string containing s1 as described in the *.sps documentation + \param source_id: string containing the source id of the unit eg. "0000" + \param interpreter_id: string containing the interpreter id of the unit eg. "00" + \param data_line_version: string containing data line version as described in the *.sps documentation, eg. "01" + \param source_firmware_version: string containing the firmware version of the unit eg. "1.2" + \param barcode: string containing the barcode of the unit, eg. "12345" + \param latitude: string containing the latitude of the unit in decimal degrees. For further info read the *.sps documentation. + \param longitude: string containing the longitude of the unit in decimal degrees. For further info read the *.sps documentation. + \param gpsFixFlag: bool containing the gps fix status, 1 if gps fix is present, else 0. + \param mag_time: string containing the last timestamp received from GSM-19 device eg. "000048.0" + \param mag_nt: string containing the last mag measurement in nT eg. "036418.77" + \param mag_sq: string containing info about the measurement quality of the last mag measurement eg. "99" + +*/ void SPS::UpdateCurrentErrString(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){ currentErrString = ""; @@ -150,7 +207,10 @@ addToCurrentErrString(LINESTOP); }; -//Fills the array for calculation of the CRC-16 with values +//! init_crc16_tab, creates a crc tab. +/*! + Populates a crc array for later use +*/ void SPS::init_crc16_tab() { int i, j; @@ -176,8 +236,13 @@ }; -// 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. + +//! update_crc_16, updates crc tab. +/*! + \param crc + \param c + \return returns crc value +*/ unsigned short SPS::update_crc_16(unsigned short crc, char c) { unsigned short tmp, short_c;