Subversion Repositories Projects

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
674 KeyOz 1
/***************************************************************************
2
 *   Copyright (C) 2009 by Manuel Schrape                                  *
3
 *   manuel.schrape@gmx.de                                                 *
4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation; either version 2 of the License.        *
8
 *                                                                         *
9
 *   This program is distributed in the hope that it will be useful,       *
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12
 *   GNU General Public License for more details.                          *
13
 *                                                                         *
14
 *   You should have received a copy of the GNU General Public License     *
15
 *   along with this program; if not, write to the                         *
16
 *   Free Software Foundation, Inc.,                                       *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18
 ***************************************************************************/
19
#ifndef HANDLERMK_H
20
#define HANDLERMK_H
21
 
22
#include <QString>
23
 
24
#include "../Kopter.h"
25
#include "../MK_Datatypes.h"
26
 
27
struct s_Hardware
28
{
29
    int ID;
30
    int VERSION_MAJOR;
31
    int VERSION_MINOR;
32
    int VERSION_PATCH;
33
    int VERSION_SERIAL_MAJOR;
34
    int VERSION_SERIAL_MINOR;
35
    QString Hardware;
36
    QString Version;
37
    QString VersionShort;
38
};
39
 
40
 
41
class HandlerMK
42
{
43
    public:
44
        HandlerMK();
45
 
46
        static int Data2Int(unsigned char Data[150], int Start, bool is_signed = true);
47
        static QString Data2QString(unsigned char Data[150], int Start, int End);
48
 
49
        static QString add_CRC(QString TXString);
50
        static bool Check_CRC(char *t_InData, int Length);
51
 
52
        static int Decode_64(char *t_InData, int Length, unsigned char *t_OutData);
53
        static QString Encode64(char Data[150],unsigned int Length);
54
        static QString make_Frame(char t_CMD, int t_Adress, char t_Data[150], unsigned int t_Length);
55
 
56
        static QString get_SelectFC();
57
        static QString get_SelectNC();
58
        static QString get_SelectMK3MAG();
59
 
60
        static s_Hardware parse_Version(unsigned char *t_Data, int Adress);
61
 
62
        static double Int2Double(int32_t Wert, int Count);
63
};
64
 
65
#endif // HANDLERMK_H