0

For my project, I intend to use SPP over BLE using the Bluez stack. I however find no sample code for Bluez for BLE SPP profile. Can someone help with a sample application for BLE SPP for Bluez? Preferably BLE SPP server.

Regards

1 Answers1

0

Unfortunately BlueZ does not have any BLE SPP example. BLE SPP is not part of the adopted BLE profiles and therefore you'll not easily find an example for this by any vendor/stack.

You can look into implementing your own BLE SPP customer service/characteristic, but for that you have to work on both the central and peripheral side which will end up being very complex. I recommend checking if you can achieve what you want with the existing BLE profiles.

If you just simply want a bidirectional communication between two BLE devices, you can simply set up a GATT server in BlueZ with characteristics that you can read/write to or be notified by. You'd need to understand the theoretical aspect of the BLE GATT profile and also how to implement these in BlueZ. I recommend the following links to get you started:-

I hope this helps.

Youssif Saeed
  • 11,789
  • 4
  • 44
  • 72
  • I needed a client-server kind of communication. Where in the request response need not be just read/write characteristics. Another question relevant to this is that is it possible to use TLS on top of BLE and/or BT communication? Any sources implementing this. Would be really thankful. – Embedded Enthusiast Jun 21 '20 at 09:00
  • So what else do you need besides read/write? And what is TLS? Transport Layer Security? If that is the case then both BLE and classic Bluetooth have inherent security and you don't need to implement something extra unless you need something custom to your case. – Youssif Saeed Jun 21 '20 at 10:18
  • I would be using just pairing due to some constraints defined. Now if pairing doesn't involve a passphrase, then there would be no security/encryption? To make BLE data more secure, we intend to add our own security (Transport Layer security/SSL). This would mean the data exchanged would have a handshake req/response content. So the question is what other methods do people generally use to encrypt the data apart from what is offered by BT/BLE. – Embedded Enthusiast Jun 21 '20 at 10:51
  • There is no common implementation for what you describe. For BLE, if you have no IO capability on the device then you have to use JustWorks pairing. If you end up using anything else, your implementation would still be susceptible to active eavesdropping and MITM attacks, but maybe the fact that you are using a specific implementation can slightly be beneficial compared to no pairing at all. Have a look at this link for more on BLE security: https://www.bluetooth.com/blog/bluetooth-pairing-part-1-pairing-feature-exchange/ – Youssif Saeed Jun 21 '20 at 11:18