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

            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/ServiceDescription.h"
      14              : 
      15              : #include <ip/IPEndpoint.h>
      16              : 
      17              : #include <etl/intrusive_links.h>
      18              : 
      19              : namespace someip
      20              : {
      21              : class ServiceAnnouncerTask : public ::etl::forward_link<0>
      22              : {
      23              : public:
      24              :     enum class TaskType : uint8_t
      25              :     {
      26              :         TASK_SUBSCRIBE,
      27              :         TASK_SUBSCRIBE_ACK,
      28              :         TASK_SUBSCRIBE_ACK_MULTICAST,
      29              :         TASK_SUBSCRIBE_NACK,
      30              :         TASK_UNSUBSCRIBE,
      31              :         TASK_ANNOUNCE,
      32              :         TASK_IDLE
      33              :     };
      34              : 
      35              :     ServiceAnnouncerTask();
      36              : 
      37              :     ServiceAnnouncerTask& operator=(ServiceAnnouncerTask const& rhs);
      38              : 
      39              :     void clear();
      40              : 
      41              :     void init(
      42              :         service_id::type serviceId,
      43              :         instance_id::type instanceId,
      44              :         eventgroup_id::type eventgroup,
      45              :         uint32_t ttl,
      46              :         major_version::type majorVersion,
      47              :         minor_version::type minorVersion);
      48              : 
      49              :     void initFrom(
      50              :         ServiceDescription const& service,
      51              :         ::ip::IPAddress const& address,
      52              :         bool unicast,
      53              :         uint64_t timestamp,
      54              :         TaskType type);
      55              : 
      56              :     void setEndpoint(::ip::IPAddress const& address, uint16_t port);
      57              : 
      58              :     void copyTo(ServiceDescription& service) const;
      59              : 
      60              :     bool isSame(ServiceDescription const& service) const;
      61              : 
      62              :     ::ip::IPAddress const& getDestinationAddress() const;
      63              :     void setDestinationAddress(::ip::IPAddress const& address);
      64              : 
      65              :     uint64_t getTimestamp() const;
      66              :     void setTimestamp(uint64_t timestamp);
      67              : 
      68              :     void setMinorVersion(minor_version::type minorVersion);
      69              : 
      70              :     void setProto(uint8_t proto);
      71              : 
      72              :     TaskType getType() const;
      73              :     void setType(TaskType type);
      74              : 
      75              :     void setUnicast(bool unicast);
      76              : 
      77              :     bool containsEventGroup() const;
      78              : 
      79              : private:
      80              :     uint64_t _timestamp;
      81              :     ::ip::IPEndpoint _endpoint;
      82              :     ::ip::IPAddress _destination;
      83              :     ttl::type _ttl;
      84              :     minor_version::type _minorVersion;
      85              :     service_id::type _serviceId;
      86              :     instance_id::type _instanceId;
      87              :     eventgroup_id::type _eventgroup;
      88              :     major_version::type _majorVersion;
      89              :     uint8_t _proto;
      90              : 
      91              :     TaskType _type;
      92              :     bool _unicast;
      93              : };
      94              : 
      95              : /*
      96              :  * inline implementation
      97              :  */
      98            3 : inline void ServiceAnnouncerTask::setMinorVersion(minor_version::type const minorVersion)
      99              : {
     100            3 :     _minorVersion = minorVersion;
     101            3 : }
     102              : 
     103            3 : inline void ServiceAnnouncerTask::setProto(uint8_t const proto) { _proto = proto; }
     104              : 
     105            6 : inline ::ip::IPAddress const& ServiceAnnouncerTask::getDestinationAddress() const
     106              : {
     107            6 :     return _destination;
     108              : }
     109              : 
     110            1 : inline uint64_t ServiceAnnouncerTask::getTimestamp() const { return _timestamp; }
     111              : 
     112           11 : inline void ServiceAnnouncerTask::setTimestamp(uint64_t const timestamp) { _timestamp = timestamp; }
     113              : 
     114           10 : inline void ServiceAnnouncerTask::setDestinationAddress(::ip::IPAddress const& address)
     115              : {
     116           10 :     _destination = address;
     117           10 : }
     118              : 
     119            3 : inline ServiceAnnouncerTask::TaskType ServiceAnnouncerTask::getType() const { return _type; }
     120              : 
     121            6 : inline void ServiceAnnouncerTask::setType(TaskType const type) { _type = type; }
     122              : 
     123            4 : inline void ServiceAnnouncerTask::setUnicast(bool const unicast) { _unicast = unicast; }
     124              : 
     125              : } // namespace someip
        

Generated by: LCOV version 2.0-1