mtrust_urp_ble_strategy 9.1.0-dev.20 copy "mtrust_urp_ble_strategy: ^9.1.0-dev.20" to clipboard
mtrust_urp_ble_strategy: ^9.1.0-dev.20 copied to clipboard

Bluetooth Low Energy connection strategy for M-Trust URP readers, covering scanning, pairing and the GATT transport.

example/README.md

BLE strategy example #

Connect to a reader over Bluetooth Low Energy.

import 'package:mtrust_urp_core/mtrust_urp_core.dart';
import 'package:mtrust_urp_ble_strategy/mtrust_urp_ble_strategy.dart';

Future<void> main() async {
  final strategy = UrpBleStrategy();

  // Bluetooth may be unsupported, off, or missing runtime permissions.
  final availability = await strategy.availability;
  if (availability != StrategyAvailability.ready) {
    print('bluetooth not ready: $availability');
    return;
  }

  await strategy.findAndConnectDevice(readerTypes: {UrpDeviceType.urpImz});
  await strategy.disconnectDevice();
}

Android needs BLUETOOTH_SCAN and BLUETOOTH_CONNECT granted at runtime, and iOS needs NSBluetoothAlwaysUsageDescription. See the package README.

0
likes
140
points
202
downloads

Documentation

Documentation
API reference

Publisher

verified publishermtrust.io

Weekly Downloads

Bluetooth Low Energy connection strategy for M-Trust URP readers, covering scanning, pairing and the GATT transport.

Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

async, collection, flutter, flutter_blue_plus, mtrust_urp_core

More

Packages that depend on mtrust_urp_ble_strategy