Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
conversation.h
1#ifndef CONVERSATION_H
2#define CONVERSATION_H
3
4#include <stdint.h>
5#include <functional>
6#include <vector>
7#include <string>
8#include "../core/result.h"
9#include "./meta_info.h"
10
11namespace ara
12{
13 namespace diag
14 {
16 enum class ActivityStatusType : uint8_t
17 {
18 kActive = 0x00,
19 kInactive = 0x01
20 };
21
23 enum class SessionControlType : uint8_t
24 {
25 kDefaultSession = 0x01,
26 kProgrammingSession = 0x02,
29 };
30
32 enum class SecurityLevelType : uint8_t
33 {
34 kLocked = 0x00
35 };
36
39 {
41 int64_t id;
42 };
43
47 {
48 private:
49 static std::vector<Conversation> mConversations;
50
51 const MetaInfo &mMetaInfo;
52 ActivityStatusType mActivityStatus;
53 std::function<void(ActivityStatusType)> mActivityNotifier;
54 ConversationIdentifierType mConversationIdentifier;
55 SessionControlType mDiagnosticSession;
56 std::function<void(SessionControlType)> mDiagnosticSessionNotifier;
57 SecurityLevelType mDiagnosticSecurityLevel;
58 std::function<void(SecurityLevelType)> mSecurityLevelNotifier;
59
60 Conversation(const MetaInfo &metaInfo);
61
62 public:
68
71 static std::vector<std::reference_wrapper<Conversation>> GetAllConversations();
72
75 static std::vector<std::reference_wrapper<Conversation>> GetCurrentActiveConversations();
76
77 Conversation() = delete;
78
82
84 void Deactivate();
85
90 std::function<void(ActivityStatusType)> notifier);
91
95
99
103 void SetDiagnosticSession(SessionControlType diagnosticSession);
104
109 std::function<void(SessionControlType)> notifier);
110
115 SessionControlType session);
116
120
125 std::function<void(SecurityLevelType)> notifier);
126
131 SecurityLevelType securityLevel);
132
136 };
137 }
138}
139
140#endif
A wrapper around the callee's return value and its possible error.
Definition: result.h:16
A wrapper around the communication between a diagnostic client and a diagnostic server.
Definition: conversation.h:47
ara::core::Result< ActivityStatusType > GetActivityStatus()
Activity status property getter.
Definition: conversation.cpp:51
ara::core::Result< void > ResetToDefaultSession()
Reset the ongoing session to default.
Definition: conversation.cpp:177
void SetDiagnosticSession(SessionControlType diagnosticSession)
Diagnostic session property setter.
Definition: conversation.cpp:91
ara::core::Result< SecurityLevelType > GetDiagnosticSecurityLevel()
Security level property getter.
Definition: conversation.cpp:140
ara::core::Result< void > SetActivityNotifier(std::function< void(ActivityStatusType)> notifier)
Register an activity status change callback.
Definition: conversation.cpp:70
ara::core::Result< ConversationIdentifierType > GetConversationIdentifier()
Conversation ID property getter.
Definition: conversation.cpp:79
static std::vector< std::reference_wrapper< Conversation > > GetCurrentActiveConversations()
Get all the active conversations.
Definition: conversation.cpp:36
ara::core::Result< SessionControlType > GetDiagnosticSession()
Diagnostic session property getter.
Definition: conversation.cpp:85
static ara::core::Result< std::reference_wrapper< Conversation > > GetConversation(MetaInfo &metaInfo)
Conversation factory.
Definition: conversation.cpp:18
ara::core::Result< void > SetDiagnosticSessionNotifier(std::function< void(SessionControlType)> notifier)
Register a diagnostic session change callback.
Definition: conversation.cpp:103
static std::vector< std::reference_wrapper< Conversation > > GetAllConversations()
Get all the existing conversations.
Definition: conversation.cpp:28
ara::core::Result< void > SetSecurityLevelNotifier(std::function< void(SecurityLevelType)> notifier)
Register a security level change callback.
Definition: conversation.cpp:146
ara::core::Result< std::string > GetDiagnosticSecurityLevelShortName(SecurityLevelType securityLevel)
Convert a given security level to a short name.
Definition: conversation.cpp:158
void Deactivate()
Set the conversation activity status to 'inactive'.
Definition: conversation.cpp:57
ara::core::Result< std::string > GetDiagnosticSessionShortName(SessionControlType session)
Convert a given session to a short name.
Definition: conversation.cpp:112
Diagnostic metainfo in different context.
Definition: meta_info.h:24
SessionControlType
Diagnostic session control type.
Definition: conversation.h:24
@ kSafetySystemDiagnosticSession
Session to enable safety system diagnostic services.
@ kExtendedDiagnosticSession
Session to enable function adjustment diagnostic services.
@ kProgrammingSession
Session to enable memory programming diagnostic services.
@ kDefaultSession
Default diagnostic session.
ActivityStatusType
Conversation enable status.
Definition: conversation.h:17
@ kActive
Active conversation due to a request processing or a non-default session.
@ kInactive
Inactive conversation.
SecurityLevelType
UDS security level access status.
Definition: conversation.h:33
@ kLocked
Locked security level (no access granted)
Type to identify a conversation.
Definition: conversation.h:39
int64_t id
Conversation ID.
Definition: conversation.h:41