SPP emulates an RS-232 serial connection, thereby supporting raw binary communication between two Bluetooth devices.
To connect via SPP, simply send the connect_service command with the MAC address as the data parameter and the profile number (0x1101) along with the UUID of the SPP server you wish to connect to as data2 to the /pps/services/bluetooth/control object. For example:
echo "command::connect_service\n data::BA:C3:32:AD:55:CC\n data2::0x1101:5DF26DC6-8E42-8401-6D98-75C100B108B1" >> /pps/services/bluetooth/control
When reading from and writing to the remote device, see the following files for file descriptors:
/dev/io-bluetooth/spp/UUID/stdin /dev/io-bluetooth/spp/UUID/stdoutYou can use regular filesystem read/write facilities to read from or write to these mount paths. So if you're connected to SPP, you can use commands such as cat for reading or echo for writing to these paths as a way to get and send data from an SPP-connected phone.
To disconnect, simply send the disconnect_service command using the same parameters you used to connect. For example:
echo "command::disconnect_service\n data::BA:C3:32:AD:55:CC\n data2::0x1101:5DF26DC6-8E42-8401-6D98-75C100B108B1" >> /pps/services/bluetooth/control