From 5574d46a4083d783a915688e0e05593b9558497b Mon Sep 17 00:00:00 2001 From: Frederic Berat Date: Wed, 7 Oct 2015 19:35:25 +0900 Subject: Control application: Control appliction to support offline log storage trigger Features : 1. One shot trigger with path 2. Automounter based trigger 3. Udev based trigger Signed-off-by: Frederic Berat Signed-off-by: Christoph Lipka Signed-off-by: anitha.ba Signed-off-by: S. Hameed --- src/console/dlt-control-common.h | 82 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 src/console/dlt-control-common.h (limited to 'src/console/dlt-control-common.h') diff --git a/src/console/dlt-control-common.h b/src/console/dlt-control-common.h new file mode 100644 index 0000000..b8d712f --- /dev/null +++ b/src/console/dlt-control-common.h @@ -0,0 +1,82 @@ +/** + * @licence app begin@ + * Copyright (C) 2015 Advanced Driver Information Technology. + * This code is developed by Advanced Driver Information Technology. + * Copyright of Advanced Driver Information Technology, Bosch and DENSO. + * + * This file is part of GENIVI Project Dlt - Diagnostic Log and Trace console apps. + * + * + * \copyright + * This Source Code Form is subject to the terms of the + * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with + * this file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * + * \author Christoph Lipka ADIT 2015 + * \author Frederic Berat ADIT 2015 + * + * \file dlt-control-common.h + * For further information see http://www.genivi.org/. + * @licence end@ + */ + +#ifndef _DLT_CONTROL_COMMON_H_ +#define _DLT_CONTROL_COMMON_H_ + +#include + +#include "dlt_common.h" + +#define DLT_CTRL_TIMEOUT 10 + +#define DLT_CTRL_ECUID_LEN 10 + +#ifndef pr_fmt +# define pr_fmt(fmt) fmt +#endif + +#ifndef USE_STDOUT +# define PRINT_OUT stderr +#else +# define PRINT_OUT stdout +#endif + +#define pr_error(fmt, ...) \ + ({ fprintf(PRINT_OUT, pr_fmt(fmt), ## __VA_ARGS__); fflush(PRINT_OUT); }) +#define pr_verbose(fmt, ...) \ + ({ if (get_verbosity()) { fprintf(PRINT_OUT, pr_fmt(fmt), ## __VA_ARGS__); fflush(PRINT_OUT); } }) + +#define DLT_CTRL_DEFAULT_ECUID "ECU1" + +/* To be used as Dlt Message body when sending to DLT daemon */ +typedef struct +{ + void *data; /**< data to be send to DLT Daemon */ + int size; /**< size of that data */ +} DltControlMsgBody; + +/* As verbosity, ecuid and timeout are needed during the communication, + * defining getter and setters here. + * Then there is no need to define them in the control's user application. + */ +int get_verbosity(void); +void set_verbosity(int); + +char *get_ecuid(void); +void set_ecuid(char *); + +long get_timeout(void); +void set_timeout(long); + +/* Initialize the connection to the daemon */ +int dlt_control_init(int (*response_analyser)(char *, void *, int), + char *ecuid, + int verbosity); + +/* Send a message to the daemon. The call is not thread safe. */ +int dlt_control_send_message(DltControlMsgBody *, int); + +/* Destroys the connection to the daemon */ +int dlt_control_deinit(void); +#endif -- cgit v1.2.1