LCOV - code coverage report
Current view: top level - executables/unitTest/transportConfiguration/include/transport - TransportConfiguration.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 7 7
Test Date: 2026-05-26 15:55:11 Functions: 100.0 % 3 3

            Line data    Source code
       1              : // Copyright 2026 Accenture.
       2              : 
       3              : #pragma once
       4              : 
       5              : #include "transport/LogicalAddress.h"
       6              : #include "transport/TransportMessage.h"
       7              : 
       8              : #include <platform/estdint.h>
       9              : 
      10              : #include <array>
      11              : 
      12              : namespace transport
      13              : {
      14              : class TransportConfiguration
      15              : {
      16              : public:
      17              :     TransportConfiguration() = delete;
      18              : 
      19              :     static uint16_t const TESTER_RANGE_START = 0x00F0U;
      20              :     static uint16_t const TESTER_RANGE_END   = 0x00FDU;
      21              : 
      22              :     static uint16_t const FUNCTIONAL_ALL_ISO14229             = 0x00DFU;
      23              :     static uint16_t const MAX_FUNCTIONAL_MESSAGE_PAYLOAD_SIZE = 6U;
      24              :     static uint16_t const DIAG_PAYLOAD_SIZE                   = 4095U;
      25              : 
      26              :     enum
      27              :     {
      28              :         INVALID_DIAG_ADDRESS = 0xFFU
      29              :     };
      30              : 
      31              :     static uint8_t const NUMBER_OF_FULL_SIZE_TRANSPORT_MESSAGES = 5U;
      32              :     static uint8_t const MAXIMUM_NUMBER_OF_TRANSPORT_MESSAGES
      33              :         = NUMBER_OF_FULL_SIZE_TRANSPORT_MESSAGES * 8U;
      34              : 
      35              :     static constexpr size_t NUMBER_OF_ETHERNET_TESTERS = 3;
      36              :     static constexpr size_t NUMBER_OF_CAN_TESTERS      = 2;
      37              :     static constexpr size_t NUMBER_OF_ADDRESS_LISTS    = 2;
      38              : 
      39              :     using EthernetTesters           = std::array<LogicalAddress, NUMBER_OF_ETHERNET_TESTERS>;
      40              :     using CanTesters                = std::array<LogicalAddress, NUMBER_OF_CAN_TESTERS>;
      41              :     using LogicalAddressConverterUT = LogicalAddressConverter<NUMBER_OF_ADDRESS_LISTS>;
      42              : 
      43              :     static constexpr EthernetTesters TESTER_ADDRESS_RANGE_ETHERNET
      44              :         = {{{0xABCDU, 0x00CDU}, {0x1234U, 0x0012U}, {0xF1F2U, 0x00FFU}}};
      45              :     static constexpr CanTesters TESTER_ADDRESS_RANGE_CAN
      46              :         = {{{0xA11DU, 0x0010U}, {0xDF01U, 0x0001U}}};
      47              : 
      48              :     static bool isFunctionalAddress(uint16_t address);
      49              : 
      50              :     static bool isFunctionallyAddressed(TransportMessage const& message);
      51              : 
      52              :     static bool isFromTester(TransportMessage const& message);
      53              : };
      54              : 
      55           27 : inline bool TransportConfiguration::isFunctionalAddress(uint16_t const address)
      56              : {
      57           27 :     return (FUNCTIONAL_ALL_ISO14229 == address);
      58              : }
      59              : 
      60           10 : inline bool TransportConfiguration::isFunctionallyAddressed(TransportMessage const& message)
      61              : {
      62           10 :     return isFunctionalAddress(message.getTargetId());
      63              : }
      64              : 
      65            5 : inline bool TransportConfiguration::isFromTester(TransportMessage const& message)
      66              : {
      67              :     return (
      68            5 :         (message.getSourceId() >= TransportConfiguration::TESTER_RANGE_START)
      69            5 :         && (message.getSourceId() <= TransportConfiguration::TESTER_RANGE_END));
      70              : }
      71              : 
      72              : } // namespace transport
        

Generated by: LCOV version 2.0-1