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 OPENTX_MULTI_H
22 #define OPENTX_MULTI_H
27 #include <QStringList>
29 #define MM_RF_CUSTOM_SELECTED 0xff
35 struct radio_mm_definition
{
37 unsigned int maxSubtype
;
39 QStringList protocols
;
43 struct MultiProtocolDefinition
{
45 const bool hasFailsafe
;
46 const QStringList subTypeStrings
;
47 const QString optionsstr
;
49 unsigned int numSubytes() const
51 return (unsigned int) subTypeStrings
.length();
54 int getOptionMin() const;
56 int getOptionMax() const;
58 MultiProtocolDefinition(const radio_mm_definition
&rd
) :
59 protocol(rd
.protocol
),
60 hasFailsafe(rd
.hasFailsafe
),
61 subTypeStrings(rd
.protocols
),
62 optionsstr(rd
.optionsstr
)
64 Q_ASSERT(rd
.maxSubtype
+ 1 == (unsigned int) rd
.protocols
.length());
68 Multiprotocols(std::initializer_list
<radio_mm_definition
> l
)
70 for (radio_mm_definition rd
: l
)
71 protocols
.push_back(MultiProtocolDefinition(rd
));
74 const MultiProtocolDefinition
&getProtocol(int protocol
) const;
78 std::vector
<MultiProtocolDefinition
> protocols
;
82 extern const Multiprotocols multiProtocols
;
84 #endif //OPENTX_MULTI_H