kopia lustrzana https://github.com/Hamlib/Hamlib
Add global rig_powerstat so other rigctld clients can see powerstat
https://github.com/Hamlib/Hamlib/issues/1085pull/1091/head
rodzic
ea9257db45
commit
d9c7fda5c9
|
@ -94,6 +94,7 @@ const char hamlib_version[21] = "Hamlib " PACKAGE_VERSION;
|
|||
const char *hamlib_version2 = "Hamlib " PACKAGE_VERSION " " HAMLIBDATETIME;
|
||||
HAMLIB_EXPORT_VAR(int) cookie_use;
|
||||
HAMLIB_EXPORT_VAR(int) lock_mode; // for use by rigctld
|
||||
HAMLIB_EXPORT_VAR(powerstat_t) rig_powerstat; // for use by rigctld
|
||||
//! @endcond
|
||||
|
||||
struct rig_caps caps_test;
|
||||
|
|
|
@ -100,6 +100,8 @@ char rigctld_password[64];
|
|||
int is_passwordOK;
|
||||
int is_rigctld;
|
||||
extern int lock_mode; // used by rigctld
|
||||
extern int rig_powerstat;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1724,14 +1726,15 @@ readline_repeat:
|
|||
|
||||
else
|
||||
{
|
||||
if ((my_rig->state.powerstat == RIG_POWER_OFF || my_rig->state.powerstat == RIG_POWER_STANDBY))
|
||||
if ((rig_powerstat == RIG_POWER_OFF || rig_powerstat == RIG_POWER_STANDBY))
|
||||
{
|
||||
// Update power status
|
||||
powerstat_t stat = RIG_POWER_ON;
|
||||
retcode = rig_get_powerstat(my_rig, &stat);
|
||||
if (retcode == RIG_OK) rig_powerstat = stat;
|
||||
}
|
||||
// only command allows when powered off is 135=set_powerstat
|
||||
if (retcode == RIG_OK && (my_rig->state.powerstat == RIG_POWER_OFF || my_rig->state.powerstat == RIG_POWER_STANDBY) && cmd_entry->cmd != 135)
|
||||
if (retcode == RIG_OK && (rig_powerstat == RIG_POWER_OFF || rig_powerstat == RIG_POWER_STANDBY) && cmd_entry->cmd != 135)
|
||||
{
|
||||
//rig_debug(RIG_DEBUG_WARN, "%s: %s - only \\set_powerstat can be run \n", __func__, rigerror(-RIG_EPOWER));
|
||||
rig_debug(RIG_DEBUG_WARN, "%s: only \\set_powerstat can be run when rig powered off\n", __func__);
|
||||
|
@ -4675,6 +4678,7 @@ declare_proto_rig(set_powerstat)
|
|||
|
||||
retval = rig_set_powerstat(rig, (powerstat_t) stat);
|
||||
rig->state.powerstat = stat;
|
||||
rig_powerstat = stat; // update our global so others can see powerstat
|
||||
fflush(fin);
|
||||
RETURNFUNC(retval);
|
||||
}
|
||||
|
|
|
@ -153,6 +153,7 @@ int multicast_port = 4532;
|
|||
extern char rigctld_password[65];
|
||||
char resp_sep = '\n';
|
||||
extern int lock_mode;
|
||||
extern powerstat_t rig_powerstat;
|
||||
|
||||
#define MAXCONFLEN 1024
|
||||
|
||||
|
@ -1150,7 +1151,7 @@ void *handle_socket(void *arg)
|
|||
char serv[NI_MAXSERV];
|
||||
char send_cmd_term = '\r'; /* send_cmd termination char */
|
||||
int ext_resp = 0;
|
||||
powerstat_t powerstat = RIG_POWER_ON; // defaults to power on
|
||||
rig_powerstat = RIG_POWER_ON; // defaults to power on
|
||||
|
||||
fsockin = get_fsockin(handle_data_arg);
|
||||
|
||||
|
@ -1206,8 +1207,8 @@ void *handle_socket(void *arg)
|
|||
|
||||
#endif
|
||||
|
||||
rig_get_powerstat(my_rig, &powerstat);
|
||||
my_rig->state.powerstat = powerstat;
|
||||
rig_get_powerstat(my_rig, &rig_powerstat);
|
||||
my_rig->state.powerstat = rig_powerstat;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -1237,6 +1238,7 @@ void *handle_socket(void *arg)
|
|||
if (retcode != 0) { rig_debug(RIG_DEBUG_VERBOSE, "%s: rigctl_parse retcode=%d\n", __func__, retcode); }
|
||||
// update our power stat in case power gets turned off
|
||||
rig_get_powerstat(my_rig, &powerstat);
|
||||
rig_powerstat = powerstat;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Ładowanie…
Reference in New Issue