keyRefreshPhaseSet method

Future<ConfigKeyRefreshPhaseStatus> keyRefreshPhaseSet({
  1. int address = 0xFFFF,
  2. int netKeyIndex = 0,
  3. int transition = useNewKeys,
})

Will send a ConfigKeyRefreshPhaseSet message to the given address.

Implementation

Future<ConfigKeyRefreshPhaseStatus> keyRefreshPhaseSet({
  int address = 0xFFFF,
  int netKeyIndex = 0,
  int transition = useNewKeys,
}) async {
  if (Platform.isAndroid) {
    final status = _onConfigKeyRefreshPhaseStatusController.stream.firstWhere(
      (element) => address != 0xFFFF || element.source == address,
      orElse: () => const ConfigKeyRefreshPhaseStatus(-1, -1, -1, 'timeout', -1, -1),
    );
    await _methodChannel.invokeMethod('keyRefreshPhaseSet', {
      'address': address,
      'netKeyIndex': netKeyIndex,
      'transition': transition,
    });
    return status;
  } else {
    throw UnimplementedError('${Platform.environment} not supported');
  }
}