Blue Dot uses a client/server model. The
BlueDot class starts a
Bluetooth server, the Blue Dot application connects as a client.
The detail below can be used to create new applications (clients); if you do please send a pull request :)
Communication over Bluetooth is made using a RFCOMM serial port profile, on port 1, using UUID “00001101-0000-1000-8000-00805f9b34fb”.
The transmission of data from client to server or server to client is a simple stream no acknowledgements or data is sent in response to commands.
All messages between conform to the same format:
Messages are sent when:
Blue Dot is released, pressed or moved -
client to server.
- Blue Dot released.
- Blue Dot pressed.
- Blue Dot pressed position moved.
x & y specify the position on the Blue Dot that was pressed, released, and/or moved:
- Positions are values between -1 and +1, with 0 being the centre and 1 being the radius of the Blue Dot.
- x is the horizontal position where +1 is far right.
- y is the vertical position where +1 is the top.
At connection the client sends a handshake -
,[protocol version],[client name]
- client to server.
- operation 3.
- protocol version is sent and corresponds to the version of protocol the client supports.
- client name is a string value used in exceptions to report what client has connected.
When the setup (or appearance) of the Blue Dot changes -
- server to client.
- operation 4.
- color is a hex value in the format #rrggbbaa representing red, green, blue, alpha values.
- square is 0 or 1, 1 if the dot should be a square.
- border is 0 or 1, 1 if the dot should have a border.
- visible is 0 or 1, 1 if the dot should be visible.
\n represents the ASCII new-line character (ASCII character 10).
When the Android client connects using protocol version 1:
3,1,Android Blue Dot app\n
If the blue dot is pressed at the top, the following message will be sent:
While the blue dot is pressed (held down), the user moves their finger to the far right causing the following message to be sent:
The button is then released, resulting in the following message:
The color of the dot is changed to “red” to server sends to the client:
- 0 - initial version
- 1 - introduction of operation 3, 4