* icom_get_ctcss_sql * Assumes rig!=NULL, STATE(rig)->priv!=NULL */
| 7888 | * Assumes rig!=NULL, STATE(rig)->priv!=NULL |
| 7889 | */ |
| 7890 | int icom_get_ctcss_sql(RIG *rig, vfo_t vfo, tone_t *tone) |
| 7891 | { |
| 7892 | const struct rig_caps *caps; |
| 7893 | unsigned char tonebuf[MAXFRAMELEN]; |
| 7894 | int tone_len, retval; |
| 7895 | int i; |
| 7896 | |
| 7897 | ENTERFUNC; |
| 7898 | caps = rig->caps; |
| 7899 | |
| 7900 | retval = icom_transaction(rig, C_SET_TONE, S_TONE_SQL, NULL, 0, |
| 7901 | tonebuf, &tone_len); |
| 7902 | |
| 7903 | if (retval != RIG_OK) |
| 7904 | { |
| 7905 | RETURNFUNC(retval); |
| 7906 | } |
| 7907 | |
| 7908 | if (tone_len != 5) |
| 7909 | { |
| 7910 | rig_debug(RIG_DEBUG_ERR, "%s: ack NG (%#.2x), len=%d\n", __func__, |
| 7911 | tonebuf[0], tone_len); |
| 7912 | RETURNFUNC(-RIG_ERJCTED); |
| 7913 | } |
| 7914 | |
| 7915 | tone_len -= 2; |
| 7916 | *tone = from_bcd_be(tonebuf + 2, tone_len * 2); |
| 7917 | |
| 7918 | /* check this tone exists. That's better than nothing. */ |
| 7919 | for (i = 0; caps->ctcss_list[i] != 0; i++) |
| 7920 | { |
| 7921 | if (caps->ctcss_list[i] == *tone) |
| 7922 | { |
| 7923 | RETURNFUNC(RIG_OK); |
| 7924 | } |
| 7925 | } |
| 7926 | |
| 7927 | rig_debug(RIG_DEBUG_ERR, "%s: CTCSS NG (%#.2x)\n", __func__, tonebuf[2]); |
| 7928 | RETURNFUNC(-RIG_EPROTO); |
| 7929 | } |
| 7930 | |
| 7931 | /* |
| 7932 | * icom_set_dcs_code |
no test coverage detected