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

Classes

struct  csv_msg_handler
 

Typedefs

typedef char *(* csv_header_fn) (const uint8_t, const uint8_t, const char *, const char *)
 
typedef char *(* csv_data_fn) (const msg_t *)
 

Functions

int sort_uint (const void *a, const void *b)
 qsort() comparison function More...
 
char * csv_all_timestamp_headers (const uint8_t source, const uint8_t type, const char *sourceName, const char *channelName)
 Generate CSV header for timestamp messages (SLCHAN_TSTAMP) More...
 
char * csv_all_timestamp_data (const msg_t *msg)
 Convert timestamp (SLCHAN_TSTAMP) to string. More...
 
char * csv_gps_position_headers (const uint8_t source, const uint8_t type, const char *sourceName, const char *channelName)
 Generate CSV header for GPS position fields. More...
 
char * csv_gps_position_data (const msg_t *msg)
 Convert GPS position information to CSV string. More...
 
char * csv_gps_velocity_headers (const uint8_t source, const uint8_t type, const char *sourceName, const char *channelName)
 Generate CSV header for GPS velocity information. More...
 
char * csv_gps_velocity_data (const msg_t *msg)
 Convert GPS velocity information to CSV string. More...
 
char * csv_gps_datetime_headers (const uint8_t source, const uint8_t type, const char *sourceName, const char *channelName)
 Generate CSV header for GPS date and time information. More...
 
char * csv_gps_datetime_data (const msg_t *msg)
 Convert GPS date and time information to appropriate CSV string. More...
 
char * csv_all_float_headers (const uint8_t source, const uint8_t type, const char *sourceName, const char *channelName)
 Generate CSV header for any single value floating point channel. More...
 
char * csv_all_float_data (const msg_t *msg)
 Convert single value floating point data channel to CSV string. More...
 

Detailed Description

Typedef Documentation

◆ csv_data_fn

typedef char*(* csv_data_fn) (const msg_t *)

CSV field generating functions

These functions are passed a pointer to a msg_t structure that matches the source and type registered. Commas are only to be included to separate fields internal to this string, not as first or last character.

If no message of this type was received, the input pointer will be NULL. In this case, the function must generate an appropriate number of empty fields to ensure the output fields remain aligned - or an empty string if the function normally only outputs a single value.

Strings will be freed by caller

Definition at line 79 of file dat2csv.c.

◆ csv_header_fn

typedef char*(* csv_header_fn) (const uint8_t, const uint8_t, const char *, const char *)

CSV Header generating functions

Each function with this type is provided with the message source and type ID, along with the corresponding names (in that order). The function must then allocate an return a string to be incorporated into the CSV header line.

Commas are only to be included to separate fields internal to this string, not as first or last character.

Strings will be freed by caller

Definition at line 63 of file dat2csv.c.

Function Documentation

◆ csv_all_float_data()

char * csv_all_float_data ( const msg_t msg)

Convert single value floating point data channel to CSV string.

Returns single floating point value as a string

Returned string must be freed by caller

Parameters
[in]msgMessage containing float value
Returns
Data from message, as a string

Definition at line 902 of file dat2csv.c.

◆ csv_all_float_headers()

char * csv_all_float_headers ( const uint8_t  source,
const uint8_t  type,
const char *  sourceName,
const char *  channelName 
)

Generate CSV header for any single value floating point channel.

Generic handler for channels representing single floating point values.

Returned string must be freed by caller

Parameters
[in]sourceSource number
[in]typeChannel number (ignored)
[in]sourceNameName of this source (ignored)
[in]channelNameName of this channel
Returns
String representing this source/channel

Definition at line 884 of file dat2csv.c.

◆ csv_all_timestamp_data()

char * csv_all_timestamp_data ( const msg_t msg)

Convert timestamp (SLCHAN_TSTAMP) to string.

Returned string must be freed by caller

Parameters
[in]msgMessage to be interpreted as timestamp
Returns
Message value, as string

Definition at line 734 of file dat2csv.c.

◆ csv_all_timestamp_headers()

char * csv_all_timestamp_headers ( const uint8_t  source,
const uint8_t  type,
const char *  sourceName,
const char *  channelName 
)

Generate CSV header for timestamp messages (SLCHAN_TSTAMP)

Returned string must be freed by caller

Parameters
[in]sourceSource number
[in]typeChannel number (ignored)
[in]sourceNameName of this source (ignored)
[in]channelNameName of this channel (ignored)
Returns
Timestamp field name

Definition at line 716 of file dat2csv.c.

◆ csv_gps_datetime_data()

char * csv_gps_datetime_data ( const msg_t msg)

Convert GPS date and time information to appropriate CSV string.

Returns field containing comma separated values corresponding to the headers in csv_gps_datetime_headers().

Returned string must be freed by caller

Parameters
[in]msgMessage containing GPS data
Returns
Data from message, as a string

Definition at line 862 of file dat2csv.c.

◆ csv_gps_datetime_headers()

char * csv_gps_datetime_headers ( const uint8_t  source,
const uint8_t  type,
const char *  sourceName,
const char *  channelName 
)

Generate CSV header for GPS date and time information.

Returned string must be freed by caller

Parameters
[in]sourceSource number
[in]typeChannel number (ignored)
[in]sourceNameName of this source (ignored)
[in]channelNameName of this channel (ignored)
Returns
Headers for GPS Date and time components

Definition at line 840 of file dat2csv.c.

◆ csv_gps_position_data()

char * csv_gps_position_data ( const msg_t msg)

Convert GPS position information to CSV string.

Returns field containing comma separated values corresponding to the headers in csv_gps_position_headers().

Returned string must be freed by caller

Parameters
[in]msgMessage containing GPS data
Returns
Data from message, as a string

Definition at line 775 of file dat2csv.c.

◆ csv_gps_position_headers()

char * csv_gps_position_headers ( const uint8_t  source,
const uint8_t  type,
const char *  sourceName,
const char *  channelName 
)

Generate CSV header for GPS position fields.

Returned string must be freed by caller

Parameters
[in]sourceSource number
[in]typeChannel number (ignored)
[in]sourceNameName of this source (ignored)
[in]channelNameName of this channel (ignored)
Returns
Headers for GPS field components

Definition at line 751 of file dat2csv.c.

◆ csv_gps_velocity_data()

char * csv_gps_velocity_data ( const msg_t msg)

Convert GPS velocity information to CSV string.

Returns field containing comma separated values corresponding to the headers in csv_gps_velocity_headers().

Returned string must be freed by caller

Parameters
[in]msgMessage containing GPS data
Returns
Data from message, as a string

Definition at line 819 of file dat2csv.c.

◆ csv_gps_velocity_headers()

char * csv_gps_velocity_headers ( const uint8_t  source,
const uint8_t  type,
const char *  sourceName,
const char *  channelName 
)

Generate CSV header for GPS velocity information.

Returned string must be freed by caller

Parameters
[in]sourceSource number
[in]typeChannel number (ignored)
[in]sourceNameName of this source (ignored)
[in]channelNameName of this channel (ignored)
Returns
Headers for GPS Velocity components

Definition at line 794 of file dat2csv.c.

◆ sort_uint()

int sort_uint ( const void *  a,
const void *  b 
)

qsort() comparison function

Parameters
[in]aPointer to uint8_t
[in]bPointer to uint8_t
Returns
1 if a > b, -1 if a < b, else 0

Definition at line 696 of file dat2csv.c.