![]() |
Hamlib
4.3
|
Files | |
file | cal.c |
Calibration routines. | |
file | cm108.c |
CM108 GPIO support. | |
file | misc.c |
Miscellaneous utility routines. | |
file | network.c |
Network port IO. | |
file | parallel.c |
Parallel Port IO. | |
file | serial.c |
Serial port IO. | |
file | token.h |
Token definitions. | |
file | usb_port.c |
USB IO. | |
Data Structures | |
struct | multicast_server_args_s |
Macros | |
#define | DUMP_HEX_WIDTH 16 |
Sets the number of hexadecimal pairs to print per line. | |
#define | TOKEN_BACKEND(t) (t) |
Create a backend token, t. | |
#define | TOKEN_FRONTEND(t) ((t)|(1<<30)) |
Create a frontend token, t. | |
#define | IS_TOKEN_FRONTEND(t) ((t)&(1<<30)) |
Test for token - frontend? | |
#define | TOK_FRONTEND_NONE TOKEN_FRONTEND(0) |
Null frontend token. | |
#define | TOK_BACKEND_NONE TOKEN_BACKEND(0) |
Null backend token. | |
#define | TOK_PATHNAME TOKEN_FRONTEND(10) |
Pathname is device for rig control, e.g. /dev/ttyS0. | |
#define | TOK_WRITE_DELAY TOKEN_FRONTEND(12) |
Delay before serial output (units?) | |
#define | TOK_POST_WRITE_DELAY TOKEN_FRONTEND(13) |
Delay after serial output (units?) | |
#define | TOK_TIMEOUT TOKEN_FRONTEND(14) |
Timeout delay (units?) | |
#define | TOK_RETRY TOKEN_FRONTEND(15) |
Number of retries permitted. | |
#define | TOK_SERIAL_SPEED TOKEN_FRONTEND(20) |
Serial speed - "baud rate". | |
#define | TOK_DATA_BITS TOKEN_FRONTEND(21) |
No. data bits per serial character. | |
#define | TOK_STOP_BITS TOKEN_FRONTEND(22) |
No. stop bits per serial character. | |
#define | TOK_PARITY TOKEN_FRONTEND(23) |
Serial parity (format?) | |
#define | TOK_HANDSHAKE TOKEN_FRONTEND(24) |
Serial Handshake (format?) | |
#define | TOK_RTS_STATE TOKEN_FRONTEND(25) |
Serial Req. To Send status. | |
#define | TOK_DTR_STATE TOKEN_FRONTEND(26) |
Serial Data Terminal Ready status. | |
#define | TOK_PTT_TYPE TOKEN_FRONTEND(30) |
PTT type override. | |
#define | TOK_PTT_PATHNAME TOKEN_FRONTEND(31) |
PTT pathname override. | |
#define | TOK_DCD_TYPE TOKEN_FRONTEND(32) |
DCD type override. | |
#define | TOK_DCD_PATHNAME TOKEN_FRONTEND(33) |
DCD pathname override. | |
#define | TOK_PTT_BITNUM TOKEN_FRONTEND(34) |
CM108 GPIO bit number for PTT. | |
#define | TOK_PTT_SHARE TOKEN_FRONTEND(35) |
PTT share with other applications. | |
#define | TOK_FLUSHX TOKEN_FRONTEND(36) |
PTT share with other applications. | |
#define | TOK_VFO_COMP TOKEN_FRONTEND(110) |
rig: ?? | |
#define | TOK_POLL_INTERVAL TOKEN_FRONTEND(111) |
rig: polling interval (units?) | |
#define | TOK_LO_FREQ TOKEN_FRONTEND(112) |
rig: lo frequency of any transverters | |
#define | TOK_RANGE_SELECTED TOKEN_FRONTEND(121) |
rig: Range index 1-5 | |
#define | TOK_RANGE_NAME TOKEN_FRONTEND(122) |
rig: Range Name | |
#define | TOK_CACHE_TIMEOUT TOKEN_FRONTEND(123) |
rig: Cache timeout | |
#define | TOK_AUTO_POWER_ON TOKEN_FRONTEND(124) |
rig: Auto power on rig_open when supported | |
#define | TOK_AUTO_POWER_OFF TOKEN_FRONTEND(125) |
rig: Auto power off rig_close when supported | |
#define | TOK_AUTO_DISABLE_SCREENSAVER TOKEN_FRONTEND(126) |
rig: Auto disable screensaver | |
#define | TOK_DISABLE_YAESU_BANDSELECT TOKEN_FRONTEND(127) |
rig: Disable Yaesu band select logic | |
#define | TOK_TWIDDLE_TIMEOUT TOKEN_FRONTEND(128) |
rig: Supporess get_freq on VFOB for satellite RIT tuning | |
#define | TOK_TWIDDLE_RIT TOKEN_FRONTEND(129) |
rig: Supporess get_freq on VFOB for satellite RIT tuning | |
#define | TOK_MIN_AZ TOKEN_FRONTEND(110) |
rot: Minimum Azimuth | |
#define | TOK_MAX_AZ TOKEN_FRONTEND(111) |
rot: Maximum Azimuth | |
#define | TOK_MIN_EL TOKEN_FRONTEND(112) |
rot: Minimum Elevation | |
#define | TOK_MAX_EL TOKEN_FRONTEND(113) |
rot: Maximum Elevation | |
#define | TOK_SOUTH_ZERO TOKEN_FRONTEND(114) |
rot: South is zero degrees | |
Functions | |
float | rig_raw2val (int rawval, const cal_table_t *cal) |
Convert raw data to a calibrated integer value, according to a calibration table. More... | |
float | rig_raw2val_float (int rawval, const cal_table_float_t *cal) |
Convert raw data to a calibrated floating-point value, according to a calibration table. More... | |
int | cm108_open (hamlib_port_t *port) |
Open CM108 HID port (/dev/hidrawX). More... | |
int | cm108_close (hamlib_port_t *port) |
Close a CM108 HID port. More... | |
int | cm108_ptt_set (hamlib_port_t *p, ptt_t pttx) |
Set or unset the Push To Talk bit on a CM108 GPIO. More... | |
int | cm108_ptt_get (hamlib_port_t *p, ptt_t *pttx) |
Get the state of Push To Talk from a CM108 GPIO. More... | |
void | dump_hex (const unsigned char ptr[], size_t size) |
Do a hex dump of the unsigned char array. More... | |
int | port_open (hamlib_port_t *p) |
Open a hamlib_port based on its rig port type. More... | |
int | port_close (hamlib_port_t *p, rig_port_t port_type) |
Close a hamlib_port. More... | |
int | write_block (hamlib_port_t *p, const char *txbuffer, size_t count) |
Write a block of characters to an fd. More... | |
int | read_block (hamlib_port_t *p, char *rxbuffer, size_t count) |
Read bytes from an fd. More... | |
int | read_string (hamlib_port_t *p, char *rxbuffer, size_t rxmax, const char *stopset, int stopset_len) |
Read a string from an fd. More... | |
unsigned char * | to_bcd (unsigned char bcd_data[], unsigned long long freq, unsigned bcd_len) |
Convert from binary to 4-bit BCD digits, little-endian. More... | |
unsigned long long | from_bcd (const unsigned char bcd_data[], unsigned bcd_len) |
Convert BCD digits, little-endian, to a long long (e.g. frequency in Hz) More... | |
unsigned char * | to_bcd_be (unsigned char bcd_data[], unsigned long long freq, unsigned bcd_len) |
Convert from binary to 4-bit BCD digits, big-endian. More... | |
unsigned long long | from_bcd_be (const unsigned char bcd_data[], unsigned bcd_len) |
Convert 4-bit BCD digits to binary, big-endian. More... | |
double | morse_code_dot_to_millis (int wpm) |
Convert duration of one morse code dot (element) to milliseconds at the given speed. More... | |
int | dot10ths_to_millis (int dot10ths, int wpm) |
Convert duration of tenths of morse code dots to milliseconds at the given speed. More... | |
int | millis_to_dot10ths (int millis, int wpm) |
Convert duration in milliseconds to tenths of morse code dots at the given speed. More... | |
int | sprintf_freq (char *str, int nlen, freq_t freq) |
Pretty print a frequency. More... | |
const char * | rig_strstatus (enum rig_status_e status) |
Convert enum RIG_STATUS_... to printable string. More... | |
rmode_t | rig_parse_mode (const char *s) |
Convert alpha string to enum RIG_MODE. More... | |
const char * | rig_strrmode (rmode_t mode) |
Convert enum RIG_MODE to alpha string. More... | |
int | rig_strrmodes (rmode_t modes, char *buf, int buflen) |
Convert RIG_MODE or'd value to alpha string of all modes. More... | |
vfo_t | rig_parse_vfo (const char *s) |
Convert alpha string to enum RIG_VFO_... More... | |
const char * | rig_strvfo (vfo_t vfo) |
Convert enum RIG_VFO_... to alpha string. More... | |
uint64_t | rig_idx2setting (int i) |
setting_t | rig_parse_func (const char *s) |
Convert alpha string to enum RIG_FUNC_... More... | |
setting_t | rot_parse_func (const char *s) |
Convert alpha string to enum ROT_FUNC_... More... | |
const char * | rig_strfunc (setting_t func) |
Convert enum RIG_FUNC_... to alpha string. More... | |
const char * | rot_strfunc (setting_t func) |
Convert enum ROT_FUNC_... to alpha string. More... | |
setting_t | rig_parse_level (const char *s) |
Convert alpha string to enum RIG_LEVEL_... More... | |
setting_t | rot_parse_level (const char *s) |
Convert alpha string to enum ROT_LEVEL_... More... | |
setting_t | amp_parse_level (const char *s) |
Convert alpha string to enum AMP_LEVEL_... More... | |
const char * | rig_strlevel (setting_t level) |
Convert enum RIG_LEVEL_... to alpha string. More... | |
const char * | rot_strlevel (setting_t level) |
Convert enum ROT_LEVEL_... to alpha string. More... | |
const char * | amp_strlevel (setting_t level) |
Convert enum AMP_LEVEL_... to alpha string. More... | |
setting_t | rig_parse_parm (const char *s) |
Convert alpha string to RIG_PARM_... More... | |
setting_t | rot_parse_parm (const char *s) |
Convert alpha string to ROT_PARM_... More... | |
const char * | rig_strparm (setting_t parm) |
Convert enum RIG_PARM_... to alpha string. More... | |
const char * | rot_strparm (setting_t parm) |
Convert enum ROT_PARM_... to alpha string. More... | |
const char * | rig_stragclevel (enum agc_level_e level) |
Convert enum RIG_AGC_... to alpha string. More... | |
vfo_op_t | rig_parse_vfo_op (const char *s) |
Convert alpha string to enum RIG_OP_... More... | |
const char * | rig_strvfop (vfo_op_t op) |
Convert enum RIG_OP_... to alpha string. More... | |
scan_t | rig_parse_scan (const char *s) |
Convert alpha string to enum RIG_SCAN_... More... | |
const char * | rig_strscan (scan_t rscan) |
Convert enum RIG_SCAN_... to alpha string. More... | |
const char * | rig_strptrshift (rptr_shift_t shift) |
convert enum RIG_RPT_SHIFT_... to printable character More... | |
rptr_shift_t | rig_parse_rptr_shift (const char *s) |
Convert alpha char to enum RIG_RPT_SHIFT_... More... | |
chan_type_t | rig_parse_mtype (const char *s) |
Convert alpha string to enum RIG_MTYPE_... More... | |
const char * | rig_strmtype (chan_type_t mtype) |
Convert enum RIG_MTYPE_... to alpha string. More... | |
const char * | rig_strspectrummode (enum rig_spectrum_mode_e mode) |
Convert enum RIG_SPECTRUM_MODE_... to alpha string. More... | |
int | rig_check_cache_timeout (const struct timeval *tv, int timeout) |
Helper for checking cache timeout. More... | |
void | rig_force_cache_timeout (struct timeval *tv) |
Helper for forcing cache timeout next call. More... | |
int | network_init () |
int | network_open (hamlib_port_t *rp, int default_port) |
Open network port using rig.state data. More... | |
void | network_flush (hamlib_port_t *rp) |
Clears any data in the read buffer of the socket. More... | |
void | sync_callback (int lock) |
int | network_multicast_server (RIG *rig, const char *multicast_addr, int default_port, enum multicast_item_e items) |
Open multicast server using rig.state data. More... | |
int | par_open (hamlib_port_t *port) |
Open Parallel Port. More... | |
int | par_close (hamlib_port_t *port) |
Close Parallel Port. More... | |
int | par_write_data (hamlib_port_t *port, unsigned char data) |
Send data on Parallel port. More... | |
int | par_read_data (hamlib_port_t *port, unsigned char *data) |
Receive data on Parallel port. More... | |
int | par_write_control (hamlib_port_t *port, unsigned char control) |
Set control data for Parallel Port. More... | |
int | par_read_control (hamlib_port_t *port, unsigned char *control) |
Read control data for Parallel Port. More... | |
int | par_read_status (hamlib_port_t *port, unsigned char *status) |
Get parallel port status. More... | |
int | par_lock (hamlib_port_t *port) |
Get a lock on the Parallel Port. More... | |
int | par_unlock (hamlib_port_t *port) |
Release lock on Parallel Port. More... | |
int | par_ptt_set (hamlib_port_t *p, ptt_t pttx) |
Set or unset Push to talk bit on Parallel Port. More... | |
int | par_ptt_get (hamlib_port_t *p, ptt_t *pttx) |
Get state of Push to Talk from Parallel Port. More... | |
int | par_dcd_get (hamlib_port_t *p, dcd_t *dcdx) |
get Data Carrier Detect (squelch) from Parallel Port More... | |
int | serial_open (hamlib_port_t *rp) |
Open serial port using rig.state data. More... | |
int | serial_setup (hamlib_port_t *rp) |
Set up Serial port according to requests in port. More... | |
int | serial_flush (hamlib_port_t *p) |
Flush all characters waiting in RX buffer. More... | |
int | ser_open (hamlib_port_t *p) |
Open serial port. More... | |
int | ser_close (hamlib_port_t *p) |
Close serial port. More... | |
int | ser_set_rts (hamlib_port_t *p, int state) |
Set Request to Send (RTS) bit. More... | |
int | ser_get_rts (hamlib_port_t *p, int *state) |
Get RTS bit. More... | |
int | ser_set_dtr (hamlib_port_t *p, int state) |
Set Data Terminal Ready (DTR) bit. More... | |
int | ser_get_dtr (hamlib_port_t *p, int *state) |
Get DTR bit. More... | |
int | ser_set_brk (hamlib_port_t *p, int state) |
Set Break. More... | |
int | ser_get_car (hamlib_port_t *p, int *state) |
Get Carrier (CI?) bit. More... | |
int | ser_get_cts (hamlib_port_t *p, int *state) |
Get Clear to Send (CTS) bit. More... | |
int | ser_get_dsr (hamlib_port_t *p, int *state) |
Get Data Set Ready (DSR) bit. More... | |
Variables | |
volatile int | multicast_server_run = 1 |
pthread_t | multicast_server_threadId |
struct multicast_server_args_s | multicast_server_args |
setting_t amp_parse_level | ( | const char * | s | ) |
Convert alpha string to enum AMP_LEVEL_...
s | input alpha string |
const char* amp_strlevel | ( | setting_t | level | ) |
Convert enum AMP_LEVEL_... to alpha string.
level | AMP_LEVEL_... |
int cm108_close | ( | hamlib_port_t * | port | ) |
Close a CM108 HID port.
port | The port structure |
errno
(3) is set appropriately).close
(2) system call. int cm108_open | ( | hamlib_port_t * | port | ) |
Open CM108 HID port (/dev/hidrawX).
port | The port structure. |
RIG_EINVAL | The port pathname is empty or no CM108 device detected. |
RIG_EIO | The open (2) system call returned a negative value. |
int cm108_ptt_get | ( | hamlib_port_t * | p, |
ptt_t * | pttx | ||
) |
Get the state of Push To Talk from a CM108 GPIO.
p | The port structure. |
pttx | Return value (must be non NULL). |
RIG_OK | Getting the PTT state was successful. |
RIG_ENIMPL | Getting the state is not yet implemented. |
RIG_ENAVAIL | Getting the state is not available for this PTT type. |
int cm108_ptt_set | ( | hamlib_port_t * | p, |
ptt_t | pttx | ||
) |
Set or unset the Push To Talk bit on a CM108 GPIO.
p | The port structure. |
pttx | RIG_PTT_ON --> Set PTT, else unset PTT. |
RIG_OK | Setting or unsetting the PTT was successful. |
RIG_EINVAL | The file descriptor is invalid or the PTT type is unsupported. |
RIG_EIO | The write (2) system call returned a negative value. |
int dot10ths_to_millis | ( | int | dot10ths, |
int | wpm | ||
) |
Convert duration of tenths of morse code dots to milliseconds at the given speed.
tenths_of_dots | number of 1/10ths of dots |
wpm | morse code speed in words per minute |
The morse code speed is calculated using the standard based on word PARIS.
void dump_hex | ( | const unsigned char | ptr[], |
size_t | size | ||
) |
Do a hex dump of the unsigned char array.
ptr | Pointer to a character array. |
size | Number of chars to words to dump. |
Prints the hex dump to stderr
via rig_debug():
unsigned long long from_bcd | ( | const unsigned char | bcd_data[], |
unsigned | bcd_len | ||
) |
Convert BCD digits, little-endian, to a long long (e.g. frequency in Hz)
bcd_data | |
bcd_len |
Convert BCD digits, little-endian, (byte order 90 78 56 34 12 for 1234567890 Hz) to a long long (e.g. frequency in Hz)
bcd_len is the number of BCD digits.
Hope the compiler will do a good job optimizing it (esp. w/ the 64bit freq)
Returns frequency in Hz an unsigned long long integer.
unsigned long long from_bcd_be | ( | const unsigned char | bcd_data[], |
unsigned | bcd_len | ||
) |
Convert 4-bit BCD digits to binary, big-endian.
bcd_data | |
bcd_len |
Same as from_bcd, but in big-endian order (e.g. byte order 12 34 56 78 90 for 1234567890 Hz)
int millis_to_dot10ths | ( | int | millis, |
int | wpm | ||
) |
Convert duration in milliseconds to tenths of morse code dots at the given speed.
millis | duration in milliseconds |
wpm | morse code speed in words per minute |
The morse code speed is calculated using the standard based on word PARIS.
double morse_code_dot_to_millis | ( | int | wpm | ) |
Convert duration of one morse code dot (element) to milliseconds at the given speed.
wpm | morse code speed in words per minute |
The morse code speed is calculated using the standard based on word PARIS.
"If you send PARIS 5 times in a minute (5WPM) you have sent 250 elements (using correct spacing). 250 elements into 60 seconds per minute = 240 milliseconds per element."
void network_flush | ( | hamlib_port_t * | rp | ) |
Clears any data in the read buffer of the socket.
rp | Port data structure |
int network_multicast_server | ( | RIG * | rig, |
const char * | multicast_addr, | ||
int | default_port, | ||
enum multicast_item_e | items | ||
) |
Open multicast server using rig.state data.
Open Open multicast server using rig.state data. NB: The signal PIPE will be ignored for the whole application.
rp | Port data structure (must spec port id eg hostname:port – hostname defaults to 224.0.1.1) |
default_port | Default network socket port |
int network_open | ( | hamlib_port_t * | rp, |
int | default_port | ||
) |
Open network port using rig.state data.
Open Open network port using rig.state data. NB: The signal PIPE will be ignored for the whole application.
rp | Port data structure (must spec port id eg hostname:port) |
default_port | Default network socket port |
int par_close | ( | hamlib_port_t * | port | ) |
Close Parallel Port.
port |
int par_dcd_get | ( | hamlib_port_t * | p, |
dcd_t * | dcdx | ||
) |
get Data Carrier Detect (squelch) from Parallel Port
p | |
dcdx | return value (Must be non NULL) |
int par_lock | ( | hamlib_port_t * | port | ) |
Get a lock on the Parallel Port.
port |
int par_open | ( | hamlib_port_t * | port | ) |
Open Parallel Port.
port |
TODO: to be called before exiting: atexit(parport_cleanup) void parport_cleanup() { ioctl(fd, PPRELEASE); }
int par_ptt_get | ( | hamlib_port_t * | p, |
ptt_t * | pttx | ||
) |
Get state of Push to Talk from Parallel Port.
p | |
pttx | return value (must be non NULL) |
int par_ptt_set | ( | hamlib_port_t * | p, |
ptt_t | pttx | ||
) |
Set or unset Push to talk bit on Parallel Port.
p | |
pttx | RIG_PTT_ON --> Set PTT |
int par_read_control | ( | hamlib_port_t * | port, |
unsigned char * | control | ||
) |
Read control data for Parallel Port.
port | |
control |
int par_read_data | ( | hamlib_port_t * | port, |
unsigned char * | data | ||
) |
Receive data on Parallel port.
port | |
data |
int par_read_status | ( | hamlib_port_t * | port, |
unsigned char * | status | ||
) |
Get parallel port status.
port | |
status |
int par_unlock | ( | hamlib_port_t * | port | ) |
Release lock on Parallel Port.
port |
int par_write_control | ( | hamlib_port_t * | port, |
unsigned char | control | ||
) |
Set control data for Parallel Port.
port | |
control |
int par_write_data | ( | hamlib_port_t * | port, |
unsigned char | data | ||
) |
Send data on Parallel port.
port | |
data |
int port_close | ( | hamlib_port_t * | p, |
rig_port_t | port_type | ||
) |
Close a hamlib_port.
p | rig port descriptor |
port_type | equivalent rig port type |
int port_open | ( | hamlib_port_t * | p | ) |
Open a hamlib_port based on its rig port type.
p | rig port descriptor |
int read_block | ( | hamlib_port_t * | p, |
char * | rxbuffer, | ||
size_t | count | ||
) |
Read bytes from an fd.
p | rig port descriptor |
rxbuffer | buffer to receive text |
count | number of bytes |
Read "num" bytes from "fd" and put results into an array of unsigned char pointed to by "rxbuffer"
Blocks on read until timeout hits.
It then reads "num" bytes into rxbuffer.
Actually, this function has nothing specific to serial comm, it could work very well also with any file handle, like a socket.
int read_string | ( | hamlib_port_t * | p, |
char * | rxbuffer, | ||
size_t | rxmax, | ||
const char * | stopset, | ||
int | stopset_len | ||
) |
Read a string from an fd.
p | Hamlib port descriptor |
rxbuffer | buffer to receive string |
rxmax | maximum string size + 1 |
stopset | string of recognized end of string characters |
stopset_len | length of stopset |
Read a string from "fd" and put result into an array of unsigned char pointed to by "rxbuffer"
Blocks on read until timeout hits.
It then reads characters until one of the characters in "stopset" is found, or until "rxmax-1" characters was copied into rxbuffer. String termination character is added at the end.
Actually, this function has nothing specific to serial comm, it could work very well also with any file handle, like a socket.
Assumes rxbuffer!=NULL
int rig_check_cache_timeout | ( | const struct timeval * | tv, |
int | timeout | ||
) |
Helper for checking cache timeout.
tv | pointer to timeval, date of cache |
timeout | duration of cache validity, in millisec |
void rig_force_cache_timeout | ( | struct timeval * | tv | ) |
Helper for forcing cache timeout next call.
This function is typically to be called in backend_set_* functions, so that a sequence:
doesn't return a bogus (cached) value in the last rig_get_freq().
tv | pointer to timeval to be reset |
uint64_t rig_idx2setting | ( | int | i | ) |
utility function to convert index to bit value
setting_t rig_parse_func | ( | const char * | s | ) |
Convert alpha string to enum RIG_FUNC_...
s | input alpha string |
< '' – No Function
setting_t rig_parse_level | ( | const char * | s | ) |
Convert alpha string to enum RIG_LEVEL_...
s | input alpha string |
< '' – No Level
rmode_t rig_parse_mode | ( | const char * | s | ) |
Convert alpha string to enum RIG_MODE.
s | input alpha string |
< '' – None
chan_type_t rig_parse_mtype | ( | const char * | s | ) |
Convert alpha string to enum RIG_MTYPE_...
s | alpha string |
setting_t rig_parse_parm | ( | const char * | s | ) |
Convert alpha string to RIG_PARM_...
s | input alpha string |
rptr_shift_t rig_parse_rptr_shift | ( | const char * | s | ) |
Convert alpha char to enum RIG_RPT_SHIFT_...
s | alpha char |
scan_t rig_parse_scan | ( | const char * | s | ) |
Convert alpha string to enum RIG_SCAN_...
s | alpha string |
vfo_t rig_parse_vfo | ( | const char * | s | ) |
Convert alpha string to enum RIG_VFO_...
s | input alpha string |
vfo_op_t rig_parse_vfo_op | ( | const char * | s | ) |
Convert alpha string to enum RIG_OP_...
s | alpha string |
float rig_raw2val | ( | int | rawval, |
const cal_table_t * | cal | ||
) |
Convert raw data to a calibrated integer value, according to a calibration table.
rawval | Input value. |
cal | Calibration table, |
cal_table_t is a data type suited to hold linear calibration.
cal_table_t.size is the number of plots cal_table_t.table contains.
If a value is below or equal to cal_table_t.table[0].raw, rig_raw2val() will return cal_table_t.table[0].val.
If a value is greater or equal to cal_table_t.table[cal_table_t.size-1].raw, rig_raw2val() will return cal_table_t.table[cal_table_t.size-1].val.
float rig_raw2val_float | ( | int | rawval, |
const cal_table_float_t * | cal | ||
) |
Convert raw data to a calibrated floating-point value, according to a calibration table.
rawval | Input value. |
cal | Calibration table. |
cal_table_float_t is a data type suited to hold linear calibration.
cal_table_float_t.size tell the number of plot cal_table_t.table contains.
If a value is below or equal to cal_table_float_t.table[0].raw, rig_raw2val_float() will return cal_table_float_t.table[0].val.
If a value is greater or equal to cal_table_float_t.table[cal_table_float_t.size-1].raw, rig_raw2val_float() will return cal_table_float_t.table[cal_table_float_t.size-1].val.
const char* rig_stragclevel | ( | enum agc_level_e | level | ) |
Convert enum RIG_AGC_... to alpha string.
mode | RIG_AGC_... |
const char* rig_strfunc | ( | setting_t | func | ) |
Convert enum RIG_FUNC_... to alpha string.
func | RIG_FUNC_... |
< '' – No Function
const char* rig_strlevel | ( | setting_t | level | ) |
Convert enum RIG_LEVEL_... to alpha string.
level | RIG_LEVEL_... |
< '' – No Level
const char* rig_strmtype | ( | chan_type_t | mtype | ) |
Convert enum RIG_MTYPE_... to alpha string.
mtype | RIG_MTYPE_... |
const char* rig_strparm | ( | setting_t | parm | ) |
Convert enum RIG_PARM_... to alpha string.
parm | RIG_PARM_... |
const char* rig_strptrshift | ( | rptr_shift_t | shift | ) |
convert enum RIG_RPT_SHIFT_... to printable character
shift | RIG_RPT_SHIFT_?? |
const char* rig_strrmode | ( | rmode_t | mode | ) |
Convert enum RIG_MODE to alpha string.
mode | RIG_MODE_... |
< '' – None
int rig_strrmodes | ( | rmode_t | modes, |
char * | buf, | ||
int | buflen | ||
) |
Convert RIG_MODE or'd value to alpha string of all modes.
modes | RIG_MODE or'd value |
buf | char* of result buffer |
buflen | length of buffer |
< '' – None
const char* rig_strscan | ( | scan_t | rscan | ) |
Convert enum RIG_SCAN_... to alpha string.
rscan | RIG_SCAN_... |
const char* rig_strspectrummode | ( | enum rig_spectrum_mode_e | mode | ) |
Convert enum RIG_SPECTRUM_MODE_... to alpha string.
mode | RIG_SPECTRUM_MODE_... |
const char* rig_strstatus | ( | enum rig_status_e | status | ) |
Convert enum RIG_STATUS_... to printable string.
status | RIG_STATUS_?? |
const char* rig_strvfo | ( | vfo_t | vfo | ) |
Convert enum RIG_VFO_... to alpha string.
vfo | RIG_VFO_... |
const char* rig_strvfop | ( | vfo_op_t | op | ) |
Convert enum RIG_OP_... to alpha string.
op | RIG_OP_... |
setting_t rot_parse_func | ( | const char * | s | ) |
Convert alpha string to enum ROT_FUNC_...
s | input alpha string |
< '' – No Function
setting_t rot_parse_level | ( | const char * | s | ) |
Convert alpha string to enum ROT_LEVEL_...
s | input alpha string |
setting_t rot_parse_parm | ( | const char * | s | ) |
Convert alpha string to ROT_PARM_...
s | input alpha string |
const char* rot_strfunc | ( | setting_t | func | ) |
Convert enum ROT_FUNC_... to alpha string.
func | ROT_FUNC_... |
< '' – No Function
const char* rot_strlevel | ( | setting_t | level | ) |
Convert enum ROT_LEVEL_... to alpha string.
level | ROT_LEVEL_... |
const char* rot_strparm | ( | setting_t | parm | ) |
Convert enum ROT_PARM_... to alpha string.
parm | ROT_PARM_... |
int ser_close | ( | hamlib_port_t * | p | ) |
Close serial port.
p | fd |
int ser_get_car | ( | hamlib_port_t * | p, |
int * | state | ||
) |
Get Carrier (CI?) bit.
p | supposed to be &rig->state.rigport |
state | non-NULL |
int ser_get_cts | ( | hamlib_port_t * | p, |
int * | state | ||
) |
Get Clear to Send (CTS) bit.
p | supposed to be &rig->state.rigport |
state | non-NULL |
int ser_get_dsr | ( | hamlib_port_t * | p, |
int * | state | ||
) |
Get Data Set Ready (DSR) bit.
p | supposed to be &rig->state.rigport |
state | non-NULL |
int ser_get_dtr | ( | hamlib_port_t * | p, |
int * | state | ||
) |
Get DTR bit.
p | supposed to be &rig->state.rigport |
state | non-NULL |
int ser_get_rts | ( | hamlib_port_t * | p, |
int * | state | ||
) |
Get RTS bit.
p | supposed to be &rig->state.rigport |
state | non-NULL |
int ser_open | ( | hamlib_port_t * | p | ) |
Open serial port.
p |
int ser_set_brk | ( | hamlib_port_t * | p, |
int | state | ||
) |
Set Break.
p | |
state | (ignored?) |
int ser_set_dtr | ( | hamlib_port_t * | p, |
int | state | ||
) |
Set Data Terminal Ready (DTR) bit.
p | |
state | true/false |
int ser_set_rts | ( | hamlib_port_t * | p, |
int | state | ||
) |
Set Request to Send (RTS) bit.
p | |
state | true/false |
int serial_flush | ( | hamlib_port_t * | p | ) |
Flush all characters waiting in RX buffer.
p |
int serial_open | ( | hamlib_port_t * | rp | ) |
Open serial port using rig.state data.
rp | port data structure (must spec port id eg /dev/ttyS1) |
int serial_setup | ( | hamlib_port_t * | rp | ) |
Set up Serial port according to requests in port.
rp |
int sprintf_freq | ( | char * | str, |
int | nlen, | ||
freq_t | freq | ||
) |
Pretty print a frequency.
str | for result (may need up to 17 char) |
freq | input in Hz |
rig_freq_snprintf? pretty print frequencies str must be long enough. max can be as long as 17 chars
unsigned char* to_bcd | ( | unsigned char | bcd_data[], |
unsigned long long | freq, | ||
unsigned | bcd_len | ||
) |
Convert from binary to 4-bit BCD digits, little-endian.
bcd_data | |
freq | |
bcd_len |
Convert a long long (e.g. frequency in Hz) to 4-bit BCD digits, packed two digits per octet, in little-endian order (e.g. byte order 90 78 56 34 12 for 1234567890 Hz).
bcd_len is the number of BCD digits, usually 10 or 8 in 1-Hz units, and 6 digits in 100-Hz units for Tx offset data.
Hope the compiler will do a good job optimizing it (esp. w/the 64bit freq)
Returns a pointer to (unsigned char *)bcd_data.
unsigned char* to_bcd_be | ( | unsigned char | bcd_data[], |
unsigned long long | freq, | ||
unsigned | bcd_len | ||
) |
Convert from binary to 4-bit BCD digits, big-endian.
bcd_data | |
freq | |
bcd_len |
Same as to_bcd, but in big-endian order (e.g. byte order 12 34 56 78 90 for 1234567890 Hz)
int write_block | ( | hamlib_port_t * | p, |
const char * | txbuffer, | ||
size_t | count | ||
) |
Write a block of characters to an fd.
p | rig port descriptor |
txbuffer | command sequence to be sent |
count | number of bytes to send |
Write a block of count characters to port file descriptor, with a pause between each character if write_delay is > 0
The write_delay is for Yaesu type rigs..require 5 character sequence to be sent with 50-200msec between each char.
Also, post_write_delay is for some Yaesu rigs (eg: FT747) that get confused with sequential fast writes between cmd sequences.
input:
fd - file descriptor to write to txbuffer - pointer to a command sequence array count - count of byte to send from the txbuffer write_delay - write delay in ms between 2 chars post_write_delay - minimum delay between two writes post_write_date - timeval of last write
Actually, this function has nothing specific to serial comm, it could work very well also with any file handle, like a socket.