Matter SDK Coverage Report
Current view: top level - messaging - ReliableMessageAnalyticsDelegate.h (source / functions) Coverage Total Hit
Test: SHA:4d2388ac7eed75b2fe5e05e20de377999c632502 Lines: 100.0 % 1 1
Test Date: 2025-07-27 07:17:09 Functions: 50.0 % 2 1

            Line data    Source code
       1              : /*
       2              :  *    Copyright (c) 2025 Project CHIP Authors
       3              :  *    All rights reserved.
       4              :  *
       5              :  *    Licensed under the Apache License, Version 2.0 (the "License");
       6              :  *    you may not use this file except in compliance with the License.
       7              :  *    You may obtain a copy of the License at
       8              :  *
       9              :  *        http://www.apache.org/licenses/LICENSE-2.0
      10              :  *
      11              :  *    Unless required by applicable law or agreed to in writing, software
      12              :  *    distributed under the License is distributed on an "AS IS" BASIS,
      13              :  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      14              :  *    See the License for the specific language governing permissions and
      15              :  *    limitations under the License.
      16              :  */
      17              : 
      18              : /**
      19              :  *    @file
      20              :  *      This file defines an interface for objects interested in MRP events for analytics
      21              :  */
      22              : 
      23              : #pragma once
      24              : 
      25              : #include <optional>
      26              : 
      27              : #include <lib/core/DataModelTypes.h>
      28              : #include <lib/core/NodeId.h>
      29              : #include <system/SystemClock.h>
      30              : 
      31              : namespace chip {
      32              : namespace Messaging {
      33              : 
      34              : class ReliableMessageAnalyticsDelegate
      35              : {
      36              : public:
      37            4 :     virtual ~ReliableMessageAnalyticsDelegate() = default;
      38              : 
      39              :     enum class SessionType
      40              :     {
      41              :         kEstablishedCase,
      42              :         // Initially, we are starting with only one session type, but we are considering the future when we expand to allow
      43              :         // other session types, such as establishing a CASE session.
      44              :     };
      45              : 
      46              :     enum class EventType
      47              :     {
      48              :         // Event associated with first time this specific message is sent.
      49              :         kInitialSend,
      50              :         // Event associated with re-transmitting a message that was previously sent but not acknowledged.
      51              :         kRetransmission,
      52              :         // Event associated with receiving an acknowledgement of a previously sent message.
      53              :         kAcknowledged,
      54              :         // Event associated with transmission of a message that failed to be acknowledged.
      55              :         kFailed,
      56              :     };
      57              : 
      58              :     struct TransmitEvent
      59              :     {
      60              :         // When the session has a peer node ID, this will be a value other than kUndefinedNodeId.
      61              :         NodeId nodeId = kUndefinedNodeId;
      62              :         // When the session has a fabric index, this will be a value other than kUndefinedFabricIndex.
      63              :         FabricIndex fabricIndex = kUndefinedFabricIndex;
      64              :         // Session type of session the message involved is being sent on.
      65              :         SessionType sessionType = SessionType::kEstablishedCase;
      66              :         // The transmit event type.
      67              :         EventType eventType = EventType::kInitialSend;
      68              :         // The outgoing message counter associated with the event. If there is no outgoing message counter
      69              :         // this value will be 0.
      70              :         uint32_t messageCounter = 0;
      71              :         // If the eventType is kRetransmission, this value will be populated with the number of the
      72              :         // retransmission attempt. A value of 1 indicates the first retransmission (i.e. the second
      73              :         // transmission of the message). This value should never be 0.
      74              :         std::optional<uint8_t> retransmissionCount;
      75              :         // When eventType is kAcknowledged, this will be populated with the number of milliseconds
      76              :         // that have elapsed between when the initial message was sent and when we received
      77              :         // acknowledgment for the message.
      78              :         std::optional<System::Clock::Milliseconds64> ackLatencyMs;
      79              :     };
      80              : 
      81              :     virtual void OnTransmitEvent(const TransmitEvent & event) = 0;
      82              : };
      83              : 
      84              : } // namespace Messaging
      85              : } // namespace chip
        

Generated by: LCOV version 2.0-1