Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
391 | Brean | 1 | #ifndef PARSER_H |
2 | #define PARSER_H |
||
3 | #include <string> |
||
396 | Brean | 4 | #include <cmath> |
391 | Brean | 5 | |
6 | /** |
||
7 | * The Parser gets values from the Mikrokopter-USART interface |
||
8 | * and parses them into a sRxData-Struct |
||
9 | */ |
||
10 | |||
396 | Brean | 11 | using namespace std; |
12 | |||
391 | Brean | 13 | struct sRxData |
14 | { |
||
15 | char *input; |
||
16 | string str; |
||
17 | int decode[150]; |
||
18 | int decLen; |
||
19 | }; |
||
20 | |||
21 | class Parser { |
||
22 | public: |
||
393 | Brean | 23 | static bool decode64(sRxData &rx); |
24 | static string encode64(char data[150],unsigned int length); |
||
391 | Brean | 25 | |
396 | Brean | 26 | static string add_CRC(string TX); |
27 | static bool check_CRC(string RX); |
||
391 | Brean | 28 | |
29 | static float getFloat(long value, int count); |
||
30 | |||
31 | static int dataToInt(int *Data , int Start, bool is_signed = true); |
||
32 | static long dataToLong(int *Data , int Start, bool is_signed = true); |
||
33 | static int dataToChar(int *data , int start, bool is_signed = true); |
||
34 | static string dataToString(int Data[150], int Start = 0, int End = 150); |
||
35 | static int charToData(int data); |
||
36 | }; |
||
37 | |||
38 | #endif |