69     uint8_t *buf = calloc(rxInfo->
maxBytes, 
sizeof(uint8_t));
 
   74         if (rx_hw < rxInfo->maxBytes - 1) {
 
   76             ti = read(rxInfo->
handle, &(buf[rx_hw]), rxInfo->
maxBytes - rx_hw);
 
   80                 if (errno != EAGAIN) {
 
   83                         "[Serial:%s] Unexpected error while reading from serial port (%s)",
 
   84                         args->
tag, strerror(errno));
 
   91         if (rx_hw < rxInfo->minBytes) {
 
  124     if (rxInfo->
handle >= 0) { 
 
  175         log_error(args->
pstate, 
"[Serial:%s] Error pushing channel name to queue",
 
  191         log_error(args->
pstate, 
"[Serial:%s] Error pushing channel map to queue",
 
  219                   "[Serial:%s] Unable to allocate memory for device parameters", lta->
tag);
 
  238         int sn = strtol(t->
value, NULL, 0);
 
  241                       lta->
tag, strerror(errno));
 
  258                     "[Serial:%s] Unexpected Source ID number (0x%02x)- this may cause analysis problems",
 
  265                     "[Serial:%s] Source number not provided - 0x%02x assigned", lta->
tag,
 
  286                       "[Serial:%s] Error parsing minimum message size: %s", lta->
tag,
 
  294                 "[Serial:%s] Invalid minimum packet size specified (%d is not greater than zero)",
 
  307                       "[Serial:%s] Error parsing maximum message size: %s", lta->
tag,
 
  316                 "[Serial:%s] Invalid maximum packet size specified (%d is not greater than zero)",
 
  325                 "[Serial:%s] Invalid maximum packet size specified (%d is smaller than specified minimum packet size)",
 
  338                       "[Serial:%s] Error parsing minimum poll frequency: %s", lta->
tag,
 
  347                 "[Serial:%s] Invalid minimum poll frequency (%d is not greater than zero)",
 
char * config_qstrdup(const char *c)
Duplicate string, stripping optional leading/trailing quote marks.
 
config_kv * config_get_key(const config_section *cs, const char *kn)
Find configugration key within specific section, by name.
 
void signalHandlersBlock(void)
Block signals that we have handlers for.
 
msg_t * msg_new_string(const uint8_t source, const uint8_t type, const size_t len, const char *str)
Create a new message with a single string embedded.
 
void msg_destroy(msg_t *msg)
Destroy a message.
 
msg_t * msg_new_string_array(const uint8_t source, const uint8_t type, const strarray *array)
Create a new message containing an array of strings.
 
msg_t * msg_new_bytes(const uint8_t source, const uint8_t type, const size_t len, const uint8_t *bytes)
Create a new message containing raw binary data.
 
int openSerialConnection(const char *port, const int baudRate)
Open a serial connection at a given baud rate.
 
#define SLCHAN_TSTAMP
Source timestamp (milliseconds, arbitrary epoch)
 
#define SLCHAN_RAW
Raw device data (Not mandatory)
 
#define SLCHAN_MAP
Channel name map (excludes log channels)
 
#define SLCHAN_NAME
Name of source device.
 
void * rx_setup(void *ptargs)
Generic serial connection setup.
 
void * rx_logging(void *ptargs)
Serial source main logging loop.
 
device_callbacks rx_getCallbacks()
Fill out device callback functions for logging.
 
bool rx_parseConfig(log_thread_args_t *lta, config_section *s)
Take a configuration section and parse parameters.
 
void * rx_shutdown(void *ptargs)
Serial source shutdown.
 
void * rx_channels(void *ptargs)
Serial source channel map.
 
rx_params rx_getParams()
Fill out default MP source parameters.
 
#define SLSOURCE_EXT
External data sources recorded but not interpreted by the logger.
 
atomic_bool shutdownFlag
Trigger clean software shutdown.
 
void log_info(const program_state *s, const int level, const char *format,...)
Output formatted information message at a given level.
 
void log_warning(const program_state *s, const char *format,...)
Output formatted warning message.
 
void log_error(const program_state *s, const char *format,...)
Output formatted error message.
 
bool queue_push(msgqueue *queue, msg_t *msg)
Add a message to the tail of the queue.
 
void sa_destroy(strarray *sa)
Destroy array and contents.
 
strarray * sa_new(int entries)
Allocate storage for a new array.
 
bool sa_create_entry(strarray *array, const int index, const size_t len, const char *src)
Create an string in a given position from a character array and length.
 
Represent a key=value pair.
 
char * value
Configuration item value.
 
Configuration file section.
 
Device specific function information.
 
device_fn startup
Called serially at startup, opens devices etc.
 
Logging thread information.
 
msgqueue * logQ
Main message queue. Pushed to by threads, consumed by main()
 
char * tag
Tag/source name for messages etc.
 
void * dParams
Device/Thread specific data.
 
program_state * pstate
Current program state, used for logging.
 
int returnCode
Thread return code (output)
 
Serial device specific parameters.
 
char * portName
Target port name.
 
char * sourceName
User defined name for this source.
 
int pollFreq
Minimum number of times per second to check for data.
 
int minBytes
Minimum number of bytes to group into a message.
 
int maxBytes
Maximum number of bytes to group into a message.
 
uint8_t sourceNum
Source ID for messages.
 
int baudRate
Baud rate for operations (currently unused)
 
int handle
Handle for currently opened device.