Files
knx_stack_usb_hid/README.md
T
2026-04-24 04:08:27 +08:00

1.3 KiB

knx_stack_usb_hid

knx_stack_usb_hid is the Flutter adapter that bridges knx_stack to KNX USB HID interfaces through the existing usb_hid package.

Status

This is the initial implementation slice. The package already exposes runtime compatibility reporting and a raw HID-report transport. KNX USB framing, EMI adaptation, and device heuristics will be added on top of this transport in the next slices.

Platform compatibility

  • Android: supported by usb_hid.
  • macOS: supported by usb_hid.
  • Linux: supported by usb_hid.
  • Windows: supported by usb_hid.
  • Web: conditional. Requires a browser with WebHID support and a user gesture for device selection.
  • iOS: unsupported because usb_hid does not provide an iOS implementation.

Usage

import 'package:knx_stack_usb_hid/knx_stack_usb_hid.dart';
import 'package:usb_hid/usb_hid.dart';

Future<void> main() async {
  final support = KnxUsbHidSupport.current();
  final usbSupport = support.supportFor(KnxFeature.usbHidTransport);

  if (!usbSupport.isSupported) {
    throw UnsupportedError(usbSupport.summary);
  }

  final transport = KnxUsbHidTransport(
    filters: const [HidDeviceFilter(vendorId: 0x28c2)],
  );

  await transport.requestDevice();
  await transport.connect();
  await transport.disconnect();
}