Projekt

Allgemein

Profil

Alerts » Historie » Version 6

Maximilian Seesslen, 11.04.2024 15:43

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
Events can be integrated into logging. They can be used anywhere in the code like ISRs. An Event has no output value.
41
42
<pre><code class="cpp">
43
bWarningE( EV_BUFFER_OVERFLOW | EV_UART, "Buffer overflow: %d", cnt);
44
</code></pre>
45
46
Alarms are send explicitly as system errors in the main event loop. An Alarm has an concrete value.
47
48
<pre><code class="cpp">
49
sendAlarm( Tdt::EAlarm::OverTemperature,
50
                 Tdt::EUnit::centiCelsius, Tdt::SValue { ._int=temperature } );
51
sendAlarm( Tdt::EAlarm::UnderVoltage,
52
                 Tdt::EUnit::milliVolt, Tdt::SValue { ._int=voltage } );
53
</code></pre>