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

Function netrigctl_get_vfo

rigs/dummy/netrigctl.c:1127–1161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1125
1126
1127static int netrigctl_get_vfo(RIG *rig, vfo_t *vfo)
1128{
1129 int ret;
1130 char cmd[CMD_MAX];
1131 char buf[BUF_MAX];
1132 struct netrigctl_priv_data *priv;
1133
1134 rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
1135
1136 priv = (struct netrigctl_priv_data *)STATE(rig)->priv;
1137
1138 SNPRINTF(cmd, sizeof(cmd), "v\n");
1139
1140 ret = netrigctl_transaction(rig, cmd, strlen(cmd), buf);
1141
1142 if (ret == -RIG_ENAVAIL || ret == -RIG_ENIMPL)
1143 {
1144 // for rigs without get_vfo we'll use our saved vfo
1145 *vfo = priv->vfo_curr;
1146 return RIG_OK;
1147 }
1148
1149 if (ret <= 0)
1150 {
1151 return (ret < 0) ? ret : -RIG_EPROTO;
1152 }
1153
1154 if (buf[ret - 1] == '\n') { buf[ret - 1] = '\0'; } /* chomp */
1155
1156 *vfo = rig_parse_vfo(buf);
1157
1158 priv->vfo_curr = *vfo;
1159
1160 return RIG_OK;
1161}
1162
1163
1164static int netrigctl_set_ptt(RIG *rig, vfo_t vfo, ptt_t ptt)

Callers

nothing calls this directly

Calls 3

rig_debugFunction · 0.85
netrigctl_transactionFunction · 0.85
rig_parse_vfoFunction · 0.85

Tested by

no test coverage detected