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

Function netrigctl_get_mode

rigs/dummy/netrigctl.c:1060–1098  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1058
1059
1060static int netrigctl_get_mode(RIG *rig, vfo_t vfo, rmode_t *mode,
1061 pbwidth_t *width)
1062{
1063 int ret;
1064 char cmd[CMD_MAX];
1065 char buf[BUF_MAX];
1066 char vfostr[16] = "";
1067
1068 rig_debug(RIG_DEBUG_VERBOSE, "%s called, vfo=%s\n", __func__, rig_strvfo(vfo));
1069
1070 ret = netrigctl_vfostr(rig, vfostr, sizeof(vfostr), vfo);
1071
1072 if (ret != RIG_OK) { return ret; }
1073
1074 SNPRINTF(cmd, sizeof(cmd), "m%s\n", vfostr);
1075
1076 ret = netrigctl_transaction(rig, cmd, strlen(cmd), buf);
1077
1078 if (ret <= 0)
1079 {
1080 return (ret < 0) ? ret : -RIG_EPROTO;
1081 }
1082
1083 if (buf[ret - 1] == '\n') { buf[ret - 1] = '\0'; } /* chomp */
1084
1085 *mode = rig_parse_mode(buf);
1086
1087 ret = read_string(RIGPORT(rig), (unsigned char *) buf, BUF_MAX, "\n", 1,
1088 0, 1);
1089
1090 if (ret <= 0)
1091 {
1092 return (ret < 0) ? ret : -RIG_EPROTO;
1093 }
1094
1095 *width = atoi(buf);
1096
1097 return RIG_OK;
1098}
1099
1100
1101static int netrigctl_set_vfo(RIG *rig, vfo_t vfo)

Callers

nothing calls this directly

Calls 6

rig_debugFunction · 0.85
rig_strvfoFunction · 0.85
netrigctl_vfostrFunction · 0.85
netrigctl_transactionFunction · 0.85
rig_parse_modeFunction · 0.85
read_stringFunction · 0.85

Tested by

no test coverage detected