kopia lustrzana https://github.com/Hamlib/Hamlib
Fix Icom DCS SQL funnctions
Copied get/set_dcs_code functions to get/set_dcs_sql Re-mapped all receivers DCS functiosn to sql.pull/152/head
rodzic
b7b1a9e3d9
commit
b12a3e31b3
99
icom/icom.c
99
icom/icom.c
|
@ -4267,6 +4267,105 @@ int icom_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code)
|
||||||
return -RIG_EPROTO;
|
return -RIG_EPROTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* icom_set_dcs_sql
|
||||||
|
* Assumes rig!=NULL, rig->state.priv!=NULL
|
||||||
|
*/
|
||||||
|
int icom_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code)
|
||||||
|
{
|
||||||
|
const struct rig_caps *caps;
|
||||||
|
unsigned char codebuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN];
|
||||||
|
int code_len, ack_len = sizeof(ackbuf), retval;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
caps = rig->caps;
|
||||||
|
|
||||||
|
for (i = 0; caps->dcs_list[i] != 0 && i < COMMON_DCS_LIST_COUNT; i++)
|
||||||
|
{
|
||||||
|
if (caps->dcs_list[i] == code)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (caps->dcs_list[i] != code)
|
||||||
|
{
|
||||||
|
return -RIG_EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* DCS Polarity ignored, by setting code_len to 3 it's forced to 0 (= Tx:norm, Rx:norm). */
|
||||||
|
code_len = 3;
|
||||||
|
to_bcd_be(codebuf, code, code_len * 2);
|
||||||
|
|
||||||
|
retval = icom_transaction(rig, C_SET_TONE, S_TONE_DTCS,
|
||||||
|
codebuf, code_len, ackbuf, &ack_len);
|
||||||
|
|
||||||
|
if (retval != RIG_OK)
|
||||||
|
{
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ack_len != 1 || ackbuf[0] != ACK)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: ack NG (%#.2x), len=%d\n", __func__, ackbuf[0],
|
||||||
|
ack_len);
|
||||||
|
return -RIG_ERJCTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return RIG_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* icom_get_dcs_sql
|
||||||
|
* Assumes rig!=NULL, rig->state.priv!=NULL
|
||||||
|
*/
|
||||||
|
int icom_get_dcs_sql(RIG *rig, vfo_t vfo, tone_t *code)
|
||||||
|
{
|
||||||
|
const struct rig_caps *caps;
|
||||||
|
unsigned char codebuf[MAXFRAMELEN];
|
||||||
|
int code_len, retval;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
|
||||||
|
caps = rig->caps;
|
||||||
|
|
||||||
|
retval = icom_transaction(rig, C_SET_TONE, S_TONE_DTCS, NULL, 0,
|
||||||
|
codebuf, &code_len);
|
||||||
|
|
||||||
|
if (retval != RIG_OK)
|
||||||
|
{
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* cn,sc,data*3 */
|
||||||
|
if (code_len != 5)
|
||||||
|
{
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: ack NG (%#.2x), len=%d\n", __func__, codebuf[0],
|
||||||
|
code_len);
|
||||||
|
return -RIG_ERJCTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* buf is cn,sc, polarity, code_lo, code_hi, so code bytes start at 3, len is 2
|
||||||
|
polarity is not decoded yet, hard to do without breaking ABI
|
||||||
|
*/
|
||||||
|
|
||||||
|
code_len -= 3;
|
||||||
|
*code = from_bcd_be(codebuf + 3, code_len * 2);
|
||||||
|
|
||||||
|
/* check this code exists. That's better than nothing. */
|
||||||
|
for (i = 0; caps->dcs_list[i] != 0 && i < COMMON_DCS_LIST_COUNT; i++)
|
||||||
|
{
|
||||||
|
if (caps->dcs_list[i] == *code)
|
||||||
|
{
|
||||||
|
return RIG_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rig_debug(RIG_DEBUG_ERR, "%s: DTCS NG (%#.2x)\n", __func__, codebuf[2]);
|
||||||
|
return -RIG_EPROTO;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* icom_set_powerstat
|
* icom_set_powerstat
|
||||||
* Assumes rig!=NULL, rig->state.priv!=NULL
|
* Assumes rig!=NULL, rig->state.priv!=NULL
|
||||||
|
|
|
@ -213,6 +213,8 @@ int icom_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone);
|
||||||
int icom_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone);
|
int icom_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone);
|
||||||
int icom_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code);
|
int icom_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code);
|
||||||
int icom_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code);
|
int icom_get_dcs_code(RIG *rig, vfo_t vfo, tone_t *code);
|
||||||
|
int icom_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code);
|
||||||
|
int icom_get_dcs_sql(RIG *rig, vfo_t vfo, tone_t *code);
|
||||||
int icom_set_bank(RIG *rig, vfo_t vfo, int bank);
|
int icom_set_bank(RIG *rig, vfo_t vfo, int bank);
|
||||||
int icom_set_mem(RIG *rig, vfo_t vfo, int ch);
|
int icom_set_mem(RIG *rig, vfo_t vfo, int ch);
|
||||||
int icom_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op);
|
int icom_vfo_op(RIG *rig, vfo_t vfo, vfo_op_t op);
|
||||||
|
|
|
@ -227,6 +227,6 @@ const struct rig_caps icr30_caps =
|
||||||
.get_dcd = icom_get_dcd,
|
.get_dcd = icom_get_dcd,
|
||||||
.set_ctcss_sql = icom_set_ctcss_sql,
|
.set_ctcss_sql = icom_set_ctcss_sql,
|
||||||
.get_ctcss_sql = icom_get_ctcss_sql,
|
.get_ctcss_sql = icom_get_ctcss_sql,
|
||||||
.set_dcs_code = icom_set_dcs_code,
|
.set_dcs_sql = icom_set_dcs_sql,
|
||||||
.get_dcs_code = icom_get_dcs_code,
|
.get_dcs_sql = icom_get_dcs_sql,
|
||||||
};
|
};
|
||||||
|
|
|
@ -168,6 +168,6 @@ const struct rig_caps icr6_caps =
|
||||||
.get_dcd = icom_get_dcd,
|
.get_dcd = icom_get_dcd,
|
||||||
.set_ctcss_sql = icom_set_ctcss_sql,
|
.set_ctcss_sql = icom_set_ctcss_sql,
|
||||||
.get_ctcss_sql = icom_get_ctcss_sql,
|
.get_ctcss_sql = icom_get_ctcss_sql,
|
||||||
.set_dcs_code = icom_set_dcs_code,
|
.set_dcs_sql = icom_set_dcs_sql,
|
||||||
.get_dcs_code = icom_get_dcs_code,
|
.get_dcs_sql = icom_get_dcs_sql,
|
||||||
};
|
};
|
||||||
|
|
|
@ -230,8 +230,8 @@ const struct rig_caps icr8600_caps =
|
||||||
.get_ts = icom_get_ts,
|
.get_ts = icom_get_ts,
|
||||||
.set_ctcss_sql = icom_set_ctcss_sql,
|
.set_ctcss_sql = icom_set_ctcss_sql,
|
||||||
.get_ctcss_sql = icom_get_ctcss_sql,
|
.get_ctcss_sql = icom_get_ctcss_sql,
|
||||||
.set_dcs_code = icom_set_dcs_code,
|
.set_dcs_sql = icom_set_dcs_sql,
|
||||||
.get_dcs_code = icom_get_dcs_code,
|
.get_dcs_sql = icom_get_dcs_sql,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -192,8 +192,8 @@ const struct rig_caps icr9500_caps =
|
||||||
.get_rptr_offs = icom_get_rptr_offs,
|
.get_rptr_offs = icom_get_rptr_offs,
|
||||||
.set_ctcss_sql = icom_set_ctcss_sql,
|
.set_ctcss_sql = icom_set_ctcss_sql,
|
||||||
.get_ctcss_sql = icom_get_ctcss_sql,
|
.get_ctcss_sql = icom_get_ctcss_sql,
|
||||||
.set_dcs_sql = icom_set_dcs_code,
|
.set_dcs_sql = icom_set_dcs_sql,
|
||||||
.get_dcs_sql = icom_get_dcs_code,
|
.get_dcs_sql = icom_get_dcs_sql,
|
||||||
|
|
||||||
.set_ts = icom_set_ts,
|
.set_ts = icom_set_ts,
|
||||||
.get_ts = icom_get_ts,
|
.get_ts = icom_get_ts,
|
||||||
|
|
|
@ -82,7 +82,7 @@ const tone_t full_dcs_list[] = { FULL_DCS_LIST };
|
||||||
* \param tone The tone to set to
|
* \param tone The tone to set to
|
||||||
*
|
*
|
||||||
* Sets the current Continuous Tone Controlled Squelch System (CTCSS)
|
* Sets the current Continuous Tone Controlled Squelch System (CTCSS)
|
||||||
* sub-audible tone frequency.
|
* sub-audible tone frequency for the transmitter only.
|
||||||
* \note the \a tone integer is NOT in Hz, but in tenth of Hz! This way,
|
* \note the \a tone integer is NOT in Hz, but in tenth of Hz! This way,
|
||||||
* if you want to set a subaudible tone of 88.5 Hz for example,
|
* if you want to set a subaudible tone of 88.5 Hz for example,
|
||||||
* then pass 885 to this function.
|
* then pass 885 to this function.
|
||||||
|
@ -152,7 +152,7 @@ int HAMLIB_API rig_set_ctcss_tone(RIG *rig, vfo_t vfo, tone_t tone)
|
||||||
* \param tone The location where to store the current tone
|
* \param tone The location where to store the current tone
|
||||||
*
|
*
|
||||||
* Retrieves the current Continuous Tone Controlled Squelch System (CTCSS)
|
* Retrieves the current Continuous Tone Controlled Squelch System (CTCSS)
|
||||||
* sub-audible tone frequency.
|
* sub-audible tone frequency for the transmitter only.
|
||||||
* \note the \a *tone integer is NOT in Hz, but in tenth of Hz! This way,
|
* \note the \a *tone integer is NOT in Hz, but in tenth of Hz! This way,
|
||||||
* if the function rig_get_ctcss_tone() returns a subaudible tone of 885
|
* if the function rig_get_ctcss_tone() returns a subaudible tone of 885
|
||||||
* for example, then the real tone is 88.5 Hz.
|
* for example, then the real tone is 88.5 Hz.
|
||||||
|
|
Ładowanie…
Reference in New Issue