SELKIELogger  1.0.0
dat2csv.c File Reference

Simple CSV conversion utility. More...

#include <errno.h>
#include <libgen.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#include <zlib.h>
#include "SELKIELoggerBase.h"
#include "SELKIELoggerMP.h"
#include "version.h"
Include dependency graph for dat2csv.c:

Go to the source code of this file.

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...
 
void free_sn_cn (char *sn[128], char *cn[128][128])
 Tidy up source and channel name arrays. More...
 
int main (int argc, char *argv[])
 

Detailed Description

Simple CSV conversion utility.

Definition in file dat2csv.c.

Function Documentation

◆ free_sn_cn()

void free_sn_cn ( char *  sn[128],
char *  cn[128][128] 
)

Tidy up source and channel name arrays.

Iterate over the array and free any allocated source and channel names.

Parameters
snSource name array
cnChannel name array

Definition at line 677 of file dat2csv.c.

◆ main()

int main ( int  argc,
char *  argv[] 
)

Groups messages from a recorded .dat file based on ticks of a nominated timestamp source (defaults to local timestamps). First message in each tick wins. Output files are gzip compressed by default.

Parameters
[in]argcArgument count
[in]argvArguments
Returns
-1 on error, otherwise 0

Definition at line 141 of file dat2csv.c.