RDK Documentation (Open Sourced RDK Components)
|
Application should use the APIs declared in this file to access services provided by IARM-Bus. Basically services provided by these APIs include:
1) Library Initialization and termination.
2) Connection to IARM-Bus.
3) Send and Receive Events.
4) Declared and Invoke RPC Methods.
Functions | |
IARM_Result_t | IARM_Bus_Init (const char *name) |
This API is used to initialize the IARM-Bus library. More... | |
IARM_Result_t | IARM_Bus_Term (void) |
This API is used to terminate the IARM-Bus library. More... | |
IARM_Result_t | IARM_Bus_Connect (void) |
This API is used to connect application to the IARM bus daemon. After connected, the application can send/receive IARM events and invoke IARM RPC calls. More... | |
IARM_Result_t | IARM_Bus_Disconnect (void) |
This API disconnect Application from IARM Bus so the application will not receive any IARM event or RPC calls. More... | |
IARM_Result_t | IARM_Bus_GetContext (void **context) |
Returns group context of the calling member. More... | |
IARM_Result_t | IARM_Bus_BroadcastEvent (const char *ownerName, IARM_EventId_t eventId, void *data, size_t len) |
This API is used to publish an Asynchronous event to all IARM client registered for this perticular event. Upon returns of this function, all the listeners are notified of the event. More... | |
IARM_Result_t | IARM_Bus_IsConnected (const char *memberName, int *isRegistered) |
This API is used to check if the current process is registered with IARM. More... | |
IARM_Result_t | IARM_Bus_RegisterEventHandler (const char *ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler) |
This API register to listen to event and provide the callback function for event notification. Execution of the handler will not block the process sending the event. More... | |
IARM_Result_t | IARM_Bus_UnRegisterEventHandler (const char *ownerName, IARM_EventId_t eventId) |
This API is used to Remove ALL handlers registered for the given event. This API remove the all the event handlers. This API is not used to unregister a specific handler.. More... | |
IARM_Result_t | IARM_Bus_RemoveEventHandler (const char *ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler) |
Remove specific handler registered for the given event. More... | |
IARM_Result_t | IARM_Bus_RegisterCall (const char *methodName, IARM_BusCall_t handler) |
This API is used to register an RPC method that can be invoked by other applications. More... | |
IARM_Result_t | IARM_Bus_Call (const char *ownerName, const char *methodName, void *arg, size_t argLen) |
This API is used to Invoke RPC method by its application name and method name. More... | |
IARM_Result_t | IARM_Bus_Call_with_IPCTimeout (const char *ownerName, const char *methodName, void *arg, size_t argLen, int timeout) |
This API is used to Invoke RPC method by its application name and method name with specified timeout to wait for response. More... | |
IARM_Result_t | IARM_Bus_RegisterEvent (IARM_EventId_t maxEventId) |
This API is used to register all the events that are published by the application. More... | |
void | IARM_Bus_WritePIDFile (const char *path) |
Write PID file. More... | |
IARM_Result_t IARM_Bus_Init | ( | const char * | name | ) |
This API is used to initialize the IARM-Bus library.
The registered IARM client is uniquely identified by the given name in the IARM_Bus_Init() function. The application is not yet connected to the bus until IARM_Bus_Connect() is called.
After the library is initialized, the application is ready to access events and RPC methods using the bus.
[in] | name | A well-known name of the IARM client. The registered IARM client should be uniquely identified by (groupName, memberName) |
IARM_RESULT_SUCCESS | Indicates the call was successful. |
IARM_RESULT_INVALID_PARAM | Indicates the call was unsuccessful because the bus is already initialised and connected. |
Definition at line 38 of file iarmMgrMocks.cpp.
IARM_Result_t IARM_Bus_Term | ( | void | ) |
This API is used to terminate the IARM-Bus library.
This function releases resources allocated by the IARM Bus Library. After it is called, the library returns to the state prior to IARM_Bus_Init function is called.
IARM_RESULT_SUCCESS | Indicates the call was successful. |
IARM_RESULT_INVALID_PARAM | Indicates the call was unsuccessful because the bus is not initialised. |
IARM_Result_t IARM_Bus_Connect | ( | void | ) |
This API is used to connect application to the IARM bus daemon. After connected, the application can send/receive IARM events and invoke IARM RPC calls.
IARM_RESULT_SUCCESS | Indicates the call was successful. |
IARM_RESULT_INVALID_STATE | Indicates the call was unsuccessful. |
Definition at line 33 of file iarmMgrMocks.cpp.
IARM_Result_t IARM_Bus_Disconnect | ( | void | ) |
This API disconnect Application from IARM Bus so the application will not receive any IARM event or RPC calls.
IARM_RESULT_SUCCESS | Indicates the call was successful. |
IARM_RESULT_INVALID_STATE | Indicates the call was unsuccessful. |
IARM_Result_t IARM_Bus_GetContext | ( | void ** | context | ) |
Returns group context of the calling member.
IARM_RESULT_SUCCESS | on success |
IARM_Result_t IARM_Bus_BroadcastEvent | ( | const char * | ownerName, |
IARM_EventId_t | eventId, | ||
void * | data, | ||
size_t | len | ||
) |
This API is used to publish an Asynchronous event to all IARM client registered for this perticular event. Upon returns of this function, all the listeners are notified of the event.
[in] | ownerName | The IARM client that publishes/owns the broadcast event. |
[in] | eventId | The event id to publish. |
[in] | data | Data carried by this event. |
[in] | len | Length of the data parameter. |
IARM_RESULT_SUCCESS | Indicates the call was successful. |
IARM_RESULT_INVALID_STATE | Indicates the call was unsuccessful because the bus is either not initialised nor connected. |
IARM_RESULT_INVALID_PARAM | Indicates invalid parameter. |
IARM_Result_t IARM_Bus_IsConnected | ( | const char * | memberName, |
int * | isRegistered | ||
) |
This API is used to check if the current process is registered with IARM.
[in] | memberName | IARMBUS member whose registration status has to be checked. |
[out] | isRegistered | True if the specified process is still registered. |
IARM_RESULT_SUCCESS | Indicates the call was successful. |
IARM_RESULT_INVALID_PARAM | Indicates invalid input parameter. |
IARM_RESULT_IPCCORE_FAIL | Indicates failure of the underlying IPC. |
IARM_Result_t IARM_Bus_RegisterEventHandler | ( | const char * | ownerName, |
IARM_EventId_t | eventId, | ||
IARM_EventHandler_t | handler | ||
) |
This API register to listen to event and provide the callback function for event notification. Execution of the handler will not block the process sending the event.
The API checks for duplicate handlers so a same handler for same event and owner name will not be registered twice NULL handler is not allowed.
[in] | ownerName | The well-known name of the IARM client. |
[in] | eventId | The event to listen for. |
[in] | handler | The hander function to be called for event notification. |
IARM_RESULT_SUCCESS | Indicates the call was successful. |
IARM_RESULT_INVALID_PARAM | Indicates invalid input parameters. |
IARM_RESULT_INVALID_STATE | Indicates the IARM_Bus is either not initialised nor connected. |
IARM_RESULT_IPCCORE_FAIL | Indicates failure of the underlying IPC. |
IARM_RESULT_OOM | Indicates memory allocation failure. |
Definition at line 43 of file iarmMgrMocks.cpp.
IARM_Result_t IARM_Bus_UnRegisterEventHandler | ( | const char * | ownerName, |
IARM_EventId_t | eventId | ||
) |
This API is used to Remove ALL handlers registered for the given event. This API remove the all the event handlers. This API is not used to unregister a specific handler..
[in] | eventId | The event whose listener to be removed. |
[in] | ownerName | The well-known name of the application. |
IARM_RESULT_SUCCESS | Indicates the call was successful. |
IARM_RESULT_INVALID_PARAM | Indicates invalid input parameter was passed. |
IARM_RESULT_INVALID_STATE | Indicates the IARM_Bus is either not initialised nor connected. |
IARM_RESULT_IPCCORE_FAIL | Indicates underlying IPC failure. |
IARM_RESULT_OOM | Indicates memory allocation failure. |
IARM_Result_t IARM_Bus_RemoveEventHandler | ( | const char * | ownerName, |
IARM_EventId_t | eventId, | ||
IARM_EventHandler_t | handler | ||
) |
Remove specific handler registered for the given event.
This API remove the specific handlers.
[in] | ownerName | The well-known name of the application. |
[in] | eventId | The event whose listener to remove. |
[in] | handler | The event handler to remove. |
Definition at line 50 of file iarmMgrMocks.cpp.
IARM_Result_t IARM_Bus_RegisterCall | ( | const char * | methodName, |
IARM_BusCall_t | handler | ||
) |
This API is used to register an RPC method that can be invoked by other applications.
The parameter methodName is the string name used to invoke the RPC method and the parameter handler is the implementation of the RPC method. When other application invokes the method via its string name, the function pointed to by the handler is executed.
[in] | methodName | The name used to invoke the RPC method. |
[in] | handler | A pointer to RPC method implementation. |
IARM_RESULT_SUCCESS | Indicates the call was successful. |
IARM_RESULT_INVALID_PARAM | Indicates invalid parameter. |
IARM_RESULT_INVALID_STATE | Indicates IARM_Bus is either not initialised nor connected. |
IARM_RESULT_OOM | Indicates memory allocation failure. |
IARM_Result_t IARM_Bus_Call | ( | const char * | ownerName, |
const char * | methodName, | ||
void * | arg, | ||
size_t | argLen | ||
) |
This API is used to Invoke RPC method by its application name and method name.
[in] | ownerName | well-known name of the application that publish the RPC call. |
[in] | methodName | well-known name of the RPC method. |
[in] | arg | It is the data structure holding input & output parameters of the invocation. |
[in] | argLen | The size of the data pointed by arg parameter. |
IARM_RESULT_SUCCESS | Indicates the call was successful. |
IARM_RESULT_INVALID_PARAM | Indicates invalid input parameter. |
IARM_RESULT_INVALID_STATE | Indicates the IARM_Bus was either not initialised nor connected. |
IARM_RESULT_IPCCORE_FAIL | Indicates failure of the underlying IPC. |
IARM_RESULT_OOM | Indicates failure to allocate memory. |
Definition at line 57 of file iarm_bus.c.
IARM_Result_t IARM_Bus_Call_with_IPCTimeout | ( | const char * | ownerName, |
const char * | methodName, | ||
void * | arg, | ||
size_t | argLen, | ||
int | timeout | ||
) |
This API is used to Invoke RPC method by its application name and method name with specified timeout to wait for response.
[in] | ownerName | well-known name of the application that publish the RPC call. |
[in] | methodName | well-known name of the RPC method. |
[in] | arg | It is the data structure holding input & output parameters of the invocation. |
[in] | argLen | The size of the data pointed by arg parameter. |
[in] | timeout | in millisecond for the RPC method. |
IARM_RESULT_SUCCESS | Indicates the call was successful. |
IARM_RESULT_INVALID_PARAM | Indicates invalid input parameter. |
IARM_RESULT_INVALID_STATE | Indicates the IARM_Bus was either not initialised nor connected. |
IARM_RESULT_IPCCORE_FAIL | Indicates failure of the underlying IPC. |
IARM_RESULT_OOM | Indicates failure to allocate memory. |
IARM_Result_t IARM_Bus_RegisterEvent | ( | IARM_EventId_t | maxEventId | ) |
This API is used to register all the events that are published by the application.
An application can publish multiple events and these events must have an enumeration value defined in the public header file of the HAL. It registers all events whose enum value is less than maxEventId.
[in] | maxEventId | The maximum number of events that can be registered. |
IARM_RESULT_SUCCESS | Indicates the call was successful. |
IARM_RESULT_INVALID_STATE | Indicates the IARM Bus is either not initialised nor connected. |
void IARM_Bus_WritePIDFile | ( | const char * | path | ) |
Write PID file.
This API allows Daemon to write PID file
full | pathname to pidfile to write |