Subversion Repositories Projects

Rev

Rev 449 | Rev 451 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 449 Rev 450
Line 1... Line 1...
1
#ifndef PARSER_H
1
#ifndef PARSER_H
2
#define PARSER_H
2
#define PARSER_H
-
 
3
#include "Kopter.h"
3
#include <cmath>
4
#include <cmath>
-
 
5
#include <string>
4
 
6
 
5
/**
7
/**
6
 * The Parser gets values from the Mikrokopter-USART interface
8
 * The Parser gets values from the Mikrokopter-USART interface
7
 *  and parses them into a sRxData-Struct
9
 *  and parses them into a sRxData-Struct
8
 */
10
 */
Line 14... Line 16...
14
    int decLen;
16
    int decLen;
15
};
17
};
16
*/
18
*/
17
class Parser {
19
class Parser {
18
    public:
20
    public:
19
        void create_frame(char cmd, int address, char * data, unsigned int length);
21
        static void create_frame(char cmd, int address, char * data, unsigned int length);
20
 
22
 
21
        static int decode64(char * data, int len, unsigned char *ptrOut, int offset);
23
        static int decode64(char * data, int len, unsigned char *ptrOut, int offset);
22
        static void encode64(char data[150],unsigned int length);
24
        static void encode64(char data[150],unsigned int length);
23
 
25
 
24
        static void add_CRC(char * tx, int length);
26
        static void add_CRC(char * tx, int length);
25
        static bool check_CRC(char * rx, int length);
27
        static bool check_CRC(char * rx, int length);
26
 
28
 
27
        static float getFloat(long value, int count);
29
        static float getFloat(long value, int count);
28
 
30
 
29
        static int dataToInt(int *data , int start, bool is_signed = true);
31
        static int dataToInt(char *data , int start, bool is_signed = true);
30
        static long dataToLong(int *data , int start, bool is_signed = true);
32
        static long dataToLong(char *data , int start, bool is_signed = true);
31
        static int dataToChar(int *data , int start, bool is_signed = true);
33
        static int dataToChar(char *data , int start, bool is_signed = true);
-
 
34
        static std::string dataToString(char * data, int start, int end);
32
        static int charToData(int data);
35
        static int charToData(int data);
33
};
36
};
34
 
37
 
35
#endif
38
#endif