RPCResult¶
-
template<class
_T
>
classkanzi::connect
::
RPCResult
¶ Wrapper for concrete RPC results.. provides limited and more convinient access.
Public Functions
-
RPCResult
()¶ Default c++ constructor.
-
RPCTypes::CallbackFunctionSubscriptionToken
addCallback
(typename RPCResultImpl<_T>::CallbackFunctionType callback)¶ Add callback.
- Return
subscription handle.
- Parameters
callback
: to be called when ready.
-
RPCTypes::CallbackFunctionSubscriptionToken
addCallbackEx
(RPCResultObserver<_T> *callback)¶ Add callback.
- Return
subscription handle.
- Parameters
callback
: to be called when ready.
-
bool
complete
(_T value, int32_t rpcresult = GenericRPCReplyMessage::RPC_RESULT_OK)¶ Completes an object.
Normally this is not meant to be used by RPC users but completion is done internally by the Kanzi Connect framework.
- Return
If completion is done, true. If completion has already been completed, false.
- Parameters
rpcresult
: The RPC level completion value.
-
int32_t
getRPCCallResult
() const¶ Retrieve low level rpc status of the method call.
- Return
RPC status.
-
_T
getValue
() const¶ Return the value of a call.
Will block calling thread if remote-call is not complete yet.
- Return
value
-
void
invalidate
()¶ Releases all the referenced resources. After calling this it is not safe to access any other methods except the valid().
-
bool
isComplete
() const¶ Check has call completed.
- Return
true if completed.
-
bool
isLinkBroken
() const¶ Has the link been broken and caused the RPC call to terminate.
- Return
true if link was broken and caused the operation to fail because if that.
-
bool
isTimedOut
() const¶ Has the request been timed out.
- Return
true if timed out.
-
void
removeCallback
(RPCTypes::CallbackFunctionSubscriptionToken token)¶ Remove a callback.
- Parameters
token
: subscription to remove.
-
void
setTimeout
(int ms)¶ Sets the timeout after which the operation is completed locally with timed-out status.
- Note
the timeout is not millisecond accurate but its quaranteed that the timeout is not signaled before specified amount of milliseconds has elapsed. Timeouts are in practise evaluated when ever information is received from the kanzi connect server.
- Parameters
ms
: Timeout in milliseconds.
-
bool
valid
() const¶ is object OK
- Return
true if ok.
-
bool
waitComplete
(int32_t ms) const¶ Wait until complete.
- Return
true if call became ready. false if still pending.
- Parameters
ms
: maximum amount of milliseconds to wait.
-