From a3186bb6984b30c4d16e57de8c1efff6d42bc7d7 Mon Sep 17 00:00:00 2001 From: "michal.budzon" Date: Wed, 17 Nov 2021 13:01:59 +0100 Subject: [PATCH 1/2] Add default timeout to fix KVS error when fetching ExtendedTimoutConfig --- examples/lighting-app/qpg/src/AppTask.cpp | 9 +++++++++ examples/lock-app/qpg/src/AppTask.cpp | 9 +++++++++ examples/platform/qpg/app/main.cpp | 8 ++++++++ 3 files changed, 26 insertions(+) diff --git a/examples/lighting-app/qpg/src/AppTask.cpp b/examples/lighting-app/qpg/src/AppTask.cpp index f422ee32a7f17b..d2f6aa20fb6f97 100644 --- a/examples/lighting-app/qpg/src/AppTask.cpp +++ b/examples/lighting-app/qpg/src/AppTask.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -73,6 +74,10 @@ StaticTask_t appTaskStruct; AppTask AppTask::sAppTask; +namespace { +constexpr int extDiscTimeoutSecs = 20; +} + CHIP_ERROR AppTask::StartAppTask() { sAppEventQueue = xQueueCreateStatic(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent), sAppEventQueueBuffer, &sAppEventQueueStruct); @@ -109,6 +114,10 @@ CHIP_ERROR AppTask::Init() // Subscribe with our button callback to the qvCHIP button handler. qvCHIP_SetBtnCallback(ButtonEventHandler); +#if CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY + chip::app::MdnsServer::Instance().SetExtendedDiscoveryTimeoutSecs(extDiscTimeoutSecs); +#endif + // Init ZCL Data Model chip::Server::GetInstance().Init(); diff --git a/examples/lock-app/qpg/src/AppTask.cpp b/examples/lock-app/qpg/src/AppTask.cpp index 95434ff2df70bf..f91a3f73c959e4 100644 --- a/examples/lock-app/qpg/src/AppTask.cpp +++ b/examples/lock-app/qpg/src/AppTask.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -72,6 +73,10 @@ StaticTask_t appTaskStruct; AppTask AppTask::sAppTask; +namespace { +constexpr int extDiscTimeoutSecs = 20; +} + CHIP_ERROR AppTask::StartAppTask() { sAppEventQueue = xQueueCreateStatic(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent), sAppEventQueueBuffer, &sAppEventQueueStruct); @@ -110,6 +115,10 @@ CHIP_ERROR AppTask::Init() qvCHIP_LedSet(LOCK_STATE_LED, !BoltLockMgr().IsUnlocked()); +#if CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY + chip::app::MdnsServer::Instance().SetExtendedDiscoveryTimeoutSecs(extDiscTimeoutSecs); +#endif + // Init ZCL Data Model chip::Server::GetInstance().Init(); diff --git a/examples/platform/qpg/app/main.cpp b/examples/platform/qpg/app/main.cpp index ce22bfc5c6e7df..4f465da9e53f5b 100644 --- a/examples/platform/qpg/app/main.cpp +++ b/examples/platform/qpg/app/main.cpp @@ -46,6 +46,10 @@ using namespace ::chip::Inet; using namespace ::chip::DeviceLayer; using namespace ::chip::DeviceLayer::Internal; +namespace { +constexpr int extDiscTimeoutSecs = 20; +} + /***************************************************************************** * Macro Definitions *****************************************************************************/ @@ -122,6 +126,10 @@ CHIP_ERROR CHIP_Init(void) } #endif // CHIP_ENABLE_OPENTHREAD +#if CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY + chip::app::MdnsServer::Instance().SetExtendedDiscoveryTimeoutSecs(extDiscTimeoutSecs); +#endif + ChipLogProgress(NotSpecified, "Starting Platform Manager Event Loop"); ret = PlatformMgr().StartEventLoopTask(); if (ret != CHIP_NO_ERROR) From d9085e681a6e9d80d427bb16dd7091f6360e1b97 Mon Sep 17 00:00:00 2001 From: "michal.budzon" Date: Tue, 30 Nov 2021 14:13:15 +0100 Subject: [PATCH 2/2] Replace Mdns with Dnssd --- examples/lighting-app/qpg/src/AppTask.cpp | 4 ++-- examples/lock-app/qpg/src/AppTask.cpp | 4 ++-- examples/platform/qpg/app/main.cpp | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/lighting-app/qpg/src/AppTask.cpp b/examples/lighting-app/qpg/src/AppTask.cpp index d2f6aa20fb6f97..a460bce1aa5bd8 100644 --- a/examples/lighting-app/qpg/src/AppTask.cpp +++ b/examples/lighting-app/qpg/src/AppTask.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include @@ -115,7 +115,7 @@ CHIP_ERROR AppTask::Init() qvCHIP_SetBtnCallback(ButtonEventHandler); #if CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY - chip::app::MdnsServer::Instance().SetExtendedDiscoveryTimeoutSecs(extDiscTimeoutSecs); + chip::app::DnssdServer::Instance().SetExtendedDiscoveryTimeoutSecs(extDiscTimeoutSecs); #endif // Init ZCL Data Model diff --git a/examples/lock-app/qpg/src/AppTask.cpp b/examples/lock-app/qpg/src/AppTask.cpp index f91a3f73c959e4..cb7dbae712c076 100644 --- a/examples/lock-app/qpg/src/AppTask.cpp +++ b/examples/lock-app/qpg/src/AppTask.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include @@ -116,7 +116,7 @@ CHIP_ERROR AppTask::Init() qvCHIP_LedSet(LOCK_STATE_LED, !BoltLockMgr().IsUnlocked()); #if CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY - chip::app::MdnsServer::Instance().SetExtendedDiscoveryTimeoutSecs(extDiscTimeoutSecs); + chip::app::DnssdServer::Instance().SetExtendedDiscoveryTimeoutSecs(extDiscTimeoutSecs); #endif // Init ZCL Data Model diff --git a/examples/platform/qpg/app/main.cpp b/examples/platform/qpg/app/main.cpp index 4f465da9e53f5b..98adc615a87934 100644 --- a/examples/platform/qpg/app/main.cpp +++ b/examples/platform/qpg/app/main.cpp @@ -33,6 +33,7 @@ #include "qvCHIP.h" // CHIP includes +#include #include #include #include @@ -127,7 +128,7 @@ CHIP_ERROR CHIP_Init(void) #endif // CHIP_ENABLE_OPENTHREAD #if CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY - chip::app::MdnsServer::Instance().SetExtendedDiscoveryTimeoutSecs(extDiscTimeoutSecs); + chip::app::DnssdServer::Instance().SetExtendedDiscoveryTimeoutSecs(extDiscTimeoutSecs); #endif ChipLogProgress(NotSpecified, "Starting Platform Manager Event Loop");