@@ -166,22 +166,7 @@ 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
-
169
+ #if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917
185
170
void BaseApplicationDelegate::OnCommissioningSessionStarted ()
186
171
{
187
172
isComissioningStarted = true ;
@@ -203,7 +188,7 @@ void BaseApplicationDelegate::OnCommissioningWindowClosed()
203
188
ChipLogError (DeviceLayer, " Failed to enable the TA Deep Sleep" );
204
189
}
205
190
}
206
- #endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917qq
191
+ #endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917
207
192
}
208
193
209
194
void BaseApplicationDelegate::OnFabricCommitted (const FabricTable & fabricTable, FabricIndex fabricIndex)
@@ -234,15 +219,15 @@ CHIP_ERROR BaseApplication::StartAppTask(osThreadFunc_t taskFunction)
234
219
sAppEventQueue = osMessageQueueNew (APP_EVENT_QUEUE_SIZE, sizeof (AppEvent), &appEventQueueAttr);
235
220
if (sAppEventQueue == NULL )
236
221
{
237
- SILABS_LOG ( " Failed to allocate app event queue" );
222
+ ChipLogDetail (AppServer, " Failed to allocate app event queue" );
238
223
appError (APP_ERROR_EVENT_QUEUE_FAILED);
239
224
}
240
225
241
226
// Start App task.
242
227
sAppTaskHandle = osThreadNew (taskFunction, &sAppEventQueue , &appTaskAttr);
243
228
if (sAppTaskHandle == nullptr )
244
229
{
245
- SILABS_LOG ( " Failed to create app task" );
230
+ ChipLogDetail (AppServer, " Failed to create app task" );
246
231
appError (APP_ERROR_CREATE_TASK_FAILED);
247
232
}
248
233
return CHIP_NO_ERROR;
@@ -256,12 +241,12 @@ CHIP_ERROR BaseApplication::Init()
256
241
/*
257
242
* Wait for the WiFi to be initialized
258
243
*/
259
- SILABS_LOG ( " APP: Wait WiFi Init" );
244
+ ChipLogDetail (AppServer, " APP: Wait WiFi Init" );
260
245
while (!wfx_hw_ready ())
261
246
{
262
247
vTaskDelay (pdMS_TO_TICKS (10 ));
263
248
}
264
- SILABS_LOG ( " APP: Done WiFi Init" );
249
+ ChipLogDetail (AppServer, " APP: Done WiFi Init" );
265
250
/* We will init server when we get IP */
266
251
267
252
chip::DeviceLayer::PlatformMgr ().LockChipStack ();
@@ -278,7 +263,7 @@ CHIP_ERROR BaseApplication::Init()
278
263
);
279
264
if (sFunctionTimer == NULL )
280
265
{
281
- SILABS_LOG ( " funct timer create failed" );
266
+ ChipLogDetail (AppServer, " funct timer create failed" );
282
267
appError (APP_ERROR_CREATE_TIMER_FAILED);
283
268
}
284
269
@@ -290,16 +275,12 @@ CHIP_ERROR BaseApplication::Init()
290
275
);
291
276
if (sLightTimer == NULL )
292
277
{
293
- SILABS_LOG ( " Light Timer create failed" );
278
+ ChipLogDetail (AppServer, " Light Timer create failed" );
294
279
appError (APP_ERROR_CREATE_TIMER_FAILED);
295
280
}
296
281
297
- SILABS_LOG (" Current Software Version String: %s" , CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING);
298
- SILABS_LOG (" Current Software Version: %d" , CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION);
299
-
300
- #ifdef DIC_ENABLE
301
- chip::DeviceLayer::PlatformMgr ().AddEventHandler (AppSpecificConnectivityEventCallback, reinterpret_cast <intptr_t >(nullptr ));
302
- #endif // DIC_ENABLE
282
+ ChipLogDetail (AppServer, " Current Software Version String: %s" , CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING);
283
+ ChipLogDetail (AppServer, " Current Software Version: %d" , CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION);
303
284
304
285
ConfigurationMgr ().LogDeviceConfig ();
305
286
@@ -549,12 +530,12 @@ void BaseApplication::ButtonHandler(AppEvent * aEvent)
549
530
chip::DeviceLayer::PlatformMgr ().UnlockChipStack ();
550
531
if (err != CHIP_NO_ERROR)
551
532
{
552
- SILABS_LOG ( " Failed to open the Basic Commissioning Window" );
533
+ ChipLogDetail (AppServer, " Failed to open the Basic Commissioning Window" );
553
534
}
554
535
}
555
536
else
556
537
{
557
- SILABS_LOG ( " Network is already provisioned, Ble advertisement not enabled" );
538
+ ChipLogDetail (AppServer, " Network is already provisioned, Ble advertisement not enabled" );
558
539
#if CHIP_CONFIG_ENABLE_ICD_SERVER
559
540
// Temporarily claim network activity, until we implement a "user trigger" reason for ICD wakeups.
560
541
PlatformMgr ().ScheduleWork ([](intptr_t ) { ICDNotifier::GetInstance ().NotifyNetworkActivityNotification (); });
@@ -577,7 +558,7 @@ void BaseApplication::CancelFunctionTimer()
577
558
{
578
559
if (osTimerStop (sFunctionTimer ) == osError)
579
560
{
580
- SILABS_LOG ( " app timer stop() failed" );
561
+ ChipLogDetail (AppServer, " app timer stop() failed" );
581
562
appError (APP_ERROR_STOP_TIMER_FAILED);
582
563
}
583
564
}
@@ -587,15 +568,15 @@ void BaseApplication::StartFunctionTimer(uint32_t aTimeoutInMs)
587
568
// Starts or restarts the function timer
588
569
if (osTimerStart (sFunctionTimer , pdMS_TO_TICKS (aTimeoutInMs)) != osOK)
589
570
{
590
- SILABS_LOG ( " app timer start() failed" );
571
+ ChipLogDetail (AppServer, " app timer start() failed" );
591
572
appError (APP_ERROR_START_TIMER_FAILED);
592
573
}
593
574
}
594
575
595
576
void BaseApplication::StartFactoryResetSequence ()
596
577
{
597
578
// Initiate the factory reset sequence
598
- SILABS_LOG ( " Factory Reset Triggered. Release button within %ums to cancel." , FACTORY_RESET_CANCEL_WINDOW_TIMEOUT);
579
+ ChipLogDetail (AppServer, " Factory Reset Triggered. Release button within %ums to cancel." , FACTORY_RESET_CANCEL_WINDOW_TIMEOUT);
599
580
600
581
// Start timer for FACTORY_RESET_CANCEL_WINDOW_TIMEOUT to allow user to
601
582
// cancel, if required.
@@ -624,15 +605,15 @@ void BaseApplication::CancelFactoryResetSequence()
624
605
if (sIsFactoryResetTriggered )
625
606
{
626
607
sIsFactoryResetTriggered = false ;
627
- SILABS_LOG ( " Factory Reset has been Canceled" );
608
+ ChipLogDetail (AppServer, " Factory Reset has been Canceled" );
628
609
}
629
610
}
630
611
631
612
void BaseApplication::StartStatusLEDTimer ()
632
613
{
633
614
if (osTimerStart (sLightTimer , kLightTimerPeriod ) != osOK)
634
615
{
635
- SILABS_LOG ( " Light Time start failed" );
616
+ ChipLogDetail (AppServer, " Light Time start failed" );
636
617
appError (APP_ERROR_START_TIMER_FAILED);
637
618
}
638
619
}
@@ -645,7 +626,7 @@ void BaseApplication::StopStatusLEDTimer()
645
626
646
627
if (osTimerStop (sLightTimer ) == osError)
647
628
{
648
- SILABS_LOG ( " Light Time start failed" );
629
+ ChipLogDetail (AppServer, " Light Time start failed" );
649
630
appError (APP_ERROR_STOP_TIMER_FAILED);
650
631
}
651
632
}
@@ -762,12 +743,12 @@ void BaseApplication::PostEvent(const AppEvent * aEvent)
762
743
{
763
744
if (osMessageQueuePut (sAppEventQueue , aEvent, osPriorityNormal, 0 ) != osOK)
764
745
{
765
- SILABS_LOG ( " Failed to post event to app task event queue" );
746
+ ChipLogDetail (AppServer, " Failed to post event to app task event queue" );
766
747
}
767
748
}
768
749
else
769
750
{
770
- SILABS_LOG ( " App Event Queue is uninitialized" );
751
+ ChipLogDetail (AppServer, " App Event Queue is uninitialized" );
771
752
}
772
753
}
773
754
@@ -779,7 +760,7 @@ void BaseApplication::DispatchEvent(AppEvent * aEvent)
779
760
}
780
761
else
781
762
{
782
- SILABS_LOG ( " Event received with no handler. Dropping event." );
763
+ ChipLogDetail (AppServer, " Event received with no handler. Dropping event." );
783
764
}
784
765
}
785
766
@@ -827,6 +808,16 @@ void BaseApplication::OnPlatformEvent(const ChipDeviceEvent * event, intptr_t)
827
808
// Note: This is only called on Attach, we need to add a method to detect Thread Network Detach
828
809
BaseApplication::sIsProvisioned = event->ServiceProvisioningChange .IsServiceProvisioned ;
829
810
}
811
+ #ifdef DIC_ENABLE
812
+ else if (event->Type == DeviceEventType::kInternetConnectivityChange )
813
+ {
814
+ VerifyOrReturn (event->InternetConnectivityChange .IPv4 == kConnectivity_Established );
815
+ if (DIC_OK != dic_init (dic::control::subscribeCB))
816
+ {
817
+ ChipLogDetail (AppServer, " Failed to initialize DIC module" );
818
+ }
819
+ }
820
+ #endif // DIC_ENABLE
830
821
}
831
822
832
823
void BaseApplication::OutputQrCode (bool refreshLCD)
@@ -853,7 +844,7 @@ void BaseApplication::OutputQrCode(bool refreshLCD)
853
844
}
854
845
else
855
846
{
856
- SILABS_LOG ( " Getting QR code failed!" );
847
+ ChipLogDetail (AppServer, " Getting QR code failed!" );
857
848
}
858
849
}
859
850
0 commit comments