kopia lustrzana https://github.com/Hamlib/Hamlib
Add set_voice_mem and stop_voice_mem for K3/K3S/K4
https://github.com/Hamlib/Hamlib/issues/1367pull/1349/head
rodzic
36dade6e6c
commit
3814f2dadf
|
@ -2087,6 +2087,7 @@ struct rig_caps {
|
|||
int (*wait_morse)(RIG *rig, vfo_t vfo);
|
||||
|
||||
int (*send_voice_mem)(RIG *rig, vfo_t vfo, int ch);
|
||||
int (*stop_voice_mem)(RIG *rig, vfo_t vfo);
|
||||
|
||||
int (*set_bank)(RIG *rig, vfo_t vfo, int bank);
|
||||
|
||||
|
@ -3410,6 +3411,10 @@ rig_send_voice_mem HAMLIB_PARAMS((RIG *rig,
|
|||
vfo_t vfo,
|
||||
int ch));
|
||||
|
||||
extern HAMLIB_EXPORT(int)
|
||||
rig_stop_voice_mem HAMLIB_PARAMS((RIG *rig,
|
||||
vfo_t vfo));
|
||||
|
||||
extern HAMLIB_EXPORT(int)
|
||||
rig_set_bank HAMLIB_PARAMS((RIG *rig,
|
||||
vfo_t vfo,
|
||||
|
|
|
@ -170,10 +170,14 @@ int k3_get_nb_level(RIG *rig, float *dsp_nb, float *if_nb);
|
|||
int k3_get_bar_graph_level(RIG *rig, float *smeter, float *pwr, float *alc,
|
||||
int *mode_tx);
|
||||
int kx3_get_bar_graph_level(RIG *rig, float *level);
|
||||
int k3_send_voice_mem(RIG *rig, vfo_t vfo, int ch);
|
||||
int k3_stop_voice_mem(RIG *rig, vfo_t vfo);
|
||||
|
||||
/* K4 functions */
|
||||
int k4_get_ptt(RIG *rig, vfo_t vfo, ptt_t *ptt);
|
||||
int k4_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt);
|
||||
int k4_send_voice_mem(RIG *rig, vfo_t vfo, int ch);
|
||||
int k4_stop_voice_mem(RIG *rig, vfo_t vfo);
|
||||
|
||||
/*
|
||||
* K3 rig capabilities.
|
||||
|
@ -190,7 +194,7 @@ const struct rig_caps k3_caps =
|
|||
RIG_MODEL(RIG_MODEL_K3),
|
||||
.model_name = "K3",
|
||||
.mfg_name = "Elecraft",
|
||||
.version = BACKEND_VER ".26",
|
||||
.version = BACKEND_VER ".27",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
@ -333,8 +337,9 @@ const struct rig_caps k3_caps =
|
|||
.get_ant = kenwood_get_ant,
|
||||
.send_morse = kenwood_send_morse,
|
||||
.wait_morse = rig_wait_morse,
|
||||
.send_voice_mem = k3_send_voice_mem,
|
||||
.stop_voice_mem = k3_stop_voice_mem,
|
||||
.power2mW = k3_power2mW,
|
||||
|
||||
.hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS
|
||||
};
|
||||
|
||||
|
@ -486,6 +491,8 @@ const struct rig_caps k3s_caps =
|
|||
.get_ant = kenwood_get_ant,
|
||||
.send_morse = kenwood_send_morse,
|
||||
.wait_morse = rig_wait_morse,
|
||||
.send_voice_mem = k3_send_voice_mem,
|
||||
.stop_voice_mem = k3_stop_voice_mem,
|
||||
.power2mW = k3_power2mW,
|
||||
.hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS
|
||||
};
|
||||
|
@ -496,7 +503,7 @@ const struct rig_caps k4_caps =
|
|||
RIG_MODEL(RIG_MODEL_K4),
|
||||
.model_name = "K4",
|
||||
.mfg_name = "Elecraft",
|
||||
.version = BACKEND_VER ".26",
|
||||
.version = BACKEND_VER ".27",
|
||||
.copyright = "LGPL",
|
||||
.status = RIG_STATUS_STABLE,
|
||||
.rig_type = RIG_TYPE_TRANSCEIVER,
|
||||
|
@ -644,6 +651,8 @@ const struct rig_caps k4_caps =
|
|||
.get_ant = kenwood_get_ant,
|
||||
.send_morse = kenwood_send_morse,
|
||||
.wait_morse = rig_wait_morse,
|
||||
.send_voice_mem = k4_send_voice_mem,
|
||||
.stop_voice_mem = k4_stop_voice_mem,
|
||||
.power2mW = k3_power2mW,
|
||||
.hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS
|
||||
};
|
||||
|
@ -795,6 +804,8 @@ const struct rig_caps kx3_caps =
|
|||
.get_ant = kenwood_get_ant,
|
||||
.send_morse = kenwood_send_morse,
|
||||
.wait_morse = rig_wait_morse,
|
||||
.send_voice_mem = k3_send_voice_mem,
|
||||
.stop_voice_mem = k3_stop_voice_mem,
|
||||
.power2mW = k3_power2mW,
|
||||
.hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS
|
||||
};
|
||||
|
@ -2836,3 +2847,53 @@ int k3_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
|
|||
|
||||
return retval;
|
||||
}
|
||||
|
||||
int k3_send_voice_mem(RIG *rig, vfo_t vfo, int ch)
|
||||
{
|
||||
char *cmd;
|
||||
int retval;
|
||||
|
||||
if (ch < 1 || ch > 4)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: expected 1<=ch<=4, got %d\n", __func__, ch);
|
||||
return(-RIG_EINVAL);
|
||||
}
|
||||
switch(ch)
|
||||
{
|
||||
case 1: cmd = "SWT21;";break;
|
||||
case 2: cmd = "SWT31;";break;
|
||||
case 3: cmd = "SWT35;";break;
|
||||
case 4: cmd = "SWT39;";break;
|
||||
}
|
||||
retval = kenwood_transaction(rig, cmd, NULL, 0);
|
||||
return retval;
|
||||
}
|
||||
|
||||
int k3_stop_voice_mem(RIG *rig, vfo_t vfo)
|
||||
{
|
||||
int retval;
|
||||
retval = kenwood_transaction(rig, "SWT37;", NULL, 0);
|
||||
return retval;
|
||||
}
|
||||
|
||||
int k4_send_voice_mem(RIG *rig, vfo_t vfo, int ch)
|
||||
{
|
||||
int retval;
|
||||
char cmd[32];
|
||||
|
||||
if (ch < 1 || ch > 8)
|
||||
{
|
||||
rig_debug(RIG_DEBUG_ERR, "%s: expected 1<=ch<=8, got %d\n", __func__, ch);
|
||||
return(-RIG_EINVAL);
|
||||
}
|
||||
sprintf(cmd, "DAMP%d00000;", ch);
|
||||
retval = kenwood_transaction(rig, cmd, NULL, 0);
|
||||
return retval;
|
||||
}
|
||||
|
||||
int k4_stop_voice_mem(RIG *rig, vfo_t vfo)
|
||||
{
|
||||
int retval;
|
||||
retval = kenwood_transaction(rig, "DA0;", NULL, 0);
|
||||
return retval;
|
||||
}
|
||||
|
|
35
src/rig.c
35
src/rig.c
|
@ -7149,6 +7149,41 @@ int HAMLIB_API rig_send_voice_mem(RIG *rig, vfo_t vfo, int ch)
|
|||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief stop sending voice memory
|
||||
* \param rig The rig handle
|
||||
* \param vfo The target VFO
|
||||
*
|
||||
* Stops sending voice memory content.
|
||||
*
|
||||
* \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_voice_mem(RIG *rig, vfo_t vfo)
|
||||
{
|
||||
const struct rig_caps *caps;
|
||||
int retcode;
|
||||
|
||||
ENTERFUNC;
|
||||
|
||||
if CHECK_RIG_ARG(rig)
|
||||
{
|
||||
RETURNFUNC(-RIG_EINVAL);
|
||||
}
|
||||
|
||||
caps = rig->caps;
|
||||
|
||||
if (caps->stop_voice_mem == NULL)
|
||||
{
|
||||
RETURNFUNC(-RIG_ENAVAIL);
|
||||
}
|
||||
retcode = caps->stop_voice_mem(rig, vfo);
|
||||
RETURNFUNC(retcode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief find the freq_range of freq/mode
|
||||
|
|
|
@ -241,6 +241,7 @@ declare_proto_rig(send_morse);
|
|||
declare_proto_rig(stop_morse);
|
||||
declare_proto_rig(wait_morse);
|
||||
declare_proto_rig(send_voice_mem);
|
||||
declare_proto_rig(stop_voice_mem);
|
||||
declare_proto_rig(send_cmd);
|
||||
declare_proto_rig(set_powerstat);
|
||||
declare_proto_rig(get_powerstat);
|
||||
|
@ -352,6 +353,7 @@ static struct test_table test_list[] =
|
|||
{ 0xbb, "stop_morse", ACTION(stop_morse), },
|
||||
{ 0xbc, "wait_morse", ACTION(wait_morse), },
|
||||
{ 0x94, "send_voice_mem", ACTION(send_voice_mem), ARG_IN, "Voice Mem#" },
|
||||
{ 0xab, "stop_voice_mem", ACTION(stop_voice_mem), },
|
||||
{ 0x8b, "get_dcd", ACTION(get_dcd), ARG_OUT, "DCD" },
|
||||
{ 0x8d, "set_twiddle", ACTION(set_twiddle), ARG_IN | ARG_NOVFO, "Timeout (secs)" },
|
||||
{ 0x8e, "get_twiddle", ACTION(get_twiddle), ARG_OUT | ARG_NOVFO, "Timeout (secs)" },
|
||||
|
@ -4789,6 +4791,12 @@ declare_proto_rig(send_voice_mem)
|
|||
RETURNFUNC2(rig_send_voice_mem(rig, vfo, ch));
|
||||
}
|
||||
|
||||
declare_proto_rig(stop_voice_mem)
|
||||
{
|
||||
ENTERFUNC2;
|
||||
RETURNFUNC2(rig_stop_voice_mem(rig, vfo));
|
||||
}
|
||||
|
||||
declare_proto_rig(send_dtmf)
|
||||
{
|
||||
ENTERFUNC2;
|
||||
|
|
Ładowanie…
Reference in New Issue