Skip to content

Commit ed856d8

Browse files
authored
Merge pull request #307 from nouknouk/master
[1.6 Update - Associations] ozw.isGroupMultiInstance(nodeid, groupid)
2 parents af0ee7f + b11428e commit ed856d8

File tree

4 files changed

+43
-15
lines changed

4 files changed

+43
-15
lines changed

README-api.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ zwave.getAssociations(nodeid, group);
104104
zwave.getMaxAssociations(nodeid, group);
105105
zwave.addAssociation(nodeid, group, target_nodeid);
106106
zwave.removeAssociation(nodeid, group, target_nodeid);
107+
zwave.isGroupMultiInstance(nodeid, group);
107108
```
108109

109110
Resetting the controller. Calling `hardReset` will clear any associations, so use
@@ -153,4 +154,4 @@ zwave.requestConfigParam(nodeId, paramId);
153154
zwave.setConfigParam(nodeId, paramId, paramValue, <sizeof paramValue>);
154155
```
155156

156-
You can always refer to [the official OpenZWave::Manager API](http://www.openzwave.com/dev/classOpenZWave_1_1Manager.html) for more details on calling Manager methods. The aim of this wrapper is to provide a 1-to-1 mapping to all available methods, with the only change here being that the first letter of each method is downcased (eg. `RequestNodeInfo` in C++ is named `requestNodeInfo` in Javascript)
157+
You can always refer to [the official OpenZWave::Manager API](http://www.openzwave.com/dev/classOpenZWave_1_1Manager.html) for more details on calling Manager methods. The aim of this wrapper is to provide a 1-to-1 mapping to all available methods, with the only change here being that the first letter of each method is downcased (eg. `RequestNodeInfo` in C++ is named `requestNodeInfo` in Javascript)

src/openzwave-groups.cc

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ namespace OZW {
128128
uint8 instanceid = 0;
129129
if(info.Length() > 3) {
130130
instanceid = Nan::To<Number>(info[3]).ToLocalChecked()->Value();
131-
}
131+
}
132132

133133
OZWManager( AddAssociation,
134134
homeid, nodeid, groupidx, tgtnodeid, instanceid
@@ -150,11 +150,31 @@ namespace OZW {
150150
uint8 instanceid = 0;
151151
if(info.Length() > 3) {
152152
instanceid = Nan::To<Number>(info[3]).ToLocalChecked()->Value();
153-
}
153+
}
154154

155155
OZWManager( RemoveAssociation,
156156
homeid, nodeid, groupidx, tgtnodeid, instanceid
157157
);
158158
}
159159

160+
#ifdef OPENZWAVE_16
161+
/*
162+
*
163+
*/
164+
// ===================================================================
165+
NAN_METHOD(OZW::IsGroupMultiInstance)
166+
// ===================================================================
167+
{
168+
Nan::HandleScope scope;
169+
bool isMultiInstance = false;
170+
171+
CheckMinArgs(2, "nodeid, groupidx");
172+
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
173+
uint8 groupidx = Nan::To<Number>(info[1]).ToLocalChecked()->Value();
174+
175+
OZWManagerAssign(isMultiInstance, IsMultiInstance, homeid, nodeid, groupidx);
176+
info.GetReturnValue().Set(Nan::New<Boolean>(isMultiInstance));
177+
}
178+
#endif
179+
160180
}

src/openzwave.cc

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ namespace OZW {
8181
Nan::SetPrototypeMethod(t, "getGroupLabel", OZW::GetGroupLabel);
8282
Nan::SetPrototypeMethod(t, "addAssociation", OZW::AddAssociation);
8383
Nan::SetPrototypeMethod(t, "removeAssociation", OZW::RemoveAssociation);
84+
#ifdef OPENZWAVE_16
85+
Nan::SetPrototypeMethod(t, "isGroupMultiInstance", OZW::IsGroupMultiInstance);
86+
#endif
87+
8488
// openzwave-management.cc
8589
#if OPENZWAVE_SECURITY == 1
8690
Nan::SetPrototypeMethod(t, "addNode", OZW::AddNode);
@@ -139,16 +143,16 @@ namespace OZW {
139143
Nan::SetPrototypeMethod(t, "setNodeManufacturerName", OZW::SetNodeManufacturerName); // ** new
140144
Nan::SetPrototypeMethod(t, "getNodeProductName", OZW::GetNodeProductName); // ** new
141145
Nan::SetPrototypeMethod(t, "setNodeProductName", OZW::SetNodeProductName); // ** new
142-
143-
Nan::SetPrototypeMethod(t, "isNodeInfoReceived", OZW::IsNodeInfoReceived); // ** new
144-
Nan::SetPrototypeMethod(t, "isNodeAwake", OZW::IsNodeAwake); // ** new
145-
Nan::SetPrototypeMethod(t, "isNodeFailed", OZW::IsNodeFailed); // ** new
146-
Nan::SetPrototypeMethod(t, "getNodeDeviceType", OZW::GetNodeDeviceType); // ** new
147-
Nan::SetPrototypeMethod(t, "getNodeRole", OZW::GetNodeRole); // ** new
148-
Nan::SetPrototypeMethod(t, "getNodeRoleString", OZW::GetNodeRoleString); // ** new
149-
Nan::SetPrototypeMethod(t, "getNodePlusType", OZW::GetNodePlusType); // ** new
150-
Nan::SetPrototypeMethod(t, "getNodePlusTypeString", OZW::GetNodePlusTypeString); // ** new
151-
Nan::SetPrototypeMethod(t, "getNodeQueryStage", OZW::GetNodeQueryStage); // ** new
146+
147+
Nan::SetPrototypeMethod(t, "isNodeInfoReceived", OZW::IsNodeInfoReceived); // ** new
148+
Nan::SetPrototypeMethod(t, "isNodeAwake", OZW::IsNodeAwake); // ** new
149+
Nan::SetPrototypeMethod(t, "isNodeFailed", OZW::IsNodeFailed); // ** new
150+
Nan::SetPrototypeMethod(t, "getNodeDeviceType", OZW::GetNodeDeviceType); // ** new
151+
Nan::SetPrototypeMethod(t, "getNodeRole", OZW::GetNodeRole); // ** new
152+
Nan::SetPrototypeMethod(t, "getNodeRoleString", OZW::GetNodeRoleString); // ** new
153+
Nan::SetPrototypeMethod(t, "getNodePlusType", OZW::GetNodePlusType); // ** new
154+
Nan::SetPrototypeMethod(t, "getNodePlusTypeString", OZW::GetNodePlusTypeString); // ** new
155+
Nan::SetPrototypeMethod(t, "getNodeQueryStage", OZW::GetNodeQueryStage); // ** new
152156
// getters
153157
Nan::SetPrototypeMethod(t, "getNodeMaxBaudRate", OZW::GetNodeMaxBaudRate); // ** new
154158
Nan::SetPrototypeMethod(t, "getNodeVersion", OZW::GetNodeVersion); // ** new

src/openzwave.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ namespace OZW {
7777
static NAN_METHOD(GetGroupLabel);
7878
static NAN_METHOD(AddAssociation);
7979
static NAN_METHOD(RemoveAssociation);
80+
#ifdef OPENZWAVE_16
81+
static NAN_METHOD(IsGroupMultiInstance);
82+
#endif
8083
#if OPENZWAVE_SECURITY == 1
8184
static NAN_METHOD(AddNode);
8285
static NAN_METHOD(RemoveNode);
@@ -139,14 +142,14 @@ namespace OZW {
139142
static NAN_METHOD(SetNodeManufacturerName);
140143
static NAN_METHOD(GetNodeProductName);
141144
static NAN_METHOD(SetNodeProductName);
142-
145+
143146
static NAN_METHOD(IsNodeInfoReceived);
144147
static NAN_METHOD(IsNodeAwake);
145148
static NAN_METHOD(IsNodeFailed);
146149
static NAN_METHOD(GetNodeDeviceType);
147150
static NAN_METHOD(GetNodeRole);
148151
static NAN_METHOD(GetNodeRoleString);
149-
static NAN_METHOD(GetNodePlusType);
152+
static NAN_METHOD(GetNodePlusType);
150153
static NAN_METHOD(GetNodePlusTypeString);
151154
static NAN_METHOD(GetNodeQueryStage);
152155
static NAN_METHOD(GetNodeDeviceTypeString);

0 commit comments

Comments
 (0)