Subversion Repositories Projects

Rev

Rev 451 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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