From b43a35434382b493e75fd121d2a58f5fa964bac6 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Mon, 7 Jan 2019 13:54:52 +0000 Subject: [PATCH] Expand range of commands. --- MMDVMHost.cpp | 20 +++++++++++++++++++- RemoteControl.cpp | 16 ++++++++++++++-- RemoteControl.h | 8 +++++++- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index 1f46391..bcce877 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -929,9 +929,27 @@ int CMMDVMHost::run() if (remoteControl != NULL) { REMOTE_COMMAND command = remoteControl->getCommand(); switch(command) { - case RC_FORCE_IDLE: + case RC_MODE_IDLE: setMode(MODE_IDLE); break; + case RC_MODE_LOCKOUT: + setMode(MODE_LOCKOUT); + break; + case RC_MODE_DSTAR: + setMode(MODE_DSTAR); + break; + case RC_MODE_DMR: + setMode(MODE_DMR); + break; + case RC_MODE_YSF: + setMode(MODE_YSF); + break; + case RC_MODE_P25: + setMode(MODE_P25); + break; + case RC_MODE_NXDN: + setMode(MODE_NXDN); + break; default: break; } diff --git a/RemoteControl.cpp b/RemoteControl.cpp index e60a2c3..1ad6cf3 100644 --- a/RemoteControl.cpp +++ b/RemoteControl.cpp @@ -47,8 +47,20 @@ REMOTE_COMMAND CRemoteControl::getCommand() unsigned int port; int ret = m_socket.read(buffer, BUFFER_LENGTH, address, port); if (ret > 0) { - if (::memcmp(buffer, "0", 1U) == 0) - command = RC_FORCE_IDLE; + if (::memcmp(buffer, "mode idle", 9U) == 0) + command = RC_MODE_IDLE; + else if (::memcmp(buffer, "mode lockout", 12U) == 0) + command = RC_MODE_LOCKOUT; + else if (::memcmp(buffer, "mode dstar", 10U) == 0) + command = RC_MODE_DSTAR; + else if (::memcmp(buffer, "mode dmr", 8U) == 0) + command = RC_MODE_DMR; + else if (::memcmp(buffer, "mode ysf", 8U) == 0) + command = RC_MODE_YSF; + else if (::memcmp(buffer, "mode p25", 8U) == 0) + command = RC_MODE_P25; + else if (::memcmp(buffer, "mode nxdn", 9U) == 0) + command = RC_MODE_NXDN; } return command; diff --git a/RemoteControl.h b/RemoteControl.h index 4d0360d..5de6ad3 100644 --- a/RemoteControl.h +++ b/RemoteControl.h @@ -23,7 +23,13 @@ enum REMOTE_COMMAND { RC_NONE, - RC_FORCE_IDLE + RC_MODE_IDLE, + RC_MODE_LOCKOUT, + RC_MODE_DSTAR, + RC_MODE_DMR, + RC_MODE_YSF, + RC_MODE_P25, + RC_MODE_NXDN }; class CRemoteControl {