5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #ifndef _OPENTXINTERFACE_H_
22 #define _OPENTXINTERFACE_H_
24 #include "eeprominterface.h"
29 class OpenTxEepromInterface
: public EEPROMInterface
33 OpenTxEepromInterface(OpenTxFirmware
* firmware
);
35 virtual ~OpenTxEepromInterface();
37 virtual unsigned long load(RadioData
&, const uint8_t * eeprom
, int size
);
39 bool loadModelFromBackup(ModelData
& model
, const uint8_t * data
, unsigned int size
, uint8_t version
, uint32_t variant
);
41 virtual unsigned long loadBackup(RadioData
&, const uint8_t * eeprom
, int esize
, int index
);
43 virtual int save(uint8_t * eeprom
, const RadioData
& radioData
, uint8_t version
=0, uint32_t variant
=0);
45 virtual int getSize(const ModelData
&);
47 virtual int getSize(const GeneralSettings
&);
51 const char * getName();
53 EepromLoadErrors
checkVersion(unsigned int version
);
55 bool checkVariant(unsigned int version
, unsigned int variant
);
57 template <class T
, class M
>
58 bool loadFromByteArray(T
& dest
, const QByteArray
& data
, uint8_t version
, uint32_t variant
=0);
61 template <class T
, class M
>
62 bool loadFromByteArray(T
& dest
, const QByteArray
& data
);
64 template <class T
, class M
>
65 bool saveToByteArray(const T
& src
, QByteArray
& data
, uint8_t version
=0);
67 bool loadRadioSettingsFromRLE(GeneralSettings
& settings
, RleFile
* rleFile
, uint8_t version
);
69 bool loadModelFromRLE(ModelData
& model
, RleFile
* rleFile
, unsigned int index
, uint8_t version
, uint32_t variant
);
72 bool saveModel(unsigned int index
, ModelData
& model
, uint8_t version
, uint32_t variant
);
75 bool saveRadioSettings(GeneralSettings
& settings
, BoardEnum board
, uint8_t version
, uint32_t variant
);
77 uint8_t getLastDataVersion(BoardEnum board
);
83 OpenTxFirmware
* firmware
;
87 class OpenTxFirmware
: public Firmware
90 OpenTxFirmware(const QString
& id
, OpenTxFirmware
* parent
):
91 Firmware(parent
, id
, parent
->getName(), parent
->getBoard())
93 setEEpromInterface(parent
->getEEpromInterface());
96 OpenTxFirmware(const QString
& id
, const QString
& name
, const BoardEnum board
):
97 Firmware(id
, name
, board
)
110 addTTSLanguage("en");
111 addTTSLanguage("cz");
112 addTTSLanguage("de");
113 addTTSLanguage("es");
114 addTTSLanguage("fr");
115 addTTSLanguage("hu");
116 addTTSLanguage("it");
117 addTTSLanguage("nl");
118 addTTSLanguage("pl");
119 addTTSLanguage("pt");
120 addTTSLanguage("se");
121 addTTSLanguage("sk");
124 virtual Firmware
* getFirmwareVariant(const QString
& id
);
126 virtual QString
getStampUrl();
128 virtual QString
getReleaseNotesUrl();
130 virtual QString
getFirmwareUrl();
132 virtual int getCapability(Capability
);
134 virtual QString
getAnalogInputName(unsigned int index
);
136 virtual QTime
getMaxTimerStart();
138 virtual int isAvailable(PulsesProtocol proto
, int port
=0);
142 QString
getFirmwareBaseUrl();
146 void registerOpenTxFirmwares();
147 void unregisterOpenTxFirmwares();
149 extern QList
<OpenTxEepromInterface
*> opentxEEpromInterfaces
;
151 OpenTxEepromInterface
* loadModelFromByteArray(ModelData
& model
, const QByteArray
& data
);
152 OpenTxEepromInterface
* loadRadioSettingsFromByteArray(GeneralSettings
& settings
, const QByteArray
& data
);
154 bool writeModelToByteArray(const ModelData
& model
, QByteArray
& data
);
155 bool writeRadioSettingsToByteArray(const GeneralSettings
& settings
, QByteArray
& data
);
157 #endif // _OPENTXINTERFACE_H_