mirror of
https://github.com/g4klx/MMDVMHost.git
synced 2026-04-05 22:45:31 +00:00
Add remote control interface.
This commit is contained in:
parent
5de3beef61
commit
42a48209d4
15 changed files with 187 additions and 12 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015-2019 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -28,6 +28,7 @@
|
|||
#include "P25Control.h"
|
||||
#include "NXDNControl.h"
|
||||
#include "POCSAGControl.h"
|
||||
#include "RemoteControl.h"
|
||||
#include "Thread.h"
|
||||
#include "Log.h"
|
||||
#include "GitVersion.h"
|
||||
|
|
@ -582,6 +583,23 @@ int CMMDVMHost::run()
|
|||
pocsagTimer.start();
|
||||
}
|
||||
|
||||
CRemoteControl* remoteControl = NULL;
|
||||
bool remoteControlEnabled = m_conf.getRemoteControlEnabled();
|
||||
if (remoteControlEnabled) {
|
||||
unsigned int port = m_conf.getRemoteControlPort();
|
||||
|
||||
LogInfo("Remote Control Parameters");
|
||||
LogInfo(" Port; %u", port);
|
||||
|
||||
remoteControl = new CRemoteControl(port);
|
||||
|
||||
ret = remoteControl->open();
|
||||
if (!ret) {
|
||||
delete remoteControl;
|
||||
remoteControl = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
setMode(MODE_IDLE);
|
||||
|
||||
LogMessage("MMDVMHost-%s is running", VERSION);
|
||||
|
|
@ -908,6 +926,17 @@ int CMMDVMHost::run()
|
|||
m_modem->writeTransparentData(data, len);
|
||||
}
|
||||
|
||||
if (remoteControl != NULL) {
|
||||
REMOTE_COMMAND command = remoteControl->getCommand();
|
||||
switch(command) {
|
||||
case RC_FORCE_IDLE:
|
||||
setMode(MODE_IDLE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int ms = stopWatch.elapsed();
|
||||
stopWatch.start();
|
||||
|
||||
|
|
@ -1051,6 +1080,11 @@ int CMMDVMHost::run()
|
|||
delete transparentSocket;
|
||||
}
|
||||
|
||||
if (remoteControl != NULL) {
|
||||
remoteControl->close();
|
||||
delete remoteControl;
|
||||
}
|
||||
|
||||
delete dstar;
|
||||
delete dmr;
|
||||
delete ysf;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue