mirror of
https://github.com/Hamlib/Hamlib.git
synced 2024-09-21 10:27:18 +00:00
Add rig_stop_morse to API and stop_morse command for rigctl
No rigs implemented yet https://github.com/Hamlib/Hamlib/issues/240
This commit is contained in:
parent
90cf25b6fe
commit
5add4b343d
@ -1792,6 +1792,7 @@ struct rig_caps {
|
||||
int (*recv_dtmf)(RIG *rig, vfo_t vfo, char *digits, int *length);
|
||||
|
||||
int (*send_morse)(RIG *rig, vfo_t vfo, const char *msg);
|
||||
int (*stop_morse)(RIG *rig, vfo_t vfo);
|
||||
|
||||
int (*send_voice_mem)(RIG *rig, vfo_t vfo, int ch);
|
||||
|
||||
@ -2503,6 +2504,10 @@ rig_send_morse HAMLIB_PARAMS((RIG *rig,
|
||||
vfo_t vfo,
|
||||
const char *msg));
|
||||
|
||||
extern HAMLIB_EXPORT(int)
|
||||
rig_stop_morse HAMLIB_PARAMS((RIG *rig,
|
||||
vfo_t vfo));
|
||||
|
||||
extern HAMLIB_EXPORT(int)
|
||||
rig_send_voice_mem HAMLIB_PARAMS((RIG *rig,
|
||||
vfo_t vfo,
|
||||
|
59
src/rig.c
59
src/rig.c
@ -5000,6 +5000,65 @@ int HAMLIB_API rig_send_morse(RIG *rig, vfo_t vfo, const char *msg)
|
||||
return retcode;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief stop morse code
|
||||
* \param rig The rig handle
|
||||
* \param vfo The target VFO
|
||||
*
|
||||
* Stops the send morse message.
|
||||
*
|
||||
* \return RIG_OK if the operation has been successful, otherwise
|
||||
* a negative value if an error occurred (in which case, cause is
|
||||
* set appropriately).
|
||||
*
|
||||
*/
|
||||
int HAMLIB_API rig_stop_morse(RIG *rig, vfo_t vfo)
|
||||
{
|
||||
const struct rig_caps *caps;
|
||||
int retcode, rc2;
|
||||
vfo_t curr_vfo;
|
||||
|
||||
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||
caps = rig->caps;
|
||||
|
||||
if (caps->stop_morse == NULL)
|
||||
{
|
||||
return -RIG_ENAVAIL;
|
||||
}
|
||||
|
||||
if ((caps->targetable_vfo & RIG_TARGETABLE_PURE)
|
||||
|| vfo == RIG_VFO_CURR
|
||||
|| vfo == rig->state.current_vfo)
|
||||
{
|
||||
return caps->stop_morse(rig, vfo);
|
||||
}
|
||||
|
||||
if (!caps->set_vfo)
|
||||
{
|
||||
return -RIG_ENTARGET;
|
||||
}
|
||||
|
||||
curr_vfo = rig->state.current_vfo;
|
||||
retcode = caps->set_vfo(rig, vfo);
|
||||
|
||||
if (retcode != RIG_OK)
|
||||
{
|
||||
return retcode;
|
||||
}
|
||||
|
||||
retcode = caps->stop_morse(rig, vfo);
|
||||
/* try and revert even if we had an error above */
|
||||
rc2 = caps->set_vfo(rig, curr_vfo);
|
||||
|
||||
if (RIG_OK == retcode)
|
||||
{
|
||||
/* return the first error code */
|
||||
retcode = rc2;
|
||||
}
|
||||
|
||||
return retcode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief send voice memory content
|
||||
|
@ -217,6 +217,7 @@ declare_proto_rig(set_ant);
|
||||
declare_proto_rig(get_ant);
|
||||
declare_proto_rig(reset);
|
||||
declare_proto_rig(send_morse);
|
||||
declare_proto_rig(stop_morse);
|
||||
declare_proto_rig(send_voice_mem);
|
||||
declare_proto_rig(send_cmd);
|
||||
declare_proto_rig(set_powerstat);
|
||||
@ -311,6 +312,7 @@ static struct test_table test_list[] =
|
||||
{ 'w', "send_cmd", ACTION(send_cmd), ARG_IN1 | ARG_IN_LINE | ARG_OUT2 | ARG_NOVFO, "Cmd", "Reply" },
|
||||
{ 'W', "send_cmd_rx", ACTION(send_cmd), ARG_IN | ARG_OUT2 | ARG_NOVFO, "Cmd", "Reply"},
|
||||
{ 'b', "send_morse", ACTION(send_morse), ARG_IN | ARG_IN_LINE, "Morse" },
|
||||
{ 0xbb, "stop_morse", ACTION(stop_morse), },
|
||||
{ 0x94, "send_voice_mem", ACTION(send_voice_mem), ARG_IN, "Voice Mem#" },
|
||||
{ 0x8b, "get_dcd", ACTION(get_dcd), ARG_OUT, "DCD" },
|
||||
{ 0x8d, "set_twiddle", ACTION(set_twiddle), ARG_IN | ARG_NOVFO, "Timeout (secs)" },
|
||||
@ -4217,6 +4219,12 @@ declare_proto_rig(send_morse)
|
||||
return rig_send_morse(rig, vfo, arg1);
|
||||
}
|
||||
|
||||
/* 0xvv */
|
||||
declare_proto_rig(stop_morse)
|
||||
{
|
||||
return rig_stop_morse(rig, vfo);
|
||||
}
|
||||
|
||||
/* '8' */
|
||||
declare_proto_rig(send_voice_mem)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user