Subversion Repositories Projects

Rev

Rev 391 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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