@@ -90,10 +90,18 @@ void ozw_watcher_callback(OpenZWave::Notification const *cb, void *ctx)
90
90
case OpenZWave::Notification::Type_ControllerCommand:
91
91
notif->event = cb->GetEvent ();
92
92
notif->notification = cb->GetNotification ();
93
+ #if OPENZWAVE_16
94
+ notif->command = cb->GetCommand ();
95
+ #endif
96
+ break ;
97
+ #endif
98
+ #if OPENZWAVE_16
99
+ case OpenZWave::Notification::Type_UserAlerts:
100
+ notif->notification = cb->GetUserAlertType ();
93
101
break ;
94
102
#endif
95
103
}
96
-
104
+ // push the notification to the queue
97
105
{
98
106
mutex::scoped_lock sl (zqueue_mutex);
99
107
zqueue.push (notif);
@@ -146,6 +154,7 @@ void handleControllerCommand(NotifInfo *notif)
146
154
// ##### END OF LEGACY MODE ###### //
147
155
#endif
148
156
157
+
149
158
/*
150
159
* handle normal OpenZWave notifications
151
160
*/
@@ -252,10 +261,7 @@ void handleNotification(NotifInfo *notif)
252
261
// #################
253
262
case OpenZWave::Notification::Type_NodeRemoved: {
254
263
// #################
255
- {
256
- mutex::scoped_lock sl (znodes_mutex);
257
- znodes.erase (notif->nodeid );
258
- }
264
+ delete_node (notif->nodeid );
259
265
emitinfo[0 ] = Nan::New<String>(" node removed" ).ToLocalChecked ();
260
266
emitinfo[1 ] = Nan::New<Integer>(notif->nodeid );
261
267
emit_cb->Call (Nan::New (ctx_obj), 2 , emitinfo, resource);
@@ -420,38 +426,74 @@ void handleNotification(NotifInfo *notif)
420
426
emit_cb->Call (Nan::New (ctx_obj), 4 , emitinfo, resource);
421
427
break ;
422
428
}
423
- case OpenZWave::Notification::Type_DriverRemoved:
424
- case OpenZWave::Notification::Type_Group:
429
+ // ##################
430
+ case OpenZWave::Notification::Type_DriverRemoved: {
431
+ // ##################
432
+ emitinfo[0 ] = Nan::New<String>(" driver removed" ).ToLocalChecked ();
433
+ emit_cb->Call (Nan::New (ctx_obj), 1 , emitinfo, resource);
434
+ break ;
435
+ }
436
+ // ###########
437
+ case OpenZWave::Notification::Type_Group: {
438
+ // ###########
425
439
/* The associations for the node have changed. The
426
440
* application should rebuild any group information it
427
441
* holds about the node.
428
442
*/
429
- // todo
443
+ emitinfo[0 ] = Nan::New<String>(" group" ).ToLocalChecked ();
444
+ emit_cb->Call (Nan::New (ctx_obj), 1 , emitinfo, resource);
430
445
break ;
431
- #if OPENZWAVE_SECURITY == 1
432
- case OpenZWave::Notification::Type_ControllerCommand:
446
+ }
447
+ #if OPENZWAVE_16
448
+ // ##############
449
+ case OpenZWave::Notification::Type_NodeReset: {
450
+ // ##############
451
+ delete_node (notif->nodeid );
452
+ emitinfo[0 ] = Nan::New<String>(" node reset" ).ToLocalChecked ();
453
+ emitinfo[1 ] = Nan::New<Integer>(notif->nodeid );
454
+ emit_cb->Call (Nan::New (ctx_obj), 2 , emitinfo, resource);
455
+ break ;
456
+ }
457
+ // ##############
458
+ case OpenZWave::Notification::Type_UserAlerts: {
459
+ // ##############
460
+ emitinfo[0 ] = Nan::New<String>(" user alert" ).ToLocalChecked ();
461
+ emitinfo[1 ] = Nan::New<Integer>(notif->notification );
462
+ emitinfo[2 ] = Nan::New<String>(notif->help .c_str ()).ToLocalChecked ();
463
+ emit_cb->Call (Nan::New (ctx_obj), 3 , emitinfo, resource);
464
+ break ;
465
+ }
466
+ // ################################
467
+ case OpenZWave::Notification::Type_ManufacturerSpecificDBReady: {
468
+ // ################################
469
+ emitinfo[0 ] = Nan::New<String>(" manufacturer specific DB ready" ).ToLocalChecked ();
470
+ emit_cb->Call (Nan::New (ctx_obj), 1 , emitinfo, resource);
471
+ break ;
472
+ }
473
+ #endif
474
+
475
+ #if OPENZWAVE_SECURITY
476
+ case OpenZWave::Notification::Type_ControllerCommand: {
433
477
emitinfo[0 ] = Nan::New<String>(" controller command" ).ToLocalChecked ();
434
478
emitinfo[1 ] = Nan::New<Integer>(notif->nodeid );
435
479
emitinfo[2 ] = Nan::New<Integer>(notif->event ); // Driver::ControllerCommand
436
480
emitinfo[3 ] =
437
481
Nan::New<Integer>(notif->notification ); // Driver::ControllerState
438
482
emitinfo[4 ] = Nan::New<String>(notif->help .c_str ()).ToLocalChecked ();
483
+ #if OPENZWAVE_16
484
+ emitinfo[5 ] = Nan::New<Integer>(notif->command );
485
+ emit_cb->Call (Nan::New (ctx_obj), 6 , emitinfo, resource);
486
+ #else
439
487
emit_cb->Call (Nan::New (ctx_obj), 5 , emitinfo, resource);
488
+ #endif
440
489
break ;
441
- case OpenZWave::Notification::Type_NodeReset:
442
- emitinfo[0 ] = Nan::New<String>(" node reset" ).ToLocalChecked ();
443
- emitinfo[1 ] = Nan::New<Integer>(notif->nodeid );
444
- emitinfo[2 ] = Nan::New<Integer>(notif->event ); // Driver::ControllerCommand
445
- emitinfo[3 ] =
446
- Nan::New<Integer>(notif->notification ); // Driver::ControllerState
447
- emit_cb->Call (Nan::New (ctx_obj), 4 , emitinfo, resource);
448
- break ;
490
+ }
449
491
#endif
450
492
default :
451
493
fprintf (stderr, " Unhandled OpenZWave notification: %d\n " , notif->type );
452
- break ;
453
- } // end switch
454
- }
494
+ break ;
495
+ } // end switch
496
+ } // end handleNotification
455
497
456
498
/*
457
499
* Async handler, triggered by the OpenZWave callback.
0 commit comments