Snapdragon® Telematics Application Framework (TelAF) Interface Specification
Diag Data ID Service

API Reference


The diag DataID service APIs are part of the diagnostic service. The DataID service provides ReadDataByIdentifier(0x22) and WriteDataByIdentifier(0x2E) service. The ReadDataByIdentifier(0x22) service allows the client to request data record values from the server identified by one or more data identifiers, and the WriteDataByIdentifier(0x2E) service allows the client to write information into the server at an internal location specified by the provided data identifier.

IPC interfaces binding

The functions of this API are provided by the tafDiagSvc platform service.

The following example illustrates how to bind to the diag DataID service.

bindings:
{
     clientExe.clientComponent.taf_diagDataID -> tafDiagSvc.taf_diagDataID
}

Server Service APIs

A diag DataID service reference should be got using taf_diagDataID_GetService(). Use the returned reference for subsequent operations.

The following example illustrates how to set up a diag DataID server-service-instance.

taf_diagDataID_ServiceRef_t svcRef; // Service reference
// Get the service reference.
LE_ASSERT(svcRef != NULL);

ReadDataByIdentifier(0x22) service

After getting the service reference, an application can call taf_diagDataID_AddRxReadDIDMsgHandler() to register a message handler for ReadDataByIdentifier(0x22) service. Once a ReadDataByIdentifier service request message is received, the handler will be called with the message reference and data identifier passed as input parameters. The application will read the data record for requested DID and uses the message reference to send a response message using taf_diagDataID_SendReadDIDResp().

// Rx message handler function.
void RxReadDIDHandler
(
const uint16_t* dataIdPtr,
size_t dataIdSize,
void* contextPtr
)
{
// Process after succesfully receiving message
}
// Register the message handler.
(taf_diagDataID_RxReadDIDMsgHandlerFunc_t)RxReadDIDHandler, NULL);
LE_ASSERT(RxReadDIDMsgHandlerRef != NULL);
// To remove the handler function, when it is not needed.
// To send ReadDataByIdentifier response.
TAF_DIAGDATAID_READ_DID_NO_ERROR, data, sizeof(data));
if (result != LE_OK)
{
LE_ERROR("Fail to send response.");
return result;
}

WriteDataByIdentifier(0x2E) service

After getting the service reference, an application can call taf_diagDataID_AddRxWriteDIDMsgHandler() to register a message handler for WriteDataByIdentifier(0x2E) service. Once a WriteDataByIdentifier service request message is received, the handler will be called with the message reference and data identifier passed as input parameters. The application will get the request data record using taf_diagDataID_GetWriteDataRecord() and uses the message reference to send a response message using taf_diagDataID_SendReadDIDResp().

// Rx message handler function.
void RxWriteDIDHandler
(
uint16_t dataId,
void* contextPtr
)
{
// Process after succesfully receiving message
}
// Register the message handler.
(taf_diagDataID_RxWriteDIDMsgHandlerFunc_t)RxWriteDIDHandler, NULL);
LE_ASSERT(RxWriteDIDMsgHandlerRef != NULL);
// To remove the handler function, when it is not needed.
// To get the WriteDataByIdentifier data record.
taf_diagDataID_GetWriteDataRecord(): Gets the data record.
// To send WriteDataByIdentifier response.
if (result != LE_OK)
{
LE_ERROR("Fail to send response.");
return result;
}

An application can remove the Data ID server service by calling taf_diagDataID_RemoveSvc().