bt-le-central is a tool for acting as a device in the LE central role by using the fuchsia.bluetooth.le and fuchsia.bluetooth.gatt FIDL APIs to discover and connect to peripherals and their services.
fx test bt-le-central-unittests
Connect to peripherals with either the scan command or the connect command. Once a peripheral has been connected, a GATT REPL will start that enables you to interact with its services.
bt-le-central <command>
scan (--connect|--scan-count=N) [--name-filter=NAME] [--uuid-filter=UUID]Scan for nearby devices and optionally connect to them.
-h, --help-s, --scan-count SCAN_COUNTNumber of scan results to return before scanning is stopped.
-c, --connectConnect to the first connectable scan result.
-n, --name-filter NAMEFilter by device name.
-u, --uuid-filter UUIDFilter by UUID.
connect <peer-id>Connect to a peer using its ID.
The GATT REPL will start when a peripheral has connected. The following commands can be entered after the GATT> prompt.
helpPrint help message.
listList discovered services.
connect <index>Connect to a service.
read-chr <id>Read a characteristic.
read-long-chr <id> <offset> <max bytes>Read a long characteristic.
write-chr [-w] <id> <value>Write to a characteristic. Use the -w flag to write without response.
write-long-chr [-r] <id> <offset> <value>Write to a long characteristic. Use the -r flag for a reliable write.
read-desc <id>Read a characteristic descriptor.
read-long-desc <id> <offset> <max bytes>Read a long characteristic descriptor.
write-desc <id> <value>Write to a characteristic descriptor.
write-long-desc <id> <offset> <value>Write to a long characteristic descriptor.
read-by-type <uuid>Read a characteristic or descriptor by its UUID.
GATT> read-by-type 9ec813b4-256b-4090-93a8-a4f0e9107733 all values read successfully: true [id: 3, value: [0, 0, 0, 0, 0, 0]]
enable-notify <id>Enable characteristic notifications.
disable-notify <id>Disable characteristic notifications.
quitQuit and disconnect the peripheral.
exitQuit and disconnect the peripheral.