Snapdragon® Telematics Application Framework (TelAF) Interface Specification
taf_someipSvr_server.h File Reference
#include "legato.h"
#include "taf_someipDef_server.h"
#include "taf_someipSvr_common.h"

Go to the source code of this file.

Functions

le_msg_ServiceRef_t taf_someipSvr_GetServiceRef (void)
 
le_msg_SessionRef_t taf_someipSvr_GetClientSessionRef (void)
 
void taf_someipSvr_AdvertiseService (void)
 
taf_someipSvr_ServiceRef_t taf_someipSvr_GetService (uint16_t serviceId, uint16_t instanceId)
 
taf_someipSvr_ServiceRef_t taf_someipSvr_GetServiceEx (uint16_t serviceId, uint16_t instanceId, const char *LE_NONNULL ifName)
 
le_result_t taf_someipSvr_SetServiceVersion (taf_someipSvr_ServiceRef_t serviceRef, uint8_t majVer, uint32_t minVer)
 
le_result_t taf_someipSvr_SetServicePort (taf_someipSvr_ServiceRef_t serviceRef, uint16_t udpPort, uint16_t tcpPort, bool enableMagicCookies)
 
le_result_t taf_someipSvr_OfferService (taf_someipSvr_ServiceRef_t serviceRef)
 
le_result_t taf_someipSvr_StopOfferService (taf_someipSvr_ServiceRef_t serviceRef)
 
le_result_t taf_someipSvr_EnableEvent (taf_someipSvr_ServiceRef_t serviceRef, uint16_t eventId, uint16_t eventgroupId)
 
le_result_t taf_someipSvr_SetEventType (taf_someipSvr_ServiceRef_t serviceRef, uint16_t eventId, taf_someipDef_EventType_t eventType)
 
le_result_t taf_someipSvr_SetEventCycleTime (taf_someipSvr_ServiceRef_t serviceRef, uint16_t eventId, uint32_t cycleTime)
 
le_result_t taf_someipSvr_DisableEvent (taf_someipSvr_ServiceRef_t serviceRef, uint16_t eventId)
 
le_result_t taf_someipSvr_OfferEvent (taf_someipSvr_ServiceRef_t serviceRef, uint16_t eventId)
 
le_result_t taf_someipSvr_StopOfferEvent (taf_someipSvr_ServiceRef_t serviceRef, uint16_t eventId)
 
le_result_t taf_someipSvr_Notify (taf_someipSvr_ServiceRef_t serviceRef, uint16_t eventId, const uint8_t *dataPtr, size_t dataSize)
 
taf_someipSvr_RxMsgHandlerRef_t taf_someipSvr_AddRxMsgHandler (taf_someipSvr_ServiceRef_t serviceRef, taf_someipSvr_RxMsgHandlerFunc_t handlerPtr, void *contextPtr)
 
void taf_someipSvr_RemoveRxMsgHandler (taf_someipSvr_RxMsgHandlerRef_t handlerRef)
 
taf_someipSvr_SubscriptionHandlerRef_t taf_someipSvr_AddSubscriptionHandler (taf_someipSvr_ServiceRef_t serviceRef, uint16_t eventGroupId, taf_someipSvr_SubscriptionHandlerFunc_t handlerPtr, void *contextPtr)
 
void taf_someipSvr_RemoveSubscriptionHandler (taf_someipSvr_SubscriptionHandlerRef_t handlerRef)
 
le_result_t taf_someipSvr_GetServiceId (taf_someipSvr_RxMsgRef_t msgRef, uint16_t *serviceIdPtr, uint16_t *instanceIdPtr)
 
le_result_t taf_someipSvr_GetMethodId (taf_someipSvr_RxMsgRef_t msgRef, uint16_t *methodIdPtr)
 
le_result_t taf_someipSvr_GetClientId (taf_someipSvr_RxMsgRef_t msgRef, uint16_t *clientIdPtr)
 
le_result_t taf_someipSvr_GetMsgType (taf_someipSvr_RxMsgRef_t msgRef, uint8_t *msgTypePtr)
 
le_result_t taf_someipSvr_GetPayloadSize (taf_someipSvr_RxMsgRef_t msgRef, uint32_t *payloadSizePtr)
 
le_result_t taf_someipSvr_GetPayloadData (taf_someipSvr_RxMsgRef_t msgRef, uint8_t *dataPtr, size_t *dataSizePtr)
 
le_result_t taf_someipSvr_SendResponse (taf_someipSvr_RxMsgRef_t msgRef, bool isErrRsp, uint8_t returnCode, const uint8_t *dataPtr, size_t dataSize)
 
le_result_t taf_someipSvr_ReleaseRxMsg (taf_someipSvr_RxMsgRef_t msgRef)
 

Function Documentation

◆ taf_someipSvr_GetServiceRef()

le_msg_ServiceRef_t taf_someipSvr_GetServiceRef ( void  )

Get the server service reference

◆ taf_someipSvr_GetClientSessionRef()

le_msg_SessionRef_t taf_someipSvr_GetClientSessionRef ( void  )

Get the client session reference for the current message

◆ taf_someipSvr_AdvertiseService()

void taf_someipSvr_AdvertiseService ( void  )

Initialize the server and advertise the service.

◆ taf_someipSvr_GetService()

taf_someipSvr_ServiceRef_t taf_someipSvr_GetService ( uint16_t  serviceId,
uint16_t  instanceId 
)

Reference to the server-service-instance, SOME/IP gateway uses it to offer the specified service through SOME/IP-SD multicast message. Reference to a message received(message type can be MT_REQUEST/MT_REQUEST_NO_RETURN). Handler for a Rx message. Reference type used by Add/Remove functions for EVENT 'taf_someipSvr_RxMsg' Handler for the event group subscription status. Reference type used by Add/Remove functions for EVENT 'taf_someipSvr_Subscription' Gets the reference to a server-service-instance on default network interface.

Returns
  • Reference to the service instance.
  • NULL if not allowed to represent the service.

Gets the reference to a server-service-instance on default network interface.

Returns
  • Reference to the service instance.
  • NULL if not allowed to represent the service.
Parameters
[in]serviceIdService ID.
[in]instanceIdInstance ID.

◆ taf_someipSvr_GetServiceEx()

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.

Returns
  • Reference to the service instance.
  • NULL if not allowed to represent the service.
Parameters
[in]serviceIdService ID.
[in]instanceIdInstance ID.
[in]ifNameNetwork interface name.

◆ taf_someipSvr_SetServiceVersion()

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.

Returns
  • LE_OK – Succeeded.
  • LE_BAD_PARAMETER – Invalid serviceRef.
  • LE_NOT_PERMITTED – The service is not set up by the client or already offered.
Parameters
[in]serviceRefService Reference.
[in]majVerMajor Version.
[in]minVerMinor Version.

◆ taf_someipSvr_SetServicePort()

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.

Returns
  • LE_OK – Succeeded.
  • LE_BAD_PARAMETER – Invalid serviceRef.
  • LE_NOT_PERMITTED – The service is not set up by the client or already offered.
Parameters
[in]serviceRefService Reference.
[in]udpPortSet up an UDP server with the given UDP port for the
[in]tcpPortSet up an TCP server with the given TCP port for the
[in]enableMagicCookiesIf TCP magic cookie is enabled when TCP server is set

◆ taf_someipSvr_OfferService()

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.

Returns
  • LE_OK – Succeeded.
  • LE_BAD_PARAMETER – Invalid serviceRef.
  • LE_NOT_PERMITTED – The service is not set up by the client.
  • LE_DUPLICATE – The service is already offered.
Parameters
[in]serviceRefService Reference.

◆ taf_someipSvr_StopOfferService()

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.

Returns
  • LE_OK – Succeeded.
  • LE_BAD_PARAMETER – Invalid serviceRef.
  • LE_NOT_PERMITTED – The service is not set up by the client.
  • LE_DUPLICATE – The service is already stopped.
Parameters
[in]serviceRefService Reference.

◆ taf_someipSvr_EnableEvent()

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.

Returns
  • LE_OK – Succeeded.
  • LE_BAD_PARAMETER – Invalid serviceRef.
  • LE_NOT_PERMITTED – The service is not set up by the client or if the event is already offered.
Parameters
[in]serviceRefService Reference.
[in]eventIdEvent ID, valid range: 0x8001 to 0xFFFE.
[in]eventgroupIdEvent Group ID, valid range: 0x0001 to 0xFFFE.

◆ taf_someipSvr_SetEventType()

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.

Returns
  • LE_OK – Succeeded.
  • LE_BAD_PARAMETER – Invalid serviceRef.
  • LE_NOT_PERMITTED – The service is not set up by the client or if the event is already offered.
Parameters
[in]serviceRefService Reference.
[in]eventIdEvent ID.
[in]eventTypeEvent Type.

◆ taf_someipSvr_SetEventCycleTime()

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.

Returns
  • LE_OK – Succeeded.
  • LE_BAD_PARAMETER – Invalid serviceRef.
  • LE_NOT_PERMITTED – The service is not set up by the client or the event is already offered or not ET_EVENT type.
Parameters
[in]serviceRefService Reference.
[in]eventIdEvent ID.
[in]cycleTimeCycle Time in milliseconds.

◆ taf_someipSvr_DisableEvent()

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.

Returns
  • LE_OK – Succeeded.
  • LE_BAD_PARAMETER – Invalid serviceRef.
  • LE_NOT_PERMITTED – The service is not set up by the client or if the event is already offered.
Parameters
[in]serviceRefService Reference.
[in]eventIdEvent ID.

◆ taf_someipSvr_OfferEvent()

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.

Returns
  • LE_OK – Succeeded.
  • LE_BAD_PARAMETER – Invalid serviceRef.
  • LE_NOT_PERMITTED – The service is not set up by the client or not offered, or the event is not enabled.
  • LE_DUPLICATE – The event is already offered.
Parameters
[in]serviceRefService Reference.
[in]eventIdEvent ID.

◆ taf_someipSvr_StopOfferEvent()

le_result_t taf_someipSvr_StopOfferEvent ( taf_someipSvr_ServiceRef_t  serviceRef,
uint16_t  eventId 
)

Stops offering an event for a server-service-instance.

Returns
  • LE_OK – Succeeded.
  • LE_BAD_PARAMETER – Invalid serviceRef.
  • LE_NOT_PERMITTED – The service is not set up by the client or not offered, or the event is not enabled.
  • LE_DUPLICATE – The event is already stopped.
Parameters
[in]serviceRefService Reference.
[in]eventIdEvent ID.

◆ taf_someipSvr_Notify()

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().

Returns
  • LE_OK – Succeeded.
  • LE_BAD_PARAMETER – Invalid serviceRef.
  • LE_NOT_PERMITTED – The service is not set up by the client or not offered, or the event is not enabled or not offered.
Parameters
[in]serviceRefService Reference.
[in]eventIdEvent ID.
[in]dataPtrPayload Data.
[in]dataSize

◆ taf_someipSvr_AddRxMsgHandler()

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.

Parameters
[in]serviceRefService Reference.
[in]handlerPtr
[in]contextPtr

◆ taf_someipSvr_RemoveRxMsgHandler()

void taf_someipSvr_RemoveRxMsgHandler ( taf_someipSvr_RxMsgHandlerRef_t  handlerRef)

Remove handler function for EVENT 'taf_someipSvr_RxMsg'

Parameters
[in]handlerRef

◆ taf_someipSvr_AddSubscriptionHandler()

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.

Parameters
[in]serviceRefService Reference.
[in]eventGroupIdEvent Group ID.
[in]handlerPtr
[in]contextPtr

◆ taf_someipSvr_RemoveSubscriptionHandler()

void taf_someipSvr_RemoveSubscriptionHandler ( taf_someipSvr_SubscriptionHandlerRef_t  handlerRef)

Remove handler function for EVENT 'taf_someipSvr_Subscription'

Parameters
[in]handlerRef

◆ taf_someipSvr_GetServiceId()

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.

Returns
  • LE_OK – Succeeded.
  • LE_BAD_PARAMETER – Invalid msgRef.
Parameters
[in]msgRefRx Message Reference.
[out]serviceIdPtrService ID.
[out]instanceIdPtrInstance ID.

◆ taf_someipSvr_GetMethodId()

le_result_t taf_someipSvr_GetMethodId ( taf_someipSvr_RxMsgRef_t  msgRef,
uint16_t *  methodIdPtr 
)

Gets the method ID of the Rx message.

Returns
  • LE_OK – Succeeded.
  • LE_BAD_PARAMETER – Invalid msgRef.
Parameters
[in]msgRefRx Message reference.
[out]methodIdPtrMethod ID.

◆ taf_someipSvr_GetClientId()

le_result_t taf_someipSvr_GetClientId ( taf_someipSvr_RxMsgRef_t  msgRef,
uint16_t *  clientIdPtr 
)

Gets the client ID of the Rx message.

Returns
  • LE_OK – Succeeded.
  • LE_BAD_PARAMETER – Invalid msgRef.
Parameters
[in]msgRefRx Message reference.
[out]clientIdPtrClient ID.

◆ taf_someipSvr_GetMsgType()

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).

Returns
  • LE_OK – Succeeded.
  • LE_BAD_PARAMETER – Invalid msgRef.
Parameters
[in]msgRefRx Message reference.
[out]msgTypePtrMessage Type.

◆ taf_someipSvr_GetPayloadSize()

le_result_t taf_someipSvr_GetPayloadSize ( taf_someipSvr_RxMsgRef_t  msgRef,
uint32_t *  payloadSizePtr 
)

Gets the payload size of the Rx message.

Returns
  • LE_OK – Succeeded.
  • LE_BAD_PARAMETER – Invalid msgRef.
Parameters
[in]msgRefRx Message reference.
[out]payloadSizePtrPayload Size in bytes.

◆ taf_someipSvr_GetPayloadData()

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.

Returns
  • LE_OK – Succeeded.
  • LE_BAD_PARAMETER – Invalid msgRef.
Parameters
[in]msgRefRx Message reference.
[out]dataPtrPayload Data.
[in,out]dataSizePtr

◆ taf_someipSvr_SendResponse()

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.

Returns
  • LE_OK – Succeeded.
  • LE_BAD_PARAMETER – Invalid msgRef.
  • LE_NOT_PERMITTED – The msgRef is not a MT_REQUEST message, or the response message type is MT_ERROR(0x81) with returnCode E_OK(0x00), or the service of the msgRef is not set up by the client or not offered.
Parameters
[in]msgRefRx Message reference.
[in]isErrRspTrue with message type MT_ERROR(0x81),
[in]returnCodeReturn Code.
[in]dataPtrPayload Data.
[in]dataSize

◆ taf_someipSvr_ReleaseRxMsg()

le_result_t taf_someipSvr_ReleaseRxMsg ( taf_someipSvr_RxMsgRef_t  msgRef)

Releases a Rx message.

Returns
  • LE_OK – Succeeded.
  • LE_BAD_PARAMETER – Invalid msgRef or invalid service of the msgRef.
  • LE_NOT_PERMITTED – The service of the msgRef is not set up by the client.
Parameters
[in]msgRefRx Message reference.