Hamlib/common/API_Candidates
2000-09-15 05:08:40 +00:00

140 lines
3.8 KiB
Plaintext

/*
*
* API Notes -- FS
*
*/
I think it is more intuitive to code things as follows...
backend must implement all opcodes (of course)
this may infer function names like thus (at least according
to yaesu docs not passing vfo as a parameter - aaarrrgh).
eg 6 functions in backend ..
int cmd_set_freq_main_vfo_hz(RIG *rig,freq_t freq, rig_mode_t mode);
int cmd_set_freq_sat_rx_vfo_hz(RIG *rig,freq_t freq, rig_mode_t mode);
int cmd_set_freq_sat_tx_vfo_hz(RIG *rig,freq_t freq, rig_mode_t mode);
long int cmd_get_freq_mode_status_main_vfo(RIG *rig, unsigned char *mode);
long int cmd_get_freq_mode_status_sat_rx_vfo(RIG *rig, unsigned char *mode);
long int cmd_get_freq_mode_status_sat_tx_vfo(RIG *rig, unsigned char *mode);
This creates a large function namespace, this is ok as there
shall be wrappers for them up front anyway. Also, bakend must test
all opcodes anyway.
However, frontend should have reduced namespace for function calls.
eg result, 2 functions up front ....
cmd_set_freq(RIG *rig,freq_t freq, rig_mode_t mode, vfo_t vfo )
long int cmd_get_freq_mode_status(RIG *rig, unsigned char *mode, vfo_t vfo);
ie: 3 to 1 reduction, and an emphasis on what parameters
you are setting on the rig, driven more by the parameter
list, than extending function names.
so, lets create some enums
enum rig_vfo_e {
RIG_VFO_MAIN = 0,
RIG_VFO_RX,
RIG_VFO_TX,
RIG_VFO_SUB,
/* etc */
}
typedef enum rig_vfo_e rig_vfo_t;
enum rig_rptr_shift_e {
RIG_RPT_SHIFT_NONE = 0,
RIG_RPT_SHIFT_MINUS,
RIG_RPT_SHIFT_PLUS,
/* etc */
}
typedef enum rig_rptr_shift_e rig_rptr_shift_t;
#include <rigcaps.h>
/* These are all potential candidates that can go into the API,
* after some cleanup, like type standardization, etc..
*/
void cmd_set_ptt_on(RIG *rig);
void cmd_set_ptt_off(RIG *rig);
void cmd_set_freq_main_vfo(RIG *rig, unsigned char d1, unsigned char d2,
unsigned char d3, unsigned char d4);
void cmd_set_freq_sat_rx_vfo(RIG *rig, unsigned char d1, unsigned char d2,
unsigned char d3, unsigned char d4);
void cmd_set_freq_sat_tx_vfo(RIG *rig, unsigned char d1, unsigned char d2,
unsigned char d3, unsigned char d4);
void cmd_set_opmode_main_vfo(RIG *rig, unsigned char d1);
void cmd_set_opmode_sat_rx_vfo(RIG *rig, unsigned char d1);
void cmd_set_opmode_sat_tx_vfo(RIG *rig, unsigned char d1);
void cmd_set_ctcss_dcs_main_vfo(RIG *rig, unsigned char d1);
void cmd_set_ctcss_dcs_sat_rx_vfo(RIG *rig, unsigned char d1);
void cmd_set_ctcss_dcs_sat_tx_vfo(RIG *rig, unsigned char d1);
void cmd_set_ctcss_freq_main_vfo(RIG *rig, unsigned char d1);
void cmd_set_ctcss_freq_sat_rx_vfo(RIG *rig, unsigned char d1);
void cmd_set_ctcss_freq_sat_tx_vfo(RIG *rig, unsigned char d1);
void cmd_set_dcs_code_main_vfo(RIG *rig, unsigned char d1, unsigned char d2);
void cmd_set_dcs_code_sat_rx_vfo(RIG *rig, unsigned char d1, unsigned char d2);
void cmd_set_dcs_code_sat_tx_vfo(RIG *rig, unsigned char d1, unsigned char d2);
void cmd_set_repeater_shift_minus(RIG *rig);
void cmd_set_repeater_shift_plus(RIG *rig);
void cmd_set_repeater_shift_simplex(RIG *rig);
void cmd_set_repeater_offset(RIG *rig, unsigned char d1, unsigned char d2,
unsigned char d3, unsigned char d4);
unsigned char cmd_get_rx_status(RIG *rig);
unsigned char cmd_get_tx_status(RIG *rig);
/*
* Get frequency and mode info
*
*/
long int cmd_get_freq_mode_status_main_vfo(RIG *rig, unsigned char *mode);
long int cmd_get_freq_mode_status_sat_rx_vfo(RIG *rig, unsigned char *mode);
long int cmd_get_freq_mode_status_sat_tx_vfo(RIG *rig, unsigned char *mode);
/*
* Set frequency in Hz and mode
*
*/
void cmd_set_freq_main_vfo_hz(RIG *rig,freq_t freq, rig_mode_t mode);
void cmd_set_freq_sat_rx_vfo_hz(RIG *rig,freq_t freq, rig_mode_t mode);
void cmd_set_freq_sat_tx_vfo_hz(RIG *rig,freq_t freq, rig_mode_t mode);
/*
* Set Repeater offset in Hz.
*
*/
void cmd_set_repeater_offset_hz(RIG *rig,freq_t freq);