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

Function rig_set_level

src/settings.c:74–130  ·  view source on GitHub ↗

* \brief set a radio level setting * \param rig The rig handle * \param vfo The target VFO * \param level The level setting * \param val The value to set the level setting to * * Sets the level of a setting. * The level value \a val can be a float or an integer. See #value_t * for more information. * * \return RIG_OK if the operation has been successful, otherwise * a negative val

Source from the content-addressed store, hash-verified

72 * \sa rig_has_set_level(), rig_get_level()
73 */
74int HAMLIB_API rig_set_level(RIG *rig, vfo_t vfo, setting_t level, value_t val)
75{
76 const struct rig_caps *caps;
77 int retcode;
78 vfo_t curr_vfo;
79
80 rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
81
82 if (CHECK_RIG_ARG(rig))
83 {
84 return -RIG_EINVAL;
85 }
86
87 caps = rig->caps;
88
89 if (caps->set_level == NULL || !rig_has_set_level(rig, level))
90 {
91 return -RIG_ENAVAIL;
92 }
93
94 rig_lock(rig, 1);
95 if ((caps->targetable_vfo & RIG_TARGETABLE_LEVEL)
96 || vfo == RIG_VFO_CURR
97 || vfo == STATE(rig)->current_vfo)
98 {
99
100 if (level == RIG_LEVEL_KEYSPD)
101 {
102 extern int morse_data_handler_set_keyspd(RIG * rig, int keyspd);
103 morse_data_handler_set_keyspd(rig, val.i);
104 }
105
106 retcode = caps->set_level(rig, vfo, level, val);
107 rig_lock(rig, 0);
108 return retcode;
109 }
110
111 if (!caps->set_vfo)
112 {
113 rig_lock(rig, 0);
114 return -RIG_ENTARGET;
115 }
116
117 curr_vfo = STATE(rig)->current_vfo;
118 retcode = caps->set_vfo(rig, vfo);
119
120 if (retcode != RIG_OK)
121 {
122 rig_lock(rig, 0);
123 return retcode;
124 }
125
126 retcode = caps->set_level(rig, vfo, level, val);
127 caps->set_vfo(rig, curr_vfo);
128 rig_lock(rig, 0);
129 return retcode;
130}
131

Callers 8

dttsp_set_levelFunction · 0.85
gnuradio_set_levelFunction · 0.85
setLevelMethod · 0.85
morse_data_handlerFunction · 0.85
generic_restore_channelFunction · 0.85
handle_ts2000Function · 0.85
mainFunction · 0.85
rigctl_parse.cFile · 0.85

Calls 4

rig_debugFunction · 0.85
rig_has_set_levelFunction · 0.85
rig_lockFunction · 0.85

Tested by

no test coverage detected