FeasyBeacon class

High-level Flutter API for FeasyBeacon SDK.

This class provides a unified interface for interacting with Feasycom BLE beacons across both Android and iOS platforms. It handles all aspects of beacon management including scanning, connection, configuration, and background monitoring.

Key Features

  • BLE Scanning: Discover nearby beacon devices
  • Device Management: Connect, configure, and control beacons
  • Background Monitoring: Cross-platform event detection
  • OTA Updates: Firmware update capabilities
  • Parameter Configuration: Full device parameter management

Platform Support

  • Android: Full support with foreground service background monitoring
  • iOS: Full support with Core Location region monitoring

Usage Example

// Start scanning for beacons
await FeasyBeacon.startScan();

// Connect to a specific device
final connected = await FeasyBeacon.connect(
  address: 'AA:BB:CC:DD:EE:FF',
  pin: '000000'
);

// Start background monitoring
await FeasyBeacon.startBackgroundMonitoring(config: {
  'thresholdMs': 200,
  'favoriteAddresses': ['AA:BB:CC:DD:EE:FF'],
});

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

backgroundEvents Stream<Map<String, dynamic>>
Comprehensive background monitoring events with detailed event types.
no setter
deviceInfoStream Stream<Map<String, dynamic>>
Stream of device information updates.
no setter
otaProgressStream Stream<Map<String, dynamic>>
Stream of OTA update progress events.
no setter
packetStream Stream<Map<String, dynamic>>
Stream of packet communication events.
no setter
scanStream Stream<Map<String, dynamic>>
Stream of BLE scan results as decoded maps.
no setter

Static Methods

addBeaconInfo(Map<String, dynamic> beaconMap) Future<void>
Add new beacon configuration information.
beaconBroadcastParameters() Future<List<Map<String, dynamic>>>
Get all beacon broadcast parameters.
checkDfuFile(Uint8List fileBytes) Future<Map<String, dynamic>?>
Check if a DFU file is valid for OTA update.
connect({required String address, String pin = '000000'}) Future<bool>
Connect to a beacon device using its MAC address and PIN.
deleteBeaconInfo(int index) Future<void>
Delete beacon configuration at specified index.
disconnect() Future<void>
Disconnect from the currently connected beacon device.
getBeaconInfo(int index) Future<Map<String, dynamic>?>
Get beacon configuration at specified index.
getDeviceInfo({bool isTxPower = true}) Future<Map<String, dynamic>?>
Get comprehensive device information for the connected beacon.
isConnected() Future<bool>
Check if currently connected to a beacon device.
restore() Future<void>
Restore beacon configuration from device memory.
saveBeaconInfo() Future<void>
Save current beacon configuration to device memory.
setBroadcastExtensions(bool enabled) Future<void>
Enable or disable broadcast extensions.
setBroadcastInterval(String intervalHex) Future<void>
Set the broadcast interval for the connected beacon.
setConnectable(bool on) Future<void>
Enable or disable connectable mode.
setDeviceName(String name) Future<void>
Set the device name for the connected beacon.
setDevicePin(String pin) Future<void>
Set the PIN code for the connected beacon.
setGsensor(bool enabled) Future<void>
Enable or disable G-sensor functionality.
setKey(bool enabled) Future<void>
Enable or disable key functionality.
setLongRange(bool enabled) Future<void>
Enable or disable long range mode.
setPhy(String value) Future<void>
Set the PHY mode for the connected beacon.
setTlm(bool enabled) Future<void>
Enable or disable TLM (Telemetry) broadcasting.
setTxPower(String value) Future<void>
Set the transmit power level for the connected beacon.
startBackgroundMonitoring({Map<String, Object?> config = const {}}) Future<bool>
Start comprehensive background monitoring on both Android and iOS.
startIosBackgroundMonitoring({required String uuid, int? major, int? thresholdMs}) Future<bool>
Convenience helper for iOS: start region-based monitoring for a specific iBeacon UUID.
startOtaUpdate(Uint8List fileBytes, {bool reset = false}) Future<bool>
Start OTA firmware update process.
startScan() Future<bool>
Start BLE scan for nearby beacon devices.
stopBackgroundMonitoring() Future<void>
Stop background monitoring on both Android and iOS.
stopScan() Future<void>
Stop BLE scanning.
updateBeaconInfo(Map<String, dynamic> beaconMap, int index) Future<void>
Update existing beacon configuration at specified index.