From fe4b42519dfc598d958db97939eb25ea98c85fdc Mon Sep 17 00:00:00 2001 From: SP2FET Date: Fri, 29 Jan 2021 12:34:42 +0100 Subject: [PATCH] [EGD-5471] Add Bluetooth on/off state diagram Added state machine diagram for Bluetooth power on/off --- module-bluetooth/README.md | 4 ++ module-bluetooth/bt_on_off_state_diagram.puml | 34 ++++++++++++ module-bluetooth/bt_on_off_state_diagram.svg | 53 +++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 module-bluetooth/bt_on_off_state_diagram.puml create mode 100644 module-bluetooth/bt_on_off_state_diagram.svg diff --git a/module-bluetooth/README.md b/module-bluetooth/README.md index 802150858ab339cf3d8cadc4fe2ce05d0e9faf82..493bdfc852e3f673ba8b6905079a0411f18401db 100644 --- a/module-bluetooth/README.md +++ b/module-bluetooth/README.md @@ -45,3 +45,7 @@ When all variables are loaded from *DB*, then *BluetoothWorker* reloads Bluetoot Flowchart below is an example of scenario, when user opens *BluetoothWindow*, and tries to change some of settings presented there. ![change_bt_status_flowchart](./change_bt_status_flowchart.svg) + +# Bluetooth on/off state machine diagram +To be able to handle all events during start up and shutting down of the Bluetooth module the following state machine has been implemented: +![bt_on_off_state_diagram](./bt_on_off_state_diagram.svg) diff --git a/module-bluetooth/bt_on_off_state_diagram.puml b/module-bluetooth/bt_on_off_state_diagram.puml new file mode 100644 index 0000000000000000000000000000000000000000..1aba6842c4b480a8821901fe34931ff3a1d5c4af --- /dev/null +++ b/module-bluetooth/bt_on_off_state_diagram.puml @@ -0,0 +1,34 @@ +@startuml + +[*] --> Off +Off: Bluetooth turned off +Off: Initial state + +Off --> Init : Command::TurnOn /worker->init() + + +state Init{ +Init: Initialization of BT stack +Init: Creating BluetoothWorker + +[*] --> WorkerSetup +WorkerSetup: Settings fetch & setup +WorkerSetup: BT driver setup + +state DriverRun{ +DriverRun: Turning on BT stack +} +WorkerSetup --> DriverRun : / initDone = 1 + +DriverRun -r-> Off: Turned on [error != 0]/ send status to appMgr +DriverRun --> On: Turned on [error == 0]/ send status to appMgr +} +state Restart { +Restart: Restart Bluetooth Stack in case of hard error +} +state On{ +On: BT stack fully operating +} +On --> Off : Command::TurnOff +Restart --> Init :/worker->Init() +@enduml diff --git a/module-bluetooth/bt_on_off_state_diagram.svg b/module-bluetooth/bt_on_off_state_diagram.svg new file mode 100644 index 0000000000000000000000000000000000000000..375c9f99512d5e7d8e07288e7c1885e090b26d2a --- /dev/null +++ b/module-bluetooth/bt_on_off_state_diagram.svg @@ -0,0 +1,53 @@ +InitInitialization of BT stackCreating BluetoothWorkerWorkerSetupSettings fetch & setupBT driver setupDriverRunTurning on BT stackOffBluetooth turned offInitial stateRestartRestart Bluetooth Stack in case of hard errorOnBT stack fully operatingCommand::TurnOn /worker->init()/ initDone = 1Turned on [error != 0]/ send status to appMgrTurned on [error == 0]/ send status to appMgrCommand::TurnOff/worker->Init() \ No newline at end of file