Make TX volatge for simu more flexible (#7124)
[opentx.git] / companion / src / firmwares / er9x / er9xinterface.h
blobec3d9cc1a1b930655d49601d5753f0c860b0242b
1 /*
2 * Copyright (C) OpenTX
4 * Based on code named
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 _ER9XINTERFACE_H_
22 #define _ER9XINTERFACE_H_
24 #include <QtXml>
25 #include "eeprominterface.h"
26 #include "er9xeeprom.h"
28 class RleFile;
30 class Er9xInterface : public EEPROMInterface
32 public:
34 Er9xInterface();
36 virtual ~Er9xInterface();
38 virtual const char * getName();
40 virtual unsigned long load(RadioData &, const uint8_t * eeprom, int size);
42 virtual unsigned long loadBackup(RadioData &, const uint8_t * eeprom, int esize, int index);
44 virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc);
46 virtual int save(uint8_t * eeprom, const RadioData & radioData, uint8_t version=0, uint32_t variant=0)
48 return 0;
51 virtual int getSize(const ModelData &);
53 virtual int getSize(const GeneralSettings &settings);
55 virtual bool isAvailable(PulsesProtocol proto, int port=0);
57 virtual int getCapability(Capability capability);
59 protected:
61 RleFile * efile;
63 private:
64 void appendTextElement(QDomDocument * qdoc, QDomElement * pe, QString name, QString value);
66 void appendNumberElement(QDomDocument * qdoc, QDomElement * pe,QString name, int value, bool forceZeroWrite = false);
68 void appendCDATAElement(QDomDocument * qdoc, QDomElement * pe,QString name, const char * data, int size);
70 QDomElement getGeneralDataXML(QDomDocument * qdoc, Er9xGeneral * tgen); //parse out data to XML format
72 QDomElement getModelDataXML(QDomDocument * qdoc, Er9xModelData * tmod, int modelNum, int mdver); //parse out data to XML format
74 bool loadRadioSettingsDataXML(QDomDocument * qdoc, Er9xGeneral * tgen); // get data from XML
76 bool loadModelDataXML(QDomDocument * qdoc, Er9xModelData * tmod, int modelNum = -1); // get data from XML
80 #endif // _ER9XINTERFACE_H_