Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
dtc_information.h
1#ifndef DTC_INFORMATION_H
2#define DTC_INFORMATION_H
3
4#include <stdint.h>
5#include <map>
6#include <functional>
7#include "../core/instance_specifier.h"
8#include "../core/result.h"
9
10namespace ara
11{
12 namespace diag
13 {
15 enum class ControlDtcStatusType : uint8_t
16 {
17 kDTCSettingOn = 0x00,
18 kDTCSettingOff = 0x01
19 };
20
23 enum class UdsDtcStatusBitType : uint8_t
24 {
25 kTestFailed = 0x01,
27 kPendingDTC = 0x04,
28 kConfirmedDTC = 0x08,
33 };
34
37 {
39 uint8_t encodedBits;
40 };
41
45 {
46 private:
47 const core::InstanceSpecifier &mSpecifier;
48 std::map<uint32_t, UdsDtcStatusByteType> mStatuses;
49 std::function<void(uint32_t, UdsDtcStatusByteType, UdsDtcStatusByteType)> mDtcStatusChangedNotifier;
50 std::function<void(uint32_t)> mNumberOfStoredEntriesNotifier;
51 ControlDtcStatusType mControlDtcStatus;
52 std::function<void(ControlDtcStatusType)> mControlDtcStatusNotifier;
53
54 public:
57 explicit DTCInformation(const core::InstanceSpecifier &specifier);
58
59 ~DTCInformation() noexcept = default;
60
65
72 uint32_t dtc, UdsDtcStatusBitType mask, UdsDtcStatusByteType status);
73
78 std::function<void(uint32_t, UdsDtcStatusByteType, UdsDtcStatusByteType)> notifier);
79
83
88 std::function<void(uint32_t)> notifier);
89
93 core::Result<void> Clear(uint32_t dtc);
94
98
103 std::function<void(ControlDtcStatusType)> notifier);
104
108 };
109 }
110}
111
112#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
A class to process Diagnostic Trouble Code (DTC) information.
Definition: dtc_information.h:45
core::Result< void > SetDTCStatusChangedNotifier(std::function< void(uint32_t, UdsDtcStatusByteType, UdsDtcStatusByteType)> notifier)
Set a notifer on any DTC status change.
Definition: dtc_information.cpp:80
core::Result< ControlDtcStatusType > GetControlDTCStatus()
Indicate whether the UDS DTC byte update is enabled or not.
Definition: dtc_information.cpp:135
core::Result< uint32_t > GetNumberOfStoredEntries()
Get the number of stored DTC.
Definition: dtc_information.cpp:90
void SetCurrentStatus(uint32_t dtc, UdsDtcStatusBitType mask, UdsDtcStatusByteType status)
Set UDS DTC status byte of a certain DTC.
Definition: dtc_information.cpp:33
DTCInformation(const core::InstanceSpecifier &specifier)
Constructor.
Definition: dtc_information.cpp:8
core::Result< void > EnableControlDtc()
Enforce enabling the USD DTC status byte update.
Definition: dtc_information.cpp:151
core::Result< void > Clear(uint32_t dtc)
Clear a DTC.
Definition: dtc_information.cpp:108
core::Result< UdsDtcStatusByteType > GetCurrentStatus(uint32_t dtc)
Get UDS DTC status byte of a certain DTC.
Definition: dtc_information.cpp:13
core::Result< void > SetControlDtcStatusNotifier(std::function< void(ControlDtcStatusType)> notifier)
Set a notifer on the control DTC status change.
Definition: dtc_information.cpp:141
core::Result< void > SetNumberOfStoredEntriesNotifier(std::function< void(uint32_t)> notifier)
Set a notifer on the number of stored DTC change.
Definition: dtc_information.cpp:98
ControlDtcStatusType
UDS Diagnostic Trouble Code (DTC) status byte updating state.
Definition: dtc_information.h:16
@ kDTCSettingOn
Enabled USD DTC status byte update.
@ kDTCSettingOff
Disable USD DTC status byte update.
UdsDtcStatusBitType
Specific bit flag of the UDS DTC status byte.
Definition: dtc_information.h:24
@ kWarningIndicatorRequested
Warning Indicator Requested (WIR)
@ kTestFailedSinceLastClear
DTC test is failed since the last error codes clearing.
@ kConfirmedDTC
DTC is confirmed at the request time.
@ kTestFailed
DTC test is failed at the request time.
@ kTestNotCompletedSinceLastClear
DTC test is not completed since the last error codes clearing.
@ kTestFailedThisOperationCycle
DTC test is failed at the current operation cycle.
@ kTestNotCompletedThisOperationCycle
DTC test is not completed at the current operation cycle.
@ kPendingDTC
DTC test is failed at the current/preivious operation cycle.
Byte that specifies an UDS DTC status.
Definition: dtc_information.h:37
uint8_t encodedBits
UDS DTC status byte containing the UdsDtcStatusBitType.
Definition: dtc_information.h:39