public CpDeviceRecognisedLinn(CpDevice aDevice, RecogniserHandler aRecognised) : base(aDevice) { try { iLock = new object(); iRecognised = aRecognised; iInAppConfig = false; iPresentationUri = string.Empty; iProductService = new CpProxyAvOpenhomeOrgProduct1(aDevice); iProductService.SetPropertyInitialEvent(InitialEvent); iProductService.SetPropertyProductRoomChanged(ProductRoomChanged); iProductService.SetPropertyProductNameChanged(ProductNameChanged); iProductService.SetPropertyModelNameChanged(ModelNameChanged); iProductService.SetPropertyProductImageUriChanged(ProductImageUriChanged); iProductService.SetPropertyAttributesChanged(ProductAttributesChanged); iProductService.Subscribe(); } catch { aDevice.RemoveRef(); throw; } }
public CpDeviceDiagnostics(CpDevice aDevice, DiagnosticsHandler aHandler) { try { iDevice = aDevice; aDevice.AddRef(); iHandler = aHandler; iLock = new object(); iResponses = 0; iDiagnosticsService = new CpProxyLinnCoUkDiagnostics1(aDevice); iDiagnosticsService.BeginCrashDataStatus(HandleCrashDataStatus); iDiagnosticsService.BeginElfFingerprint(HandleElfFingerprint); // remove checking of RS232 connections //iDiagnosticsService.BeginDiagnosticTest("help", string.Empty, HandleHelp); iProductService = new CpProxyAvOpenhomeOrgProduct1(aDevice); iProductService.SetPropertyInitialEvent(InitialEvent); iProductService.SetPropertyProductRoomChanged(ProductRoomChanged); iProductService.SetPropertyProductNameChanged(ProductNameChanged); iProductService.SetPropertyProductImageUriChanged(ProductImageUriChanged); iProductService.SetPropertyModelNameChanged(ModelNameChanged); iProductService.Subscribe(); } catch { aDevice.RemoveRef(); throw; } }
public CpDeviceFallback(CpDevice aDevice, DeviceVolkanoHandler aHandler) : base(aDevice, aHandler) { try { OnSubscribed(); } catch { aDevice.RemoveRef(); } }
public CpDeviceMain(CpDevice aDevice, DeviceVolkanoHandler aHandler) : base(aDevice, aHandler) { try { iLock = new object(); iProductService = new CpProxyAvOpenhomeOrgProduct1(aDevice); iProductService.SetPropertyInitialEvent(InitialEvent); iProductService.SetPropertyProductRoomChanged(ProductRoomChanged); iProductService.SetPropertyProductNameChanged(ProductNameChanged); iProductService.SetPropertyProductImageUriChanged(ProductImageUriChanged); iProductService.Subscribe(); } catch { aDevice.RemoveRef(); } }
public CpDeviceVolkano(CpDevice aDevice, DeviceVolkanoHandler aHandler) { try { iHandler = aHandler; iDevice = aDevice; iDevice.AddRef(); iLock = new object(); iVolkanoService = new CpProxyLinnCoUkVolkano1(iDevice); iModel = "Unknown"; string xml; if (iDevice.GetAttribute("Upnp.DeviceXml", out xml)) { XmlNameTable table = new NameTable(); XmlNamespaceManager manager = new XmlNamespaceManager(table); manager.AddNamespace("ns", "urn:schemas-upnp-org:device-1-0"); XmlDocument doc = new XmlDocument(manager.NameTable); doc.LoadXml(xml); XmlNode node = doc.SelectSingleNode("/ns:root/ns:device/ns:modelName", manager); if (node != null && node.FirstChild != null) { iModel = node.FirstChild.InnerText; if (iModel.StartsWith("Reprogram-")) { string[] split = iModel.Split(new char[] { '-' }, 2); if (split.Length == 2) { iModel = split[1]; } } } } iVolkanoService.SyncMacAddress(out iMacAddress); iVolkanoService.SyncSoftwareVersion(out iSoftwareVersion); iVolkanoService.SyncProductId(out iProductNumber); iPcbNumberList = new List <string>(); uint count; iVolkanoService.SyncMaxBoards(out count); for (uint i = 0; i < count; ++i) { string number; iVolkanoService.SyncBoardType(i, out number); iPcbNumberList.Add(Convert.ToUInt32(number.Substring(0, 8), 16).ToString()); } } catch { aDevice.RemoveRef(); throw; } }
public CpDeviceRecognisedSonos(CpDevice aDevice, RecogniserHandler aRecognised) : base(aDevice) { try { iRecognised = aRecognised; string xml; if (aDevice.GetAttribute("Upnp.DeviceXml", out xml)) { XmlNameTable table = new NameTable(); XmlNamespaceManager manager = new XmlNamespaceManager(table); manager.AddNamespace("ns", "urn:schemas-upnp-org:device-1-0"); XmlDocument doc = new XmlDocument(manager.NameTable); try { doc.LoadXml(xml); } catch (Exception ex) { UserLog.WriteLine("CpDeviceRecognisedSonos. Exception caught recognising device xml: " + ex); UserLog.WriteLine(xml); throw; } string baseUri = string.Empty; XmlNode node = doc.SelectSingleNode("/ns:root/ns:URLBase", manager); if (node == null) { string location; if (aDevice.GetAttribute("Upnp.Location", out location)) { Uri uri = new Uri(location); baseUri = string.Format("{0}://{1}", uri.Scheme, uri.Authority); } } else if (node.FirstChild != null) { baseUri = node.FirstChild.InnerText; } XmlNodeList nodes = doc.SelectNodes("/ns:root/ns:device/ns:iconList/ns:icon", manager); int width = 0; int height = 0; foreach (XmlNode n in nodes) { bool found = false; XmlNode w = n.SelectSingleNode("ns:width", manager); XmlNode h = n.SelectSingleNode("ns:height", manager); XmlNode u = n.SelectSingleNode("ns:url", manager); if (w != null && w.FirstChild != null) { try { int i = int.Parse(w.FirstChild.InnerText); if (i > width) { width = i; height = i; found = true; } } catch (FormatException) { } } if (h != null && h.FirstChild != null) { try { int i = int.Parse(h.FirstChild.InnerText); if (i > height) { width = i; height = i; found = true; } } catch (FormatException) { } } if (found && u != null && u.FirstChild != null) { iProductImageUri = baseUri; iProductImageUri += u.FirstChild.InnerText; } } } string name; if (Device.GetAttribute("Upnp.FriendlyName", out name)) { iZoneName = name; } else { iZoneName = string.Empty; } iRecognised(this); } catch { aDevice.RemoveRef(); throw; } }