public bool Connect() { if (_contropoint == null) { _contropoint = new UpnpSmartControlPoint(); _contropoint.OnAddedDevice += _contropoint_OnAddedDevice; _isconnected = true; } return(true); }
private void controPoint_OnAddedDevice(UpnpSmartControlPoint sender, UPnPDevice device) { if (String.IsNullOrWhiteSpace(device.StandardDeviceType)) { return; } //foreach (UPnPService s in device.Services) //{ // s.Subscribe(1000, new UPnPService.UPnPEventSubscribeHandler(_subscribe_sink)); //} lock (deviceOperationLock) { InterfaceModule module = new InterfaceModule(); module.Domain = this.Domain; module.Address = device.UniqueDeviceName; module.Description = device.FriendlyName + " (" + device.ModelName + ")"; if (device.StandardDeviceType == "MediaRenderer") { module.ModuleType = MIG.ModuleTypes.MediaReceiver; } else if (device.StandardDeviceType == "MediaServer") { module.ModuleType = MIG.ModuleTypes.MediaTransmitter; } else if (device.StandardDeviceType == "SwitchPower") { module.ModuleType = MIG.ModuleTypes.Switch; } else if (device.StandardDeviceType == "BinaryLight") { module.ModuleType = MIG.ModuleTypes.Light; } else if (device.StandardDeviceType == "DimmableLight") { module.ModuleType = MIG.ModuleTypes.Dimmer; } else { module.ModuleType = MIG.ModuleTypes.Sensor; } module.CustomData = new DeviceHolder() { Device = device, Initialized = false }; modules.Add(module); // OnInterfacePropertyChanged(this.GetDomain(), "1", "DLNA/UPnP Controller", "Controller.Status", "Added node " + module.Description); } OnInterfaceModulesChanged(this.GetDomain()); }
private void controPoint_OnDeviceExpired(UpnpSmartControlPoint sender, UPnPDevice device) { lock (deviceOperationLock) { var module = modules.Find(m => m.Address == device.UniqueDeviceName); if (module != null) { OnInterfacePropertyChanged(this.GetDomain(), "1", "DLNA/UPnP Controller", "Controller.Status", "Removed node " + module.Description); modules.Remove(module); OnInterfaceModulesChanged(this.GetDomain()); } } }
public bool Connect() { if (controlPoint == null) { controlPoint = new UpnpSmartControlPoint(); controlPoint.OnAddedDevice += controPoint_OnAddedDevice; controlPoint.OnRemovedDevice += controPoint_OnRemovedDevice; controlPoint.OnDeviceExpired += controPoint_OnDeviceExpired; isConnected = true; } OnInterfaceModulesChanged(this.GetDomain()); return(true); }
private void _contropoint_OnAddedDevice(UpnpSmartControlPoint sender, UPnPDevice device) { if (InterfacePropertyChangedAction != null) { //foreach (UPnPService s in device.Services) //{ // s.Subscribe(1000, new UPnPService.UPnPEventSubscribeHandler(_subscribe_sink)); //} InterfacePropertyChangedAction(new InterfacePropertyChangedAction() { Domain = this.Domain, SourceId = device.UniqueDeviceName, SourceType = "UPnP " + device.FriendlyName, Path = "UPnP.DeviceType", Value = device.StandardDeviceType }); } }
public void Disconnect() { if (_localdevice != null) { _localdevice.StopDevice(); _localdevice = null; } if (_contropoint != null) { _contropoint.OnAddedDevice -= _contropoint_OnAddedDevice; _contropoint = null; } _isconnected = false; }
public void Disconnect() { /* * if (localDevice != null) * { * localDevice.StopDevice(); * localDevice = null; * } */ if (controlPoint != null) { controlPoint.OnAddedDevice -= controPoint_OnAddedDevice; controlPoint.OnRemovedDevice -= controPoint_OnRemovedDevice; controlPoint.OnDeviceExpired -= controPoint_OnDeviceExpired; controlPoint.ShutDown(); controlPoint = null; } isConnected = false; }
private void controPoint_OnRemovedDevice(UpnpSmartControlPoint sender, UPnPDevice device) { lock (deviceOperationLock) { var module = modules.Find(m => m.Address == device.UniqueDeviceName); if (module != null) { if (InterfacePropertyChangedAction != null) InterfacePropertyChangedAction(new InterfacePropertyChangedAction() { Domain = this.Domain, SourceId = "1", SourceType = "DLNA/UPnP Controller", Path = "Controller.Status", Value = "Removed node " + module.Description }); modules.Remove(module); if (InterfaceModulesChangedAction != null) InterfaceModulesChangedAction(new InterfaceModulesChangedAction() { Domain = this.Domain }); } } }
private void controPoint_OnAddedDevice(UpnpSmartControlPoint sender, UPnPDevice device) { if (String.IsNullOrWhiteSpace(device.StandardDeviceType)) return; //foreach (UPnPService s in device.Services) //{ // s.Subscribe(1000, new UPnPService.UPnPEventSubscribeHandler(_subscribe_sink)); //} lock (deviceOperationLock) { InterfaceModule module = new InterfaceModule(); module.Domain = this.Domain; module.Address = device.UniqueDeviceName; module.Description = device.FriendlyName + " (" + device.ModelName + ")"; if (device.StandardDeviceType == "MediaRenderer") { module.ModuleType = MIG.ModuleTypes.MediaReceiver; } else if (device.StandardDeviceType == "MediaServer") { module.ModuleType = MIG.ModuleTypes.MediaTransmitter; } else if (device.StandardDeviceType == "SwitchPower") { module.ModuleType = MIG.ModuleTypes.Switch; } else if (device.StandardDeviceType == "BinaryLight") { module.ModuleType = MIG.ModuleTypes.Light; } else if (device.StandardDeviceType == "DimmableLight") { module.ModuleType = MIG.ModuleTypes.Dimmer; } else { module.ModuleType = MIG.ModuleTypes.Sensor; } module.CustomData = new DeviceHolder() { Device = device, Initialized = false }; modules.Add(module); // if (InterfacePropertyChangedAction != null) InterfacePropertyChangedAction(new InterfacePropertyChangedAction() { Domain = this.Domain, SourceId = "1", SourceType = "DLNA/UPnP Controller", Path = "Controller.Status", Value = "Added node " + module.Description }); } if (InterfaceModulesChangedAction != null) InterfaceModulesChangedAction(new InterfaceModulesChangedAction() { Domain = this.Domain }); }
public void Disconnect() { /* if (localDevice != null) { localDevice.StopDevice(); localDevice = null; } */ if (controlPoint != null) { controlPoint.OnAddedDevice -= controPoint_OnAddedDevice; controlPoint.OnRemovedDevice -= controPoint_OnRemovedDevice; controlPoint.OnDeviceExpired -= controPoint_OnDeviceExpired; controlPoint.ShutDown(); controlPoint = null; } isConnected = false; }
public bool Connect() { if (controlPoint == null) { controlPoint = new UpnpSmartControlPoint(); controlPoint.OnAddedDevice += controPoint_OnAddedDevice; controlPoint.OnRemovedDevice += controPoint_OnRemovedDevice; controlPoint.OnDeviceExpired += controPoint_OnDeviceExpired; isConnected = true; } if (InterfaceModulesChangedAction != null) InterfaceModulesChangedAction(new InterfaceModulesChangedAction() { Domain = this.Domain }); return true; }
public bool Connect() { if (controPoint == null) { controPoint = new UpnpSmartControlPoint(); controPoint.OnAddedDevice += controPoint_OnAddedDevice; isConnected = true; } return true; }
private void controPoint_OnAddedDevice(UpnpSmartControlPoint sender, UPnPDevice device) { if (InterfacePropertyChangedAction != null) { //foreach (UPnPService s in device.Services) //{ // s.Subscribe(1000, new UPnPService.UPnPEventSubscribeHandler(_subscribe_sink)); //} InterfacePropertyChangedAction(new InterfacePropertyChangedAction() { Domain = this.Domain, SourceId = device.UniqueDeviceName, SourceType = "UPnP " + device.FriendlyName, Path = "UPnP.DeviceType", Value = device.StandardDeviceType }); } }
public void Disconnect() { if (localDevice != null) { localDevice.StopDevice(); localDevice = null; } if (controPoint != null) { controPoint.OnAddedDevice -= controPoint_OnAddedDevice; controPoint = null; } isConnected = false; }
private void controPoint_OnRemovedDevice(UpnpSmartControlPoint sender, UPnPDevice device) { lock (deviceOperationLock) { var module = modules.Find(m => m.Address == device.UniqueDeviceName); if (module != null) { OnInterfacePropertyChanged(this.GetDomain(), "1", "DLNA/UPnP Controller", "Controller.Status", "Removed node " + module.Description); modules.Remove(module); OnInterfaceModulesChanged(this.GetDomain()); } } }
public bool Connect() { if (controlPoint == null) { controlPoint = new UpnpSmartControlPoint(); controlPoint.OnAddedDevice += controPoint_OnAddedDevice; controlPoint.OnRemovedDevice += controPoint_OnRemovedDevice; controlPoint.OnDeviceExpired += controPoint_OnDeviceExpired; isConnected = true; } OnInterfaceModulesChanged(this.GetDomain()); return true; }