# Diag Update Service

- [API reference](https://docs.qualcomm.com/doc/80-41102-2/topic/_doxygen_rst_file__doxygen_sources_taf_diagUpdate_interface_h.html#file-taf-diagupdate-interface-h)

The diag update service APIs are used by applications to handle transfer requests from UDS clients. The diag update service includes the TransferData(0x36), RequestTransferExit(0x37), and RequestFileTransfer(0x38) services.

## IPC interfaces binding

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

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

bindings:
    {
         clientExe.clientComponent.taf_diagUpdate -> tafDiagSvc.taf_diagUpdate
    }
    Copy to clipboard

## Server-service APIs

A diag update service reference can be got using [taf\_diagUpdate\_GetService()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a2b3c9fb78fcfc782cdc25389f1956423.html#Documentationa00446_1a2b3c9fb78fcfc782cdc25389f1956423). Use the returned reference for subsequent operations.

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

taf_diagUpdate_ServiceRef_t diagUpdateSvcRef;    // Service reference
    
    // Get the service reference.
    diagUpdateSvcRef = taf_diagUpdate_GetService();
    LE_ASSERT(svcRef != NULL);
    Copy to clipboard

## Set/get VLAN ID

After getting a service reference, an application can set VLAN ID to the service to filter RequestFileTransfer/TransferData/RequestTransferExit requests using [taf\_diagUpdate\_SetVlanId()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a62ae9d7f44a554db9b82690c2134dea5.html#Documentationa00446_1a62ae9d7f44a554db9b82690c2134dea5). It shall be called before registering the handler for the TransferData(0x36), RequestTransferExit(0x37), and RequestFileTransfer(0x38) request messages. An application can get the VLAN ID of the request message using [taf\_diagUpdate\_GetVlanIdFromMsg()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a622d6bf3c9076cf8edd174bcdcf0794a.html#Documentationa00446_1a622d6bf3c9076cf8edd174bcdcf0794a).

- [taf\_diagUpdate\_SetVlanId()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a62ae9d7f44a554db9b82690c2134dea5.html#Documentationa00446_1a62ae9d7f44a554db9b82690c2134dea5) — Sets the VLAN ID.
- [taf\_diagUpdate\_GetVlanIdFromMsg()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a622d6bf3c9076cf8edd174bcdcf0794a.html#Documentationa00446_1a622d6bf3c9076cf8edd174bcdcf0794a) — Gets the VLAN ID of the request message.

## Request file transfer

After getting a reference, an application registers a file transfer handler using [taf\_diagUpdate\_AddRxFileXferMsgHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1ad050cc4f91ed5b34692a0be68f2043fe.html#Documentationa00446_1ad050cc4f91ed5b34692a0be68f2043fe). Once a file transfer request message is received, the handler will be called indicating the new message.

diagFileXferMsgRef = taf_diagUpdate_AddRxFileXferMsgHandler( diagUpdateSvcRef,
             fileXferMsgHandler, NULL );
    Copy to clipboard

An application can get a file path and name, and length by using [taf\_diagUpdate\_GetFilePathAndName()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a0c7869c95c20e4c778d89e81301d3a0e.html#Documentationa00446_1a0c7869c95c20e4c778d89e81301d3a0e).

result = taf_diagUpdate_GetFilePathAndName( rxMsgRef,
             (uint8_t *)filePathAndName, &fileLen );
    if (result != LE_OK)
    {
         LE_ERROR("Fail to get file path and name, and length.");
         return result;
    }
    Copy to clipboard

An application can set the file position by using [taf\_diagUpdate\_SetFilePosition()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a25bd1bf74402f22855a68e9241ddbbd7.html#Documentationa00446_1a25bd1bf74402f22855a68e9241ddbbd7).

result = taf_diagUpdate_SetFilePosition(rxMsgRef, sizeOfFilePosition);
    if (result != LE_OK)
    {
         LE_ERROR("Fail to set file position as response: %d", result);
         return result;
    }
    Copy to clipboard

An application can set the file size or directory information length by using [taf\_diagUpdate\_SetFileSizeOrDirInfoLength()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1ab70b4187c5c3287dcc0764888a4053c5.html#Documentationa00446_1ab70b4187c5c3287dcc0764888a4053c5).

result = taf_diagUpdate_SetFileSizeOrDirInfoLength(rxMsgRef,
                                                       fileSizeUncompressedOrDirInfoLength,
                                                       fileSizeCompressed);
    if (result != LE_OK)
    {
         LE_ERROR("Fail to set file size or dir info len as response: %d", result);
         return result;
    }
    Copy to clipboard

An application can send a file transfer response by using [taf\_diagUpdate\_SendFileXferResp()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1ab7b21dee6f4cf636820507d69cfc4b2b.html#Documentationa00446_1ab7b21dee6f4cf636820507d69cfc4b2b).

result = taf_diagUpdate_SendFileXferResp(rxMsgRef, TAF_DIAGUPDATE_FILE_XFER_NO_ERROR);
    if (result != LE_OK)
    {
         LE_ERROR("Fail to send response.");
         return result;
    }
    Copy to clipboard

The following APIs are provided for request file transfer.

- [taf\_diagUpdate\_AddRxFileXferMsgHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1ad050cc4f91ed5b34692a0be68f2043fe.html#Documentationa00446_1ad050cc4f91ed5b34692a0be68f2043fe) — Adds a handler function for the specified event.
- [taf\_diagUpdate\_RemoveRxFileXferMsgHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a615b91aae0b175d60ea6847967fd69d0.html#Documentationa00446_1a615b91aae0b175d60ea6847967fd69d0) — Removes a handler function for the specified event.
- [taf\_diagUpdate\_GetFilePathAndName()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a0c7869c95c20e4c778d89e81301d3a0e.html#Documentationa00446_1a0c7869c95c20e4c778d89e81301d3a0e) — Gets the file path and name.
- [taf\_diagUpdate\_GetDataFormatID()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1aeaac02bd39fdb7023d7d87596250acfb.html#Documentationa00446_1aeaac02bd39fdb7023d7d87596250acfb) — Gets the data format ID.
- [taf\_diagUpdate\_GetUnCompFileSize()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a231b0e805d60af9a90179469c7c6dd7a.html#Documentationa00446_1a231b0e805d60af9a90179469c7c6dd7a) — Gets the size of the uncompressed file.
- [taf\_diagUpdate\_GetCompFileSize()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1ab590a1fe442c60e8af12e99458ade703.html#Documentationa00446_1ab590a1fe442c60e8af12e99458ade703) — Gets the size of the compressed file.
- [taf\_diagUpdate\_SetFilePosition()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a25bd1bf74402f22855a68e9241ddbbd7.html#Documentationa00446_1a25bd1bf74402f22855a68e9241ddbbd7) — Set the file position into a response message.
- [taf\_diagUpdate\_SetFileSizeOrDirInfoLength()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1ab70b4187c5c3287dcc0764888a4053c5.html#Documentationa00446_1ab70b4187c5c3287dcc0764888a4053c5) — Set the file size or directory info length into a response message.
- [taf\_diagUpdate\_SendFileXferResp()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1ab7b21dee6f4cf636820507d69cfc4b2b.html#Documentationa00446_1ab7b21dee6f4cf636820507d69cfc4b2b) — Sends a response message for the file transfer message.

## Transfer data

An application registers a transfer data handler using [taf\_diagUpdate\_AddRxXferDataMsgHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1ad9d85340d6896bc2c44fd73ede013581.html#Documentationa00446_1ad9d85340d6896bc2c44fd73ede013581). Once a transfer data request message is received, the handler will be called indicating the new message.

diagXferDataMsgRef = taf_diagUpdate_AddRxXferDataMsgHandler( diagUpdateSvcRef,
             xferDataMsgHandler, NULL );
    Copy to clipboard

An application can get the data length and payload by using [taf\_diagUpdate\_GetXferDataParamRecLen()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a63a2417e72b833509698cb03c9ea3688.html#Documentationa00446_1a63a2417e72b833509698cb03c9ea3688) and [taf\_diagUpdate\_GetXferDataParamRec()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a1f35a478279336605f35ca3c0a26fa1d.html#Documentationa00446_1a1f35a478279336605f35ca3c0a26fa1d) referring to the following sample code snippets.

result = taf_diagUpdate_GetXferDataParamRecLen( rxMsgRef, (uint16_t *)&xferDataLen);
    if (result != LE_OK)
    {
         LE_ERROR("Fail to get data length.");
         return result;
    }
    Copy to clipboard

result = taf_diagUpdate_GetXferDataParamRec( rxMsgRef, xferData, &xferDataLen);
    if (result != LE_OK)
    {
         LE_ERROR("Fail to get data payload.");
         return result;
    }
    Copy to clipboard

An application can send a transfer data response by using [taf\_diagUpdate\_SendXferDataResp()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a74b8ade99d9069c5fbbeb1dc44b57cc4.html#Documentationa00446_1a74b8ade99d9069c5fbbeb1dc44b57cc4).

result = taf_diagUpdate_SendXferDataResp( rxMsgRef, TAF_DIAGUPDATE_XFER_DATA_NO_ERROR , NULL, 0);
    if (result != LE_OK)
    {
       LE_ERROR("Fail to send response.");
       return result;
    }
    Copy to clipboard

The following APIs are provided for transfer data.

- [taf\_diagUpdate\_AddRxXferDataMsgHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1ad9d85340d6896bc2c44fd73ede013581.html#Documentationa00446_1ad9d85340d6896bc2c44fd73ede013581) — Adds a handler function for the specified event.
- [taf\_diagUpdate\_RemoveRxXferDataMsgHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a1374ed373c509450e1e025f18e94dc17.html#Documentationa00446_1a1374ed373c509450e1e025f18e94dc17) — Removes a handler function for the specified event.
- [taf\_diagUpdate\_GetblockSeqCount()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a104f6b7e2f5fbaadc25daa24ce7636eb.html#Documentationa00446_1a104f6b7e2f5fbaadc25daa24ce7636eb) — Gets the block sequence counter.
- [taf\_diagUpdate\_GetXferDataParamRecLen()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a63a2417e72b833509698cb03c9ea3688.html#Documentationa00446_1a63a2417e72b833509698cb03c9ea3688) — Gets the data length.
- [taf\_diagUpdate\_GetXferDataParamRec()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a1f35a478279336605f35ca3c0a26fa1d.html#Documentationa00446_1a1f35a478279336605f35ca3c0a26fa1d) — Gets the data payload.
- [taf\_diagUpdate\_SendXferDataResp()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a74b8ade99d9069c5fbbeb1dc44b57cc4.html#Documentationa00446_1a74b8ade99d9069c5fbbeb1dc44b57cc4) — Sends a response message for the transfer data message.

## Request transfer exit

An application registers a transfer exit handler using [taf\_diagUpdate\_AddRxXferExitMsgHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1aeedecae415b732af4a07b86b0e8ad94b.html#Documentationa00446_1aeedecae415b732af4a07b86b0e8ad94b). Once a transfer exit request message is received, the handler will be called indicating the new message.

diagXferExitMsgRef = taf_diagUpdate_AddRxXferExitMsgHandler( diagUpdateSvcRef,
             xferExitMsgHandler, NULL );
    Copy to clipboard

An application can send a transfer exit response by using [taf\_diagUpdate\_SendXferExitResp()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1af3af3b25052c0ac371bb9f219eaf573a.html#Documentationa00446_1af3af3b25052c0ac371bb9f219eaf573a).

result = taf_diagUpdate_SendXferExitResp( rxMsgRef, TAF_DIAGUPDATE_XFER_EXIT_NO_ERROR, NULL, 0 );
    if (result != LE_OK)
    {
         LE_ERROR("Fail to send response.");
         return result;
    }
    Copy to clipboard

The following APIs are provided for request transfer exit.

- [taf\_diagUpdate\_AddRxXferExitMsgHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1aeedecae415b732af4a07b86b0e8ad94b.html#Documentationa00446_1aeedecae415b732af4a07b86b0e8ad94b) — Adds a handler function for the specified event.
- [taf\_diagUpdate\_RemoveRxXferExitMsgHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1acf766d78ee1a12c729d4ef1950fceab6.html#Documentationa00446_1acf766d78ee1a12c729d4ef1950fceab6) — Removes a handler function for the specified event.
- [taf\_diagUpdate\_GetXferExitParamRec()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1afdf2960a01704fe194c5250ca5644ea4.html#Documentationa00446_1afdf2960a01704fe194c5250ca5644ea4) — Gets the transfer request parameter record.
- [taf\_diagUpdate\_SendXferExitResp()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1af3af3b25052c0ac371bb9f219eaf573a.html#Documentationa00446_1af3af3b25052c0ac371bb9f219eaf573a) — Sends a response message for the transfer exit message.

## Request download

An application registers a request download handler using [taf\_diagUpdate\_AddRxDwnldMsgHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a76756962b331defd08f983d223ffdd12.html#Documentationa00446_1a76756962b331defd08f983d223ffdd12). Once a request download message is received, the handler is called with the message reference passed as an input parameter.

// Rx message handler function.
    void RxReqDwnldEventHandler
    (
        taf_diagUpdate_RxDwnldMsgRef_t rxMsgRef,
        void* contextPtr
    )
    {
        // Process after succesfully receiving message
    }
    
    // Register the message handler.
    taf_diagUpdate_RxDwnldMsgHandlerRef_t RxReqDwnldMsgHandlerRef =
        taf_diagUpdate_AddRxDwnldMsgHandler(diagUpdateSvcRef,
           (taf_diagUpdate_RxDwnldMsgHandlerFunc_t)RxReqDwnldEventHandler, NULL);
    LE_ASSERT(RxReqDwnldMsgHandlerRef != NULL);
    
    // To remove the handler function, when it is not needed.
    taf_diagUpdate_RemoveRxDwnldMsgHandler(RxReqDwnldMsgHandlerRef);
    Copy to clipboard

The following APIs are provided for request download.

- [taf\_diagUpdate\_GetReqDwnldDataFormatID()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1aa3af29874314b892bf6f5bc801415802.html#Documentationa00446_1aa3af29874314b892bf6f5bc801415802) — Gets the data format ID.
- [taf\_diagUpdate\_GetMemAddrParamLen()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1adc6fdd6eeccca965baa068cf1722a5e8.html#Documentationa00446_1adc6fdd6eeccca965baa068cf1722a5e8) — Gets the length (number of bytes) of the memoryAddress parameter.
- [taf\_diagUpdate\_GetMemAddr()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1af61d6e287748536e39c3a07e6fb2cc9b.html#Documentationa00446_1af61d6e287748536e39c3a07e6fb2cc9b) — Gets the memory address.
- [taf\_diagUpdate\_GetMemSizeParamLen()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a345b88aa96bd2e21e092ea2929c81447.html#Documentationa00446_1a345b88aa96bd2e21e092ea2929c81447) — Gets the length (number of bytes) of the memorySize parameter.
- [taf\_diagUpdate\_GetMemSize()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1ac018f7dc571c9f0f5f0a6e383944293d.html#Documentationa00446_1ac018f7dc571c9f0f5f0a6e383944293d) — Gets the memory size.

An application can send a request download response by using [taf\_diagUpdate\_SendReqDwnldResp()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1ae422dd7b719509992a08ccd9e70446ad.html#Documentationa00446_1ae422dd7b719509992a08ccd9e70446ad).

result = taf_diagUpdate_SendReqDwnldResp( rxMsgRef, TAF_DIAGUPDATE_REQ_DWNLD_NO_ERROR);
    if (result != LE_OK)
    {
         LE_ERROR("Fail to send response.");
         return result;
    }
    Copy to clipboard

## NRC status notification API

After getting the service reference, an application can call [taf\_diagUpdate\_AddNrcStatusHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a8a0fb3174d696aeaea8594cf69850aa5.html#Documentationa00446_1a8a0fb3174d696aeaea8594cf69850aa5) to register a handler for NRC status for diag update service. Once an NRC (excluding 0x21 and 0x78) is sent, the handler will be called with the status message, VLAN ID, service ID, and NRC passed as input parameters. Currently the statusRef is not used and kept for future.

// NRC status handler function.
    void nrcStatusHandler
    (
         taf_diagUpdate_NrcStatusRef_t statusRef,
         uint16_t vlanId,
         uint8_t sid,
         uint8_t nrc,
         void* contextPtr
    )
    {
         // Process after NRC status
    }
    
    // Register the NRC status handler.
    taf_diagUpdate_NrcStatusHandlerRef_t DiagNrcStatusRef =
             taf_diagUpdate_AddNrcStatusHandler(diagUpdateSvcRef, nrcStatusHandler, NULL);
    
    LE_ERROR_IF((DiagNrcStatusRef == NULL), "taf_diagUpdate_AddNrcStatusHandler returns NULL!");
    
    // To remove the handler function when it is not needed.
    taf_diagUpdate_RemoveNrcStatusHandler(DiagNrcStatusRef);
    Copy to clipboard

The following APIs are provided for NRC notification.

- [taf\_diagUpdate\_AddNrcStatusHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a8a0fb3174d696aeaea8594cf69850aa5.html#Documentationa00446_1a8a0fb3174d696aeaea8594cf69850aa5) — Adds a handler function for NRC status.
- [taf\_diagUpdate\_RemoveNrcStatusHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a69b23fa121e1a579e4a671cca536e40d.html#Documentationa00446_1a69b23fa121e1a579e4a671cca536e40d) — Removes a handler function for NRC status.
- [taf\_diagUpdate\_ReleaseNrcStatusMsg()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a31039c284b1745ee7066ad1fc2d38051.html#Documentationa00446_1a31039c284b1745ee7066ad1fc2d38051) — Releases an NRC status notification message.

The following APIs are provided for service reference.

- [taf\_diagUpdate\_GetService()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a2b3c9fb78fcfc782cdc25389f1956423.html#Documentationa00446_1a2b3c9fb78fcfc782cdc25389f1956423) — Gets the reference to a diag update service.
- [taf\_diagUpdate\_RemoveSvc()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00446_1a1cc11023eff05c30e5504b27cc1166cf.html#Documentationa00446_1a1cc11023eff05c30e5504b27cc1166cf) — Removes the daig update service.

Last Published: Jun 09, 2026

[Previous Topic
Diag Security Service](https://docs.qualcomm.com/bundle/publicresource/80-41102-2/topics/page_c_tafDiagSecurity.md) [Next Topic
Diag Data ID Storage Service](https://docs.qualcomm.com/bundle/publicresource/80-41102-2/topics/page_c_tafDiagDataIDStor.md)