automotive-dlt
dlt_offline_trace.h File Reference
#include <limits.h>
#include "dlt_types.h"
Include dependency graph for dlt_offline_trace.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  DltOfflineTrace
 

Macros

#define DLT_OFFLINETRACE_FILENAME_BASE   "dlt_offlinetrace"
 
#define DLT_OFFLINETRACE_FILENAME_DELI   "."
 
#define DLT_OFFLINETRACE_FILENAME_EXT   ".dlt"
 
#define DLT_OFFLINETRACE_INDEX_MAX_SIZE   10
 
#define DLT_OFFLINETRACE_FILENAME_TO_COMPARE   "dlt_offlinetrace_"
 
#define DLT_OFFLINETRACE_FILENAME_MAX_SIZE
 

Functions

DltReturnValue dlt_offline_trace_init (DltOfflineTrace *trace, const char *directory, int fileSize, int maxSize, int filenameTimestampBased)
 
DltReturnValue dlt_offline_trace_free (DltOfflineTrace *buf)
 
DltReturnValue dlt_offline_trace_write (DltOfflineTrace *trace, unsigned char *data1, int size1, unsigned char *data2, int size2, unsigned char *data3, int size3)
 
unsigned long dlt_offline_trace_get_total_size (DltOfflineTrace *trace)
 
unsigned int dlt_offline_trace_storage_dir_info (char *path, char *file_name, char *newest, char *oldest)
 
void dlt_offline_trace_file_name (char *log_file_name, char *name, unsigned int idx)
 
unsigned int dlt_offline_trace_get_idx_of_log_file (char *file)
 

Detailed Description

Author
Alexander Wenzel alexa.nosp@m.nder.nosp@m..aw.w.nosp@m.enze.nosp@m.l@bmw.nosp@m..de

Definition in file dlt_offline_trace.h.

Macro Definition Documentation

#define DLT_OFFLINETRACE_FILENAME_BASE   "dlt_offlinetrace"
#define DLT_OFFLINETRACE_FILENAME_DELI   "."

Definition at line 65 of file dlt_offline_trace.h.

Referenced by dlt_offline_trace_file_name().

#define DLT_OFFLINETRACE_FILENAME_EXT   ".dlt"

Definition at line 66 of file dlt_offline_trace.h.

Referenced by dlt_offline_trace_file_name().

#define DLT_OFFLINETRACE_FILENAME_MAX_SIZE
Value:
#define DLT_OFFLINETRACE_FILENAME_BASE
#define DLT_OFFLINETRACE_FILENAME_EXT
#define DLT_OFFLINETRACE_INDEX_MAX_SIZE
#define DLT_OFFLINETRACE_FILENAME_DELI

Definition at line 70 of file dlt_offline_trace.h.

Referenced by dlt_offline_trace_create_new_file(), dlt_offline_trace_file_name(), and dlt_offline_trace_storage_dir_info().

#define DLT_OFFLINETRACE_FILENAME_TO_COMPARE   "dlt_offlinetrace_"

Definition at line 68 of file dlt_offline_trace.h.

Referenced by dlt_offline_trace_delete_oldest_file().

#define DLT_OFFLINETRACE_INDEX_MAX_SIZE   10

Definition at line 67 of file dlt_offline_trace.h.

Function Documentation

void dlt_offline_trace_file_name ( char *  log_file_name,
char *  name,
unsigned int  idx 
)

creates filename with index

Parameters
logfile name created with index
filenamebase
indexto be used for file name creation

Definition at line 168 of file dlt_offline_trace.c.

References DLT_OFFLINETRACE_FILENAME_BASE, DLT_OFFLINETRACE_FILENAME_DELI, DLT_OFFLINETRACE_FILENAME_EXT, and DLT_OFFLINETRACE_FILENAME_MAX_SIZE.

Referenced by dlt_offline_trace_create_new_file().

DltReturnValue dlt_offline_trace_free ( DltOfflineTrace buf)

Uninitialise the offline trace This function call closes currently used log file. This function must be called after usage of offline trace

Parameters
tracepointer to offline trace structure
Returns
negative value if there was an error

Definition at line 440 of file dlt_offline_trace.c.

References DLT_RETURN_ERROR, DLT_RETURN_OK, and DltOfflineTrace::ohandle.

Referenced by dlt_daemon_local_cleanup().

unsigned int dlt_offline_trace_get_idx_of_log_file ( char *  file)

generates index for log file name

Parameters
filenamesupplied to create index
Returns
the index to be used for log file name

Definition at line 181 of file dlt_offline_trace.c.

References NULL.

Referenced by dlt_offline_trace_create_new_file().

unsigned long dlt_offline_trace_get_total_size ( DltOfflineTrace trace)

Get size of currently used offline trace buffer

Returns
size in bytes

Definition at line 264 of file dlt_offline_trace.c.

References DltOfflineTrace::directory, DLT_OFFLINETRACE_FILENAME_BASE, and NULL.

Referenced by dlt_offline_trace_check_size().

DltReturnValue dlt_offline_trace_init ( DltOfflineTrace trace,
const char *  directory,
int  fileSize,
int  maxSize,
int  filenameTimestampBased 
)

Initialise the offline trace This function call opens the currently used log file. A check of the complete size of the offline trace is done during startup. Old files are deleted, if there is not enough space left to create new file. This function must be called before using further offline trace functions.

Parameters
tracepointer to offline trace structure
directorydirectory where to store offline trace files
fileSizemaximum size of one offline trace file.
maxSizemaximum size of complete offline trace in bytes. .
filenameTimestampBasedfilename to be created on timestamp based or index based
Returns
negative value if there was an error

Definition at line 384 of file dlt_offline_trace.c.

References DltOfflineTrace::directory, dlt_offline_trace_check_size(), dlt_offline_trace_create_new_file(), DltOfflineTrace::filenameTimestampBased, DltOfflineTrace::fileSize, and DltOfflineTrace::maxSize.

Referenced by dlt_daemon_local_init_p2().

unsigned int dlt_offline_trace_storage_dir_info ( char *  path,
char *  file_name,
char *  newest,
char *  oldest 
)

Provides info about the offline logs storage directory

Parameters
pathof the storage directory
filenameto search for
pointerto store newest filename
pointerto store oldest filename
Returns
num of files in the directory

Definition at line 70 of file dlt_offline_trace.c.

References DLT_OFFLINETRACE_FILENAME_MAX_SIZE, and NULL.

Referenced by dlt_offline_trace_create_new_file().

DltReturnValue dlt_offline_trace_write ( DltOfflineTrace trace,
unsigned char *  data1,
int  size1,
unsigned char *  data2,
int  size2,
unsigned char *  data3,
int  size3 
)

Write data into offline trace If the current used log file exceeds the max file size, new log file is created. A check of the complete size of the offline trace is done before new file is created. Old files are deleted, if there is not enough space left to create new file.

Parameters
tracepointer to offline trace structure
data1pointer to first data block to be written, null if not used
size1size in bytes of first data block to be written, 0 if not used
data2pointer to second data block to be written, null if not used
size2size in bytes of second data block to be written, 0 if not used
data3pointer to third data block to be written, null if not used
size3size in bytes of third data block to be written, 0 if not used
Returns
negative value if there was an error

Definition at line 398 of file dlt_offline_trace.c.

References dlt_offline_trace_check_size(), dlt_offline_trace_create_new_file(), DLT_RETURN_ERROR, DLT_RETURN_OK, DltOfflineTrace::fileSize, and DltOfflineTrace::ohandle.

Referenced by dlt_daemon_client_send(), and dlt_daemon_process_user_message_log().