Loading...
Searching...
No Matches
Rig (transceiver) Internal API

## 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_publisher_data_packet_s
struct | multicast_publisher_priv_data_s
struct | multicast_receiver_args_s
struct | multicast_receiver_priv_data_s

## Macros

#define | DUMP_HEX_WIDTH 16
| Sets the number of hexadecimal pairs to print per line.
#define | HAMLIB_TRACE2 rig_debug(RIG_DEBUG_TRACE,"%s trace(%d)\n", __FILE__, __LINE__)
#define | MULTICAST_PUBLISHER_DATA_PACKET_TYPE_POLL 0x01
#define | MULTICAST_PUBLISHER_DATA_PACKET_TYPE_TRANSCEIVE 0x02
#define | MULTICAST_PUBLISHER_DATA_PACKET_TYPE_SPECTRUM 0x03
#define | TRACE rig_debug(RIG_DEBUG_ERR, "TRACE %s(%d)\n", __func__,__LINE__);
#define | TOKEN_BACKEND(t)
| Create a backend token, t.
#define | TOKEN_FRONTEND(t)
| Create a frontend token, t.
#define | IS_TOKEN_FRONTEND(t)
| 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)
| Flush with read instead of TCFLUSH.
#define | TOK_ASYNC TOKEN_FRONTEND(37)
| Asynchronous data transfer support.
#define | TOK_TUNER_CONTROL_PATHNAME TOKEN_FRONTEND(38)
| Tuner external control pathname.
#define | TOK_TIMEOUT_RETRY TOKEN_FRONTEND(39)
| Number of retries permitted in case of read timeouts.
#define | TOK_POST_PTT_DELAY TOKEN_FRONTEND(40)
#define | TOK_DEVICE_ID TOKEN_FRONTEND(41)
#define | TOK_VFO_COMP TOKEN_FRONTEND(110)
| rig: VFO compensation in ppm
#define | TOK_POLL_INTERVAL TOKEN_FRONTEND(111)
| rig: Rig state poll interval in milliseconds
#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 in milliseconds
#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: Suppress get_freq on VFOB for satellite RIT tuning
#define | TOK_TWIDDLE_RIT TOKEN_FRONTEND(129)
| rig: Suppress get_freq on VFOB for satellite RIT tuning
#define | TOK_OFFSET_VFOA TOKEN_FRONTEND(130)
| rig: Add Hz to VFOA/Main frequency set
#define | TOK_OFFSET_VFOB TOKEN_FRONTEND(131)
| rig: Add Hz to VFOB/Sub frequency set
#define | TOK_MULTICAST_DATA_ADDR TOKEN_FRONTEND(132)
| rig: Multicast data UDP address for publishing rig data and state, default 224.0.0.1, value of 0.0.0.0 disables multicast data publishing
#define | TOK_MULTICAST_DATA_PORT TOKEN_FRONTEND(133)
| rig: Multicast data UDP port, default 4532
#define | TOK_MULTICAST_CMD_ADDR TOKEN_FRONTEND(134)
| rig: Multicast command server UDP address for sending commands to rig, default 224.0.0.2, value of 0.0.0.0 disables multicast command server
#define | TOK_MULTICAST_CMD_PORT TOKEN_FRONTEND(135)
| rig: Multicast command server UDP port, default 4532
#define | TOK_FREQ_SKIP TOKEN_FRONTEND(136)
| rig: Skip setting freq on opposite VFO when in split mode
#define | TOK_CLIENT TOKEN_FRONTEND(137)
| rig: Client ID of WSJTX or GPREDICT
#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

## Typedefs

typedef struct multicast_publisher_priv_data_s | multicast_publisher_priv_data
typedef struct multicast_receiver_args_s | multicast_receiver_args
typedef struct multicast_receiver_priv_data_s | multicast_receiver_priv_data

## Functions

float | rig_raw2val (int rawval, const cal_table_t *cal)
| Convert raw data to a calibrated integer value, according to a calibration table.
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.
const char * | get_usb_device_class_string (int device_class)
int | cm108_open (hamlib_port_t *port)
| Open CM108 HID port (/dev/hidrawX).
int | cm108_close (hamlib_port_t *port)
| Close a CM108 HID port.
int | cm108_ptt_set (hamlib_port_t *p, ptt_t pttx)
| Set or unset the Push To Talk bit on a CM108 GPIO.
int | cm108_ptt_get (hamlib_port_t *p, ptt_t *pttx)
| Get the state of Push To Talk from a CM108 GPIO.
int | cm108_set_bit (hamlib_port_t *p, enum GPIO gpio, int bit)
int | cm108_get_bit (hamlib_port_t *p, enum GPIO gpio, int *bit)
int | rig_cm108_get_bit (hamlib_port_t *p, enum GPIO gpio, int *bit)
int | rig_cm108_set_bit (hamlib_port_t *p, enum GPIO gpio, int bit)
void | dump_hex (const unsigned char ptr[], size_t size)
| Do a hex dump of the unsigned char array.
int | port_open (hamlib_port_t *p)
| Open a hamlib_port based on its rig port type.
int | port_close (hamlib_port_t *p, rig_port_t port_type)
| Close a hamlib_port.
int | write_block_sync (hamlib_port_t *p, const unsigned char *txbuffer, size_t count)
int | write_block_sync_error (hamlib_port_t *p, const unsigned char *txbuffer, size_t count)
int | port_flush_sync_pipes (hamlib_port_t *p)
int | write_block (hamlib_port_t *p, const unsigned char *txbuffer, size_t count)
| Write a block of characters to an fd.
int | read_block (hamlib_port_t *p, unsigned char *rxbuffer, size_t count)
| Read bytes from the device directly or from the synchronous data pipe, depending on the device caps.
int | read_block_direct (hamlib_port_t *p, unsigned char *rxbuffer, size_t count)
| Read bytes directly from the device file descriptor.
int | read_string (hamlib_port_t *p, unsigned char *rxbuffer, size_t rxmax, const char *stopset, int stopset_len, int flush_flag, int expected_len)
| Read a string from the device directly or from the synchronous data pipe, depending on the device caps.
int | read_string_direct (hamlib_port_t *p, unsigned char *rxbuffer, size_t rxmax, const char *stopset, int stopset_len, int flush_flag, int expected_len)
| Read a string directly from the device file descriptor.
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.
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).
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.
unsigned long long | from_bcd_be (const unsigned char bcd_data[], unsigned bcd_len)
| Convert 4-bit BCD digits to binary, big-endian.
size_t | to_hex (size_t source_length, const unsigned char *source_data, size_t dest_length, char *dest_data)
double | morse_code_dot_to_millis (int wpm)
| Convert duration of one morse code dot (element) to milliseconds at the given speed.
int | dot10ths_to_millis (int dot10ths, int wpm)
| Convert duration of tenths of morse code dots to milliseconds at the given speed.
int | millis_to_dot10ths (int millis, int wpm)
| Convert duration in milliseconds to tenths of morse code dots at the given speed.
int | sprintf_freq (char *str, int str_len, freq_t freq)
| Pretty print a frequency.
const char * | rig_strstatus (enum rig_status_e status)
| Convert enum RIG_STATUS_... to printable string.
rmode_t | rig_parse_mode (const char *s)
| Convert alpha string to enum RIG_MODE.
const char * | rig_strrmode (rmode_t mode)
| Convert enum RIG_MODE to alpha string.
int | rig_strrmodes (rmode_t modes, char *buf, int buflen)
| Convert RIG_MODE or'd value to alpha string of all modes.
vfo_t | rig_parse_vfo (const char *s)
| Convert alpha string to enum RIG_VFO_...
const char * | rig_strvfo (vfo_t vfo)
| Convert enum RIG_VFO_... to alpha string.
uint64_t | rig_idx2setting (int i)
setting_t | rig_parse_func (const char *s)
| Convert alpha string to enum RIG_FUNC_...
setting_t | rig_parse_band (const char *s)
| Convert alpha string to enum band_select_t...
setting_t | rot_parse_func (const char *s)
| Convert alpha string to enum ROT_FUNC_...
const char * | rig_strfunc (setting_t func)
| Convert enum RIG_FUNC_... to alpha string.
const char * | rot_strfunc (setting_t func)
| Convert enum ROT_FUNC_... to alpha string.
setting_t | rig_parse_level (const char *s)
| Convert alpha string to enum RIG_LEVEL_...
setting_t | rot_parse_level (const char *s)
| Convert alpha string to enum ROT_LEVEL_...
setting_t | amp_parse_level (const char *s)
| Convert alpha string to enum AMP_LEVEL_...
const char * | rig_strlevel (setting_t level)
| Convert enum RIG_LEVEL_... to alpha string.
const char * | rot_strlevel (setting_t level)
| Convert enum ROT_LEVEL_... to alpha string.
const char * | amp_strlevel (setting_t level)
| Convert enum AMP_LEVEL_... to alpha string.
setting_t | rig_parse_parm (const char *s)
| Convert alpha string to RIG_PARM_...
setting_t | rot_parse_parm (const char *s)
| Convert alpha string to ROT_PARM_...
const char * | rig_strparm (setting_t parm)
| Convert enum RIG_PARM_... to alpha string.
const char * | rot_strparm (setting_t parm)
| Convert enum ROT_PARM_... to alpha string.
const char * | rig_stragclevel (enum agc_level_e level)
| Convert enum RIG_AGC_... to alpha string.
value_t | rig_valueagclevel (enum agc_level_e agcLevel)
| Convert a enum agc_level_e to value.
enum agc_level_e | rig_levelagcvalue (int agcValue)
| Convert a value to agc_level_e – constrains the range.
enum agc_level_e | rig_levelagcstr (const char *agcString)
| Convert AGC string... to agc_level_e.
vfo_op_t | rig_parse_vfo_op (const char *s)
| Convert alpha string to enum RIG_OP_...
const char * | rig_strvfop (vfo_op_t op)
| Convert enum RIG_OP_... to alpha string.
scan_t | rig_parse_scan (const char *s)
| Convert alpha string to enum RIG_SCAN_...
const char * | rig_strscan (scan_t rscan)
| Convert enum RIG_SCAN_... to alpha string.
const char * | rig_strptrshift (rptr_shift_t shift)
| convert enum RIG_RPT_SHIFT_... to printable character
rptr_shift_t | rig_parse_rptr_shift (const char *s)
| Convert alpha char to enum RIG_RPT_SHIFT_...
chan_type_t | rig_parse_mtype (const char *s)
| Convert alpha string to enum RIG_MTYPE_...
const char * | rig_strmtype (chan_type_t mtype)
| Convert enum RIG_MTYPE_... to alpha string.
const char * | rig_strspectrummode (enum rig_spectrum_mode_e mode)
| Convert enum RIG_SPECTRUM_MODE_... to alpha string.
int | rig_check_cache_timeout (const struct timeval *tv, int timeout)
| Helper for checking cache timeout.
void | rig_force_cache_timeout (struct timeval *tv)
| Helper for forcing cache timeout next call.
vfo_t | vfo_fixup2a (RIG *rig, vfo_t vfo, split_t split, const char *func, int line)
vfo_t | vfo_fixup (RIG *rig, vfo_t vfo, split_t split)
int | parse_hoststr (char *hoststr, int hoststr_len, char host[256], char port[6])
int | rig_flush_force (hamlib_port_t *port, int flush_async_data)
| Force flush of rig communication data buffers.
int | rig_flush (hamlib_port_t *port)
const char * | rot_strstatus (rot_status_t status)
| Convert enum ROT_STATUS_... to a string.
void * | rig_get_function_ptr (rig_model_t rig_model, enum rig_function_e rig_function)
| Get pointer to rig function instead of using rig->caps.
uint64_t | rig_get_caps_int (rig_model_t rig_model, enum rig_caps_int_e rig_caps)
| Get integer/long instead of using rig->caps watch out for integer values that may be negative – if needed must change hamlib.
const char * | rig_get_caps_cptr (rig_model_t rig_model, enum rig_caps_cptr_e rig_caps)
| Function to return char pointer value from rig->caps.
const char * | rig_strcommstatus (rig_comm_status_t status)
| Convert enum RIG_COMM_STATUS... to alpha string.
void | errmsg (int err, char *s, const char *func, const char *file, int line)
uint32_t | CRC32_function (const uint8_t *buf, uint32_t len)
int | queue_deferred_config (deferred_config_header_t *head, hamlib_token_t token, const char *val)
struct multicast_publisher_data_packet_s | __attribute__ ((packed))
int | network_open (hamlib_port_t *rp, int default_port)
| Open network port using STATE(rig) data.
int | network_flush2 (hamlib_port_t *rp, unsigned char *stopset, char *buf, int buf_len)
void | network_flush (hamlib_port_t *rp)
| Clears any data in the read buffer of the socket.
int | network_multicast_publisher_start (RIG *rig, const char *multicast_addr, int multicast_port, enum multicast_item_e items)
| Start multicast publisher.
int | network_multicast_publisher_stop (RIG *rig)
| Stop multicast publisher.
int | network_multicast_receiver_start (RIG *rig, const char *multicast_addr, int multicast_port)
| Start multicast receiver.
int | network_multicast_receiver_stop (RIG *rig)
| Stop multicast receiver.
int | par_open (hamlib_port_t *port)
| Open Parallel Port.
int | par_close (hamlib_port_t *port)
| Close Parallel Port.
int | par_write_data (hamlib_port_t *port, unsigned char data)
| Send data on Parallel port.
int | par_read_data (hamlib_port_t *port, unsigned char *data)
| Receive data on Parallel port.
int | par_write_control (hamlib_port_t *port, unsigned char control)
| Set control data for Parallel Port.
int | par_read_control (hamlib_port_t *port, unsigned char *control)
| Read control data for Parallel Port.
int | par_read_status (hamlib_port_t *port, unsigned char *status)
| Get parallel port status.
int | par_lock (hamlib_port_t *port)
| Get a lock on the Parallel Port.
int | par_unlock (hamlib_port_t *port)
| Release lock on Parallel Port.
int | par_ptt_set (hamlib_port_t *p, ptt_t pttx)
| Set or unset Push to talk bit on Parallel Port.
int | par_ptt_get (hamlib_port_t *p, ptt_t *pttx)
| Get state of Push to Talk from Parallel Port.
int | par_dcd_get (hamlib_port_t *p, dcd_t *dcdx)
| get Data Carrier Detect (squelch) from Parallel Port
int | serial_open (hamlib_port_t *rp)
| Open serial port using port data only.
int | serial_setup (hamlib_port_t *rp)
| Set up Serial port according to requests in port.
int | serial_flush (hamlib_port_t *p)
| Flush all characters waiting in RX buffer.
int | ser_open (hamlib_port_t *p)
| Open serial port.
int | ser_close (hamlib_port_t *p)
| Close serial port.
int | ser_set_rts (hamlib_port_t *p, int state)
| Set Request to Send (RTS) bit.
int | ser_get_rts (hamlib_port_t *p, int *state)
| Get RTS bit.
int | ser_set_dtr (hamlib_port_t *p, int state)
| Set Data Terminal Ready (DTR) bit.
int | ser_get_dtr (hamlib_port_t *p, int *state)
| Get DTR bit.
int | ser_set_brk (const hamlib_port_t *p, int state)
| Set Break.
int | ser_get_car (hamlib_port_t *p, int *state)
| Get Carrier (CI?) bit.
int | ser_get_cts (hamlib_port_t *p, int *state)
| Get Clear to Send (CTS) bit.
int | ser_get_dsr (hamlib_port_t *p, int *state)
| Get Data Set Ready (DSR) bit.

## Variables

FILE * | rig_debug_stream
| multicast_publisher_args

## Detailed Description

## Macro Definition Documentation

## IS_TOKEN_FRONTEND

#define IS_TOKEN_FRONTEND | ( |  | t | ) |

Value:
((t)&(1<<30))

Test for token - frontend?

## TOKEN_BACKEND

#define TOKEN_BACKEND | ( |  | t | ) |

Value:
(t)

Create a backend token, t.

## TOKEN_FRONTEND

#define TOKEN_FRONTEND | ( |  | t | ) |

Value:
((t)|(1<<30))

Create a frontend token, t.

## Function Documentation

## amp_parse_level()

setting_t amp_parse_level | ( | const char * | s | ) |

Convert alpha string to enum AMP_LEVEL_...

Parameters

  s | input alpha string

Returns
  AMP_LEVEL_...

See also
  amp_level_e()

Here is the call graph for this function:

## amp_strlevel()

const char * amp_strlevel | ( | setting_t | level | ) |

Convert enum AMP_LEVEL_... to alpha string.

Parameters

  level | AMP_LEVEL_...

Returns
  alpha string

See also
  amp_level_e()

## cm108_close()

int cm108_close | ( | hamlib_port_t * | port | ) |

Close a CM108 HID port.

Parameters

  port | The port structure

Returns
  Zero if the port was closed successfully, otherwise -1 if an error occurred (in which case, the system errno(3) is set appropriately).

See also
  The close(2) system call.

Here is the call graph for this function:

## cm108_open()

int cm108_open | ( | hamlib_port_t * | port | ) |

Open CM108 HID port (/dev/hidrawX).

Parameters

  port | The port structure.

Returns
  File descriptor, otherwise a negative value if an error occurred (in which case, cause is set appropriately).

Return values

  -RIG_EINVAL | The port pathname is empty or no CM108 device detected.
  -RIG_EIO | The open(2) system call returned a negative value.

Here is the call graph for this function:

## cm108_ptt_get()

int cm108_ptt_get | ( | hamlib_port_t * | p,
|  | ptt_t * | pttx )

Get the state of Push To Talk from a CM108 GPIO.

Parameters

  p | The port structure.
  pttx | Return value (must be non NULL).

Returns
  RIG_OK on success, otherwise a negative value if an error occurred (in which case, cause is set appropriately).

Return values

  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.

Here is the call graph for this function:

## cm108_ptt_set()

int cm108_ptt_set | ( | hamlib_port_t * | p,
|  | ptt_t | pttx )

Set or unset the Push To Talk bit on a CM108 GPIO.

Parameters

  p | The port structure.
  pttx | RIG_PTT_ON --> Set PTT, else unset PTT.

Returns
  RIG_OK on success, otherwise a negative value if an error occurred (in which case, cause is set appropriately).

Return values

  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.

Here is the call graph for this function:

## dot10ths_to_millis()

int dot10ths_to_millis | ( | int | dot10ths,
|  | int | wpm )

Convert duration of tenths of morse code dots to milliseconds at the given speed.

Parameters

  dot10ths | number of 1/10ths of dots
  wpm | morse code speed in words per minute

Returns
  int duration in milliseconds

The morse code speed is calculated using the standard based on word PARIS.

Here is the call graph for this function:

## dump_hex()

void dump_hex | ( | const unsigned char | ptr[],
|  | size_t | size )

extern

Do a hex dump of the unsigned char array.

Parameters

  ptr | Pointer to a character array.
  size | Number of chars to words to dump.

Prints the hex dump to stderr via rig_debug():

0000 4b 30 30 31 34 35 30 30 30 30 30 30 30 35 30 32 K001450000000502
0010 30 30 0d 0a 00..
Here is the call graph for this function:

## from_bcd()

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).

Parameters

  bcd_data |
  bcd_len |

Returns
  binary result (e.g. frequency)

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.

See also
  from_bcd_be()

Here is the call graph for this function:

## from_bcd_be()

unsigned long long from_bcd_be | ( | const unsigned char | bcd_data[],
|  | unsigned | bcd_len )

Convert 4-bit BCD digits to binary, big-endian.

Parameters

  bcd_data |
  bcd_len |

Returns
  binary result

Same as from_bcd, but in big-endian order (e.g. byte order 12 34 56 78 90 for 1234567890 Hz)

See also
  from_bcd()

Here is the call graph for this function:

## millis_to_dot10ths()

int millis_to_dot10ths | ( | int | millis,
|  | int | wpm )

Convert duration in milliseconds to tenths of morse code dots at the given speed.

Parameters

  millis | duration in milliseconds
  wpm | morse code speed in words per minute

Returns
  int number of 1/10ths of dots

The morse code speed is calculated using the standard based on word PARIS.

Here is the call graph for this function:

## morse_code_dot_to_millis()

double morse_code_dot_to_millis | ( | int | wpm | ) |

Convert duration of one morse code dot (element) to milliseconds at the given speed.

Parameters

  wpm | morse code speed in words per minute

Returns
  double duration in milliseconds

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."

Source: http://kent-engineers.com/codespeed.htm

## network_flush()

void network_flush | ( | hamlib_port_t * | rp | ) |

Clears any data in the read buffer of the socket.

Parameters

  rp | Port data structure

Here is the call graph for this function:

## network_multicast_publisher_start()

int network_multicast_publisher_start | ( | RIG * | rig,
|  | const char * | multicast_addr,
|  | int | multicast_port,
|  | enum multicast_item_e | items )

Start multicast publisher.

Start multicast publisher.

Parameters

  multicast_addr | UDP address
  multicast_port | UDP socket port

Returns
  RIG_OK or < 0 if error

Here is the call graph for this function:

## network_multicast_publisher_stop()

int network_multicast_publisher_stop | ( | RIG * | rig | ) |

Stop multicast publisher.

Stop multicast publisher

Returns
  RIG_OK or < 0 if error

Here is the call graph for this function:

## network_multicast_receiver_start()

int network_multicast_receiver_start | ( | RIG * | rig,
|  | const char * | multicast_addr,
|  | int | multicast_port )

Start multicast receiver.

Start multicast receiver.

Parameters

  multicast_addr | UDP address
  multicast_port | UDP socket port

Returns
  RIG_OK or < 0 if error

Here is the call graph for this function:

## network_multicast_receiver_stop()

int network_multicast_receiver_stop | ( | RIG * | rig | ) |

Stop multicast receiver.

Stop multicast receiver

Returns
  RIG_OK or < 0 if error

Here is the call graph for this function:

## network_open()

int network_open | ( | hamlib_port_t * | rp,
|  | int | default_port )

Open network port using STATE(rig) data.

Open network port using STATE(rig) data. NB: The signal PIPE will be ignored for the whole application.

Parameters

  rp | Port data structure (must spec port id eg hostname:port)
  default_port | Default network socket port

Returns
  RIG_OK or < 0 if error

Here is the call graph for this function:

## par_close()

int par_close | ( | hamlib_port_t * | port | ) |

Close Parallel Port.

Parameters

  port |

Here is the call graph for this function:

## par_dcd_get()

int par_dcd_get | ( | hamlib_port_t * | p,
|  | dcd_t * | dcdx )

get Data Carrier Detect (squelch) from Parallel Port

Parameters

  p |
  dcdx | return value (Must be non NULL)

Returns
  RIG_OK or < 0 error

Here is the call graph for this function:

## par_lock()

int par_lock | ( | hamlib_port_t * | port | ) |

Get a lock on the Parallel Port.

Parameters

  port |

Returns
  RIG_OK or < 0

Here is the call graph for this function:

## par_open()

int par_open | ( | hamlib_port_t * | port | ) |

Open Parallel Port.

Parameters

  port |

Returns
  file descriptor

TODO: to be called before exiting: atexit(parport_cleanup) void parport_cleanup() { ioctl(fd, PPRELEASE); }

Here is the call graph for this function:

## par_ptt_get()

int par_ptt_get | ( | hamlib_port_t * | p,
|  | ptt_t * | pttx )

Get state of Push to Talk from Parallel Port.

Parameters

  p |
  pttx | return value (must be non NULL)

Returns
  RIG_OK or < 0 error

Here is the call graph for this function:

## par_ptt_set()

int par_ptt_set | ( | hamlib_port_t * | p,
|  | ptt_t | pttx )

Set or unset Push to talk bit on Parallel Port.

Parameters

  p |
  pttx | RIG_PTT_ON --> Set PTT

Returns
  RIG_OK or < 0 error

Here is the call graph for this function:

## par_read_control()

int par_read_control | ( | hamlib_port_t * | port,
|  | unsigned char * | control )

Read control data for Parallel Port.

Parameters

  port |
  control |

Here is the call graph for this function:

## par_read_data()

int par_read_data | ( | hamlib_port_t * | port,
|  | unsigned char * | data )

Receive data on Parallel port.

Parameters

  port |
  data |

Here is the call graph for this function:

## par_read_status()

int par_read_status | ( | hamlib_port_t * | port,
|  | unsigned char * | status )

Get parallel port status.

Parameters

  port |
  status |

Returns
  RIG_OK or < 0 for error

Here is the call graph for this function:

## par_unlock()

int par_unlock | ( | hamlib_port_t * | port | ) |

Release lock on Parallel Port.

Parameters

  port |

Returns
  RIG_OK or < 0

Here is the call graph for this function:

## par_write_control()

int par_write_control | ( | hamlib_port_t * | port,
|  | unsigned char | control )

Set control data for Parallel Port.

Parameters

  port |
  control |

Here is the call graph for this function:

## par_write_data()

int par_write_data | ( | hamlib_port_t * | port,
|  | unsigned char | data )

Send data on Parallel port.

Parameters

  port |
  data |

Here is the call graph for this function:

## port_close()

int port_close | ( | hamlib_port_t * | p,
|  | rig_port_t | port_type )

Close a hamlib_port.

Parameters

  p | rig port descriptor
  port_type | equivalent rig port type

Returns
  status

Here is the call graph for this function:

## port_open()

int port_open | ( | hamlib_port_t * | p | ) |

Open a hamlib_port based on its rig port type.

Parameters

  p | rig port descriptor

Returns
  status

Here is the call graph for this function:

## queue_deferred_config()

int queue_deferred_config | ( | deferred_config_header_t * | head,
|  | hamlib_token_t | token,
|  | const char * | val )

Add item to be sent to device after it is opened (currently only used by rotators)

## read_block()

int read_block | ( | hamlib_port_t * | p,
|  | unsigned char * | rxbuffer,
|  | size_t | count )

Read bytes from the device directly or from the synchronous data pipe, depending on the device caps.

Parameters

  p | rig port descriptor
  rxbuffer | buffer to receive text
  count | number of bytes

Returns
  count of bytes received

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.

## read_block_direct()

int read_block_direct | ( | hamlib_port_t * | p,
|  | unsigned char * | rxbuffer,
|  | size_t | count )

Read bytes directly from the device file descriptor.

Parameters

  p | rig port descriptor
  rxbuffer | buffer to receive text
  count | number of bytes

Returns
  count of bytes received

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.

## read_string()

int read_string | ( | hamlib_port_t * | p,
|  | unsigned char * | rxbuffer,
|  | size_t | rxmax,
|  | const char * | stopset,
|  | int | stopset_len,
|  | int | flush_flag,
|  | int | expected_len )

Read a string from the device directly or from the synchronous data pipe, depending on the device caps.

Parameters

  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

Returns
  number of characters read if the operation has been successful, otherwise a negative value if an error occurred (in which case, cause is set appropriately).

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

## read_string_direct()

int read_string_direct | ( | hamlib_port_t * | p,
|  | unsigned char * | rxbuffer,
|  | size_t | rxmax,
|  | const char * | stopset,
|  | int | stopset_len,
|  | int | flush_flag,
|  | int | expected_len )

Read a string directly from the device file descriptor.

Parameters

  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

Returns
  number of characters read if the operation has been successful, otherwise a negative value if an error occurred (in which case, cause is set appropriately).

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

## rig_check_cache_timeout()

int rig_check_cache_timeout | ( | const struct timeval * | tv,
|  | int | timeout )

Helper for checking cache timeout.

Parameters

  tv | pointer to timeval, date of cache
  timeout | duration of cache validity, in millisec

Returns
  1 when timed out, 0 when cache shall be used

Here is the call graph for this function:

## rig_flush_force()

int rig_flush_force | ( | hamlib_port_t * | port,
|  | int | flush_async_data )

Force flush of rig communication data buffers.

Parameters

  port | communication port
  flush_async_data | Flushes also asynchronous I/O pipes if non-zero.

Returns
  status code

This function should be used only in special cases like after handling raw command data from Hamlib clients. When asynchronous I/O is enabled, responses to raw commands may disrupt processing of all commands, because the responses and up in the async I/O pipes.

Here is the call graph for this function:

## rig_force_cache_timeout()

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:

rig_get_freq();
rig_set_freq();
rig_get_freq();
rig_get_freq
int rig_get_freq(RIG *rig, vfo_t vfo, freq_t *freq)
get the frequency of the target VFO
Definition rig.c:2498
rig_set_freq
int rig_set_freq(RIG *rig, vfo_t vfo, freq_t freq)
set the frequency of the target VFO
Definition rig.c:2150

doesn't return a bogus (cached) value in the last rig_get_freq().

Parameters

  tv | pointer to timeval to be reset

Here is the call graph for this function:

## rig_get_caps_int()

uint64_t rig_get_caps_int | ( | rig_model_t | rig_model,
|  | enum rig_caps_int_e | rig_caps )

Get integer/long instead of using rig->caps watch out for integer values that may be negative – if needed must change hamlib.

Function to return int value from rig->caps Does not support > 32-bit rig_caps values.

Parameters

  rig_model |
  rig_caps |

Returns
  the corresponding long value – -RIG_EINVAL is the only error possible

Here is the call graph for this function:

## rig_get_function_ptr()

void * rig_get_function_ptr | ( | rig_model_t | rig_model,
|  | enum rig_function_e | rig_function )

Get pointer to rig function instead of using rig->caps.

Function to return pointer to rig_* function.

Parameters

  rig_model |
  rig_function |

Returns
  the corresponding function pointer

Here is the call graph for this function:

## rig_idx2setting()

uint64_t rig_idx2setting | ( | int | i | ) |

utility function to convert index to bit value

## rig_levelagcstr()

enum agc_level_e rig_levelagcstr | ( | const char * | agcString | ) |

Convert AGC string... to agc_level_e.

Parameters

  agcString | AGC string to convert

Returns
  agc_level_e

## rig_levelagcvalue()

enum agc_level_e rig_levelagcvalue | ( | int | agcValue | ) |

Convert a value to agc_level_e – constrains the range.

Parameters

  agcValue | value to convert

Returns
  agc_level_e

## rig_parse_band()

setting_t rig_parse_band | ( | const char * | s | ) |

Convert alpha string to enum band_select_t...

Parameters

  s | input alpha string

Returns
  RIG_FUNC_...

See also
  rig_func_e()

< '' – No Function

Here is the call graph for this function:

## rig_parse_func()

setting_t rig_parse_func | ( | const char * | s | ) |

Convert alpha string to enum RIG_FUNC_...

Parameters

  s | input alpha string

Returns
  RIG_FUNC_...

See also
  rig_func_e()

< '' – No Function

Here is the call graph for this function:

## rig_parse_level()

setting_t rig_parse_level | ( | const char * | s | ) |

Convert alpha string to enum RIG_LEVEL_...

Parameters

  s | input alpha string

Returns
  RIG_LEVEL_...

See also
  rig_level_e()

< '' – No Level

Here is the call graph for this function:

## rig_parse_mode()

rmode_t rig_parse_mode | ( | const char * | s | ) |

Convert alpha string to enum RIG_MODE.

Parameters

  s | input alpha string

Returns
  enum RIG_MODE_??

See also
  rmode_t

< '' – None

Here is the call graph for this function:

## rig_parse_mtype()

chan_type_t rig_parse_mtype | ( | const char * | s | ) |

Convert alpha string to enum RIG_MTYPE_...

Parameters

  s | alpha string

Returns
  RIG_MTYPE_...

See also
  chan_type_t()

Here is the call graph for this function:

## rig_parse_parm()

setting_t rig_parse_parm | ( | const char * | s | ) |

Convert alpha string to RIG_PARM_...

Parameters

  s | input alpha string

Returns
  RIG_PARM_...

See also
  rig_parm_e()

Here is the call graph for this function:

## rig_parse_rptr_shift()

rptr_shift_t rig_parse_rptr_shift | ( | const char * | s | ) |

Convert alpha char to enum RIG_RPT_SHIFT_...

Parameters

  s | alpha char

Returns
  RIG_RPT_SHIFT_...

Here is the call graph for this function:

## rig_parse_scan()

scan_t rig_parse_scan | ( | const char * | s | ) |

Convert alpha string to enum RIG_SCAN_...

Parameters

  s | alpha string

Returns
  RIG_SCAN_...

See also
  scan_t()

Here is the call graph for this function:

## rig_parse_vfo()

vfo_t rig_parse_vfo | ( | const char * | s | ) |

Convert alpha string to enum RIG_VFO_...

Parameters

  s | input alpha string

Returns
  RIG_VFO_...

See also
  RIG_VFO_A RIG_VFO_B RIG_VFO_C RIG_VFO_MAIN RIG_VFO_MAIN_A RIG_VFO_MAIN_B RIG_VFO_SUB RIG_VFO_SUB_A RIG_VFO_SUB_B RIG_VFO_VFO RIG_VFO_CURR RIG_VFO_MEM RIG_VFO_TX RIG_VFO_RX RIG_VFO_NONE

Here is the call graph for this function:

## rig_parse_vfo_op()

vfo_op_t rig_parse_vfo_op | ( | const char * | s | ) |

Convert alpha string to enum RIG_OP_...

Parameters

  s | alpha string

Returns
  RIG_OP_...

See also
  vfo_op_t()

Here is the call graph for this function:

## rig_raw2val()

float rig_raw2val | ( | int | rawval,
|  | const cal_table_t * | cal )

Convert raw data to a calibrated integer value, according to a calibration table.

Parameters

  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.

Returns
  Calibrated integer value.

Here is the call graph for this function:

## rig_raw2val_float()

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.

Parameters

  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.

Returns
  calibrated floating-point value

Here is the call graph for this function:

## rig_stragclevel()

const char * rig_stragclevel | ( | enum agc_level_e | level | ) |

Convert enum RIG_AGC_... to alpha string.

Parameters

  level | RIG_AGC_...

Returns
  alpha string

## rig_strcommstatus()

const char * rig_strcommstatus | ( | rig_comm_status_t | status | ) |

Convert enum RIG_COMM_STATUS... to alpha string.

Parameters

  status | RIG_COMM_STATUS_...

Returns
  alpha string

## rig_strfunc()

const char * rig_strfunc | ( | setting_t | func | ) |

Convert enum RIG_FUNC_... to alpha string.

Parameters

  func | RIG_FUNC_...

Returns
  alpha string

See also
  rig_func_e()

< '' – No Function

## rig_strlevel()

const char * rig_strlevel | ( | setting_t | level | ) |

Convert enum RIG_LEVEL_... to alpha string.

Parameters

  level | RIG_LEVEL_...

Returns
  alpha string

See also
  rig_level_e()

< '' – No Level

Here is the call graph for this function:

## rig_strmtype()

const char * rig_strmtype | ( | chan_type_t | mtype | ) |

Convert enum RIG_MTYPE_... to alpha string.

Parameters

  mtype | RIG_MTYPE_...

Returns
  alpha string

See also
  chan_type_t()

Here is the call graph for this function:

## rig_strparm()

const char * rig_strparm | ( | setting_t | parm | ) |

Convert enum RIG_PARM_... to alpha string.

Parameters

  parm | RIG_PARM_...

Returns
  alpha string

See also
  rig_parm_e()

## rig_strptrshift()

const char * rig_strptrshift | ( | rptr_shift_t | shift | ) |

convert enum RIG_RPT_SHIFT_... to printable character

Parameters

  shift | RIG_RPT_SHIFT_??

Returns
  alpha character

Here is the call graph for this function:

## rig_strrmode()

const char * rig_strrmode | ( | rmode_t | mode | ) |

Convert enum RIG_MODE to alpha string.

Parameters

  mode | RIG_MODE_...

Returns
  alpha string

See also
  rmode_t

< '' – None

Examples
  /tests/testrig.c.

## rig_strrmodes()

int rig_strrmodes | ( | rmode_t | modes,
|  | char * | buf,
|  | int | buflen )

Convert RIG_MODE or'd value to alpha string of all modes.

Parameters

  modes | RIG_MODE or'd value
  buf | char* of result buffer
  buflen | length of buffer

Returns
  rig status – RIG_ETRUNC if buffer not big enough

See also
  rmode_t

< '' – None

## rig_strscan()

const char * rig_strscan | ( | scan_t | rscan | ) |

Convert enum RIG_SCAN_... to alpha string.

Parameters

  rscan | RIG_SCAN_...

Returns
  alpha string

See also
  scan_t()

## rig_strspectrummode()

const char * rig_strspectrummode | ( | enum rig_spectrum_mode_e | mode | ) |

Convert enum RIG_SPECTRUM_MODE_... to alpha string.

Parameters

  mode | RIG_SPECTRUM_MODE_...

Returns
  alpha string

## rig_strstatus()

const char * rig_strstatus | ( | enum rig_status_e | status | ) |

Convert enum RIG_STATUS_... to printable string.

Parameters

  status | RIG_STATUS_??

Returns
  string

## rig_strvfo()

const char * rig_strvfo | ( | vfo_t | vfo | ) |

Convert enum RIG_VFO_... to alpha string.

Parameters

  vfo | RIG_VFO_...

Returns
  alpha string

See also
  RIG_VFO_A RIG_VFO_B RIG_VFO_C RIG_VFO_MAIN RIG_VFO_SUB RIG_VFO_VFO RIG_VFO_CURR RIG_VFO_MEM RIG_VFO_TX RIG_VFO_RX RIG_VFO_NONE

Examples
  /tests/testrig.c.

## rig_strvfop()

const char * rig_strvfop | ( | vfo_op_t | op | ) |

Convert enum RIG_OP_... to alpha string.

Parameters

  op | RIG_OP_...

Returns
  alpha string

See also
  vfo_op_t()

## rig_valueagclevel()

value_t rig_valueagclevel | ( | enum agc_level_e | agcLevel | ) |

Convert a enum agc_level_e to value.

Parameters

  agcLevel | level to convert

Returns
  agc_level_e value

## rot_parse_func()

setting_t rot_parse_func | ( | const char * | s | ) |

Convert alpha string to enum ROT_FUNC_...

Parameters

  s | input alpha string

Returns
  ROT_FUNC_...

See also
  rot_func_e()

< '' – No Function

Here is the call graph for this function:

## rot_parse_level()

setting_t rot_parse_level | ( | const char * | s | ) |

Convert alpha string to enum ROT_LEVEL_...

Parameters

  s | input alpha string

Returns
  ROT_LEVEL_...

See also
  rot_level_e()

Here is the call graph for this function:

## rot_parse_parm()

setting_t rot_parse_parm | ( | const char * | s | ) |

Convert alpha string to ROT_PARM_...

Parameters

  s | input alpha string

Returns
  ROT_PARM_...

See also
  rot_parm_e()

Here is the call graph for this function:

## rot_strfunc()

const char * rot_strfunc | ( | setting_t | func | ) |

Convert enum ROT_FUNC_... to alpha string.

Parameters

  func | ROT_FUNC_...

Returns
  alpha string

See also
  rot_func_e()

< '' – No Function

## rot_strlevel()

const char * rot_strlevel | ( | setting_t | level | ) |

Convert enum ROT_LEVEL_... to alpha string.

Parameters

  level | ROT_LEVEL_...

Returns
  alpha string

See also
  rot_level_e()

Here is the call graph for this function:

## rot_strparm()

const char * rot_strparm | ( | setting_t | parm | ) |

Convert enum ROT_PARM_... to alpha string.

Parameters

  parm | ROT_PARM_...

Returns
  alpha string

See also
  rot_parm_e()

Here is the call graph for this function:

## rot_strstatus()

const char * rot_strstatus | ( | rot_status_t | status | ) |

Convert enum ROT_STATUS_... to a string.

Parameters

  status | ROT_STATUS_...

Returns
  the corresponding string value

## ser_close()

int ser_close | ( | hamlib_port_t * | p | ) |

Close serial port.

Parameters

  p | fd

Returns
  RIG_OK or < 0

Here is the call graph for this function:

## ser_get_car()

int ser_get_car | ( | hamlib_port_t * | p,
|  | int * | state )

Get Carrier (CI?) bit.

Parameters

  p | supposed to be RIGPORT(rig)
  state | non-NULL

## ser_get_cts()

int ser_get_cts | ( | hamlib_port_t * | p,
|  | int * | state )

Get Clear to Send (CTS) bit.

Parameters

  p | supposed to be RIGPORT(rig)
  state | non-NULL

## ser_get_dsr()

int ser_get_dsr | ( | hamlib_port_t * | p,
|  | int * | state )

Get Data Set Ready (DSR) bit.

Parameters

  p | supposed to be RIGPORT(rig)
  state | non-NULL

## ser_get_dtr()

int ser_get_dtr | ( | hamlib_port_t * | p,
|  | int * | state )

Get DTR bit.

Parameters

  p | supposed to be RIGPORT(rig)
  state | non-NULL

## ser_get_rts()

int ser_get_rts | ( | hamlib_port_t * | p,
|  | int * | state )

Get RTS bit.

Parameters

  p | supposed to be RIGPORT(rig)
  state | non-NULL

## ser_open()

int ser_open | ( | hamlib_port_t * | p | ) |

Open serial port.

Parameters

  p |

Returns
  fd

Here is the call graph for this function:

## ser_set_brk()

int ser_set_brk | ( | const hamlib_port_t * | p,
|  | int | state )

Set Break.

Parameters

  p |
  state | (ignored?)

Returns
  RIG_OK or < 0

## ser_set_dtr()

int ser_set_dtr | ( | hamlib_port_t * | p,
|  | int | state )

Set Data Terminal Ready (DTR) bit.

Parameters

  p |
  state | true/false

Returns
  RIG_OK or < 0

Here is the call graph for this function:

## ser_set_rts()

int ser_set_rts | ( | hamlib_port_t * | p,
|  | int | state )

Set Request to Send (RTS) bit.

Parameters

  p |
  state | true/false

Returns
  RIG_OK or < 0

Here is the call graph for this function:

## serial_flush()

int serial_flush | ( | hamlib_port_t * | p | ) |

Flush all characters waiting in RX buffer.

Parameters

  p |

Returns
  RIG_OK

Here is the call graph for this function:

## serial_open()

int serial_open | ( | hamlib_port_t * | rp | ) |

Open serial port using port data only.

Parameters

  rp | port data structure (must spec port id eg /dev/ttyS1)

Returns
  RIG_OK or < 0 if error

Here is the call graph for this function:

## serial_setup()

int serial_setup | ( | hamlib_port_t * | rp | ) |

Set up Serial port according to requests in port.

Parameters

  rp |

Returns
  RIG_OK or < 0

Here is the call graph for this function:

## sprintf_freq()

int sprintf_freq | ( | char * | str,
|  | int | str_len,
|  | freq_t | freq )

Pretty print a frequency.

Parameters

  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

## to_bcd()

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.

Parameters

  bcd_data |
  freq |
  bcd_len |

Returns
  bcd_data

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.

See also
  to_bcd_be()

Here is the call graph for this function:

## to_bcd_be()

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.

Parameters

  bcd_data |
  freq |
  bcd_len |

Returns
  bcd_data

Same as to_bcd, but in big-endian order (e.g. byte order 12 34 56 78 90 for 1234567890 Hz)

See also
  to_bcd()

Here is the call graph for this function:

## write_block()

int write_block | ( | hamlib_port_t * | p,
|  | const unsigned char * | txbuffer,
|  | size_t | count )

Write a block of characters to an fd.

Parameters

  p | rig port descriptor
  txbuffer | command sequence to be sent
  count | number of bytes to send

Returns
  0 = OK, <0 = NOK

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.

Here is the call graph for this function: