You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At runtime, BLE advertising is started. You can then use a smartphone or computer to connect and bond to your Pinetime.
207
213
As soon as a device is bonded, Pinetime will look for a **CTS** server (**C**urrent **T**ime **S**ervice) on the connected device.
208
214
215
+
### Using Android and NRFConnect
209
216
Here is how to do it with an Android smartphone running NRFConnect:
210
217
211
218
* Build and program the firmware on the Pinetime
@@ -217,4 +224,33 @@ Here is how to do it with an Android smartphone running NRFConnect:
217
224
* Go back to the main screen and scan for BLE devices. A device called "PineTime" should appear
218
225
* Tap the button "Connect" next to the PineTime device. It should connect to the PineTime and switch to a new tab.
219
226
* On this tab, on the top right, there is a 3 dots button. Tap on it and select Bond. The bonding process begins, and if it is sucessful, the PineTime should update its time and display it on the screen.
220
-
227
+
228
+
### Using Linux and bluetoothctl
229
+
* Ensure that your bluetooth controller is enabled and working fine. I've tested this on a x86 Debian computer and on a RaspberryPi 3.
230
+
* Run bluetoothctl as root : `sudo bluetoothctl`
231
+
* Enter the following commands:
232
+
*`scan on` and wait for you Pinetime to be detected. Note the BLE MAC address
233
+
* `scan off'
234
+
*`trust <MAC ADDRESS>`
235
+
*`pair <MAC ADDRESS>`
236
+
* Wait for some time, and the connection should be established.
237
+
238
+
**NOTE : ** The commands above establish a BLE connection between your PC, but the time synchronization and notifications won't work because there is not CTS or ANS server running. I'm currently working on an application that'll provide both of these servers.
239
+
240
+
### Troubleshooting
241
+
If the connection cannot be established, or the time synchronization does not work, try the following steps.
242
+
243
+
On Android:
244
+
* Disable and re-enable your bluetooth device
245
+
* In NRFConnect, in the device tab corresponding to your pinetime, tap on the menu on the top left of the screen and select "Delete bond information".
246
+
* Then re-try to bond/connect.
247
+
248
+
On Linux:
249
+
* Reset the bluetooth device : `sudo hciconfig hci0 reset`
250
+
* Restart the Bluetooth service : `sudo systemctl restart bluetooth.service`
251
+
* In bluetootctl:
252
+
*`remove <MAC ADDRESS>`
253
+
*`trust <MAC ADDRESS>`
254
+
*`pair <MAC ADDRESS>`
255
+
256
+
Note that the current firmware only advertise for the first 3 minutes. If you cannot connect after more than 3 minutes, try resetting the device (push the button and hold it for 7-10 seconds).
This page describes the BLE implementation and API built in this firmware.
4
+
5
+
**Note** : I'm a beginner in BLE related technologies and the information of this document reflect my current knowledge and understanding of the BLE stack. These informations might be erroneous or incomplete. Feel free to submit a PR if you think you can improve these.
6
+
7
+
## BLE Connection
8
+
When starting the firmware start a BLE advertising : it send small messages that can be received by any *central* device in range. This allows the device to announce its presence to other devices.
9
+
10
+
A companion application (running on a PC, RasberryPi, smartphone) which received this avertising packet can request a connection to the device. This connection procedure allows the 2 devices to negociate communication parameters, security keys,...
11
+
12
+
When the connection is established, the pinetime will try to discover services running on the companion application. For now **CTS** (**C**urrent **T**ime **S**ervice) and **ANS** (**A**lert **N**otification **S**ervice) are supported.
13
+
14
+
If **CTS** is detected, it'll request the current time to the companion application. If **ANS** is detected, it will listen to new notifications coming from the companion application.
[List of standard BLE services](https://www.bluetooth.com/specifications/gatt/services/)
20
+
21
+
### CTS
22
+
[Current Time Service](https://www.bluetooth.com/wp-content/uploads/Sitecore-Media-Library/Gatt/Xml/Services/org.bluetooth.service.alert_notification.xml)
0 commit comments