@@ -165,22 +165,6 @@ LEDWidget * BaseApplication::sAppActionLed = nullptr;
165
165
BaseApplicationDelegate BaseApplication::sAppDelegate = BaseApplicationDelegate();
166
166
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917
167
167
168
- #ifdef DIC_ENABLE
169
- namespace {
170
- void AppSpecificConnectivityEventCallback (const ChipDeviceEvent * event, intptr_t arg)
171
- {
172
- SILABS_LOG (" AppSpecificConnectivityEventCallback: call back for IPV4" );
173
- if ((event->Type == DeviceEventType::kInternetConnectivityChange ) &&
174
- (event->InternetConnectivityChange .IPv4 == kConnectivity_Established ))
175
- {
176
- SILABS_LOG (" Got IPv4 Address! Starting DIC module\n " );
177
- if (DIC_OK != dic_init (dic::control::subscribeCB))
178
- SILABS_LOG (" Failed to initialize DIC module\n " );
179
- }
180
- }
181
- } // namespace
182
- #endif // DIC_ENABLE
183
-
184
168
#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917
185
169
void BaseApplicationDelegate::OnCommissioningSessionStarted ()
186
170
{
@@ -212,15 +196,15 @@ CHIP_ERROR BaseApplication::StartAppTask(osThreadFunc_t taskFunction)
212
196
sAppEventQueue = osMessageQueueNew (APP_EVENT_QUEUE_SIZE, sizeof (AppEvent), &appEventQueueAttr);
213
197
if (sAppEventQueue == NULL )
214
198
{
215
- SILABS_LOG ( " Failed to allocate app event queue" );
199
+ ChipLogDetail (AppServer, " Failed to allocate app event queue" );
216
200
appError (APP_ERROR_EVENT_QUEUE_FAILED);
217
201
}
218
202
219
203
// Start App task.
220
204
sAppTaskHandle = osThreadNew (taskFunction, &sAppEventQueue , &appTaskAttr);
221
205
if (sAppTaskHandle == nullptr )
222
206
{
223
- SILABS_LOG ( " Failed to create app task" );
207
+ ChipLogDetail (AppServer, " Failed to create app task" );
224
208
appError (APP_ERROR_CREATE_TASK_FAILED);
225
209
}
226
210
return CHIP_NO_ERROR;
@@ -234,12 +218,12 @@ CHIP_ERROR BaseApplication::Init()
234
218
/*
235
219
* Wait for the WiFi to be initialized
236
220
*/
237
- SILABS_LOG ( " APP: Wait WiFi Init" );
221
+ ChipLogDetail (AppServer, " APP: Wait WiFi Init" );
238
222
while (!wfx_hw_ready ())
239
223
{
240
224
vTaskDelay (pdMS_TO_TICKS (10 ));
241
225
}
242
- SILABS_LOG ( " APP: Done WiFi Init" );
226
+ ChipLogDetail (AppServer, " APP: Done WiFi Init" );
243
227
/* We will init server when we get IP */
244
228
245
229
chip::DeviceLayer::PlatformMgr ().LockChipStack ();
@@ -256,7 +240,7 @@ CHIP_ERROR BaseApplication::Init()
256
240
);
257
241
if (sFunctionTimer == NULL )
258
242
{
259
- SILABS_LOG ( " funct timer create failed" );
243
+ ChipLogDetail (AppServer, " funct timer create failed" );
260
244
appError (APP_ERROR_CREATE_TIMER_FAILED);
261
245
}
262
246
@@ -268,16 +252,12 @@ CHIP_ERROR BaseApplication::Init()
268
252
);
269
253
if (sLightTimer == NULL )
270
254
{
271
- SILABS_LOG ( " Light Timer create failed" );
255
+ ChipLogDetail (AppServer, " Light Timer create failed" );
272
256
appError (APP_ERROR_CREATE_TIMER_FAILED);
273
257
}
274
258
275
- SILABS_LOG (" Current Software Version String: %s" , CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING);
276
- SILABS_LOG (" Current Software Version: %d" , CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION);
277
-
278
- #ifdef DIC_ENABLE
279
- chip::DeviceLayer::PlatformMgr ().AddEventHandler (AppSpecificConnectivityEventCallback, reinterpret_cast <intptr_t >(nullptr ));
280
- #endif // DIC_ENABLE
259
+ ChipLogDetail (AppServer, " Current Software Version String: %s" , CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING);
260
+ ChipLogDetail (AppServer, " Current Software Version: %d" , CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION);
281
261
282
262
ConfigurationMgr ().LogDeviceConfig ();
283
263
@@ -508,12 +488,12 @@ void BaseApplication::ButtonHandler(AppEvent * aEvent)
508
488
chip::DeviceLayer::PlatformMgr ().UnlockChipStack ();
509
489
if (err != CHIP_NO_ERROR)
510
490
{
511
- SILABS_LOG ( " Failed to open the Basic Commissioning Window" );
491
+ ChipLogDetail (AppServer, " Failed to open the Basic Commissioning Window" );
512
492
}
513
493
}
514
494
else
515
495
{
516
- SILABS_LOG ( " Network is already provisioned, Ble advertisement not enabled" );
496
+ ChipLogDetail (AppServer, " Network is already provisioned, Ble advertisement not enabled" );
517
497
#if CHIP_CONFIG_ENABLE_ICD_SERVER
518
498
// Temporarily claim network activity, until we implement a "user trigger" reason for ICD wakeups.
519
499
PlatformMgr ().ScheduleWork ([](intptr_t ) { ICDNotifier::GetInstance ().NotifyNetworkActivityNotification (); });
@@ -536,7 +516,7 @@ void BaseApplication::CancelFunctionTimer()
536
516
{
537
517
if (osTimerStop (sFunctionTimer ) == osError)
538
518
{
539
- SILABS_LOG ( " app timer stop() failed" );
519
+ ChipLogDetail (AppServer, " app timer stop() failed" );
540
520
appError (APP_ERROR_STOP_TIMER_FAILED);
541
521
}
542
522
}
@@ -546,15 +526,15 @@ void BaseApplication::StartFunctionTimer(uint32_t aTimeoutInMs)
546
526
// Starts or restarts the function timer
547
527
if (osTimerStart (sFunctionTimer , pdMS_TO_TICKS (aTimeoutInMs)) != osOK)
548
528
{
549
- SILABS_LOG ( " app timer start() failed" );
529
+ ChipLogDetail (AppServer, " app timer start() failed" );
550
530
appError (APP_ERROR_START_TIMER_FAILED);
551
531
}
552
532
}
553
533
554
534
void BaseApplication::StartFactoryResetSequence ()
555
535
{
556
536
// Initiate the factory reset sequence
557
- SILABS_LOG ( " Factory Reset Triggered. Release button within %ums to cancel." , FACTORY_RESET_CANCEL_WINDOW_TIMEOUT);
537
+ ChipLogDetail (AppServer, " Factory Reset Triggered. Release button within %ums to cancel." , FACTORY_RESET_CANCEL_WINDOW_TIMEOUT);
558
538
559
539
// Start timer for FACTORY_RESET_CANCEL_WINDOW_TIMEOUT to allow user to
560
540
// cancel, if required.
@@ -583,15 +563,15 @@ void BaseApplication::CancelFactoryResetSequence()
583
563
if (sIsFactoryResetTriggered )
584
564
{
585
565
sIsFactoryResetTriggered = false ;
586
- SILABS_LOG ( " Factory Reset has been Canceled" );
566
+ ChipLogDetail (AppServer, " Factory Reset has been Canceled" );
587
567
}
588
568
}
589
569
590
570
void BaseApplication::StartStatusLEDTimer ()
591
571
{
592
572
if (osTimerStart (sLightTimer , kLightTimerPeriod ) != osOK)
593
573
{
594
- SILABS_LOG ( " Light Time start failed" );
574
+ ChipLogDetail (AppServer, " Light Time start failed" );
595
575
appError (APP_ERROR_START_TIMER_FAILED);
596
576
}
597
577
}
@@ -604,7 +584,7 @@ void BaseApplication::StopStatusLEDTimer()
604
584
605
585
if (osTimerStop (sLightTimer ) == osError)
606
586
{
607
- SILABS_LOG ( " Light Time start failed" );
587
+ ChipLogDetail (AppServer, " Light Time start failed" );
608
588
appError (APP_ERROR_STOP_TIMER_FAILED);
609
589
}
610
590
}
@@ -721,12 +701,12 @@ void BaseApplication::PostEvent(const AppEvent * aEvent)
721
701
{
722
702
if (osMessageQueuePut (sAppEventQueue , aEvent, osPriorityNormal, 0 ) != osOK)
723
703
{
724
- SILABS_LOG ( " Failed to post event to app task event queue" );
704
+ ChipLogDetail (AppServer, " Failed to post event to app task event queue" );
725
705
}
726
706
}
727
707
else
728
708
{
729
- SILABS_LOG ( " App Event Queue is uninitialized" );
709
+ ChipLogDetail (AppServer, " App Event Queue is uninitialized" );
730
710
}
731
711
}
732
712
@@ -738,7 +718,7 @@ void BaseApplication::DispatchEvent(AppEvent * aEvent)
738
718
}
739
719
else
740
720
{
741
- SILABS_LOG ( " Event received with no handler. Dropping event." );
721
+ ChipLogDetail (AppServer, " Event received with no handler. Dropping event." );
742
722
}
743
723
}
744
724
@@ -761,6 +741,16 @@ void BaseApplication::OnPlatformEvent(const ChipDeviceEvent * event, intptr_t)
761
741
{
762
742
BaseApplication::sIsProvisioned = event->ServiceProvisioningChange .IsServiceProvisioned ;
763
743
}
744
+ #ifdef DIC_ENABLE
745
+ else if (event->Type == DeviceEventType::kInternetConnectivityChange )
746
+ {
747
+ VerifyOrReturn (event->InternetConnectivityChange .IPv4 == kConnectivity_Established );
748
+ if (DIC_OK != dic_init (dic::control::subscribeCB))
749
+ {
750
+ ChipLogDetail (AppServer, " Failed to initialize DIC module" );
751
+ }
752
+ }
753
+ #endif // DIC_ENABLE
764
754
}
765
755
766
756
void BaseApplication::OutputQrCode (bool refreshLCD)
@@ -787,7 +777,7 @@ void BaseApplication::OutputQrCode(bool refreshLCD)
787
777
}
788
778
else
789
779
{
790
- SILABS_LOG ( " Getting QR code failed!" );
780
+ ChipLogDetail (AppServer, " Getting QR code failed!" );
791
781
}
792
782
}
793
783
0 commit comments