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

Function icom_set_ctcss_sql

rigs/icom/icom.c:7842–7884  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

7840 * Assumes rig!=NULL, STATE(rig)->priv!=NULL
7841 */
7842int icom_set_ctcss_sql(RIG *rig, vfo_t vfo, tone_t tone)
7843{
7844 const struct rig_caps *caps;
7845 unsigned char tonebuf[MAXFRAMELEN], ackbuf[MAXFRAMELEN];
7846 int tone_len, ack_len = sizeof(ackbuf), retval;
7847 int i;
7848
7849 ENTERFUNC;
7850 caps = rig->caps;
7851
7852 for (i = 0; caps->ctcss_list[i] != 0; i++)
7853 {
7854 if (caps->ctcss_list[i] == tone)
7855 {
7856 break;
7857 }
7858 }
7859
7860 if (caps->ctcss_list[i] != tone)
7861 {
7862 RETURNFUNC(-RIG_EINVAL);
7863 }
7864
7865 /* Sent as frequency in tenth of Hz */
7866
7867 tone_len = 3;
7868 to_bcd_be(tonebuf, tone, tone_len * 2);
7869
7870 retval = icom_transaction(rig, C_SET_TONE, S_TONE_SQL,
7871 tonebuf, tone_len, ackbuf, &ack_len);
7872
7873 if (retval != RIG_OK)
7874 {
7875 RETURNFUNC(retval);
7876 }
7877
7878 if ((retval = icom_check_ack(ack_len, ackbuf)) != RIG_OK)
7879 {
7880 RETURNFUNC(retval);
7881 }
7882
7883 RETURNFUNC(RIG_OK);
7884}
7885
7886/*
7887 * icom_get_ctcss_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