BluetoothConnectionBloc constructor

BluetoothConnectionBloc(
  1. BluetoothSerialService _bluetoothService
)

Implementation

BluetoothConnectionBloc(this._bluetoothService)
    : super(const BluetoothConnectionStateLocal()) {
  on<StartBluetoothScan>(_onStartBluetoothScan);
  on<ConnectToDevice>(_onConnectToDevice);
  on<DisconnectDevice>(_onDisconnectDevice);
  on<DataReceived>(_onDataReceived);

  // Set up data listener from the Bluetooth service
  _bluetoothService.onDataReceived = (BluetoothData data) {
    // print("in BLoC?? -> ${data.mValue}");
    add(DataReceived(data));
  };
}