SELKIELogger  1.0.0
Logger internal functions
Collaboration diagram for Logger internal functions:

Modules

 Logger: Datawell WaveBuoy / Receiver support
 
 Logger: GPS Support
 
 Logger: I2C Support
 
 Logger: LPMS device support
 
 Logger: Native device support
 
 Logger: N2K Support
 
 Logger: Generic network device support
 
 Logger: NMEA Support
 
 Logger: Generic serial device support
 
 Logger: Global triggers/signal handlers
 
 Logger: Timer functions
 

Classes

struct  global_opts
 General program options. More...
 
struct  device_callbacks
 Device specific function information. More...
 
struct  log_thread_args_t
 Logging thread information. More...
 
struct  channel_stats
 Channel statistics. More...
 

Macros

#define DEFAULT_MON_PREFIX   "@DEFAULT_MON_PREFIX@"
 If no output file prefix is specified, this will be used as a default.
 
#define DEFAULT_STATE_NAME   "@DEFAULT_STATE_NAME@"
 If no state file name is specified, this will be used as a default.
 
#define DEFAULT_MARK_FREQUENCY   @DEFAULT_MARK_FREQUENCY@
 Default sample/marker frequency.
 
#define DEFAULT_MARK_FREQ_STRING   "@DEFAULT_MARK_FREQUENCY@"
 Default sample/marker frequency, as a string.
 
#define SERIAL_SLEEP   1E3
 Default serial wait time. More...
 

Typedefs

typedef void *(* device_fn) (void *)
 Device specific callback functions.
 
typedef bool(* dc_parser) (log_thread_args_t *, config_section *)
 Data source specific configuration parsers;.
 

Functions

bool timespec_subtract (struct timespec *result, struct timespec *x, struct timespec *y)
 Difference between timespecs (used for rate keeping) More...
 
bool log_softwareVersion (msgqueue *q)
 Push current software version into message queue. More...
 
void destroy_global_opts (struct global_opts *go)
 Cleanup function for global_opts struct. More...
 
bool write_state_file (char *sFName, channel_stats stats[128][128], uint32_t lTS, char *vFName)
 Write out the state file. More...
 

Detailed Description

Macro Definition Documentation

◆ SERIAL_SLEEP

#define SERIAL_SLEEP   1E3

Default serial wait time.

If no data, the various reader threads usleep() for a period to give sensors/devices time to send more data.

The main logging thread also sleeps when no messages are available, which is also based on this value.

Definition at line 51 of file Logger.h.in.

Function Documentation

◆ destroy_global_opts()

void destroy_global_opts ( struct global_opts go)

Cleanup function for global_opts struct.

The global_opts structure should be left in a safe state after calling this function, and calling this function repeatedly should not cause an error.

Parameters
[in]goPointer to structure

Definition at line 943 of file Logger.c.

◆ log_softwareVersion()

bool log_softwareVersion ( msgqueue q)

Push current software version into message queue.

Parameters
[in]qLog queue
Returns
True on success

Definition at line 926 of file Logger.c.

◆ timespec_subtract()

bool timespec_subtract ( struct timespec *  result,
struct timespec *  x,
struct timespec *  y 
)

Difference between timespecs (used for rate keeping)

Timespec subtraction, modified from the timeval example in the glibc manual

Parameters
[out]resultX-Y
[in]xInput X
[in]yInput Y
Returns
true if difference is negative

Definition at line 900 of file Logger.c.

◆ write_state_file()

bool write_state_file ( char *  sFName,
channel_stats  stats[128][128],
uint32_t  lTS,
char *  vFName 
)

Write out the state file.

Truncates and recreates the state file, including last received message statistics, timestamps and path to the channel mapping file currently in use. Any change to this output format also needs to be reflected in SLFiles.py

Todo:
Write to temporary file and atomically move into place
Parameters
[in]sFNameName and path to state file
[in]statsChannel statistics array
[in]lTSLast received timestamp
[in]vFNameName and path to current channel mapping file
Returns
False if unable to create state file, True otherwise

Definition at line 974 of file Logger.c.