Skip to content

Commit

Permalink
Fixed encoding of group list indices for OpenGD77 channels. Addresses #…
Browse files Browse the repository at this point in the history
  • Loading branch information
hmatuschek authored Jan 24, 2025
1 parent 3c85868 commit fe6361c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/opengd77base_codeplug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ OpenGD77BaseCodeplug::ChannelElement::clear() {
enablePowerSave(false);
enableBeep(false);
clearDMRId();
setGroupListIndex(0);
clearGroupListIndex();
setColorCode(0);
clearAPRSIndex();
clearTXContact();
Expand Down
31 changes: 31 additions & 0 deletions test/opengd77_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,37 @@ OpenGD77Test::testChannelFrequency() {
}


void
OpenGD77Test::testChannelGroupList() {
ErrorStack err;

Config config, decoded;
if (! config.readYAML(":/data/config_test.yaml", err))
QFAIL(QString("Cannot open codeplug file: %1")
.arg(err.format()).toLocal8Bit().constData());

config.channelList()->channel(0)->as<DMRChannel>()->setGroupListObj(nullptr);
config.channelList()->channel(0)->as<DMRChannel>()->setTXContactObj(nullptr);
config.channelList()->channel(1)->as<DMRChannel>()->setTXContactObj(nullptr);
config.channelList()->channel(2)->as<DMRChannel>()->setGroupListObj(nullptr);

if (! encodeDecode(config, decoded, err))
QFAIL(err.format().toLocal8Bit().constData());

QVERIFY(decoded.channelList()->channel(0)->as<DMRChannel>()->groupList()->isNull());
QVERIFY(decoded.channelList()->channel(0)->as<DMRChannel>()->contact()->isNull());

QVERIFY(! decoded.channelList()->channel(1)->as<DMRChannel>()->groupList()->isNull());
QVERIFY(decoded.channelList()->channel(1)->as<DMRChannel>()->contact()->isNull());

QVERIFY(decoded.channelList()->channel(2)->as<DMRChannel>()->groupList()->isNull());
QVERIFY(! decoded.channelList()->channel(2)->as<DMRChannel>()->contact()->isNull());

QVERIFY(! decoded.channelList()->channel(3)->as<DMRChannel>()->groupList()->isNull());
QVERIFY(decoded.channelList()->channel(3)->as<DMRChannel>()->contact()->isNull());
}


void
OpenGD77Test::testChannelPowerSettings() {
ErrorStack err;
Expand Down
2 changes: 2 additions & 0 deletions test/opengd77_test.hh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ private slots:
void testBasicConfigDecoding();
void testChannelFrequency();

/** Regression test for #539. */
void testChannelGroupList();
/** Regression test for #507 */
void testChannelPowerSettings();
/** Regression test for #541. */
Expand Down

0 comments on commit fe6361c

Please sign in to comment.