Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecations to remove the compile warnings #181

Merged
merged 2 commits into from
Jul 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/openzwave-config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(3, "nodeid, param, value");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 param = info[1]->ToNumber()->Value();
int32 value = info[2]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
uint8 param = Nan::To<Number>(info[1]).ToLocalChecked()->Value();
int32 value = Nan::To<Number>(info[2]).ToLocalChecked()->Value();
if (info.Length() < 4) {
OpenZWave::Manager::Get()->SetConfigParam(homeid, nodeid, param, value);
}
else {
uint8 size = info[3]->ToNumber()->Value();
uint8 size = Nan::To<Number>(info[3]).ToLocalChecked()->Value();
OpenZWave::Manager::Get()->SetConfigParam(homeid, nodeid, param, value, size);
}
}
Expand All @@ -62,8 +62,8 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(2, "nodeid, param");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 param = info[1]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
uint8 param = Nan::To<Number>(info[1]).ToLocalChecked()->Value();
OpenZWave::Manager::Get()->RequestConfigParam(homeid, nodeid, param);
}

Expand All @@ -78,7 +78,7 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
OpenZWave::Manager::Get()->RequestAllConfigParams (homeid, nodeid);
}

Expand Down
26 changes: 13 additions & 13 deletions src/openzwave-groups.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
uint8 numGroups = OpenZWave::Manager::Get()->GetNumGroups(homeid, nodeid);
info.GetReturnValue().Set(Nan::New<Integer>(numGroups));
}
Expand All @@ -48,8 +48,8 @@ namespace OZW {
Nan::HandleScope scope;
CheckMinArgs(2, "nodeid, groupidx");
uint8* associations;
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 groupidx = info[1]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
uint8 groupidx = Nan::To<Number>(info[1]).ToLocalChecked()->Value();

uint32 numNodes = OpenZWave::Manager::Get()->GetAssociations(
homeid, nodeid, groupidx, &associations
Expand Down Expand Up @@ -77,8 +77,8 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(2, "nodeid, groupidx");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 groupidx = info[1]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
uint8 groupidx = Nan::To<Number>(info[1]).ToLocalChecked()->Value();

uint8 numMaxAssoc = OpenZWave::Manager::Get()->GetMaxAssociations(
homeid, nodeid, groupidx
Expand All @@ -96,8 +96,8 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(2, "nodeid, groupidx");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 groupidx = info[1]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
uint8 groupidx = Nan::To<Number>(info[1]).ToLocalChecked()->Value();

std::string groupLabel = OpenZWave::Manager::Get()->GetGroupLabel(
homeid, nodeid, groupidx
Expand All @@ -118,9 +118,9 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(3, "nodeid, groupidx, tgtnodeid");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 groupidx = info[1]->ToNumber()->Value();
uint8 tgtnodeid = info[2]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
uint8 groupidx = Nan::To<Number>(info[1]).ToLocalChecked()->Value();
uint8 tgtnodeid = Nan::To<Number>(info[2]).ToLocalChecked()->Value();

OpenZWave::Manager::Get()->AddAssociation(
homeid,nodeid,groupidx,tgtnodeid
Expand All @@ -136,9 +136,9 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(3, "nodeid, groupidx, tgtnodeid");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 groupidx = info[1]->ToNumber()->Value();
uint8 tgtnodeid = info[2]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
uint8 groupidx = Nan::To<Number>(info[1]).ToLocalChecked()->Value();
uint8 tgtnodeid = Nan::To<Number>(info[2]).ToLocalChecked()->Value();

OpenZWave::Manager::Get()->RemoveAssociation(homeid,nodeid,groupidx,tgtnodeid);
}
Expand Down
38 changes: 19 additions & 19 deletions src/openzwave-management.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace OZW {
// =================================================================
{
Nan::HandleScope scope;
bool doSecurity = info.Length() > 0 && info[0]->ToBoolean()->Value();
bool doSecurity = info.Length() > 0 && Nan::To<Boolean>(info[0]).ToLocalChecked()->Value();
info.GetReturnValue().Set(Nan::New<Boolean>(
OpenZWave::Manager::Get()->AddNode(homeid, doSecurity)
));
Expand Down Expand Up @@ -74,7 +74,7 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
info.GetReturnValue().Set(Nan::New<Boolean>(
OpenZWave::Manager::Get()->RemoveFailedNode(homeid, nodeid)
));
Expand All @@ -93,7 +93,7 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
info.GetReturnValue().Set(Nan::New<Boolean>(
OpenZWave::Manager::Get()->HasNodeFailed(homeid, nodeid)
));
Expand All @@ -109,7 +109,7 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
info.GetReturnValue().Set(Nan::New<Boolean>(
OpenZWave::Manager::Get()->RequestNodeNeighborUpdate(homeid, nodeid)
));
Expand All @@ -125,7 +125,7 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
info.GetReturnValue().Set(Nan::New<Boolean>(
OpenZWave::Manager::Get()->AssignReturnRoute(homeid, nodeid)
));
Expand All @@ -142,7 +142,7 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
info.GetReturnValue().Set(Nan::New<Boolean>(
OpenZWave::Manager::Get()->DeleteAllReturnRoutes(homeid, nodeid)
));
Expand All @@ -158,7 +158,7 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
info.GetReturnValue().Set(Nan::New<Boolean>(
OpenZWave::Manager::Get()->SendNodeInformation(homeid, nodeid)
));
Expand Down Expand Up @@ -206,7 +206,7 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
info.GetReturnValue().Set(Nan::New<Boolean>(
OpenZWave::Manager::Get()->ReplaceFailedNode(homeid, nodeid)
));
Expand Down Expand Up @@ -235,7 +235,7 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
info.GetReturnValue().Set(Nan::New<Boolean>(
OpenZWave::Manager::Get()->RequestNetworkUpdate(homeid, nodeid)
));
Expand All @@ -250,7 +250,7 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
info.GetReturnValue().Set(Nan::New<Boolean>(
OpenZWave::Manager::Get()->ReplicationSend(homeid, nodeid)
));
Expand All @@ -265,8 +265,8 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(2, "nodeid, buttonid");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 btnid = info[1]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
uint8 btnid = Nan::To<Number>(info[1]).ToLocalChecked()->Value();
info.GetReturnValue().Set(Nan::New<Boolean>(
OpenZWave::Manager::Get()->CreateButton(homeid, nodeid, btnid)
));
Expand All @@ -281,8 +281,8 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(2, "nodeid, buttonid");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 btnid = info[1]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
uint8 btnid = Nan::To<Number>(info[1]).ToLocalChecked()->Value();
info.GetReturnValue().Set(Nan::New<Boolean>(
OpenZWave::Manager::Get()->DeleteButton(homeid, nodeid, btnid)
));
Expand All @@ -299,16 +299,16 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(1, "command");
std::string ctrcmd = (*String::Utf8Value(info[0]->ToString()));
std::string ctrcmd = (*String::Utf8Value(Nan::To<String>(info[0]).ToLocalChecked()));
uint8 nodeid1 = 0xff;
uint8 nodeid2 = 0;
bool highpower = false;
if (info.Length() > 1) {
highpower = info[1]->ToBoolean()->Value();
highpower = Nan::To<Boolean>(info[1]).ToLocalChecked()->Value();
if (info.Length() > 2) {
nodeid1 = info[2]->ToNumber()->Value();
nodeid1 = Nan::To<Number>(info[2]).ToLocalChecked()->Value();
if (info.Length() > 3) {
nodeid2 = info[3]->ToNumber()->Value();
nodeid2 = Nan::To<Number>(info[3]).ToLocalChecked()->Value();
}
}
}
Expand Down Expand Up @@ -400,7 +400,7 @@ namespace OZW {
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
OpenZWave::Node::NodeData data;
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();

OpenZWave::Manager::Get()->GetNodeStatistics(homeid, nodeid, &data);

Expand Down
12 changes: 6 additions & 6 deletions src/openzwave-network.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 nummsg = (info.Length() > 1) ? info[1]->ToNumber()->Value() : 1;
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
uint8 nummsg = (info.Length() > 1) ? Nan::To<Number>(info[1]).ToLocalChecked()->Value() : 1;
OpenZWave::Manager::Get()->TestNetworkNode(homeid, nodeid, nummsg);
}

Expand All @@ -45,7 +45,7 @@ namespace OZW {
// ===================================================================
{
Nan::HandleScope scope;
uint8 nummsg = (info.Length() > 0) ? info[0]->ToNumber()->Value() : 1;
uint8 nummsg = (info.Length() > 0) ? Nan::To<Number>(info[0]).ToLocalChecked()->Value() : 1;
OpenZWave::Manager::Get()->TestNetwork(homeid, nummsg);
}

Expand All @@ -58,8 +58,8 @@ namespace OZW {
{
Nan::HandleScope scope;
CheckMinArgs(1, "nodeid");
uint8 nodeid = info[0]->ToNumber()->Value();
uint8 doRR = (info.Length() > 1) ? info[1]->ToBoolean()->Value() : false;
uint8 nodeid = Nan::To<Number>(info[0]).ToLocalChecked()->Value();
uint8 doRR = (info.Length() > 1) ? Nan::To<Boolean>(info[1]).ToLocalChecked()->Value() : false;
OpenZWave::Manager::Get()->HealNetworkNode(homeid, nodeid, doRR);
}

Expand All @@ -73,7 +73,7 @@ namespace OZW {
// ===================================================================
{
Nan::HandleScope scope;
bool doRR = (info.Length() > 0) ? info[0]->ToBoolean()->Value() : false;
bool doRR = (info.Length() > 0) ? Nan::To<Boolean>(info[0]).ToLocalChecked()->Value() : false;
OpenZWave::Manager::Get()->HealNetwork(homeid, doRR);
}
}
Loading