uwjhn
uwjhn

Reputation: 25

Send string from one ble device to another

i have two raspberry pi's with ble 4.0 dongles. i compiled blue-5.9 on the raspberrys. Everything works fine with TI's Sensortag.

next, i would like to connect both devices via BLE and send a string from one to the other.

i'm pretty lost with all i found online.

do you have any link or short example for me?

Upvotes: 0

Views: 2310

Answers (2)

bobh
bobh

Reputation: 131

You would need to set up a GATT server on one Pi, client on the other. A characteristic endpoint on the server could be a UART. 4800/9600 bps async is possible. But I've never seen an example of a BLE GATT server on Linux using blue.

Other hardware solutions (I have no financial interest in these)

Here is what a UART GATT Service would look like: http://www.mkroll.mobi/?page_id=1070

SPP over BLE https://bluegiga.zendesk.com/entries/29185293-BGScript-spp-over-ble-AT-command-SPP-implementation-for-BLE

Upvotes: 0

Tim Tisdall
Tim Tisdall

Reputation: 10382

I think you're misunderstanding how BLE works. It's not like opening a TCP socket or a serial connection where you can just pass a string in and the other end gets the string.

I think your 2 options would be:

  1. pack the string into a directed advertising packet for the destination machine to receive.

  2. set up a GATT server on the first machine and have the second machine connect and retrieve the string you want to pass along

Either way, though, you're limited to fairly short strings.

Unfortunately I don't have any sample code or examples to point you too.

Upvotes: 2

Related Questions