コード例 #1
0
ファイル: LGTVSetup.cs プロジェクト: yartat/Auto3D
        public void ServiceAdded(UPnPService service)
        {
            comboBoxTV.Items.Add(service);

              foreach (UPnPService item in comboBoxTV.Items)
              {
            if (item.ParentDevice.UDN == _device.UDN)
            {
              Log.Info("Auto3D: LG service selected -> " + service.ParentDevice.UDN);
              comboBoxTV.SelectedItem = item;
              break;
            }
              }

              if (comboBoxTV.SelectedIndex == -1)
              {
            Log.Info("Auto3D: LG service selected as default -> " + service.ParentDevice.UDN);
            comboBoxTV.SelectedItem = service;
              }

              listBoxCompatibleModels.Items.Clear();

              foreach (String model in _device.SelectedDeviceModel.CompatibleModels)
              {
            listBoxCompatibleModels.Items.Add(" " + model);
              }
        }
コード例 #2
0
 static void LogService(UPnPService service, bool known, bool add)
 {
     Log.Debug("Auto3D: UPnP scan -> " + (known ? "known" : "unknown") + " service " + (add ? "added" : "removed"));
     Log.Debug("Auto3D: Device = " + service.ParentDevice.FriendlyName);
     Log.Debug("Auto3D: ServiceType = " + service.ServiceType);
     Log.Debug("Auto3D: ServiceID = " + service.ServiceID);
     Log.Debug("Auto3D: ControlUrl = " + service.ControlUrl);
 }
コード例 #3
0
ファイル: PanasonicTVSetup.cs プロジェクト: yartat/Auto3D
        public void ServiceAdded(UPnPService service)
        {
            this.Invoke((System.Windows.Forms.MethodInvoker)delegate
            {
            comboBoxTV.Items.Add(service);

            foreach (UPnPService item in comboBoxTV.Items)
            {
                if (item.ParentDevice.UDN == _device.UDN)
                {
                    comboBoxTV.SelectedItem = item;
                    break;
                }
            }

            if (comboBoxTV.SelectedIndex == -1)
                comboBoxTV.SelectedItem = service;
            });
        }
コード例 #4
0
ファイル: UPnPDevice.cs プロジェクト: yartat/Auto3D
        public UPnPDevice(Uri webAddr, XNamespace ns, XElement device)
        {
            Confirmed = true;
              Services = new List<UPnPService>();
              WebAddress = webAddr;
              DeviceXML = device;

              DeviceType = device.Elements().First(e => e.Name.LocalName == "deviceType").Value;
              FriendlyName = device.Elements().First(e => e.Name.LocalName == "friendlyName").Value;
              Manufacturer = device.Elements().First(e => e.Name.LocalName == "manufacturer").Value;
              ModelName = device.Elements().First(e => e.Name.LocalName == "modelName").Value;
              UDN = device.Elements().First(e => e.Name.LocalName == "UDN").Value;

              XElement serviceList = device.Descendants(ns + "serviceList").First();
              List<XElement> services = serviceList.Descendants(ns + "service").ToList();

              foreach (XElement service in services)
              {
            UPnPService upnpService = new UPnPService(this, ns, service);
            Services.Add(upnpService);
              }
        }
コード例 #5
0
ファイル: UPnPDevice.cs プロジェクト: caomw/Auto3D
    public UPnPDevice(Uri webAddr, XNamespace ns, XElement device)
    {
      Confirmed = true;
      Services = new List<UPnPService>();
      WebAddress = webAddr;
      DeviceXML = device;

      DeviceType = device.Elements().First(e => e.Name.LocalName == "deviceType").Value;
      FriendlyName = device.Elements().First(e => e.Name.LocalName == "friendlyName").Value;
      Manufacturer = device.Elements().First(e => e.Name.LocalName == "manufacturer").Value;
      ModelName = device.Elements().First(e => e.Name.LocalName == "modelName").Value;
      UDN = device.Elements().First(e => e.Name.LocalName == "UDN").Value;

      XElement serviceList = device.Descendants(ns + "serviceList").First();
      List<XElement> services = serviceList.Descendants(ns + "service").ToList();

      foreach (XElement service in services)
      {
        UPnPService upnpService = new UPnPService(this, ns, service);
        Services.Add(upnpService);
      }     
    }
コード例 #6
0
ファイル: SonyTVSetup.cs プロジェクト: yartat/Auto3D
        public void ServiceAdded(UPnPService service)
        {
            comboBoxTV.Items.Add(service);

              foreach (UPnPService item in comboBoxTV.Items)
              {
            if (item.ParentDevice.UDN == _device.UDN)
            {
              comboBoxTV.SelectedItem = item;
              break;
            }
              }

              if (comboBoxTV.SelectedIndex == -1)
            comboBoxTV.SelectedItem = service;

              listBoxCompatibleModels.Items.Clear();

              foreach (String model in _device.SelectedDeviceModel.CompatibleModels)
              {
            listBoxCompatibleModels.Items.Add(" " + model);
              }
        }
コード例 #7
0
 public ServiceEventArgs(UPnPService service)
 {
     Service = service;
 }
コード例 #8
0
ファイル: PanasonicTV.cs プロジェクト: yartat/Auto3D
 public override void ServiceRemoved(UPnPService service)
 {
     Log.Info("Auto3D: Panasonic service removed");
       base.ServiceRemoved(service);
 }
コード例 #9
0
ファイル: PanasonicTV.cs プロジェクト: yartat/Auto3D
        public override void ServiceAdded(UPnPService service)
        {
            base.ServiceAdded(service);

              Log.Info("Auto3D: Panasonic service found -> " + service.ParentDevice.Manufacturer + ", " + service.ParentDevice.WebAddress.Host);

              if (service.ParentDevice.UDN == UDN)
              {
              MAC = Auto3DHelpers.RequestMACAddress(service.ParentDevice.WebAddress.Host);
              Log.Info("Auto3D: Panasonic service connected");
              }
        }
コード例 #10
0
ファイル: Auto3DUPnP.cs プロジェクト: yartat/Auto3D
 static void LogService(UPnPService service, bool known, bool add)
 {
     Log.Debug("Auto3D: UPnP scan -> " + (known ? "known" : "unknown") + " service " + (add ? "added" : "removed"));
     Log.Debug("Auto3D: Device = " + service.ParentDevice.FriendlyName);
     Log.Debug("Auto3D: ServiceType = " + service.ServiceType);
     Log.Debug("Auto3D: ServiceID = " + service.ServiceID);
     Log.Debug("Auto3D: ControlUrl = " + service.ControlUrl);
 }
コード例 #11
0
ファイル: LGTV.cs プロジェクト: yartat/Auto3D
 public override void ServiceRemoved(UPnPService service)
 {
     Log.Info("Auto3D: LG service removed");
       WebOS.Close();
       base.ServiceRemoved(service);
 }
コード例 #12
0
ファイル: LGTV.cs プロジェクト: yartat/Auto3D
        public override void ServiceAdded(UPnPService service)
        {
            Log.Info("Auto3D: LG service found -> " + service.ParentDevice.Manufacturer + ", " + service.ParentDevice.WebAddress.Host + ", " + service.ParentDevice.UDN + ", " + UDAPnP.Protocol);

              base.ServiceAdded(service);

              if (!ConnectAndPair())
            return;

              if (service.ParentDevice.UDN == UDN)
              {
            MAC = Auto3DHelpers.RequestMACAddress(service.ParentDevice.WebAddress.Host);
            Log.Info("Auto3D: LG service connected!");
              }
        }
コード例 #13
0
ファイル: Auto3DUPnPBaseDevice.cs プロジェクト: yartat/Auto3D
 public virtual void ServiceAdded(UPnPService service)
 {
     _uPnPService = service;
       ((IAuto3DUPnPSetup)GetSetupControl()).ServiceAdded(service);
 }
コード例 #14
0
ファイル: SonyDevice.cs プロジェクト: yartat/Auto3D
        /// <summary>
        /// Initializes a NEW Sony Device object with settings from a device retrieved from sonyDiscover(device).
        /// </summary>
        /// <param name="device">A Sony Device object selected from the list obtained with sonyDiscover(device) method.</param>
        public void initialize(UPnPService service)
        {
            Name = service.ParentDevice.FriendlyName;
            DeviceIPAddress = service.ParentDevice.WebAddress.Host;

            if (actionListURL == null)
            {
                getActionlist_URL(service);
            }

            Generation = Convert.ToInt32(getRegistrationMode());

            if (DevicePort == 0)
            {
                if (Generation <= 2)
                {
                    string devIP = actionListURL;
                    devIP = devIP.Replace("http://", "");
                    string s1 = ":";
                    int endIP = devIP.IndexOf(s1);
                    string port = devIP.Substring(endIP + 1);
                    devIP = devIP.Substring(0, endIP);
                    s1 = "/";
                    int endPort = port.IndexOf(s1);
                    port = port.Substring(0, endPort);
                    DevicePort = Convert.ToInt32(port);
                }
                else
                {
                    DevicePort = 80;
                }
            }

            Log.Debug("Auto3D: Initializing Device: " + Name + " @ " + DeviceIPAddress + ":" + DevicePort.ToString());

            if (ServerName == null)
            {
                ServerName = SystemInformation.ComputerName + "(SonyAPILib)";
            }

            ircc = service;

            ServerMacAddress = getControlMac();

            if (Generation == 3)
            {
                DeviceMacAddress = findDevMac().ToString();
            }

            checkReg();
            Log.Debug("Auto3D: Device Initialized: " + Name);
        }
コード例 #15
0
ファイル: SonyTV.cs プロジェクト: yartat/Auto3D
        public override void ServiceAdded(UPnPService service)
        {
            base.ServiceAdded(service);

              Log.Info("Auto3D: Sony service found -> " + service.ParentDevice.Manufacturer + ", " + service.ParentDevice.WebAddress.Host);

              if (service.ParentDevice.UDN == UDN)
              {
            MAC = Auto3DHelpers.RequestMACAddress(service.ParentDevice.WebAddress.Host);
            Log.Info("Auto3D: Sony service connected");
              }

              try
              {
              sonyDevice.initialize(service);
              }
              catch (Exception ex)
              {
              Log.Error("Auto3D: Initialize failed: " + ex.Message);
              }

              // show on GUI that device is not registered!)

              if (!sonyDevice.Registered)
              {
            Log.Error("Auto3D: Device " + service.ParentDevice.FriendlyName + " is not registered");
              }
              else
              {
             String CmdList = sonyDevice.get_remote_command_list();
             Log.Debug("Auto3D: Device " + service.ParentDevice.FriendlyName + " CmdList = " + CmdList);
              }

              ((SonyTVSetup)GetSetupControl()).SetRegisterButtonState(!sonyDevice.Registered);
        }
コード例 #16
0
ファイル: SonyTVSetup.cs プロジェクト: yartat/Auto3D
        public void ServiceRemoved(UPnPService service)
        {
            for (int i = 0; i < comboBoxTV.Items.Count; i++)
              {
            UPnPService srv = (UPnPService)comboBoxTV.Items[i];

            if (srv.ParentDevice.WebAddress.Host == service.ParentDevice.WebAddress.Host)
            {
              comboBoxTV.Items.RemoveAt(i);
              break;
            }
              }
        }
コード例 #17
0
ファイル: Auto3DUPnPBaseDevice.cs プロジェクト: yartat/Auto3D
 public virtual void ServiceRemoved(UPnPService service)
 {
     ((IAuto3DUPnPSetup)GetSetupControl()).ServiceRemoved(service);
       _uPnPService = null;
 }
コード例 #18
0
ファイル: SonyDevice.cs プロジェクト: yartat/Auto3D
        /// <summary>
        /// This method sets the Action List URL found in the DLNA Device Action List XML.
        /// </summary>
        /// <param name="devName">This is the Name of the Device to get the infromation for</param>
        /// 
        private void getActionlist_URL(UPnPService service)
        {
            Log.Debug("Auto3D: Retrieving Action List URL from device description file: " + service.ParentDevice.FriendlyName);

            try
            {
                XElement xDeviceInfo = service.ParentDevice.DeviceXML.Elements().First(e => e.Name.LocalName == "X_UNR_DeviceInfo");

                if (xDeviceInfo != null)
                {
                    XElement xActionList = xDeviceInfo.Elements().First(e => e.Name.LocalName == "X_CERS_ActionList_URL");

                    if (xActionList != null)
                    {
                        actionListURL = xActionList.Value;
                        Log.Debug("Auto3D: Action List URL found for device: " + service.ParentDevice.FriendlyName);
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error("Auto3D: " + ex.Message);
            }

            Log.Error("Auto3D: Action List URL was NOT found for device: " + service.ParentDevice.FriendlyName);
            actionListURL = "";
        }
コード例 #19
0
ファイル: ServiceEventArgs.cs プロジェクト: yartat/Auto3D
 public ServiceEventArgs(UPnPService service)
 {
     Service = service;
 }