Rework ReflectorLogic command structure

The command structure for the ReflectorLogic has now been reworked for
better usability. Each command is prefixed with the prefix specified in
the logic linking configuration but that has been left out in the list
below, as well as the # command termination symbol.

*    -- info/status
1    -- Select previous TG
1nnn -- Select TG nnn
2    -- QSY to "private" TG
2nnn -- QSY to TG nnn
3    -- Follow last QSY
This commit is contained in:
Tobias Blomberg 2019-09-28 19:40:30 +02:00
parent ced46314d3
commit 6b1d610153
3 changed files with 50 additions and 24 deletions

View File

@ -319,11 +319,38 @@ void ReflectorLogic::remoteCmdReceived(LogicBase* src_logic,
{
processEvent("report_tg_status");
}
else if (cmd.substr(0, 2) == "*1") // QSY
//else if (cmd[0] == '0') // Help
//{
//}
else if (cmd[0] == '1') // Select TG
{
const std::string subcmd(cmd.substr(1));
if (!subcmd.empty()) // Select specified TG
{
istringstream is(subcmd);
uint32_t tg;
if (is >> tg)
{
selectTg(tg, "tg_command_activation");
m_tg_local_activity = true;
}
else
{
processEvent(std::string("command_failed ") + cmd);
}
}
else // Select previous TG
{
selectTg(m_previous_tg, "tg_command_activation");
m_tg_local_activity = true;
}
}
else if (cmd[0] == '2') // QSY
{
if ((m_selected_tg != 0) && isLoggedIn())
{
const std::string subcmd(cmd.substr(2));
const std::string subcmd(cmd.substr(1));
if (subcmd.empty())
{
cout << name() << ": Requesting QSY to random TG" << endl;
@ -349,7 +376,7 @@ void ReflectorLogic::remoteCmdReceived(LogicBase* src_logic,
processEvent(std::string("command_failed ") + cmd);
}
}
else if (cmd == "*2") // Follow last QSY
else if (cmd == "3") // Follow last QSY
{
if ((m_last_qsy > 0) && (m_last_qsy != m_selected_tg))
{
@ -361,19 +388,9 @@ void ReflectorLogic::remoteCmdReceived(LogicBase* src_logic,
processEvent(std::string("command_failed ") + cmd);
}
}
else // Choose TG
else
{
istringstream is(cmd);
uint32_t tg;
if (is >> tg)
{
selectTg(tg, "tg_command_activation");
m_tg_local_activity = true;
}
else
{
processEvent(std::string("command_failed ") + cmd);
}
processEvent(std::string("unknown_command ") + cmd);
}
} /* ReflectorLogic::remoteCmdReceived */

View File

@ -35,6 +35,23 @@ if {$logic_name != [namespace tail [namespace current]]} {
}
#
# Executed when an unknown command is received
# cmd - The command string
#
proc unknown_command {cmd} {
Logic::unknown_command $cmd;
}
#
# Executed when a received command fails
#
proc command_failed {cmd} {
Logic::command_failed $cmd;
}
#
# Executed when manual TG announcement is triggered
#
@ -195,14 +212,6 @@ proc tg_selection_timeout {new_tg old_tg} {
}
#
# Executed when an entered DTMF command failed
#
proc command_failed {cmd} {
Logic::command_failed $cmd;
}
#
# Executed on talker start
#

View File

@ -11,7 +11,7 @@ LIBECHOLIB=1.3.3
LIBASYNC=1.6.0.99.2-reflector_tg
# SvxLink versions
SVXLINK=1.7.99.4-reflector_tg
SVXLINK=1.7.99.5-reflector_tg
MODULE_HELP=1.0.0
MODULE_PARROT=1.1.1
MODULE_ECHO_LINK=1.5.0