@ -37,6 +37,11 @@ class ObserverConfigService extends ChangeNotifier {
String ? _lastError ;
String ? _lastError ;
String ? get lastError = > _lastError ;
String ? get lastError = > _lastError ;
/ / / True when the broker - pool dump failed but the flat settings read OK — the
/ / / UI shows the broker section as unavailable instead of blanking the pane .
bool _brokersUnavailable = false ;
bool get brokersUnavailable = > _brokersUnavailable ;
/ / / Whether the connected device supports the config command — the version
/ / / Whether the connected device supports the config command — the version
/ / / gate AND the capability bit , read live from the connector ' s device-info
/ / / gate AND the capability bit , read live from the connector ' s device-info
/ / / parse . The settings UI watches the connector , so the Observer category
/ / / parse . The settings UI watches the connector , so the Observer category
@ -164,28 +169,27 @@ class ObserverConfigService extends ChangeNotifier {
final rotation = await getFlat ( ' display.rotation ' ) ;
final rotation = await getFlat ( ' display.rotation ' ) ;
final brokers = await getBrokers ( ) ;
final brokers = await getBrokers ( ) ;
if ( brokers = = null ) {
/ / The broker pool loads independently of the flat settings: a broker - dump
_stale = true ;
/ / failure ( e . g . the firmware never sends BROKERS_END ) must NOT blank
notifyListeners ( ) ;
/ / settings that read cleanly . Surface it as broker - only " unavailable " .
return ;
}
_config = ObserverConfig (
_config = ObserverConfig (
wifi: _parseWifi ( ssid , wifiEnabled , wifiStatus ) ,
wifi: _parseWifi ( ssid , wifiEnabled , wifiStatus ) ,
mqtt: MqttGlobalConfig (
mqtt: MqttGlobalConfig (
iata: iata ? ? ' ' ,
iata: iata ? ? ' ' ,
statusInterval: int . tryParse ( statusInterval ? ? ' ' ) ? ? 60 ,
statusInterval: int . tryParse ( statusInterval ? ? ' ' ) ? ? 60 ,
) ,
) ,
brokers: brokers ,
brokers: brokers ? ? const [ ] ,
display: DisplayConfig (
display: DisplayConfig (
alwaysOn: alwaysOn = = ' 1 ' ,
alwaysOn: alwaysOn = = ' 1 ' ,
rotation: int . tryParse ( rotation ? ? ' ' ) ? ? 0 ,
rotation: int . tryParse ( rotation ? ? ' ' ) ? ? 0 ,
) ,
) ,
) ;
) ;
/ / A null from any getFlat is a failed read ( GET returns the value , null
_brokersUnavailable = brokers = = null ;
/ / on ERR / timeout ) . Don ' t present defaults as a complete snapshot or wipe
/ / the error a failed field already surfaced ( SAFELANE error - visibility ) .
/ / A null from any flat getFlat is a failed read ( GET returns the value ,
final allRead =
/ / null on ERR / timeout ) . Stale reflects the FLAT read only ; a broker miss
/ / is shown in its own section , not as a stale snapshot ( SAFELANE § 6 ) .
final allFlatRead =
ssid ! = null & &
ssid ! = null & &
wifiEnabled ! = null & &
wifiEnabled ! = null & &
wifiStatus ! = null & &
wifiStatus ! = null & &
@ -193,8 +197,8 @@ class ObserverConfigService extends ChangeNotifier {
statusInterval ! = null & &
statusInterval ! = null & &
alwaysOn ! = null & &
alwaysOn ! = null & &
rotation ! = null ;
rotation ! = null ;
_stale = ! all Read;
_stale = ! all Flat Read;
if ( all Read) _lastError = null ;
if ( all Flat Read) _lastError = null ;
notifyListeners ( ) ;
notifyListeners ( ) ;
} catch ( e ) {
} catch ( e ) {
_stale = true ;
_stale = true ;