![]() |
Hamlib 4.7~git
|
Files | |
file | amp_state.h |
Hamlib amplifier state structure. | |
file | amplifier.h |
Hamlib amplifier data structures. | |
file | amp_conf.c |
Amplifier Configuration Interface. | |
file | amp_settings.c |
Amplifier function/level/parameter interface. | |
file | amplifier.c |
Amplifier interface. | |
file | extamp.c |
Amplifier extension parameters and levels interface. |
Data Structures | |
struct | amp_state |
Amplifier state structure. More... | |
struct | amp_caps |
Amplifier capabilities. More... | |
struct | amp |
Master amplifier structure. More... |
Macros | |
#define | HAMLIB_AMPSTATE(a) |
#define | NETAMPCTL_RET "RPRT " |
The token in the netampctl protocol for returning an error condition code. | |
#define | AMP_MODEL(arg) |
#define | amp_debug rig_debug |
Convenience macro for generating debugging messages. |
Typedefs | |
typedef struct amp | AMP |
Main amplifier handle type definition. | |
typedef float | swr_t |
Type definition for SWR (Standing Wave Ratio). | |
typedef int | tune_value_t |
Type definition for the transmatch tuning values of capacitance and inductance. | |
typedef enum amp_reset_e | amp_reset_t |
Amplifier reset tokens. | |
typedef enum amp_type_e | amp_type_t |
Amplifier type flags. |
Enumerations | |
enum | amp_reset_e { AMP_RESET_MEM , AMP_RESET_FAULT , AMP_RESET_AMP } |
Amplifier reset tokens. More... | |
enum | amp_type_e { AMP_FLAG_1 = (1 << 1) , AMP_FLAG_2 = (1 << 2) } |
Amplifier type flags. More... |
Functions | |
int | amp_token_foreach (AMP *amp, int(*cfunc)(const struct confparams *, rig_ptr_t), rig_ptr_t data) |
Executes cfunc on all the elements stored in the configuration parameters table. | |
const struct confparams * | amp_confparam_lookup (AMP *amp, const char *name) |
Query an amplifier configuration parameter token by its name. | |
hamlib_token_t | amp_token_lookup (AMP *amp, const char *name) |
Search for the token ID associated with an amplifier configuration parameter token name. | |
int | amp_set_conf (AMP *amp, hamlib_token_t token, const char *val) |
Set an amplifier configuration parameter. | |
int | amp_get_conf2 (AMP *amp, hamlib_token_t token, char *val, int val_len) |
Query the value of an amplifier configuration parameter. | |
int | amp_get_conf (AMP *amp, hamlib_token_t token, char *val) |
setting_t | amp_has_set_level (AMP *amp, setting_t level) |
Check which level settings can be set. | |
setting_t | amp_has_get_level (AMP *amp, setting_t level) |
Check which level settings can be queried. | |
AMP * | amp_init (amp_model_t amp_model) |
Allocate a new AMP handle. | |
int | amp_open (AMP *amp) |
Open the communication channel to the amplifier. | |
int | amp_close (AMP *amp) |
Close the communication channel to the amplifier. | |
int | amp_cleanup (AMP *amp) |
Release an AMP handle and free associated memory. | |
int | amp_reset (AMP *amp, amp_reset_t reset) |
Reset the amplifier. | |
int | amp_get_freq (AMP *amp, freq_t *freq) |
Query the operating frequency of the amplifier. | |
int | amp_set_freq (AMP *amp, freq_t freq) |
Set the operating frequency of the amplifier. | |
const char * | amp_get_info (AMP *amp) |
Query general information from the amplifier. | |
int | amp_set_level (AMP *amp, setting_t level, value_t val) |
Set the value of a requested level. | |
int | amp_get_level (AMP *amp, setting_t level, value_t *val) |
Query the value of a requested level. | |
int | amp_set_ext_level (AMP *amp, hamlib_token_t level, value_t val) |
Set the value of a requested extension levels token. | |
int | amp_get_ext_level (AMP *amp, hamlib_token_t level, value_t *val) |
Query the value of a requested extension levels token. | |
int | amp_set_powerstat (AMP *amp, powerstat_t status) |
Turn the amplifier On or Off or toggle the Standby or Operate status. | |
int | amp_get_powerstat (AMP *amp, powerstat_t *status) |
Query the power or standby status of the amplifier. | |
void * | amp_data_pointer (AMP *amp, rig_ptrx_t idx) |
Get the address of amplifier data structure(s) | |
int | amp_ext_level_foreach (AMP *amp, int(*cfunc)(AMP *, const struct confparams *, amp_ptr_t), amp_ptr_t data) |
Executes cfunc on all the elements stored in the amp_caps::extlevels extension levels table. | |
int | amp_ext_parm_foreach (AMP *amp, int(*cfunc)(AMP *, const struct confparams *, amp_ptr_t), amp_ptr_t data) |
Executes cfunc on all the elements stored in the amp_caps::extparms extension parameters table. | |
const struct confparams * | amp_ext_lookup (AMP *amp, const char *name) |
Lookup an extension levels or parameters token by its name and return a pointer to the containing confparams structure member. | |
const struct confparams * | amp_ext_lookup_tok (AMP *amp, hamlib_token_t token) |
Search for an extension levels or parameters token by its constant value and return a pointer to the confparams structure member. | |
hamlib_token_t | amp_ext_token_lookup (AMP *amp, const char *name) |
Simple search returning the extension token ID associated with name. | |
enum | amp_level_e { AMP_LEVEL_NONE = 0 , AMP_LEVEL_SWR = (1 << 0) , AMP_LEVEL_NH = (1 << 1) , AMP_LEVEL_PF = (1 << 2) , AMP_LEVEL_PWR_INPUT = (1 << 3) , AMP_LEVEL_PWR_FWD = (1 << 4) , AMP_LEVEL_PWR_REFLECTED = (1 << 5) , AMP_LEVEL_PWR_PEAK = (1 << 6) , AMP_LEVEL_FAULT = (1 << 7) , AMP_LEVEL_PWR = (1 << 8) } |
#define | AMP_TYPE_MASK (AMP_FLAG_1|AMP_FLAG_2) |
#define | AMP_TYPE_OTHER 0 |
#define | AMP_TYPE_1 AMP_FLAG_1 |
#define | AMP_TYPE_2 AMP_FLAG_2 |
#define | AMP_TYPE_ALL (AMP_FLAG_1|AMP_FLAG_2) |
#define amp_debug rig_debug |
Convenience macro for generating debugging messages.
This is an alias of the rig_debug() function call and is used in the same manner.
#define AMP_MODEL | ( | arg | ) |
#define AMP_TYPE_1 AMP_FLAG_1 |
Amplifier type bit masks.
#define AMP_TYPE_2 AMP_FLAG_2 |
Amplifier type bit masks.
#define AMP_TYPE_ALL (AMP_FLAG_1|AMP_FLAG_2) |
Amplifier type bit masks.
#define AMP_TYPE_MASK (AMP_FLAG_1|AMP_FLAG_2) |
Amplifier type bit masks.
#define AMP_TYPE_OTHER 0 |
Amplifier type bit masks.
#define HAMLIB_AMPSTATE | ( | a | ) |
Macro for application access to amp_state data structure using the AMP handle.
Example code.
Main amplifier handle type definition.
The AMP handle is returned by amp_init() and is passed as a parameter to every amplifier specific API call.
amp_cleanup() must be called when this handle is no longer needed.
typedef float swr_t |
Type definition for SWR (Standing Wave Ratio).
The unit of swr_t is 1.0 to the maximum value reported by the amplifier's internal antenna system tuner, i.e. transmatch, representing the ratio of 1.0:1 to Maximum:1.
typedef int tune_value_t |
Type definition for the transmatch tuning values of capacitance and inductance.
The tune_value_t type is used as a parameter for amp_get_level().
The unit of tune_value_t is picoFarads (pF) or nanoHenrys (nH).
enum amp_level_e |
Amplifier levels as bit masks.
enum amp_reset_e |
enum amp_type_e |
int amp_cleanup | ( | AMP * | amp | ) |
Release an AMP handle and free associated memory.
amp | The AMP handle to be released. |
Releases an AMP handle for which the communications channel has been closed with amp_close().
RIG_OK | AMP handle successfully released. |
-RIG_EINVAL | amp is NULL or inconsistent. |
int amp_close | ( | AMP * | amp | ) |
Close the communication channel to the amplifier.
amp | The AMP handle of the amplifier to be closed. |
Closes the communication channel to an amplifier for which the AMP handle has been passed by argument that was previously opened with amp_open().
RIG_OK | Communication channel successfully closed. |
-RIG_EINVAL | amp is NULL or inconsistent. |
const struct confparams * amp_confparam_lookup | ( | AMP * | amp, |
const char * | name ) |
Query an amplifier configuration parameter token by its name.
amp | The AMP handle. |
name | Configuration parameter token name string. |
Use this function to get a pointer to the token in the confparams structure. Searches the backend config params table first, then falls back to the frontend config params table.
TODO: Should use Lex to speed it up, strcmp() hurts!
void * amp_data_pointer | ( | AMP * | amp, |
rig_ptrx_t | idx ) |
Get the address of amplifier data structure(s)
int amp_ext_level_foreach | ( | AMP * | amp, |
int(* | cfunc )(AMP *, const struct confparams *, amp_ptr_t), | ||
amp_ptr_t | data ) |
Executes cfunc on all the elements stored in the amp_caps::extlevels extension levels table.
amp | The AMP handle. |
cfunc | Callback function of each amp_caps::extlevels. |
data | Cookie to be passed to the callback function cfunc. |
The callback function cfunc is called until it returns a value which is not strictly positive.
RIG_OK | All extension levels elements successfully processed. |
-RIG_EINVAL | amp or cfunc is NULL or inconsistent. |
const struct confparams * amp_ext_lookup | ( | AMP * | amp, |
const char * | name ) |
Lookup an extension levels or parameters token by its name and return a pointer to the containing confparams structure member.
amp | The AMP handle. |
name | The extension levels or parameters token name. |
Searches the amp_caps::extlevels table and then the amp_caps::extparms table for the token by its name.
const struct confparams * amp_ext_lookup_tok | ( | AMP * | amp, |
hamlib_token_t | token ) |
Search for an extension levels or parameters token by its constant value and return a pointer to the confparams structure member.
amp | The AMP handle. |
token | The token value (constant). |
Searches the amp_caps::extlevels table first and then the amp_caps::extparms for the token by its constant value.
int amp_ext_parm_foreach | ( | AMP * | amp, |
int(* | cfunc )(AMP *, const struct confparams *, amp_ptr_t), | ||
amp_ptr_t | data ) |
Executes cfunc on all the elements stored in the amp_caps::extparms extension parameters table.
amp | The AMP handle. |
cfunc | Callback function of each amp_caps::extparms. |
data | Cookie to be passed to the callback function cfunc. |
The callback function cfunc is called until it returns a value which is not strictly positive.
RIG_OK | All extension parameters elements successfully processed. |
-RIG_EINVAL | amp or cfunc is NULL or inconsistent. |
hamlib_token_t amp_ext_token_lookup | ( | AMP * | amp, |
const char * | name ) |
Simple search returning the extension token ID associated with name.
amp | The AMP handle. |
name | The token name string to search. |
int amp_get_conf2 | ( | AMP * | amp, |
hamlib_token_t | token, | ||
char * | val, | ||
int | val_len ) |
Query the value of an amplifier configuration parameter.
amp | The AMP handle. |
token | The token of the parameter to query. |
val | The location where to store the value of the configuration token. |
Retrieves the value of a configuration parameter associated with token.
RIG_OK | Querying the parameter was successful. |
-RIG_EINVAL | amp is NULL or inconsistent. |
-RIG_ENAVAIL | amp_caps::get_conf() capability is not available. |
int amp_get_ext_level | ( | AMP * | amp, |
hamlib_token_t | level, | ||
value_t * | val ) |
Query the value of a requested extension levels token.
amp | The AMP handle. |
level | The requested extension levels token. |
val | The variable to store the extension level token value. |
Query the val corresponding to the extension level token.
RIG_OK | The query was successful. |
-RIG_EINVAL | amp is NULL or inconsistent. |
-RIG_ENAVAIL | amp_caps::get_ext_level() capability is not available. |
Query the operating frequency of the amplifier.
amp | The AMP handle. |
freq | The variable to store the operating frequency. |
Retrieves the operating frequency from the amplifier.
RIG_OK | The query was successful. |
-RIG_EINVAL | amp is NULL or inconsistent. |
-RIG_ENAVAIL | amp_caps::get_freq() capability is not available. |
const char * amp_get_info | ( | AMP * | amp | ) |
Query general information from the amplifier.
amp | The AMP handle. |
Retrieves some general information from the amplifier. This can include firmware revision, exact model name, or just nothing.
Query the value of a requested level.
amp | The AMP handle. |
level | The requested level. |
val | The variable to store the level value. |
Query the val corresponding to the level.
RIG_OK | The query was successful. |
-RIG_EINVAL | amp is NULL or inconsistent. |
-RIG_ENAVAIL | amp_caps::get_level() capability is not available. |
int amp_get_powerstat | ( | AMP * | amp, |
powerstat_t * | status ) |
Query the power or standby status of the amplifier.
amp | The AMP handle. |
status | The variable to store the amplifier status. |
Query the amplifier's power or standby condition. The value stored in status will be one of RIG_POWER_ON, RIG_POWER_OFF and RIG_POWER_OPERATE, RIG_POWER_STANDBY, or RIG_POWER_UNKNOWN.
RIG_OK | Querying the power/standby state was successful. |
-RIG_EINVAL | amp is NULL or inconsistent. |
-RIG_ENAVAIL | amp_caps::get_powerstat() capability is not available. |
Check which level settings can be queried.
amp | The AMP handle. |
level | The level settings bitmap. |
Checks if an amplifier is capable of getting a level setting. Since the level is an OR'ed bitwise argument, more than one level can be checked at the same time.
EXAMPLE:
Check which level settings can be set.
amp | The AMP handle. |
level | The level settings bitmap. |
Checks if an amplifier is capable of setting a level setting. Since the level is an OR'ed bitwise argument, more than one level can be checked at the same time.
EXAMPLE:
AMP * amp_init | ( | amp_model_t | amp_model | ) |
Allocate a new AMP handle.
amp_model | The amplifier model for this new handle. |
Allocates a new AMP handle and initializes the associated data for amp_model (see amplist.h or ampctl -l).
int amp_open | ( | AMP * | amp | ) |
Open the communication channel to the amplifier.
amp | The AMP handle of the amplifier to be opened. |
Opens the communication channel to an amplifier for which the AMP handle has been passed.
RIG_OK | Communication channel successfully opened. |
-RIG_EINVAL | amp is NULL or inconsistent. |
int amp_reset | ( | AMP * | amp, |
amp_reset_t | reset ) |
Reset the amplifier.
amp | The AMP handle. |
reset | The reset operation to perform. |
Perform a reset of the amplifier.
RIG_OK | The reset command was successful. |
-RIG_EINVAL | amp is NULL or inconsistent. |
-RIG_ENAVAIL | amp_caps::reset() capability is not available. |
int amp_set_conf | ( | AMP * | amp, |
hamlib_token_t | token, | ||
const char * | val ) |
Set an amplifier configuration parameter.
amp | The AMP handle. |
token | The token of the parameter to set. |
val | The value to set the parameter to. |
Sets an amplifier configuration parameter to val.
RIG_OK | The parameter was set successfully. |
-RIG_EINVAL | amp is NULL or inconsistent or token is invalid. |
-RIG_ENAVAIL | amp_caps::set_conf() capability is not available. |
int amp_set_ext_level | ( | AMP * | amp, |
hamlib_token_t | level, | ||
value_t | val ) |
Set the value of a requested extension levels token.
amp | The AMP handle. |
level | The requested extension levels token. |
val | The variable to set the extension level token value. |
Query the val corresponding to the extension level token.
RIG_OK | The query was successful. |
-RIG_EINVAL | amp is NULL or inconsistent. |
-RIG_ENAVAIL | amp_caps::set_ext_level() capability is not available. |
Set the operating frequency of the amplifier.
amp | The AMP handle. |
freq | The operating frequency. |
Set the operating frequency of the amplifier. Depending on the amplifier this may simply set the bandpass filters, etc.
RIG_OK | Setting the frequency was successful. |
-RIG_EINVAL | amp is NULL or inconsistent. |
-RIG_ENAVAIL | amp_caps::set_freq() capability is not available. |
Set the value of a requested level.
amp | The AMP handle. |
level | The requested level. |
val | The variable to store the level value. |
Set the val corresponding to the level.
RIG_OK | The query was successful. |
-RIG_EINVAL | amp is NULL or inconsistent. |
-RIG_ENAVAIL | amp_caps::get_level() capability is not available. |
int amp_set_powerstat | ( | AMP * | amp, |
powerstat_t | status ) |
Turn the amplifier On or Off or toggle the Standby or Operate status.
amp | The AMP handle |
status | The powerstat_t setting. |
Turns the amplifier On or Off or toggles the Standby or Operate status. See RIG_POWER_ON, RIG_POWER_OFF and RIG_POWER_OPERATE, RIG_POWER_STANDBY for the value of status.
RIG_OK | The requested power/standby state was successful. |
-RIG_EINVAL | amp is NULL or inconsistent. |
-RIG_ENAVAIL | amp_caps::set_powerstat() capability is not available. |
int amp_token_foreach | ( | AMP * | amp, |
int(* | cfunc )(const struct confparams *, rig_ptr_t), | ||
rig_ptr_t | data ) |
Executes cfunc on all the elements stored in the configuration parameters table.
amp | The AMP handle. |
cfunc | Pointer to the callback function(...). |
data | Data for the callback function. |
Start first with backend configuration parameters table, then finish with frontend configuration parameters table.
RIG_OK | The cfunc action completed successfully. |
-RIG_EINVAL | amp is NULL or inconsistent or cfunc is NULL. |
hamlib_token_t amp_token_lookup | ( | AMP * | amp, |
const char * | name ) |
Search for the token ID associated with an amplifier configuration parameter token name.
amp | The AMP handle. |
name | Configuration parameter token name string. |
Searches the backend and frontend configuration parameters tables for the token ID.