# SIM Access Profile

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

The SIM Access Profile (SAP) is an interface to communicate between remote SIM (RSIM) service and applications. This service is based on the SIM Access Profile (SAP) specification and a bridge between RSIM and the host applications. This allows an application to convey APDU requests to the remote SIM and help APDU to get responses from the modem through the RSIM service. A SAP service is needed for applications that want to communicate through RSIM service related to SIM I/O e.g. APDU, ATR sends messages to the SIM which located at remote side.

## IPC interfaces binding

The functions of this API are provided by the **tafRemoteSimSvc** application service.

The following example illustrates how to bind to the SAP service.

bindings:
    {
        clientExe.clientComponent.taf_simSap -> tafRemoteSimSvc.taf_simSap
    }
    Copy to clipboard

## Send message from app

A message can be sent to the service which then sends commands to the modem using [taf\_simSap\_SendMessage()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00671_1a91a461a6a58563983adfd528ae24c884.html#Documentationa00671_1a91a461a6a58563983adfd528ae24c884) with the messagePtr and messageNumElements passed as parameters.

uint8_t buffer[TAF_SIMSAP_MAX_MSG_SIZE];
    static bool daemonConnected = false;
    int bytes;
    le_result_t result = LE_FAULT;
    memset(buffer, 0, sizeof(buffer));
    if ((bytes = read(fd, buffer, TAF_SIMSAP_MAX_MSG_SIZE)) <= 0) {
        LE_ERROR("Connection closed or failed to read from daemon! %s\n", strerror(errno));
        daemonConnected = false;
    } else {
        //Send message
        LE_INFO("Read %d bytes from daemon", bytes);
        result = taf_simSap_SendMessage(buffer, bytes);
    
    }
    LE_ASSERT(result == LE_OK);
    Copy to clipboard

Before an application starts to send message, the application needs to register a callback handler using [taf\_simSap\_AddMessageHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00671_1a9fda879cc9a9191ccc5b13c143595cc9.html#Documentationa00671_1a9fda879cc9a9191ccc5b13c143595cc9). Once the message is sent, the handler will be called indicating the sending status of the message. If the message failed to send, the handler will be called with the error code.

taf_simSap_MessageHandlerRef_t msgHandlerRef = taf_simSap_AddMessageHandler(SAPMessageHandler, NULL);
    Copy to clipboard

Applications must use [taf\_simSap\_RemoveMessageHandler()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00671_1a3f3fc744acc080dbcd85ef591b0c6dc1.html#Documentationa00671_1a3f3fc744acc080dbcd85ef591b0c6dc1) to release the [taf\_simSap\_MessageHandlerRef\_t](https://docs.qualcomm.com/doc/80-41102-2/topic/typedef_a00668_1abc08f41e8042c762c33c396f4dfb2634.html#Documentationa00668_1abc08f41e8042c762c33c396f4dfb2634) message handler reference object when it is no longer used.

Last Published: Jun 09, 2026

[Previous Topic
Remote SIM Profile](https://docs.qualcomm.com/bundle/publicresource/80-41102-2/topics/page_c_tafSimRsp.md) [Next Topic
SMS Service](https://docs.qualcomm.com/bundle/publicresource/80-41102-2/topics/page_c_tafsms.md)