MonitorSession constructor

MonitorSession(
  1. AtClient _atClient, {
  2. String? regex,
  3. bool shouldDecrypt = true,
  4. IOSink? output,
})

Implementation

MonitorSession(this._atClient, {String? regex, bool shouldDecrypt = true, IOSink? output})
    : _regex = regex ?? defaultMonitorRegex,
      _shouldDecrypt = shouldDecrypt,
      _output = output ?? stdout {

  _output.writeln(green.wrap(
      "Starting monitor${_regex != defaultMonitorRegex ? ' with regex: $_regex' : ' (excluding statsNotification)'}..."));
  _output.writeln(cyan.wrap("Type 'q' to stop monitoring"));

  Stream<AtNotification> stream = _atClient.notificationService
      .subscribe(regex: _regex, shouldDecrypt: _shouldDecrypt);
  stream.listen(_onData);

  _output.writeln(lightYellow.wrap(
      "Monitor session started. Using regex: '$_regex'. Waiting for notifications..."));
}