README.md (3973B)
1 # RCVD: sync BLE-enabled Casio watches from KaiOS and modern Web 2 3 RCVD is the missing KaiOS application and, first and foremost, a [JS library](rcvd.js) that allows you to interact with a set of most recent Casio watches via Bluetooth 4.0LE communication protocol. 4 5 ## Why? 6 7 - Official Casio apps like G-Shock Connected, Oceanus Connected etc. are too bulky, proprietary and opaque, require too many permissions to work and only available for two major mobile platforms. 8 - The only existing FOSS alternative for the time being is no less bulky, written for Android only, has a lot of obscure and suboptimal code and also doesn't solve Android's problem with location permission required to be granted to use BLE scanning. 9 - As such, up until this point, there was no way to sync these watches from a Bluetooth-enabled PC in a fully cross-platform way. 10 - Up until this point, KaiOS also didn't have any simple and straightforward examples of working with Bluetooth GATT characteristics on real-world consumer-grade devices. 11 - BLE Web API interfaces totally differ across KaiOS and modern browsers, so the lowest-level abstraction layer is still necessary. 12 13 ## Supported host platforms 14 15 - As a certified app: KaiOS 2.5.x (install directly from this repo via WebIDE); 16 - As a JS library: Chrome 85+, Opera 43+, Edge 79+ and other modern Chromium-based browsers (including Android ones) except the ones with support explicitly disabled, such as Brave. 17 18 ## Supported models 19 20 - GW-B5600 21 - GMW-B5000 22 - MRG-B5000\* 23 - OCW-T200 24 - GWR-B1000\* 25 - GM-B2100 26 - GA-B2100\* 27 - GST-B400\* 28 - GST-B500\* 29 - ECB-S100\* 30 - MSG-B100\* 31 - ECB-2000\* 32 - ECB-2200\* 33 - DW-B5600 34 - GA-B001 35 - G-B001\* 36 37 The list is incomplete and your watch may be supported too. Please [let me know](https://matrix.to/#/@luxferre:hackliberty.org) if this is the case! 38 39 \* *model theoretically supported but not checked by the author* 40 41 ## How to use the app 42 43 1. Ensure your phone time is synced from the network. 44 2. Open the app and press SYNC (central D-pad key). 45 3. Enter the fast or full sync mode on your watch (depends on your model, please refer to the manual). 46 4. Wait until the time is set. If the app cannot connect, retry steps 2-3 until the app says your model is synced. 47 48 ## How to use the library 49 50 The [library](rcvd.js) can be used "as is" or as a building block for more advanced tools. For its purposes, it exposes several methods: 51 52 - `RCVD.connect() -> Promise` - connect to a watch, perform the necessary handshake operations and resolve the Promise on success; 53 - `RCVD.disconnect()` - disconnect from the currently connected watch's GATT server; 54 - `RCVD.sync(Date obj?) -> Promise` - perform time synchronization with the **optional** Date object (if it's not passed, actual current local time will be set), running all the required DST/world time setting cycles before setting the actual time; 55 - `RCVD.setSyncDelta(ms)` - update the delta value (in milliseconds) to add to the current time before synchronization to make up for the Bluetooth transmission delay (500 ms by default, can be adjusted according to your host and watch latency); 56 - `RCVD.getModel() -> String` - return the watch model name obtained during the connection process; 57 - `RCVD.rawRead(uint8 param1, uint8 param2...) -> Promise(Uint8Array)` - accept variable number of integer parameters and execute the read command on the watch, resolving to the result in a Uint8Array value; 58 - `RCVD.rawWrite(Uint8Array command) -> Promise` - accept a write command shaped as byte data in Uint8Array and resolve on successful write operation. 59 60 The last two methods are not used in the app directly in their exposed format, but allow to use the library to easily create more advanced applications to interact with Casio watches based on already known protocol details, without having to worry about low-level connectivity bits. 61 62 ## Credits 63 64 Created by Luxferre in 2022. Both the app and the library are released into public domain. 65 66 Made in Ukraine.