File tree Expand file tree Collapse file tree 7 files changed +200
-182
lines changed
Expand file tree Collapse file tree 7 files changed +200
-182
lines changed Original file line number Diff line number Diff line change 44 "description" : " Node.JS bindings for OpenZWave including management and security functions" ,
55 "main" : " ./lib/openzwave-shared.js" ,
66 "dependencies" : {
7- "nan" : " 2.5.0 "
7+ "nan" : " 2.6.2 "
88 },
99 "scripts" : {
1010 "test" : " node test.js" ,
Original file line number Diff line number Diff line change @@ -98,22 +98,18 @@ namespace OZW {
9898 {
9999 Nan::HandleScope scope;
100100 OpenZWave::ValueID* ozwvid = populateValueId (info);
101- if (ozwvid == NULL ) {
102- Nan::ThrowTypeError (" OpenZWave valueId not found" );
103- } else {
101+ if (ozwvid) {
104102 OpenZWave::Manager::Get ()->PressButton (*ozwvid);
105103 }
106104 }
107-
105+
108106 // ===================================================================
109107 NAN_METHOD (OZW::ReleaseButton)
110108 // ===================================================================
111109 {
112110 Nan::HandleScope scope;
113111 OpenZWave::ValueID* ozwvid = populateValueId (info);
114- if (ozwvid == NULL ) {
115- Nan::ThrowTypeError (" OpenZWave valueId not found" );
116- } else {
112+ if (ozwvid) {
117113 OpenZWave::Manager::Get ()->ReleaseButton (*ozwvid);
118114 }
119115 }
Original file line number Diff line number Diff line change @@ -111,9 +111,7 @@ namespace OZW {
111111 Nan::HandleScope scope;
112112 CheckMinArgs (1 , " valueId" );
113113 OpenZWave::ValueID* ozwvid = populateValueId (info);
114- if (ozwvid == NULL ) {
115- Nan::ThrowTypeError (" OpenZWave valueId not found" );
116- } else {
114+ if (ozwvid) {
117115 bool b = OpenZWave::Manager::Get ()->isPolled (*ozwvid);
118116 info.GetReturnValue ().Set (Nan::New<Boolean>(b));
119117 }
@@ -127,9 +125,7 @@ namespace OZW {
127125 CheckMinArgs (1 , " valueId" );
128126 OpenZWave::ValueID* ozwvid = populateValueId (info);
129127 uint8 intensity;
130- if (ozwvid == NULL ) {
131- Nan::ThrowTypeError (" OpenZWave valueId not found" );
132- } else {
128+ if (ozwvid) {
133129 uint8 intensity_index = ( info[0 ]->IsObject () ) ? 1 : 4 ;
134130 intensity = info[intensity_index]->ToNumber ()->Value ();
135131 OpenZWave::Manager::Get ()->SetPollIntensity (*ozwvid, intensity);
@@ -144,9 +140,7 @@ namespace OZW {
144140 Nan::HandleScope scope;
145141 CheckMinArgs (1 , " valueId" );
146142 OpenZWave::ValueID* ozwvid = populateValueId (info);
147- if (ozwvid == NULL ) {
148- Nan::ThrowTypeError (" OpenZWave valueId not found" );
149- } else {
143+ if (ozwvid) {
150144 uint8 i = OpenZWave::Manager::Get ()->GetPollIntensity (*ozwvid);
151145 info.GetReturnValue ().Set (Nan::New<Integer>(i));
152146 }
Original file line number Diff line number Diff line change @@ -120,9 +120,7 @@ namespace OZW {
120120 CheckMinArgs (2 , " sceneid, value" );
121121 uint8 sceneid = info[0 ]->ToNumber ()->Value ();
122122 OpenZWave::ValueID* vit = populateValueId (info, 1 );
123- if (vit == NULL ) {
124- Nan::ThrowTypeError (" OpenZWave valueId not found" );
125- } else {
123+ if (vit) {
126124 uint8 valoffset = ( info[1 ]->IsObject () ) ? 2 : 5 ;
127125 switch ((*vit).GetType ()) {
128126 case OpenZWave::ValueID::ValueType_Bool: {
@@ -190,9 +188,7 @@ namespace OZW {
190188 SceneInfo *scene;
191189 if ((scene = get_scene_info (sceneid))) {
192190 OpenZWave::ValueID* vit = populateValueId (info, 1 );
193- if (vit == NULL ) {
194- Nan::ThrowTypeError (" OpenZWave valueId not found" );
195- } else {
191+ if (vit) {
196192 OpenZWave::Manager::Get ()->RemoveSceneValue (sceneid, *vit);
197193 scene->values .remove (*vit);
198194 }
You can’t perform that action at this time.
0 commit comments