MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / icom_set_dcs_sql

Function icom_set_dcs_sql

rigs/icom/icom.c:8032–8073  ·  view source on GitHub ↗

* icom_set_dcs_sql * Assumes rig!=NULL, STATE(rig)->priv!=NULL */

Source from the content-addressed store, hash-verified

8030 * Assumes rig!=NULL, STATE(rig)->priv!=NULL
8031 */
8032int icom_set_dcs_sql(RIG *rig, vfo_t vfo, tone_t code)
8033{
8034 const struct rig_caps *caps;
8035 unsigned char codebuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN];
8036 int code_len, ack_len = sizeof(ackbuf), retval;
8037 int i;
8038
8039 ENTERFUNC;
8040 caps = rig->caps;
8041
8042 for (i = 0; caps->dcs_list[i] != 0; i++)
8043 {
8044 if (caps->dcs_list[i] == code)
8045 {
8046 break;
8047 }
8048 }
8049
8050 if (caps->dcs_list[i] != code)
8051 {
8052 RETURNFUNC(-RIG_EINVAL);
8053 }
8054
8055 /* DCS Polarity ignored, by setting code_len to 3 it's forced to 0 (= Tx:norm, Rx:norm). */
8056 code_len = 3;
8057 to_bcd_be(codebuf, code, code_len * 2);
8058
8059 retval = icom_transaction(rig, C_SET_TONE, S_TONE_DTCS,
8060 codebuf, code_len, ackbuf, &ack_len);
8061
8062 if (retval != RIG_OK)
8063 {
8064 RETURNFUNC(retval);
8065 }
8066
8067 if ((retval = icom_check_ack(ack_len, ackbuf)) != RIG_OK)
8068 {
8069 RETURNFUNC(retval);
8070 }
8071
8072 RETURNFUNC(RIG_OK);
8073}
8074
8075/*
8076 * icom_get_dcs_sql

Callers 1

never_usedFunction · 0.85

Calls 3

to_bcd_beFunction · 0.85
icom_transactionFunction · 0.85
icom_check_ackFunction · 0.70

Tested by

no test coverage detected