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
);
71 void showErrors(const QString
& title
, const QStringList
& errors
);
73 uint8_t getLastDataVersion(Board::Type board
);
77 OpenTxFirmware
* firmware
;
81 class OpenTxFirmware
: public Firmware
84 OpenTxFirmware(const QString
& id
, OpenTxFirmware
* parent
):
85 Firmware(parent
, id
, parent
->getName(), parent
->getBoard())
87 setEEpromInterface(parent
->getEEpromInterface());
90 OpenTxFirmware(const QString
& id
, const QString
& name
, const Board::Type board
):
91 Firmware(id
, name
, board
)
104 addTTSLanguage("en");
105 addTTSLanguage("cz");
106 addTTSLanguage("de");
107 addTTSLanguage("es");
108 addTTSLanguage("fr");
109 addTTSLanguage("hu");
110 addTTSLanguage("it");
111 addTTSLanguage("nl");
112 addTTSLanguage("pl");
113 addTTSLanguage("pt");
114 addTTSLanguage("se");
115 addTTSLanguage("sk");
118 virtual Firmware
* getFirmwareVariant(const QString
& id
);
120 virtual QString
getStampUrl();
122 virtual QString
getReleaseNotesUrl();
124 virtual QString
getFirmwareUrl();
126 virtual int getCapability(Capability
);
128 virtual QString
getAnalogInputName(unsigned int index
);
130 virtual QTime
getMaxTimerStart();
132 virtual int isAvailable(PulsesProtocol proto
, int port
=0);
136 QString
getFirmwareBaseUrl();
140 void registerOpenTxFirmwares();
141 void unregisterOpenTxFirmwares();
143 extern QList
<OpenTxEepromInterface
*> opentxEEpromInterfaces
;
145 OpenTxEepromInterface
* loadModelFromByteArray(ModelData
& model
, const QByteArray
& data
);
146 OpenTxEepromInterface
* loadRadioSettingsFromByteArray(GeneralSettings
& settings
, const QByteArray
& data
);
148 bool writeModelToByteArray(const ModelData
& model
, QByteArray
& data
);
149 bool writeRadioSettingsToByteArray(const GeneralSettings
& settings
, QByteArray
& data
);
151 #endif // _OPENTXINTERFACE_H_