For another device like a smartphone to use any of the Bluetooth “services” which the board has, it must first be paired with the board. Once paired, the other device may connect to the board and exchange data relating to many of the board’s features.
Bluetooth UART Service
The Bluetooth UART service allows another device such as a smartphone to exchange any data it wants to with the board, in small chunks which are intended to be joined together. UART stands for Universal Asynchronous Receiver Transmitter and is one way in which serial data communications can be performed, usually between two devices connected by a physical, wired connection. The Bluetooth UART service emulates the behaviour of a physical UART system and allows the exchange of a maximum of 20 bytes of data at a time in either direction.
When this service is used, the board sets up a 60 byte buffer and data it receives will be accumulated in the buffer until it is full. When using the UART service from your board code, you can indicate a special character which will be used to mean that the entire message in at most three chunks has now been sent by the other, connected device, at which point the board will release the entire contents of its buffer to any code trying to read it. In other words this special character, known as a ‘delimiter’ is used by the device connected to the board to mean “I’ve sent my whole message, you can now use it”.
You could use the UART service for many things. It doesn’t care what you put in messages which makes it very flexible. You could create a guessing game, with questions and answers passing between board and a smartphone or you could connect a camera to the board and transmit image data obtained from the edge connector, in chunks over Bluetooth to a smartphone. There are a great many possibilities.
To use the Bluetooth UART service from another device you’ll need additional board code which reads and uses data from the UART buffer and / or writes data to the buffer for transmission over Bluetooth to another device.
bluetooth.startUartService();
Example: Starting the Bluetooth UART service
The following code shows the Bluetooth UART service being started:
bluetooth.startUartService();
Video - UART service guessing game
Advanced
For more advanced information on the board Bluetooth UART service including information on using a smartphone, see the Lancaster University board runtime technical documentation
See also
About Bluetooth, board Bluetooth profile overview , board Bluetooth profile reference, Bluetooth on board resources, Bluetooth SIG
bluetooth