Subversion Repositories Projects

Rev

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

/***************************************************************************
 *   Copyright (C) 2009 by Manuel Schrape                                  *
 *   manuel.schrape@gmx.de                                                 *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License.        *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef HANDLERMK_H
#define HANDLERMK_H

#include <QString>

#include "../Kopter.h"
#include "../MK_Datatypes.h"

struct s_Hardware
{
    int ID;
    int VERSION_MAJOR;
    int VERSION_MINOR;
    int VERSION_PATCH;
    int VERSION_SERIAL_MAJOR;
    int VERSION_SERIAL_MINOR;
    QString Hardware;
    QString Version;
    QString VersionShort;
};


class HandlerMK
{
    public:
        HandlerMK();

        static int Data2Int(unsigned char Data[150], int Start, bool is_signed = true);
        static QString Data2QString(unsigned char Data[150], int Start, int End);

        static QString add_CRC(QString TXString);
        static bool Check_CRC(char *t_InData, int Length);

        static int Decode_64(char *t_InData, int Length, unsigned char *t_OutData);
        static QString Encode64(char Data[150],unsigned int Length);
        static QString make_Frame(char t_CMD, int t_Adress, char t_Data[150], unsigned int t_Length);

        static QString get_SelectFC();
        static QString get_SelectNC();
        static QString get_SelectMK3MAG();

        static s_Hardware parse_Version(unsigned char *t_Data, int Adress);

        static double Int2Double(int32_t Wert, int Count);
};

#endif // HANDLERMK_H