Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
monitor.h
1#ifndef MONITOR_H
2#define MONITOR_H
3
4#include <functional>
5#include "../core/instance_specifier.h"
6#include "../core/result.h"
7#include "./debouncing/counter_based_debouncer.h"
8#include "./debouncing/timer_based_debouncer.h"
9#include "./event.h"
10
11namespace ara
12{
13 namespace diag
14 {
16 enum class InitMonitorReason : uint32_t
17 {
18 kClear = 0x00,
19 kRestart = 0x01,
20 kReenabled = 0x02,
21 kDisabled = 0x03
22 };
23
25 enum class MonitorAction : uint32_t
26 {
27 kPassed = 0x00,
28 kFailed = 0x01,
29 kPrepassed = 0x02,
30 kPrefailed = 0x03,
32 kResetTestFailed = 0x05,
33 kFreezeDebouncing = 0x06,
34 kResetDebouncing = 0x07
35 };
36
39 class Monitor final
40 {
41 private:
42 const core::InstanceSpecifier &mSpecifier;
43 const std::function<void(InitMonitorReason)> mInitMonitor;
44 bool mOffered;
45 debouncing::Debouncer *mDebouncer;
46 Event *mEvent;
47
48 Monitor(
49 const core::InstanceSpecifier &specifier,
50 std::function<void(InitMonitorReason)> initMonitor);
51
52 void onEventStatusChanged(bool passed);
53
54 public:
59 Monitor(
60 const core::InstanceSpecifier &specifier,
61 std::function<void(InitMonitorReason)> initMonitor,
62 CounterBased defaultValues);
63
68 Monitor(
69 const core::InstanceSpecifier &specifier,
70 std::function<void(InitMonitorReason)> initMonitor,
71 TimeBased defaultValues);
72
73 ~Monitor() noexcept;
74
79
83 void AttachEvent(Event *event);
84
88
90 void StopOffer();
91 };
92 }
93}
94
95#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
A class to monitor the correct functionality of a system part.
Definition: monitor.h:40
void StopOffer()
Stop offering monitoring requests handling.
Definition: monitor.cpp:130
void AttachEvent(Event *event)
Attach an event to the monitor object.
Definition: monitor.cpp:101
core::Result< void > Offer()
Start offering monitoring requests handling.
Definition: monitor.cpp:106
void ReportMonitorAction(MonitorAction action)
Report a monitor action.
Definition: monitor.cpp:58
Debouncing mechanism interface.
Definition: debouncer.h:24
MonitorAction
Diagnostic monitor action type reported by an adpative application.
Definition: monitor.h:26
@ kFreezeDebouncing
Freeze the internal debouncing.
@ kResetDebouncing
Reset the internal debouncing.
@ kPassed
Monitoring passed.
@ kPrefailed
Monitoring pre-failed.
@ kResetTestFailed
Reset TestFailed bit in UDS DTC status.
@ kFailed
Monitoring failed.
@ kPrepassed
Monitoring pre-passed.
@ kFdcThresholdReached
Fault Detection Counter (FDC) threshold has been reached.
InitMonitorReason
Monitoring re-initialization reason.
Definition: monitor.h:17
@ kRestart
Operation cycle of the event was restarted.
@ kDisabled
Enable conditions (if set) are no longer fullfilled.
@ kReenabled
Enable conditions (if set) are fullfilled.
@ kClear
Event was cleared.
Contour-based debouncing parameters.
Definition: counter_based_debouncer.h:13
Time-based debouncing parameters.
Definition: timer_based_debouncer.h:16