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>
Line 4... Line 6...
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
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);
Line 20... Line 22...
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);
Line 22... Line 24...
22
        static void encode64(char data[150],unsigned int length);
24
        static void encode64(char data[150],unsigned int length);
23
 
25
 
Line 24... Line 26...
24
        static void add_CRC(char * tx, int length);
26
        static void add_CRC(char * tx, int length);
Line 25... Line 27...
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);
-
 
30
 
28
 
31
        static int dataToInt(char *data , int start, bool is_signed = true);
29
        static int dataToInt(int *data , int start, bool is_signed = true);
32
        static long dataToLong(char *data , int start, bool is_signed = true);
Line 30... Line 33...
30
        static long dataToLong(int *data , int start, bool is_signed = true);
33
        static int dataToChar(char *data , int start, bool is_signed = true);