/** * Retrieve the output arguments from an asynchronously invoked action. This may only be called * from the callback set in the {@link #beginTime} method. * * @param aAsyncHandle argument passed to the delegate set in the {@link #beginTime} method. * @return the result of the previously invoked action. */ public Time endTime(long aAsyncHandle) { ProxyError errObj = Invocation.error(aAsyncHandle); if (errObj != null) { throw errObj; } int index = 0; long trackCount = Invocation.getOutputUint(aAsyncHandle, index++); long duration = Invocation.getOutputUint(aAsyncHandle, index++); long seconds = Invocation.getOutputUint(aAsyncHandle, index++); return new Time(trackCount, duration, seconds); }
/** * Invoke the action asynchronously. Returns immediately and will run the client-specified * callback when the action later completes. Any output arguments can then be retrieved by calling * {@link #endTime}. * * @param aCallback listener to call back when action completes. This is guaranteed to be run but * may indicate an error. */ public void beginTime(ICpProxyListener aCallback) { Invocation invocation = iService.getInvocation(iActionTime, aCallback); int outIndex = 0; invocation.addOutput( new ArgumentUint((ParameterUint) iActionTime.getOutputParameter(outIndex++))); invocation.addOutput( new ArgumentUint((ParameterUint) iActionTime.getOutputParameter(outIndex++))); invocation.addOutput( new ArgumentUint((ParameterUint) iActionTime.getOutputParameter(outIndex++))); iService.invokeAction(invocation); }