public void OnDiscoveryEvent(DiscoveryEventArgs e) { if (DiscoveryEvent != null) { DiscoveryEvent(this, e); } }
// fired either at startup time and after a new z-wave node has been added to the controller private void zwaveController_DiscoveryEvent(object source, DiscoveryEventArgs e) { switch (e.Status) { case DISCOVERY_STATUS.DISCOVERY_START: LogBroadcastEvent( Domains.HomeAutomation_ZWave, "1", "Z-Wave Controller", "Controller.Status", "Discovery Started" ); break; case DISCOVERY_STATUS.DISCOVERY_END: LogBroadcastEvent( Domains.HomeAutomation_ZWave, "1", "Z-Wave Controller", "Controller.Status", "Discovery Complete" ); modules_RefreshZwave(); modules_Sort(); break; case DISCOVERY_STATUS.NODE_ADDED: LogBroadcastEvent( Domains.HomeAutomation_ZWave, "1", "Z-Wave Controller", "Controller.Status", "Added node " + e.NodeId ); break; case DISCOVERY_STATUS.NODE_UPDATED: LogBroadcastEvent( Domains.HomeAutomation_ZWave, "1", "Z-Wave Controller", "Controller.Status", "Updated node " + e.NodeId ); break; case DISCOVERY_STATUS.NODE_REMOVED: LogBroadcastEvent( Domains.HomeAutomation_ZWave, "1", "Z-Wave Controller", "Controller.Status", "Removed node " + e.NodeId ); break; } }
/* class USBDeviceInfo { public USBDeviceInfo(string deviceID, string pnpDeviceID, string description) { this.DeviceID = deviceID; this.PnpDeviceID = pnpDeviceID; this.Description = description; } public string DeviceID { get; private set; } public string PnpDeviceID { get; private set; } public string Description { get; private set; } } */ private void DiscoveryEvent(object sender, DiscoveryEventArgs e) { //ZWaveNode node = _controller.GetDevice(e.NodeId); // if (e.Status == DISCOVERY_STATUS.NODE_REMOVED) { lastRemovedNode = e.NodeId; } else if (e.Status == DISCOVERY_STATUS.NODE_ADDED) { lastAddedNode = e.NodeId; } }
/* class USBDeviceInfo { public USBDeviceInfo(string deviceID, string pnpDeviceID, string description) { this.DeviceID = deviceID; this.PnpDeviceID = pnpDeviceID; this.Description = description; } public string DeviceID { get; private set; } public string PnpDeviceID { get; private set; } public string Description { get; private set; } } */ // fired either at startup time and after a new z-wave node has been added to the controller private void DiscoveryEvent(object sender, DiscoveryEventArgs e) { switch (e.Status) { case DISCOVERY_STATUS.DISCOVERY_START: RaisePropertyChanged(new InterfacePropertyChangedAction() { Domain = this.Domain, SourceId = "1", SourceType = "Z-Wave Controller", Path = "Controller.Status", Value = "Discovery Started" }); break; case DISCOVERY_STATUS.DISCOVERY_END: RaisePropertyChanged(new InterfacePropertyChangedAction() { Domain = this.Domain, SourceId = "1", SourceType = "Z-Wave Controller", Path = "Controller.Status", Value = "Discovery Complete" }); if (InterfaceModulesChangedAction != null) InterfaceModulesChangedAction(new InterfaceModulesChangedAction(){ Domain = this.Domain }); break; case DISCOVERY_STATUS.NODE_ADDED: RaisePropertyChanged(new InterfacePropertyChangedAction() { Domain = this.Domain, SourceId = "1", SourceType = "Z-Wave Controller", Path = "Controller.Status", Value = "Added node " + e.NodeId }); lastAddedNode = e.NodeId; if (InterfaceModulesChangedAction != null) InterfaceModulesChangedAction(new InterfaceModulesChangedAction(){ Domain = this.Domain }); break; case DISCOVERY_STATUS.NODE_UPDATED: RaisePropertyChanged(new InterfacePropertyChangedAction() { Domain = this.Domain, SourceId = "1", SourceType = "Z-Wave Controller", Path = "Controller.Status", Value = "Updated node " + e.NodeId }); //if (InterfaceModulesChangedAction != null) InterfaceModulesChangedAction(new InterfaceModulesChangedAction(){ Domain = this.Domain }); break; case DISCOVERY_STATUS.NODE_REMOVED: lastRemovedNode = e.NodeId; RaisePropertyChanged(new InterfacePropertyChangedAction() { Domain = this.Domain, SourceId = "1", SourceType = "Z-Wave Controller", Path = "Controller.Status", Value = "Removed node " + e.NodeId }); if (InterfaceModulesChangedAction != null) InterfaceModulesChangedAction(new InterfaceModulesChangedAction(){ Domain = this.Domain }); break; } }