Esempio n. 1
0
        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);
              }
        }
Esempio n. 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);
 }
Esempio n. 3
0
        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;
            });
        }
Esempio n. 4
0
        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);
              }
        }
Esempio n. 5
0
    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);
      }     
    }
Esempio n. 6
0
        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);
              }
        }
Esempio n. 7
0
 public ServiceEventArgs(UPnPService service)
 {
     Service = service;
 }
Esempio n. 8
0
 public override void ServiceRemoved(UPnPService service)
 {
     Log.Info("Auto3D: Panasonic service removed");
       base.ServiceRemoved(service);
 }
Esempio n. 9
0
        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");
              }
        }
Esempio n. 10
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);
 }
Esempio n. 11
0
 public override void ServiceRemoved(UPnPService service)
 {
     Log.Info("Auto3D: LG service removed");
       WebOS.Close();
       base.ServiceRemoved(service);
 }
Esempio n. 12
0
        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!");
              }
        }
Esempio n. 13
0
 public virtual void ServiceAdded(UPnPService service)
 {
     _uPnPService = service;
       ((IAuto3DUPnPSetup)GetSetupControl()).ServiceAdded(service);
 }
Esempio n. 14
0
        /// <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);
        }
Esempio n. 15
0
        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);
        }
Esempio n. 16
0
        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;
            }
              }
        }
Esempio n. 17
0
 public virtual void ServiceRemoved(UPnPService service)
 {
     ((IAuto3DUPnPSetup)GetSetupControl()).ServiceRemoved(service);
       _uPnPService = null;
 }
Esempio n. 18
0
        /// <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 = "";
        }
Esempio n. 19
0
 public ServiceEventArgs(UPnPService service)
 {
     Service = service;
 }