SELKIELogger  1.0.0
Core functions and definitions
Collaboration diagram for Core functions and definitions:

Modules

 Strings and String arrays
 
 Logging support functions
 
 Internal message format and functions
 
 Message queues
 

Files

file  logging.h
 
file  messages.h
 
file  queue.h
 
file  serial.h
 
file  sources.h
 
file  strarray.h
 

Functions

int openSerialConnection (const char *port, const int baudRate)
 Open a serial connection at a given baud rate. More...
 
int baud_to_flag (const int rate)
 Convert a numerical baud rate to termios flag. More...
 
int flag_to_baud (const int flag)
 Convert a termios baud rate flag to a numerical value. More...
 

Detailed Description

Function Documentation

◆ baud_to_flag()

int baud_to_flag ( const int  rate)

Convert a numerical baud rate to termios flag.

Defaults to returning -1 if a rate is not known/available at compile time.

Earlier versions returned -rate.

Parameters
[in]rateBaud rate as integer value
Returns
Corresponding flag from termios.h

Definition at line 100 of file serial.c.

◆ flag_to_baud()

int flag_to_baud ( const int  flag)

Convert a termios baud rate flag to a numerical value.

As with the baud_to_flag() counterpart, will return -1 flag if no matching baud rate is found.

Parameters
[in]flagCorresponding flag from termios.h
Returns
Baud rate as integer value

Definition at line 166 of file serial.c.

◆ openSerialConnection()

int openSerialConnection ( const char *  port,
const int  baudRate 
)

Open a serial connection at a given baud rate.

Opens port and sets the following modes:

  • Read-write
  • Do not make us controlling terminal (ignore control codes in data!)
  • Data synchronised mode
  • Ignore flow control lines

The baud rate provided is compared to the mode requested and an error returned if this does not match.

Parameters
[in]portSerial port device path
[in]baudRateTarget baud rate (will be passed to baud_to_flag()
Returns
-1 on error, file descriptor number on success

Definition at line 44 of file serial.c.