Firmware SDK
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
bc_flood_detector.h
1 #ifndef _BC_FLOOD_DETECTOR_H
2 #define _BC_FLOOD_DETECTOR_H
3 
4 #include <bc_tick.h>
5 #include <bc_module_sensor.h>
6 #include <bc_scheduler.h>
7 #include <bc_gpio.h>
8 
12 
14 
15 typedef enum
16 {
17  BC_FLOOD_DETECTOR_TYPE_LD_81_SENSOR_MODULE_CHANNEL_A,
18  BC_FLOOD_DETECTOR_TYPE_LD_81_SENSOR_MODULE_CHANNEL_B
19 
21 
23 
24 typedef enum
25 {
26  BC_FLOOD_DETECTOR_EVENT_ERROR,
27  BC_FLOOD_DETECTOR_EVENT_UPDATE,
28 
30 
32 
34 
36 
37 typedef enum
38 {
39  BC_FLOOD_DETECTOR_STATE_ERROR = -1,
40  BC_FLOOD_DETECTOR_STATE_INITIALIZE = 0,
41  BC_FLOOD_DETECTOR_STATE_READY = 1,
42  BC_FLOOD_DETECTOR_STATE_MEASURE = 2,
43 
44 } bc_flood_detector_state_t;
45 
47 {
49  void (*_event_handler)(bc_flood_detector_t *, bc_flood_detector_event_t, void *);
50  void *_event_param;
51  bc_tick_t _update_interval;
52  bc_flood_detector_state_t _state;
53  bc_scheduler_task_id_t _task_id_interval;
54  bc_scheduler_task_id_t _task_id_measure;
55  bool _measurement_active;
56  bool _alarm;
57 
58 };
59 
61 
65 
67 
72 
73 void bc_flood_detector_set_event_handler(bc_flood_detector_t *self, void (*event_handler)(bc_flood_detector_t *,bc_flood_detector_event_t, void*), void *event_param);
74 
78 
80 
85 
87 
92 
94 
96 
97 #endif // _BC_FLOOD_DETECTOR_H
uint64_t bc_tick_t
Timestamp data type.
Definition: bc_tick.h:16
bool bc_flood_detector_is_alarm(bc_flood_detector_t *self)
Is alarm.
bc_flood_detector_event_t
Callback events.
void bc_flood_detector_set_update_interval(bc_flood_detector_t *self, bc_tick_t interval)
Set measurement interval.
size_t bc_scheduler_task_id_t
Task ID assigned by scheduler.
Definition: bc_scheduler.h:18
bc_flood_detector_type_t
Type sensor.
struct bc_flood_detector_t bc_flood_detector_t
Instance.
bool bc_flood_detector_measure(bc_flood_detector_t *self)
Start measurement manually.
void bc_flood_detector_set_event_handler(bc_flood_detector_t *self, void(*event_handler)(bc_flood_detector_t *, bc_flood_detector_event_t, void *), void *event_param)
Set callback function.
void bc_flood_detector_init(bc_flood_detector_t *self, bc_flood_detector_type_t type)
Initialize flood detector.