LCOV - code coverage report
Current view: top level - shared - dlt_protocol.c (source / functions) Coverage Total Hit
Test: dlt_final_coverage.info Lines: 85.7 % 7 6
Test Date: 2025-03-25 20:53:42 Functions: 100.0 % 1 1

            Line data    Source code
       1              : /*
       2              :  * SPDX license identifier: MPL-2.0
       3              :  *
       4              :  * Copyright (C) 2016 Advanced Driver Information Technology.
       5              :  * This code is developed by Advanced Driver Information Technology.
       6              :  * Copyright of Advanced Driver Information Technology, Bosch and DENSO.
       7              :  *
       8              :  * This file is part of COVESA Project DLT - Diagnostic Log and Trace.
       9              :  *
      10              :  * This Source Code Form is subject to the terms of the
      11              :  * Mozilla Public License (MPL), v. 2.0.
      12              :  * If a copy of the MPL was not distributed with this file,
      13              :  * You can obtain one at http://mozilla.org/MPL/2.0/.
      14              :  *
      15              :  * For further information see http://www.covesa.org/.
      16              :  */
      17              : 
      18              : /*!
      19              :  * \author
      20              :  * Christoph Lipka <clipka@jp.adit-jv.com>
      21              :  *
      22              :  * \copyright Copyright © 2016 Advanced Driver Information Technology. \n
      23              :  * License MPL-2.0: Mozilla Public License version 2.0 http://mozilla.org/MPL/2.0/.
      24              :  *
      25              :  * \file dlt_protocol.c
      26              :  */
      27              : 
      28              : #include "dlt_protocol.h"
      29              : 
      30              : const char *const dlt_service_names[] = {
      31              :     "DLT_SERVICE_ID",
      32              :     "DLT_SERVICE_ID_SET_LOG_LEVEL",
      33              :     "DLT_SERVICE_ID_SET_TRACE_STATUS",
      34              :     "DLT_SERVICE_ID_GET_LOG_INFO",
      35              :     "DLT_SERVICE_ID_GET_DEFAULT_LOG_LEVEL",
      36              :     "DLT_SERVICE_ID_STORE_CONFIG",
      37              :     "DLT_SERVICE_ID_RESET_TO_FACTORY_DEFAULT",
      38              :     "DLT_SERVICE_ID_SET_COM_INTERFACE_STATUS",
      39              :     "DLT_SERVICE_ID_SET_COM_INTERFACE_MAX_BANDWIDTH",
      40              :     "DLT_SERVICE_ID_SET_VERBOSE_MODE",
      41              :     "DLT_SERVICE_ID_SET_MESSAGE_FILTERING",
      42              :     "DLT_SERVICE_ID_SET_TIMING_PACKETS",
      43              :     "DLT_SERVICE_ID_GET_LOCAL_TIME",
      44              :     "DLT_SERVICE_ID_USE_ECU_ID",
      45              :     "DLT_SERVICE_ID_USE_SESSION_ID",
      46              :     "DLT_SERVICE_ID_USE_TIMESTAMP",
      47              :     "DLT_SERVICE_ID_USE_EXTENDED_HEADER",
      48              :     "DLT_SERVICE_ID_SET_DEFAULT_LOG_LEVEL",
      49              :     "DLT_SERVICE_ID_SET_DEFAULT_TRACE_STATUS",
      50              :     "DLT_SERVICE_ID_GET_SOFTWARE_VERSION",
      51              :     "DLT_SERVICE_ID_MESSAGE_BUFFER_OVERFLOW"
      52              : };
      53              : const char *const dlt_user_service_names[] = {
      54              :     "DLT_USER_SERVICE_ID",
      55              :     "DLT_SERVICE_ID_UNREGISTER_CONTEXT",
      56              :     "DLT_SERVICE_ID_CONNECTION_INFO",
      57              :     "DLT_SERVICE_ID_TIMEZONE",
      58              :     "DLT_SERVICE_ID_MARKER",
      59              :     "DLT_SERVICE_ID_OFFLINE_LOGSTORAGE",
      60              :     "DLT_SERVICE_ID_PASSIVE_NODE_CONNECT",
      61              :     "DLT_SERVICE_ID_PASSIVE_NODE_CONNECTION_STATUS",
      62              :     "DLT_SERVICE_ID_SET_ALL_LOG_LEVEL",
      63              :     "DLT_SERVICE_ID_SET_ALL_TRACE_STATUS",
      64              :     "DLT_SERVICE_ID_UNDEFINED", /* 0xF0A is not defined */
      65              :     "DLT_SERVICE_ID_RESERVED",
      66              :     "DLT_SERVICE_ID_RESERVED",
      67              :     "DLT_SERVICE_ID_RESERVED",
      68              :     "DLT_SERVICE_ID_RESERVED"
      69              : };
      70              : 
      71           11 : const char *dlt_get_service_name(unsigned int id)
      72              : {
      73           11 :     if (id == DLT_SERVICE_ID_CALLSW_CINJECTION)
      74              :         return "DLT_SERVICE_ID_CALLSW_CINJECTION";
      75           11 :     else if ((id == DLT_SERVICE_ID) || (id >= DLT_USER_SERVICE_ID_LAST_ENTRY) ||
      76           11 :              ((id >= DLT_SERVICE_ID_LAST_ENTRY) && (id <= DLT_USER_SERVICE_ID)))
      77              :         return "UNDEFINED";
      78           11 :     else if ((id > DLT_SERVICE_ID) && (id < DLT_SERVICE_ID_LAST_ENTRY))
      79           11 :         return dlt_service_names[id];
      80              :     else /* user services */
      81            0 :         return dlt_user_service_names[id & 0xFF];
      82              : }
        

Generated by: LCOV version 2.0-1