Skip to content

Commit

Permalink
Merge pull request #307 from nouknouk/master
Browse files Browse the repository at this point in the history
[1.6 Update - Associations] ozw.isGroupMultiInstance(nodeid, groupid)
  • Loading branch information
ekarak authored Jun 19, 2019
2 parents af0ee7f + b11428e commit ed856d8
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 15 deletions.
3 changes: 2 additions & 1 deletion README-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ zwave.getAssociations(nodeid, group);
zwave.getMaxAssociations(nodeid, group);
zwave.addAssociation(nodeid, group, target_nodeid);
zwave.removeAssociation(nodeid, group, target_nodeid);
zwave.isGroupMultiInstance(nodeid, group);
```

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

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)
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)
24 changes: 22 additions & 2 deletions src/openzwave-groups.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ namespace OZW {
uint8 instanceid = 0;
if(info.Length() > 3) {
instanceid = Nan::To<Number>(info[3]).ToLocalChecked()->Value();
}
}

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

OZWManager( RemoveAssociation,
homeid, nodeid, groupidx, tgtnodeid, instanceid
);
}

#ifdef OPENZWAVE_16
/*
*
*/
// ===================================================================
NAN_METHOD(OZW::IsGroupMultiInstance)
// ===================================================================
{
Nan::HandleScope scope;
bool isMultiInstance = false;

CheckMinArgs(2, "nodeid, groupidx");
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
uint8 groupidx = Nan::To<Number>(info[1]).ToLocalChecked()->Value();

OZWManagerAssign(isMultiInstance, IsMultiInstance, homeid, nodeid, groupidx);
info.GetReturnValue().Set(Nan::New<Boolean>(isMultiInstance));
}
#endif

}
24 changes: 14 additions & 10 deletions src/openzwave.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ namespace OZW {
Nan::SetPrototypeMethod(t, "getGroupLabel", OZW::GetGroupLabel);
Nan::SetPrototypeMethod(t, "addAssociation", OZW::AddAssociation);
Nan::SetPrototypeMethod(t, "removeAssociation", OZW::RemoveAssociation);
#ifdef OPENZWAVE_16
Nan::SetPrototypeMethod(t, "isGroupMultiInstance", OZW::IsGroupMultiInstance);
#endif

// openzwave-management.cc
#if OPENZWAVE_SECURITY == 1
Nan::SetPrototypeMethod(t, "addNode", OZW::AddNode);
Expand Down Expand Up @@ -139,16 +143,16 @@ namespace OZW {
Nan::SetPrototypeMethod(t, "setNodeManufacturerName", OZW::SetNodeManufacturerName); // ** new
Nan::SetPrototypeMethod(t, "getNodeProductName", OZW::GetNodeProductName); // ** new
Nan::SetPrototypeMethod(t, "setNodeProductName", OZW::SetNodeProductName); // ** new
Nan::SetPrototypeMethod(t, "isNodeInfoReceived", OZW::IsNodeInfoReceived); // ** new
Nan::SetPrototypeMethod(t, "isNodeAwake", OZW::IsNodeAwake); // ** new
Nan::SetPrototypeMethod(t, "isNodeFailed", OZW::IsNodeFailed); // ** new
Nan::SetPrototypeMethod(t, "getNodeDeviceType", OZW::GetNodeDeviceType); // ** new
Nan::SetPrototypeMethod(t, "getNodeRole", OZW::GetNodeRole); // ** new
Nan::SetPrototypeMethod(t, "getNodeRoleString", OZW::GetNodeRoleString); // ** new
Nan::SetPrototypeMethod(t, "getNodePlusType", OZW::GetNodePlusType); // ** new
Nan::SetPrototypeMethod(t, "getNodePlusTypeString", OZW::GetNodePlusTypeString); // ** new
Nan::SetPrototypeMethod(t, "getNodeQueryStage", OZW::GetNodeQueryStage); // ** new

Nan::SetPrototypeMethod(t, "isNodeInfoReceived", OZW::IsNodeInfoReceived); // ** new
Nan::SetPrototypeMethod(t, "isNodeAwake", OZW::IsNodeAwake); // ** new
Nan::SetPrototypeMethod(t, "isNodeFailed", OZW::IsNodeFailed); // ** new
Nan::SetPrototypeMethod(t, "getNodeDeviceType", OZW::GetNodeDeviceType); // ** new
Nan::SetPrototypeMethod(t, "getNodeRole", OZW::GetNodeRole); // ** new
Nan::SetPrototypeMethod(t, "getNodeRoleString", OZW::GetNodeRoleString); // ** new
Nan::SetPrototypeMethod(t, "getNodePlusType", OZW::GetNodePlusType); // ** new
Nan::SetPrototypeMethod(t, "getNodePlusTypeString", OZW::GetNodePlusTypeString); // ** new
Nan::SetPrototypeMethod(t, "getNodeQueryStage", OZW::GetNodeQueryStage); // ** new
// getters
Nan::SetPrototypeMethod(t, "getNodeMaxBaudRate", OZW::GetNodeMaxBaudRate); // ** new
Nan::SetPrototypeMethod(t, "getNodeVersion", OZW::GetNodeVersion); // ** new
Expand Down
7 changes: 5 additions & 2 deletions src/openzwave.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ namespace OZW {
static NAN_METHOD(GetGroupLabel);
static NAN_METHOD(AddAssociation);
static NAN_METHOD(RemoveAssociation);
#ifdef OPENZWAVE_16
static NAN_METHOD(IsGroupMultiInstance);
#endif
#if OPENZWAVE_SECURITY == 1
static NAN_METHOD(AddNode);
static NAN_METHOD(RemoveNode);
Expand Down Expand Up @@ -139,14 +142,14 @@ namespace OZW {
static NAN_METHOD(SetNodeManufacturerName);
static NAN_METHOD(GetNodeProductName);
static NAN_METHOD(SetNodeProductName);

static NAN_METHOD(IsNodeInfoReceived);
static NAN_METHOD(IsNodeAwake);
static NAN_METHOD(IsNodeFailed);
static NAN_METHOD(GetNodeDeviceType);
static NAN_METHOD(GetNodeRole);
static NAN_METHOD(GetNodeRoleString);
static NAN_METHOD(GetNodePlusType);
static NAN_METHOD(GetNodePlusType);
static NAN_METHOD(GetNodePlusTypeString);
static NAN_METHOD(GetNodeQueryStage);
static NAN_METHOD(GetNodeDeviceTypeString);
Expand Down

0 comments on commit ed856d8

Please sign in to comment.