Skip to content

Commit

Permalink
Added codeplug limits for the GD-73. Addresses #188.
Browse files Browse the repository at this point in the history
  • Loading branch information
hmatuschek committed Oct 14, 2023
1 parent f9946d3 commit b8299e1
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 5 deletions.
3 changes: 2 additions & 1 deletion doc/code/gd73_settings_element.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
20 | DMR ID, 24bit unsigned int little endian | Pad byte 0x00 |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
24 | Unknonw 0x01 | Unknown 0x00 | Vox level [0,4] | Squelch level [0,9] |
24 | Language | Unknown 0x00 | Vox level [0,4] | Squelch level [0,9] |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
28 | TOT | TX Interrupt enable | Power-save enable | Power save timeout |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
Expand Down Expand Up @@ -52,6 +52,7 @@ a8 ... |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

Where:
- Language: 0x00=Chinese, 0x01=English
- TOT: Transmit timeout, 0=off, ..., 16=180, ..., 48=500s, N = (T-20)/10
- Display mode: 0=Channel Name, 1 = Channel Frequency
- Power-save timeout: Timeout in seconds [10, 60]
Expand Down
4 changes: 2 additions & 2 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ SET(libdmrconf_SOURCES
opengd77.cc opengd77_interface.cc opengd77_codeplug.cc opengd77_extension.cc
opengd77_callsigndb.cc opengd77_limits.cc
openrtx.cc openrtx_interface.cc openrtx_codeplug.cc
c7000device.cc gd73.cc gd73_interface.cc gd73_codeplug.cc gd73_filereader.cc
c7000device.cc gd73.cc gd73_interface.cc gd73_codeplug.cc gd73_filereader.cc gd73_limits.cc
anytone_interface.cc anytone_radio.cc anytone_codeplug.cc anytone_extension.cc anytone_limits.cc
d868uv.cc d868uv_codeplug.cc d868uv_callsigndb.cc d868uv_limits.cc
d878uv.cc d878uv_codeplug.cc d878uv_limits.cc
Expand All @@ -53,7 +53,7 @@ SET(libdmrconf_MOC_HEADERS
gd77.hh gd77_codeplug.hh gd77_callsigndb.hh gd77_limits.hh
opengd77.hh opengd77_interface.hh opengd77_codeplug.hh opengd77_extension.hh
opengd77_callsigndb.hh opengd77_limits.hh
c7000device.hh gd73.hh gd73_interface.hh gd73_codeplug.hh
c7000device.hh gd73.hh gd73_interface.hh gd73_codeplug.hh gd73_limits.hh
openrtx.hh openrtx_interface.hh openrtx_codeplug.hh
anytone_interface.hh anytone_radio.hh anytone_codeplug.hh anytone_extension.hh anytone_limits.hh
d868uv.hh d868uv_codeplug.hh d868uv_callsigndb.hh d868uv_limits.hh
Expand Down
4 changes: 2 additions & 2 deletions lib/gd73.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "gd73.hh"
#include "gd77_limits.hh"
#include "gd73_limits.hh"

#include "logger.hh"
#include "config.hh"
Expand All @@ -25,7 +25,7 @@ GD73::name() const {
const RadioLimits &
GD73::limits() const {
if (nullptr == _limits)
_limits = new GD77Limits();
_limits = new GD73Limits();
return *_limits;
}

Expand Down
151 changes: 151 additions & 0 deletions lib/gd73_limits.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
#include "gd73_limits.hh"
#include "gd73_codeplug.hh"
#include "channel.hh"
#include "radioid.hh"
#include "contact.hh"
#include "rxgrouplist.hh"
#include "zone.hh"
#include "scanlist.hh"
#include "roamingzone.hh"


GD73Limits::GD73Limits(QObject *parent)
: RadioLimits(true, parent)
{
// Define limits for call-sign DB
_hasCallSignDB = false;
_callSignDBImplemented = false;
_numCallSignDBEntries = 0;

/* Define limits for the general settings. */
add("settings",
new RadioLimitItem{
{ "introLine1", new RadioLimitString(-1, GD73Codeplug::SettingsElement::Limit::bootTextLine(), RadioLimitString::Unicode) },
{ "introLine2", new RadioLimitString(-1, GD73Codeplug::SettingsElement::Limit::bootTextLine(), RadioLimitString::Unicode) },
{ "micLevel", new RadioLimitUInt(1, 10) },
{ "speech", new RadioLimitIgnoredBool() },
{ "power", new RadioLimitEnum({unsigned(Channel::Power::Low), unsigned(Channel::Power::High)}) },
{ "squlech", new RadioLimitUInt(0, 10) },
{ "vox", new RadioLimitUInt(0, 10) },
{ "tot", new RadioLimitUInt(0, -1) }
});

/* Define limits for radio IDs. */
add("radioIDs",
new RadioLimitList {
{ DMRRadioID::staticMetaObject, 1, 1, new RadioLimitObject {
{"name", new RadioLimitString(1, GD73Codeplug::SettingsElement::Limit::name(), RadioLimitString::Unicode) },
{"id", new RadioLimitUInt(0, 16777215)}
} }
/// @todo check default radio ID.
});

/* Define limits for contacts. */
add("contacts",
new RadioLimitList{
{ DMRContact::staticMetaObject, 1, GD73Codeplug::ContactBankElement::Limit::contactCount(), new RadioLimitObject {
{ "name", new RadioLimitString(1, GD73Codeplug::ContactElement::Limit::nameLength(), RadioLimitString::Unicode) },
{ "ring", new RadioLimitBool() },
{ "type", new RadioLimitEnum{
(unsigned)DMRContact::PrivateCall,
(unsigned)DMRContact::GroupCall,
(unsigned)DMRContact::AllCall
}},
{ "number", new RadioLimitUInt(0, 16777215) }
} }
});

/* Define limits for group lists. */
add("groupLists",
new RadioLimitList(
RXGroupList::staticMetaObject, 1, GD73Codeplug::GroupListBankElement::Limit::memberCount(), new RadioLimitObject {
{ "name", new RadioLimitString(1, GD73Codeplug::GroupListElement::Limit::nameLength(), RadioLimitString::Unicode) },
{ "contacts", new RadioLimitGroupCallRefList(1, GD73Codeplug::GroupListElement::Limit::memberCount()) }
}));

/* Define limits for channel list. */
add("channels",
new RadioLimitList(
Channel::staticMetaObject, 1, GD73Codeplug::ChannelBankElement::Limit::channelCount(),
new RadioLimitObjects {
{ FMChannel::staticMetaObject,
new RadioLimitObject {
{"name", new RadioLimitString(1, GD73Codeplug::ChannelElement::Limit::nameLength(), RadioLimitString::Unicode)},
{"rxFrequency", new RadioLimitFrequencies({{Frequency::fromMHz(400.), Frequency::fromMHz(470.)}}, true)},
{"txFrequency", new RadioLimitTransmitFrequencies({{Frequency::fromMHz(400.), Frequency::fromMHz(470.)}})},
{"power", new RadioLimitEnum{unsigned(Channel::Power::Low), unsigned(Channel::Power::High)}},
{"timeout", new RadioLimitUInt(0, 3825, std::numeric_limits<unsigned>::max())},
{"scanlist", new RadioLimitObjRef(ScanList::staticMetaObject)},
{"vox", new RadioLimitUInt(0, 10, std::numeric_limits<unsigned>::max())},
{"rxOnly", new RadioLimitBool()},
{"admit", new RadioLimitEnum{
(unsigned)FMChannel::Admit::Always,
(unsigned)FMChannel::Admit::Free,
(unsigned)FMChannel::Admit::Tone
} },
{"squelch", new RadioLimitUInt(0, 10, std::numeric_limits<unsigned>::max())},
{"bandwidth", new RadioLimitEnum{
(unsigned)FMChannel::Bandwidth::Narrow,
(unsigned)FMChannel::Bandwidth::Wide
}},
{"aprs", new RadioLimitObjRefIgnored()},
{"openGD77", new RadioLimitIgnored()},
{"tyt", new RadioLimitIgnored()}
} },
{ DMRChannel::staticMetaObject,
new RadioLimitObject {
{"name", new RadioLimitString(1, GD73Codeplug::ChannelElement::Limit::nameLength(), RadioLimitString::Unicode)},
{"rxFrequency", new RadioLimitFrequencies({{Frequency::fromMHz(400.), Frequency::fromMHz(470.)}}, true)},
{"txFrequency", new RadioLimitTransmitFrequencies({{Frequency::fromMHz(400.), Frequency::fromMHz(470.)}})},
{"power", new RadioLimitEnum{unsigned(Channel::Power::Low), unsigned(Channel::Power::High)}},
{"timeout", new RadioLimitUInt(0, 3825, std::numeric_limits<unsigned>::max())},
{"scanlist", new RadioLimitObjRef(ScanList::staticMetaObject)},
{"vox", new RadioLimitUInt(0, 10, std::numeric_limits<unsigned>::max())},
{"rxOnly", new RadioLimitBool()},
{"admit", new RadioLimitEnum {
unsigned(DMRChannel::Admit::Always),
unsigned(DMRChannel::Admit::Free),
unsigned(DMRChannel::Admit::ColorCode) } },
{"colorCode", new RadioLimitUInt(0,16)},
{"timeSlot", new RadioLimitEnum {
unsigned(DMRChannel::TimeSlot::TS1),
unsigned(DMRChannel::TimeSlot::TS2) } },
{"radioID", new RadioLimitObjRef(RadioID::staticMetaObject, true)},
{"groupList", new RadioLimitObjRef(RXGroupList::staticMetaObject, false)},
{"contact", new RadioLimitObjRef(DMRContact::staticMetaObject, true)},
{"aprs", new RadioLimitObjRefIgnored()},
{"roaming", new RadioLimitObjRefIgnored(DefaultRoamingZone::get())},
{"openGD77", new RadioLimitIgnored(RadioLimitIssue::Hint)},
{"tyt", new RadioLimitIgnored(RadioLimitIssue::Hint)}
} }
} ));

/* Define limits for zone list. */
add("zones",
new RadioLimitList(
Zone::staticMetaObject, 1, GD73Codeplug::ZoneBankElement::Limit::zoneCount(), new RadioLimitSingleZone(
GD73Codeplug::ZoneElement::Limit::channelCount(), {
{ "name", new RadioLimitString(1, GD73Codeplug::ZoneElement::Limit::nameLength(), RadioLimitString::Unicode) },
{ "anytone", new RadioLimitIgnored(RadioLimitIssue::Hint) } // ignore AnyTone extensions
})
) );

/* Ignore scan lists. */
add("scanlists", new RadioLimitList(
ScanList::staticMetaObject, 1, GD73Codeplug::ScanListBankElement::Limit::memberCount(), new RadioLimitObject{
{ "name", new RadioLimitString(1, GD73Codeplug::ScanListElement::Limit::nameLength(), RadioLimitString::Unicode) },
{ "primary", new RadioLimitObjRef(Channel::staticMetaObject, false) },
{ "secondary", new RadioLimitObjRef(Channel::staticMetaObject, true) },
{ "revert", new RadioLimitObjRef(Channel::staticMetaObject, true) },
{ "channels", new RadioLimitRefList(0, GD73Codeplug::ScanListElement::Limit::memberCount(), Channel::staticMetaObject) }
}));

/* Ignore positioning systems. */
add("positioning", new RadioLimitList(
ConfigObject::staticMetaObject, -1, -1, new RadioLimitIgnored()) );

/* Ignore roaming zones. */
add("roaming",
new RadioLimitList(
ConfigObject::staticMetaObject, -1, -1, new RadioLimitIgnored()) );
}
17 changes: 17 additions & 0 deletions lib/gd73_limits.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef GD73LIMITS_HH
#define GD73LIMITS_HH

#include "radiolimits.hh"

/** Implements the limits for the Radioddity GD77.
* @ingroup gd73 */
class GD73Limits: public RadioLimits
{
Q_OBJECT

public:
/** Constructor. */
explicit GD73Limits(QObject *parent=nullptr);
};

#endif // GD73LIMITS_HH

0 comments on commit b8299e1

Please sign in to comment.