git clone https://garage44.eu/jeroen/pinnacle.gitcartopolis-agent · 2026-11-30T16:44:52Z
feat(bluetooth): pair a keyboard by a code shown, and type with it The Bluetooth app shows the six-digit code to type on a keyboard, with Cancel; the bt service tells it (PASSKEY), or a notification when no app is open. Once paired and its link encrypted, the service asks the keyboard for its boot reports and sends its keys to the display server on a channel the display server gave it at start (handle 1): the display server takes keys only from there, as from the kernel, so no other program can type this way. Keys from a keyboard never paired are not read, and what is typed reaches no app listening to the service. The keyboard stays connected when the app goes back to the list; Forget drops it.
Cargo.lock | 1 +
programs/Cargo.toml | 1 +
programs/src/bin/bluetooth.rs | 103 ++++++++++++++++-----
programs/src/bin/bt.rs | 204 +++++++++++++++++++++++++++++++++++++++---
programs/src/bin/display.rs | 28 +++++-
ui/src/bluetooth.rs | 27 ++++++
6 files changed, 332 insertions(+), 32 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index 13a02d2..bbd09ea 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -189,6 +189,7 @@ dependencies = [
"pinnacle-bt",
"pinnacle-contacts",
"pinnacle-gfx",
+ "pinnacle-hid",
"pinnacle-json",
"pinnacle-layout",
"pinnacle-locale",
diff --git a/programs/Cargo.toml b/programs/Cargo.toml
index 40f9860..176a20a 100644
--- a/programs/Cargo.toml
+++ b/programs/Cargo.toml
@@ -34,6 +34,7 @@ pinnacle-net = { path = "../net" }
pinnacle-records = { path = "../records" }
pinnacle-json = { path = "../json" }
pinnacle-bt = { path = "../bt" }
+pinnacle-hid = { path = "../hid" }
pinnacle-contacts = { path = "../contacts" }
pinnacle-modem = { path = "../modem" }
pinnacle-wifi = { path = "../wifi" }
diff --git a/programs/src/bin/bluetooth.rs b/programs/src/bin/bluetooth.rs
index 8995576..9276d6d 100644
--- a/programs/src/bin/bluetooth.rs
+++ b/programs/src/bin/bluetooth.rs
@@ -8,6 +8,9 @@
//! a six-digit number and the person says whether they match. A paired
//! device stays in the list, first, whether it is nearby or not; its link
//! is encrypted again on every connection, and Forget drops the pairing.
+//! A keyboard shows no number: this device shows a code to type on it,
+//! then Enter; once paired, what is typed on it goes to the app in front,
+//! and it stays connected when the app goes back to the list.
#![no_std]
#![no_main]
@@ -38,13 +41,18 @@ struct Page {
pairing: bool,
/// What the last pairing came to, in words.
note: Option<String>,
+ /// It paired by a code typed on it; it types into this device.
+ typed: bool,
+ keyboard: bool,
}
-/// Pairing's question to the person: the connection, who, the number.
+/// Pairing's question to the person: the connection, who, the number to
+/// compare or, with `typed`, the code to type on the device.
struct Ask {
connection: u16,
who: String,
code: Option<u32>,
+ typed: bool,
}
/// A row of the list: a paired device (nearby or not) or one found.
@@ -257,6 +265,9 @@ fn page(
};
shown.push(("Link".into(), link.into(), page.private));
}
+ if page.keyboard {
+ shown.push(("Keyboard".into(), "Types into the app in front".into(), true));
+ }
shown.extend(page.rows.iter().map(|(l, v)| (l.clone(), v.clone(), false)));
if !shown.is_empty() {
let mut card = el("div").attr(
@@ -304,7 +315,8 @@ fn page(
};
actions = actions.child(button(label, "pair", variant, Tap::Pair, tapped));
}
- if page.connection.is_some() {
+ // A keyboard typing stays connected; Forget drops it.
+ if page.connection.is_some() && !page.keyboard {
actions = actions.child(button("Disconnect", "disconnect", None, Tap::Disconnect, tapped));
}
main = main.child(actions);
@@ -313,8 +325,24 @@ fn page(
let mut root = el("div").attr("style", "min-height: 100vh").child(main);
if let Some(ask) = ask {
// The question over what is behind it, which takes no tap meanwhile.
- let (said, yes) = match ask.code {
+ let (title, said, yes) = match ask.code {
+ Some(code) if ask.typed => (
+ alloc::format!("Type this code on {}", ask.who),
+ el("div")
+ .child(
+ el("div")
+ .attr("style", "font-size: 54px; margin: 12px 0")
+ .child(digits(code)),
+ )
+ .child(
+ el("p")
+ .attr("style", "margin: 0; color: var(--m-text-dim)")
+ .child("Then press Enter on it. A device listening in cannot pair this way."),
+ ),
+ None,
+ ),
Some(code) => (
+ alloc::format!("Pair with {}?", ask.who),
el("div")
.child(
el("p")
@@ -326,17 +354,29 @@ fn page(
.attr("style", "font-size: 54px; margin: 12px 0")
.child(digits(code)),
),
- "Yes, it matches",
+ Some("Yes, it matches"),
),
None => (
+ alloc::format!("Pair with {}?", ask.who),
el("div").child(
el("p")
.attr("style", "margin: 0; color: var(--m-text-dim)")
.child("It has no screen to show a number on. Pair only if you asked it to."),
),
- "Pair",
+ Some("Pair"),
),
};
+ // A code to type has only Cancel: typing it on the device answers.
+ let mut answers = el("div").attr("style", "display: flex; gap: 12px").child(button(
+ if yes.is_some() { "No" } else { "Cancel" },
+ "ask-no",
+ None,
+ Tap::Answer(false),
+ tapped,
+ ));
+ if let Some(yes) = yes {
+ answers = answers.child(button(yes, "ask-yes", Some("primary"), Tap::Answer(true), tapped));
+ }
root = root.child(
el("div")
.attr(
@@ -352,18 +392,9 @@ fn page(
flex-direction: column; gap: 12px; background: var(--m-pressed); \
border-radius: var(--m-radius-lg)",
)
- .child(
- el("h2")
- .attr("style", "margin: 0; font-size: 21px")
- .child(alloc::format!("Pair with {}?", ask.who)),
- )
+ .child(el("h2").attr("style", "margin: 0; font-size: 21px").child(title))
.child(said)
- .child(
- el("div")
- .attr("style", "display: flex; gap: 12px")
- .child(button("No", "ask-no", None, Tap::Answer(false), tapped))
- .child(button(yes, "ask-yes", Some("primary"), Tap::Answer(true), tapped)),
- ),
+ .child(answers),
),
);
}
@@ -518,18 +549,48 @@ fn main(_argument: u64) -> u64 {
connection,
who: name_of(address, &devices, &paired),
code,
+ typed: false,
});
}
+ // This device shows the code; asked to type one, the
+ // service has refused already.
+ Said::Passkey {
+ connection,
+ address,
+ passkey: Some(passkey),
+ } => {
+ pinnacle_rt::println!(
+ "bluetooth: a code to type on {}",
+ name_of(address, &devices, &paired)
+ );
+ ask = Some(Ask {
+ connection,
+ who: name_of(address, &devices, &paired),
+ code: Some(passkey),
+ typed: true,
+ });
+ if let Some(page) = mine(&mut shown, connection) {
+ page.typed = true;
+ }
+ }
+ Said::Passkey { passkey: None, .. } => {}
+ Said::Keyboard { connection, on, .. } => {
+ if let Some(page) = mine(&mut shown, connection) {
+ page.keyboard = on;
+ }
+ }
Said::Paired {
connection, compared, ..
} => {
ask = None;
if let Some(page) = mine(&mut shown, connection) {
page.pairing = false;
- page.note = Some(String::from(if compared {
- "Paired. The numbers matched, so no one sits in between."
- } else {
- "Paired. It has no shown, so no numbers could be compared."
+ page.note = Some(String::from(match (compared, page.typed) {
+ (true, true) => {
+ "Paired. The code typed on it matched, so no one sits in between."
+ }
+ (true, false) => "Paired. The numbers matched, so no one sits in between.",
+ (false, _) => "Paired. It has no screen, so no numbers could be compared.",
}));
}
}
@@ -664,6 +725,8 @@ fn main(_argument: u64) -> u64 {
private: false,
pairing: false,
note: None,
+ typed: false,
+ keyboard: false,
}));
}
}
diff --git a/programs/src/bin/bt.rs b/programs/src/bin/bt.rs
index 50250d6..572a2c8 100644
--- a/programs/src/bin/bt.rs
+++ b/programs/src/bin/bt.rs
@@ -14,6 +14,14 @@
//! phone or watch that moves to a new private address is still known. This
//! device's own identity key, handed to each device it pairs with, is made
//! once and kept beside them (`data:/bt/identity`).
+//!
+//! A keyboard pairs by a passkey this device shows and its person types on
+//! it. A paired keyboard, connected and its link encrypted, is asked for
+//! its boot reports (HID over GATT, `pinnacle_bt::hogp`), and its keys go
+//! to the display server as a USB keyboard's do, on the channel the display
+//! server gave this service when it started it (handle 1, with argument 1):
+//! no other program can type that way. It stays connected while the person
+//! types, whether the Bluetooth app is open or not.
#![no_std]
#![no_main]
@@ -23,8 +31,11 @@ extern crate alloc;
use alloc::string::String;
use alloc::vec::Vec;
use pinnacle_bt::gatt::{self, Characteristic, Service, Uuid};
+use pinnacle_bt::hogp::{self, BootKeyboard};
use pinnacle_bt::{Address, Bond, Event, Host, smp};
-use pinnacle_rt::{Channel, Received, fs, println};
+use pinnacle_hid::Keyboard;
+use pinnacle_rt::abi::InputEvent;
+use pinnacle_rt::{Channel, Handle, Received, fs, println};
use pinnacle_ui::bluetooth as protocol;
use pinnacle_ui::p2p;
@@ -157,12 +168,112 @@ fn connection_bytes(connection: u16, address: &pinnacle_bt::Address) -> Vec<u8>
b
}
+/// A keyboard typing into this device: its connection, who, the handle
+/// its reports come by, and its keys held.
+struct Typing {
+ connection: u16,
+ peer: Address,
+ input: u16,
+ keys: Keyboard,
+}
+
+/// Keyboards among the devices connected: those found by their services,
+/// and those typing.
+#[derive(Default)]
+struct Keyboards {
+ found: Vec<(u16, BootKeyboard)>,
+ typing: Vec<Typing>,
+}
+
+impl Keyboards {
+ /// Starts a keyboard found on `connection` typing, once its link is
+ /// encrypted with the key of a pairing: never one that is not paired.
+ fn start(&mut self, host: &mut Host, connection: u16, clients: &[Channel]) {
+ if self.typing.iter().any(|t| t.connection == connection) || !host.encrypted(connection) {
+ return;
+ }
+ let Some(&(_, keyboard)) = self.found.iter().find(|(c, _)| *c == connection) else {
+ return;
+ };
+ let Some(peer) = host
+ .connections()
+ .find(|(c, _)| *c == connection)
+ .map(|(_, peer)| peer)
+ else {
+ return;
+ };
+ if !host.bonds().iter().any(|b| b.address == peer) {
+ return;
+ }
+ hogp::start(host, connection, &keyboard);
+ self.typing.push(Typing {
+ connection,
+ peer,
+ input: keyboard.input,
+ keys: Keyboard::default(),
+ });
+ println!("bt: keys from {} go to the app in front", peer.text());
+ let mut b = connection_bytes(connection, &peer);
+ b.push(1);
+ said(clients, protocol::KEYBOARD, &b);
+ }
+
+ /// A report from a keyboard typing: its keys, to the display server.
+ fn report(&mut self, host: &Host, connection: u16, handle: u16, value: &[u8], out: Option<&Channel>) {
+ if !host.encrypted(connection) {
+ return;
+ }
+ if let Some(t) = self
+ .typing
+ .iter_mut()
+ .find(|t| t.connection == connection && t.input == handle)
+ {
+ send_keys(out, t.keys.report(value));
+ }
+ }
+
+ /// A connection went: whatever its keyboard held is let go.
+ fn gone(&mut self, connection: u16, clients: &[Channel], out: Option<&Channel>) {
+ self.found.retain(|(c, _)| *c != connection);
+ if let Some(i) = self.typing.iter().position(|t| t.connection == connection) {
+ let mut t = self.typing.remove(i);
+ send_keys(out, t.keys.release_all());
+ let mut b = connection_bytes(connection, &t.peer);
+ b.push(0);
+ said(clients, protocol::KEYBOARD, &b);
+ }
+ }
+
+ fn typing(&self, connection: u16) -> bool {
+ self.typing.iter().any(|t| t.connection == connection)
+ }
+}
+
+/// Keys to the display server, as a keyboard's own.
+fn send_keys(out: Option<&Channel>, keys: Vec<pinnacle_hid::Key>) {
+ let Some(out) = out else { return };
+ for key in keys {
+ let event = InputEvent {
+ kind: InputEvent::KEY,
+ code: key.code,
+ value: i32::from(key.down),
+ ..InputEvent::default()
+ };
+ out.send(&event.to_bytes(), Vec::new());
+ }
+}
+
#[unsafe(no_mangle)]
-fn main(_argument: u64) -> u64 {
+fn main(argument: u64) -> u64 {
let Some(port) = pinnacle_rt::bluetooth_port() else {
println!("bt: no controller");
return 1;
};
+ // Where a keyboard's keys go: the display server's channel, given at
+ // start.
+ // SAFETY: argument 1 says the display server gave it, as handle 1.
+ let keys_out = (argument == 1).then(|| Channel(unsafe { Handle::from_raw(1) }));
+ let mut keyboards = Keyboards::default();
let name = fs::read_string("system:/settings/name")
.map(|n| n.trim().into())
.filter(|n: &String| !n.is_empty())
@@ -176,7 +287,7 @@ fn main(_argument: u64) -> u64 {
let mut host = new_host(&name, &card, irk, &bonds);
// A pairing asked by a device nearby, waiting on the person: told to
// every app that connects until it is answered.
- let mut asking: Option<Vec<u8>> = None;
+ let mut asking: Option<(u8, Vec<u8>)> = None;
let mut display: Option<Channel> = None;
let card_handle = host.table().value_handle(
Uuid::Long(gatt::PINNACLE_SERVICE),
@@ -214,8 +325,8 @@ fn main(_argument: u64) -> u64 {
..
} if !handles.is_empty() => {
let client = Channel(handles.remove(0));
- if let Some(ask) = &asking {
- client.send(&protocol::message(protocol::ASK, ask), Vec::new());
+ if let Some((kind, ask)) = &asking {
+ client.send(&protocol::message(*kind, ask), Vec::new());
}
clients.push(client);
}
@@ -232,9 +343,35 @@ fn main(_argument: u64) -> u64 {
(protocol::STOP, _) => host.stop_scan(),
(protocol::CONNECT, _) => {
if let Some(a) = body.get(..6) {
- host.connect(pinnacle_bt::Address(a.try_into().unwrap()));
+ let address = pinnacle_bt::Address(a.try_into().unwrap());
+ // A keyboard typing is connected already.
+ let connected = host
+ .connections()
+ .find(|(_, peer)| *peer == address)
+ .map(|(c, _)| c);
+ match connected {
+ Some(c) => {
+ let mut b = connection_bytes(c, &address);
+ b.push(1);
+ let client = &clients[index - 2];
+ client.send(&protocol::message(protocol::CONNECTED, &b), Vec::new());
+ if host.encrypted(c) {
+ let b = connection_bytes(c, &address);
+ client.send(&protocol::message(protocol::ENCRYPTED, &b), Vec::new());
+ }
+ if keyboards.typing(c) {
+ let mut b = connection_bytes(c, &address);
+ b.push(1);
+ client.send(&protocol::message(protocol::KEYBOARD, &b), Vec::new());
+ }
+ }
+ None => host.connect(address),
+ }
}
}
+ // A keyboard typing stays connected when the app is
+ // done with it; Forget drops it.
+ (protocol::DISCONNECT, Some(c)) if keyboards.typing(c) => {}
(protocol::DISCONNECT, Some(c)) => host.disconnect(c),
(protocol::DISCOVER, Some(c)) => host.discover(c),
(protocol::READ, Some(c)) => {
@@ -328,10 +465,11 @@ fn main(_argument: u64) -> u64 {
Event::Disconnected { connection, peer } => {
if asking
.as_ref()
- .is_some_and(|a| a[..2] == connection.to_le_bytes())
+ .is_some_and(|(_, a)| a[..2] == connection.to_le_bytes())
{
asking = None;
}
+ keyboards.gone(connection, &clients, keys_out.as_ref());
said(
&clients,
protocol::DISCONNECTED,
@@ -342,6 +480,11 @@ fn main(_argument: u64) -> u64 {
let mut b = connection.to_le_bytes().to_vec();
b.extend(protocol::services_bytes(&services));
said(&clients, protocol::SERVICES, &b);
+ if let Some(keyboard) = hogp::boot_keyboard(&services) {
+ keyboards.found.retain(|(c, _)| *c != connection);
+ keyboards.found.push((connection, keyboard));
+ keyboards.start(&mut host, connection, &clients);
+ }
}
Event::Read {
connection,
@@ -374,6 +517,15 @@ fn main(_argument: u64) -> u64 {
b.push(u8::from(ok));
said(&clients, protocol::WRITTEN, &b);
}
+ // What is typed goes to the app in front, and to no app
+ // listening here.
+ Event::Notified {
+ connection,
+ handle,
+ value,
+ } if keyboards.typing(connection) => {
+ keyboards.report(&host, connection, handle, &value, keys_out.as_ref());
+ }
Event::Notified {
connection,
handle,
@@ -426,8 +578,38 @@ fn main(_argument: u64) -> u64 {
pinnacle_ui::notify(display, "bluetooth", &who, &text);
}
}
- asking = Some(b);
+ asking = Some((protocol::ASK, b));
+ }
+ Event::Passkey {
+ connection,
+ peer,
+ passkey: Some(passkey),
+ } => {
+ let who = host
+ .found()
+ .iter()
+ .find(|f| f.address == peer)
+ .and_then(|f| f.name.clone())
+ .unwrap_or_else(|| peer.text());
+ println!("bt: pairing with {who}: type {passkey:06} on it");
+ let mut b = connection_bytes(connection, &peer);
+ b.extend_from_slice(&passkey.to_le_bytes());
+ said(&clients, protocol::PASSKEY, &b);
+ if clients.is_empty() {
+ // A keyboard asked to pair with no app open.
+ let text = alloc::format!("Type {passkey:06} on it, then Enter");
+ if display.is_none() {
+ display = pinnacle_rt::connect("display");
+ }
+ if let Some(display) = &display {
+ pinnacle_ui::notify(display, "bluetooth", &who, &text);
+ }
+ }
+ asking = Some((protocol::PASSKEY, b));
}
+ // This device shows; it is never the one to type (it pairs
+ // as a display with buttons), so a peer asking that is refused.
+ Event::Passkey { connection, .. } => host.confirm(connection, false),
Event::Paired { connection, bond } => {
asking = None;
let name = host
@@ -454,6 +636,8 @@ fn main(_argument: u64) -> u64 {
// A device paired from a private address is listed by
// its identity from now on.
said(&clients, protocol::DEVICES_ARE, &devices_bytes(&host));
+ // A keyboard types from now on.
+ keyboards.start(&mut host, connection, &clients);
}
Event::PairingFailed {
connection,
@@ -477,6 +661,8 @@ fn main(_argument: u64) -> u64 {
protocol::ENCRYPTED,
&connection_bytes(connection, &peer),
);
+ // A paired keyboard connected again types at once.
+ keyboards.start(&mut host, connection, &clients);
}
Event::EncryptionFailed { connection, peer, .. } => {
println!("bt: {} refused the key kept", peer.text());
@@ -486,8 +672,6 @@ fn main(_argument: u64) -> u64 {
&connection_bytes(connection, &peer),
);
}
- // No app shows a passkey yet: refused, as before.
- Event::Passkey { connection, .. } => host.confirm(connection, false),
Event::Changed { .. } | Event::Subscribed { .. } => {}
}
}
diff --git a/programs/src/bin/display.rs b/programs/src/bin/display.rs
index a220839..78868db 100644
--- a/programs/src/bin/display.rs
+++ b/programs/src/bin/display.rs
@@ -84,6 +84,10 @@ struct Server {
/// Connections to `system-confirm`: the agent's gatekeepers, through
/// the terminal that started them.
askers: Vec<Channel>,
+ /// The Bluetooth service's end for a paired keyboard's keys, given it
+ /// as it started: what arrives here is a hand on a keyboard, as the
+ /// kernel's input is. No other program holds a way in.
+ bluetooth_keys: Option<Channel>,
/// The questions waiting, the first on show over everything: which
/// asker, and what (`pinnacle_ui::confirm`).
confirming: Vec<(usize, pinnacle_ui::confirm::Question)>,
@@ -836,8 +840,13 @@ impl Server {
fn start_system(&mut self) {
// The peer-to-peer service runs in the background, with no window.
pinnacle_rt::spawn("p2p", 0, Vec::new());
- // The Bluetooth service too: this device's host stack, for apps and for contacts nearby.
- pinnacle_rt::spawn("bt", 0, Vec::new());
+ // The Bluetooth service too: this device's host stack, for apps and
+ // for contacts nearby, with a channel for a paired keyboard's keys
+ // (argument 1: it is handle 1).
+ let (keys, theirs) = Channel::pair();
+ if pinnacle_rt::spawn("bt", 1, alloc::vec![theirs.0]).is_some() {
+ self.bluetooth_keys = Some(keys);
+ }
// And the phone service, for ordinary calls over the modem when a
// contact cannot be reached peer to peer.
pinnacle_rt::spawn("phone", 0, Vec::new());
@@ -1921,6 +1930,7 @@ fn main(_argument: u64) -> u64 {
vault_open: false,
last_input: 0,
askers: Vec::new(),
+ bluetooth_keys: None,
confirming: Vec::new(),
confirm_sheet: None,
list_sheet: None,
@@ -2001,6 +2011,9 @@ fn main(_argument: u64) -> u64 {
// comes or goes.
let first_asker = channels.len();
channels.extend(server.askers.iter());
+ // A Bluetooth keyboard's keys last.
+ let bluetooth_keys = channels.len();
+ channels.extend(server.bluetooth_keys.iter());
let received = pinnacle_rt::receive(&channels, &mut buffer, Some(deadline));
drop(channels);
match received {
@@ -2047,6 +2060,17 @@ fn main(_argument: u64) -> u64 {
} if !handles.is_empty() => {
server.askers.push(Channel(handles.remove(0)));
}
+ // Keys only, as a hand on the keyboard: never a touch, and
+ // never marked as an agent's.
+ Received::Message { index, len, .. } if index == bluetooth_keys => {
+ if let Some(event) = InputEvent::from_bytes(&buffer[..len])
+ && event.kind == InputEvent::KEY
+ && !event.synthetic
+ {
+ server.input(event);
+ }
+ }
+ Received::Closed { index } if index == bluetooth_keys => server.bluetooth_keys = None,
Received::Message { index, len, .. } if index >= first_asker => {
match pinnacle_ui::confirm::Question::decode(&buffer[..len]) {
Some(question) => server.confirm(index - first_asker, question),
diff --git a/ui/src/bluetooth.rs b/ui/src/bluetooth.rs
index 2844e39..dd1f675 100644
--- a/ui/src/bluetooth.rs
+++ b/ui/src/bluetooth.rs
@@ -71,6 +71,13 @@ pub const KEY_REFUSED: u8 = 0x8d;
/// The paired devices: count u8, then per device address (6), compared
/// u8, name length u8, name.
pub const BONDS_ARE: u8 = 0x8e;
+/// Pairing by passkey: connection u16, address (6), then the passkey as
+/// u32 for the person to type on the device (a keyboard), or nothing (it
+/// shows one to type here). CONFIRM with no cancels.
+pub const PASSKEY: u8 = 0x8f;
+/// A paired keyboard's keys go to the app in front, or stopped: connection
+/// u16, address (6), on u8.
+pub const KEYBOARD: u8 = 0x90;
pub fn message(kind: u8, body: &[u8]) -> Vec<u8> {
let mut m = alloc::vec![kind];
@@ -272,6 +279,16 @@ pub enum Said {
address: Address,
},
Bonds(Vec<Paired>),
+ Passkey {
+ connection: u16,
+ address: Address,
+ passkey: Option<u32>,
+ },
+ Keyboard {
+ connection: u16,
+ address: Address,
+ on: bool,
+ },
}
fn device_at(b: &[u8], at: usize) -> Option<(Device, usize)> {
@@ -368,6 +385,16 @@ pub fn parse(m: &[u8]) -> Option<Said> {
}
Said::Bonds(all)
}
+ PASSKEY => Said::Passkey {
+ connection: u16_at(body, 0)?,
+ address: address_at(body, 2)?,
+ passkey: body.get(8..12).map(|c| u32::from_le_bytes(c.try_into().unwrap())),
+ },
+ KEYBOARD => Said::Keyboard {
+ connection: u16_at(body, 0)?,
+ address: address_at(body, 2)?,
+ on: *body.get(8)? != 0,
+ },
_ => return None,
})
}