public CpDeviceRecognised Recognise(CpDevice aDevice, RecogniserHandler 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("RecogniserMediaServer.  Exception caught recognising device xml: " + ex);
                    UserLog.WriteLine(xml);
                    return(null);
                }

                XmlNode n = doc.SelectSingleNode("/ns:root/ns:device/ns:deviceType", manager);
                if (n != null && n.FirstChild != null && n.FirstChild.InnerText == kDeviceType)
                {
                    UserLog.WriteLine(DateTime.Now + ": RecogniserMediaServer: Device+             Udn{" + aDevice.Udn() + "}");

                    return(new CpDeviceRecognisedMediaServer(aDevice, aRecognised));
                }
            }

            return(null);
        }
        private void Added(CpDeviceList aList, CpDevice aDevice)
        {
            UserLog.WriteLine(DateTime.Now + ": CpDeviceRecogniserList: Device+             Udn{" + aDevice.Udn() + "}");

            lock (iLock)
            {
                if (iDisposed)
                {
                    return;
                }

                foreach (IRecogniser r in iRecognisers)
                {
                    CpDeviceRecognised recognisedDevice = r.Recognise(aDevice, RecogniserAdded);
                    if (recognisedDevice != null)
                    {
                        // check to see if device has been added immediately
                        if (!iDeviceListRecognised.Contains(recognisedDevice))
                        {
                            iDeviceListPending.Add(recognisedDevice);
                        }

                        return;
                    }
                }
            }

            UserLog.WriteLine(DateTime.Now + ": CpDeviceRecogniserList: Device not recognised       Udn{" + aDevice.Udn() + "}");
        }
        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;
            }
        }
Exemple #4
0
        private void Added(CpDeviceList aList, CpDevice aDevice)
        {
            UserLog.WriteLine(DateTime.Now + ": CpDeviceDiagnosticsList: Device+             Udn{" + aDevice.Udn() + "}");

            string version;

            if (!aDevice.GetAttribute("Upnp.Service.av-openhome-org.Product", out version))
            {
                return;
            }

            CpDeviceDiagnostics device = new CpDeviceDiagnostics(aDevice, DiagnosticsAdded);

            lock (iLock)
            {
                if (iDisposed)
                {
                    return;
                }

                // check to see if device has been added immediately
                if (!iDeviceListDiagnostics.Contains(device))
                {
                    iDeviceListPending.Add(device);
                }
            }
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <remarks>Use CpProxy::[Un]Subscribe() to enable/disable querying of state variable and reporting of their changes.</remarks>
        /// <param name="aDevice">The device to use</param>
        public CpProxyAvOpenhomeOrgNetworkMonitor1(CpDevice aDevice)
            : base("av-openhome-org", "NetworkMonitor", 1, aDevice)
        {
            OpenHome.Net.Core.Parameter param;
            List <String> allowedValues = new List <String>();

            iActionName = new OpenHome.Net.Core.Action("Name");
            param       = new ParameterString("Name", allowedValues);
            iActionName.AddOutputParameter(param);

            iActionPorts = new OpenHome.Net.Core.Action("Ports");
            param        = new ParameterUint("Sender");
            iActionPorts.AddOutputParameter(param);
            param = new ParameterUint("Receiver");
            iActionPorts.AddOutputParameter(param);
            param = new ParameterUint("Results");
            iActionPorts.AddOutputParameter(param);

            iName = new PropertyString("Name", NamePropertyChanged);
            AddProperty(iName);
            iSender = new PropertyUint("Sender", SenderPropertyChanged);
            AddProperty(iSender);
            iReceiver = new PropertyUint("Receiver", ReceiverPropertyChanged);
            AddProperty(iReceiver);
            iResults = new PropertyUint("Results", ResultsPropertyChanged);
            AddProperty(iResults);

            iPropertyLock = new Mutex();
        }
Exemple #6
0
 public MuxService(CpDevice device)
     : base(device, "urn:opencable-com:serviceId:urn:schemas-opencable-com:service:Mux")
 {
     _service.Actions.TryGetValue("SetProgram", out _setProgramAction);
     _service.Actions.TryGetValue("AddPid", out _addPidAction);
     _service.Actions.TryGetValue("RemovePid", out _removePidAction);
 }
Exemple #7
0
 public EncoderService(CpDevice device)
     : base(device, "urn:opencable-com:serviceId:urn:schemas-opencable-com:service:Encoder")
 {
     _service.Actions.TryGetValue("GetEncoderCapabilities", out _getEncoderCapabilitiesAction);
     _service.Actions.TryGetValue("SetEncoderParameters", out _setEncoderParametersAction);
     _service.Actions.TryGetValue("GetEncoderParameters", out _getEncoderParametersAction);
 }
Exemple #8
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;
            }
        }
 public FdcService(CpDevice device)
     : base(device, "urn:opencable-com:serviceId:urn:schemas-opencable-com:service:FDC")
 {
     _service.Actions.TryGetValue("GetFDCStatus", out _getFdcStatusAction);
     _service.Actions.TryGetValue("RequestTables", out _requestTablesAction);
     _service.Actions.TryGetValue("AddPid", out _addPidAction);
     _service.Actions.TryGetValue("RemovePid", out _removePidAction);
 }
 public TunerService(CpDevice device)
     : base(device, "urn:opencable-com:serviceId:urn:schemas-opencable-com:service:Tuner")
 {
     _service.Actions.TryGetValue("SetTunerParameters", out _setTunerParametersAction);
     _service.Actions.TryGetValue("GetTunerParameters", out _getTunerParametersAction);
     _service.Actions.TryGetValue("SeekSignal", out _seekSignalAction);
     _service.Actions.TryGetValue("SeekCancel", out _seekCancelAction);
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <remarks>Use CpProxy::[Un]Subscribe() to enable/disable querying of state variable and reporting of their changes.</remarks>
        /// <param name="aDevice">The device to use</param>
        public CpProxyAvOpenhomeOrgExakt2(CpDevice aDevice)
            : base("av-openhome-org", "Exakt", 2, aDevice)
        {
            OpenHome.Net.Core.Parameter param;
            List <String> allowedValues = new List <String>();

            iActionDeviceList = new OpenHome.Net.Core.Action("DeviceList");
            param             = new ParameterString("List", allowedValues);
            iActionDeviceList.AddOutputParameter(param);

            iActionDeviceSettings = new OpenHome.Net.Core.Action("DeviceSettings");
            param = new ParameterString("DeviceId", allowedValues);
            iActionDeviceSettings.AddInputParameter(param);
            param = new ParameterString("Settings", allowedValues);
            iActionDeviceSettings.AddOutputParameter(param);

            iActionConnectionStatus = new OpenHome.Net.Core.Action("ConnectionStatus");
            param = new ParameterString("ConnectionStatus", allowedValues);
            iActionConnectionStatus.AddOutputParameter(param);

            iActionSet = new OpenHome.Net.Core.Action("Set");
            param      = new ParameterString("DeviceId", allowedValues);
            iActionSet.AddInputParameter(param);
            param = new ParameterUint("BankId");
            iActionSet.AddInputParameter(param);
            param = new ParameterString("FileUri", allowedValues);
            iActionSet.AddInputParameter(param);
            param = new ParameterBool("Mute");
            iActionSet.AddInputParameter(param);
            param = new ParameterBool("Persist");
            iActionSet.AddInputParameter(param);

            iActionReprogram = new OpenHome.Net.Core.Action("Reprogram");
            param            = new ParameterString("DeviceId", allowedValues);
            iActionReprogram.AddInputParameter(param);
            param = new ParameterString("FileUri", allowedValues);
            iActionReprogram.AddInputParameter(param);

            iActionReprogramFallback = new OpenHome.Net.Core.Action("ReprogramFallback");
            param = new ParameterString("DeviceId", allowedValues);
            iActionReprogramFallback.AddInputParameter(param);
            param = new ParameterString("FileUri", allowedValues);
            iActionReprogramFallback.AddInputParameter(param);

            iActionVersion = new OpenHome.Net.Core.Action("Version");
            param          = new ParameterString("Version", allowedValues);
            iActionVersion.AddOutputParameter(param);

            iDeviceList = new PropertyString("DeviceList", DeviceListPropertyChanged);
            AddProperty(iDeviceList);
            iConnectionStatus = new PropertyString("ConnectionStatus", ConnectionStatusPropertyChanged);
            AddProperty(iConnectionStatus);
            iVersion = new PropertyString("Version", VersionPropertyChanged);
            AddProperty(iVersion);

            iPropertyLock = new Mutex();
        }
Exemple #12
0
 public ConnectionManagerService(CpDevice device)
     : base(device, "urn:upnp-org:serviceId:urn:schemas-upnp-org:service:ConnectionManager")
 {
     _service.Actions.TryGetValue("GetProtocolInfo", out _getProtocolInfoAction);
     _service.Actions.TryGetValue("PrepareForConnection", out _prepareForConnectionAction);
     _service.Actions.TryGetValue("ConnectionComplete", out _connectionCompleteAction);
     _service.Actions.TryGetValue("GetCurrentConnectionIDs", out _getCurrentConnectionIdsAction);
     _service.Actions.TryGetValue("GetCurrentConnectionInfo", out _getCurrentConnectionInfoAction);
 }
 private void Initialise(CpDevice device, string serviceName, bool isOptional)
 {
     _device = device;
     _unqualifiedServiceName = serviceName.Substring(serviceName.LastIndexOf(":"));
     if (!device.Services.TryGetValue(serviceName, out _service) && !isOptional)
     {
         throw new NotImplementedException(string.Format("DRI: device does not implement a {0} service", _unqualifiedServiceName));
     }
 }
 public CasService(CpDevice device)
     : base(device, "urn:opencable-com:serviceId:urn:schemas-opencable-com:service:CAS")
 {
     _service.Actions.TryGetValue("GetCardStatus", out _getCardStatusAction);
     _service.Actions.TryGetValue("GetEntitlement", out _getEntitlementAction);
     _service.Actions.TryGetValue("NotifyMmiClose", out _notifyMmiCloseAction);
     _service.Actions.TryGetValue("SetChannel", out _setChannelAction);
     _service.Actions.TryGetValue("SetPreferredLanguage", out _setPreferredLanguageAction);
 }
Exemple #15
0
 public AuxService(CpDevice device)
     : base(device, "urn:opencable-com:serviceId:urn:schemas-opencable-com:service:Aux", true)
 {
     if (_service != null)
     {
         _service.Actions.TryGetValue("GetAuxCapabilities", out _getAuxCapabilitiesAction);
         _service.Actions.TryGetValue("SetAuxParameters", out _setAuxParametersAction);
     }
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <remarks>Use CpProxy::[Un]Subscribe() to enable/disable querying of state variable and reporting of their changes.</remarks>
        /// <param name="aDevice">The device to use</param>
        public CpProxyOpenhomeOrgTestLights1(CpDevice aDevice)
            : base("openhome-org", "TestLights", 1, aDevice)
        {
            OpenHome.Net.Core.Parameter param;
            List <String> allowedValues = new List <String>();

            iActionGetCount = new OpenHome.Net.Core.Action("GetCount");
            param           = new ParameterUint("Count");
            iActionGetCount.AddOutputParameter(param);

            iActionGetRoom = new OpenHome.Net.Core.Action("GetRoom");
            param          = new ParameterUint("Index");
            iActionGetRoom.AddInputParameter(param);
            param = new ParameterString("RoomName", allowedValues);
            iActionGetRoom.AddOutputParameter(param);

            iActionGetName = new OpenHome.Net.Core.Action("GetName");
            param          = new ParameterUint("Index");
            iActionGetName.AddInputParameter(param);
            param = new ParameterString("FriendlyName", allowedValues);
            iActionGetName.AddOutputParameter(param);

            iActionGetPosition = new OpenHome.Net.Core.Action("GetPosition");
            param = new ParameterUint("Index");
            iActionGetPosition.AddInputParameter(param);
            param = new ParameterUint("X");
            iActionGetPosition.AddOutputParameter(param);
            param = new ParameterUint("Y");
            iActionGetPosition.AddOutputParameter(param);
            param = new ParameterUint("Z");
            iActionGetPosition.AddOutputParameter(param);

            iActionSetColor = new OpenHome.Net.Core.Action("SetColor");
            param           = new ParameterUint("Index");
            iActionSetColor.AddInputParameter(param);
            param = new ParameterUint("Color");
            iActionSetColor.AddInputParameter(param);

            iActionGetColor = new OpenHome.Net.Core.Action("GetColor");
            param           = new ParameterUint("Index");
            iActionGetColor.AddInputParameter(param);
            param = new ParameterUint("Color");
            iActionGetColor.AddOutputParameter(param);

            iActionGetColorComponents = new OpenHome.Net.Core.Action("GetColorComponents");
            param = new ParameterUint("Color");
            iActionGetColorComponents.AddInputParameter(param);
            param = new ParameterUint("Brightness");
            iActionGetColorComponents.AddOutputParameter(param);
            param = new ParameterUint("Red");
            iActionGetColorComponents.AddOutputParameter(param);
            param = new ParameterUint("Green");
            iActionGetColorComponents.AddOutputParameter(param);
            param = new ParameterUint("Blue");
            iActionGetColorComponents.AddOutputParameter(param);
        }
Exemple #17
0
 private void DeviceAdded(CpDeviceList aList, CpDevice aDevice)
 {
     lock (this)
     {
         if (iDeviceList.Count == 0 && aDevice.Udn() == DeviceBasic.gDeviceName)
         {
             aDevice.AddRef();
             iDeviceList.Add(aDevice);
         }
     }
 }
Exemple #18
0
        public static CpDeviceVolkano Create(CpDevice aDevice, DeviceVolkanoHandler aHandler)
        {
            string value;

            if (aDevice.GetAttribute("Upnp.Service.av-openhome-org.Product", out value))
            {
                return(new CpDeviceMain(aDevice, aHandler));
            }

            return(new CpDeviceFallback(aDevice, aHandler));
        }
Exemple #19
0
        /// <summary>
        /// Establishes the actual device connection by building the control point's proxy device tree corresponding to the
        /// device contained in the given <paramref name="rootDescriptor"/> specified by its <paramref name="deviceUUID"/>.
        /// </summary>
        /// <param name="rootDescriptor">Root descriptor which contains the device to build.</param>
        /// <param name="deviceUUID">UUID of the device to connect.</param>
        /// <param name="dataTypeResolver">Delegate method to resolve extended datatypes.</param>
        private void BuildDeviceProxy(RootDescriptor rootDescriptor, string deviceUUID, DataTypeResolverDlgt dataTypeResolver)
        {
            if (rootDescriptor.State != RootDescriptorState.Ready)
            {
                throw new ArgumentException("Root descriptor is not ready - cannot connect");
            }
            DeviceDescriptor rootDeviceDescriptor = DeviceDescriptor.CreateRootDeviceDescriptor(rootDescriptor);
            DeviceDescriptor deviceDescriptor     = rootDeviceDescriptor.FindDevice(deviceUUID);

            _device = CpDevice.ConnectDevice(this, deviceDescriptor, dataTypeResolver);
        }
Exemple #20
0
 public CpDeviceFallback(CpDevice aDevice, DeviceVolkanoHandler aHandler)
     : base(aDevice, aHandler)
 {
     try
     {
         OnSubscribed();
     }
     catch
     {
         aDevice.RemoveRef();
     }
 }
Exemple #21
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <remarks>Use CpProxy::[Un]Subscribe() to enable/disable querying of state variable and reporting of their changes.</remarks>
        /// <param name="aDevice">The device to use</param>
        public CpProxyRaumfeldComConfigService1(CpDevice aDevice)
            : base("schemas-raumfeld-com", "ConfigService", 1, aDevice)
        {
            OpenHome.Net.Core.Parameter param;
            List <String> allowedValues = new List <String>();

            iActionGetPublicKey = new OpenHome.Net.Core.Action("GetPublicKey");
            param = new ParameterString("Key", allowedValues);
            iActionGetPublicKey.AddOutputParameter(param);

            iActionGetRevision = new OpenHome.Net.Core.Action("GetRevision");
            param = new ParameterUint("Revision");
            iActionGetRevision.AddOutputParameter(param);

            iActionSetPreferences = new OpenHome.Net.Core.Action("SetPreferences");
            param = new ParameterString("Preferences", allowedValues);
            iActionSetPreferences.AddInputParameter(param);
            param = new ParameterString("LeastCommonChangedNode", allowedValues);
            iActionSetPreferences.AddInputParameter(param);
            param = new ParameterUint("ExpectedRevision");
            iActionSetPreferences.AddInputParameter(param);
            allowedValues.Add("ForceOverwrite");
            allowedValues.Add("Cancel");
            param = new ParameterString("OnConflict", allowedValues);
            iActionSetPreferences.AddInputParameter(param);
            allowedValues.Clear();

            iActionGetPreferences = new OpenHome.Net.Core.Action("GetPreferences");
            param = new ParameterString("PublicKey", allowedValues);
            iActionGetPreferences.AddInputParameter(param);
            param = new ParameterString("Preferences", allowedValues);
            iActionGetPreferences.AddOutputParameter(param);
            param = new ParameterUint("Revision");
            iActionGetPreferences.AddOutputParameter(param);

            iActionGetDevice = new OpenHome.Net.Core.Action("GetDevice");
            allowedValues.Add("meta-server");
            allowedValues.Add("renderer");
            param = new ParameterString("Service", allowedValues);
            iActionGetDevice.AddInputParameter(param);
            allowedValues.Clear();
            param = new ParameterString("UniqueDeviceName", allowedValues);
            iActionGetDevice.AddOutputParameter(param);

            iLastChange = new PropertyString("LastChange", LastChangePropertyChanged);
            AddProperty(iLastChange);
            iRevision = new PropertyUint("Revision", RevisionPropertyChanged);
            AddProperty(iRevision);
            iARG_TYPE_OnConflict = new PropertyString("ARG_TYPE_OnConflict", ARG_TYPE_OnConflictPropertyChanged);
            AddProperty(iARG_TYPE_OnConflict);

            iPropertyLock = new Mutex();
        }
Exemple #22
0
        private void Removed(CpDeviceList aList, CpDevice aDevice)
        {
            UserLog.WriteLine(DateTime.Now + ": CpDeviceDiagnosticsList: Device-             Udn{" + aDevice.Udn() + "}");

            CpDeviceDiagnostics device = null;

            lock (iLock)
            {
                if (iDisposed)
                {
                    return;
                }

                foreach (CpDeviceDiagnostics d in iDeviceListPending)
                {
                    if (d.Udn == aDevice.Udn())
                    {
                        iDeviceListPending.Remove(d);

                        d.Dispose();

                        return;
                    }
                }

                foreach (CpDeviceDiagnostics d in iDeviceListDiagnostics)
                {
                    if (d.Udn == aDevice.Udn())
                    {
                        device = d;

                        iDeviceListDiagnostics.Remove(device);

                        break;
                    }
                }
            }

            if (device != null)
            {
                if (iRemoved != null)
                {
                    iRemoved(this, device);
                }

                device.Dispose();
            }
        }
        private void Removed(CpDeviceList aList, CpDevice aDevice)
        {
            UserLog.WriteLine(DateTime.Now + ": CpDeviceRecogniserList: Device-             Udn{" + aDevice.Udn() + "}");

            CpDeviceRecognised removedDevice = null;

            lock (iLock)
            {
                if (iDisposed)
                {
                    return;
                }

                foreach (CpDeviceRecognised d in iDeviceListPending)
                {
                    if (d.Udn == aDevice.Udn())
                    {
                        iDeviceListPending.Remove(d);

                        d.Dispose();

                        return;
                    }
                }

                foreach (CpDeviceRecognised d in iDeviceListRecognised)
                {
                    if (d.Udn == aDevice.Udn())
                    {
                        removedDevice = d;

                        iDeviceListRecognised.Remove(d);

                        break;
                    }
                }
            }

            if (removedDevice != null)
            {
                if (iRemoved != null)
                {
                    iRemoved(this, removedDevice);
                }

                removedDevice.Dispose();
            }
        }
Exemple #24
0
        private void Removed(CpDeviceList aList, CpDevice aDevice)
        {
            UserLog.WriteLine(DateTime.Now + ": CpDeviceReprogramList: Device-             Udn{" + aDevice.Udn() + "}");

            //CpDeviceReprogrammable removedDevice = null;
            lock (iLock)
            {
                if (iDisposed)
                {
                    return;
                }

                foreach (CpDeviceVolkano d in iDeviceListPending)
                {
                    if (d.Udn == aDevice.Udn())
                    {
                        iDeviceListPending.Remove(d);

                        d.Dispose();

                        return;
                    }
                }

                foreach (KeyValuePair <string, CpDeviceReprogrammable> d in iDeviceListReprogrammable)
                {
                    if (d.Value.Udn == aDevice.Udn())
                    {
                        //removedDevice = d.Value;

                        d.Value.SetDevice(null);

                        break;
                    }
                }
            }

            /*if (removedDevice != null)
             * {
             *  if (iRemoved != null)
             *  {
             *      iRemoved(this, removedDevice);
             *  }
             *
             *  removedDevice.Dispose();
             * }*/
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <remarks>Use CpProxy::[Un]Subscribe() to enable/disable querying of state variable and reporting of their changes.</remarks>
        /// <param name="aDevice">The device to use</param>
        public CpProxyAvOpenhomeOrgReceiver1(CpDevice aDevice)
            : base("av-openhome-org", "Receiver", 1, aDevice)
        {
            OpenHome.Net.Core.Parameter param;
            List <String> allowedValues = new List <String>();

            iActionPlay = new OpenHome.Net.Core.Action("Play");

            iActionStop = new OpenHome.Net.Core.Action("Stop");

            iActionSetSender = new OpenHome.Net.Core.Action("SetSender");
            param            = new ParameterString("Uri", allowedValues);
            iActionSetSender.AddInputParameter(param);
            param = new ParameterString("Metadata", allowedValues);
            iActionSetSender.AddInputParameter(param);

            iActionSender = new OpenHome.Net.Core.Action("Sender");
            param         = new ParameterString("Uri", allowedValues);
            iActionSender.AddOutputParameter(param);
            param = new ParameterString("Metadata", allowedValues);
            iActionSender.AddOutputParameter(param);

            iActionProtocolInfo = new OpenHome.Net.Core.Action("ProtocolInfo");
            param = new ParameterString("Value", allowedValues);
            iActionProtocolInfo.AddOutputParameter(param);

            iActionTransportState = new OpenHome.Net.Core.Action("TransportState");
            allowedValues.Add("Stopped");
            allowedValues.Add("Playing");
            allowedValues.Add("Waiting");
            allowedValues.Add("Buffering");
            param = new ParameterString("Value", allowedValues);
            iActionTransportState.AddOutputParameter(param);
            allowedValues.Clear();

            iUri = new PropertyString("Uri", UriPropertyChanged);
            AddProperty(iUri);
            iMetadata = new PropertyString("Metadata", MetadataPropertyChanged);
            AddProperty(iMetadata);
            iTransportState = new PropertyString("TransportState", TransportStatePropertyChanged);
            AddProperty(iTransportState);
            iProtocolInfo = new PropertyString("ProtocolInfo", ProtocolInfoPropertyChanged);
            AddProperty(iProtocolInfo);

            iPropertyLock = new Mutex();
        }
Exemple #26
0
        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();
            }
        }
Exemple #27
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <remarks>Use CpProxy::[Un]Subscribe() to enable/disable querying of state variable and reporting of their changes.</remarks>
        /// <param name="aDevice">The device to use</param>
        public CpProxyAvOpenhomeOrgSender1(CpDevice aDevice)
            : base("av-openhome-org", "Sender", 1, aDevice)
        {
            OpenHome.Net.Core.Parameter param;
            List <String> allowedValues = new List <String>();

            iActionPresentationUrl = new OpenHome.Net.Core.Action("PresentationUrl");
            param = new ParameterString("Value", allowedValues);
            iActionPresentationUrl.AddOutputParameter(param);

            iActionMetadata = new OpenHome.Net.Core.Action("Metadata");
            param           = new ParameterString("Value", allowedValues);
            iActionMetadata.AddOutputParameter(param);

            iActionAudio = new OpenHome.Net.Core.Action("Audio");
            param        = new ParameterBool("Value");
            iActionAudio.AddOutputParameter(param);

            iActionStatus = new OpenHome.Net.Core.Action("Status");
            allowedValues.Add("Enabled");
            allowedValues.Add("Disabled");
            allowedValues.Add("Blocked");
            param = new ParameterString("Value", allowedValues);
            iActionStatus.AddOutputParameter(param);
            allowedValues.Clear();

            iActionAttributes = new OpenHome.Net.Core.Action("Attributes");
            param             = new ParameterString("Value", allowedValues);
            iActionAttributes.AddOutputParameter(param);

            iPresentationUrl = new PropertyString("PresentationUrl", PresentationUrlPropertyChanged);
            AddProperty(iPresentationUrl);
            iMetadata = new PropertyString("Metadata", MetadataPropertyChanged);
            AddProperty(iMetadata);
            iAudio = new PropertyBool("Audio", AudioPropertyChanged);
            AddProperty(iAudio);
            iStatus = new PropertyString("Status", StatusPropertyChanged);
            AddProperty(iStatus);
            iAttributes = new PropertyString("Attributes", AttributesPropertyChanged);
            AddProperty(iAttributes);

            iPropertyLock = new Mutex();
        }
        public CpDeviceRecognised Recognise(CpDevice aDevice, RecogniserHandler aRecognised)
        {
            string version;

            if (aDevice.GetAttribute("Upnp.Service.schemas-upnp-org.DeviceProperties", out version))
            {
                UserLog.WriteLine(DateTime.Now + ": RecogniserSonos: Device+             Udn{" + aDevice.Udn() + "}");
                try
                {
                    return(new CpDeviceRecognisedSonos(aDevice, aRecognised));
                }
                catch (Exception ex)
                {
                    UserLog.WriteLine(DateTime.Now + "RecogniserSonos:  Exception caught recognising device xml: " + ex);
                    return(null);
                }
            }

            return(null);
        }
Exemple #29
0
        private void Added(CpDeviceList aList, CpDevice aDevice)
        {
            UserLog.WriteLine(DateTime.Now + ": CpDeviceReprogramList: Device+             Udn{" + aDevice.Udn() + "}");

            CpDeviceVolkano device = CpDeviceVolkano.Create(aDevice, ReprogrammableAdded);

            lock (iLock)
            {
                if (iDisposed)
                {
                    return;
                }

                // check to see if device has been added immediately
                if (!iDeviceListReprogrammable.ContainsKey(device.MacAddress))
                {
                    iDeviceListPending.Add(device);
                }
            }
        }
Exemple #30
0
 private void DeviceRemoved(CpDeviceList aList, CpDevice aDevice)
 {
     /* The device stack sends byebyes then alives for each newly enabled device.
      * These can be interleaved with responses to a msearch and can cause tests to misbehave,
      * thinking a device has been removed.  The simplest way to work around this is to say
      * our test guarantees that a device remains available as long as its needed then take
      * advantage of this by ignoring device removed callbacks. */
     /*lock (this)
      * {
      *  string udn = aDevice.Udn();
      *  int count = iDeviceList.Count;
      *  for (int i = 0; i < count; i++)
      *  {
      *      if (iDeviceList[i].Udn() == udn)
      *      {
      *          iDeviceList.RemoveAt(i);
      *          iDeviceList[i].RemoveRef();
      *      }
      *  }
      * }*/
 }