setSNBeacon method

Future<ConfigBeaconStatus> setSNBeacon({
  1. int address = 0xFFFF,
  2. bool enable = false,
})

Will set the beacon configuration.

If enable is true, the node that receives this message will periodically send Secure Network Beacons.

Implementation

Future<ConfigBeaconStatus> setSNBeacon({
  int address = 0xFFFF,
  bool enable = false,
}) async {
  if (Platform.isAndroid || Platform.isIOS) {
    final status = _onConfigBeaconStatusController.stream.firstWhere(
      (element) => element.source == address,
      orElse: () => const ConfigBeaconStatus(-1, -1, false),
    );
    await _methodChannel.invokeMethod('setSNBeacon', {
      'address': address,
      'enable': enable,
    });
    return status;
  } else {
    throw UnimplementedError('${Platform.environment} not supported');
  }
}