protected void PositionInfoSink(CpAVTransport sender, UInt32 InstanceID,
                                        UInt32 Track,
                                        string TrackDuration,
                                        string TrackMetaData,
                                        string TrackURI,
                                        string RelTime,
                                        string AbsTime,
                                        int RelCount,
                                        int AbsCount,
                                        UPnPInvokeException e,
                                        object Handle)
        {
            DText p = new DText();

            p.ATTRMARK = ":";
            try
            {
                p[0]             = TrackDuration;
                _CurrentDuration = new TimeSpan(int.Parse(p[1]), int.Parse(p[2]), int.Parse(p[3]));
            }
            catch (Exception)
            {
            }

            try
            {
                p[0]             = RelTime;
                _CurrentPosition = new TimeSpan(int.Parse(p[1]), int.Parse(p[2]), int.Parse(p[3]));
            }
            catch (Exception)
            {
            }

            if (OnCurrentPositionChanged != null)
            {
                OnCurrentPositionChanged(this);
            }

            _CurrentTrack  = Track;
            this._TrackURI = HTTPMessage.UnEscapeString(TrackURI);
            if (this.OnTrackURIChanged != null)
            {
                OnTrackURIChanged(this);
            }
            if (OnCurrentTrackChanged != null)
            {
                OnCurrentTrackChanged(this);
            }
            lock (this)
            {
                --StateCounter;
                if (StateCounter == 0)
                {
                    if (OnReady != null)
                    {
                        OnReady(this);
                    }
                }
            }
        }
        /// <summary>
        /// This method is called whenever we need to inspect a list of ConnectionIDs
        /// to see if any of them are new
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="IDString"></param>
        /// <param name="e"></param>
        /// <param name="Handle"></param>
        protected void IDSink(CpConnectionManager sender, string IDString, UPnPInvokeException e, object Handle)
        {
            if ((e != null) || (IDString == ""))
            {
                return;
            }

            // This is a temp parser that will parse the CSV list of IDs
            DText p = new DText();

            p.ATTRMARK = ",";
            p[0]       = IDString;
            int len = p.DCOUNT();

            for (int i = 1; i <= len; ++i)
            {
//				bool FOUND = false;
                int cid = int.Parse(p[i].Trim());

//				lock(InstanceList)
//				{
//					foreach(AVConnection _AVC in InstanceList)
//					{
//						if(_AVC.ConnectionID == cid)
//						{
//							FOUND = true;
//							break;
//						}
//					}
//				}

                lock (this.CreateConnectionLock)
                {
                    if (this.PendingCreateConnection == 0)
                    {
                        ConnectionManager.GetCurrentConnectionInfo(cid, null, new CpConnectionManager.Delegate_OnResult_GetCurrentConnectionInfo(ConnectionInfoSink));
                    }
                    else
                    {
                        // We possible need to wait a maximum of 30 seconds, just in case events arrive
                        // that involve this connection ID. When/if that happens, we will remove this
                        // object from the monitor, and continue directly.
                        this.ConnectionMonitor.Add(cid, 30);
                    }
                }
            }
        }
        /// <summary>
        /// Processes the results of Browse requests.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="ObjectID"></param>
        /// <param name="BrowseFlag"></param>
        /// <param name="Filter"></param>
        /// <param name="StartingIndex"></param>
        /// <param name="RequestedCount"></param>
        /// <param name="SortCriteria"></param>
        /// <param name="Result"></param>
        /// <param name="NumberReturned"></param>
        /// <param name="TotalMatches"></param>
        /// <param name="UpdateID"></param>
        /// <param name="e"></param>
        /// <param name="_Tag"></param>
        private void OnBrowseDone(CpContentDirectory sender, System.String ObjectID, OpenSource.UPnP.AV.CpContentDirectory.Enum_A_ARG_TYPE_BrowseFlag BrowseFlag, System.String Filter, System.UInt32 StartingIndex, System.UInt32 RequestedCount, System.String SortCriteria, System.String Result, System.UInt32 NumberReturned, System.UInt32 TotalMatches, System.UInt32 UpdateID, UPnPInvokeException e, object _Tag)
        {
            _RequestState state = (_RequestState)_Tag;

            if (e != null)
            {
                if (state.Callback_Browse1 != null)
                {
                    state.Callback_Browse1(this, ObjectID, BrowseFlag, Filter, StartingIndex, RequestedCount, SortCriteria, e, null, state.Tag, null, NumberReturned, TotalMatches, UpdateID);
                }
                else if (state.Callback_Browse2 != null)
                {
                    state.Callback_Browse2(this, e, null, state.Tag, null, NumberReturned, TotalMatches, UpdateID);
                }
            }
            else
            {
                ArrayList al = null;
                try
                {
                    al = CpMediaBuilder.BuildMediaBranches(Result);
                }
                catch (Exception parseError)
                {
                    if (state.Callback_Browse1 != null)
                    {
                        state.Callback_Browse1(this, ObjectID, BrowseFlag, Filter, StartingIndex, RequestedCount, SortCriteria, e, parseError, state.Tag, null, NumberReturned, TotalMatches, UpdateID);
                    }
                    else if (state.Callback_Browse2 != null)
                    {
                        state.Callback_Browse2(this, e, parseError, state.Tag, null, NumberReturned, TotalMatches, UpdateID);
                    }
                    al = null;
                }

                if (al != null)
                {
                    if (state.Callback_Browse1 != null)
                    {
                        state.Callback_Browse1(this, ObjectID, BrowseFlag, Filter, StartingIndex, RequestedCount, SortCriteria, e, null, state.Tag, (IUPnPMedia[])al.ToArray(typeof(IUPnPMedia)), NumberReturned, TotalMatches, UpdateID);
                    }
                    else if (state.Callback_Browse2 != null)
                    {
                        state.Callback_Browse2(this, e, null, state.Tag, (IUPnPMedia[])al.ToArray(typeof(IUPnPMedia)), NumberReturned, TotalMatches, UpdateID);
                    }
                }
            }
        }
        protected void ConnectionInfoSink(CpConnectionManager sender, System.Int32 ConnectionID, System.Int32 RcsID, System.Int32 AVTransportID, System.String ProtocolInfo, System.String PeerConnectionManager, System.Int32 PeerConnectionID, CpConnectionManager.Enum_A_ARG_TYPE_Direction Direction, CpConnectionManager.Enum_A_ARG_TYPE_ConnectionStatus Status, UPnPInvokeException e, object Handle)
        {
            if (e != null)
            {
                return;
            }

            AVConnection av = null;

            lock (InstanceList)
            {
                foreach (AVConnection a in InstanceList)
                {
                    if (a.ConnectionID == ConnectionID)
                    {
                        av = a;
                        break;
                    }
                }
                if (av == null)
                {
                    av         = new AVConnection(MainDevice, AVTransportID, RcsID, ConnectionID, new AVConnection.OnReadyHandler(ReadySink), Handle);
                    av._Parent = this;
                    InstanceList.Add(av);
                }
                else
                {
                    return;                     // Don't need to trigger event
                }
            }

            // Wait for Ready before sending OnCreateConnection
        }
        /// <summary>
        /// This method is called when an Async call to PrepareForConnection returns. Only
        /// the AVPlayList class will ever call that method.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="RemoteProtocolInfo"></param>
        /// <param name="PeerConnectionManager"></param>
        /// <param name="PeerConnectionID"></param>
        /// <param name="Direction"></param>
        /// <param name="ConnectionID"></param>
        /// <param name="AVTransportID"></param>
        /// <param name="RcsID"></param>
        /// <param name="e"></param>
        /// <param name="Handle"></param>
        protected void PrepareForConnectionSink(CpConnectionManager sender, System.String RemoteProtocolInfo, System.String PeerConnectionManager, System.Int32 PeerConnectionID, CpConnectionManager.Enum_A_ARG_TYPE_Direction Direction, System.Int32 ConnectionID, System.Int32 AVTransportID, System.Int32 RcsID, UPnPInvokeException e, object Handle)
        {
            AVConnection c     = null;
            bool         IsNew = true;

            if (e != null)
            {
                // Since only the AVPlayList class will call PrepareForConnection, we need to fire
                // this other event, because it's too early to notify the user. Only AVPlayList needs
                // to know about this, so it can continue to setup the connection for the user
                OnCreateConnectionFailedEvent2.Fire(this, AVRenderer.CreateFailedReason.CREATE_ATTEMPT_DENIED, Handle);
                return;
            }

            lock (InstanceList)
            {
                foreach (AVConnection a in InstanceList)
                {
                    if (a.ConnectionID == ConnectionID)
                    {
                        // We Already Have this ID From somewhere
                        IsNew = false;
                        c     = a;
                        break;
                    }
                }
                if (IsNew == true)
                {
                    // Does not Exist
                    c         = new AVConnection(MainDevice, AVTransportID, RcsID, ConnectionID, new AVConnection.OnReadyHandler(_ReadySink), Handle);
                    c._Parent = this;
                    InstanceList.Add(c);
                }
            }

            if (IsNew == true)
            {
                // Wait for Ready event from the AVConnection, since we can't return it
                // until it is initialized.
            }
            else
            {
                // Recycled
                OnRecycledConnectionEvent2.Fire(this, c, Handle);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// This method gets called when a new Uri has been set, when faking a playlist
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="InstanceID"></param>
        /// <param name="CurrentURI"></param>
        /// <param name="CurrentURIMetaData"></param>
        /// <param name="e"></param>
        /// <param name="Tag"></param>
        protected void FakePlayListSink(CpAVTransport sender, System.UInt32 InstanceID, System.String CurrentURI, System.String CurrentURIMetaData, UPnPInvokeException e, object Tag)
        {

            if (e == null)
            {
                ((AVConnection)Tag).Play();
            }

        }
		private void MuteSink(CpRenderingControl sender, System.UInt32 InstanceID, CpRenderingControl.Enum_A_ARG_TYPE_Channel Channel, System.Boolean CurrentMute, UPnPInvokeException e, object _Tag)
		{
			if(e==null)
			{	
				MuteByChannel[_cp.Enum_A_ARG_TYPE_Channel_ToString(Channel)] = CurrentMute;
			}
			lock(this)
			{
				--StateCounter;
				if(StateCounter==0)
				{
					if(OnReady!=null)OnReady(this);
				}
			}
		}
Ejemplo n.º 8
0
 private void Error_Sink_SetAVTransportURI(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
 {
     if(OnResult_SetAVTransportURI != null)
     {
          OnResult_SetAVTransportURI((System.UInt32 )Args[0].DataValue, (System.String )Args[1].DataValue, (System.String )Args[2].DataValue, e, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_SetAVTransportURI.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_SetAVTransportURI)wr.Target)((System.UInt32 )Args[0].DataValue, (System.String )Args[1].DataValue, (System.String )Args[2].DataValue, e, Handle);
         }
         else
         {
             WeakList_SetAVTransportURI.Remove(wr);
         }
     }
 }
Ejemplo n.º 9
0
 private void Error_Sink_SetRecordQualityMode(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
 {
     for(int i=0;i<Args.Length;++i)
     {
         switch(Args[i].Name)
         {
             case "NewRecordQualityMode":
                 switch((string)Args[i].DataValue)
                 {
                     case "0:EP":
                         Args[i].DataValue = Enum_CurrentRecordQualityMode._0_EP;
                         break;
                     case "1:LP":
                         Args[i].DataValue = Enum_CurrentRecordQualityMode._1_LP;
                         break;
                     case "2:SP":
                         Args[i].DataValue = Enum_CurrentRecordQualityMode._2_SP;
                         break;
                     case "0:BASIC":
                         Args[i].DataValue = Enum_CurrentRecordQualityMode._0_BASIC;
                         break;
                     case "1:MEDIUM":
                         Args[i].DataValue = Enum_CurrentRecordQualityMode._1_MEDIUM;
                         break;
                     case "2:HIGH":
                         Args[i].DataValue = Enum_CurrentRecordQualityMode._2_HIGH;
                         break;
                     case "NOT_IMPLEMENTED":
                         Args[i].DataValue = Enum_CurrentRecordQualityMode.NOT_IMPLEMENTED;
                         break;
                     case " vendor-defined ":
                         Args[i].DataValue = Enum_CurrentRecordQualityMode._VENDOR_DEFINED_;
                         break;
                 }
                 break;
         }
     }
     if(OnResult_SetRecordQualityMode != null)
     {
          OnResult_SetRecordQualityMode((System.UInt32 )Args[0].DataValue, (Enum_CurrentRecordQualityMode )Args[1].DataValue, e, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_SetRecordQualityMode.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_SetRecordQualityMode)wr.Target)((System.UInt32 )Args[0].DataValue, (Enum_CurrentRecordQualityMode )Args[1].DataValue, e, Handle);
         }
         else
         {
             WeakList_SetRecordQualityMode.Remove(wr);
         }
     }
 }
        protected void PollSink(CpAVTransport sender, UInt32 InstanceID,
                                UInt32 Track,
                                string TrackDuration,
                                string TrackMetaData,
                                string TrackURI,
                                string RelTime,
                                string AbsTime,
                                int RelCount,
                                int AbsCount,
                                UPnPInvokeException e,
                                object Handle)
        {
            DText p = new DText();

            p.ATTRMARK = ":";
            TimeSpan ts;


            try
            {
                p[0]             = RelTime;
                _CurrentPosition = new TimeSpan(int.Parse(p[1]), int.Parse(p[2]), int.Parse(p[3]));

                if (this._CurrentTrack != Track)
                {
                    this._CurrentTrack = Track;
                    if (this.OnCurrentTrackChanged != null)
                    {
                        this.OnCurrentTrackChanged(this);
                    }
                }

                p[0] = TrackDuration;
                ts   = new TimeSpan(int.Parse(p[1]), int.Parse(p[2]), int.Parse(p[3]));
                if (this._CurrentDuration != ts)
                {
                    this._CurrentDuration = ts;
                }

                if (this._TrackURI.CompareTo(TrackURI) != 0)
                {
                    this._TrackURI = TrackURI;
                    if (this.OnCurrentTrackChanged != null)
                    {
                        this.OnCurrentTrackChanged(this);
                    }
                }

                if (this._AVTransportMetaData.CompareTo(TrackMetaData) != 0)
                {
                    this._AVTransportMetaData = TrackMetaData;
                    if (this.OnCurrentURIMetaDataChanged != null)
                    {
                        this.OnCurrentURIMetaDataChanged(this);
                    }
                }
            }
            catch (Exception)
            {
            }

            if (OnCurrentPositionChanged != null)
            {
                OnCurrentPositionChanged(this);
            }
        }
        protected void MediaInfoSink(CpAVTransport sender, System.UInt32 InstanceID, System.UInt32 NrTracks, System.String MediaDuration, System.String CurrentURI, System.String CurrentURIMetaData, System.String NextURI, System.String NextURIMetaData, CpAVTransport.Enum_PlaybackStorageMedium PlayMedium, CpAVTransport.Enum_RecordStorageMedium RecordMedium, CpAVTransport.Enum_RecordMediumWriteStatus WriteStatus, UPnPInvokeException e, object Handle)
        {
            _AVTransportURI      = CurrentURI;
            _AVTransportMetaData = CurrentURIMetaData;
            if (this.OnAVTransportURIChanged != null)
            {
                OnAVTransportURIChanged(this);
            }

            _NextAVTransportURI      = NextURI;
            _NextAVTransportMetaData = NextURIMetaData;
            if (this.OnNextAVTransportURIChanged != null)
            {
                OnNextAVTransportURIChanged(this);
            }

            _NumberOfTracks           = NrTracks;
            this._AVTransportMetaData = CurrentURIMetaData;
            if (this.OnCurrentURIMetaDataChanged != null)
            {
                OnCurrentURIMetaDataChanged(this);
            }
            if (OnNumberOfTracksChanged != null)
            {
                OnNumberOfTracksChanged(this);
            }
            lock (this)
            {
                --StateCounter;
                if (StateCounter == 0)
                {
                    if (OnReady != null)
                    {
                        OnReady(this);
                    }
                }
            }
        }
        private void Sink_OnBrowse(CpMediaServer server, System.String ObjectID, Intel.UPNP.AV.CpContentDirectory.Enum_A_ARG_TYPE_BrowseFlag BrowseFlag, System.String Filter, System.UInt32 StartingIndex, System.UInt32 RequestedCount, System.String SortCriteria, UPnPInvokeException e, Exception parseError, object _Tag, IUPnPMedia[] Result, System.UInt32 NumberReturned, System.UInt32 TotalMatches, System.UInt32 UpdateID)
        {
            if (server == this.m_Server)
            {
                if (ObjectID == this.m_Context)
                {
                    if (_Tag == this.m_Container)
                    {
                        if ((e != null) || (parseError != null))
                        {
                            //error encountered
                        }
                        else
                        {
                            // add children
                            this.m_Children.AddRange(Result);
                            this.m_Container.AddObjects(Result, true);

                            if (this.OnIncrementalUpdate != null)
                            {
                                this.OnIncrementalUpdate(this, Result);
                            }

                            if (
                                ((this.m_Children.Count == TotalMatches) && (NumberReturned > 0)) ||
                                ((TotalMatches == 0) && (NumberReturned > 0))
                                )
                            {
                                // more items to come
                                this.m_CurrentIndex = NumberReturned;
                                DoNextBrowse();
                            }
                            else
                            {
                                lock (this)
                                {
                                    // no more items, prune children from m_Container
                                    ArrayList remove = new ArrayList();
                                    foreach (IUPnPMedia m1 in this.m_Container.CompleteList)
                                    {
                                        bool found = false;
                                        foreach (IUPnPMedia m2 in this.m_Children)
                                        {
                                            if (m1 == m2)
                                            {
                                                found = true;
                                                break;
                                            }
                                        }
                                        if (found == false)
                                        {
                                            remove.Add(m1);
                                        }
                                    }
                                    this.m_Container.RemoveObjects(remove);
                                }

                                if (this.OnRefreshComplete != null)
                                {
                                    IUPnPMedia[] list = (IUPnPMedia[])this.m_Children.ToArray(typeof(IUPnPMedia));
                                    this.OnRefreshComplete(this, list);
                                }
                            }
                        }
                    }
                }
            }
        }
 private void GetTransportSettingsSink(CpAVTransport sender, System.UInt32 InstanceID, CpAVTransport.Enum_CurrentPlayMode PlayMode, CpAVTransport.Enum_CurrentRecordQualityMode RecQualityMode, UPnPInvokeException e, object _Tag)
 {
     if (e == null)
     {
         _CurrentPlayMode = _cp.Enum_CurrentPlayMode_ToString(PlayMode);
         if (this.OnCurrentPlayModeChanged != null)
         {
             OnCurrentPlayModeChanged(this);
         }
     }
     lock (this)
     {
         --StateCounter;
         if (StateCounter == 0)
         {
             if (OnReady != null)
             {
                 OnReady(this);
             }
         }
     }
 }
Ejemplo n.º 14
0
        private void Sink_OnBrowse(CpMediaServer server, System.String ObjectID, Intel.UPNP.AV.CpContentDirectory.Enum_A_ARG_TYPE_BrowseFlag BrowseFlag, System.String Filter, System.UInt32 StartingIndex, System.UInt32 RequestedCount, System.String SortCriteria, UPnPInvokeException e, Exception parseError, object _Tag, IUPnPMedia[] Result, System.UInt32 NumberReturned, System.UInt32 TotalMatches, System.UInt32 UpdateID)
        {
            if (server == this.m_Server)
            {
                if (ObjectID == this.m_Context)
                {
                    if (_Tag == this.m_Container)
                    {
                        if ((e != null) || (parseError != null))
                        {
                            //error encountered
                        }
                        else
                        {
                            // add children
                            this.m_Children.AddRange(Result);
                            this.m_Container.AddObjects(Result, true);

                            if (this.OnIncrementalUpdate != null)
                            {
                                this.OnIncrementalUpdate(this, Result);
                            }

                            if (
                                ((this.m_Children.Count == TotalMatches) && (NumberReturned > 0)) ||
                                ((TotalMatches == 0) && (NumberReturned > 0))
                                )
                            {
                                // more items to come
                                this.m_CurrentIndex = NumberReturned;
                                DoNextBrowse();
                            }
                            else
                            {
                                lock (this)
                                {
                                    // no more items, prune children from m_Container
                                    ArrayList remove = new ArrayList();
                                    foreach (IUPnPMedia m1 in this.m_Container.CompleteList)
                                    {
                                        bool found = false;
                                        foreach (IUPnPMedia m2 in this.m_Children)
                                        {
                                            if (m1 == m2)
                                            {
                                                found = true;
                                                break;
                                            }
                                        }
                                        if (found == false)
                                        {
                                            remove.Add(m1);
                                        }
                                    }
                                    this.m_Container.RemoveObjects(remove);
                                }

                                if (this.OnRefreshComplete != null)
                                {
                                    IUPnPMedia[] list = (IUPnPMedia[]) this.m_Children.ToArray(typeof(IUPnPMedia));
                                    this.OnRefreshComplete(this, list);
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 15
0
 private void _OnBrowseDone(CpContentDirectory sender, System.String ObjectID, Intel.UPNP.AV.CpContentDirectory.Enum_A_ARG_TYPE_BrowseFlag BrowseFlag, System.String Filter, System.UInt32 StartingIndex, System.UInt32 RequestedCount, System.String SortCriteria, System.String Result, System.UInt32 NumberReturned, System.UInt32 TotalMatches, System.UInt32 UpdateID, UPnPInvokeException e, object _Tag)
 {
     _RequestState state = (_RequestState) _Tag;
     if (e != null)
     {
         state.Callback(state.Server, e, null, state.Tag, null, NumberReturned, TotalMatches, UpdateID);
     }
     else
     {
         try
         {
             ArrayList al = CpMediaBuilder.BuildMediaBranches(Result);
             state.Callback(state.Server, e, null, state.Tag, (IUPnPMedia[]) al.ToArray(typeof(IUPnPMedia)), NumberReturned, TotalMatches, UpdateID);
         }
         catch (Exception parseError)
         {
             state.Callback(state.Server, e, parseError, state.Tag, null, NumberReturned, TotalMatches, UpdateID);
         }
     }
 }
Ejemplo n.º 16
0
 /// <summary>
 /// This method gets called when SetAVTransportURI completes
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="InstanceID"></param>
 /// <param name="CurrentURI"></param>
 /// <param name="CurrentURIMetaData"></param>
 /// <param name="e"></param>
 /// <param name="Tag"></param>
 protected void SetURISink(CpAVTransport sender, System.UInt32 InstanceID, System.String CurrentURI, System.String CurrentURIMetaData, UPnPInvokeException e, object Tag)
 {
     if (e == null)
     {
         SetURI_Event.Set();
         if (SetURIEvent_Event.WaitOne(0, false) == true)
         {
             //					OpenSource.Utilities.InstanceTracker.StopTimer("SetAVTransport+Event");
             if (OnReady != null) OnReady(this, (AVConnection)Tag, _Tag);
             OnReady = null;
         }
     }
     else
     {
         if (OnFailed != null) OnFailed(this, AVRenderer.CreateFailedReason.SetAVTransport_FAILED);
         OnFailed = null;
         OnReady = null;
     }
 }
 /// <summary>
 /// This method gets called when SetAVTransportURI completes
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="InstanceID"></param>
 /// <param name="CurrentURI"></param>
 /// <param name="CurrentURIMetaData"></param>
 /// <param name="e"></param>
 /// <param name="Tag"></param>
 protected void SetURISink(CpAVTransport sender, System.UInt32 InstanceID, System.String CurrentURI, System.String CurrentURIMetaData, UPnPInvokeException e, object Tag)
 {
     if (e == null)
     {
         SetURI_Event.Set();
         if (SetURIEvent_Event.WaitOne(0, false) == true)
         {
             //					OpenSource.Utilities.InstanceTracker.StopTimer("SetAVTransport+Event");
             if (OnReady != null)
             {
                 OnReady(this, (AVConnection)Tag, _Tag);
             }
             OnReady = null;
         }
     }
     else
     {
         if (OnFailed != null)
         {
             OnFailed(this, AVRenderer.CreateFailedReason.SetAVTransport_FAILED);
         }
         OnFailed = null;
         OnReady  = null;
     }
 }
        protected void GetTransportInfoSink(CpAVTransport sender, System.UInt32 InstanceID, CpAVTransport.Enum_TransportState CurrentTransportState, CpAVTransport.Enum_TransportStatus CurrentTransportStatus, CpAVTransport.Enum_TransportPlaySpeed CurrentSpeed, UPnPInvokeException e, object Handle)
        {
            if (e != null)
            {
                return;
            }

            _TransportStatus = _cp.Enum_TransportStatus_ToString(CurrentTransportStatus);

            switch (CurrentTransportState)
            {
            case CpAVTransport.Enum_TransportState.PLAYING:
                this._PlayState = "PLAYING";
                break;

            case CpAVTransport.Enum_TransportState.STOPPED:
                this._PlayState = "STOPPED";
                break;

            case CpAVTransport.Enum_TransportState.PAUSED_PLAYBACK:
                this._PlayState = "PAUSED_PLAYBACK";
                break;

            case CpAVTransport.Enum_TransportState.PAUSED_RECORDING:
                this._PlayState = "PAUSED_RECORDING";
                break;

            case CpAVTransport.Enum_TransportState.RECORDING:
                this._PlayState = "RECORDING";
                break;

            case CpAVTransport.Enum_TransportState.TRANSITIONING:
                this._PlayState = "TRANSITIONING";
                break;
            }

            if (this.OnPlayStateChanged != null)
            {
                OnPlayStateChanged(this);
            }
            if (this.OnTransportStatusChanged != null)
            {
                OnTransportStatusChanged(this);
            }

            lock (this)
            {
                --StateCounter;
                if (StateCounter == 0)
                {
                    if (OnReady != null)
                    {
                        OnReady(this);
                    }
                }
            }
        }
Ejemplo n.º 19
0
 private void Error_Sink_Play(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
 {
     for(int i=0;i<Args.Length;++i)
     {
         switch(Args[i].Name)
         {
             case "Speed":
                 switch((string)Args[i].DataValue)
                 {
                     case "1":
                         Args[i].DataValue = Enum_TransportPlaySpeed._1;
                         break;
                     case " vendor-defined ":
                         Args[i].DataValue = Enum_TransportPlaySpeed._VENDOR_DEFINED_;
                         break;
                 }
                 break;
         }
     }
     if(OnResult_Play != null)
     {
          OnResult_Play((System.UInt32 )Args[0].DataValue, (Enum_TransportPlaySpeed )Args[1].DataValue, e, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_Play.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_Play)wr.Target)((System.UInt32 )Args[0].DataValue, (Enum_TransportPlaySpeed )Args[1].DataValue, e, Handle);
         }
         else
         {
             WeakList_Play.Remove(wr);
         }
     }
 }
Ejemplo n.º 20
0
 private void Error_Sink_ConnectionComplete(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
 {
     if(OnResult_ConnectionComplete != null)
     {
          OnResult_ConnectionComplete((System.Int32 )Args[0].DataValue, e, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_ConnectionComplete.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_ConnectionComplete)wr.Target)((System.Int32 )Args[0].DataValue, e, Handle);
         }
         else
         {
             WeakList_ConnectionComplete.Remove(wr);
         }
     }
 }
Ejemplo n.º 21
0
 private void Error_Sink_GetTransportInfo(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
 {
     if(OnResult_GetTransportInfo != null)
     {
          OnResult_GetTransportInfo((System.UInt32 )Args[0].DataValue, (Enum_TransportState)0, (Enum_TransportStatus)0, (Enum_TransportPlaySpeed)0, e, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_GetTransportInfo.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_GetTransportInfo)wr.Target)((System.UInt32 )Args[0].DataValue, (Enum_TransportState)0, (Enum_TransportStatus)0, (Enum_TransportPlaySpeed)0, e, Handle);
         }
         else
         {
             WeakList_GetTransportInfo.Remove(wr);
         }
     }
 }
        private void CPGetDocumentSink(CpGateKeeper sender, System.String DeviceUDN, System.String ServiceID, System.Byte[] Document, UPnPInvokeException e, object _Tag)
        {
            if (e != null)
            {
                return;
            }
            UTF8Encoding U = new UTF8Encoding();

            string    XML       = U.GetString(Document);
            Uri       SourceUri = new Uri("http://127.0.0.1");
            IPAddress Intfce    = null;

            UPnPDevice d = (UPnPDevice)(new UPnPDebugObject(typeof(OpenSource.UPnP.UPnPDevice))).InvokeStaticMethod("Parse", new object[3]
            {
                XML, SourceUri, Intfce
            });

            ProxyDeviceFactory df = new ProxyDeviceFactory(sender, d, new ProxyDeviceFactory.OnDeviceHandler(NewDeviceSink));

            ProxyFactoryTable[df] = df;
        }
Ejemplo n.º 23
0
 private void Error_Sink_GetCurrentConnectionInfo(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
 {
     if(OnResult_GetCurrentConnectionInfo != null)
     {
          OnResult_GetCurrentConnectionInfo((System.Int32 )Args[0].DataValue, (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), (System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), (System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), (Enum_A_ARG_TYPE_Direction)0, (Enum_A_ARG_TYPE_ConnectionStatus)0, e, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_GetCurrentConnectionInfo.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_GetCurrentConnectionInfo)wr.Target)((System.Int32 )Args[0].DataValue, (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), (System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), (System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), (Enum_A_ARG_TYPE_Direction)0, (Enum_A_ARG_TYPE_ConnectionStatus)0, e, Handle);
         }
         else
         {
             WeakList_GetCurrentConnectionInfo.Remove(wr);
         }
     }
 }
 private void Error_Sink_ConnectionComplete(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, object _Tag)
 {
     object[] StateInfo = (object[])_Tag;
     if (StateInfo[1] != null)
     {
         ((Delegate_OnResult_ConnectionComplete)StateInfo[1])(this, (System.Int32)Args[0].DataValue, e, StateInfo[0]);
     }
     else
     {
         OnResult_ConnectionComplete_Event.Fire(this, (System.Int32)Args[0].DataValue, e, StateInfo[0]);
     }
 }
        private void GetDocumentSink(CpGateKeeper sender, System.String DeviceUDN, System.String ServiceID, System.Byte[] Document, UPnPInvokeException e, object _Tag)
        {
            if (e != null)
            {
                return;
            }
            UTF8Encoding U = new UTF8Encoding();

            string      XML = U.GetString(Document);
            UPnPService S   = (UPnPService)_Tag;

            (new UPnPDebugObject(S)).InvokeNonStaticMethod("ParseSCPD", new object[1] {
                XML
            });
            --Counter;
            if (Counter == 0)
            {
                if (OnDevice != null)
                {
                    OnDevice(this, new UPnPRelayDevice(_D, HOME));
                }
            }
        }
        /// <summary>
        /// This routes execution to the user-provided callback, provided in a call to
        /// <see cref="ResourceTransfer.RequestGetTransferProgress"/>
        /// when the results return from <see cref="ResourceTransfer.RequestGetTransferProgress"/>.
        /// </summary>
        /// <param name="sender">the <see cref="CpContentDirectory"/> that made the request on the wire</param>
        /// <param name="TransferID">caller specified ID of the transfer at invoke time</param>
        /// <param name="TransferStatus">output status for the transfer</param>
        /// <param name="TransferLength">output progress of the transfer</param>
        /// <param name="TransferTotal">output expected length of the transfer</param>
        /// <param name="e">errors reported by media server</param>
        /// <param name="_Tag">
        /// A <see cref="GetTransferProgressRequestTag"/> object that has information about the callback
        /// and user provided state.
        /// </param>
        private void SinkResult_GetTransferProgress(CpContentDirectory sender, System.UInt32 TransferID, CpContentDirectory.Enum_A_ARG_TYPE_TransferStatus TransferStatus, System.String TransferLength, System.String TransferTotal, UPnPInvokeException e, object _Tag)
        {
            GetTransferProgressRequestTag rtag = (GetTransferProgressRequestTag)_Tag;

            if (rtag.Callback != null)
            {
                System.Int64 length = -1;
                System.Int64 total  = -1;

                Exception castError = null;
                try
                {
                    System.Int64.Parse(TransferLength);
                    System.Int64.Parse(TransferTotal);
                }
                catch (Exception ce)
                {
                    castError = ce;
                }

                rtag.Callback(this, TransferStatus, length, total, rtag.Tag, e, castError);
            }
        }
 private void MuteSink(CpRenderingControl sender, System.UInt32 InstanceID, CpRenderingControl.Enum_A_ARG_TYPE_Channel Channel, System.Boolean CurrentMute, UPnPInvokeException e, object _Tag)
 {
     if (e == null)
     {
         MuteByChannel[_cp.Enum_A_ARG_TYPE_Channel_ToString(Channel)] = CurrentMute;
     }
     lock (this)
     {
         --StateCounter;
         if (StateCounter == 0)
         {
             if (OnReady != null)
             {
                 OnReady(this);
             }
         }
     }
 }
        /// <summary>
        /// This routes execution to the user-provided callback, provided in a call to
        /// <see cref="ResourceTransfer.RequestStopTransferResource"/>
        /// when the results return from <see cref="ResourceTransfer.RequestStopTransferResource"/>.
        /// </summary>
        /// <param name="sender">the <see cref="CpContentDirectory"/> that made the request on the wire</param>
        /// <param name="TransferID">the caller-specified ID of the transfer to stop</param>
        /// <param name="e">media server reported errors</param>
        /// <param name="_Tag">
        /// A <see cref="StopTransferResourceRequestTag"/> object that has information about the callback
        /// and user provided state.
        /// </param>
        private void SinkResult_StopTransferResource(CpContentDirectory sender, System.UInt32 TransferID, UPnPInvokeException e, object _Tag)
        {
            StopTransferResourceRequestTag rtag = (StopTransferResourceRequestTag)_Tag;

            if (rtag.Callback != null)
            {
                rtag.Callback(this, rtag.Tag, e);
            }
        }
        /// <summary>
        /// This routes execution to the user-provided callback, provided in a call to
        /// <see cref="ResourceTransfer.RequestStopTransferResource"/>
        /// when the results return from <see cref="ResourceTransfer.RequestStopTransferResource"/>.
        /// </summary>
        /// <param name="sender">the <see cref="CpContentDirectory"/> that made the request on the wire</param>
        /// <param name="TransferID">the caller-specified ID of the transfer to stop</param>
        /// <param name="e">media server reported errors</param>
        /// <param name="_Tag">
        /// A <see cref="StopTransferResourceRequestTag"/> object that has information about the callback
        /// and user provided state.
        /// </param>
        private void SinkResult_StopTransferResource(CpContentDirectory sender, System.UInt32 TransferID, UPnPInvokeException e, object _Tag)
        {
            StopTransferResourceRequestTag rtag = (StopTransferResourceRequestTag) _Tag;

            if (rtag.Callback != null)
            {
                rtag.Callback(this, rtag.Tag, e);
            }
        }
        private void GetStateTableSink(CpGateKeeper sender, System.String DeviceUDN, System.String ServiceID, System.Byte[] Variables, UPnPInvokeException e, object _Tag)
        {
            UPnPService s = (UPnPService)_Tag;

            UPnPArgument[] Vars = Gatekeeper.ParseArguments(Variables);
            foreach (UPnPArgument var in Vars)
            {
                (new UPnPDebugObject(s)).SetProperty("ValidationMode", false);
                s.SetStateVariable(var.Name, var.DataValue);
            }
            if (Interlocked.Decrement(ref InitCounter) == 0)
            {
                ProxyDevice.StartDevice();
            }
            if (Vars.Length > 0)
            {
                EventCounter += Vars.Length;
                if (this.OnEvent != null)
                {
                    OnEvent(this, EventCounter);
                }
            }
        }
        /// <summary>
        /// This method is called when an AsyncCall to GetProtocolInfo completes
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="Source"></param>
        /// <param name="Sink"></param>
        /// <param name="e"></param>
        /// <param name="Handle"></param>
        protected void GetProtocolInfoSink(CpConnectionManager sender, System.String Source, System.String Sink, UPnPInvokeException e, object Handle)
        {
            if (e != null)
            {
                return;
            }
            if (Sink == "")
            {
                return;
            }

            // This is a temp parser to parse the supported ProtocolInfo values
            DText p = new DText();

            p.ATTRMARK = ",";
            p[0]       = Sink;
            int len = p.DCOUNT();
            ProtocolInfoString istring;

            for (int i = 1; i <= len; ++i)
            {
                istring = new ProtocolInfoString(p[i]);
                // Add each individual entry
                ProtocolInfoList.Add(istring);
            }
            if (!this.__Init)
            {
                this.__Init = true;
                // Upon discovery of a renderer, we can't return the renderer to the user
                // until we at least parsed the supported ProtocolInfo values, otherwise
                // the user will experience incorrect behavior. Since we have just parsed
                // these values, we can fire this event.
                if (this.OnInitialized != null)
                {
                    OnInitialized(this);
                }
            }
        }
        protected void HandleInvokeError(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, object Handle)
        {
            if (sender != service)
            {
                return;
            }
            if (MethodName != action.Name)
            {
                return;
            }
            TimeSpan invokeSpan = DateTime.Now.Subtract(invokeTime);

            string timeStr;

            if (invokeSpan.TotalMilliseconds >= 1000)
            {
                timeStr = invokeSpan.Seconds + "." + invokeSpan.Milliseconds + "sec";
            }
            else
            {
                timeStr = invokeSpan.Milliseconds + "ms";
            }

            if (e.UPNP == null)
            {
                statusBar.Text = "Invocation error (" + timeStr + "): " + e.ToString();
            }
            else
            {
                statusBar.Text = "Invocation Error Code " + e.UPNP.ErrorCode.ToString() + " (" + timeStr + "): " + e.UPNP.ErrorDescription;
            }
        }
        private void ResultGetTransferProgressSink(IResourceTransfer transferObject, CpContentDirectory.Enum_A_ARG_TYPE_TransferStatus transferStatus, System.Int64 transferLength, System.Int64 transferTotal, object Tag, UPnPInvokeException error, Exception castError)
        {
            label1.Text = (antiblockcount++).ToString();

            if (transferLength < 0)
            {
                transferProgressLabel.Text  = transferTotal + " bytes send";
                transferProgressBar.Value   = 0;
                transferProgressBar.Maximum = 100;
            }
            else
            {
                transferProgressBar.Value   = (int)transferTotal;
                transferProgressBar.Maximum = (int)transferLength;
                transferProgressLabel.Text  = (((double)transferLength / (double)transferTotal) * 100).ToString() + "%";
            }
            stateTextBox.Text = transferStatus.ToString();

            if (transferStatus == CpContentDirectory.Enum_A_ARG_TYPE_TransferStatus.IN_PROGRESS)
            {
                transferObject.RequestGetTransferProgress(null, new CpMediaDelegates.Delegate_ResultGetTransferProgress(ResultGetTransferProgressSink));
            }
        }
        protected void SetAVTransportURISink(CpAVTransport sender, System.UInt32 InstanceID, System.String CurrentURI, System.String CurrentURIMetaData, UPnPInvokeException e, object Tag)
        {
            if (e != null)
            {
                return;
            }

            OnSetAVTransportURIEvent.Fire(this, Tag);
        }
 /// <summary>
 /// This method gets called when a new Uri has been set, when faking a playlist
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="InstanceID"></param>
 /// <param name="CurrentURI"></param>
 /// <param name="CurrentURIMetaData"></param>
 /// <param name="e"></param>
 /// <param name="Tag"></param>
 protected void FakePlayListSink(CpAVTransport sender, System.UInt32 InstanceID, System.String CurrentURI, System.String CurrentURIMetaData, UPnPInvokeException e, object Tag)
 {
     if (e == null)
     {
         ((AVConnection)Tag).Play();
     }
 }
 /// <summary>
 /// This is called when GetCurrentConnectionInfo completes.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="ConnectionID"></param>
 /// <param name="RcsID"></param>
 /// <param name="AVTransportID"></param>
 /// <param name="ProtocolInfo"></param>
 /// <param name="PeerConnectionManager"></param>
 /// <param name="PeerConnectionID"></param>
 /// <param name="Direction"></param>
 /// <param name="Status"></param>
 /// <param name="e"></param>
 /// <param name="Tag"></param>
 protected void ConnectionInfoSink(CpConnectionManager sender, System.Int32 ConnectionID, System.Int32 RcsID, System.Int32 AVTransportID, System.String ProtocolInfo, System.String PeerConnectionManager, System.Int32 PeerConnectionID, CpConnectionManager.Enum_A_ARG_TYPE_Direction Direction, CpConnectionManager.Enum_A_ARG_TYPE_ConnectionStatus Status, UPnPInvokeException e, object Tag)
 {
     if (e != null)
     {
         return;
     }
     MediaResource = ResourceBuilder.CreateResource(MediaResource.ContentUri, ProtocolInfo);
     if (OnMediaResourceChanged != null)
     {
         OnMediaResourceChanged(this, MediaResource);
     }
 }
Ejemplo n.º 37
0
 private void Error_Sink_GetConnectionVariables(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, object _Tag)
 {
     object[] StateInfo = (object[])_Tag;
     if(StateInfo[1]!=null)
     {
         ((Delegate_OnResult_GetConnectionVariables)StateInfo[1])(this, (System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), e, StateInfo[0]);
     }
     else
     {
         OnResult_GetConnectionVariables_Event.Fire(this, (System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), e, StateInfo[0]);
     }
 }
        protected void InitialState_GetCurrentConnectionInfoSink(CpConnectionManager sender, System.Int32 ConnectionID, System.Int32 RcsID, System.Int32 AVTransportID, System.String ProtocolInfo, System.String PeerConnectionManager, System.Int32 PeerConnectionID, CpConnectionManager.Enum_A_ARG_TYPE_Direction Direction, CpConnectionManager.Enum_A_ARG_TYPE_ConnectionStatus Status, UPnPInvokeException e, object __tag)
        {
            this.ProtocolInfoString = ProtocolInfo;

            bool OK = false;

            lock (this)
            {
                --StateCounter;
                if (StateCounter == 0)
                {
                    this.UpdateCurrentItem();
                    OK = true;
                }
            }

            if (OK)
            {
                if (OnReady != null)
                {
                    OnReady(this, Tag);
                }
            }
        }
Ejemplo n.º 39
0
 private void Error_Sink_GetMediaInfo(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
 {
     if(OnResult_GetMediaInfo != null)
     {
          OnResult_GetMediaInfo((System.UInt32 )Args[0].DataValue, (System.UInt32)UPnPService.CreateObjectInstance(typeof(System.UInt32),null), (System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), (System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), (System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), (System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), (System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), (Enum_PlaybackStorageMedium)0, (Enum_RecordStorageMedium)0, (Enum_RecordMediumWriteStatus)0, e, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_GetMediaInfo.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_GetMediaInfo)wr.Target)((System.UInt32 )Args[0].DataValue, (System.UInt32)UPnPService.CreateObjectInstance(typeof(System.UInt32),null), (System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), (System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), (System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), (System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), (System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), (Enum_PlaybackStorageMedium)0, (Enum_RecordStorageMedium)0, (Enum_RecordMediumWriteStatus)0, e, Handle);
         }
         else
         {
             WeakList_GetMediaInfo.Remove(wr);
         }
     }
 }
Ejemplo n.º 40
0
 private void InvokeFailedSink(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, object Tag)
 {
     Arguments       = Args;
     InvokeException = e;
     Result.Set();
 }
Ejemplo n.º 41
0
 private void Error_Sink_SetPlayMode(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
 {
     for(int i=0;i<Args.Length;++i)
     {
         switch(Args[i].Name)
         {
             case "NewPlayMode":
                 switch((string)Args[i].DataValue)
                 {
                     case "NORMAL":
                         Args[i].DataValue = Enum_CurrentPlayMode.NORMAL;
                         break;
                     case "SHUFFLE":
                         Args[i].DataValue = Enum_CurrentPlayMode.SHUFFLE;
                         break;
                     case "REPEAT_ONE":
                         Args[i].DataValue = Enum_CurrentPlayMode.REPEAT_ONE;
                         break;
                     case "REPEAT_ALL":
                         Args[i].DataValue = Enum_CurrentPlayMode.REPEAT_ALL;
                         break;
                     case "RANDOM":
                         Args[i].DataValue = Enum_CurrentPlayMode.RANDOM;
                         break;
                     case "DIRECT_1":
                         Args[i].DataValue = Enum_CurrentPlayMode.DIRECT_1;
                         break;
                     case "INTRO":
                         Args[i].DataValue = Enum_CurrentPlayMode.INTRO;
                         break;
                 }
                 break;
         }
     }
     if(OnResult_SetPlayMode != null)
     {
          OnResult_SetPlayMode((System.UInt32 )Args[0].DataValue, (Enum_CurrentPlayMode )Args[1].DataValue, e, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_SetPlayMode.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_SetPlayMode)wr.Target)((System.UInt32 )Args[0].DataValue, (Enum_CurrentPlayMode )Args[1].DataValue, e, Handle);
         }
         else
         {
             WeakList_SetPlayMode.Remove(wr);
         }
     }
 }
Ejemplo n.º 42
0
 private void Error_Sink_SelectPreset(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
 {
     for(int i=0;i<Args.Length;++i)
     {
         switch(Args[i].Name)
         {
             case "PresetName":
                 switch((string)Args[i].DataValue)
                 {
                     case "FactoryDefaults":
                         Args[i].DataValue = Enum_A_ARG_TYPE_PresetName.FACTORYDEFAULTS;
                         break;
                     case "InstallationDefaults":
                         Args[i].DataValue = Enum_A_ARG_TYPE_PresetName.INSTALLATIONDEFAULTS;
                         break;
                     case "Vendor defined":
                         Args[i].DataValue = Enum_A_ARG_TYPE_PresetName.VENDOR_DEFINED;
                         break;
                 }
                 break;
         }
     }
     if(OnResult_SelectPreset != null)
     {
          OnResult_SelectPreset((System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_PresetName )Args[1].DataValue, e, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_SelectPreset.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_SelectPreset)wr.Target)((System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_PresetName )Args[1].DataValue, e, Handle);
         }
         else
         {
             WeakList_SelectPreset.Remove(wr);
         }
     }
 }
Ejemplo n.º 43
0
 private void Error_Sink_Seek(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
 {
     for(int i=0;i<Args.Length;++i)
     {
         switch(Args[i].Name)
         {
             case "Unit":
                 switch((string)Args[i].DataValue)
                 {
                     case "ABS_TIME":
                         Args[i].DataValue = Enum_A_ARG_TYPE_SeekMode.ABS_TIME;
                         break;
                     case "REL_TIME":
                         Args[i].DataValue = Enum_A_ARG_TYPE_SeekMode.REL_TIME;
                         break;
                     case "ABS_COUNT":
                         Args[i].DataValue = Enum_A_ARG_TYPE_SeekMode.ABS_COUNT;
                         break;
                     case "REL_COUNT":
                         Args[i].DataValue = Enum_A_ARG_TYPE_SeekMode.REL_COUNT;
                         break;
                     case "TRACK_NR":
                         Args[i].DataValue = Enum_A_ARG_TYPE_SeekMode.TRACK_NR;
                         break;
                     case "CHANNEL_FREQ":
                         Args[i].DataValue = Enum_A_ARG_TYPE_SeekMode.CHANNEL_FREQ;
                         break;
                     case "TAPE-INDEX":
                         Args[i].DataValue = Enum_A_ARG_TYPE_SeekMode.TAPE_INDEX;
                         break;
                     case "FRAME":
                         Args[i].DataValue = Enum_A_ARG_TYPE_SeekMode.FRAME;
                         break;
                 }
                 break;
         }
     }
     if(OnResult_Seek != null)
     {
          OnResult_Seek((System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_SeekMode )Args[1].DataValue, (System.String )Args[2].DataValue, e, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_Seek.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_Seek)wr.Target)((System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_SeekMode )Args[1].DataValue, (System.String )Args[2].DataValue, e, Handle);
         }
         else
         {
             WeakList_Seek.Remove(wr);
         }
     }
 }
Ejemplo n.º 44
0
 private void Error_Sink_SetMute(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
 {
     for(int i=0;i<Args.Length;++i)
     {
         switch(Args[i].Name)
         {
             case "Channel":
                 switch((string)Args[i].DataValue)
                 {
                     case "Master":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.MASTER;
                         break;
                     case "LF":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.LF;
                         break;
                     case "RF":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.RF;
                         break;
                     case "CF":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.CF;
                         break;
                     case "LFE":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.LFE;
                         break;
                     case "LS":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.LS;
                         break;
                     case "RS":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.RS;
                         break;
                     case "LFC":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.LFC;
                         break;
                     case "RFC":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.RFC;
                         break;
                     case "SD":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.SD;
                         break;
                     case "SL":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.SL;
                         break;
                     case "SR ":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.SR_;
                         break;
                     case "T":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.T;
                         break;
                     case "B":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.B;
                         break;
                     case "Vendor defined":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.VENDOR_DEFINED;
                         break;
                 }
                 break;
         }
     }
     if(OnResult_SetMute != null)
     {
          OnResult_SetMute((System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_Channel )Args[1].DataValue, (System.Boolean )Args[2].DataValue, e, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_SetMute.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_SetMute)wr.Target)((System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_Channel )Args[1].DataValue, (System.Boolean )Args[2].DataValue, e, Handle);
         }
         else
         {
             WeakList_SetMute.Remove(wr);
         }
     }
 }
Ejemplo n.º 45
0
        private void Sink_OnBrowse(CpMediaServer server, System.String ObjectID, OpenSource.UPnP.AV.CpContentDirectory.Enum_A_ARG_TYPE_BrowseFlag BrowseFlag, System.String Filter, System.UInt32 StartingIndex, System.UInt32 RequestedCount, System.String SortCriteria, UPnPInvokeException e, Exception parseError, object _Tag, IUPnPMedia[] Result, System.UInt32 NumberReturned, System.UInt32 TotalMatches, System.UInt32 UpdateID)
        {
            IMediaContainer[] tagC, ec;
            bool ok     = true;
            bool nomore = false;

            // ensure we're processing results for the current context
            lock (this)
            {
                tagC = (IMediaContainer[])_Tag;
                ec   = this.CurrentContext.EntireContext;

                for (int i = 0; i < ec.Length; i++)
                {
                    if (ec[i] != tagC[i])
                    {
                        ok = false;
                        break;
                    }
                }
            }

            if (ok)
            {
                // results are for current context, merge metadata results
                // with existing child list

                if ((e == null) && (parseError == null))
                {
                    lock (this)
                    {
                        // add to our media object
                        this.m_Children.AddRange(Result);
                        this.CurrentContext.ContainerContext.AddObjects(Result, true);

                        if (
                            ((this.m_Children.Count < TotalMatches) && (NumberReturned > 0)) ||
                            ((TotalMatches == 0) && (NumberReturned > 0))
                            )
                        {
                            // more items to come
                            this.m_CurrentIndex = NumberReturned;
                        }
                        else
                        {
                            // no more items, prune children from m_Container
                            ArrayList remove = new ArrayList();
                            foreach (IUPnPMedia m1 in this.CurrentContext.ContainerContext.CompleteList)
                            {
                                bool found = false;
                                foreach (IUPnPMedia m2 in this.m_Children)
                                {
                                    if (m1 == m2)
                                    {
                                        found = true;
                                        break;
                                    }
                                }
                                if (found == false)
                                {
                                    remove.Add(m1);
                                }
                            }
                            this.CurrentContext.ContainerContext.RemoveObjects(remove);
                            nomore = true;
                        }
                    }

                    if (this.OnIncrementalUpdate != null)
                    {
                        this.OnIncrementalUpdate(this, Result);
                    }

                    if (nomore)
                    {
                        if (this.OnRefreshComplete != null)
                        {
                            IUPnPMedia[] list = (IUPnPMedia[])this.m_Children.ToArray(typeof(IUPnPMedia));
                            this.OnRefreshComplete(this, list);
                        }
                    }
                }
                else
                {
                    // error occurred with the results...
                    // how should we report this?
                }
            }
        }
Ejemplo n.º 46
0
 private void Error_Sink_SetColorTemperature(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
 {
     if(OnResult_SetColorTemperature != null)
     {
          OnResult_SetColorTemperature((System.UInt32 )Args[0].DataValue, (System.UInt16)UPnPService.CreateObjectInstance(typeof(System.UInt16),null), e, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_SetColorTemperature.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_SetColorTemperature)wr.Target)((System.UInt32 )Args[0].DataValue, (System.UInt16)UPnPService.CreateObjectInstance(typeof(System.UInt16),null), e, Handle);
         }
         else
         {
             WeakList_SetColorTemperature.Remove(wr);
         }
     }
 }
Ejemplo n.º 47
0
 private void Error_Sink_PrepareForConnection(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
 {
     for(int i=0;i<Args.Length;++i)
     {
         switch(Args[i].Name)
         {
             case "Direction":
                 switch((string)Args[i].DataValue)
                 {
                     case "Input":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Direction.INPUT;
                         break;
                     case "Output":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Direction.OUTPUT;
                         break;
                 }
                 break;
         }
     }
     if(OnResult_PrepareForConnection != null)
     {
          OnResult_PrepareForConnection((System.String )Args[0].DataValue, (System.String )Args[1].DataValue, (System.Int32 )Args[2].DataValue, (Enum_A_ARG_TYPE_Direction )Args[3].DataValue, (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), e, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_PrepareForConnection.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_PrepareForConnection)wr.Target)((System.String )Args[0].DataValue, (System.String )Args[1].DataValue, (System.Int32 )Args[2].DataValue, (Enum_A_ARG_TYPE_Direction )Args[3].DataValue, (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), (System.Int32)UPnPService.CreateObjectInstance(typeof(System.Int32),null), e, Handle);
         }
         else
         {
             WeakList_PrepareForConnection.Remove(wr);
         }
     }
 }
        protected void GetTransportInfoSink(CpAVTransport sender, System.UInt32 InstanceID, CpAVTransport.Enum_TransportState CurrentTransportState, CpAVTransport.Enum_TransportStatus CurrentTransportStatus, CpAVTransport.Enum_TransportPlaySpeed CurrentSpeed, UPnPInvokeException e, object Handle)
        {
            if(e!=null) return;

            _TransportStatus = _cp.Enum_TransportStatus_ToString(CurrentTransportStatus);

            switch(CurrentTransportState)
            {
                case CpAVTransport.Enum_TransportState.PLAYING:
                    this._PlayState = "PLAYING";
                    break;
                case CpAVTransport.Enum_TransportState.STOPPED:
                    this._PlayState = "STOPPED";
                    break;
                case CpAVTransport.Enum_TransportState.PAUSED_PLAYBACK:
                    this._PlayState = "PAUSED_PLAYBACK";
                    break;
                case CpAVTransport.Enum_TransportState.PAUSED_RECORDING:
                    this._PlayState = "PAUSED_RECORDING";
                    break;
                case CpAVTransport.Enum_TransportState.RECORDING:
                    this._PlayState = "RECORDING";
                    break;
                case CpAVTransport.Enum_TransportState.TRANSITIONING:
                    this._PlayState = "TRANSITIONING";
                    break;
            }

            if(this.OnPlayStateChanged!=null) OnPlayStateChanged(this);
            if(this.OnTransportStatusChanged!=null) OnTransportStatusChanged(this);

            lock(this)
            {
                --StateCounter;
                if(StateCounter==0)
                {
                    if(OnReady!=null)OnReady(this);
                }
            }
        }
Ejemplo n.º 49
0
 private void Error_Sink_GetCurrentConnectionIDs(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
 {
     if(OnResult_GetCurrentConnectionIDs != null)
     {
          OnResult_GetCurrentConnectionIDs((System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), e, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_GetCurrentConnectionIDs.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_GetCurrentConnectionIDs)wr.Target)((System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), e, Handle);
         }
         else
         {
             WeakList_GetCurrentConnectionIDs.Remove(wr);
         }
     }
 }
        protected void MediaInfoSink(CpAVTransport sender, System.UInt32 InstanceID, System.UInt32 NrTracks, System.String MediaDuration, System.String CurrentURI, System.String CurrentURIMetaData, System.String NextURI, System.String NextURIMetaData, CpAVTransport.Enum_PlaybackStorageMedium PlayMedium, CpAVTransport.Enum_RecordStorageMedium RecordMedium, CpAVTransport.Enum_RecordMediumWriteStatus WriteStatus, UPnPInvokeException e, object Handle)
        {
            _AVTransportURI = CurrentURI;
            _AVTransportMetaData = CurrentURIMetaData;
            if(this.OnAVTransportURIChanged!=null) OnAVTransportURIChanged(this);

            _NextAVTransportURI = NextURI;
            _NextAVTransportMetaData = NextURIMetaData;
            if(this.OnNextAVTransportURIChanged!=null) OnNextAVTransportURIChanged(this);

            _NumberOfTracks = NrTracks;
            this._AVTransportMetaData = CurrentURIMetaData;
            if(this.OnCurrentURIMetaDataChanged!=null) OnCurrentURIMetaDataChanged(this);
            if(OnNumberOfTracksChanged!=null) OnNumberOfTracksChanged(this);
            lock(this)
            {
                --StateCounter;
                if(StateCounter==0)
                {
                    if(OnReady!=null)OnReady(this);
                }
            }
        }
Ejemplo n.º 51
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="testGroup"></param>
        /// <param name="test"></param>
        /// <param name="input"></param>
        /// <param name="methodName"></param>
        /// <param name="invokeError"></param>
        /// <param name="otherErrors"></param>
        public static void LogErrors(AdvancedTestGroup testGroup, CdsSubTest test, InputParams input, string methodName, UPnPInvokeException invokeError, IList otherErrors)
        {
            if (invokeError != null)
            {
                StringBuilder msg = new StringBuilder();
                msg.Append("\r\n");
                msg.AppendFormat("[{0}]({1}) <Invoke Error>. ", testGroup.GroupName, test.Name, LogImportance.Critical.ToString());
                FieldInfo[] fi = input.GetType().GetFields();

                msg.AppendFormat("Method={0}\r\n \tInput=(", methodName);
                for (int i = 0; i < fi.Length; i++)
                {
                    msg.Append("\r\n\t\t");
                    object val       = fi[i].GetValue(input);
                    string valString = "";
                    if (val != null)
                    {
                        valString = val.ToString();
                    }
                    if (i > 0)
                    {
                        msg.Append(", ");
                    }
                    msg.AppendFormat("[{0}={1}]", fi[i].Name, valString);
                }
                msg.Append("\r\n\t).");
                msg.AppendFormat("\r\n\tInvokeErrorMessage=<{0}>.", PrintStackTraceRecursively(invokeError, "\t\t"));
                foreach (Exception e in otherErrors)
                {
                    if (e != null)
                    {
                        msg.AppendFormat("\r\n\tAdditionalErrorInfo=<{0}>.", PrintStackTraceRecursively(e, "\t\t"));
                    }
                }
                testGroup.AddEvent(LogImportance.Critical, test.Name, msg.ToString());
            }
        }
        protected void PollSink(CpAVTransport sender, UInt32 InstanceID, 
			UInt32 Track,
			string TrackDuration,
			string TrackMetaData,
			string TrackURI,
			string RelTime,
			string AbsTime,
			int RelCount,
			int AbsCount,
			UPnPInvokeException e,
			object Handle)
        {
            DText p = new DText();
            p.ATTRMARK = ":";
            TimeSpan ts;

            try
            {
                p[0]= RelTime;
                _CurrentPosition = new TimeSpan(int.Parse(p[1]),int.Parse(p[2]),int.Parse(p[3]));

                if (this._CurrentTrack != Track)
                {
                    this._CurrentTrack = Track;
                    if (this.OnCurrentTrackChanged != null)
                    {
                        this.OnCurrentTrackChanged(this);
                    }
                }

                p[0] = TrackDuration;
                ts = new TimeSpan(int.Parse(p[1]), int.Parse(p[2]), int.Parse(p[3]));
                if (this._CurrentDuration != ts)
                {
                    this._CurrentDuration = ts;
                }

                if (this._TrackURI.CompareTo(TrackURI) != 0)
                {
                    this._TrackURI = TrackURI;
                    if (this.OnCurrentTrackChanged != null)
                    {
                        this.OnCurrentTrackChanged(this);
                    }
                }

                if (this._AVTransportMetaData.CompareTo(TrackMetaData) != 0)
                {
                    this._AVTransportMetaData = TrackMetaData;
                    if (this.OnCurrentURIMetaDataChanged != null)
                    {
                        this.OnCurrentURIMetaDataChanged(this);
                    }
                }
            }
            catch(Exception)
            {
            }

            if(OnCurrentPositionChanged!=null) OnCurrentPositionChanged(this);
        }
        private void A_InvokeErrorSink(UPnPService sender, String MethodName, UPnPArgument[] Args, UPnPInvokeException e, object Tag)
        {
            object[] state  = (object[])Tag;
            string   Caller = (string)state[0];
            int      Handle = (int)state[1];

            CpGateKeeper C = (CpGateKeeper)RegisteredTable[Caller];

            if (e.UPNP != null)
            {
                C.InvokeAsyncResponse(Handle, new byte[0], e.UPNP.ErrorCode, e.UPNP.ErrorDescription);
            }
            else
            {
                C.InvokeAsyncResponse(Handle, new byte[0], 500, e.Message);
            }
        }
        protected void PositionInfoSink(CpAVTransport sender, UInt32 InstanceID, 
			UInt32 Track,
			string TrackDuration,
			string TrackMetaData,
			string TrackURI,
			string RelTime,
			string AbsTime,
			int RelCount,
			int AbsCount,
			UPnPInvokeException e,
			object Handle)
        {
            DText p = new DText();
            p.ATTRMARK = ":";
            try
            {
                p[0] = TrackDuration;
                _CurrentDuration = new TimeSpan(int.Parse(p[1]),int.Parse(p[2]),int.Parse(p[3]));
            }
            catch(Exception)
            {
            }

            try
            {
                p[0]= RelTime;
                _CurrentPosition = new TimeSpan(int.Parse(p[1]),int.Parse(p[2]),int.Parse(p[3]));
            }
            catch(Exception)
            {
            }

            if(OnCurrentPositionChanged!=null) OnCurrentPositionChanged(this);

            _CurrentTrack = Track;
            this._TrackURI = HTTPMessage.UnEscapeString(TrackURI);
            if(this.OnTrackURIChanged!=null) OnTrackURIChanged(this);
            if(OnCurrentTrackChanged!=null) OnCurrentTrackChanged(this);
            lock(this)
            {
                --StateCounter;
                if(StateCounter==0)
                {
                    if(OnReady!=null)OnReady(this);
                }
            }
        }
 private void VolumeSink(CpRenderingControl sender, UInt32 id, CpRenderingControl.Enum_A_ARG_TYPE_Channel Channel, UInt16 VolumeLevel, UPnPInvokeException e, object Handle)
 {
     if (e == null)
     {
         VolumeByChannel[_cp.Enum_A_ARG_TYPE_Channel_ToString(Channel)] = VolumeLevel;
     }
     lock (this)
     {
         --StateCounter;
         if (StateCounter == 0)
         {
             if (OnReady != null)
             {
                 OnReady(this);
             }
         }
     }
 }
 private void GetTransportSettingsSink(CpAVTransport sender, System.UInt32 InstanceID, CpAVTransport.Enum_CurrentPlayMode PlayMode, CpAVTransport.Enum_CurrentRecordQualityMode RecQualityMode, UPnPInvokeException e, object _Tag)
 {
     if(e==null)
     {
         _CurrentPlayMode = _cp.Enum_CurrentPlayMode_ToString(PlayMode);
         if(this.OnCurrentPlayModeChanged!=null) OnCurrentPlayModeChanged(this);
     }
     lock(this)
     {
         --StateCounter;
         if(StateCounter==0)
         {
             if(OnReady!=null)OnReady(this);
         }
     }
 }
		private void VolumeSink(CpRenderingControl sender, UInt32 id, CpRenderingControl.Enum_A_ARG_TYPE_Channel Channel, UInt16 VolumeLevel, UPnPInvokeException e, object Handle)
		{
			if(e==null)
			{	
				VolumeByChannel[_cp.Enum_A_ARG_TYPE_Channel_ToString(Channel)] = VolumeLevel;
			}
			lock(this)
			{
				--StateCounter;
				if(StateCounter==0)
				{
					if(OnReady!=null)OnReady(this);
				}
			}
		}
        /// <summary>
        /// This routes execution to the user-provided callback, provided in a call to
        /// <see cref="ResourceTransfer.RequestGetTransferProgress"/>
        /// when the results return from <see cref="ResourceTransfer.RequestGetTransferProgress"/>.
        /// </summary>
        /// <param name="sender">the <see cref="CpContentDirectory"/> that made the request on the wire</param>
        /// <param name="TransferID">caller specified ID of the transfer at invoke time</param>
        /// <param name="TransferStatus">output status for the transfer</param>
        /// <param name="TransferLength">output progress of the transfer</param>
        /// <param name="TransferTotal">output expected length of the transfer</param>
        /// <param name="e">errors reported by media server</param>
        /// <param name="_Tag">
        /// A <see cref="GetTransferProgressRequestTag"/> object that has information about the callback
        /// and user provided state.
        /// </param>
        private void SinkResult_GetTransferProgress(CpContentDirectory sender, System.UInt32 TransferID, CpContentDirectory.Enum_A_ARG_TYPE_TransferStatus TransferStatus, System.String TransferLength, System.String TransferTotal, UPnPInvokeException e, object _Tag)
        {
            GetTransferProgressRequestTag rtag = (GetTransferProgressRequestTag) _Tag;

            if (rtag.Callback != null)
            {
                System.Int64 length = -1;
                System.Int64 total = -1;

                Exception castError = null;
                try
                {
                    System.Int64.Parse(TransferLength);
                    System.Int64.Parse(TransferTotal);
                }
                catch (Exception ce)
                {
                    castError = ce;
                }

                rtag.Callback(this, TransferStatus, length, total, rtag.Tag, e, castError);
            }
        }