From d515020fa1bcb5d874084a68c9de9434dc9d994e Mon Sep 17 00:00:00 2001 From: Manikandan C Date: Mon, 29 Oct 2018 16:32:17 +0100 Subject: Gateway Improvements -Support to send and parse periodic control messages -add application/contexts to passive ECU list -Refactor dlt_gateway_send_control_message -Gateway issues with corrupted data and on demand connection -Unit Test update Signed-off-by: Saya Sugiura ssugiura@jp.adit-jv.com Signed-off-by: Christoph Lipka clipka@jp.adit-jv.com Signed-off-by: S. Hameed shameed@jp.adit-jv.com Signed-off-by: ManikandanC Manikandan.Chockalingam@in.bosch.com --- include/dlt/dlt_common.h | 103 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) (limited to 'include/dlt/dlt_common.h') diff --git a/include/dlt/dlt_common.h b/include/dlt/dlt_common.h index 0b9fd8d..d76d190 100644 --- a/include/dlt/dlt_common.h +++ b/include/dlt/dlt_common.h @@ -207,6 +207,25 @@ enum { #define DLT_SIZE_WSID (sizeof(uint32_t)) #define DLT_SIZE_WTMS (sizeof(uint32_t)) +/** + * Definitions for GET_LOG_INFO + */ +#define DLT_RECEIVE_TEXTBUFSIZE 1024 /* Size of buffer for text output */ +#define DLT_GET_LOG_INFO_HEADER 18 /*Get log info header size in response text */ +#define GET_LOG_INFO_LENGTH 13 +#define SERVICE_OPT_LENGTH 3 + +/* checks if received size is big enough for expected data */ +#define DLT_CHECK_RCV_DATA_SIZE(received, required) \ + ({ \ + int _ret = DLT_RETURN_OK; \ + if (((int)received - (int)required) < 0) { \ + dlt_vlog(LOG_WARNING, "%s: Received data not complete\n", __func__); \ + _ret = DLT_RETURN_ERROR; \ + } \ + _ret; \ + }) + /** * Get the size of extra header parameters, depends on htyp. */ @@ -452,6 +471,46 @@ typedef struct char com[DLT_ID_SIZE]; /**< communication interface */ } PACKED DltServiceGetLogInfoRequest; +typedef struct +{ + uint32_t service_id; /**< service ID */ +} PACKED DltServiceGetDefaultLogLevelRequest; + +/** + * The structure of the DLT Service Get Log Info response. + */ +typedef struct +{ + char context_id[DLT_ID_SIZE]; + int16_t log_level; + int16_t trace_status; + uint16_t len_context_description; + char *context_description; +} ContextIDsInfoType; + +typedef struct +{ + char app_id[DLT_ID_SIZE]; + uint16_t count_context_ids; + ContextIDsInfoType *context_id_info; /**< holds info about a specific con id */ + uint16_t len_app_description; + char *app_description; +} AppIDsType; + +typedef struct +{ + uint16_t count_app_ids; + AppIDsType *app_ids; /**< holds info about a specific app id */ +} LogInfoType; + +typedef struct +{ + uint32_t service_id; /**< service ID */ + uint8_t status; /**< type of request */ + LogInfoType log_info_type; /**< log info type */ + char com[DLT_ID_SIZE]; /**< communication interface */ +} DltServiceGetLogInfoResponse; + /** * The structure of the DLT Service Set Log Level. */ @@ -1396,6 +1455,50 @@ extern "C" */ void dlt_check_envvar(); + /** + * Parse the response text and identifying service id and its options. + * + * @param resp_text char * + * @param service_id int * + * @param service_opt int * + * @return pointer to resp_text + */ + int dlt_set_loginfo_parse_service_id(char *resp_text, uint32_t *service_id, uint8_t *service_opt); + + /** + * Convert get log info from ASCII to uint16 + * + * @param rp char + * @param rp_count int + * @return length + */ + int16_t dlt_getloginfo_conv_ascii_to_uint16_t(char *rp, int *rp_count); + + /** + * Convert get log info from ASCII to int16 + * + * @param rp char + * @param rp_count int + * @return length + */ + int16_t dlt_getloginfo_conv_ascii_to_int16_t(char *rp, int *rp_count); + + /** + * Convert get log info from ASCII to ID + * + * @param rp char + * @param rp_count int + */ + void dlt_getloginfo_conv_ascii_to_id(char *rp, int *rp_count, char *wp, int len); + + /** + * Convert from hex ASCII to binary + * @param ptr const char + * @param binary uint8_t + * @param size int + */ + void dlt_hex_ascii_to_binary(const char *ptr, uint8_t *binary, int *size); + #ifndef DLT_USE_UNIX_SOCKET_IPC /** * Create the specified path, recursive if necessary -- cgit v1.2.1