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

Function rig_open

src/rig.c:1040–1734  ·  view source on GitHub ↗

* \brief open the communication to the rig * \param rig The #RIG handle of the radio to be opened * * Opens communication to a radio which \a RIG handle has been passed * by argument. * * \return RIG_OK if the operation has been successful, otherwise * a negative value if an error occurred (in which case, cause is * set appropriately). * * \retval -RIG_EINVAL \a rig is NULL or incons

Source from the content-addressed store, hash-verified

1038 * \sa rig_init(), rig_close()
1039 */
1040int HAMLIB_API rig_open(RIG *rig)
1041{
1042 struct rig_caps *caps;
1043 struct rig_state *rs;
1044 hamlib_port_t *rp, *pttp, *dcdp;
1045 int status = RIG_OK;
1046 value_t parm_value;
1047 //unsigned int net1, net2, net3, net4, net5, net6, net7, net8, port;
1048 int is_network = 0;
1049 int retval = 0;
1050
1051 ENTERFUNC2;
1052
1053 if (!rig || !rig->caps)
1054 {
1055 RETURNFUNC2(-RIG_EINVAL);
1056 }
1057
1058 caps = rig->caps;
1059 rs = STATE(rig);
1060 rp = RIGPORT(rig);
1061 pttp = PTTPORT(rig);
1062 dcdp = DCDPORT(rig);
1063 rp->rig = rig;
1064 rs->rigport_deprecated.rig = rig;
1065
1066 if (strcmp(rp->pathname, "USB") == 0)
1067 {
1068 rig_debug(RIG_DEBUG_ERR, "%s: 'USB' is not a valid COM port name\n", __func__);
1069 errno = 2;
1070 RETURNFUNC2(-RIG_EINVAL);
1071 }
1072
1073 // rigctl/rigctld may have deprecated values -- backwards compatibility
1074 if (rs->rigport_deprecated.pathname[0] != 0)
1075 {
1076 strcpy(rp->pathname, rs->rigport_deprecated.pathname);
1077 }
1078
1079 if (rs->pttport_deprecated.type.ptt != RIG_PTT_NONE)
1080 {
1081 pttp->type.ptt = rs->pttport_deprecated.type.ptt;
1082 }
1083
1084 if (rs->dcdport_deprecated.type.dcd != RIG_DCD_NONE)
1085 {
1086 dcdp->type.dcd = rs->dcdport_deprecated.type.dcd;
1087 }
1088
1089 if (rs->pttport_deprecated.pathname[0] != 0)
1090 {
1091 strcpy(pttp->pathname, rs->pttport_deprecated.pathname);
1092 }
1093
1094 if (rs->dcdport_deprecated.pathname[0] != 0)
1095 {
1096 strcpy(dcdp->pathname, rs->dcdport_deprecated.pathname);
1097 }

Callers 15

dttsp_openFunction · 0.85
icom_set_powerstatFunction · 0.85
newcat_set_powerstatFunction · 0.85
gr_openFunction · 0.85
mainFunction · 0.85
openMethod · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
handle_socketFunction · 0.85

Calls 15

rig_debugFunction · 0.85
rig_settings_load_allFunction · 0.85
parse_hoststrFunction · 0.85
rig_debug_clearFunction · 0.85
port_closeFunction · 0.85
port_openFunction · 0.85
ser_set_dtrFunction · 0.85
ser_set_rtsFunction · 0.85
ser_openFunction · 0.85
ser_closeFunction · 0.85
par_openFunction · 0.85
par_ptt_setFunction · 0.85

Tested by 7

mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
callbackFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68