LCOV - code coverage report
Current view: top level - executables/unitTest/udsConfiguration/include/uds/session - DiagSession.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 50.0 % 4 2
Test Date: 2026-06-18 08:29:03 Functions: 50.0 % 4 2

            Line data    Source code
       1              : /********************************************************************************
       2              :  * Copyright (c) 2024 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 <uds/DiagReturnCode.h>
      14              : #include <util/Mask.h>
      15              : 
      16              : namespace uds
      17              : {
      18              : class ApplicationDefaultSession;
      19              : class ApplicationExtendedSession;
      20              : class ProgrammingSession;
      21              : 
      22              : class DiagSession
      23              : {
      24              : public:
      25              :     enum
      26              :     {
      27              :         MAX_INDEX = 8
      28              :     };
      29              : 
      30              :     typedef Mask<DiagSession> DiagSessionMask;
      31              : 
      32              :     static ApplicationDefaultSession& APPLICATION_DEFAULT_SESSION();
      33              :     static ApplicationExtendedSession& APPLICATION_EXTENDED_SESSION();
      34              :     static ProgrammingSession& PROGRAMMING_SESSION();
      35              : 
      36              :     static DiagSessionMask const& ALL_SESSIONS();
      37              :     static DiagSessionMask const& APPLICATION_EXTENDED_SESSION_MASK();
      38              : 
      39              :     enum SessionType
      40              :     {
      41              :         DEFAULT     = 0x01,
      42              :         PROGRAMMING = 0x02,
      43              :         EXTENDED    = 0x03,
      44              :     };
      45              : 
      46            0 :     uint8_t toIndex() const { return fId; }
      47              : 
      48           35 :     uint8_t getSessionByte() const { return fType; }
      49              : 
      50           11 :     SessionType getType() const { return fType; }
      51              : 
      52              :     virtual DiagReturnCode::Type isTransitionPossible(DiagSession::SessionType targetSession) = 0;
      53              : 
      54              :     virtual DiagSession& getTransitionResult(DiagSession::SessionType targetSession) = 0;
      55              : 
      56            0 :     virtual void enter() {}
      57              : 
      58              : protected:
      59              :     DiagSession(SessionType id, uint8_t index);
      60              : 
      61              : private:
      62              :     SessionType fType;
      63              :     uint8_t fId;
      64              : };
      65              : 
      66              : bool operator==(DiagSession const& x, DiagSession const& y);
      67              : bool operator!=(DiagSession const& x, DiagSession const& y);
      68              : 
      69              : } // namespace uds
        

Generated by: LCOV version 2.0-1