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

Function rig_scan

src/rig.c:7260–7315  ·  view source on GitHub ↗

* \brief perform Memory/VFO operations * \param rig The rig handle * \param vfo The target VFO * \param scan The scanning operation to perform * \param ch Optional channel argument used for the scan. * * Performs scanning operation. * See #scan_t for more information. * * \return RIG_OK if the operation has been successful, otherwise * a negative value if an error occurred (in

Source from the content-addressed store, hash-verified

7258 * \sa rig_has_scan()
7259 */
7260int HAMLIB_API rig_scan(RIG *rig, vfo_t vfo, scan_t scan, int ch)
7261{
7262 const struct rig_caps *caps;
7263 int retcode, rc2;
7264 vfo_t curr_vfo;
7265
7266 if (CHECK_RIG_ARG(rig))
7267 {
7268 rig_debug(RIG_DEBUG_ERR, "%s: rig or rig->caps is null\n", __func__);
7269 return -RIG_EINVAL;
7270 }
7271
7272 ENTERFUNC;
7273
7274 caps = rig->caps;
7275
7276 if (caps->scan == NULL
7277 || (scan != RIG_SCAN_STOP && !rig_has_scan(rig, scan)))
7278 {
7279 RETURNFUNC(-RIG_ENAVAIL);
7280 }
7281
7282 if (vfo == RIG_VFO_CURR
7283 || vfo == STATE(rig)->current_vfo)
7284 {
7285 retcode = caps->scan(rig, vfo, scan, ch);
7286 RETURNFUNC(retcode);
7287 }
7288
7289 if (!caps->set_vfo)
7290 {
7291 RETURNFUNC(-RIG_ENAVAIL);
7292 }
7293
7294 curr_vfo = STATE(rig)->current_vfo;
7295 HAMLIB_TRACE;
7296 retcode = caps->set_vfo(rig, vfo);
7297
7298 if (retcode != RIG_OK)
7299 {
7300 RETURNFUNC(retcode);
7301 }
7302
7303 retcode = caps->scan(rig, vfo, scan, ch);
7304 /* try and revert even if we had an error above */
7305 HAMLIB_TRACE;
7306 rc2 = caps->set_vfo(rig, curr_vfo);
7307
7308 if (RIG_OK == retcode)
7309 {
7310 /* Return the first error code */
7311 retcode = rc2;
7312 }
7313
7314 RETURNFUNC(retcode);
7315}
7316
7317

Callers 2

scanMethod · 0.85
rigctl_parse.cFile · 0.85

Calls 3

rig_debugFunction · 0.85
rig_has_scanFunction · 0.85
scanMethod · 0.80

Tested by

no test coverage detected