Add netrigctl_send_raw to allow send_raw to work with rigctld

https://github.com/Hamlib/Hamlib/issues/1157
pull/1173/head
Mike Black W9MDB 2022-12-01 16:20:23 -06:00
rodzic 3e01e7e9a7
commit 2b145fe717
2 zmienionych plików z 22 dodań i 1 usunięć

Wyświetl plik

@ -2709,6 +2709,14 @@ int netrigctl_get_lock_mode(RIG *rig, int *lock)
return (RIG_OK);
}
int netrigctl_send_raw(RIG *rig, char *s)
{
int ret;
char buf[BUF_MAX];
ret = netrigctl_transaction(rig, s, strlen(s), buf);
return ret;
}
/*
* Netrigctl rig capabilities.
*/
@ -2718,7 +2726,7 @@ struct rig_caps netrigctl_caps =
RIG_MODEL(RIG_MODEL_NETRIGCTL),
.model_name = "NET rigctl",
.mfg_name = "Hamlib",
.version = "20221123.0",
.version = "20221201.0",
.copyright = "LGPL",
.status = RIG_STATUS_STABLE,
.rig_type = RIG_TYPE_OTHER,

Wyświetl plik

@ -5371,6 +5371,9 @@ static int parse_hex(const char *s, unsigned char *buf, int len)
free(s2);
return i;
}
// sends whatever is in s -- no addtions or changes done
extern int netrigctl_send_raw(RIG *rig, char *s);
/* 0xa4 */
declare_proto_rig(send_raw)
{
@ -5384,6 +5387,16 @@ declare_proto_rig(send_raw)
int buf_len = sizeof(buf);
int val = 0;
if (rig->caps->rig_model == RIG_MODEL_NETRIGCTL)
{
char netbuf[1024];
int retval;
snprintf(netbuf, sizeof(netbuf) - 1, "\\sendraw %s %s\n", arg2, arg3);
rig_debug(RIG_DEBUG_ERR, "%s: calling netrigctl\n", __func__);
retval = RIG_OK;
return retval;
}
if (strcmp(arg1, ";") == 0) { term[0] = ';'; }
else if (strcasecmp(arg1, "CR")) { term[0] = 0x0d; }
else if (strcasecmp(arg1, "LF")) { term[0] = 0x0a; }