예제 #1
0
        public CpAVRenderer_OhNet(OpenHome.Net.ControlPoint.CpDevice _rendererDevice)
        {
            XMLParser xmlParser = new XMLParser();

                renderingControl = new CpProxyUpnpOrgRenderingControl1(_rendererDevice);
                renderingControl.SetPropertyInitialEvent(propertyChanged);
                renderingControl.SetPropertyChanged(propertyChanged);
                renderingControl.SetPropertyLastChangeChanged(propertyChanged);
                renderingControl.Subscribe();

                avRendererDevice = _rendererDevice;
                avRendererDevice.GetAttribute("Upnp.DeviceXml", out DeviceXml);

                ModelDescription = xmlParser.getNodeValue(DeviceXml, "modelDescription");
                FriendlyName = xmlParser.getNodeValue(DeviceXml, "friendlyName");
                Manufacturer = xmlParser.getNodeValue(DeviceXml, "manufacturer");
                UniqueDeviceName = avRendererDevice.Udn();

                Connections = new List<CpAVConnection>();
                Connections.Add(new CpAVConnection_OhNet(avRendererDevice));
        }
예제 #2
0
        protected void propertyChanged()
        {
            string propXml = renderingControl.PropertyLastChange();
                string result;
                XMLParser xmlParser = new XMLParser();
                UInt16 currentVolumeNew;
                Boolean isMutedNew;

                result = xmlParser.getNodeAttributeValue(propXml, "Volume", "val");
                if (result != null)
                {
                    currentVolumeNew = (UInt16)Convert.ToInt16(result);
                    if (currentVolumeNew != null && currentVolume != currentVolumeNew)
                    {
                        currentVolume = currentVolumeNew;
                        this.VolumeChangedSink(currentVolumeNew);
                    }
                }

                result = xmlParser.getNodeAttributeValue(propXml, "Mute", "val");
                if (result != null)
                {
                    if (result == "0")
                        isMutedNew = false;
                    else
                        isMutedNew = true;
                    if (isMutedNew != null /*&& isMuted != isMutedNew*/)
                    {
                        isMuted = isMutedNew;
                        this.MuteStateChangedSink(isMutedNew);
                    }
                }
        }
예제 #3
0
        protected void propertyChanged()
        {
            string avTransportUriNew;
                string avTransportUriMetaDataNew;
                string tmp;
                UInt32 CurrentTrackNew;
                string propXml = avTransport.PropertyLastChange();
                XMLParser xmlParser = new XMLParser();

                avTransportUriMetaDataNew = xmlParser.getNodeAttributeValue(propXml, "AVTransportURIMetaData", "val");
                if (avTransportUriMetaDataNew != null && AVTransportUriMetaData != avTransportUriMetaDataNew)
                {
                    AVTransportUriMetaData = avTransportUriMetaDataNew;
                    this.AVTransportURIMetaDataChangedSink();
                }

                avTransportUriNew = xmlParser.getNodeAttributeValue(propXml, "AVTransportURI", "val");
                if (avTransportUriNew != null && AVTransportUri != avTransportUriNew)
                {
                    AVTransportUri = avTransportUriNew;
                    this.AVTransportURIChangedSink();
                }

                tmp = xmlParser.getNodeAttributeValue(propXml, "CurrentTrack", "val");
                if (tmp != null && tmp != "")
                {
                    CurrentTrackNew = Convert.ToUInt32(tmp);
                    if (CurrentTrack != CurrentTrackNew)
                    {
                        CurrentTrack = CurrentTrackNew;
                        this.TrackChangedSink(CurrentTrack);
                    }
                }

                tmp = xmlParser.getNodeAttributeValue(propXml, "CurrentPlayMode", "val");
                if (tmp != null && tmp != currentPlayMode)
                {
                    currentPlayMode = tmp;
                    playMode = playModeStringToPlayMode(currentPlayMode);
                    this.CurrentPlayModeChangedSink();
                }

                tmp = xmlParser.getNodeAttributeValue(propXml, "TransportState", "val");
                if (tmp != null && tmp != "")
                {
                    this.PlayStateChangedSink(tmp);

                    if (progressTimer != null)
                    {
                        if (tmp == "PLAYING")
                            progressTimer.Start();
                        else
                            progressTimer.Stop();
                    }

                }
        }