Skip to content

Add serial capability for Bluetooth Classic and USB OTG#22

Closed
mithun50 wants to merge 1 commit intomainfrom
feat/serial-capability
Closed

Add serial capability for Bluetooth Classic and USB OTG#22
mithun50 wants to merge 1 commit intomainfrom
feat/serial-capability

Conversation

@mithun50
Copy link
Copy Markdown
Owner

Summary

Closes #21

  • Adds a unified serial capability with Bluetooth Classic (RFCOMM/SPP) and USB serial (CDC-ACM, FTDI, CH340, CP210x) support
  • AI agents can now scan, connect, write, read, disconnect, and list serial devices via the Node protocol
  • Smart permission gating: Bluetooth permissions only requested for BT transport, USB needs no runtime permissions

Commands

Command Description
serial.scan Discover USB devices or paired Bluetooth devices
serial.connect Open a persistent serial connection
serial.write Send data (utf8 or base64 encoded)
serial.read Read buffered data with timeout and delimiter support
serial.disconnect Close one or all connections
serial.list List active connections with buffer sizes

Changes

  • New: serial_capability.dart — 530-line capability handler with 64KB read buffers
  • Modified: pubspec.yaml — added flutter_serial_communication and flutter_bluetooth_classic_serial
  • Modified: AndroidManifest.xml — Bluetooth + USB host permissions
  • Modified: node_provider.dart — registered serial capability
  • Modified: node_screen.dart — added Bluetooth Serial and USB Serial UI tiles

Test plan

  • serial.scan transport:"usb" with Arduino connected via USB OTG → device appears
  • serial.connect → returns connectionId
  • serial.write + serial.read → round-trip data verified
  • serial.scan transport:"bluetooth" with paired Micro:bit → device appears
  • BT connect + write/read cycle
  • serial.disconnect connectionId:"all" + serial.list → empty
  • Deny BT permission → PERMISSION_DENIED error returned

🤖 Generated with Claude Code

Implements serial communication over Bluetooth Classic (RFCOMM/SPP) and
USB serial (CDC-ACM, FTDI, CH340, CP210x) so AI agents can control
Arduino, Micro:bit, and other serial hardware via the Node protocol.

Commands: serial.scan, serial.connect, serial.write, serial.read,
serial.disconnect, serial.list — unified under a single 'serial'
capability with a transport parameter.

- New SerialCapability handler with 64KB read buffers per connection
- Bluetooth permissions (BLUETOOTH_CONNECT, BLUETOOTH_SCAN) for Android 12+
- USB host feature declaration (optional)
- Registered in NodeProvider, UI tiles added to Node screen

Co-Authored-By: Mithun Gowda B <mithungowda.b7411@gmail.com>
@mithun50 mithun50 closed this Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for serial over Bluetooth and USB

1 participant