@@ -90,10 +90,18 @@ void ozw_watcher_callback(OpenZWave::Notification const *cb, void *ctx)
9090 case OpenZWave::Notification::Type_ControllerCommand:
9191 notif->event = cb->GetEvent ();
9292 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 ();
93101 break ;
94102#endif
95103 }
96-
104+ // push the notification to the queue
97105 {
98106 mutex::scoped_lock sl (zqueue_mutex);
99107 zqueue.push (notif);
@@ -146,6 +154,7 @@ void handleControllerCommand(NotifInfo *notif)
146154// ##### END OF LEGACY MODE ###### //
147155#endif
148156
157+
149158/*
150159 * handle normal OpenZWave notifications
151160 */
@@ -252,10 +261,7 @@ void handleNotification(NotifInfo *notif)
252261 // #################
253262 case OpenZWave::Notification::Type_NodeRemoved: {
254263 // #################
255- {
256- mutex::scoped_lock sl (znodes_mutex);
257- znodes.erase (notif->nodeid );
258- }
264+ delete_node (notif->nodeid );
259265 emitinfo[0 ] = Nan::New<String>(" node removed" ).ToLocalChecked ();
260266 emitinfo[1 ] = Nan::New<Integer>(notif->nodeid );
261267 emit_cb->Call (Nan::New (ctx_obj), 2 , emitinfo, resource);
@@ -420,38 +426,74 @@ void handleNotification(NotifInfo *notif)
420426 emit_cb->Call (Nan::New (ctx_obj), 4 , emitinfo, resource);
421427 break ;
422428 }
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+ // ###########
425439 /* The associations for the node have changed. The
426440 * application should rebuild any group information it
427441 * holds about the node.
428442 */
429- // todo
443+ emitinfo[0 ] = Nan::New<String>(" group" ).ToLocalChecked ();
444+ emit_cb->Call (Nan::New (ctx_obj), 1 , emitinfo, resource);
430445 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: {
433477 emitinfo[0 ] = Nan::New<String>(" controller command" ).ToLocalChecked ();
434478 emitinfo[1 ] = Nan::New<Integer>(notif->nodeid );
435479 emitinfo[2 ] = Nan::New<Integer>(notif->event ); // Driver::ControllerCommand
436480 emitinfo[3 ] =
437481 Nan::New<Integer>(notif->notification ); // Driver::ControllerState
438482 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
439487 emit_cb->Call (Nan::New (ctx_obj), 5 , emitinfo, resource);
488+ #endif
440489 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+ }
449491#endif
450492 default :
451493 fprintf (stderr, " Unhandled OpenZWave notification: %d\n " , notif->type );
452- break ;
453- } // end switch
454- }
494+ break ;
495+ } // end switch
496+ } // end handleNotification
455497
456498/*
457499* Async handler, triggered by the OpenZWave callback.
0 commit comments