-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathgzw_valueid.cpp
124 lines (112 loc) · 3.33 KB
/
gzw_valueid.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
#include "gzw_valueid.h"
#include <value_classes/ValueID.h>
//
// Public member functions.
//
uint32_t valueid_getHomeId(valueid_t v)
{
OpenZWave::ValueID *valid = (OpenZWave::ValueID*)v;
return valid->GetHomeId();
}
uint8_t valueid_getNodeId(valueid_t v)
{
OpenZWave::ValueID *valid = (OpenZWave::ValueID*)v;
return valid->GetNodeId();
}
valueid_genre valueid_getGenre(valueid_t v)
{
OpenZWave::ValueID *valid = (OpenZWave::ValueID*)v;
valueid_genre val_genre;
switch (valid->GetGenre()) {
case OpenZWave::ValueID::ValueGenre_Basic:
val_genre = valueid_genre_basic;
break;
case OpenZWave::ValueID::ValueGenre_User:
val_genre = valueid_genre_user;
break;
case OpenZWave::ValueID::ValueGenre_Config:
val_genre = valueid_genre_config;
break;
case OpenZWave::ValueID::ValueGenre_System:
val_genre = valueid_genre_system;
break;
case OpenZWave::ValueID::ValueGenre_Count:
val_genre = valueid_genre_count;
break;
}
return val_genre;
}
uint8_t valueid_getCommandClassId(valueid_t v)
{
OpenZWave::ValueID *valid = (OpenZWave::ValueID*)v;
return valid->GetCommandClassId();
}
uint8_t valueid_getInstance(valueid_t v)
{
OpenZWave::ValueID *valid = (OpenZWave::ValueID*)v;
return valid->GetInstance();
}
uint8_t valueid_getIndex(valueid_t v)
{
OpenZWave::ValueID *valid = (OpenZWave::ValueID*)v;
return valid->GetIndex();
}
valueid_type valueid_getType(valueid_t v)
{
OpenZWave::ValueID *valid = (OpenZWave::ValueID*)v;
valueid_type val_type;
switch (valid->GetType()) {
case OpenZWave::ValueID::ValueType_Bool:
val_type = valueid_type_bool;
break;
case OpenZWave::ValueID::ValueType_Byte:
val_type = valueid_type_byte;
break;
case OpenZWave::ValueID::ValueType_Decimal:
val_type = valueid_type_decimal;
break;
case OpenZWave::ValueID::ValueType_Int:
val_type = valueid_type_int;
break;
case OpenZWave::ValueID::ValueType_List:
val_type = valueid_type_list;
break;
case OpenZWave::ValueID::ValueType_Schedule:
val_type = valueid_type_schedule;
break;
case OpenZWave::ValueID::ValueType_Short:
val_type = valueid_type_short;
break;
case OpenZWave::ValueID::ValueType_String:
val_type = valueid_type_string;
break;
case OpenZWave::ValueID::ValueType_Button:
val_type = valueid_type_button;
break;
case OpenZWave::ValueID::ValueType_Raw:
val_type = valueid_type_raw;
break;
// case OpenZWave::ValueID::ValueType_Max:
// val_type = valueid_type_max;
// break;
}
return val_type;
}
uint64_t valueid_getId(valueid_t v)
{
OpenZWave::ValueID *valid = (OpenZWave::ValueID*)v;
return valid->GetId();
}
//
// Go helper functions.
//
valueid_t valueid_create(uint32_t homeId, uint64_t id)
{
OpenZWave::ValueID *valueid = new OpenZWave::ValueID(homeId, (uint64)id);
return (valueid_t)valueid;
}
void valueid_free(valueid_t valueid)
{
OpenZWave::ValueID *val = (OpenZWave::ValueID*)valueid;
delete val;
}