예제 #1
0
        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;
            }
        }
예제 #2
0
 private void DeviceAdded(CpDeviceList aList, CpDevice aDevice)
 {
     lock (this)
     {
         if (iDeviceList.Count == 0 && aDevice.Udn() == DeviceBasic.gDeviceName)
         {
             aDevice.AddRef();
             iDeviceList.Add(aDevice);
         }
     }
 }
예제 #3
0
        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;
            }
        }
예제 #4
0
 public CpDeviceRecognised(CpDevice aDevice)
 {
     iDevice = aDevice;
     iDevice.AddRef();
 }