Rev 440 | Rev 450 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 440 | Rev 449 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #ifndef PARSER_H |
1 | #ifndef PARSER_H |
2 | #define PARSER_H |
2 | #define PARSER_H |
3 | #include <string> |
- | |
4 | #include <cmath> |
3 | #include <cmath> |
Line 5... | Line 4... | ||
5 | 4 | ||
6 | /** |
5 | /** |
7 | * The Parser gets values from the Mikrokopter-USART interface |
6 | * The Parser gets values from the Mikrokopter-USART interface |
8 | * and parses them into a sRxData-Struct |
7 | * and parses them into a sRxData-Struct |
9 | */ |
- | |
10 | - | ||
11 | using namespace std; |
8 | */ |
12 | 9 | /* |
|
13 | struct sRxData |
10 | struct sRxData |
14 | { |
11 | { |
15 | char *input; |
- | |
16 | string str; |
12 | char *input; |
17 | int decode[150]; |
13 | int decode[150]; |
18 | int decLen; |
14 | int decLen; |
19 | }; |
15 | }; |
20 | 16 | */ |
|
21 | class Parser { |
17 | class Parser { |
- | 18 | public: |
|
- | 19 | void create_frame(char cmd, int address, char * data, unsigned int length); |
|
22 | public: |
20 | |
23 | static bool decode64(sRxData &rx); |
21 | static int decode64(char * data, int len, unsigned char *ptrOut, int offset); |
Line 24... | Line 22... | ||
24 | static string encode64(char data[150],unsigned int length); |
22 | static void encode64(char data[150],unsigned int length); |
25 | 23 | ||
Line 26... | Line 24... | ||
26 | static string add_CRC(string TX); |
24 | static void add_CRC(char * tx, int length); |
Line 27... | Line 25... | ||
27 | static bool check_CRC(string RX); |
25 | static bool check_CRC(char * rx, int length); |
28 | 26 | ||
29 | static float getFloat(long value, int count); |
27 | static float getFloat(long value, int count); |
30 | - | ||
31 | static int dataToInt(int *Data , int Start, bool is_signed = true); |
28 | |
32 | static long dataToLong(int *Data , int Start, bool is_signed = true); |
29 | static int dataToInt(int *data , int start, bool is_signed = true); |
Line 33... | Line 30... | ||
33 | static int dataToChar(int *data , int start, bool is_signed = true); |
30 | static long dataToLong(int *data , int start, bool is_signed = true); |