luna-service2++ Library API Reference
API Summary
The C++ wrapper for the webOS Luna System Bus that provides a bus-based IPC mechanism used between components in webOS. Luna-service2 is composed of a client library and a central hub daemon. The client library provides the API support to register on the bus and communicate with other components. The hub provides a central clearinghouse for all communication. Utilities for monitoring and debugging the bus are included.
Overview of the API
A bus-based Inter Process Communication (IPC) mechanism for components in the webOS. The Luna Service is composed of a client library and of a central hub daemon. The client library provides the API support to register on the bus and communicate with other components. The hub provides a central clearing house for all communication. Utilities for monitoring and debugging the bus are included. After having registered on the Luna Service Bus, services and applications can call public methods of other services and applications registered on the Luna Service Bus. The Luna Service API offers the mechanism that enables sending and receiving data within a single device. Both third-party and internal services can use Luna Service Bus. The operations that a service can perform on the Luna Service Bus are limited by the assigned security permissions.
Example for asynchronous client usage:
try
{
auto client = LS::registerService( nullptr );
client.attachToLoop(mainLoop);
auto call = client.callOneReply( "luna://com.palm.contacts/category/listContacts" ,"{ \"json payload\" }" );
call.setTimeout(1000);
call.continueWith(listContactsHandler, userData);
g_main_loop_run(mainLoop);
}
catch ( const LS::Error &e)
{
cerr << e << endl;
throw;
}
Example for service usage:
namespace {
// callback
bool listContacts(LSHandle *sh, LSMessage *raw_message, void *categoryContext)
{
LS::Message message{raw_message};
try
{
message.respond( "{ JSON REPLY PAYLOAD }" );
}
catch ( const LS::Error &e)
{
cerr << e << endl;
return false;
}
return true ;
}
static LSMethod ipcMethods[] = {
{ "listContacts" , listContacts },
{ },
};
} //namespace
try
{
auto service = LS::registerService( "com.palm.contacts" );
service.registerCategory( "/category" , ipcMethods, nullptr , nullptr );
service.setCategoryData( "/category" , userData);
service.attachToLoop(mainLoop);
g_main_loop_run(mainLoop);
}
catch ( const LS::Error &e)
{
cerr << e << endl;
throw ;
}
Example C++ service usage:
class Category
: private LS::Handle
{
public :
Category(GMainLoop *mainLoop)
: LS::Handle(LS::registerService( "com.palm.contacts" ))
{
attachToLoop (mainLoop);
LS_CATEGORY_BEGIN(Category, "/category" )
LS_CATEGORY_METHOD(listContacts)
LS_CATEGORY_END
}
private:
bool listContacts(LSMessage &message)
{
LS::Message request(&message);
request.respond( "{ JSON REPLY PAYLOAD }" );
return true ;
}
};
try
{
Category category(mainLoop);
g_main_loop_run(mainLoop);
}
catch ( const LS::Error &e)
{
cerr << e << endl;
throw;
}
LS::PayloadRef
A Reference wrapper for LSPayload, that does not own it.
PayloadRef
Description
Constructs a reference for the LSPayload.
Syntax
PayloadRef (LSPayload * payload)
Parameters
Name | Required | Type | Description |
---|---|---|---|
payload | Required | LSPayload * | Indicates the underlying LSPayload to the reference. |
Returns
None~PayloadRef
Description
Destructs the reference payload.
Note: It does not free the reference payload.
Syntax
~PayloadRef ()
Parameters
NoneReturns
NoneattachFd
Description
Attaches the file descriptor to the payload.
Syntax
attachFd (int fd)
Parameters
Name | Required | Type | Description |
---|---|---|---|
fd | Required | int | Indicates the file descriptor to be attached. |
Returns
NonegetFd
Description
Gets the file descriptor attached to the payload.
Syntax
getFd ()
Parameters
NoneReturns
Name | Required | Type | Description |
---|---|---|---|
int | Required | int | Returns the file descriptor if it is attached or -1 if not attached. |
getJson
Description
Get string representation of JSON in payload.
Syntax
getJson ()
Parameters
NoneReturns
Name | Required | Type | Description |
---|---|---|---|
const char * | Required | const char * | Indicates the JSON string or the nullptr if the string can't be retrieved. |
getJValue
Description
Gets the pbnjson::Jvalue from the JSON in the payload.
Syntax
getJValue ()
Parameters
NoneReturns
Name | Required | Type | Description |
---|---|---|---|
pbnjson::JValue | Required | pbnjson::JValue | Indicates the new Jvalue or JNull if the Jvalue can't be retrieved. |
getDataType
Description
Gets the string identifier of the payload data type.
Syntax
getDataType ()
Parameters
NoneReturns
Name | Required | Type | Description |
---|---|---|---|
const char * | Required | const char * | Gets the string identifier of the payload data. |
getData
Description
Gets the raw data.
Syntax
getData (size_t & size)
Parameters
Name | Required | Type | Description |
---|---|---|---|
size | Required | size_t & | Indicates the size_t that stores the size of the data. |
Returns
Name | Required | Type | Description |
---|---|---|---|
void * | Required | void * | Indicates the data pointer. |
LS::PalmService
A wrapper for the service that has both public and private representations.
Deprecated: Use LS::Handle instead
registerCategory
Description
Register tables of callbacks (private and public) associated with the message category.Syntax
registerCategory (const char * category, LSMethod * methods_public, LSMethod * methods_private, LSSignal * ls_signals)
Parameters
Name | Required | Type | Description |
---|---|---|---|
category | Required | const char * | name |
methods_public | Required | LSMethod * | LSMethod array that should end with {0} |
methods_private | Required | LSMethod * | LSMethod array that should end with {0} |
ls_signals | Required | LSSignal * | LSSignal array that should end with {0} |
Returns
NonegetPublicHandle
Description
Function to get public handle.Syntax
getPublicHandle ()
Parameters
NoneReturns
Name | Required | Type | Description |
---|---|---|---|
Handle & | Required | Handle & | public service handle |
getPublicHandle
Description
Function to get public handle.Syntax
getPublicHandle ()
Parameters
NoneReturns
Name | Required | Type | Description |
---|---|---|---|
const Handle & | Required | const Handle & | public service handle |
getPrivateHandle
Description
Function to get private handle.Syntax
getPrivateHandle ()
Parameters
NoneReturns
Name | Required | Type | Description |
---|---|---|---|
Handle & | Required | Handle & | private service handle |
getPrivateHandle
Description
Function to get private handle.Syntax
getPrivateHandle ()
Parameters
NoneReturns
Name | Required | Type | Description |
---|---|---|---|
const Handle & | Required | const Handle & | private service handle |
LS::SubscriptionPoint
Represents a publishing point for the sender service.
setServiceHandle
Description
Assigns a publisher service.
Syntax
setServiceHandle (Handle * service_handle)
Parameters
Name | Required | Type | Description |
---|---|---|---|
service_handle | Required | Handle * |
Returns
Nonesubscribe
Description
Indicates the process subscription message. Subscribes sender of the given message.
Syntax
subscribe (LS::Message & message)
Parameters
Name | Required | Type | Description |
---|---|---|---|
message | Required | LS::Message & | Indicates the subscription message to process. |
Returns
Name | Required | Type | Description |
---|---|---|---|
bool | Required | bool | Indicates the subscribe status of the sender. Possible values are:
|
post
Description
Posts the payload to all the subscribers.
Syntax
post (const char * payload)
Parameters
Name | Required | Type | Description |
---|---|---|---|
payload | Required | const char * | Indicates the posted data. |
Returns
Name | Required | Type | Description |
---|---|---|---|
bool | Required | bool | Indicates the status of the post. Possible values are:
|
getSubscribersCount
Description
Returns the number of service subscribers.
Syntax
getSubscribersCount ()
Parameters
NoneReturns
Name | Required | Type | Description |
---|---|---|---|
std::vector< SubscriptionItem * >::size_type | Required | std::vector< SubscriptionItem * >::size_type | Indicates the number of subscribers. |
PJSAXBounce
Callbacks adapter to parse JSON SAX events.
Possible types that facilitate the next method calls are:
- (bool)jsonObjectOpen()
- (bool)jsonObjectKey({str,len})
- (bool)jsonObjectClose()
- (bool)jsonArrayOpen()
- (bool)jsonArrayClose()
- (bool)jsonString({str,len})
- (bool)jsonNumber({str,len})
- (bool)jsonBoolean(boolVal)
- (bool)jsonNull()
- constchar*str;
- size_tlen;
- (bool)boolVal
Note: If the method returns something that implicitly casts to false is treated as the request to abort the parser.
callbacks
Description
Gets the PJSAX callbacks for the type T.
Syntax
callbacks ()
Parameters
NoneReturns
NoneLS::Payload
Wrapper for LSPayload.
Payload
Description
Construct from the string representation of the JSON.
Syntax
Payload (const char * json)
Parameters
Name | Required | Type | Description |
---|---|---|---|
json | Required | const char * | JSON. |
Returns
NonePayload
Description
Construct from pbnjson::JValue representation of JSON.
Syntax
Payload (pbnjson::JValue json)
Parameters
Name | Required | Type | Description |
---|---|---|---|
json | Required | pbnjson::JValue | JSON. |
Returns
NonePayload
Description
Construct from raw data.Syntax
Payload (const char * type, void * data, size_t size)
Parameters
Name | Required | Type | Description |
---|---|---|---|
type | Required | const char * | |
data | Required | void * | |
size | Required | size_t |
Returns
None~Payload
Description
Destruct owning payload.Syntax
~Payload ()
Parameters
NoneReturns
NoneLS::Message
Indicates the LSMessage wrapper.
accessPayload
Description
Indicates the access payload in the message.
Syntax
accessPayload ()
Parameters
NoneReturns
Name | Required | Type | Description |
---|---|---|---|
LS::PayloadRef | Required | LS::PayloadRef | Indicates the payload reference. |
getSenderExePath
Description
Gets the exe_path of the sender of the message.
Syntax
getSenderExePath ()
Parameters
NoneReturns
Name | Required | Type | Description |
---|---|---|---|
exe_path | Required | const char * | exe_path of the sender |
getSenderTrustLevel
Description
Gets the trustLevel of the sender that sent the message.
Syntax
getSenderTrustLevel ()
Parameters
NoneReturns
Name | Required | Type | Description |
---|---|---|---|
trustLevel | Required | const char * | trustLevel of the sender |
respond
Description
Responds with payload via LS2. Throws an exception on failure.
Syntax
respond (LS::Payload payload)
Parameters
Name | Required | Type | Description |
---|---|---|---|
payload | Required | LS::Payload | Indicates the payload to respond. |
Returns
NoneLS::Error
A class that wraps the LS errors.
what
Description
Gets the text representation of the error.
Syntax
what ()
Parameters
NoneReturns
Name | Required | Type | Description |
---|---|---|---|
const char * | Required | const char * | Indicates the error text message. |
LS::Handle
A bus end-point base class that provides an API to control the service and client end-points of the luna hub.
The user can inherit or use it to create an own service. However the class has not been designed to be used as a precise low-level full functional wrapper for the API. Instead additional service and client wrappers could be created for easy use of the functionality.
methodWraper
Description
Maps a category method to some class method.
Note:
- An object address which has the method should be passed as user_data parameter to setCategoryData method. All methods of a category should be methods of one class as of now.
- It allows to obtain the LSMethod presentation of a given method. This is used to create a category method list.
Syntax
methodWraper (LSHandle * h, LSMessage * m, void * ctx, typedef ClassT, typedef MethT)
Parameters
Name | Required | Type | Description |
---|---|---|---|
h | Required | LSHandle * | |
m | Required | LSMessage * | |
ctx | Required | void * | |
ClassT | Required | typedef | Specifies the class of category. |
MethT | Required | typedef | Specifies the method of the class ClassT. |
Returns
NoneHandle
Description
Creates an empty inactive instance.
Note: This handle is not registered.
Syntax
Handle ()
Parameters
NoneReturns
NoneHandle
Description
Registers a new service with the specified name.Syntax
Handle (const char * name)
Parameters
Name | Required | Type | Description |
---|---|---|---|
name | Required | const char * | Indicates the service name. |
Returns
NoneHandle
Description
Registers a new service with a specified name and an application ID.
Syntax
Handle (const char * name, const char * app_id)
Parameters
Name | Required | Type | Description |
---|---|---|---|
name | Required | const char * | Indicates the service name. |
app_id | Required | const char * | Indicates the additional application identifier, which can be used to distinguish the applications, that work within one registration (HANDLE) on the bus. Note: The recipient should be prepared to query app_from an incoming message. |
Returns
Noneget
Description
Gets the handle to the service.
Syntax
get ()
Parameters
NoneReturns
Name | Required | Type | Description |
---|---|---|---|
LSHandle * | Required | LSHandle * | Indicates the service handle for libluna-service c API. |
get
Description
Gets the handle to the service.
Syntax
get ()
Parameters
NoneReturns
Name | Required | Type | Description |
---|---|---|---|
const LSHandle * | Required | const LSHandle * | Indicates the service handle for the libluna-service c API. |
getName
Description
Gets a LSHandle name.
Syntax
getName ()
Parameters
NoneReturns
Name | Required | Type | Description |
---|---|---|---|
const char * | Required | const char * | Indicates the service name. |
operator bool
Description
Checks if the end-point registration was successfully performed.
Syntax
operator bool ()
Parameters
NoneReturns
NoneregisterCategory
Description
Registers tables of the callbacks associated with the message category.
Syntax
registerCategory (const char * category, const LSMethod * methods, const LSSignal * ls_signals, const LSProperty * properties)
Parameters
Name | Required | Type | Description |
---|---|---|---|
category | Required | const char * | Indicates the category name starting from '/'. |
methods | Required | const LSMethod * | Indicates the c API style method describing the structure objects. |
ls_signals | Required | const LSSignal * | Indicates the table of signals. |
properties | Required | const LSProperty * | Indicates the table of properties. |
Returns
NoneregisterCategoryAppend
Description
Appends methods to the category.
Note: Creates a category if needed.
Syntax
registerCategoryAppend (const char * category, LSMethod * methods, LSSignal * ls_signals)
Parameters
Name | Required | Type | Description |
---|---|---|---|
category | Required | const char * | Indicates the name of the category for the given end-point. |
methods | Required | LSMethod * | Indicates the c-style method list. Note: The list should end with the zeroed item. |
ls_signals | Required | LSSignal * | Indicates the c-style signal list. Note: The list should end with zeroed item. |
Returns
NonesetDisconnectHandler
Description
Sets a function to be called if we are disconnected from the bus.
Syntax
setDisconnectHandler (LSDisconnectHandler disconnect_handler, void * user_data)
Parameters
Name | Required | Type | Description |
---|---|---|---|
disconnect_handler | Required | LSDisconnectHandler | Indicates the function callback. |
user_data | Required | void * | Indicates the user data to be passed to callback. |
Returns
NonesetCategoryData
Description
Sets the user data that is delivered to each callback registered to the category.
Note: If the method user data is set using the setMethodData, it overrides the category data.
Syntax
setCategoryData (const char * category, void * user_data)
Parameters
Name | Required | Type | Description |
---|---|---|---|
category | Required | const char * | Indicates the category name. |
user_data | Required | void * | Indicates the user data to be set. |
Returns
NonesetCategoryDescription
Description
Specifies the meta information about the category and sets the JSON value that describes specified category. Provides validation schema for input parameters and replies. Gives some description for calls.
Syntax
setCategoryDescription (const char * category, jvalue_ref description)
Parameters
Name | Required | Type | Description |
---|---|---|---|
category | Required | const char * | Indicates the category. |
description | Required | jvalue_ref | Indicates the information (no ownership transfer) see / category in example. |
Returns
NonesetMethodData
Description
Sets the user data that is delivered to callback registered to the method.
Note:
- It's recommended to set method user data before method registration, otherwise, if mainloop is running, there is a chance to get callback called with category data.
- Overrides category data as callback context.
Syntax
setMethodData (const char * category, const char * method, void * user_data)
Parameters
Name | Required | Type | Description |
---|---|---|---|
category | Required | const char * | Indicates the name of the category. |
method | Required | const char * | Indicates the method. |
user_data | Required | void * | Indicates the user data to be set. |
Returns
NonepushRole
Description
Pushes a role file for this process.
Note: Once the role file has been pushed with this function, the process will be restricted to the constraints of the provided role file.
Syntax
pushRole (const char * role_path)
Parameters
Name | Required | Type | Description |
---|---|---|---|
role_path | Required | const char * | Specifies the complete path to the role file. |
Returns
NoneattachToLoop
Description
Attaches the service to the glib main loop context.
Syntax
attachToLoop (GMainContext * context)
Parameters
Name | Required | Type | Description |
---|---|---|---|
context | Required | GMainContext * | Indicates the context to the glib main loop. |
Returns
NoneattachToLoop
Description
Attaches the service to the glib main loop.
Syntax
attachToLoop (GMainLoop * loop)
Parameters
Name | Required | Type | Description |
---|---|---|---|
loop | Required | GMainLoop * | Indicates the loop to attach. |
Returns
Nonedetach
Description
Detaches the end-point from the glib mainloop.
Note: You should NEVER use this function unless you are fork()'ing without executing. This will perform nearly all the same cleanup as LSUnregister(), with the exception that it will not send out shutdown messages or flush any buffers. It is intended to be used only when fork()'ing so that your child process can continue without interfering with the parent's file descriptors, since open file descriptors are duplicated during a fork().
Syntax
detach ()
Parameters
NoneReturns
NonesetPriority
Description
Sets the priority level on the associated GSources for the service connection.
Note: The method should be called after attachToLoop(). See https://developer.gnome.org/glib/2.37/glib-The-Main-Event-Loop.html#g-source-set-priority for details.
Syntax
setPriority (int priority)
Parameters
Name | Required | Type | Description |
---|---|---|---|
priority | Required | int | Indicates the priority level. |
Returns
NonesendSignal
Description
Sends a signal specified by the URI with given payload to subscribed services.
Note:
- Services register signals with the method registerCategory(). The signal can be fired with sendSignal(). Services can subscribe for signals with addmatch.
- Client subscribes to a signals with the method LSCall(sh, "luna://com.webos.service.bus/signal/addmatch", ...)
Syntax
sendSignal (const char * uri, const char * payload, bool typecheck)
Parameters
Name | Required | Type | Description |
---|---|---|---|
uri | Required | const char * | Indicates the fully qualified path for a method of the given service. |
payload | Required | const char * | Indicates a string, usually following the JSON object semantics. |
typecheck | Required | bool | Indicates the status of the signal point. Possible values are:
|
Returns
NonecallOneReply
Description
Makes a call.
Syntax
callOneReply (const char * uri, const char * payload, const char * appID)
Parameters
Name | Required | Type | Description |
---|---|---|---|
uri | Required | const char * | Indicates the fully qualified path to service's method. |
payload | Required | const char * | Indicates some string, usually following JSON object semantics. |
appID | Required | const char * | Indicates the application ID. |
sessionID | Optional | const char * | Indicates the session ID. |
Returns
Name | Required | Type | Description |
---|---|---|---|
Call | Required | class LS::Call | Indicates the Call control object. |
callOneReply
Description
Makes a call with the result handler callback.
Syntax
callOneReply (const char * uri, const char * payload, LSFilterFunc func, void * context, const char * appID)
Parameters
Name | Required | Type | Description |
---|---|---|---|
uri | Required | const char * | Indicates the fully qualified path to service's method. |
payload | Required | const char * | Indicates some string, usually following JSON object semantics. |
func | Required | LSFilterFunc | Indicates the callback function. |
context | Required | void * | Indicates the user data. |
appID | Required | const char * | Indicates the application ID. |
sessionID | Optional | const char * | Indicates the session ID. |
Returns
Name | Required | Type | Description |
---|---|---|---|
Call | Required | class LS::Call | Indicates the Call handler object. |
callMultiReply
Description
Makes a multi-call Returned object will collect arrived messages in internal queue.
Note: The messages can be obtained with callback or get(...) functions.
Syntax
callMultiReply (const char * uri, const char * payload, const char * appID)
Parameters
Name | Required | Type | Description |
---|---|---|---|
uri | Required | const char * | Indicates the fully qualified path to service's method. |
payload | Required | const char * | Indicates some string, usually following JSON object semantics. |
appID | Required | const char * | Indicates the application ID. |
sessionID | Optional | const char * | Indicates the session ID. |
Returns
Name | Required | Type | Description |
---|---|---|---|
Call | Required | class LS::Call | Indicates the Call handler object. |
callMultiReply
Description
Makes a multi-call with result processing callback.
Syntax
callMultiReply (const char * uri, const char * payload, LSFilterFunc func, void * context, const char * appID)
Parameters
Name | Required | Type | Description |
---|---|---|---|
uri | Required | const char * | Indicates the fully qualified path to service's method. |
payload | Required | const char * | Indicates some string, usually following JSON object semantics. |
func | Required | LSFilterFunc | Indicates the callback function. |
context | Required | void * | Indicates the context. |
appID | Required | const char * | Indicates the application ID. |
sessionID | Optional | const char * | Indicates the session ID. |
Returns
Name | Required | Type | Description |
---|---|---|---|
Call | Required | class LS::Call | Indicates the Call handler object. |
callSignal
Description
Call a signal to a specific category.Syntax
callSignal (const char * category, const char * methodName, LSFilterFunc func, void * context)
Parameters
Name | Required | Type | Description |
---|---|---|---|
category | Required | const char * | Indicates the category name to monitor. |
methodName | Required | const char * | Indicates the methodName to monitor. |
func | Required | LSFilterFunc | Indicates the callback function. |
context | Required | void * | Indicates the user data. |
Returns
Name | Required | Type | Description |
---|---|---|---|
Call | Required | class LS::Call | Inidicates the Call handler object. |
registerServerStatus
Description
Registers a callback to be called when the server goes down or comes up.
Note: Callback may be called in this context if the server is already up.
Syntax
registerServerStatus (const char * service_name, const ServerStatusCallback & callback)
Parameters
Name | Required | Type | Description |
---|---|---|---|
service_name | Required | const char * | Indicates the service name. |
callback | Required | const ServerStatusCallback & | Indicates the callback function. |
sessionID | Optional | const char * | Indicates the session ID. |
Returns
Name | Required | Type | Description |
---|---|---|---|
ServerStatus | Required | ServerStatus | Indicates the status handler object, controls its lifetime to control the subscription. |
callProxyOneReply
Description
Get the proxy call reply one time.
Syntax
callProxyOneReply (const char * callee_exe, const char * callee_id, const char * callee_name, const char * uri, const char * payload, char func, void * context, const char * appID)
Parameters
Name | Required | Type | Description |
---|---|---|---|
callee_exe | Required | const char * | Absolute exe path of callee, if callee is service else NULL |
callee_id | Required | const char * | app_id of the callee, if callee is app else NULL |
callee_name | Required | const char * | Service name of the callee, NULL not accepted |
uri | Required | const char * | Fully qualified path to service's method |
payload | Required | const char * | Some string, usually following JSON object semantics |
func | Required | char | Function callback to be called when responses arrive. Datatype is LSFIlterFunc. |
context | Required | void * | User data to be passed to callback. |
appID | Required | const char * | Application ID. |
Returns
Name | Required | Type | Description |
---|---|---|---|
Call | Required | class LS::Call | The call control object |
callProxyMultiReply
Description
Gets the proxy call reply multiple times.
Syntax
callProxyMultiReply (const char * callee_exe, const char * callee_id, const char * callee_name, const char * uri, const char * payload, char func, void * context, const char * appID)
Parameters
Name | Required | Type | Description |
---|---|---|---|
callee_exe | Required | const char * | Absolute exe path of callee, if callee is service else NULL |
callee_id | Required | const char * | app_id of the callee, if callee is app else NULL |
callee_name | Required | const char * | Service name of the callee, NULL not accepted |
uri | Required | const char * | Fully qualified path to service's method. |
payload | Required | const char * | Some string, usually following JSON object semantics. |
func | Required | char | Function callback to be called when responses arrive. Datatype is LSFIlterFunc. |
context | Required | void * | User data to be passed to callback. |
appID | Required | const char * | Application ID. |
Returns
Name | Required | Type | Description |
---|---|---|---|
Call | Required | class LS::Call | The call control object. |
LS::Call
Provides the ability to make a call to service category methods, it controls the lifetime of the call.
Note: The call is canceled on object destroy.
~Call
Description
Cancels the call if it is active.
Syntax
~Call ()
Parameters
NoneReturns
Nonecancel
Description
Sends the cancel message to the service to end the call session and unregisters any callback associated with the call.
Syntax
cancel ()
Parameters
NoneReturns
NonesetTimeout
Description
Sets the timeout for a method call.
Note: The call will be canceled if no reply is received after the msTimeout (milliseconds).
Syntax
setTimeout (int msTimeout)
Parameters
Name | Required | Type | Description |
---|---|---|---|
msTimeout | Required | int | Indicates the time after which the method can be canceled. |
Returns
Name | Required | Type | Description |
---|---|---|---|
bool | Required | bool | Indicates if the timeout status for the given call. Possible values are:
|
continueWith
Description
Sets the callback to continue.
Note: This is the callback that is called for each message that arrives. It replaces any previous callback if it exists. If the internal queue already contains the messages then the callback is called sequentially for every message in the queue.
Syntax
continueWith (LSFilterFunc callback, void * context)
Parameters
Name | Required | Type | Description |
---|---|---|---|
callback | Required | LSFilterFunc | Indicates the callback function. |
context | Required | void * | Indicates the user data. |
Returns
Noneget
Description
Retrieve a message object from the top of its queue.
If continueWith was called then this call will wait infinitely because callback from continueWith intercepts all messages and keeps the message queue empty.
It waits for new messages if there is none. It blocks execution until a new message arrives. if msTimeout != 0 the call will be canceled if no reply is received after msTimeout milliseconds.
Syntax
get (unsigned long msTimeout)
Parameters
Name | Required | Type | Description |
---|---|---|---|
msTimeout | Required | unsigned long | time after which method can be canceled. If msTimeout == 0 message wasn't canceled. |
Returns
Name | Required | Type | Description |
---|---|---|---|
Message | Required | Message | message. The message could be empty. Check for an empty message using an if (message) statement before processing the message. |
isActive
Description
Returns the status of the call.
Note:
- If the call is active, it is expected to receive the replies and will be canceled in the destructor.
- If a call is not active, it is not expected to receive replies (for calls with one reply), and will not be cancelled in the destructor.
Syntax
isActive ()
Parameters
NoneReturns
Name | Required | Type | Description |
---|---|---|---|
bool | Required | bool | Indicates the call status. Possible values are:
|