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

Function rig_get_level

src/settings.c:157–233  ·  view source on GitHub ↗

* \brief get the value of a level * \param rig The rig handle * \param vfo The target VFO * \param level The level setting * \param val The location where to store the value of \a level * * Retrieves the value of a \a level. * The level value \a val can be a float or an integer. See #value_t * for more information. * * RIG_LEVEL_STRENGTH: \a val is an integer, representing

Source from the content-addressed store, hash-verified

155 * \sa rig_has_get_level(), rig_set_level()
156 */
157int HAMLIB_API rig_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
158{
159 const struct rig_caps *caps;
160 struct rig_state *rs = STATE(rig);
161 int retcode;
162 vfo_t curr_vfo;
163
164 // too verbose
165 //rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);
166
167 if (CHECK_RIG_ARG(rig) || !val)
168 {
169 return -RIG_EINVAL;
170 }
171
172 caps = rig->caps;
173
174 if (caps->get_level == NULL || !rig_has_get_level(rig, level))
175 {
176 return -RIG_ENAVAIL;
177 }
178
179 rig_lock(rig, 1); // Keep Out!
180 /*
181 * Special case(frontend emulation): calibrated S-meter reading
182 */
183 if (level == RIG_LEVEL_STRENGTH
184 && (caps->has_get_level & RIG_LEVEL_STRENGTH) == 0
185 && rig_has_get_level(rig, RIG_LEVEL_RAWSTR)
186 && rs->str_cal.size)
187 {
188
189 value_t rawstr;
190
191 retcode = rig_get_level(rig, vfo, RIG_LEVEL_RAWSTR, &rawstr);
192
193 if (retcode != RIG_OK)
194 {
195 rig_lock(rig, 0);
196 return retcode;
197 }
198
199 val->i = (int)rig_raw2val(rawstr.i, &rs->str_cal);
200 rig_lock(rig, 0);
201 return RIG_OK;
202 }
203
204
205 if ((caps->targetable_vfo & RIG_TARGETABLE_LEVEL)
206 || vfo == RIG_VFO_CURR
207 || vfo == rs->current_vfo)
208 {
209 retcode = caps->get_level(rig, vfo, level, val);
210 rig_lock(rig, 0);
211 return retcode;
212 }
213
214 if (!caps->set_vfo)

Callers 11

dttsp_get_levelFunction · 0.85
getLevelMethod · 0.85
getLevelIMethod · 0.85
getLevelFMethod · 0.85
morse_data_handler_startFunction · 0.85
generic_save_channelFunction · 0.85
handle_ts2000Function · 0.85
mainFunction · 0.85
mainFunction · 0.85
rigctl_parse.cFile · 0.85
mainFunction · 0.85

Calls 3

rig_has_get_levelFunction · 0.85
rig_lockFunction · 0.85
rig_raw2valFunction · 0.85

Tested by

no test coverage detected