Snapdragon® Telematics Application Framework (TelAF) Interface Specification
|
#include "taf_someipClnt_interface.h"
#include "taf_someipClnt_messages.h"
#include "taf_someipClnt_service.h"
Data Structures | |
struct | _ClientThreadData_t |
Macros | |
#define | LOCK_INIT le_mutex_Lock(le_ifgen_InitMutexRef); |
Locks the mutex. More... | |
#define | UNLOCK_INIT le_mutex_Unlock(le_ifgen_InitMutexRef); |
Unlocks the mutex. More... | |
Variables | |
static le_mem_PoolRef_t | _ClientThreadDataPool |
static pthread_key_t | _ThreadDataKey |
static bool | CommonDataInitialized = false |
le_mutex_Ref_t | le_ifgen_InitMutexRef |
#define LOCK_INIT le_mutex_Lock(le_ifgen_InitMutexRef); |
Locks the mutex.
#define UNLOCK_INIT le_mutex_Unlock(le_ifgen_InitMutexRef); |
Unlocks the mutex.
LE_MEM_DEFINE_STATIC_POOL | ( | taf_someipClnt_ClientThreadData | , |
LE_CDATA_COMPONENT_COUNT | , | ||
sizeof(_ClientThreadData_t) | |||
) |
Static pool for client threads.
|
static |
Initialize thread specific data, and connect to the service for the current thread.
|
static |
Get a pointer to the client thread data for the current thread.
If the current thread does not have client data, then NULL is returned
__attribute__ | ( | (unused) | ) |
Return the sessionRef for the current thread.
If the current thread does not have a session ref, then this is a fatal error.
|
static |
Destructor function for client thread objects.
|
static |
Init data that is common across all threads.
|
static |
Connect to the service, using either blocking or non-blocking calls.
This function implements the details of the public ConnectService functions.
void taf_someipClnt_ConnectService | ( | void | ) |
Connect the current client thread to the service providing this API. Block until the service is available.
For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see apiFilesC_client.
This function is created automatically.
le_result_t taf_someipClnt_TryConnectService | ( | void | ) |
Try to connect the current client thread to the service providing this API. Return with an error if the service is not available.
For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see apiFilesC_client.
This function is created automatically.
|
static |
void taf_someipClnt_SetServerDisconnectHandler | ( | taf_someipClnt_DisconnectHandler_t | disconnectHandler, |
void * | contextPtr | ||
) |
Set handler called when server disconnection is detected.
When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants to continue without exiting, it should call longjmp() from inside the handler.
|
static |
void taf_someipClnt_SetNonExitServerDisconnectHandler | ( | taf_someipClnt_DisconnectHandler_t | disconnectHandler, |
void * | contextPtr | ||
) |
Set handler called when server disconnection is detected without exiting.
When a server connection is lost, call this handler without exit.
void taf_someipClnt_DisconnectService | ( | void | ) |
Disconnect the current client thread from the service providing this API.
Normally, this function doesn't need to be called. After this function is called, there's no longer a connection to the service, and the functions in this API can't be used. For details, see apiFilesC_client.
This function is created automatically.
uint16_t taf_someipClnt_GetClientId | ( | void | ) |
Gets the SOME/IP client ID of client-service-instance on default network interface.
le_result_t taf_someipClnt_GetClientIdEx | ( | const char *LE_NONNULL | ifName, |
uint16_t * | clientIdPtr | ||
) |
Gets the SOME/IP client ID of client-service-instance on a dedicated network interface. The ifName shall match the device name specified in one of the JSON files.
[in] | ifName | Network interface name. |
[out] | clientIdPtr | SOME/IP Client ID. |
taf_someipClnt_ServiceRef_t taf_someipClnt_RequestService | ( | uint16_t | serviceId, |
uint16_t | instanceId | ||
) |
Requests a client-service-instance on default network interface and returns the reference to the client-service-instance.
[in] | serviceId | Service ID. |
[in] | instanceId | Instance ID. |
taf_someipClnt_ServiceRef_t taf_someipClnt_RequestServiceEx | ( | uint16_t | serviceId, |
uint16_t | instanceId, | ||
const char *LE_NONNULL | ifName | ||
) |
Requests a client-service-instance on a dedicated network interface and returns the reference to the client-service-instance. The ifName shall match the device name specified in one of the JSON files.
[in] | serviceId | Service ID. |
[in] | instanceId | Instance ID. |
[in] | ifName | Network interface name. |
le_result_t taf_someipClnt_ReleaseService | ( | taf_someipClnt_ServiceRef_t | serviceRef | ) |
Releases a client-service-instance.
[in] | serviceRef | Service Reference. |
le_result_t taf_someipClnt_GetState | ( | taf_someipClnt_ServiceRef_t | serviceRef, |
taf_someipClnt_State_t * | statePtr | ||
) |
Gets the service state.
[in] | serviceRef | Service Reference. |
[out] | statePtr | Service State. |
le_result_t taf_someipClnt_GetVersion | ( | taf_someipClnt_ServiceRef_t | serviceRef, |
uint8_t * | majVerPtr, | ||
uint32_t * | minVerPtr | ||
) |
Gets the service version.
[in] | serviceRef | Service Reference. |
[out] | majVerPtr | Major Version. |
[out] | minVerPtr | Minor Version. |
taf_someipClnt_StateChangeHandlerRef_t taf_someipClnt_AddStateChangeHandler | ( | taf_someipClnt_ServiceRef_t | serviceRef, |
taf_someipClnt_StateChangeHandlerFunc_t | handlerPtr, | ||
void * | contextPtr | ||
) |
Add handler function for EVENT 'taf_someipClnt_StateChange'
This event provides information on the service state change.
[in] | serviceRef | Service Reference. |
[in] | handlerPtr | |
[in] | contextPtr |
void taf_someipClnt_RemoveStateChangeHandler | ( | taf_someipClnt_StateChangeHandlerRef_t | handlerRef | ) |
Remove handler function for EVENT 'taf_someipClnt_StateChange'
[in] | handlerRef |
taf_someipClnt_TxMsgRef_t taf_someipClnt_CreateMsg | ( | taf_someipClnt_ServiceRef_t | serviceRef, |
uint16_t | methodId | ||
) |
Creates a request message and sets the destination.
[in] | serviceRef | Service Reference. |
[in] | methodId | Method ID. |
le_result_t taf_someipClnt_SetNonRet | ( | taf_someipClnt_TxMsgRef_t | msgRef | ) |
Sets the request to a non-return-request(MT_REQUEST_NO_RETURN). By default, it is MT_REQUEST.
[in] | msgRef | Tx message reference. |
le_result_t taf_someipClnt_SetReliable | ( | taf_someipClnt_TxMsgRef_t | msgRef | ) |
Uses TCP to send the request. By default, it uses UDP.
[in] | msgRef | Tx message reference. |
le_result_t taf_someipClnt_SetTimeout | ( | taf_someipClnt_TxMsgRef_t | msgRef, |
uint32_t | timeOut | ||
) |
Sets the timeout in milliseconds for waiting for the response. By default, the timeout is 30000 ms. 0 means NEVER time out.
[in] | msgRef | Tx message reference. |
[in] | timeOut | Timeout in milliseconds. |
le_result_t taf_someipClnt_SetPayload | ( | taf_someipClnt_TxMsgRef_t | msgRef, |
const uint8_t * | dataPtr, | ||
size_t | dataSize | ||
) |
Sets the payload data of the request. By default, the payload is empty.
[in] | msgRef | Tx message reference. |
[in] | dataPtr | Payload data. |
[in] | dataSize |
le_result_t taf_someipClnt_DeleteMsg | ( | taf_someipClnt_TxMsgRef_t | msgRef | ) |
Deletes a request message.
[in] | msgRef | Tx message reference. |
void taf_someipClnt_RequestResponse | ( | taf_someipClnt_TxMsgRef_t | msgRef, |
taf_someipClnt_RespMsgHandlerFunc_t | handlerPtr, | ||
void * | contextPtr | ||
) |
Sends an asynchronous request message. The response handler will be called once the response is received or any errors occur.
NOTE: The request message will be automatically deleted after calling this API.
[in] | msgRef | Tx message reference. |
[in] | handlerPtr | Response message handler. |
[in] | contextPtr |
le_result_t taf_someipClnt_EnableEventGroup | ( | taf_someipClnt_ServiceRef_t | serviceRef, |
uint16_t | eventGroupId, | ||
uint16_t | eventId, | ||
taf_someipDef_EventType_t | eventType | ||
) |
Enables an event group by adding an event into the group.
NOTE: This API can be called multiple times if there is more than one event to be added into the group. Currently, one event can only be added into one group, and one event group can be enabled only by one client.
[in] | serviceRef | Service Reference. |
[in] | eventGroupId | Event Group ID. |
[in] | eventId | Event ID. |
[in] | eventType | Event Type. |
le_result_t taf_someipClnt_DisableEventGroup | ( | taf_someipClnt_ServiceRef_t | serviceRef, |
uint16_t | eventGroupId | ||
) |
Disables an event group and removes all events from the group.
[in] | serviceRef | Service Reference. |
[in] | eventGroupId | Event Group ID. |
le_result_t taf_someipClnt_SubscribeEventGroup | ( | taf_someipClnt_ServiceRef_t | serviceRef, |
uint16_t | eventGroupId | ||
) |
Subscribes an event group of a service.
[in] | serviceRef | Service Reference. |
[in] | eventGroupId | Event Group ID. |
le_result_t taf_someipClnt_UnsubscribeEventGroup | ( | taf_someipClnt_ServiceRef_t | serviceRef, |
uint16_t | eventGroupId | ||
) |
Unsubscribes an event group of a service.
[in] | serviceRef | Service Reference. |
[in] | eventGroupId | Event Group ID. |
taf_someipClnt_EventMsgHandlerRef_t taf_someipClnt_AddEventMsgHandler | ( | taf_someipClnt_ServiceRef_t | serviceRef, |
uint16_t | eventGroupId, | ||
taf_someipClnt_EventMsgHandlerFunc_t | handlerPtr, | ||
void * | contextPtr | ||
) |
Add handler function for EVENT 'taf_someipClnt_EventMsg'
This event provides information on an event message.
[in] | serviceRef | Service Reference. |
[in] | eventGroupId | Event Group ID. |
[in] | handlerPtr | Event Handler. |
[in] | contextPtr |
void taf_someipClnt_RemoveEventMsgHandler | ( | taf_someipClnt_EventMsgHandlerRef_t | handlerRef | ) |
Remove handler function for EVENT 'taf_someipClnt_EventMsg'
[in] | handlerRef |
|
static |
The memory pool for client thread objects
|
static |
Key under which the pointer to the Thread Object (_ClientThreadData_t) will be kept in thread-local storage. This allows a thread to quickly get a pointer to its own Thread Object.
|
static |
This global flag is shared by all client threads, and is used to indicate whether the common data has been initialized.
le_mutex_Ref_t le_ifgen_InitMutexRef |
Mutex and associated macros for use with the above CommonDataInitialized.