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));
            }
        }
Exemplo n.º 2
0
        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;
        }
 private void Error_Sink_SetVerticalKeystone(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
 {
     if(OnResult_SetVerticalKeystone != null)
     {
          OnResult_SetVerticalKeystone((System.UInt32 )Args[0].DataValue, (System.Int16 )Args[1].DataValue, e, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_SetVerticalKeystone.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_SetVerticalKeystone)wr.Target)((System.UInt32 )Args[0].DataValue, (System.Int16 )Args[1].DataValue, e, Handle);
         }
         else
         {
             WeakList_SetVerticalKeystone.Remove(wr);
         }
     }
 }
 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);
         }
     }
 }
 private void ResultImportResource2SinkEx(System.Uri importFromThis, IUPnPMedia owner, IMediaResource importToThis, IResourceTransfer transferObject, object Tag, UPnPInvokeException error)
 {
     new TransferForm(transferObject).Show();
 }
 private void ResultDestroyObjectSink(ICpMedia destroyThis, object Tag, UPnPInvokeException error)
 {
     MessageBox.Show(this, "Media " + destroyThis.Title + " Deleted","Delete Media");
 }
        /// <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);
                    }
                }
            }
        }
 private void Error_Sink_GetProtocolInfo(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
 {
     if(OnResult_GetProtocolInfo != null)
     {
          OnResult_GetProtocolInfo((System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), (System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), e, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_GetProtocolInfo.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_GetProtocolInfo)wr.Target)((System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), (System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), e, Handle);
         }
         else
         {
             WeakList_GetProtocolInfo.Remove(wr);
         }
     }
 }
 private void Error_Sink_Play(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, object _Tag)
 {
     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;
         }
     }
     object[] StateInfo = (object[])_Tag;
     if (StateInfo[1]!=null)
     {
         ((Delegate_OnResult_Play)StateInfo[1])(this, (System.UInt32 )Args[0].DataValue, (Enum_TransportPlaySpeed )Args[1].DataValue, e, StateInfo[0]);
     }
     else
     {
         OnResult_Play_Event.Fire(this, (System.UInt32 )Args[0].DataValue, (Enum_TransportPlaySpeed )Args[1].DataValue, e, StateInfo[0]);
     }
 }
 private void Error_Sink_GetTransportSettings(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, object _Tag)
 {
     object[] StateInfo = (object[])_Tag;
     if (StateInfo[1]!=null)
     {
         ((Delegate_OnResult_GetTransportSettings)StateInfo[1])(this, (System.UInt32 )Args[0].DataValue, (Enum_CurrentPlayMode)0, (Enum_CurrentRecordQualityMode)0, e, StateInfo[0]);
     }
     else
     {
         OnResult_GetTransportSettings_Event.Fire(this, (System.UInt32 )Args[0].DataValue, (Enum_CurrentPlayMode)0, (Enum_CurrentRecordQualityMode)0, e, StateInfo[0]);
     }
 }
 private void Error_Sink_GetTransportInfo(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, object _Tag)
 {
     object[] StateInfo = (object[])_Tag;
     if (StateInfo[1]!=null)
     {
         ((Delegate_OnResult_GetTransportInfo)StateInfo[1])(this, (System.UInt32 )Args[0].DataValue, (Enum_TransportState)0, (Enum_TransportStatus)0, (Enum_TransportPlaySpeed)0, e, StateInfo[0]);
     }
     else
     {
         OnResult_GetTransportInfo_Event.Fire(this, (System.UInt32 )Args[0].DataValue, (Enum_TransportState)0, (Enum_TransportStatus)0, (Enum_TransportPlaySpeed)0, e, StateInfo[0]);
     }
 }
 private void Error_Sink_GetMediaInfo(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, object _Tag)
 {
     object[] StateInfo = (object[])_Tag;
     if (StateInfo[1]!=null)
     {
         ((Delegate_OnResult_GetMediaInfo)StateInfo[1])(this, (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, StateInfo[0]);
     }
     else
     {
         OnResult_GetMediaInfo_Event.Fire(this, (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, StateInfo[0]);
     }
 }
Exemplo n.º 13
0
		private void InvokeFailedSink(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, object Tag)
		{
			Arguments = Args;
			InvokeException = e;
			Result.Set();
		}
 private void Error_Sink_GetIPAddress(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, object _Tag)
 {
     object[] StateInfo = (object[])_Tag;
     if (StateInfo[1]!=null)
     {
         ((Delegate_OnResult_GetIPAddress)StateInfo[1])(this, (System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), e, StateInfo[0]);
     }
     else
     {
         OnResult_GetIPAddress_Event.Fire(this, (System.String)UPnPService.CreateObjectInstance(typeof(System.String),null), e, StateInfo[0]);
     }
 }
 private void Error_Sink_SetVolumeDB(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, object _Tag)
 {
     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;
                 }
                 break;
         }
     }
     object[] StateInfo = (object[])_Tag;
     if (StateInfo[1]!=null)
     {
         ((Delegate_OnResult_SetVolumeDB)StateInfo[1])(this, (System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_Channel )Args[1].DataValue, (System.Int16 )Args[2].DataValue, e, StateInfo[0]);
     }
     else
     {
         OnResult_SetVolumeDB_Event.Fire(this, (System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_Channel )Args[1].DataValue, (System.Int16 )Args[2].DataValue, e, StateInfo[0]);
     }
 }
 private void Error_Sink_Seek(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, object _Tag)
 {
     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;
         }
     }
     object[] StateInfo = (object[])_Tag;
     if (StateInfo[1]!=null)
     {
         ((Delegate_OnResult_Seek)StateInfo[1])(this, (System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_SeekMode )Args[1].DataValue, (System.String )Args[2].DataValue, e, StateInfo[0]);
     }
     else
     {
         OnResult_Seek_Event.Fire(this, (System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_SeekMode )Args[1].DataValue, (System.String )Args[2].DataValue, e, StateInfo[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_SetPlayMode(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, object _Tag)
 {
     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 "REPEAT_ALL":
                         Args[i].DataValue = Enum_CurrentPlayMode.REPEAT_ALL;
                         break;
                     case "INTRO":
                         Args[i].DataValue = Enum_CurrentPlayMode.INTRO;
                         break;
                 }
                 break;
         }
     }
     object[] StateInfo = (object[])_Tag;
     if (StateInfo[1]!=null)
     {
         ((Delegate_OnResult_SetPlayMode)StateInfo[1])(this, (System.UInt32 )Args[0].DataValue, (Enum_CurrentPlayMode )Args[1].DataValue, e, StateInfo[0]);
     }
     else
     {
         OnResult_SetPlayMode_Event.Fire(this, (System.UInt32 )Args[0].DataValue, (Enum_CurrentPlayMode )Args[1].DataValue, e, StateInfo[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);
         }
     }
 }
        private static void OnResult_RequestForUpdateObject(ICpMedia attemptChangeOnThis, IUPnPMedia usedThisMetadata, object Tag, UPnPInvokeException error)
        {
            MediaPropertyForm form = null;
            lock (MediaPropertyForm.MetadataRequests.SyncRoot)
            {
                form = (MediaPropertyForm)MediaPropertyForm.MetadataRequests[Tag];
                MediaPropertyForm.MetadataRequests.Remove(Tag);
            }

            if (error != null)
            {
                MessageBox.Show(error.UPNP.Message, "An error occurred while trying to update an object.");
            }
            if (form != null)
            {
            }
        }
        private void ResultCreateObjectSink(ICpContainer parent, IUPnPMedia newObject, string newObjectID, string ResultXml, IUPnPMedia returnedObject, object Tag, UPnPInvokeException error, Exception xmlToObjectError)
        {
            if (error != null)
            {
                MessageBox.Show(this,xmlToObjectError.ToString(),"Create Object Server Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
                return;
            }
            if (xmlToObjectError != null)
            {
                MessageBox.Show(this,xmlToObjectError.ToString(),"Create Object Response Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
                return;
            }

            IUPnPMedia original = (IUPnPMedia) Tag;

            for (int i=0; i < original.Resources.Length; i++)
            {
                parent.RequestImportResource2(new Uri(((IMediaResource)original.Resources[i]).ContentUri), (IMediaResource) returnedObject.Resources[i], null, new OpenSource.UPnP.AV.MediaServer.CP.CpMediaDelegates.Delegate_ResultImportResource2(ResultImportResource2Sink));
            }

            //newObject
            //			foreach (IMediaResource resource in returnedObject.Resources)
            //			{
            //				parent.RequestImportResource2(new Uri(((IMediaResource)original.Resources[0]).ContentUri), resource, null, new OpenSource.UPnP.AV.MediaServer.CP.CpMediaDelegates.Delegate_ResultImportResource2(ResultImportResource2Sink));
            //			}
        }
Exemplo n.º 22
0
 private void Error_Sink_SelectPreset(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, object _Tag)
 {
     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;
         }
     }
     object[] StateInfo = (object[])_Tag;
     if(StateInfo[1]!=null)
     {
         ((Delegate_OnResult_SelectPreset)StateInfo[1])(this, (System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_PresetName )Args[1].DataValue, e, StateInfo[0]);
     }
     else
     {
         OnResult_SelectPreset_Event.Fire(this, (System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_PresetName )Args[1].DataValue, e, StateInfo[0]);
     }
 }
 private void ResultImportResource2Sink(System.Uri importFromThis, IUPnPMedia owner, IMediaResource importToThis, IResourceTransfer transferObject, object Tag, UPnPInvokeException error)
 {
     //MessageBox.Show(this,"Transfering...","Object Import",MessageBoxButtons.OK,MessageBoxIcon.Information);
     object[] args = new object[6];
     args[0] = importFromThis;
     args[1] = owner;
     args[2] = importToThis;
     args[3] = transferObject;
     args[4] = Tag;
     args[5] = error;
     this.BeginInvoke(new OpenSource.UPnP.AV.MediaServer.CP.CpMediaDelegates.Delegate_ResultImportResource2(ResultImportResource2SinkEx),args);
 }
Exemplo n.º 24
0
 private void Error_Sink_GetRedVideoGain(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, object _Tag)
 {
     object[] StateInfo = (object[])_Tag;
     if(StateInfo[1]!=null)
     {
         ((Delegate_OnResult_GetRedVideoGain)StateInfo[1])(this, (System.UInt32 )Args[0].DataValue, (System.UInt16)UPnPService.CreateObjectInstance(typeof(System.UInt16),null), e, StateInfo[0]);
     }
     else
     {
         OnResult_GetRedVideoGain_Event.Fire(this, (System.UInt32 )Args[0].DataValue, (System.UInt16)UPnPService.CreateObjectInstance(typeof(System.UInt16),null), e, StateInfo[0]);
     }
 }
Exemplo n.º 25
0
        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;
            }
        }
Exemplo n.º 26
0
 private void Error_Sink_SetMute(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, object _Tag)
 {
     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;
         }
     }
     object[] StateInfo = (object[])_Tag;
     if(StateInfo[1]!=null)
     {
         ((Delegate_OnResult_SetMute)StateInfo[1])(this, (System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_Channel )Args[1].DataValue, (System.Boolean )Args[2].DataValue, e, StateInfo[0]);
     }
     else
     {
         OnResult_SetMute_Event.Fire(this, (System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_Channel )Args[1].DataValue, (System.Boolean )Args[2].DataValue, e, StateInfo[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);
         }
     }
 }
Exemplo n.º 28
0
 private void Error_Sink_SetColorTemperature(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, object _Tag)
 {
     object[] StateInfo = (object[])_Tag;
     if(StateInfo[1]!=null)
     {
         ((Delegate_OnResult_SetColorTemperature)StateInfo[1])(this, (System.UInt32 )Args[0].DataValue, (System.UInt16 )Args[1].DataValue, e, StateInfo[0]);
     }
     else
     {
         OnResult_SetColorTemperature_Event.Fire(this, (System.UInt32 )Args[0].DataValue, (System.UInt16 )Args[1].DataValue, e, StateInfo[0]);
     }
 }
 private void Error_Sink_SetVolumeDB(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_SetVolumeDB != null)
     {
          OnResult_SetVolumeDB((System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_Channel )Args[1].DataValue, (System.Int16 )Args[2].DataValue, e, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_SetVolumeDB.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_SetVolumeDB)wr.Target)((System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_Channel )Args[1].DataValue, (System.Int16 )Args[2].DataValue, e, Handle);
         }
         else
         {
             WeakList_SetVolumeDB.Remove(wr);
         }
     }
 }
Exemplo n.º 30
0
        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);
            }
        }