Bonding and exporting a session¶
Bench use only. Never connect TwiistOff to a pump that is attached to a person.
For the complete pairing/re-pairing procedure (physical pump steps, ordering, what still requires the official app) see Pairing and setup. This page is the bond mechanics in detail plus session export.
Why TwiistOff bonds¶
The pump uses LE Secure Connections with Passkey Entry, so a passive sniffer cannot read traffic after the link encrypts. TwiistOff is the bonded Android peer: the app sees ATT in the clear. (The long-term key stays inside Android's Bluetooth stack and is not readable by apps. For link-layer decryption of a sniffer capture, use Developer options > Bluetooth HCI snoop log instead.)
Bonding, step by step¶
- Put the pump in pairing mode (charged battery, cassette off, remove and reinsert the battery; on an already-paired pump a ~5 s button hold re-opens advertising). See Pairing and setup §2.
- Open TwiistOff, accept the bench-only disclaimer, and on the Connect tab tap Scan.
- The pump is highlighted: its name is its serial and it advertises manufacturer data
0x026B. Tap Connect. Its address rotates every minute or two, which is normal. - TwiistOff connects and discovers the GATT tree (the
e533…service and the Nordic DFU service are starred in Menu → Advanced → GATT explorer). - Start bonding either way:
- use the Bond (label PIN) block on the Connect page, or
- tap Subscribe all in the GATT explorer (or Subscribe on a single characteristic): the pump rejects a protected notify with insufficient authentication, and Android starts pairing.
- A Enter pump PIN dialog appears. The last PIN used is pre-filled and editable. Enter the 6-digit PIN on the pump label and tap Pair.
- On success the bond block shows
bondedand any subscription that failed for lack of authentication is retried once automatically.
Bonding is verified live: the bridge path with the in-app auto-passkey bonded an off-body pump
unattended, and the on-phone dialog uses the same BondManager code path. Treat bond state
transitions as verified and the dialog rendering as ordinary Compose UI. The debug bridge exposes
GET /bond, POST /pin, POST /bond/start and
POST /bond/forget for scripted bonding (REST API §5.4).
If the in-app dialog does not appear or setPin fails on your Android build, switch off Ask for PIN inside TwiistOff in the GATT explorer's device panel and Android's own pairing dialog is used instead. If the pump refuses to bond, it may still be bonded to another phone or the official app; unpair it there first. Forget bond removes Android's keys (or remove the pump in Android Bluetooth settings).
Every step is logged under the Bond tag (pairing variant, bond-state transitions with reason code, setPin result). The PIN itself is never written to the log.
Exporting¶
Tap Export session (Menu, or Advanced → Session log). Android's share sheet opens with one twiistoff-session-<serial>-<timestamp>.txt file: app and phone info, target device and bond state, bonded devices, scan candidates, the full GATT map, and the complete timestamped session log with hex payloads. Copy all puts the same report on the clipboard for a quick paste.
The report is also kept in the app's data folder (exports/), next to the app log (logs/, one file a day), so it can be shared again later or pulled over adb (Permissions and files).
Known-UUID labels¶
e5331fe0-977c-11e5-a837-0800200c9a66 and the nine e533… characteristics were seen in a cleartext capture of one pump; they are starred by UUID. Roles as TwiistOff uses them are in BLE and session. Nordic Secure DFU (0xFE59, 8ec9000x-…) is labelled from Nordic's public documentation.