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