RPCResult¶
-
template<class
_T>
classkanzi::connect::RPCResult¶ Wrapper for concrete RPC results.. provides limited and more convinient access.
Public Functions
-
inline
RPCResult()¶ Default c++ constructor.
-
inline RPCTypes::CallbackFunctionSubscriptionToken
addCallback(typename RPCResultImpl<_T>::CallbackFunctionType callback)¶ Add callback.
- Parameters
callback – to be called when ready.
- Returns
subscription handle.
-
inline RPCTypes::CallbackFunctionSubscriptionToken
addCallbackEx(RPCResultObserver<_T> *callback)¶ Add callback.
- Parameters
callback – to be called when ready.
- Returns
subscription handle.
-
inline 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.
- Parameters
rpcresult – The RPC level completion value.
- Returns
If completion is done, true. If completion has already been completed, false.
-
inline int32_t
getRPCCallResult() const¶ Retrieve low level rpc status of the method call.
- Returns
RPC status.
-
inline _T
getValue() const¶ Return the value of a call.
Will block calling thread if remote-call is not complete yet.
- Returns
value
-
inline void
invalidate()¶ Releases all the referenced resources. After calling this it is not safe to access any other methods except the valid().
-
inline bool
isComplete() const¶ Check has call completed.
- Returns
true if completed.
-
inline bool
isLinkBroken() const¶ Has the link been broken and caused the RPC call to terminate.
- Returns
true if link was broken and caused the operation to fail because if that.
-
inline bool
isTimedOut() const¶ Has the request been timed out.
- Returns
true if timed out.
-
inline void
removeCallback(RPCTypes::CallbackFunctionSubscriptionToken token)¶ Remove a callback.
- Parameters
token – subscription to remove.
-
inline 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.
-
inline bool
valid() const¶ is object OK
- Returns
true if ok.
-
inline bool
waitComplete(int32_t ms) const¶ Wait until complete.
- Parameters
ms – maximum amount of milliseconds to wait.
- Returns
true if call became ready. false if still pending.
-
inline