* \brief turn on/off the radio * \param rig The rig handle * \param status The status to set to * * turns on/off the radio. * See #RIG_POWER_ON, #RIG_POWER_OFF and #RIG_POWER_STANDBY defines * for the \a status. * * \return RIG_OK if the operation has been successful, otherwise * a negative value if an error occurred (in which case, cause is * set appropriately). * * \sa rig_get_p
| 6904 | * \sa rig_get_powerstat() |
| 6905 | */ |
| 6906 | int HAMLIB_API rig_set_powerstat(RIG *rig, powerstat_t status) |
| 6907 | { |
| 6908 | int retcode; |
| 6909 | |
| 6910 | rig_debug(RIG_DEBUG_VERBOSE, "%s called status=%d\n", __func__, status); |
| 6911 | |
| 6912 | if (CHECK_RIG_ARG(rig)) |
| 6913 | { |
| 6914 | rig_debug(RIG_DEBUG_ERR, "%s: rig or rig->caps is null\n", __func__); |
| 6915 | return -RIG_EINVAL; |
| 6916 | } |
| 6917 | |
| 6918 | ENTERFUNC; |
| 6919 | ELAPSED1; |
| 6920 | |
| 6921 | if (rig->caps->set_powerstat == NULL) |
| 6922 | { |
| 6923 | rig_debug(RIG_DEBUG_WARN, "%s set_powerstat not implemented\n", __func__); |
| 6924 | STATE(rig)->powerstat = |
| 6925 | RIG_POWER_ON; // assume we are on if we can't set_powerstat |
| 6926 | RETURNFUNC(-RIG_ENAVAIL); |
| 6927 | } |
| 6928 | |
| 6929 | HAMLIB_TRACE; |
| 6930 | retcode = rig->caps->set_powerstat(rig, status); |
| 6931 | |
| 6932 | if (retcode == RIG_OK) |
| 6933 | { |
| 6934 | STATE(rig)->powerstat = status; |
| 6935 | } |
| 6936 | |
| 6937 | // if anything is queued up flush it |
| 6938 | rig_flush_force(RIGPORT(rig), 1); |
| 6939 | ELAPSED2; |
| 6940 | RETURNFUNC(retcode); |
| 6941 | } |
| 6942 | |
| 6943 | |
| 6944 | /** |
no test coverage detected