Alerts » Historie » Version 7
Maximilian Seesslen, 11.04.2024 15:56
1 | 1 | Maximilian Seesslen | h2. Alarms/Alerts |
---|---|---|---|
2 | |||
3 | Devices should indicate issues; e.g.: |
||
4 | |||
5 | * Battery low |
||
6 | * I2C problems |
||
7 | 5 | Maximilian Seesslen | * Buffer overflow |
8 | 1 | Maximilian Seesslen | |
9 | h2. Object structutre |
||
10 | |||
11 | |_. Size |_. Decription |_. Examples | |
||
12 | | 2 | Object/Subsystem | I2C, VBat, | |
||
13 | | 1 | Unit | hz, Float, Time, Date, Percent, promilPwm, centiCelsius, canId, room, Multipacket-String | |
||
14 | | 1 | Issue | Whats wrong, Undervolts, Communication error | |
||
15 | | 4 | Value | 32Bit data of kind 'unit' | |
||
16 | 2 | Maximilian Seesslen | |
17 | |||
18 | 4 | Maximilian Seesslen | |_. Size |_. Decription |_. Examples | |
19 | | 2 | Event/Alert | buffer overflow, want sleep, overtemperature, Undervolts, Communication error + categorie | |
||
20 | | 1 | Unit | hz, Float, Time, Date, Percent, promilPwm, centiCelsius, canId, room, Multipacket-String | |
||
21 | | 1 | type | | |
||
22 | | 4 | Value | 32Bit data of kind 'unit' | |
||
23 | 1 | Maximilian Seesslen | |
24 | Room is a bit specifik to the timeout-shutdown-thing. subindex |
||
25 | Setting ambient light has the same issue. |
||
26 | 4 | Maximilian Seesslen | |
27 | Categorie: |
||
28 | USB, UART, System |
||
29 | |||
30 | Type: |
||
31 | Critical, Warning, Info, Event |
||
32 | 5 | Maximilian Seesslen | |
33 | Events: |
||
34 | Simple integer code which can be send via logging |
||
35 | * Buffer overflow |
||
36 | * I2C issue |
||
37 | 6 | Maximilian Seesslen | |
38 | h2. Events vs. Alerts |
||
39 | |||
40 | 7 | Maximilian Seesslen | Events can be integrated into logging. They can be used anywhere in the code like ISRs. An Event has no output value. Events just happen. They do not "disapear" or have an state. |
41 | The overhead should be acceptable. The code still compiles if events are disabled. |
||
42 | 6 | Maximilian Seesslen | |
43 | <pre><code class="cpp"> |
||
44 | bWarningE( EV_BUFFER_OVERFLOW | EV_UART, "Buffer overflow: %d", cnt); |
||
45 | 1 | Maximilian Seesslen | </code></pre> |
46 | |||
47 | 7 | Maximilian Seesslen | Alarms are send explicitly as system errors in the main event loop. An Alarm has an concrete value and it has an state like "apeared" or "disapeared". |
48 | The overhead is a little big higher than events. It uses an additional function code in Tdt. |
||
49 | 1 | Maximilian Seesslen | |
50 | 6 | Maximilian Seesslen | <pre><code class="cpp"> |
51 | 7 | Maximilian Seesslen | sendAlarm( Tdt::EAlarm::OverTemperature, Tdt::EAlarmState::appear, |
52 | 1 | Maximilian Seesslen | Tdt::EUnit::centiCelsius, Tdt::SValue { ._int=temperature } ); |
53 | 7 | Maximilian Seesslen | sendAlarm( Tdt::EAlarm::UnderVoltage, Tdt::EAlarmState::appear, |
54 | 1 | Maximilian Seesslen | Tdt::EUnit::milliVolt, Tdt::SValue { ._int=voltage } ); |
55 | 7 | Maximilian Seesslen | sendAlarm( Tdt::EAlarm::UnderVoltage, Tdt::EAlarmState::disappear, |
56 | Tdt::EUnit::none, Tdt::SValue { } ); |
||
57 | 6 | Maximilian Seesslen | </code></pre> |
58 | 7 | Maximilian Seesslen | |
59 | Events and alarms are implemented independantly. They can be used mutual. |