forked from jimjibone/goopenzwave
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gzw_notification.cpp
169 lines (156 loc) · 5.84 KB
/
gzw_notification.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include "gzw_notification.h"
#include <Notification.h>
#include <string.h>
//
// Public member functions.
//
notification_type notification_getType(notification_t n)
{
OpenZWave::Notification *noti = (OpenZWave::Notification*)n;
notification_type noti_type;
switch (noti->GetType()) {
case OpenZWave::Notification::Type_ValueAdded:
noti_type = notification_type_valueAdded;
break;
case OpenZWave::Notification::Type_ValueRemoved:
noti_type = notification_type_valueRemoved;
break;
case OpenZWave::Notification::Type_ValueChanged:
noti_type = notification_type_valueChanged;
break;
case OpenZWave::Notification::Type_ValueRefreshed:
noti_type = notification_type_valueRefreshed;
break;
case OpenZWave::Notification::Type_Group:
noti_type = notification_type_group;
break;
case OpenZWave::Notification::Type_NodeNew:
noti_type = notification_type_nodeNew;
break;
case OpenZWave::Notification::Type_NodeAdded:
noti_type = notification_type_nodeAdded;
break;
case OpenZWave::Notification::Type_NodeRemoved:
noti_type = notification_type_nodeRemoved;
break;
case OpenZWave::Notification::Type_NodeProtocolInfo:
noti_type = notification_type_nodeProtocolInfo;
break;
case OpenZWave::Notification::Type_NodeNaming:
noti_type = notification_type_nodeNaming;
break;
case OpenZWave::Notification::Type_NodeEvent:
noti_type = notification_type_nodeEvent;
break;
case OpenZWave::Notification::Type_PollingDisabled:
noti_type = notification_type_pollingDisabled;
break;
case OpenZWave::Notification::Type_PollingEnabled:
noti_type = notification_type_pollingEnabled;
break;
case OpenZWave::Notification::Type_SceneEvent:
noti_type = notification_type_sceneEvent;
break;
case OpenZWave::Notification::Type_CreateButton:
noti_type = notification_type_createButton;
break;
case OpenZWave::Notification::Type_DeleteButton:
noti_type = notification_type_deleteButton;
break;
case OpenZWave::Notification::Type_ButtonOn:
noti_type = notification_type_buttonOn;
break;
case OpenZWave::Notification::Type_ButtonOff:
noti_type = notification_type_buttonOff;
break;
case OpenZWave::Notification::Type_DriverReady:
noti_type = notification_type_driverReady;
break;
case OpenZWave::Notification::Type_DriverFailed:
noti_type = notification_type_driverFailed;
break;
case OpenZWave::Notification::Type_DriverReset:
noti_type = notification_type_driverReset;
break;
case OpenZWave::Notification::Type_EssentialNodeQueriesComplete:
noti_type = notification_type_essentialNodeQueriesComplete;
break;
case OpenZWave::Notification::Type_NodeQueriesComplete:
noti_type = notification_type_nodeQueriesComplete;
break;
case OpenZWave::Notification::Type_AwakeNodesQueried:
noti_type = notification_type_awakeNodesQueried;
break;
case OpenZWave::Notification::Type_AllNodesQueriedSomeDead:
noti_type = notification_type_allNodesQueriedSomeDead;
break;
case OpenZWave::Notification::Type_AllNodesQueried:
noti_type = notification_type_allNodesQueried;
break;
case OpenZWave::Notification::Type_Notification:
noti_type = notification_type_notification;
break;
case OpenZWave::Notification::Type_DriverRemoved:
noti_type = notification_type_driverRemoved;
break;
case OpenZWave::Notification::Type_ControllerCommand:
noti_type = notification_type_controllerCommand;
break;
case OpenZWave::Notification::Type_NodeReset:
noti_type = notification_type_nodeReset;
break;
}
return noti_type;
}
uint32_t notification_getHomeId(notification_t n)
{
OpenZWave::Notification *noti = (OpenZWave::Notification*)n;
return noti->GetHomeId();
}
uint8_t notification_getNodeId(notification_t n)
{
OpenZWave::Notification *noti = (OpenZWave::Notification*)n;
return noti->GetNodeId();
}
valueid_t notification_getValueId(notification_t n)
{
OpenZWave::Notification *noti = (OpenZWave::Notification*)n;
valueid_t valid = (OpenZWave::ValueID*)&(noti->GetValueID());
return valid;
}
uint8_t notification_getGroupIdx(notification_t n)
{
OpenZWave::Notification *noti = (OpenZWave::Notification*)n;
return noti->GetGroupIdx();
}
uint8_t notification_getEvent(notification_t n)
{
OpenZWave::Notification *noti = (OpenZWave::Notification*)n;
return noti->GetEvent();
}
uint8_t notification_getButtonId(notification_t n)
{
OpenZWave::Notification *noti = (OpenZWave::Notification*)n;
return noti->GetButtonId();
}
uint8_t notification_getSceneId(notification_t n)
{
OpenZWave::Notification *noti = (OpenZWave::Notification*)n;
return noti->GetSceneId();
}
uint8_t notification_getNotification(notification_t n)
{
OpenZWave::Notification *noti = (OpenZWave::Notification*)n;
return noti->GetNotification();
}
uint8_t notification_getByte(notification_t n)
{
OpenZWave::Notification *noti = (OpenZWave::Notification*)n;
return noti->GetEvent();
}
char* notification_getAsString(notification_t n)
{
OpenZWave::Notification *noti = (OpenZWave::Notification*)n;
return strdup(noti->GetAsString().c_str());
}