During the last weeks I’ve worked in adding Bluetooth Sim Access Profile (SAP) Client Side support to oFono and BlueZ. This work was done by me at ProFUSION and sponsored by Linux Foundation.
The Bluetooth Sim Access Profile enables a device to use a remote SIM card as its own SIM card. Between the benefits are ability to user others features than phone calls, like data connections, SMS, etc. This is an advantage over the Handsfree Profile, that only supports phone calls. It also uses less power due to audio part, that is not streamed over the Bluetooth link like in the Handsfree Profile but instead is handled locally.
In the development I used the Telit UC864-G module. This module has built-in SAP Client support and other features that a common modem has to have.
The Telit modem has no Bluetooth support, then the main work was to modify oFono in order to connect a Bluetooth RFCOMM socket coming from BlueZ to a Serial port coming from Telit module. This Serial port give/receive SAP protocol messages. So anything we got from it can be passed without changes to the RFCOMM socket and vice-versa.
The work was divided in two parts, in BlueZ fd-passing support was added to the Serial API through a method called Serial.ConnectFD(). This was an already planned change by BlueZ developers for the upcoming BlueZ 5.0 release. This a generic method to get a RFCOMM socket, it can be used for any purpose or by any profile.
On the oFono side, the Bluetooth infrastructure plugin was used to create a new SAP plugin that is aware of any remote device with Bluetooth SAP Server support that we paired, it also tracks if any SAP Client enabled modem is available. If the two conditions holds true a new oFono modem instance is created to connect the paired device with the SAP enabled hardware. Of course, this modem works like any other oFono modem and one can do the usual phone operations with it.
The implementation inside oFono is modular enough to easily support any other SAP enabled modem that comes to the market in the future.
It’s important to note that all the work related to the SAP Client implementation is already upstream in both BlueZ and oFono repositories.
Finally, I would like to thank Denis Kenzior, oFono maintainer, by the help on reviewing and improving the SAP code.