@@ -166,22 +166,6 @@ bool BaseApplication::sIsFactoryResetTriggered = false;
166
166
LEDWidget * BaseApplication::sAppActionLed = nullptr ;
167
167
BaseApplicationDelegate BaseApplication::sAppDelegate = BaseApplicationDelegate();
168
168
169
- #ifdef DIC_ENABLE
170
- namespace {
171
- void AppSpecificConnectivityEventCallback (const ChipDeviceEvent * event, intptr_t arg)
172
- {
173
- SILABS_LOG (" AppSpecificConnectivityEventCallback: call back for IPV4" );
174
- if ((event->Type == DeviceEventType::kInternetConnectivityChange ) &&
175
- (event->InternetConnectivityChange .IPv4 == kConnectivity_Established ))
176
- {
177
- SILABS_LOG (" Got IPv4 Address! Starting DIC module\n " );
178
- if (DIC_OK != dic_init (dic::control::subscribeCB))
179
- SILABS_LOG (" Failed to initialize DIC module\n " );
180
- }
181
- }
182
- } // namespace
183
- #endif // DIC_ENABLE
184
-
185
169
void BaseApplicationDelegate::OnCommissioningSessionStarted ()
186
170
{
187
171
isComissioningStarted = true ;
@@ -203,7 +187,7 @@ void BaseApplicationDelegate::OnCommissioningWindowClosed()
203
187
ChipLogError (DeviceLayer, " Failed to enable the TA Deep Sleep" );
204
188
}
205
189
}
206
- #endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917qq
190
+ #endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917
207
191
}
208
192
209
193
void BaseApplicationDelegate::OnFabricCommitted (const FabricTable & fabricTable, FabricIndex fabricIndex)
@@ -297,10 +281,6 @@ CHIP_ERROR BaseApplication::Init()
297
281
SILABS_LOG (" Current Software Version String: %s" , CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING);
298
282
SILABS_LOG (" Current Software Version: %d" , CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION);
299
283
300
- #ifdef DIC_ENABLE
301
- chip::DeviceLayer::PlatformMgr ().AddEventHandler (AppSpecificConnectivityEventCallback, reinterpret_cast <intptr_t >(nullptr ));
302
- #endif // DIC_ENABLE
303
-
304
284
ConfigurationMgr ().LogDeviceConfig ();
305
285
306
286
OutputQrCode (true /* refreshLCD at init*/ );
@@ -730,14 +710,25 @@ SilabsLCD & BaseApplication::GetLCD(void)
730
710
return slLCD;
731
711
}
732
712
733
- void BaseApplication::UpdateLCDStatusScreen (void )
713
+ void BaseApplication::UpdateLCDStatusScreen (bool withChipStackLock )
734
714
{
735
715
SilabsLCD::DisplayStatus_t status;
736
716
bool enabled, attached;
737
- chip::DeviceLayer::PlatformMgr ().LockChipStack ();
717
+ if (withChipStackLock)
718
+ {
719
+ chip::DeviceLayer::PlatformMgr ().LockChipStack ();
720
+ }
738
721
#ifdef SL_WIFI
739
722
enabled = ConnectivityMgr ().IsWiFiStationEnabled ();
740
723
attached = ConnectivityMgr ().IsWiFiStationConnected ();
724
+ chip::DeviceLayer::NetworkCommissioning::Network network;
725
+ memset (reinterpret_cast <void *>(&network), 0 , sizeof (network));
726
+ chip::DeviceLayer::NetworkCommissioning::GetConnectedNetwork (network);
727
+ if (network.networkIDLen )
728
+ {
729
+ chip::Platform::CopyString (status.networkName , sizeof (status.networkName ),
730
+ reinterpret_cast <const char *>(network.networkID ));
731
+ }
741
732
#endif /* SL_WIFI */
742
733
#if CHIP_ENABLE_OPENTHREAD
743
734
enabled = ConnectivityMgr ().IsThreadEnabled ();
@@ -751,7 +742,10 @@ void BaseApplication::UpdateLCDStatusScreen(void)
751
742
? SilabsLCD::ICDMode_e::SIT
752
743
: SilabsLCD::ICDMode_e::LIT;
753
744
#endif
754
- chip::DeviceLayer::PlatformMgr ().UnlockChipStack ();
745
+ if (withChipStackLock)
746
+ {
747
+ chip::DeviceLayer::PlatformMgr ().UnlockChipStack ();
748
+ }
755
749
slLCD.SetStatus (status);
756
750
}
757
751
#endif
@@ -822,10 +816,33 @@ void BaseApplication::DoProvisioningReset()
822
816
823
817
void BaseApplication::OnPlatformEvent (const ChipDeviceEvent * event, intptr_t )
824
818
{
825
- if (event->Type == DeviceEventType:: kServiceProvisioningChange )
819
+ switch (event->Type )
826
820
{
821
+ case DeviceEventType::kServiceProvisioningChange :
827
822
// Note: This is only called on Attach, we need to add a method to detect Thread Network Detach
828
823
BaseApplication::sIsProvisioned = event->ServiceProvisioningChange .IsServiceProvisioned ;
824
+ break ;
825
+ case DeviceEventType::kInternetConnectivityChange :
826
+ #ifdef DIC_ENABLE
827
+ VerifyOrReturn (event->InternetConnectivityChange .IPv4 == kConnectivity_Established );
828
+ if (DIC_OK != dic_init (dic::control::subscribeCB))
829
+ {
830
+ SILABS_LOG (" Failed to initialize DIC module\n " );
831
+ }
832
+ #endif // DIC_ENABLE
833
+ break ;
834
+ case DeviceEventType::kWiFiConnectivityChange :
835
+ #ifdef DISPLAY_ENABLED
836
+ SilabsLCD::Screen_e screen;
837
+ AppTask::GetLCD ().GetScreen (screen);
838
+ // Update the LCD screen with SSID and connected state
839
+ VerifyOrReturn (screen == SilabsLCD::Screen_e::StatusScreen);
840
+ BaseApplication::UpdateLCDStatusScreen (false );
841
+ AppTask::GetLCD ().SetScreen (screen);
842
+ #endif // DISPLAY_ENABLED
843
+ break ;
844
+ default :
845
+ break ;
829
846
}
830
847
}
831
848
0 commit comments