TAP rust SDK allows you to build rust app that can establish BLE connection with Tap Strap and TapXR, send commands and receive events and data - Thus allowing TAP to act as a controller for your app!
The library is currently in alpha.
Use cargo:
cargo add tap-sdkOr clone this repo:
git clone https://github.com/VladChekunov/tap-rust-sdk
cd tap-rust-sdk
cargo buildThen just import the main class
let mut tap_client = tap_sdk::Client::new(None).await.unwrap();
tap_client.run().await;Note that the SDK will not scan for BLE peripherals, therefore you'll have to pair the Tap device manually with your machine.
Also make sure that you have updated your Tap device to the latest version.
This SDK implements two basic interfaces with a Tap device.
First is setting the operation mode:
- Text mode - the Tap device will operate normally, with no events being sent to the SDK
- Controller mode - the Tap device will send events to the SDK
- Controller and Text mode - the Tap device will operate normally, in parallel with sending events to the SDK
- Raw data mode - tha Tap device will stream raw sensors data to the SDK.
Second, subscribing to the following events:
- Tap event - whenever a tap event has occured
- Mouse event - whenever a mouse movement has occured
- AirGesture event - whenever one of the gestures is detected
- Raw data - whenever new raw data sample is being made.
Additional to these functional event, there are also some state events, such as connection and disconnection of Tap devices to the SDK backend.
Authorized developers can gain access to the experimantal Spatial Control features:
- Extended AirGesture state - enabling aggregation for pinch, drag and swipe gestures.
- Select input type - enabling the selection of input type to be activated - i.e. AirMouse/Tapping.
These featureas are only available on TapXR and only for qualified developers. Request access here
The SDK uses callbacks to implement user functions on the various events. To register a callback, you just have to instance a TapSDK object and just:
fn on_tapped(identifier: Uuid, tapcode: u8) {
println!("{} tapped {}", identifier.to_short_string(), tapcode);
}
tap_client.register_tap_events(on_tapped).await;Make sure that "Developer mode" is enabled on TapManager app for this mode to work properly In raw sensors mode, the Tap device continuously sends raw data from the following sensors:
- Five 3-axis accelerometers - one per each finger (available only on TAP Strap and Tap Strap 2).
- sampled at 200Hz
- allows dynamic range configuration (±2G, ±4G, ±8G, ±16G)
- IMU (3-axis accelerometer + gyro) located on the thumb (available on TAP Strap 2 and TapXR).
- sampled at 208Hz.
- allows dynamic range configuration for the accelerometer (±2G, ±4G, ±8G, ±16G) and for the gyro (±125dps, ±250dps, ±500dps, ±1000dps, ±2000dps).
The sensors measurements are given with respect to the reference system below.
Each sample (of accelerometer or imu) is preambled with a millisecond timestamp, referenced to an internal Tap clock.
The dynamic range of the sensors is determined with the set_input_mode method by passing a sensitivity integers list of length 3 with the following elements (by order):
-
Fingers accelerometers sensitivity -
value sensitivity scale factor (mg/LSB) 0 (default) ±16G 31.25 1 ±2G 3.91 2 ±4G 7.81 3 ±8G 15.62 4 ±16G 31.25 -
IMU gyro sensitivity -
value sensitivity scale factor (mdps/LSB) 0 (default) ±500dps 17.5 1 ±125dps 4.375 2 ±250dps 8.75 3 ±500dps 17.5 4 ±1000dps 35 5 ±2000dps 70 -
IMU accelerometer sensitivity -
value sensitivity scale factor (mg/LSB) 0 (default) ±4G 0.122 1 ±2G 0.061 2 ±4G 0.122 3 ±8G 0.244 4 ±16G 0.488
You can run examples by running:
just run-examplesPlease refer to the issues tab!

