onEvent method
Called when an event is received by the FSM
Implementation
@override
Future<bool> onEvent(
{required FsmEvent event, required FsmOwner owner}) async {
BleDeviceOwner deviceOwner = owner as BleDeviceOwner;
debugPrintSynchronously("OnEnter: BleDeviceDisconnectingState ${deviceOwner.device.getId()} - Event $event");
if (event is BleDeviceConnectionStateChangedEvent) {
if (event.newState == BleConnectionState.disconnected) {
deviceOwner._notifyState(state: BleSetupState.disconnected);
// Transition to initial state to be able to connect once again on user request.
//await owner.getFsm()?.changeState(nextState: BleInitialState());
owner.getFsm()?.changeState(nextState: BleInitialState());
}
return true;
}
return false;
}