3
3
import os
4
4
from application .config_manager import ConfigManager
5
5
from application .constants import (
6
- DEVICE_NAME ,
6
+ DEFAULT_DEVICE_NAME ,
7
7
CFG_KEY_RADIO_DRIVER_NAME ,
8
8
CFG_KEY_WIFI_NAME ,
9
9
CFG_KEY_RADIO_BAUD_RATE ,
10
10
CFG_KEY_RADIO_DATA_BITS ,
11
11
CFG_KEY_RADIO_STOP_BITS ,
12
12
CFG_KEY_RADIO_PARITY ,
13
- SPLASH_SCREEN_WAIT_TIME ,
14
13
RADIO_DRIVER_FILE_PATH ,
14
+ CFG_KEY_STARTUP_SCREEN_WAIT_TIME ,
15
15
)
16
16
from application .setup_manager import SetupManager
17
17
from application .wifi_manager import WifiManager
@@ -168,12 +168,14 @@ async def run(self):
168
168
self ._logger .debug ("Starting websocket client task" )
169
169
websocket_client_task = WebsocketClientTask (
170
170
logger = self ._logger ,
171
+ message_broker = self ._message_broker ,
172
+ omnirig_helper = self ._omnirig_helper ,
173
+ omnirig_command_executor = self ._omnirig_command_executor ,
174
+ config_manager = self ._config_manager ,
171
175
)
172
176
asyncio .create_task (websocket_client_task .run ())
177
+ asyncio .create_task (websocket_client_task .run_trx_status_messages_subscriber ())
173
178
self ._tasks_to_stop_when_setup_is_launched .append (websocket_client_task )
174
-
175
- # todo server for cloudlog offline - conditional based on config?
176
- # todo websocket client for wavelog bandlist???
177
179
178
180
asyncio .get_event_loop ().run_forever ()
179
181
@@ -211,7 +213,7 @@ async def _wait_for_setup_button_long_press_event(
211
213
212
214
self ._stop_tasks_that_dont_need_to_run_when_setup_is_launched ()
213
215
214
- access_point_ssid = DEVICE_NAME
216
+ access_point_ssid = DEFAULT_DEVICE_NAME
215
217
self ._logger .debug (f"Creating wi-fi access point with ssid '{ access_point_ssid } '" )
216
218
device_ip_address = self ._wifi_manager .create_wifi_access_point (
217
219
essid = access_point_ssid
@@ -235,9 +237,9 @@ def _run_startup_sequence(self):
235
237
"""
236
238
Perform necessary initialization tasks
237
239
"""
238
- config = self ._config_manager .read_config ()
239
- self ._display_splash_screen (config = config )
240
- time .sleep (SPLASH_SCREEN_WAIT_TIME ) # TODO configurable?
240
+ config = self ._config_manager .get_config ()
241
+ self ._display_splash_screen (config_manager = self . _config_manager )
242
+ time .sleep (int ( config [ CFG_KEY_STARTUP_SCREEN_WAIT_TIME ]))
241
243
242
244
self ._logger .info ("Setting up wi-fi" )
243
245
self ._wifi_manager .setup_wifi_as_client ()
@@ -248,7 +250,7 @@ def _radio_driver_is_missing(self, config_manager: ConfigManager) -> bool:
248
250
"""
249
251
Check if radio driver was not yet set up by user on the setup screen
250
252
"""
251
- config = config_manager .read_config ()
253
+ config = config_manager .get_config ()
252
254
radio_driver_file_exists = RADIO_DRIVER_FILE_PATH in os .listdir ()
253
255
config_entry_exists = config .get (CFG_KEY_RADIO_DRIVER_NAME )
254
256
return not radio_driver_file_exists or not config_entry_exists
@@ -296,10 +298,13 @@ def _configure_uart(self, config: dict):
296
298
f"{ uart_baudrate } -{ uart_bits } -{ parity_str } -{ uart_stop_bits } "
297
299
)
298
300
299
- def _display_splash_screen (self , config : dict ):
301
+ def _display_splash_screen (self , config_manager : ConfigManager ):
300
302
"""
301
303
Display splash (startup) screen with some useful info
302
304
"""
305
+ config = config_manager .get_config ()
306
+ device_id = config_manager .get_device_id ()
307
+
303
308
uart_baudrate = int (config .get (CFG_KEY_RADIO_BAUD_RATE ))
304
309
uart_bits = int (config .get (CFG_KEY_RADIO_DATA_BITS ))
305
310
uart_stop_bits = int (config .get (CFG_KEY_RADIO_STOP_BITS ))
@@ -313,7 +318,7 @@ def _display_splash_screen(self, config: dict):
313
318
parity = 'N'
314
319
315
320
text_rows = [
316
- DEVICE_NAME ,
321
+ device_id ,
317
322
"" ,
318
323
f"Radio: { config .get (CFG_KEY_RADIO_DRIVER_NAME )} " ,
319
324
f"Wifi: { config .get (CFG_KEY_WIFI_NAME )} " ,
0 commit comments