LCOV - code coverage report
Current view: top level - libs/bsw/cpp2someip/include/someip - ITpTransceiver.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 1 1
Test Date: 2026-09-11 12:05:06 Functions: 50.0 % 2 1

            Line data    Source code
       1              : /********************************************************************************
       2              :  * Copyright (c) 2026 Accenture
       3              :  *
       4              :  * This program and the accompanying materials are made available under the
       5              :  * terms of the Apache License Version 2.0 which is available at
       6              :  * https://www.apache.org/licenses/LICENSE-2.0
       7              :  *
       8              :  * SPDX-License-Identifier: Apache-2.0
       9              :  ********************************************************************************/
      10              : 
      11              : #pragma once
      12              : 
      13              : #include "someip/NetworkChannel.h"
      14              : #include "someip/SomeIpMessage.h"
      15              : 
      16              : #include <cstdint>
      17              : 
      18              : namespace someip
      19              : {
      20              : class SomeIpMessage;
      21              : 
      22              : class ITpListener;
      23              : 
      24              : /**
      25              :  * Interface for a TP transceiver.
      26              :  */
      27              : class ITpTransceiver
      28              : {
      29              : public:
      30           72 :     virtual ~ITpTransceiver() = default;
      31              : 
      32              :     static uint8_t const TP_MESSAGE_TYPE_BIT_MASK = 32U;
      33              : 
      34              :     static uint32_t const TP_RECEIVE_TIMEOUT = 100U;
      35              :     static uint32_t const TP_UPDATE_CYCLE    = TP_RECEIVE_TIMEOUT / 4U;
      36              : 
      37              :     // INTERFACE1_START
      38              : 
      39              :     /**
      40              :      * Function that tells if outgoing message is TP message.
      41              :      */
      42              :     static bool isOutgoingTpMessage(uint8_t proto, uint32_t length);
      43              : 
      44              :     /**
      45              :      * Function that tells if incoming message is TP message.
      46              :      */
      47              :     static bool isIncomingTpMessage(uint8_t proto, SomeIpMessage::MessageType type);
      48              : 
      49              :     // INTERFACE1_END
      50              : 
      51              :     struct TpHeader
      52              :     {
      53              :         uint32_t payloadOffset;
      54              :         bool hasMoreSegments;
      55              :     };
      56              : 
      57              :     static size_t const TP_HEADER_LENGTH = 4U;
      58              : 
      59              :     // INTERFACE2_START
      60              : 
      61              :     /**
      62              :      * Function that that serializes TP header.
      63              :      */
      64              :     static uint32_t serializeTpHeader(TpHeader const& input);
      65              : 
      66              :     /**
      67              :      * Function that that parses TP header.
      68              :      */
      69              :     static void parseTpHeader(uint32_t input, TpHeader& output);
      70              : 
      71              :     /**
      72              :      * Pure virtual function that handles sending TP message if possible.
      73              :      */
      74              :     virtual bool sendTpMessage(NetworkChannel& channel, SomeIpMessage const& message) const = 0;
      75              : 
      76              :     /**
      77              :      * Pure virtual function that handles receiving TP message if possible.
      78              :      */
      79              :     virtual void
      80              :     receiveTpMessage(NetworkChannel& channel, SomeIpMessage const& message, ITpListener& listener)
      81              :         = 0;
      82              : 
      83              :     // INTERFACE2_END
      84              : };
      85              : 
      86              : } // namespace someip
        

Generated by: LCOV version 2.0-1