@startuml

title Happy path initialization of prplMesh Agent

participant backhaul_manager
participant platform_manager
participant son_slave
participant ap_manager
participant ap_wlan_hal
participant monitor
participant mon_wlan_hal
participant transport

activate backhaul_manager
activate platform_manager
activate son_slave

backhaul_manager -> backhaul_manager: goto INIT
backhaul_manager -> backhaul_manager: goto WAIT_ENABLE

...

son_slave -> son_slave: goto STATE_INIT
son_slave -> son_slave: goto STATE_CONNECT_TO_PLATFORM_MANAGER
son_slave -> platform_manager: send ACTION_PLATFORM_SON_SLAVE_REGISTER_REQUEST
son_slave -> son_slave: goto STATE_WAIT_FOR_PLATFORM_MANAGER_REGISTER_RESPONSE
platform_manager -> platform_manager: fill_platform_settings()
platform_manager -> son_slave: send ACTION_PLATFORM_SON_SLAVE_REGISTER_RESPONSE
son_slave -> son_slave: goto STATE_CONNECT_TO_BACKHAUL_MANAGER
son_slave -> backhaul_manager: send ACTION_BACKHAUL_REGISTER_REQUEST
son_slave -> son_slave: goto STATE_WAIT_FOR_BACKHAUL_MANAGER_REGISTER_RESPONSE
backhaul_manager -> son_slave: send ACTION_BACKHAUL_REGISTER_RESPONSE
son_slave -> son_slave: goto STATE_JOIN_INIT
son_slave -> son_slave: fronthaul_start()
note right of son_slave: runs beerocks_fronthaul
son_slave --> ap_manager
activate ap_manager
son_slave --> monitor
son_slave -> son_slave: goto STATE_WAIT_FOR_FRONTHAUL_THREADS_JOINED

...

ap_manager -> ap_manager: goto INIT
ap_manager -> son_slave: send ACTION_APMANAGER_UP_NOTIFICATION
ap_manager -> ap_manager: goto WAIT_FOR_CONFIGURATION
son_slave -> ap_manager: send ACTION_APMANAGER_CONFIGURE
ap_manager -> ap_manager: goto ATTACHING
ap_manager -> ap_wlan_hal: attach()
ap_wlan_hal -> ap_wlan_hal: refresh_radio_info()
ap_manager -> ap_manager: goto ATTACHED
ap_manager -> ap_wlan_hal: read_acs_report()
ap_manager -> ap_manager: goto OPERATIONAL
activate monitor
ap_manager -> son_slave: send ACTION_APMANAGER_JOINED_NOTIFICATION

...

monitor -> mon_wlan_hal: attach()
mon_wlan_hal -> mon_wlan_hal: refresh_radio_info()
monitor -> son_slave: send ACTION_MONITOR_JOINED_NOTIFICATION


son_slave -> son_slave: goto STATE_BACKHAUL_ENABLE
son_slave -> son_slave: goto STATE_SEND_BACKHAUL_MANAGER_ENABLE
son_slave -> backhaul_manager: send ACTION_BACKHAUL_ENABLE
son_slave -> son_slave: goto STATE_WAIT_FOR_BACKHAUL_MANAGER_CONNECTED_NOTIFICATION
backhaul_manager -> backhaul_manager: if (pending_slave_ifaces.empty()) { pending_enable = true; }
backhaul_manager -> backhaul_manager: goto ENABLED
backhaul_manager -> backhaul_manager: goto MASTER_DISCOVERY
backhaul_manager -> transport: configure_al_mac()
backhaul_manager -> transport: configure_interfaces()
backhaul_manager -> backhaul_manager: goto WAIT_FOR_AUTOCONFIG_COMPLETE
note right of backhaul_manager: AP Autoconfiguration Task
backhaul_manager -> son_slave: ACTION_BACKHAUL_CONNECTED_NOTIFICATION
son_slave -> son_slave: goto STATE_BACKHAUL_MANAGER_CONNECTED
...
backhaul_manager -> backhaul_manager: goto CONNECT_TO_MASTER
backhaul_manager -> backhaul_manager: goto CONNECTED
backhaul_manager -> backhaul_manager: goto PRE_OPERATIONAL
backhaul_manager -> backhaul_manager: goto OPERATIONAL
...


@enduml
