automotive-dlt
dlt-control-common.h
Go to the documentation of this file.
1 
24 #ifndef _DLT_CONTROL_COMMON_H_
25 #define _DLT_CONTROL_COMMON_H_
26 
27 #include <stdio.h>
28 
29 #include "dlt_common.h"
30 
31 #define DLT_CTRL_TIMEOUT 10
32 
33 #define DLT_CTRL_ECUID_LEN 10
34 #define DLT_DAEMON_FLAG_MAX 256
35 
36 #ifndef pr_fmt
37 # define pr_fmt(fmt) fmt
38 #endif
39 
40 #ifndef USE_STDOUT
41 # define PRINT_OUT stderr
42 #else
43 # define PRINT_OUT stdout
44 #endif
45 
46 #define pr_error(fmt, ...) \
47  ({ fprintf(PRINT_OUT, pr_fmt(fmt), ## __VA_ARGS__); fflush(PRINT_OUT); })
48 #define pr_verbose(fmt, ...) \
49  ({ if (get_verbosity()) { fprintf(PRINT_OUT, pr_fmt(fmt), ## __VA_ARGS__); fflush(PRINT_OUT); } })
50 
51 #define DLT_CTRL_DEFAULT_ECUID "ECU1"
52 
53 /* To be used as Dlt Message body when sending to DLT daemon */
54 typedef struct
55 {
56  void *data;
57  int size;
59 
60 /* As verbosity, ecuid and timeout are needed during the communication,
61  * defining getter and setters here.
62  * Then there is no need to define them in the control's user application.
63  */
64 int get_verbosity(void);
65 void set_verbosity(int);
66 
67 char *get_ecuid(void);
68 void set_ecuid(char *);
69 
70 long get_timeout(void);
71 void set_timeout(long);
72 
73 /* Parse dlt.conf file and return the value of requested configuration */
74 int dlt_parse_config_param(char *config_id, char **config_data);
75 
76 /* Initialize the connection to the daemon */
77 int dlt_control_init(int (*response_analyser)(char *, void *, int),
78  char *ecuid,
79  int verbosity);
80 
81 /* Send a message to the daemon. The call is not thread safe. */
83 
84 /* Destroys the connection to the daemon */
85 int dlt_control_deinit(void);
86 #endif
int dlt_control_send_message(DltControlMsgBody *, int)
Send a message to the daemon and wait for the asynchronous answer.
int dlt_parse_config_param(char *config_id, char **config_data)
int get_verbosity(void)
void set_verbosity(int)
char * get_ecuid(void)
void set_timeout(long)
int dlt_control_init(int(*response_analyser)(char *, void *, int), char *ecuid, int verbosity)
Control communication initialization.
void set_ecuid(char *)
long get_timeout(void)
int dlt_control_deinit(void)
Control communication clean-up.