Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
event.h
1#ifndef EVENT_H
2#define EVENT_H
3
4#include <stdint.h>
5#include <functional>
6#include <map>
7#include "../core/instance_specifier.h"
8#include "../core/result.h"
9
10namespace ara
11{
12 namespace diag
13 {
15 enum class DTCFormatType : uint8_t
16 {
17 kDTCFormatOBD = 0,
18 kDTCFormatUDS = 1,
20 };
21
24 enum class EventStatusBit : uint8_t
25 {
29 };
30
33 {
35 uint8_t encodedBits;
36 };
37
39 enum class DebouncingState : uint8_t
40 {
41 kNeutral = 0x00,
43 kFinallyDefective = 0x02,
44 kTemporarilyHealed = 0x04,
45 kFinallyHealed = 0x08
46 };
47
51 class Event
52 {
53 private:
54 const uint8_t cDefaultEventStatus{0x02};
55
56 const ara::core::InstanceSpecifier &mSpecifier;
57 EventStatusByte mEventStatus;
58 std::function<void(EventStatusByte)> mNotifier;
59 bool mWirStatus;
60 uint32_t mDtcNumber;
61 int8_t mFdc;
62
63 public:
66 explicit Event(const ara::core::InstanceSpecifier &specifier);
67
68 ~Event() noexcept = default;
69
73
78 void SetEventStatusBits(std::map<EventStatusBit, bool> statusBits);
79
84 std::function<void(EventStatusByte)> notifier);
85
89
94
100
104 void SetDTCNumber(uint32_t dtcNumber) noexcept;
105
109
113
117
121 void SetFaultDetectionCounter(int8_t fdc) noexcept;
122 };
123 }
124}
125
126#endif
AUTOSAR shortname-path wrapper.
Definition: instance_specifier.h:14
A wrapper around the callee's return value and its possible error.
Definition: result.h:16
Diagnostic event class that represents a fault path of a system.
Definition: event.h:52
void SetFaultDetectionCounter(int8_t fdc) noexcept
Set the event Fault Detection Counter (FDC) value.
Definition: event.cpp:160
ara::core::Result< void > SetEventStatusChangedNotifier(std::function< void(EventStatusByte)> notifier)
Set a notifier on the event status changed.
Definition: event.cpp:75
ara::core::Result< uint32_t > GetDTCNumber(DTCFormatType dtcFormat)
Get the Diagnostic Trouble Code (DTC) number relates to the event.
Definition: event.cpp:96
ara::core::Result< int8_t > GetFaultDetectionCounter()
Get the event Fault Detection Counter (FDC) value.
Definition: event.cpp:154
void SetEventStatusBits(std::map< EventStatusBit, bool > statusBits)
Set the bits of the event status.
Definition: event.cpp:24
ara::core::Result< EventStatusByte > GetEventStatus()
Get the event status.
Definition: event.cpp:18
Event(const ara::core::InstanceSpecifier &specifier)
Constructor.
Definition: event.cpp:10
ara::core::Result< void > SetLatchedWIRStatus(bool status)
Set the Warning Indicator Requested bit status.
Definition: event.cpp:89
void SetDTCNumber(uint32_t dtcNumber) noexcept
Set the Diagnostic Trouble Code (DTC) number relates to the event.
Definition: event.cpp:110
ara::core::Result< bool > GetLatchedWIRStatus()
Get the Warning Indicator Requested bit status.
Definition: event.cpp:83
ara::core::Result< DebouncingState > GetDebouncingStatus()
Get the event debounding state.
Definition: event.cpp:115
ara::core::Result< bool > GetTestComplete()
Indicates whether the event has matured to test completed or not.
Definition: event.cpp:144
DTCFormatType
Diagnostic Trouble Code (DTC) number format.
Definition: event.h:16
@ kDTCFormatUDS
ISO 14229-1 format.
@ kDTCFormatJ1939
SAE J1939-73 format.
@ kDTCFormatOBD
ISO 15031-6 format.
DebouncingState
Debouncing state of an event.
Definition: event.h:40
@ kFinallyHealed
FDC equal to -128.
@ kTemporarilyHealed
FDC less than zero and greater than -128.
@ kFinallyDefective
FDC equal to 127.
@ kNeutral
Zero Fault Detection Counter (FDC)
@ kTemporarilyDefective
FDC greater than zero and less than 127.
EventStatusBit
Specific bit of the event status byte.
Definition: event.h:25
@ kTestFailed
Bit 0: Failed test.
@ kTestFailedThisOperationCycle
Bit 1: Failed test during the current operation cycle.
@ kTestNotCompletedThisOperationCycle
Bit 6: Incomplete test during the current operation cyle.
Byte that specifies an event status.
Definition: event.h:33
uint8_t encodedBits
Event status byte containing the EventStatusBit.
Definition: event.h:35