In order to provide data synchronization capabilities between a watch and another device (typically a phone but that could also be a computer), AsteroidOS defines a variety of Bluetooth Low Energy profiles. This page tries to document those profiles so that developers can implement new synchronization apps.
Basic knowledge of BLE is useful to understand this page. In this page, the server parts refer to the side of the protocol implemented by asteroid-btsyncd on the watch. The client parts refer to what's implemented by external apps such as AsteroidOSSync.
Clients can distinguish an AsteroidOS watch from another BLE device by diving into advertisement payloads. AsteroidOS advertises the following service UUID: 00000000-0000-0000-0000-00a57e401d05. This information can be filtered when scanning surrounding devices.
Clients can read an Asteroid watch's battery level using the BLE battery profile. This profile is a standard defined by the Bluetooth Consortium very well documented and implemented by many other devices.
Battery Service (UUID: 0000180F-0000-1000-8000-00805f9b34fb)
Battery Level Characteristic (UUID: 00002a19-0000-1000-8000-00805f9b34fb)
This characteristic can be read or used to be notified of a battery level change. The notified and read values consist of one byte between 0 and 100 representing the current battery level.
Apps on an asteroid watch can control client's media playback capabilities (for example with the asteroid-music) using the Media profile. This profile is custom and functions as below:
Media Service (UUID: 00007071-0000-0000-0000-00A57E401D05)
Title Characteristic (UUID: 00007001-0000-0000-0000-00A57E401D05)
This characteristic can be written by the client to set the name of the media that is currently being played. Set to "" if no media is played. Values should be UTF-8 strings.
Album Characteristic (UUID: 00007002-0000-0000-0000-00A57E401D05)
This characteristic can be written by the client to set the name of the album that is currently being played. Set to "" if no media is played. Values should be UTF-8 strings.
Artist Characteristic (UUID: 00007003-0000-0000-0000-00A57E401D05)
This characteristic can be written by the client to set the name of the artist that is currently being played. Set to "" if no media is played. Values should be UTF-8 strings.
Playing Characteristic (UUID: 00007004-0000-0000-0000-00A57E401D05)
This characteristic can be written by the client to set the state of the media currently being played. Possible values can be: one byte set to 1 if the media is being played or one byte set to 0 if the media is paused.
Command Characteristic (UUID: 00007005-0000-0000-0000-00A57E401D05)
This characteristic can be used by the client to be notified of a command being sent by the server. Possible events are signaled with one bytes between:
- 0x0: Previous (the client is expected to change media and update the writable characteristics)
- 0x1: Next (the client is expected to change media and update the writable characteristics)
- 0x2: Play (the client is expected to play the current media and update the playing characteristics according to the new state)
- 0x3: Pause (the client is expected to pause the current media and update the playing characteristics according to the new state)
- 0x4: Volume (the client is expected to change the volume to a supplied target volume and then update the Volume characteristic)
Volume Characteristic (UUID: 00007006-0000-0000-0000-00A57E401D05)
This characteristic can be written by the client to set the volume of the current media session. Supported value range is 0-100.
Clients can create notifications on the watch side by using the Notification Profile. This profile is typically used to synchronize notifications from a phone to a watch or to send special alerts such as AsteroidOSSync's "Find my watch" feature.
Notification Service (UUID: 00009071-0000-0000-0000-00A57E401D05)
Notification Update Characteristic (UUID: 00009001-0000-0000-0000-00A57E401D05)
This characteristic can be written to send notifications-related commands to the watch. Commands are formated as UTF-8 strings containing an XML tree. The root element can be:
- insert: to be used when the client wants to add or modify a notification on the watch side. In that case, it can contain the following sub-elements:
- pn: (Package name) currently ignored, should be used to identify the Android application at the origin of this notification. This field can safely be ignored by other platforms.
- id: (Identifier) unsigned integer freely assigned by the client to identify a notification. If the server doesn't know any notifications with this ID yet, a notification will be created. If the server already knows a notification attached to this ID, this notification will be updated according to the other insert's sub-elements.
- an: (Application Name) used by the watch's UI to show a human readable name of the application at the origin of this notification.
- ai: (Application Icon) used by the watch's UI to assign an icon to this notification. Icons should be designated by their ion-icons identifier. The complete list of supported icons can be found here
- su: (Summary) used by the watch's UI to show a title to this notification. This field is usually kept short and can be anything that should be seen first in a notification.
- bo: (Body) used by the watch's UI to show the content of this notification. This field should be an arbitrarily long text to be read by the user on the watch.
- vb: (Vibrate) specifies how the watch should notify the user of this notification. Possible values are
- strong Makes the watch use a strong vibration with sound when possible when this notification is received. (This is also the default behavior if no vb element or an incorrect value is received)
- normal Play a subtle vibration when the notification is received on the watch.
- ringtone Vibrates in a strong pattern until the notification is removed.
- none Don't make the watch vibrate at all when the notification is received.
- removed: to be used when the client wants to close a notification on the watch side. In that case, it can only contain the id sub-element which contains a notification ID attached to the notification to be closed.
Examples of well-formed values:
com.android.mms 42 SMS ios-text Bob Hey, check out this super cool OS! http://asteroidos.org strong
Notification Feedback Characteristic (UUID: 00009002-0000-0000-0000-00A57E401D05)
Eventually, this characteristic should allow the server to send command regarding notifications to the client (e.g: close a notification or call an action) but this feature is not standardized nor documented yet. Don't hesitate to contribute!
A client can save the content of the server's screen using the Screenshot profile.
Screenshot Service (UUID: 00006071-0000-0000-0000-00A57E401D05)
Screenshot Request Characteristic (UUID: 00006001-0000-0000-0000-00A57E401D05)
This characteristic can be written by the client to any value (for example one byte set to 0) to trigger a byte stream on the Screenshot Content Characteristic.
Screenshot Content Characteristic (UUID: 00006002-0000-0000-0000-00A57E401D05)
This characteristic can be used to be notified of a screenshot content. After a write to the Screenshot Request Characteristic, the first value signaled by the Screenshot Content Characteristic should be made of four bytes containing the size of the data to be transmitted and can be used to show a progress bar during the screenshot download time. The rest of the transmission is made of chunks of raw data to be concatenated by the client in a buffer to reconstruct a screenshot of the watch's screen. The complete buffer should be a valid JPEG file but other formats could also be considered in the future.
A client can change the server's system time using the Time Profile. This should be used periodically to synchronize a watch's time with the device it is currently connected to.
Time Service (UUID: 00005071-0000-0000-0000-00A57E401D05)
Time Set Characteristic (UUID: 00005001-0000-0000-0000-00A57E401D05)
This characteristic can be written. It is made of 5 bytes:
- Year: (byte 0) An unsigned value to be added to 1900 to set the current year.
- Month: (byte 1) A value between 0 and 11 (included) with 0 corresponding to January and 11 to December
- Day: (byte 2) A value between 0 and 31
- Hour: (byte 3) A value between 0 and 60
- Minute: (byte 4) A value between 0 and 60
- Second: (byte 5) A value between 0 and 60
A client can fill weather information buffers on the watch using the Weather Profile. Those information can typically be used by asteroid-weather or asteroid-launcher's Today page to show current info.
Weather Service (UUID: 00008071-0000-0000-0000-00A57E401D05)
Weather City Characteristic (UUID: 00008001-0000-0000-0000-00A57E401D05)
This characteristic can be written by the client to set the name of the city whose weather information are attached to. Values should be UTF-8 strings.
Weather IDs Characteristic (UUID: 00008002-0000-0000-0000-00A57E401D05)
This characteristic can be written by the client with a value of 10 bytes. Each pair or byte represents an OWM weather condition ID for a specific day of forecast. For instance: Bytes 0 and 1 set to 500 represent light rain today.
Weather Min Temperatures Characteristic (UUID: 00008003-0000-0000-0000-00A57E401D05)
This characteristic can be written by the client with a value of 10 bytes. Each pair or byte represents a minimum temperature for a specific day of forecast. For instance: Bytes 2 and 3 set to 20 represent a minimum temperature of 20°C tomorrow.
Weather Max Temperatures Characteristic (UUID: 00008004-0000-0000-0000-00A57E401D05)
This characteristic can be written by the client with a value of 10 bytes. Each pair or byte represents a maximum temperature for a specific day of forecast. For instance: Bytes 4 and 5 set to 30 represent a maximum temperature of 30°C the day after tomorrow.