diff --git a/examples/lighting-app/silabs/src/AppTask.cpp b/examples/lighting-app/silabs/src/AppTask.cpp index bb27d8c702bff5..542dc2fbfd55c8 100644 --- a/examples/lighting-app/silabs/src/AppTask.cpp +++ b/examples/lighting-app/silabs/src/AppTask.cpp @@ -101,7 +101,7 @@ CHIP_ERROR AppTask::Init() if (!ConnectivityMgr().IsThreadProvisioned()) #endif /* !SL_WIFI */ { - GetLCD().ShowQRCode(true, true); + GetLCD().ShowQRCode(true); } #endif // QR_CODE_ENABLED #endif diff --git a/examples/lock-app/silabs/src/AppTask.cpp b/examples/lock-app/silabs/src/AppTask.cpp index 7d86fec80a07d9..4e8527f4f4fa1a 100644 --- a/examples/lock-app/silabs/src/AppTask.cpp +++ b/examples/lock-app/silabs/src/AppTask.cpp @@ -190,7 +190,7 @@ CHIP_ERROR AppTask::Init() if (!ConnectivityMgr().IsThreadProvisioned()) #endif /* !SL_WIFI */ { - GetLCD().ShowQRCode(true, true); + GetLCD().ShowQRCode(true); } #endif // QR_CODE_ENABLED #endif diff --git a/examples/platform/silabs/BaseApplication.cpp b/examples/platform/silabs/BaseApplication.cpp index 09556e899b79a3..665c65bcda6a15 100644 --- a/examples/platform/silabs/BaseApplication.cpp +++ b/examples/platform/silabs/BaseApplication.cpp @@ -400,6 +400,7 @@ bool BaseApplication::ActivateStatusLedPatterns() return isPatternSet; } +// TODO Move State Monitoring elsewhere void BaseApplication::LightEventHandler() { // Collect connectivity and configuration state from the CHIP stack. Because @@ -420,8 +421,17 @@ void BaseApplication::LightEventHandler() sIsAttached = ConnectivityMgr().IsThreadAttached(); #endif /* CHIP_ENABLE_OPENTHREAD */ sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0); + +#ifdef DISPLAY_ENABLED + SilabsLCD::DisplayStatus_t status; + status.connected = sIsEnabled && sIsAttached; + status.advertising = chip::Server::GetInstance().GetCommissioningWindowManager().IsCommissioningWindowOpen(); + status.nbFabric = chip::Server::GetInstance().GetFabricTable().FabricCount(); + slLCD.SetStatus(status); +#endif PlatformMgr().UnlockChipStack(); } + #endif // CHIP_CONFIG_ENABLE_ICD_SERVER #if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917))) @@ -473,9 +483,8 @@ void BaseApplication::ButtonHandler(AppEvent * aEvent) mFunction = kFunction_NoneSelected; OutputQrCode(false); -#ifdef QR_CODE_ENABLED - // TOGGLE QRCode/LCD demo UI - slLCD.ToggleQRCode(); +#ifdef DISPLAY_ENABLED + slLCD.CycleScreens(); #endif #ifdef SL_WIFI @@ -732,7 +741,7 @@ void BaseApplication::OutputQrCode(bool refreshLCD) if (refreshLCD) { slLCD.SetQRCode((uint8_t *) setupPayload.data(), setupPayload.size()); - slLCD.ShowQRCode(true, true); + slLCD.ShowQRCode(true); } #endif // QR_CODE_ENABLED diff --git a/examples/platform/silabs/display/demo-ui-bitmaps.h b/examples/platform/silabs/display/demo-ui-bitmaps.h index 4b3650e39d6603..b5a6103a8fddb2 100644 --- a/examples/platform/silabs/display/demo-ui-bitmaps.h +++ b/examples/platform/silabs/display/demo-ui-bitmaps.h @@ -98,63 +98,38 @@ 0x7F, 0xFC, 0xFC, 0xFC, 0xE3, 0xF1, 0x87, 0x87, 0xC7, 0xDE, 0x88, 0x33, 0xC7, 0xCF, 0xFC, 0xFF, 0xFF, 0x03 #ifndef ON_DEMO_BITMAP // Unknown demo.... + #define ON_DEMO_BITMAP \ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ - 0xFF, 0xFF, 0x7F, 0xFE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F, 0xFF, 0xFF, 0x3F, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF +#define OFF_DEMO_BITMAP ON_DEMO_BITMAP #endif #endif // SILABS_DEMO_UI_BITMAPS_H diff --git a/examples/platform/silabs/display/lcd.cpp b/examples/platform/silabs/display/lcd.cpp index 6a06be1c28f6c8..7a18951dd54b06 100644 --- a/examples/platform/silabs/display/lcd.cpp +++ b/examples/platform/silabs/display/lcd.cpp @@ -125,12 +125,10 @@ int SilabsLCD::Update(void) void SilabsLCD::WriteDemoUI(bool state) { -#ifdef QR_CODE_ENABLED - if (mShowQRCode) + if (mCurrentScreen != DemoScreen) { - mShowQRCode = false; + mCurrentScreen = DemoScreen; } -#endif dState.mainState = state; WriteDemoUI(); } @@ -149,11 +147,102 @@ void SilabsLCD::WriteDemoUI() } } +void SilabsLCD::WriteStatus() +{ + uint8_t lineNb = 0; + char str[20]; + + GLIB_clear(&glibContext); + sprintf(str, "# Fabrics : %d", mStatus.nbFabric); + GLIB_drawStringOnLine(&glibContext, str, lineNb++, GLIB_ALIGN_LEFT, 0, 0, true); + + if (strlen(mStatus.networkName) >= sizeof(str)) + { + memcpy(str, mStatus.networkName, sizeof(str) - 1); + str[sizeof(str) - 1] = '\0'; + } + else + { + memcpy(str, mStatus.networkName, sizeof(str)); + } + +#if SL_WIFI + GLIB_drawStringOnLine(&glibContext, "SSID : ", lineNb++, GLIB_ALIGN_LEFT, 0, 0, true); + GLIB_drawStringOnLine(&glibContext, str, lineNb++, GLIB_ALIGN_LEFT, 0, 0, true); +#else + GLIB_drawStringOnLine(&glibContext, "PANID : ", lineNb, GLIB_ALIGN_LEFT, 0, 0, true); + GLIB_drawStringOnLine(&glibContext, str, lineNb++, GLIB_ALIGN_LEFT, 64, 0, true); +#if CHIP_DEVICE_CONFIG_THREAD_FTD + GLIB_drawStringOnLine(&glibContext, "OT Type : FTD", lineNb++, GLIB_ALIGN_LEFT, 0, 0, true); +#else + GLIB_drawStringOnLine(&glibContext, "OT Type : MTD", lineNb++, GLIB_ALIGN_LEFT, 0, 0, true); +#endif // FTD +#endif + GLIB_drawStringOnLine(&glibContext, "", lineNb++, GLIB_ALIGN_LEFT, 0, 0, true); + sprintf(str, "Connected : %c", mStatus.connected ? 'Y' : 'N'); + GLIB_drawStringOnLine(&glibContext, str, lineNb++, GLIB_ALIGN_LEFT, 0, 0, true); + sprintf(str, "Advertising : %c", mStatus.advertising ? 'Y' : 'N'); + GLIB_drawStringOnLine(&glibContext, str, lineNb++, GLIB_ALIGN_LEFT, 0, 0, true); +#if CHIP_CONFIG_ENABLE_ICD_SERVER + GLIB_drawStringOnLine(&glibContext, "Is ICD : Y", lineNb++, GLIB_ALIGN_LEFT, 0, 0, true); +#else + GLIB_drawStringOnLine(&glibContext, "Is ICD : N", lineNb++, GLIB_ALIGN_LEFT, 0, 0, true); +#endif + + updateDisplay(); +} + void SilabsLCD::SetCustomUI(customUICB cb) { customUI = cb; } +void SilabsLCD::SetScreen(Screen_e screen) +{ + if (screen >= InvalidScreen) + { + return; + } + + switch (screen) + { + case DemoScreen: + WriteDemoUI(); + break; + case StatusScreen: + WriteStatus(); + break; + case QRCodeScreen: + WriteQRCode(); + break; + default: + break; + } +} + +void SilabsLCD::CycleScreens(void) +{ +#ifdef QR_CODE_ENABLED + if (mCurrentScreen < QRCodeScreen) +#elif + if (mCurrentScreen < StatusScreen) +#endif + { + mCurrentScreen++; + } + else + { + mCurrentScreen = DemoScreen; + } + + SetScreen(static_cast(mCurrentScreen)); +} + +void SilabsLCD::SetStatus(DisplayStatus_t & status) +{ + mStatus = status; +} + #ifdef QR_CODE_ENABLED void SilabsLCD::WriteQRCode() { @@ -194,19 +283,14 @@ void SilabsLCD::SetQRCode(uint8_t * str, uint32_t size) } } -void SilabsLCD::ShowQRCode(bool show, bool forceRefresh) +void SilabsLCD::ShowQRCode(bool show) { - if (show != mShowQRCode || forceRefresh) + if (mCurrentScreen != QRCodeScreen) { - (show) ? WriteQRCode() : WriteDemoUI(); - mShowQRCode = show; + mCurrentScreen = QRCodeScreen; } -} -void SilabsLCD::ToggleQRCode(void) -{ - (mShowQRCode) ? WriteDemoUI() : WriteQRCode(); - mShowQRCode = !mShowQRCode; + WriteQRCode(); } void SilabsLCD::LCDFillRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h) diff --git a/examples/platform/silabs/display/lcd.h b/examples/platform/silabs/display/lcd.h index d375b7a133c9aa..085dd7ef8d6240 100644 --- a/examples/platform/silabs/display/lcd.h +++ b/examples/platform/silabs/display/lcd.h @@ -33,6 +33,22 @@ class SilabsLCD { public: + typedef enum screen + { + DemoScreen = 0, + StatusScreen, + QRCodeScreen, + InvalidScreen, + } Screen_e; + + typedef struct dStatus + { + uint8_t nbFabric = 0; + bool connected = false; + char networkName[50] = { "TODO" }; + bool advertising = false; + } DisplayStatus_t; + typedef void (*customUICB)(GLIB_Context_t * context); CHIP_ERROR Init(uint8_t * name = nullptr, bool initialState = false); void * Context(); @@ -42,10 +58,13 @@ class SilabsLCD void WriteDemoUI(bool state); void SetCustomUI(customUICB cb); + void SetScreen(Screen_e screen); + void CycleScreens(void); + void SetStatus(DisplayStatus_t & status); + #ifdef QR_CODE_ENABLED void SetQRCode(uint8_t * str, uint32_t size); - void ShowQRCode(bool show, bool forceRefresh = false); - void ToggleQRCode(void); + void ShowQRCode(bool show); #endif private: @@ -57,10 +76,10 @@ class SilabsLCD void WriteQRCode(); void WriteDemoUI(); + void WriteStatus(); #ifdef QR_CODE_ENABLED void LCDFillRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h); char mQRCodeBuffer[chip::QRCodeBasicSetupPayloadGenerator::kMaxQRCodeBase38RepresentationLength + 1]; - bool mShowQRCode = true; #endif GLIB_Context_t glibContext; @@ -71,4 +90,7 @@ class SilabsLCD #endif customUICB customUI = nullptr; DemoState_t dState; + + DisplayStatus_t mStatus; + uint8_t mCurrentScreen = DemoScreen; }; diff --git a/examples/pump-app/silabs/src/AppTask.cpp b/examples/pump-app/silabs/src/AppTask.cpp index b37d10852d0bd9..2dab9268a9035c 100644 --- a/examples/pump-app/silabs/src/AppTask.cpp +++ b/examples/pump-app/silabs/src/AppTask.cpp @@ -110,7 +110,7 @@ CHIP_ERROR AppTask::Init() if (!ConnectivityMgr().IsThreadProvisioned()) #endif /* !SL_WIFI */ { - GetLCD().ShowQRCode(true, true); + GetLCD().ShowQRCode(true); } #endif // QR_CODE_ENABLED #endif diff --git a/examples/smoke-co-alarm-app/silabs/src/AppTask.cpp b/examples/smoke-co-alarm-app/silabs/src/AppTask.cpp index 153f2e7073bcb7..0ead0862709abd 100644 --- a/examples/smoke-co-alarm-app/silabs/src/AppTask.cpp +++ b/examples/smoke-co-alarm-app/silabs/src/AppTask.cpp @@ -96,7 +96,7 @@ CHIP_ERROR AppTask::Init() if (!ConnectivityMgr().IsThreadProvisioned()) #endif /* !SL_WIFI */ { - GetLCD().ShowQRCode(true, true); + GetLCD().ShowQRCode(true); } #endif // QR_CODE_ENABLED #endif diff --git a/examples/window-app/silabs/src/AppTask.cpp b/examples/window-app/silabs/src/AppTask.cpp index 4765c48fa4d987..92c80531080acb 100644 --- a/examples/window-app/silabs/src/AppTask.cpp +++ b/examples/window-app/silabs/src/AppTask.cpp @@ -94,7 +94,7 @@ CHIP_ERROR AppTask::Init() if (!ConnectivityMgr().IsThreadProvisioned()) #endif /* !SL_WIFI */ { - GetLCD().ShowQRCode(true, true); + GetLCD().ShowQRCode(true); } #endif // QR_CODE_ENABLED #endif