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

Function rig_get_powerstat

src/rig.c:6958–6996  ·  view source on GitHub ↗

* \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

Source from the content-addressed store, hash-verified

6956 * \sa rig_set_powerstat()
6957 */
6958int 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/**

Callers 7

kenwood_openFunction · 0.85
getPowerStatMethod · 0.85
rig_openFunction · 0.85
handle_socketFunction · 0.85
handle_socketFunction · 0.85
mainFunction · 0.85
rigctl_parse.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected