Skip to content

Commit

Permalink
Add netrigctl_send_raw to allow send_raw to work with rigctld
Browse files Browse the repository at this point in the history
  • Loading branch information
mdblack98 committed Dec 1, 2022
1 parent 3e01e7e commit 2b145fe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
10 changes: 9 additions & 1 deletion rigs/dummy/netrigctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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,
Expand Down
13 changes: 13 additions & 0 deletions tests/rigctl_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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; }
Expand Down

0 comments on commit 2b145fe

Please sign in to comment.