-
Notifications
You must be signed in to change notification settings - Fork 507
/
event_queue.cpp
52 lines (49 loc) · 1.31 KB
/
event_queue.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "alarm_system_event_handler.h"
#include "de_web_plugin_private.h"
#include "ui/device_widget.h"
/*! Handles one event and fires again if more are in the queue.
*/
void DeRestPluginPrivate::handleEvent(const Event &e)
{
if (e.resource() == RSensors)
{
handleSensorEvent(e);
AS_HandleAlarmSystemDeviceEvent(e, alarmSystemDeviceTable.get(), eventEmitter);
}
else if (e.resource() == RLights)
{
handleLightEvent(e);
AS_HandleAlarmSystemDeviceEvent(e, alarmSystemDeviceTable.get(), eventEmitter);
}
else if (e.resource() == RGroups)
{
handleGroupEvent(e);
}
else if (e.resource() == RAlarmSystems || e.what() == REventDeviceAlarm)
{
if (alarmSystems)
{
AS_HandleAlarmSystemEvent(e, *alarmSystems, eventEmitter, webSocketServer);
}
}
else if (e.resource() == RConfig)
{
if (deviceWidget)
{
deviceWidget->handleEvent(e);
}
}
else if (e.resource() == RDevices && e.what() == REventDDFInitResponse)
{
needRuleCheck = RULE_CHECK_DELAY;
}
if (e.deviceKey() != 0)
{
auto *device = DEV_GetDevice(m_devices, e.deviceKey());
if (device)
{
device->handleEvent(e);
}
}
handleRuleEvent(e);
}