예제 #1
0
파일: CpService.cs 프로젝트: simoncn/ohNet
        /// <summary>
        /// Request an invocation object prior to setting input/output arguments
        /// </summary>
        /// <param name="aAction">Action which will be invoked</param>
        /// <param name="aCallback">Delegate to run when the action completes</param>
        /// <returns>Invocation object, ready to receive input and output arguments</returns>
        public Invocation Invocation(OpenHome.Net.Core.Action aAction, CpProxy.CallbackAsyncComplete aCallback)
        {
            Invocation invocation = new Invocation(this, aAction.Handle(), aCallback);

            lock (this)
            {
                iActiveInvocations.Add(invocation);
            }
            return(invocation);
        }
예제 #2
0
파일: CpService.cs 프로젝트: simoncn/ohNet
        /// <summary>
        /// Constructor.  Not intended for external use (use CpService.Invocation instead)
        /// </summary>
        /// <param name="aService">Service the action is being invoked on</param>
        /// <param name="aAction">Handle to the action being invoked</param>
        /// <param name="aCallback">Callback to run when the action completes</param>
        internal Invocation(CpService aService, IntPtr aAction, CpProxy.CallbackAsyncComplete aCallback)
        {
            iService    = aService;
            iInputArgs  = new List <Argument>();
            iOutputArgs = new List <Argument>();
            GCHandle gch = GCHandle.Alloc(this); /* no need to store gch as a member as AsyncComplete is guaranteed
                                                  * to be called, even in error cases */

            iAsyncComplete         = aCallback;
            iCallbackAsyncComplete = new CpProxy.CallbackActionComplete(AsyncComplete);
            IntPtr ptr = GCHandle.ToIntPtr(gch);

            iHandle = CpServiceInvocation(aService.Handle(), aAction, iCallbackAsyncComplete, ptr);
        }
예제 #3
0
파일: CpService.cs 프로젝트: broonie/ohNet
 /// <summary>
 /// Constructor.  Not intended for external use (use CpService.Invocation instead)
 /// </summary>
 /// <param name="aService">Service the action is being invoked on</param>
 /// <param name="aAction">Handle to the action being invoked</param>
 /// <param name="aCallback">Callback to run when the action completes</param>
 internal Invocation(CpService aService, IntPtr aAction, CpProxy.CallbackAsyncComplete aCallback)
 {
     iService = aService;
     iInputArgs = new List<Argument>();
     iOutputArgs = new List<Argument>();
     GCHandle gch = GCHandle.Alloc(this); /* no need to store gch as a member as AsyncComplete is guaranteed
                                             to be called, even in error cases */
     iAsyncComplete = aCallback;
     iCallbackAsyncComplete = new CpProxy.CallbackActionComplete(AsyncComplete);
     IntPtr ptr = GCHandle.ToIntPtr(gch);
     iHandle = CpServiceInvocation(aService.Handle(), aAction, iCallbackAsyncComplete, ptr);
 }
예제 #4
0
 protected SyncProxyAction()
 {
     iAsyncComplete = new CpProxy.CallbackAsyncComplete(CallbackAsyncComplete);
     iSem           = new Semaphore(0, 1);
 }
예제 #5
0
파일: CpProxy.cs 프로젝트: hacx/ohNet
 protected SyncProxyAction()
 {
     iAsyncComplete = new CpProxy.CallbackAsyncComplete(CallbackAsyncComplete);
     iSem = new Semaphore(0, 1);
 }