Snapdragon® Telematics Application Framework (TelAF) Interface Specification
|
#include "taf_someipSvr_interface.h"
#include "taf_someipSvr_messages.h"
#include "taf_someipSvr_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_someipSvr_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_someipSvr_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_someipSvr_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_someipSvr_SetServerDisconnectHandler | ( | taf_someipSvr_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_someipSvr_SetNonExitServerDisconnectHandler | ( | taf_someipSvr_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_someipSvr_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.
taf_someipSvr_ServiceRef_t taf_someipSvr_GetService | ( | uint16_t | serviceId, |
uint16_t | instanceId | ||
) |
Gets the reference to a server-service-instance on default network interface.
[in] | serviceId | Service ID. |
[in] | instanceId | Instance ID. |
taf_someipSvr_ServiceRef_t taf_someipSvr_GetServiceEx | ( | uint16_t | serviceId, |
uint16_t | instanceId, | ||
const char *LE_NONNULL | ifName | ||
) |
Gets the reference to a server-service-instance on a dedicated network interface. 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_someipSvr_SetServiceVersion | ( | taf_someipSvr_ServiceRef_t | serviceRef, |
uint8_t | majVer, | ||
uint32_t | minVer | ||
) |
Sets the major and minor version for the server-service-instance. The default major version is 0x00, the minor version is 0x00000000.
NOTE: This API must be called before OfferService() if needed.
[in] | serviceRef | Service Reference. |
[in] | majVer | Major Version. |
[in] | minVer | Minor Version. |
le_result_t taf_someipSvr_SetServicePort | ( | taf_someipSvr_ServiceRef_t | serviceRef, |
uint16_t | udpPort, | ||
uint16_t | tcpPort, | ||
bool | enableMagicCookies | ||
) |
Sets up an UDP server and/or a TCP server with given port(s) for the server-service-instance.
NOTE: This API must be called before OfferService() if needed.
[in] | serviceRef | Service Reference. |
[in] | udpPort | Set up an UDP server with the given UDP port for the |
[in] | tcpPort | Set up an TCP server with the given TCP port for the |
[in] | enableMagicCookies | If TCP magic cookie is enabled when TCP server is set |
le_result_t taf_someipSvr_OfferService | ( | taf_someipSvr_ServiceRef_t | serviceRef | ) |
Offers a server-service-instance. The TCP port or/and UDP port must be set if the service need to be offered remotely, otherwise it's only offered locally.
[in] | serviceRef | Service Reference. |
le_result_t taf_someipSvr_StopOfferService | ( | taf_someipSvr_ServiceRef_t | serviceRef | ) |
Stops offering a server-service-instance. It also stops offering all events of the service.
[in] | serviceRef | Service Reference. |
le_result_t taf_someipSvr_EnableEvent | ( | taf_someipSvr_ServiceRef_t | serviceRef, |
uint16_t | eventId, | ||
uint16_t | eventgroupId | ||
) |
Enables an event by adding it to an event group.
NOTE: This API must be called before offerEvent() and can be called for multiple times if the event need to be added into more than one event groups.
[in] | serviceRef | Service Reference. |
[in] | eventId | Event ID, valid range: 0x8001 to 0xFFFE. |
[in] | eventgroupId | Event Group ID, valid range: 0x0001 to 0xFFFE. |
le_result_t taf_someipSvr_SetEventType | ( | taf_someipSvr_ServiceRef_t | serviceRef, |
uint16_t | eventId, | ||
taf_someipDef_EventType_t | eventType | ||
) |
Sets the event type for an event of a service.
NOTE: The default event type is ET_EVENT and the API must be called before OfferEvent() if needed.
[in] | serviceRef | Service Reference. |
[in] | eventId | Event ID. |
[in] | eventType | Event Type. |
le_result_t taf_someipSvr_SetEventCycleTime | ( | taf_someipSvr_ServiceRef_t | serviceRef, |
uint16_t | eventId, | ||
uint32_t | cycleTime | ||
) |
Sets the cycle time for an periodic event notification(ET_EVENT) of a service. By default the cycle time is 0 which means periodic event notification is disabled.
NOTE: This API has no effect for field notification(ET_FIELD) and must be called before OfferEvent() if needed.
[in] | serviceRef | Service Reference. |
[in] | eventId | Event ID. |
[in] | cycleTime | Cycle Time in milliseconds. |
le_result_t taf_someipSvr_DisableEvent | ( | taf_someipSvr_ServiceRef_t | serviceRef, |
uint16_t | eventId | ||
) |
Disables an event by removing it from all added event groups.
NOTE: This API must be called before OfferEvent() if needed.
[in] | serviceRef | Service Reference. |
[in] | eventId | Event ID. |
le_result_t taf_someipSvr_OfferEvent | ( | taf_someipSvr_ServiceRef_t | serviceRef, |
uint16_t | eventId | ||
) |
Offers an event which is enabled for a server-service-instance.
NOTE: This API must be called after OfferService() and EnableEvent() if needed.
[in] | serviceRef | Service Reference. |
[in] | eventId | Event ID. |
le_result_t taf_someipSvr_StopOfferEvent | ( | taf_someipSvr_ServiceRef_t | serviceRef, |
uint16_t | eventId | ||
) |
Stops offering an event for a server-service-instance.
[in] | serviceRef | Service Reference. |
[in] | eventId | Event ID. |
le_result_t taf_someipSvr_Notify | ( | taf_someipSvr_ServiceRef_t | serviceRef, |
uint16_t | eventId, | ||
const uint8_t * | dataPtr, | ||
size_t | dataSize | ||
) |
Fires an event or field notification. The specified event is updated with the specified payload Data. Dependent on the type of the event, the payload is distributed to all notified clients (always for events, only if the payload has changed for fields).
NOTE: This API is only available after offerService() and OfferEvent().
[in] | serviceRef | Service Reference. |
[in] | eventId | Event ID. |
[in] | dataPtr | Payload Data. |
[in] | dataSize |
taf_someipSvr_RxMsgHandlerRef_t taf_someipSvr_AddRxMsgHandler | ( | taf_someipSvr_ServiceRef_t | serviceRef, |
taf_someipSvr_RxMsgHandlerFunc_t | handlerPtr, | ||
void * | contextPtr | ||
) |
Add handler function for EVENT 'taf_someipSvr_RxMsg'
This event provides information on Rx message.
[in] | serviceRef | Service Reference. |
[in] | handlerPtr | |
[in] | contextPtr |
void taf_someipSvr_RemoveRxMsgHandler | ( | taf_someipSvr_RxMsgHandlerRef_t | handlerRef | ) |
Remove handler function for EVENT 'taf_someipSvr_RxMsg'
[in] | handlerRef |
taf_someipSvr_SubscriptionHandlerRef_t taf_someipSvr_AddSubscriptionHandler | ( | taf_someipSvr_ServiceRef_t | serviceRef, |
uint16_t | eventGroupId, | ||
taf_someipSvr_SubscriptionHandlerFunc_t | handlerPtr, | ||
void * | contextPtr | ||
) |
Add handler function for EVENT 'taf_someipSvr_Subscription'
This event provides information on the event group subscription status.
[in] | serviceRef | Service Reference. |
[in] | eventGroupId | Event Group ID. |
[in] | handlerPtr | |
[in] | contextPtr |
void taf_someipSvr_RemoveSubscriptionHandler | ( | taf_someipSvr_SubscriptionHandlerRef_t | handlerRef | ) |
Remove handler function for EVENT 'taf_someipSvr_Subscription'
[in] | handlerRef |
le_result_t taf_someipSvr_GetServiceId | ( | taf_someipSvr_RxMsgRef_t | msgRef, |
uint16_t * | serviceIdPtr, | ||
uint16_t * | instanceIdPtr | ||
) |
Gets the service ID and Instance ID of the Rx Message.
[in] | msgRef | Rx Message Reference. |
[out] | serviceIdPtr | Service ID. |
[out] | instanceIdPtr | Instance ID. |
le_result_t taf_someipSvr_GetMethodId | ( | taf_someipSvr_RxMsgRef_t | msgRef, |
uint16_t * | methodIdPtr | ||
) |
Gets the method ID of the Rx message.
[in] | msgRef | Rx Message reference. |
[out] | methodIdPtr | Method ID. |
le_result_t taf_someipSvr_GetClientId | ( | taf_someipSvr_RxMsgRef_t | msgRef, |
uint16_t * | clientIdPtr | ||
) |
Gets the client ID of the Rx message.
[in] | msgRef | Rx Message reference. |
[out] | clientIdPtr | Client ID. |
le_result_t taf_someipSvr_GetMsgType | ( | taf_someipSvr_RxMsgRef_t | msgRef, |
uint8_t * | msgTypePtr | ||
) |
Gets the message type of the Rx message. The possible message type can be MT_REQUEST(0x00) or MT_REQUEST_NO_RETURN(0x01).
[in] | msgRef | Rx Message reference. |
[out] | msgTypePtr | Message Type. |
le_result_t taf_someipSvr_GetPayloadSize | ( | taf_someipSvr_RxMsgRef_t | msgRef, |
uint32_t * | payloadSizePtr | ||
) |
Gets the payload size of the Rx message.
[in] | msgRef | Rx Message reference. |
[out] | payloadSizePtr | Payload Size in bytes. |
le_result_t taf_someipSvr_GetPayloadData | ( | taf_someipSvr_RxMsgRef_t | msgRef, |
uint8_t * | dataPtr, | ||
size_t * | dataSizePtr | ||
) |
Gets the payload data of the Rx message.
[in] | msgRef | Rx Message reference. |
[out] | dataPtr | Payload Data. |
[in,out] | dataSizePtr |
le_result_t taf_someipSvr_SendResponse | ( | taf_someipSvr_RxMsgRef_t | msgRef, |
bool | isErrRsp, | ||
uint8_t | returnCode, | ||
const uint8_t * | dataPtr, | ||
size_t | dataSize | ||
) |
Sends a response message for a Rx message. The Rx message is automatically freed after sending the response successfully.
NOTE: Only the message type MT_REQUEST(0x00) is allowed to send a response.
[in] | msgRef | Rx Message reference. |
[in] | isErrRsp | True with message type MT_ERROR(0x81), |
[in] | returnCode | Return Code. |
[in] | dataPtr | Payload Data. |
[in] | dataSize |
le_result_t taf_someipSvr_ReleaseRxMsg | ( | taf_someipSvr_RxMsgRef_t | msgRef | ) |
Releases a Rx message.
[in] | msgRef | Rx Message reference. |
|
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.