* \brief get the on/off status of the radio * \param rig The rig handle * \param status The location where to store the current status * * Retrieve the status of 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, cau
| 6956 | * \sa rig_set_powerstat() |
| 6957 | */ |
| 6958 | int HAMLIB_API rig_get_powerstat(RIG *rig, powerstat_t *status) |
| 6959 | { |
| 6960 | int retcode; |
| 6961 | |
| 6962 | if (CHECK_RIG_ARG(rig)) |
| 6963 | { |
| 6964 | *status = RIG_POWER_ON; // default to power on if not available |
| 6965 | return -RIG_EINVAL; |
| 6966 | } |
| 6967 | |
| 6968 | ENTERFUNC; |
| 6969 | |
| 6970 | if (!status) |
| 6971 | { |
| 6972 | RETURNFUNC(-RIG_EINVAL); |
| 6973 | } |
| 6974 | |
| 6975 | if (rig->caps->get_powerstat == NULL) |
| 6976 | { |
| 6977 | *status = RIG_POWER_ON; // default to power if not available |
| 6978 | RETURNFUNC(RIG_OK); |
| 6979 | } |
| 6980 | |
| 6981 | *status = RIG_POWER_OFF; // default now to power off until proven otherwise in get_powerstat |
| 6982 | HAMLIB_TRACE; |
| 6983 | retcode = rig->caps->get_powerstat(rig, status); |
| 6984 | |
| 6985 | if (retcode == RIG_OK) |
| 6986 | { |
| 6987 | STATE(rig)->powerstat = *status; |
| 6988 | } |
| 6989 | else |
| 6990 | { |
| 6991 | // if failed, assume power is on |
| 6992 | *status = RIG_POWER_ON; |
| 6993 | } |
| 6994 | |
| 6995 | RETURNFUNC(retcode); |
| 6996 | } |
| 6997 | |
| 6998 | |
| 6999 | /** |
no outgoing calls
no test coverage detected