kopia lustrzana https://github.com/Hamlib/Hamlib
Change the dummy implementation of rig_send_raw()
Makes it more similar to the regular version handling also the reply and term arguments.pull/1840/head
rodzic
12ec55c3d7
commit
289a3952ce
22
src/rig.c
22
src/rig.c
|
@ -8923,13 +8923,9 @@ HAMLIB_EXPORT(int) rig_send_raw(RIG *rig, const unsigned char *send,
|
||||||
|
|
||||||
if (simulate)
|
if (simulate)
|
||||||
{
|
{
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%s: simulating response for model %s\n",
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: simulating write for model %s\n",
|
||||||
__func__, rig->caps->model_name);
|
__func__, rig->caps->model_name);
|
||||||
memcpy(reply, send, send_len);
|
retval = RIG_OK;
|
||||||
retval = send_len;
|
|
||||||
set_transaction_inactive(rig);
|
|
||||||
ELAPSED2;
|
|
||||||
RETURNFUNC(retval);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -8950,8 +8946,18 @@ HAMLIB_EXPORT(int) rig_send_raw(RIG *rig, const unsigned char *send,
|
||||||
if (simulate)
|
if (simulate)
|
||||||
{
|
{
|
||||||
// Simulate a response by copying the command
|
// Simulate a response by copying the command
|
||||||
memcpy(buf, send, send_len);
|
rig_debug(RIG_DEBUG_VERBOSE, "%s: simulating response for model %s\n",
|
||||||
nbytes = send_len + 1;
|
__func__, rig->caps->model_name);
|
||||||
|
|
||||||
|
nbytes = send_len < reply_len ? send_len : reply_len;
|
||||||
|
for (int i = 0; i < nbytes; i++)
|
||||||
|
{
|
||||||
|
buf[i] = send[i];
|
||||||
|
if (term && memchr(term, send[i], 1)) {
|
||||||
|
nbytes = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Ładowanie…
Reference in New Issue