Skip to content

Commit

Permalink
Merge pull request #64 from OpenZWave/bugfix/issue-63-getZwaveValueID…
Browse files Browse the repository at this point in the history
…-typo

Bugfix/issue 63 get zwave value id typo
  • Loading branch information
ekarak committed Feb 7, 2016
2 parents 3a21b2f + a02310f commit 466ae61
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openzwave-shared",
"version": "1.1.6",
"version": "1.1.7",
"description": "Node.JS bindings for OpenZWave including management and security functions",
"main": "./lib/openzwave-shared.js",
"dependencies": {
Expand Down
13 changes: 4 additions & 9 deletions src/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ namespace OZW {
}

bool isOzwValue(Local<Object>& o) {
return (!Nan::HasOwnProperty(o, Nan::New<String>("nodeid").ToLocalChecked()).IsNothing()
return (!Nan::HasOwnProperty(o, Nan::New<String>("node_id").ToLocalChecked()).IsNothing()
&& !Nan::HasOwnProperty(o, Nan::New<String>("class_id").ToLocalChecked()).IsNothing()
&& !Nan::HasOwnProperty(o, Nan::New<String>("instance").ToLocalChecked()).IsNothing()
&& !Nan::HasOwnProperty(o, Nan::New<String>("index").ToLocalChecked()).IsNothing());
Expand All @@ -261,20 +261,15 @@ namespace OZW {
if ( (info.Length() >= offset) && info[offset]->IsObject() ) {
Local<Object> o = info[offset]->ToObject();
if (isOzwValue(o)) {
nodeid = Nan::Get(o, Nan::New<String>("nodeid").ToLocalChecked()).ToLocalChecked()->ToNumber()->Value();
nodeid = Nan::Get(o, Nan::New<String>("node_id").ToLocalChecked()).ToLocalChecked()->ToNumber()->Value();
comclass = Nan::Get(o, Nan::New<String>("class_id").ToLocalChecked()).ToLocalChecked()->ToNumber()->Value();
instance = Nan::Get(o, Nan::New<String>("instance").ToLocalChecked()).ToLocalChecked()->ToNumber()->Value();
index = Nan::Get(o, Nan::New<String>("index").ToLocalChecked()).ToLocalChecked()->ToNumber()->Value();
} else {
return ( NULL );
}
} else if (
(info.Length() >= offset+4)
&& info[offset]->IsNumber()
&& info[offset+1]->IsNumber()
&& info[offset+2]->IsNumber()
&& info[offset+3]->IsNumber()
) { // legacy mode
} else if ((info.Length() >= offset+4)) {
// legacy mode
nodeid = info[offset]->ToNumber()->Value();
comclass = info[offset+1]->ToNumber()->Value();
instance = info[offset+2]->ToNumber()->Value();
Expand Down

0 comments on commit 466ae61

Please sign in to comment.