* \brief get the current split modes * \param rig The rig handle * \param vfo The target VFO * \param tx_mode The location where to store the current transmit split mode * \param tx_width The location where to store the current transmit split width * * Retrieves the current split(TX) mode and passband. * If the backend is unable to determine the width, the \a tx_width * will be s
| 5352 | * \sa rig_set_split_mode() |
| 5353 | */ |
| 5354 | int HAMLIB_API rig_get_split_mode(RIG *rig, vfo_t vfo, rmode_t *tx_mode, |
| 5355 | pbwidth_t *tx_width) |
| 5356 | { |
| 5357 | const struct rig_caps *caps; |
| 5358 | const struct rig_state *rs; |
| 5359 | struct rig_cache *cachep; |
| 5360 | int retcode, rc2; |
| 5361 | vfo_t curr_vfo, tx_vfo; |
| 5362 | |
| 5363 | if (CHECK_RIG_ARG(rig)) |
| 5364 | { |
| 5365 | rig_debug(RIG_DEBUG_ERR, "%s: rig or rig->caps is null\n", __func__); |
| 5366 | return -RIG_EINVAL; |
| 5367 | } |
| 5368 | |
| 5369 | ELAPSED1; |
| 5370 | ENTERFUNC; |
| 5371 | |
| 5372 | if (!tx_mode || !tx_width) |
| 5373 | { |
| 5374 | ELAPSED2; |
| 5375 | RETURNFUNC(-RIG_EINVAL); |
| 5376 | } |
| 5377 | |
| 5378 | caps = rig->caps; |
| 5379 | rs = STATE(rig); |
| 5380 | cachep = CACHE(rig); |
| 5381 | |
| 5382 | // Always use the previously selected TX VFO for split. The targeted VFO will have no effect. |
| 5383 | tx_vfo = rs->tx_vfo; |
| 5384 | |
| 5385 | if (cachep->split == RIG_SPLIT_OFF || tx_vfo == RIG_VFO_NONE |
| 5386 | || tx_vfo == RIG_VFO_CURR) |
| 5387 | { |
| 5388 | // Split mode and filter width are not available if split is off |
| 5389 | *tx_mode = RIG_MODE_NONE; |
| 5390 | *tx_width = 0; |
| 5391 | ELAPSED2; |
| 5392 | RETURNFUNC(RIG_OK); |
| 5393 | } |
| 5394 | |
| 5395 | // Use get_split_mode directly if implemented and mode is targetable |
| 5396 | if (caps->get_split_mode && (caps->targetable_vfo & RIG_TARGETABLE_MODE)) |
| 5397 | { |
| 5398 | HAMLIB_TRACE; |
| 5399 | retcode = caps->get_split_mode(rig, tx_vfo, tx_mode, tx_width); |
| 5400 | ELAPSED2; |
| 5401 | |
| 5402 | if (retcode == RIG_OK) |
| 5403 | { |
| 5404 | rig_set_cache_mode(rig, tx_vfo, *tx_mode, *tx_width); |
| 5405 | } |
| 5406 | |
| 5407 | RETURNFUNC(retcode); |
| 5408 | } |
| 5409 | |
| 5410 | // Alternatively, use get_mode if mode is targetable |
| 5411 | if (caps->get_mode && (caps->targetable_vfo & RIG_TARGETABLE_MODE)) |
no test coverage detected