Subversion Repositories Projects

Rev

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

#ifndef PARSER_H
#define PARSER_H
#include "Kopter.h"
#include "FlightLog.h"
#include <cmath>
#include <string>

/**
 * The Parser gets values from the Mikrokopter-USART interface
 *  and parses them into a sRxData-Struct
 */


class Parser {
    public:
        static void create_frame(char * send_data, char cmd, int address, char * data, unsigned int length);

        static int decode64(char * data, int len, unsigned char *ptrOut, int offset);
        static void encode64(char data[150],unsigned int length);

        static void add_CRC(char * tx, int length);
        static bool check_CRC(char * rx, int length);

        static float getFloat(long value, int count);

        static int dataToInt(char *data , int start, bool is_signed = true);
        static long dataToLong(char *data , int start, bool is_signed = true);
        static int dataToChar(char *data , int start, bool is_signed = true);
        static std::string dataToString(char * data, int start, int end);
        static int charToData(int data);
};

#endif