Subversion Repositories Projects

Rev

Rev 440 | Rev 450 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef PARSER_H
#define PARSER_H
#include <cmath>

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

/*
struct sRxData
{
    char *input;
    int decode[150];
    int decLen;
};
*/

class Parser {
    public:
        void create_frame(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(int *data , int start, bool is_signed = true);
        static long dataToLong(int *data , int start, bool is_signed = true);
        static int dataToChar(int *data , int start, bool is_signed = true);
        static int charToData(int data);
};

#endif