Skip to content

Commit 263d9bd

Browse files
authored
feat: expose GetNodeClassInformation (#374)
1 parent 21e1516 commit 263d9bd

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

src/openzwave-nodes.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ namespace OZW {
4444
info.GetReturnValue().Set( o_neighbors );
4545
}
4646

47+
/*
48+
* Gets the Command Class Version for a node
49+
*/
50+
// ===================================================================
51+
NAN_METHOD(OZW::GetNodeClassInformation)
52+
// =================================================================
53+
{
54+
Nan::HandleScope scope;
55+
CheckMinArgs(2, "nodeid, commClass");
56+
uint8 nodeid = Nan::To<Integer>(info[0]).ToLocalChecked()->Value();
57+
uint8 commClass = Nan::To<Integer>(info[1]).ToLocalChecked()->Value();
58+
uint8 commClassVersion = 0;
59+
OZWManager( GetNodeClassInformation, homeid, nodeid, commClass, NULL, &commClassVersion);
60+
info.GetReturnValue().Set(Nan::New<Integer>(commClassVersion));
61+
}
62+
4763
#ifdef OPENZWAVE16_DEPRECATED
4864
// =================================================================
4965
NAN_METHOD(OZW::SetNodeOn)

src/openzwave.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ namespace OZW {
162162
Nan::SetPrototypeMethod(t, "getNodeGeneric", OZW::GetNodeGeneric); // ** new
163163
Nan::SetPrototypeMethod(t, "getNodeManufacturerId", OZW::GetNodeManufacturerId); // ** new
164164
Nan::SetPrototypeMethod(t, "getNodeNeighbors", OZW::GetNodeNeighbors);
165+
Nan::SetPrototypeMethod(t, "getNodeClassInformation", OZW::GetNodeClassInformation);
165166
Nan::SetPrototypeMethod(t, "getNodeProductId", OZW::GetNodeProductId); // ** new
166167
Nan::SetPrototypeMethod(t, "getNodeProductType", OZW::GetNodeProductType); // ** new
167168
Nan::SetPrototypeMethod(t, "getNodeSecurity", OZW::GetNodeSecurity); // ** new

src/openzwave.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ namespace OZW {
168168
static NAN_METHOD(GetNodeProductType);
169169
static NAN_METHOD(GetNodeProductId);
170170
static NAN_METHOD(GetNodeNeighbors);
171+
static NAN_METHOD(GetNodeClassInformation);
171172
#if OPENZWAVE_16
172173
static NAN_METHOD(GetMetaData);
173174
static NAN_METHOD(GetChangeLog);

types/openzwave-shared.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,11 @@ declare module "openzwave-shared" {
630630
*/
631631
getNodeNeighbors(nodeId: number): Array<number>;
632632

633+
/**
634+
* Gets the Command Class Version for a node.
635+
*/
636+
getNodeClassInformation(nodeId: number, commClass: number): number;
637+
633638
/**
634639
* LEGACY MODE (using setNodeOn)
635640
* @deprecated

0 commit comments

Comments
 (0)