Subversion Repositories Projects

Rev

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

#ifndef PARSER_H
#define PARSER_H
#include <string>
#include <cmath>

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


using namespace std;

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

class Parser {
    public:
        static bool decode64(sRxData &rx);
        static string encode64(char data[150],unsigned int length);

        static string add_CRC(string TX);
        static bool check_CRC(string RX);

        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 string dataToString(int Data[150], int Start = 0, int End = 150);
        static int charToData(int data);
};

#endif