Remote shutdown

* add xmlrpc command string "rig.shutdown"
    - provides remote shutdown of both flrig and
      transceiver if capable and configured
This commit is contained in:
David Freese 2020-02-28 11:08:09 -06:00
parent 043a4391ce
commit 00f1c3fffc
2 changed files with 30 additions and 5 deletions

View file

@ -1820,6 +1820,27 @@ public:
} rig_cat_string(&rig_server);
static void shutdown(void *)
{
cbExit();
}
class rig_shutdown : public XmlRpcServerMethod {
public:
rig_shutdown(XmlRpcServer* s) : XmlRpcServerMethod("rig.shutdown", s) {}
void execute(XmlRpcValue& params, XmlRpcValue& result) {
if (!xcvr_initialized) {
result = 0;
return;
}
Fl::awake(shutdown, static_cast<void *>(0));
}
std::string help() { return std::string("turn off rig / close flrig"); }
} rig_shutdown(&rig_server);
struct MLIST {
string name; string signature; string help;
} mlist[] = {
@ -1869,7 +1890,8 @@ struct MLIST {
{ "rig.set_rfgain", "i:i", "sets rf gain control" },
{ "rig.set_micgain", "i:i", "sets mic gain control" },
{ "rig.swap", "i:i", "execute vfo swap" },
{ "rig.cat_string", "s:s", "execute CAT string" }
{ "rig.cat_string", "s:s", "execute CAT string" },
{ "rig.shutdown", "i:i", "shutdown xcvr & flrig" }
};
class rig_list_methods : public XmlRpcServerMethod {

View file

@ -3290,9 +3290,9 @@ void close_UI()
}
pthread_join(*serial_thread, NULL);
// xcvr auto off
if (selrig->has_xcvr_auto_on_off && progStatus.xcvr_auto_off)
selrig->set_xcvr_auto_off();
// xcvr auto off
// if (selrig->has_xcvr_auto_on_off && progStatus.xcvr_auto_off)
// selrig->set_xcvr_auto_off();
// close down the serial port
RigSerial->ClosePort();
@ -3315,7 +3315,10 @@ void closeRig()
if (xcvr_initialized) {
restore_rig_vals();
selrig->shutdown();
}
// xcvr auto off
if (selrig->has_xcvr_auto_on_off && progStatus.xcvr_auto_off)
selrig->set_xcvr_auto_off();
}
close_rig = false;
}