Subversion Repositories Projects

Rev

Rev 451 | Details | Compare with Previous | Last modification | View Log | RSS feed

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