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

Function icom_set_dcs_code

rigs/icom/icom.c:7935–7976  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

7933 * Assumes rig!=NULL, STATE(rig)->priv!=NULL
7934 */
7935int icom_set_dcs_code(RIG *rig, vfo_t vfo, tone_t code)
7936{
7937 const struct rig_caps *caps;
7938 unsigned char codebuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN];
7939 int code_len, ack_len = sizeof(ackbuf), retval;
7940 int i;
7941
7942 ENTERFUNC;
7943 caps = rig->caps;
7944
7945 for (i = 0; caps->dcs_list[i] != 0; i++)
7946 {
7947 if (caps->dcs_list[i] == code)
7948 {
7949 break;
7950 }
7951 }
7952
7953 if (caps->dcs_list[i] != code)
7954 {
7955 RETURNFUNC(-RIG_EINVAL);
7956 }
7957
7958 /* DCS Polarity ignored, by setting code_len to 3 it's forced to 0 (= Tx:norm, Rx:norm). */
7959 code_len = 3;
7960 to_bcd_be(codebuf, code, code_len * 2);
7961
7962 retval = icom_transaction(rig, C_SET_TONE, S_TONE_DTCS,
7963 codebuf, code_len, ackbuf, &ack_len);
7964
7965 if (retval != RIG_OK)
7966 {
7967 RETURNFUNC(retval);
7968 }
7969
7970 if ((retval = icom_check_ack(ack_len, ackbuf)) != RIG_OK)
7971 {
7972 RETURNFUNC(retval);
7973 }
7974
7975 RETURNFUNC(RIG_OK);
7976}
7977
7978/*
7979 * icom_get_dcs_code

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