Got set_lock_mode and get_lock_mode working now

https://github.com/Hamlib/Hamlib/issues/1044
pull/1068/head
Mike Black W9MDB 2022-06-02 15:55:56 -05:00
rodzic 739f699067
commit f555eceff9
6 zmienionych plików z 66 dodań i 8 usunięć

Wyświetl plik

@ -1219,14 +1219,14 @@ Sends password to rigctld when rigctld has been secured with -A. Must use the 3
.
.TP
.BR set_lock_mode " \(aq" \fILocked\fP \(aq
Turns mode lock on(1) or off(0). Turning on will prevent all clients from changing the rig mode.
Turns mode lock on(1) or off(0) (only when using rigctld). Turning on will prevent all clients from changing the rig mode.
For example this is useful when running CW Skimmer in FM mode on an IC-7300. Clicking spots
in a spotting program will not change the VFOA mode when lock is on. So "set_lock_mode 1" when
CW Skimmer is started and "set_lock_mode 0" when CW Skimmer is stopped.
.
.TP
.BR get_lock_mode
Returns current lock mode status 1=On, 2=Off
Returns current lock mode status 1=On, 2=Off (only useful when using rigctld)
.
.SH READLINE
.

Wyświetl plik

@ -1142,14 +1142,14 @@ This can be dyamically changed while running.
.
.TP
.BR set_lock_mode " \(aq" \fILocked\fP \(aq
Turns mode lock on(1) or off(0). Turning on will prevent all clients from changing the rig mode.
Turns mode lock on(1) or off(0) (only when using rigctld). Turning on will prevent all clients from changing the rig mode.
For example this is useful when running CW Skimmer in FM mode on an IC-7300. Clicking spots
in a spotting program will not change the VFOA mode when lock is on. So "set_lock_mode 1" when
CW Skimmer is started and "set_lock_mode 0" when CW Skimmer is stopped.
.
.TP
.BR get_lock_mode
Returns current lock mode status 1=On, 2=Off
Returns current lock mode status 1=On, 2=Off (only useful with rigctld)
.
.
.SH PROTOCOL

Wyświetl plik

@ -2049,6 +2049,8 @@ struct rig_caps {
char *hamlib_check_rig_caps; // a constant value we can check for hamlib integrity
int (*get_conf2)(RIG *rig, token_t token, char *val, int val_len);
int (*password)(RIG *rig, const char *key1); /*< Send encrypted password if rigctld is secured with -A/--password */
int (*set_lock_mode)(RIG *rig, int mode);
int (*get_lock_mode)(RIG *rig, int *mode);
};
//! @endcond
@ -3406,6 +3408,9 @@ locator2longlat HAMLIB_PARAMS((double *longitude,
extern HAMLIB_EXPORT(char*) rig_make_md5(char *pass);
extern HAMLIB_EXPORT(int) rig_set_lock_mode(RIG *rig, int lock);
extern HAMLIB_EXPORT(int) rig_get_lock_mode(RIG *rig, int *lock);
//! @endcond

Wyświetl plik

@ -2649,6 +2649,22 @@ int netrigctl_password(RIG *rig, const char *key1)
RETURNFUNC(retval);
}
int lock_mode;
int netrigctl_set_lock_mode(RIG *rig, int mode)
{
//rig->state.lock_mode = mode;
lock_mode = mode;
return (RIG_OK);
}
int netrigctl_get_lock_mode(RIG *rig, int *mode)
{
//*mode = rig->state.lock_mode;
*mode = lock_mode;
return (RIG_OK);
}
/*
* Netrigctl rig capabilities.
*/
@ -2764,6 +2780,8 @@ struct rig_caps netrigctl_caps =
.power2mW = netrigctl_power2mW,
.mW2power = netrigctl_mW2power,
.password = netrigctl_password,
.set_lock_mode = netrigctl_set_lock_mode,
.get_lock_mode = netrigctl_get_lock_mode,
.hamlib_check_rig_caps = HAMLIB_CHECK_RIG_CAPS
};

Wyświetl plik

@ -4165,7 +4165,8 @@ int HAMLIB_API rig_set_split_mode(RIG *rig,
// some rigs exhibit undesirable flashing when swapping vfos in split
// so we turn it off, do our thing, and turn split back on
rx_vfo = vfo;
if (tx_vfo == RIG_VFO_B) rx_vfo = RIG_VFO_A;
if (tx_vfo == RIG_VFO_B) { rx_vfo = RIG_VFO_A; }
if (vfo == RIG_VFO_CURR && tx_vfo == RIG_VFO_B) { rx_vfo = RIG_VFO_A; }
else if (vfo == RIG_VFO_CURR && tx_vfo == RIG_VFO_A) { rx_vfo = RIG_VFO_B; }
@ -7306,3 +7307,27 @@ HAMLIB_EXPORT(int) rig_send_raw(RIG *rig, const unsigned char *send,
RETURNFUNC(retval);
}
HAMLIB_EXPORT(int) rig_set_lock_mode(RIG *rig, int mode)
{
int retcode = -RIG_ENAVAIL;
if (rig->caps->set_lock_mode)
{
retcode = rig->caps->set_lock_mode(rig, mode);
}
return (retcode);
}
HAMLIB_EXPORT(int) rig_get_lock_mode(RIG *rig, int *mode)
{
int retcode = -RIG_ENAVAIL;
if (rig->caps->get_lock_mode)
{
retcode = rig->caps->get_lock_mode(rig, mode);
}
return (retcode);
}

Wyświetl plik

@ -5223,17 +5223,27 @@ declare_proto_rig(set_lock_mode)
{
int lock;
CHKSCN1ARG(sscanf(arg1, "%d", &lock));
rig->state.lock_mode = lock != 0;
return RIG_OK;
return (rig_set_lock_mode(rig, lock));
}
/* '0xa3' */
declare_proto_rig(get_lock_mode)
{
int retval;
int lock;
if ((interactive && prompt) || (interactive && !prompt && ext_resp))
{
fprintf(fout, "%s: ", cmd->arg1);
}
fprintf(fout, "%d\n", rig->state.lock_mode);
retval = rig_get_lock_mode(rig, &lock);
if (retval != RIG_OK)
{
return retval;
}
fprintf(fout, "%d\n", lock);
return RIG_OK;
}