Пример #1
0
 // optional
 public void Pause()
 {
     if (TransportState != TransportState.PAUSED_PLAYBACK)
     {
         UPnP.InvokeAction(_service, "Pause", InstanceId);
     }
 }
Пример #2
0
 // required
 public void Next()
 {
     if (CurrentTrack < NumberOfTracks)
     {
         UPnP.InvokeAction(_service, "Next", InstanceId);
     }
 }
Пример #3
0
 // required
 public void Previous()
 {
     if (CurrentTrack > 1)
     {
         UPnP.InvokeAction(_service, "Previous", InstanceId);
     }
 }
Пример #4
0
 // required
 public void Stop()
 {
     if (TransportState != TransportState.STOPPED)
     {
         UPnP.InvokeAction(_service, "Stop", InstanceId);
     }
 }
Пример #5
0
        public IEnumerable <XPathNavigator> Browse(string objectId, BrowseFlags browseFlag, string filter, string sortCriteria)
        {
            object[] inArgs   = { objectId, browseFlag.ToString(), filter, 0u, 256u * 4, sortCriteria };
            object[] outArray = { "", 0u, uint.MaxValue, 0u };

            for (uint i = 0; i < (uint)outArray[2]; i += (uint)outArray[1])
            {
                inArgs.SetValue(i, 3);                                                                         // starting index
                inArgs.SetValue(Math.Min((uint)inArgs.GetValue(4), (uint)outArray[2] - (uint)outArray[1]), 4); // items to retrieve
                outArray = UPnP.InvokeAction(_service, "Browse", inArgs);

                string resultXml      = Convert.ToString(outArray.GetValue(0));
                uint   numberReturned = Convert.ToUInt32(outArray.GetValue(1));
                uint   totalMatches   = Convert.ToUInt32(outArray.GetValue(2));
                uint   updateId       = Convert.ToUInt32(outArray.GetValue(3));

                XPathDocument  doc = new XPathDocument(new StringReader(resultXml));
                XPathNavigator nav = doc.CreateNavigator();

                foreach (XPathNavigator node in nav.Select(XPath.Expressions.ContainerElements))
                {
                    yield return(node);
                }

                foreach (XPathNavigator node in nav.Select(XPath.Expressions.ItemsElements))
                {
                    yield return(node);
                }
            }
        }
Пример #6
0
        public void BeginSoftwareUpdate(Uri updateUrl, uint flags)
        {
            if (updateUrl == null || updateUrl.IsAbsoluteUri == false)
            {
                throw new ArgumentException("Need absolute uri", "updateUrl");
            }

            UPnP.InvokeAction(_service, "BeginSoftwareUpdate", updateUrl.ToString(), flags);
        }
Пример #7
0
        public AudioInputAttributes GetAudioInputAttributes()
        {
            object[]             ret = UPnP.InvokeAction(_service, "GetAudioInputAttributes");
            AudioInputAttributes aia = new AudioInputAttributes();

            aia._currentName = Convert.ToString(ret[0], CultureInfo.InvariantCulture);
            aia._currentIcon = Convert.ToString(ret[1], CultureInfo.InvariantCulture);
            return(aia);
        }
Пример #8
0
        // required
        public void Play()
        {
            const string speed = "1";

            if (this.NumberOfTracks > 0 && TransportState != TransportState.PLAYING)
            {
                UPnP.InvokeAction(_service, "Play", InstanceId, speed);
            }
        }
Пример #9
0
        public LineInLevel GetLineInLevel()
        {
            object[]    ret = UPnP.InvokeAction(_service, "GetLineInLevel");
            LineInLevel lil = new LineInLevel();

            lil._currentLeftLineInLevel  = Convert.ToInt32(ret[0], CultureInfo.InvariantCulture);
            lil._currentRightLineInLevel = Convert.ToInt32(ret[1], CultureInfo.InvariantCulture);
            return(lil);
        }
Пример #10
0
        public TransportSettings GetTransportSettings()
        {
            object[] outArray = UPnP.InvokeAction(_service, "GetTransportSettings", InstanceId);

            TransportSettings ts = new TransportSettings();

            ts._playMode       = Convert.ToString(outArray[0], CultureInfo.InvariantCulture);
            ts._recQualityMode = Convert.ToString(outArray[1], CultureInfo.InvariantCulture);
            return(ts);
        }
Пример #11
0
        public TransportInfo GetTransportInfo()
        {
            object[] outArray = UPnP.InvokeAction(_service, "GetTransportInfo", InstanceId);

            TransportInfo ti = new TransportInfo();

            ti._currentTransportState  = (TransportState)Enum.Parse(typeof(TransportState), Convert.ToString(outArray[0], CultureInfo.InvariantCulture), true);
            ti._currentTransportStatus = Convert.ToString(outArray[1], CultureInfo.InvariantCulture);
            ti._currentSpeed           = Convert.ToString(outArray[2], CultureInfo.InvariantCulture);
            return(ti);
        }
Пример #12
0
        public DeviceCapabilities GetDeviceCapabilities()
        {
            object[] outArray = UPnP.InvokeAction(_service, "GetDeviceCapabilities", InstanceId);

            DeviceCapabilities dc = new DeviceCapabilities();

            dc._playMedia       = Convert.ToString(outArray[0], CultureInfo.InvariantCulture);
            dc._recMedia        = Convert.ToString(outArray[1], CultureInfo.InvariantCulture);
            dc._reqQualityModes = Convert.ToString(outArray[2], CultureInfo.InvariantCulture);
            return(dc);
        }
Пример #13
0
        public void AddUriToQueue(Uri enqueuedUri, string enqueuedUriMetaData, uint desiredFirstTrackNumberEnqueued, bool enqueueAsNext)
        {
            if (enqueuedUri == null)
            {
                throw new ArgumentException("enqueuedUri required", "enqueuedUri");
            }

            UPnP.InvokeAction(_service, "AddURIToQueue", InstanceId, enqueuedUri.ToString(), enqueuedUriMetaData, desiredFirstTrackNumberEnqueued, enqueueAsNext);
            // out[0] == FirstTrackNumberEnqueued
            // out[1] == NumTracksAdded
            // out[2] == NewQueueLength
        }
Пример #14
0
        // optional
        public void SetNextAVTransportUri(Uri currentUri, string currentUriMetadata)
        {
            if (currentUri == null)
            {
                throw new ArgumentException("currentUri is required", "currentUri");
            }

            if (NextAVTransportUri != currentUri || String.CompareOrdinal(_NextAVTransportURIMetaData, currentUriMetadata) != 0)
            {
                UPnP.InvokeAction(_service, "SetNextAVTransportUri", InstanceId, currentUri.ToString(), currentUriMetadata);
            }
        }
Пример #15
0
        public PositionInfo GetPositionInfo()
        {
            object[] outArray = UPnP.InvokeAction(_service, "GetPositionInfo", InstanceId);

            PositionInfo pi = new PositionInfo();

            pi._track         = Convert.ToString(outArray[0], CultureInfo.InvariantCulture);
            pi._trackDuration = CreateTimeSpan(Convert.ToString(outArray[1], CultureInfo.InvariantCulture));
            pi._trackMetaData = Convert.ToString(outArray[2], CultureInfo.InvariantCulture);
            pi._trackUri      = CreateUri(Convert.ToString(outArray[3], CultureInfo.InvariantCulture));
            pi._relTime       = CreateTimeSpan(Convert.ToString(outArray[4], CultureInfo.InvariantCulture));
            pi._absTime       = CreateTimeSpan(Convert.ToString(outArray[5], CultureInfo.InvariantCulture));
            pi._relCount      = Convert.ToString(outArray[6], CultureInfo.InvariantCulture);
            pi._absCount      = Convert.ToString(outArray[7], CultureInfo.InvariantCulture);
            return(pi);
        }
Пример #16
0
        public MediaInfo GetMediaInfo()
        {
            object[] outArray = UPnP.InvokeAction(_service, "GetMediaInfo", InstanceId);

            MediaInfo mi = new MediaInfo();

            mi._nrTracks           = Convert.ToUInt32(outArray[0], CultureInfo.InvariantCulture);
            mi._mediaDuration      = Convert.ToString(outArray[1], CultureInfo.InvariantCulture);
            mi._currentUri         = CreateUri(Convert.ToString(outArray[2], CultureInfo.InvariantCulture));
            mi._currentUriMetadata = Convert.ToString(outArray[3], CultureInfo.InvariantCulture);
            mi._nextUri            = CreateUri(Convert.ToString(outArray[4], CultureInfo.InvariantCulture));
            mi._nextUriMetadata    = Convert.ToString(outArray[5], CultureInfo.InvariantCulture);
            mi._playMedium         = Convert.ToString(outArray[6], CultureInfo.InvariantCulture);
            mi._recordMedium       = Convert.ToString(outArray[7], CultureInfo.InvariantCulture);
            mi._writeStatus        = Convert.ToString(outArray[8], CultureInfo.InvariantCulture);
            return(mi);
        }
Пример #17
0
 public void SetTreble(int desiredTreble)
 {
     UPnP.InvokeAction(_service, "SetTreble", InstanceId, desiredTreble);
 }
Пример #18
0
 public short GetTreble()
 {
     return(UPnP.InvokeAction <short>(_service, "GetTreble", InstanceId));
 }
Пример #19
0
 public void SetBass(int desiredBass)
 {
     UPnP.InvokeAction(_service, "SetBass", InstanceId, desiredBass);
 }
Пример #20
0
 public short GetBass()
 {
     return(UPnP.InvokeAction <short>(_service, "GetBass", InstanceId));
 }
Пример #21
0
 public void GetVolumeDBRange(Channel channel)
 {
     // TODO: return MinValue/MaxValue
     object[] results = UPnP.InvokeAction(_service, "GetVolumeDBRange", InstanceId, channel.ToString());
 }
Пример #22
0
 public uint RampToVolume(Channel channel, RampType rampType, short desiredVolume)
 {
     return(UPnP.InvokeAction <uint>(_service, "RampToVolume", InstanceId, channel.ToString(), rampType.ToString(), desiredVolume));
 }
Пример #23
0
 public bool GetOutputFixed()
 {
     return(UPnP.InvokeAction <bool>(_service, "GetOutputFixed", InstanceId));
 }
Пример #24
0
 public bool GetLoudness(Channel channel)
 {
     return(UPnP.InvokeAction <bool>(_service, "GetLoudness", InstanceId, channel.ToString()));
 }
Пример #25
0
 public void SetLoudness(Channel channel, bool desiredLoudness)
 {
     UPnP.InvokeAction(_service, "SetLoudness", InstanceId, channel.ToString(), desiredLoudness);
 }
Пример #26
0
 public ushort SetRelativeVolume(Channel channel, int adjustment)
 {
     return(UPnP.InvokeAction <ushort>(_service, "SetRelativeVolume", InstanceId, channel.ToString(), adjustment));
 }
Пример #27
0
 public void SetOutputFixed(bool desiredFixed)
 {
     UPnP.InvokeAction(_service, "SetOutputFixed", InstanceId, desiredFixed);
 }
Пример #28
0
 public short GetVolumeDB(Channel channel)
 {
     return(UPnP.InvokeAction <short>(_service, "GetVolumeDB", InstanceId, channel.ToString()));
 }
Пример #29
0
 public void RestoreVolumePriorToRamp(Channel channel)
 {
     UPnP.InvokeAction(_service, "RestoreVolumePriorToRamp", InstanceId, channel.ToString());
 }
Пример #30
0
 public void SetVolumeDB(Channel channel, short desiredVolume)
 {
     UPnP.InvokeAction(_service, "SetVolumeDB", InstanceId, channel.ToString(), desiredVolume);
 }