3. Controls, Switches & Hardware Events
The card stores one action per physical input (btn_single, btn_double, btn_long_press, btn_long_release, switch_on, switch_off, charge_on, charge_off). When triggered, firmware emits the event and executes the bound action on-device—host apps must not replay the action.
ReAI Recording Card SDK Documentation › Controls & Hardware Events
SDK v0.0.9 (MIT)BLE 5 NUS (CONFIG_* + Events)Buttons/Switch >= 0.3.0 · Charge edges & sync_upload >= 0.3.9
Input Keys & Actions
- Keys:
btn_single,btn_double,btn_long_press,btn_long_release,switch_on,switch_off,charge_on,charge_off. - Actions:
none,record_start,record_stop,record_toggle,record_mark,sync_upload(>= 0.3.9).
Code Examples
javascript
client.onEvent((ev) => {
if (ev.kind === "button" || ev.kind === "toggle_switch") {
console.log("Input event:", ev);
}
});
await client.applyControlBindings({
switch_on: "record_start",
switch_off: "record_stop",
btn_single: "record_mark",
charge_on: "sync_upload",
});rust
use reai_card_sdk::{ChargeEdge, ControlAction, ControlBindings};
device.apply_control_bindings(&ControlBindings::recorder()).await?;
device.set_control_action(ChargeEdge::On, ControlAction::SyncUpload).await?;Live Web Demo
Web Bluetooth is unavailable in this browser/context (requires Chrome/Edge on HTTPS or localhost). You can still test every API using the Virtual Card Simulator.
btn_single
btn_double
btn_long_press
btn_long_release
switch_on
switch_off
charge_on
charge_off
Wire Protocol Log (BLE NUS / HTTP)
Connect a real card or Virtual Card Simulator to inspect live protocol frames.