activate method

  1. @override
Future<void> activate(
  1. Future<TestDeviceInfo> testDeviceInfoBuilder()
)

Instructs the driver to connect to the external source. By the time the returned Future completes, the commandStream must be available to be listened to.

Implementation

@override
Future<void> activate(
  Future<TestDeviceInfo> Function() testDeviceInfoBuilder,
) async {
  _testDeviceInfoBuilder = testDeviceInfoBuilder;
  _active = true;

  _commandTimer?.cancel();
  _commandTimer = null;

  _pingTimer?.cancel();

  _reconnectTimer?.cancel();
  _reconnectTimer = null;

  await _channelSubscription?.cancel();
  _channelSubscription = null;

  await _commandStreamController?.close();
  _commandQueue.clear();
  _commandStreamController = StreamController<DeviceCommand>.broadcast();

  await _connect();
}