g4klx / DMRGateway

A multi-network DMR gateway for the MMDVM.
GNU General Public License v2.0
141 stars 91 forks source link

Implement remote command support. #103

Closed f1rmb closed 3 years ago

f1rmb commented 3 years ago

Status are:

A returned string is expected from the socket connection, this is why I did not reuse the MMDVMHost's RemoteCommand (unless MMDVMHost RemoteControl is modified as well). EDIT: I raised a PR in MMDVMHost #688, to be able to use RemoteCommand on both softwares. So, just tell me, and I will drop the remote command tool in this PR.

The exit value can be used in scripting (also 1 if we didn't get any reply).

Some examples:

RemoteCommandDMRG 7643 status
M: 2021-03-20 11:47:42.050 Command sent: "status" to port: 7643
M: 2021-03-20 11:47:42.101 xlx:disc net1:disc net2:disc net3:n/a net4:disc net5:n/a

RemoteCommandDMRG 7643 status
M: 2021-03-20 11:48:17.333 Command sent: "status" to port: 7643
M: 2021-03-20 11:48:17.383 xlx:conn net1:conn net2:conn net3:n/a net4:conn net5:n/a

RemoteCommandDMRG 7643 disable net2
M: 2021-03-20 11:48:40.494 Command sent: "disable net2" to port: 7643
M: 2021-03-20 11:48:40.545 OK

RemoteCommandDMRG 7643 status
M: 2021-03-20 11:49:13.513 Command sent: "status" to port: 7643
M: 2021-03-20 11:49:13.563 xlx:conn net1:conn net2:n/a net3:n/a net4:conn net5:n/a

RemoteCommandDMRG 7643 disable xlx
M: 2021-03-20 11:49:53.381 Command sent: "disable xlx" to port: 7643
M: 2021-03-20 11:49:53.431 OK

RemoteCommandDMRG 7643 status
M: 2021-03-20 11:50:16.188 Command sent: "status" to port: 7643
M: 2021-03-20 11:50:16.239 xlx:n/a net1:conn net2:n/a net3:n/a net4:conn net5:n/a

RemoteCommandDMRG 7643 enable xlx
M: 2021-03-20 11:50:50.804 Command sent: "enable xlx" to port: 7643
M: 2021-03-20 11:50:50.854 OK

RemoteCommandDMRG 7643 status
M: 2021-03-20 11:51:01.381 Command sent: "status" to port: 7643
M: 2021-03-20 11:51:01.431 xlx:conn net1:conn net2:n/a net3:n/a net4:conn net5:n/a
g4klx commented 3 years ago

Could you remove the remote control program part from this PR, and then I'll merge it.

f1rmb commented 3 years ago

Hi Jonathan.

Yes, no problem.

f1rmb commented 3 years ago

it was removed.

f1rmb commented 3 years ago

Thanks ;-)