From 8622381d0deca180506ecc32a8f1eb64bc52fabc Mon Sep 17 00:00:00 2001 From: Kevin Schoedel <67607049+kpschoedel@users.noreply.github.com> Date: Wed, 8 Dec 2021 16:06:26 -0500 Subject: [PATCH 01/28] Add unit tests for SystemTimer.h (#12742) #### Problem Only the higher-level `System::Layer` timer operations had tests; the utility classes in `system/SystemTimer.h` had no unit tests, and a recent refactor (#12628) introduced a bug that a proper unit test would have caught. Fixes #12729 Add unit tests for SystemTimer.h #### Change overview What's in this PR - Add tests covering `TimerData`, `TimeList`, and `TimerPool`. - Changed these helpers to take a `Timestamp` rather than a `Timeout`. - Fixed `TimerList::Remove(Node*)` to allow an empty list or null argument (matching its description). #### Testing Quis custodiet ipsos custodes? --- src/system/SystemLayerImplLwIP.cpp | 4 +- src/system/SystemLayerImplSelect.cpp | 4 +- src/system/SystemTimer.cpp | 35 +++--- src/system/SystemTimer.h | 18 ++-- src/system/tests/TestSystemTimer.cpp | 153 +++++++++++++++++++++++++++ 5 files changed, 185 insertions(+), 29 deletions(-) diff --git a/src/system/SystemLayerImplLwIP.cpp b/src/system/SystemLayerImplLwIP.cpp index 7c03a18600be45..605f78daaa46bd 100644 --- a/src/system/SystemLayerImplLwIP.cpp +++ b/src/system/SystemLayerImplLwIP.cpp @@ -56,7 +56,7 @@ CHIP_ERROR LayerImplLwIP::StartTimer(Clock::Timeout delay, TimerCompleteCallback CancelTimer(onComplete, appState); - TimerList::Node * timer = mTimerPool.Create(*this, delay, onComplete, appState); + TimerList::Node * timer = mTimerPool.Create(*this, SystemClock().GetMonotonicTimestamp() + delay, onComplete, appState); VerifyOrReturnError(timer != nullptr, CHIP_ERROR_NO_MEMORY); if (mTimerList.Add(timer) == timer) @@ -87,7 +87,7 @@ CHIP_ERROR LayerImplLwIP::ScheduleWork(TimerCompleteCallback onComplete, void * { VerifyOrReturnError(mLayerState.IsInitialized(), CHIP_ERROR_INCORRECT_STATE); - TimerList::Node * timer = mTimerPool.Create(*this, System::Clock::kZero, onComplete, appState); + TimerList::Node * timer = mTimerPool.Create(*this, SystemClock().GetMonotonicTimestamp(), onComplete, appState); VerifyOrReturnError(timer != nullptr, CHIP_ERROR_NO_MEMORY); return ScheduleLambda([this, timer] { this->mTimerPool.Invoke(timer); }); diff --git a/src/system/SystemLayerImplSelect.cpp b/src/system/SystemLayerImplSelect.cpp index 88d915ca7d1ae7..0ac3bd3e7ad7bc 100644 --- a/src/system/SystemLayerImplSelect.cpp +++ b/src/system/SystemLayerImplSelect.cpp @@ -124,7 +124,7 @@ CHIP_ERROR LayerImplSelect::StartTimer(Clock::Timeout delay, TimerCompleteCallba CancelTimer(onComplete, appState); - TimerList::Node * timer = mTimerPool.Create(*this, delay, onComplete, appState); + TimerList::Node * timer = mTimerPool.Create(*this, SystemClock().GetMonotonicTimestamp() + delay, onComplete, appState); VerifyOrReturnError(timer != nullptr, CHIP_ERROR_NO_MEMORY); #if CHIP_SYSTEM_CONFIG_USE_DISPATCH @@ -186,7 +186,7 @@ CHIP_ERROR LayerImplSelect::ScheduleWork(TimerCompleteCallback onComplete, void CancelTimer(onComplete, appState); - TimerList::Node * timer = mTimerPool.Create(*this, Clock::kZero, onComplete, appState); + TimerList::Node * timer = mTimerPool.Create(*this, SystemClock().GetMonotonicTimestamp(), onComplete, appState); VerifyOrReturnError(timer != nullptr, CHIP_ERROR_NO_MEMORY); #if CHIP_SYSTEM_CONFIG_USE_DISPATCH diff --git a/src/system/SystemTimer.cpp b/src/system/SystemTimer.cpp index 5764228e844322..f966564e788418 100644 --- a/src/system/SystemTimer.cpp +++ b/src/system/SystemTimer.cpp @@ -67,29 +67,30 @@ TimerList::Node * TimerList::Add(TimerList::Node * add) TimerList::Node * TimerList::Remove(TimerList::Node * remove) { - VerifyOrDie(mEarliestTimer != nullptr); - - if (remove == mEarliestTimer) - { - mEarliestTimer = remove->mNextTimer; - } - else + if (mEarliestTimer != nullptr && remove != nullptr) { - TimerList::Node * lTimer = mEarliestTimer; - - while (lTimer->mNextTimer) + if (remove == mEarliestTimer) + { + mEarliestTimer = remove->mNextTimer; + } + else { - if (remove == lTimer->mNextTimer) + TimerList::Node * lTimer = mEarliestTimer; + + while (lTimer->mNextTimer) { - lTimer->mNextTimer = remove->mNextTimer; - break; - } + if (remove == lTimer->mNextTimer) + { + lTimer->mNextTimer = remove->mNextTimer; + break; + } - lTimer = lTimer->mNextTimer; + lTimer = lTimer->mNextTimer; + } } - } - remove->mNextTimer = nullptr; + remove->mNextTimer = nullptr; + } return mEarliestTimer; } diff --git a/src/system/SystemTimer.h b/src/system/SystemTimer.h index 59457d2c855c00..54b07f8c092f49 100644 --- a/src/system/SystemTimer.h +++ b/src/system/SystemTimer.h @@ -44,6 +44,7 @@ namespace chip { namespace System { class Layer; +class TestTimer; /** * Basic Timer information: time and callback. @@ -57,7 +58,7 @@ class DLL_EXPORT TimerData Callback(Layer & systemLayer, TimerCompleteCallback onComplete, void * appState) : mSystemLayer(&systemLayer), mOnComplete(onComplete), mAppState(appState) {} - void Invoke() { mOnComplete(mSystemLayer, mAppState); } + void Invoke() const { mOnComplete(mSystemLayer, mAppState); } const TimerCompleteCallback & GetOnComplete() const { return mOnComplete; } void * GetAppState() const { return mAppState; } Layer * GetSystemLayer() const { return mSystemLayer; } @@ -68,8 +69,8 @@ class DLL_EXPORT TimerData void * mAppState; }; - TimerData(Layer & systemLayer, System::Clock::Timeout delay, TimerCompleteCallback onComplete, void * appState) : - mAwakenTime(SystemClock().GetMonotonicTimestamp() + delay), mCallback(systemLayer, onComplete, appState) + TimerData(Layer & systemLayer, System::Clock::Timestamp awakenTime, TimerCompleteCallback onComplete, void * appState) : + mAwakenTime(awakenTime), mCallback(systemLayer, onComplete, appState) {} ~TimerData() = default; @@ -106,8 +107,8 @@ class TimerList class Node : public TimerData { public: - Node(Layer & systemLayer, System::Clock::Timeout delay, TimerCompleteCallback onComplete, void * appState) : - TimerData(systemLayer, delay, onComplete, appState), mNextTimer(nullptr) + Node(Layer & systemLayer, System::Clock::Timestamp awakenTime, TimerCompleteCallback onComplete, void * appState) : + TimerData(systemLayer, awakenTime, onComplete, appState), mNextTimer(nullptr) {} Node * mNextTimer; }; @@ -160,7 +161,7 @@ class TimerList /** * Test whether there are any timers. */ - bool Empty() const { return mEarliestTimer != nullptr; } + bool Empty() const { return mEarliestTimer == nullptr; } /** * Remove and return all timers that expire before the given time @a t. @@ -188,9 +189,9 @@ class TimerPool /** * Create a new timer from the pool. */ - Timer * Create(Layer & systemLayer, System::Clock::Timeout delay, TimerCompleteCallback onComplete, void * appState) + Timer * Create(Layer & systemLayer, System::Clock::Timestamp awakenTime, TimerCompleteCallback onComplete, void * appState) { - Timer * timer = mTimerPool.CreateObject(systemLayer, delay, onComplete, appState); + Timer * timer = mTimerPool.CreateObject(systemLayer, awakenTime, onComplete, appState); SYSTEM_STATS_INCREMENT(Stats::kSystemLayer_NumTimers); return timer; } @@ -224,6 +225,7 @@ class TimerPool } private: + friend class TestTimer; ObjectPool mTimerPool; }; diff --git a/src/system/tests/TestSystemTimer.cpp b/src/system/tests/TestSystemTimer.cpp index 9b902f246ee0b6..6520be21959bfa 100644 --- a/src/system/tests/TestSystemTimer.cpp +++ b/src/system/tests/TestSystemTimer.cpp @@ -168,6 +168,158 @@ static void CheckStarvation(nlTestSuite * inSuite, void * aContext) ServiceEvents(lSys); } +// Test the implementation helper classes TimerPool, TimerList, and TimerData. +namespace chip { +namespace System { +class TestTimer +{ +public: + static void CheckTimerPool(nlTestSuite * inSuite, void * aContext); +}; +} // namespace System +} // namespace chip + +void chip::System::TestTimer::CheckTimerPool(nlTestSuite * inSuite, void * aContext) +{ + TestContext & testContext = *static_cast(aContext); + Layer & systemLayer = *testContext.mLayer; + nlTestSuite * const suite = testContext.mTestSuite; + + using Timer = TimerList::Node; + struct TestState + { + int count = 0; + static void Increment(Layer * layer, void * state) { ++static_cast(state)->count; } + static void Reset(Layer * layer, void * state) { static_cast(state)->count = 0; } + }; + TestState testState; + + using namespace Clock::Literals; + struct + { + Clock::Timestamp awakenTime; + TimerCompleteCallback onComplete; + Timer * timer; + } testTimer[] = { + { 111_ms, TestState::Increment }, // 0 + { 100_ms, TestState::Increment }, // 1 + { 202_ms, TestState::Reset }, // 2 + { 303_ms, TestState::Increment }, // 3 + }; + + TimerPool pool; + NL_TEST_ASSERT(suite, pool.mTimerPool.Allocated() == 0); + SYSTEM_STATS_RESET(Stats::kSystemLayer_NumTimers); + + // Test TimerPool::Create() and TimerData accessors. + + for (auto & timer : testTimer) + { + timer.timer = pool.Create(systemLayer, timer.awakenTime, timer.onComplete, &testState); + } +#if CHIP_SYSTEM_CONFIG_PROVIDE_STATISTICS + NL_TEST_ASSERT(suite, Stats::GetResourcesInUse()[Stats::kSystemLayer_NumTimers] == 4); +#endif // CHIP_SYSTEM_CONFIG_PROVIDE_STATISTICS + + for (auto & timer : testTimer) + { + NL_TEST_ASSERT(suite, timer.timer != nullptr); + NL_TEST_ASSERT(suite, timer.timer->AwakenTime() == timer.awakenTime); + NL_TEST_ASSERT(suite, timer.timer->GetCallback().GetOnComplete() == timer.onComplete); + NL_TEST_ASSERT(suite, timer.timer->GetCallback().GetAppState() == &testState); + NL_TEST_ASSERT(suite, timer.timer->GetCallback().GetSystemLayer() == &systemLayer); + } + + // Test TimerList operations. + + TimerList list; + NL_TEST_ASSERT(suite, list.Remove(nullptr) == nullptr); + NL_TEST_ASSERT(suite, list.Remove(nullptr, nullptr) == nullptr); + NL_TEST_ASSERT(suite, list.PopEarliest() == nullptr); + NL_TEST_ASSERT(suite, list.PopIfEarlier(500_ms) == nullptr); + NL_TEST_ASSERT(suite, list.Earliest() == nullptr); + NL_TEST_ASSERT(suite, list.Empty()); + + Timer * earliest = list.Add(testTimer[0].timer); // list: () → (0) returns: 0 + NL_TEST_ASSERT(suite, earliest == testTimer[0].timer); + NL_TEST_ASSERT(suite, list.PopIfEarlier(10_ms) == nullptr); + NL_TEST_ASSERT(suite, list.Earliest() == testTimer[0].timer); + NL_TEST_ASSERT(suite, !list.Empty()); + + earliest = list.Add(testTimer[1].timer); // list: (0) → (1 0) returns: 1 + NL_TEST_ASSERT(suite, earliest == testTimer[1].timer); + NL_TEST_ASSERT(suite, list.Earliest() == testTimer[1].timer); + + earliest = list.Add(testTimer[2].timer); // list: (1 0) → (1 0 2) returns: 1 + NL_TEST_ASSERT(suite, earliest == testTimer[1].timer); + NL_TEST_ASSERT(suite, list.Earliest() == testTimer[1].timer); + + earliest = list.Add(testTimer[3].timer); // list: (1 0 2) → (1 0 2 3) returns: 1 + NL_TEST_ASSERT(suite, earliest == testTimer[1].timer); + NL_TEST_ASSERT(suite, list.Earliest() == testTimer[1].timer); + + earliest = list.Remove(earliest); // list: (1 0 2 3) → (0 2 3) returns: 0 + NL_TEST_ASSERT(suite, earliest == testTimer[0].timer); + NL_TEST_ASSERT(suite, list.Earliest() == testTimer[0].timer); + + earliest = list.Remove(TestState::Reset, &testState); // list: (0 2 3) → (0 3) returns: 2 + NL_TEST_ASSERT(suite, earliest == testTimer[2].timer); + NL_TEST_ASSERT(suite, list.Earliest() == testTimer[0].timer); + + earliest = list.PopEarliest(); // list: (0 3) → (3) returns: 0 + NL_TEST_ASSERT(suite, earliest == testTimer[0].timer); + NL_TEST_ASSERT(suite, list.Earliest() == testTimer[3].timer); + + earliest = list.PopIfEarlier(10_ms); // list: (3) → (3) returns: nullptr + NL_TEST_ASSERT(suite, earliest == nullptr); + + earliest = list.PopIfEarlier(500_ms); // list: (3) → () returns: 3 + NL_TEST_ASSERT(suite, earliest == testTimer[3].timer); + NL_TEST_ASSERT(suite, list.Empty()); + + earliest = list.Add(testTimer[3].timer); // list: () → (3) returns: 3 + list.Clear(); // list: (3) → () + NL_TEST_ASSERT(suite, earliest == testTimer[3].timer); + NL_TEST_ASSERT(suite, list.Empty()); + + for (auto & timer : testTimer) + { + list.Add(timer.timer); + } + TimerList early = list.ExtractEarlier(200_ms); // list: (1 0 2 3) → (2 3) returns: (1 0) + NL_TEST_ASSERT(suite, list.PopEarliest() == testTimer[2].timer); + NL_TEST_ASSERT(suite, list.PopEarliest() == testTimer[3].timer); + NL_TEST_ASSERT(suite, list.PopEarliest() == nullptr); + NL_TEST_ASSERT(suite, early.PopEarliest() == testTimer[1].timer); + NL_TEST_ASSERT(suite, early.PopEarliest() == testTimer[0].timer); + NL_TEST_ASSERT(suite, early.PopEarliest() == nullptr); + + // Test TimerPool::Invoke() + NL_TEST_ASSERT(suite, testState.count == 0); + pool.Invoke(testTimer[0].timer); + testTimer[0].timer = nullptr; + NL_TEST_ASSERT(suite, testState.count == 1); + NL_TEST_ASSERT(suite, pool.mTimerPool.Allocated() == 3); +#if CHIP_SYSTEM_CONFIG_PROVIDE_STATISTICS + NL_TEST_ASSERT(suite, Stats::GetResourcesInUse()[Stats::kSystemLayer_NumTimers] == 3); +#endif // CHIP_SYSTEM_CONFIG_PROVIDE_STATISTICS + + // Test TimerPool::Release() + pool.Release(testTimer[1].timer); + testTimer[1].timer = nullptr; + NL_TEST_ASSERT(suite, testState.count == 1); + NL_TEST_ASSERT(suite, pool.mTimerPool.Allocated() == 2); +#if CHIP_SYSTEM_CONFIG_PROVIDE_STATISTICS + NL_TEST_ASSERT(suite, Stats::GetResourcesInUse()[Stats::kSystemLayer_NumTimers] == 2); +#endif // CHIP_SYSTEM_CONFIG_PROVIDE_STATISTICS + + pool.ReleaseAll(); + NL_TEST_ASSERT(suite, pool.mTimerPool.Allocated() == 0); +#if CHIP_SYSTEM_CONFIG_PROVIDE_STATISTICS + NL_TEST_ASSERT(suite, Stats::GetResourcesInUse()[Stats::kSystemLayer_NumTimers] == 0); +#endif // CHIP_SYSTEM_CONFIG_PROVIDE_STATISTICS +} + // Test Suite /** @@ -178,6 +330,7 @@ static const nlTest sTests[] = { NL_TEST_DEF("Timer::TestOverflow", CheckOverflow), NL_TEST_DEF("Timer::TestTimerStarvation", CheckStarvation), + NL_TEST_DEF("Timer::TestTimerPool", chip::System::TestTimer::CheckTimerPool), NL_TEST_SENTINEL() }; // clang-format on From 20ee19757c9595e4056760fe73b8800e2fbcdbd7 Mon Sep 17 00:00:00 2001 From: Kevin Schoedel <67607049+kpschoedel@users.noreply.github.com> Date: Wed, 8 Dec 2021 16:16:52 -0500 Subject: [PATCH 02/28] Remove ObjectPool leak flag from GroupDataProviderImpl::mKeySetIterators (#12734) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### Problem The `ObjectPool` leak reported in #12503 _ObjectPool leaks in GroupDataProviderImpl_ is no longer reproducable; possibly fixed by d25a3ef9. #### Change overview Remove the ‘allow leaks’ flag from `GroupDataProviderImpl::mKeySetIterators`. #### Testing CI. --- src/credentials/GroupDataProviderImpl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/credentials/GroupDataProviderImpl.h b/src/credentials/GroupDataProviderImpl.h index cbd25f78d4d07f..24a1b9883cf57b 100644 --- a/src/credentials/GroupDataProviderImpl.h +++ b/src/credentials/GroupDataProviderImpl.h @@ -160,7 +160,7 @@ class GroupDataProviderImpl : public GroupDataProvider BitMapObjectPool mEndpointGroupsIterators; BitMapObjectPool mAllStatesIterators; BitMapObjectPool mFabricStatesIterators; - BitMapObjectPool mKeySetIterators; + BitMapObjectPool mKeySetIterators; }; } // namespace Credentials From 7014556554b27a1155e766dbd113728d968fcd6d Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 8 Dec 2021 16:19:23 -0500 Subject: [PATCH 03/28] Add K32W sdks into Vscode image - need to be able to compile everything as developers (#12746) --- integrations/docker/images/chip-build-vscode/Dockerfile | 4 ++++ integrations/docker/images/chip-build/version | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/integrations/docker/images/chip-build-vscode/Dockerfile b/integrations/docker/images/chip-build-vscode/Dockerfile index 10303e107c48d3..f6b5fb16b1822f 100644 --- a/integrations/docker/images/chip-build-vscode/Dockerfile +++ b/integrations/docker/images/chip-build-vscode/Dockerfile @@ -9,6 +9,7 @@ FROM connectedhomeip/chip-build-infineon:${VERSION} AS p6 FROM connectedhomeip/chip-build-tizen:${VERSION} AS tizen FROM connectedhomeip/chip-build-crosscompile:${VERSION} AS crosscompile FROM connectedhomeip/chip-build-ameba:${VERSION} AS ameba +FROM connectedhomeip/chip-build-k32w:${VERSION} AS k32w FROM connectedhomeip/chip-build:${VERSION} # qemu-src copied over because qemu directory contains symlinks to the src @@ -37,6 +38,8 @@ COPY --from=crosscompile /opt/ubuntu-21.04-aarch64-sysroot /opt/ubuntu-21.04-aar COPY --from=ameba /opt/ameba /opt/ameba +COPY --from=k32w /opt/sdk/sdks /opt/sdk/sdks + # Android license file "acceping" is done by writing license hashes # into the 'licenses' subfolder. This allows any user (in particular # 'vscode' to accept licenses) @@ -63,3 +66,4 @@ ENV CY_TOOLS_PATHS="/opt/ModusToolbox/tools_2.3" ENV TIZEN_HOME /opt/tizen_sdk ENV SYSROOT_AARCH64=/opt/ubuntu-21.04-aarch64-sysroot ENV AMEBA_PATH=/opt/ameba/ambd_sdk_with_chip_non_NDA +ENV NXP_K32W061_SDK_ROOT=/opt/sdk/sdks diff --git a/integrations/docker/images/chip-build/version b/integrations/docker/images/chip-build/version index 28facc1c14b20e..ae93538201aaec 100644 --- a/integrations/docker/images/chip-build/version +++ b/integrations/docker/images/chip-build/version @@ -1 +1 @@ -0.5.34 Version bump reason: Reduce size crosscompile image +0.5.35 Add K32W SDKs into chip-build-vscode From e9add41141ae3002a792a5b09c45831cc996092a Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 8 Dec 2021 16:19:47 -0500 Subject: [PATCH 04/28] Fix flashbundle error in infineon. Ensure CI will catch this in the future (#12744) --- .github/workflows/examples-infineon.yaml | 21 ++++++++++++++++++--- scripts/build/builders/infineon.py | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/examples-infineon.yaml b/.github/workflows/examples-infineon.yaml index de651be3d54ad9..ec6188e77c222a 100644 --- a/.github/workflows/examples-infineon.yaml +++ b/.github/workflows/examples-infineon.yaml @@ -61,7 +61,12 @@ jobs: timeout-minutes: 10 run: | scripts/run_in_build_env.sh \ - "scripts/build/build_examples.py --no-log-timestamps --target 'infineon-p6-lock' build" + "scripts/build/build_examples.py \ + --enable-flashbundle --no-log-timestamps \ + --target infineon-p6-lock \ + build \ + --copy-artifacts-to out/artifacts \ + " .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ p6 default lock-app \ out/infineon-p6-lock/chip-p6-lock-example.out @@ -69,7 +74,12 @@ jobs: timeout-minutes: 10 run: | scripts/run_in_build_env.sh \ - "scripts/build/build_examples.py --no-log-timestamps --target 'infineon-p6-all-clusters' build" + "scripts/build/build_examples.py \ + --enable-flashbundle --no-log-timestamps \ + --target infineon-p6-all-clusters \ + build \ + --copy-artifacts-to out/artifacts \ + " .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ p6 default all-clusters-app \ out/infineon-p6-all-clusters/chip-p6-clusters-example.out @@ -77,7 +87,12 @@ jobs: timeout-minutes: 10 run: | scripts/run_in_build_env.sh \ - "scripts/build/build_examples.py --no-log-timestamps --target 'infineon-p6-light' build" + "scripts/build/build_examples.py \ + --enable-flashbundle --no-log-timestamps \ + --target infineon-p6-light \ + build \ + --copy-artifacts-to out/artifacts \ + " .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ p6 default light-app \ out/infineon-p6-light/chip-p6-lighting-example.out diff --git a/scripts/build/builders/infineon.py b/scripts/build/builders/infineon.py index 3c5f1f828afa37..3324525c6ae3a6 100644 --- a/scripts/build/builders/infineon.py +++ b/scripts/build/builders/infineon.py @@ -49,7 +49,7 @@ def FlashBundleName(self): elif self == InfineonApp.ALL_CLUSTERS: return 'clusters_app.flashbundle.txt' elif self == InfineonApp.LIGHT: - return 'light_app.flashbundle.txt' + return 'lighting_app.flashbundle.txt' else: raise Exception('Unknown app type: %r' % self) From a5f849c91c570fa0dafb7c5e90baba62583d6b62 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Wed, 8 Dec 2021 16:30:56 -0500 Subject: [PATCH 05/28] Fix inifinte loop in esp32 RIO handling. (#12736) If the router is advertising a default prefix (::/0), the route handler is going into an infinite loop. Route information options can only have one prefix anyway, so the loop here is overkill and likely to introduce bad routes. Changing this to a simple check. Test: Configured radvd to advertise a default route, saw infinite loop on upstream, no problems with this code. Regular routes are being processed correctly. --- examples/platform/esp32/route_hook/esp_route_hook.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/platform/esp32/route_hook/esp_route_hook.c b/examples/platform/esp32/route_hook/esp_route_hook.c index 201619f301a574..ab60fc23a8a55a 100644 --- a/examples/platform/esp32/route_hook/esp_route_hook.c +++ b/examples/platform/esp32/route_hook/esp_route_hook.c @@ -94,7 +94,7 @@ static void ra_recv_handler(struct netif * netif, const uint8_t * icmp_payload, uint8_t rio_data_len = opt_len - sizeof(rio_header_t); ESP_LOGI(TAG, "Received RIO"); - for (; rio_data_len >= prefix_len_bytes; rio_data_len -= prefix_len_bytes, rio_data += prefix_len_bytes) + if (rio_data_len >= prefix_len_bytes) { ip6_addr_t prefix; esp_route_entry_t route; From 3e3195caeee2501c3e035cb7c5d0b09881bee4ab Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 8 Dec 2021 16:48:32 -0500 Subject: [PATCH 06/28] Enable client-side accessor generation for strongly typed enum attributes. (#12731) --- src/app/data-model/Nullable.h | 3 + .../zap-templates/common/ClustersHelper.js | 6 - .../java/templates/CHIPClusters-JNI.zapt | 4 +- .../templates/CHIPInvokeCallbacks-src.zapt | 2 +- .../java/templates/CHIPReadCallbacks-src.zapt | 2 +- .../java/templates/partials/decode_value.zapt | 2 +- .../java/templates/partials/encode_value.zapt | 12 +- .../java/zap-generated/CHIPClusters-JNI.cpp | 307 +- .../zap-generated/CHIPClustersRead-JNI.cpp | 175 +- .../java/zap-generated/CHIPReadCallbacks.cpp | 540 +++ .../java/zap-generated/CHIPReadCallbacks.h | 217 ++ .../chip/devicecontroller/ChipClusters.java | 186 +- .../devicecontroller/ClusterReadMapping.java | 73 +- .../devicecontroller/ClusterWriteMapping.java | 33 + .../templates/CHIPCallbackBridge-src.zapt | 7 + .../CHIPCallbackBridge_internal.zapt | 14 + .../CHIP/templates/CHIPClustersObjc-src.zapt | 2 + .../CHIP/zap-generated/CHIPCallbackBridge.mm | 2198 ++++++++++++ .../CHIPCallbackBridge_internal.h | 3171 +++++++++++++++++ .../CHIP/zap-generated/CHIPClustersObjc.h | 32 + .../CHIP/zap-generated/CHIPClustersObjc.mm | 196 + .../Framework/CHIPTests/CHIPClustersTests.m | 48 + .../zap-generated/cluster/Commands.h | 392 ++ .../zap-generated/reporting/Commands.h | 25 + .../zap-generated/CHIPClusters.cpp | 68 + .../zap-generated/CHIPClusters.h | 13 + 26 files changed, 7672 insertions(+), 56 deletions(-) diff --git a/src/app/data-model/Nullable.h b/src/app/data-model/Nullable.h index 50efceb7aa6f95..ff33d2d0d68fde 100644 --- a/src/app/data-model/Nullable.h +++ b/src/app/data-model/Nullable.h @@ -41,6 +41,9 @@ struct Nullable : protected Optional // Optional. using Optional::Value; + // Some consumers need an easy way to determine our underlying type. + using UnderlyingType = T; + constexpr void SetNull() { Optional::ClearValue(); } constexpr bool IsNull() const { return !Optional::HasValue(); } diff --git a/src/app/zap-templates/common/ClustersHelper.js b/src/app/zap-templates/common/ClustersHelper.js index 939d5cc14c7d1e..8ec037819760a3 100644 --- a/src/app/zap-templates/common/ClustersHelper.js +++ b/src/app/zap-templates/common/ClustersHelper.js @@ -164,12 +164,6 @@ function asChipCallback(item) return { name : 'List', type : null }; } - if (item.isEnum) { - // Unsupported or now, until we figure out what to do for callbacks for - // strongly typed enums. - return { name : 'Unsupported', type : null }; - } - const basicType = ChipTypesHelper.asBasicType(item.chipType); switch (basicType) { case 'int8_t': diff --git a/src/controller/java/templates/CHIPClusters-JNI.zapt b/src/controller/java/templates/CHIPClusters-JNI.zapt index df068fe01d8314..bc4867ec2d1825 100644 --- a/src/controller/java/templates/CHIPClusters-JNI.zapt +++ b/src/controller/java/templates/CHIPClusters-JNI.zapt @@ -52,7 +52,7 @@ JNI_METHOD(void, {{asUpperCamelCase ../name}}Cluster, {{asLowerCamelCase name}}) chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::Type request; {{#chip_cluster_command_arguments}} - {{>encode_value target=(concat "request." (asLowerCamelCase label)) source=(asLowerCamelCase label)}} + {{>encode_value target=(concat "request." (asLowerCamelCase label)) source=(asLowerCamelCase label) cluster=parent.parent.name}} {{/chip_cluster_command_arguments}} {{#*inline "callbackName"}}{{#if hasSpecificResponse}}{{asUpperCamelCase parent.name false}}Cluster{{asUpperCamelCase responseName false}}{{else}}DefaultSuccess{{/if}}{{/inline}} @@ -93,7 +93,7 @@ JNI_METHOD(void, {{asUpperCamelCase ../name}}Cluster, write{{asUpperCamelCase na using TypeInfo = chip::app::Clusters::{{asUpperCamelCase parent.name}}::Attributes::{{asUpperCamelCase name}}::TypeInfo; TypeInfo::Type cppValue; - {{>encode_value target="cppValue" source="value"}} + {{>encode_value target="cppValue" source="value" cluster=parent.name}} std::unique_ptr onSuccess(Platform::New(callback), Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); diff --git a/src/controller/java/templates/CHIPInvokeCallbacks-src.zapt b/src/controller/java/templates/CHIPInvokeCallbacks-src.zapt index 3c8ab15c6dbc96..3a90b3d2d9bd7a 100644 --- a/src/controller/java/templates/CHIPInvokeCallbacks-src.zapt +++ b/src/controller/java/templates/CHIPInvokeCallbacks-src.zapt @@ -65,7 +65,7 @@ void CHIP{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}Callbac VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error invoking Java callback: %s", ErrorStr(err))); {{#chip_cluster_response_arguments}} - {{>decode_value source=(concat "dataResponse." (asLowerCamelCase name)) target=(asSymbol label)}} + {{>decode_value source=(concat "dataResponse." (asLowerCamelCase name)) target=(asSymbol label) cluster=parent.parent.name}} {{/chip_cluster_response_arguments}} env->CallVoidMethod(javaCallbackRef, javaMethod{{#chip_cluster_response_arguments}}, {{asSymbol label}}{{/chip_cluster_response_arguments}}); diff --git a/src/controller/java/templates/CHIPReadCallbacks-src.zapt b/src/controller/java/templates/CHIPReadCallbacks-src.zapt index a18431cdd071e4..d7c33c21f61a58 100644 --- a/src/controller/java/templates/CHIPReadCallbacks-src.zapt +++ b/src/controller/java/templates/CHIPReadCallbacks-src.zapt @@ -340,7 +340,7 @@ void CHIP{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}AttributeCallb err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "({{#if isArray}}{{else if isStruct}}{{else if isOptional}}Ljava/util/Optional;{{else if (isOctetString type)}}[B{{else if (isCharString type)}}Ljava/lang/String;{{else}}{{asJniSignature type true}}{{/if}})V", &javaMethod); VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); - {{>decode_value source="value" target="javaValue"}} + {{>decode_value source="value" target="javaValue" cluster=parent.name}} env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } diff --git a/src/controller/java/templates/partials/decode_value.zapt b/src/controller/java/templates/partials/decode_value.zapt index dc53a3937eb26b..723258bb631046 100644 --- a/src/controller/java/templates/partials/decode_value.zapt +++ b/src/controller/java/templates/partials/decode_value.zapt @@ -24,7 +24,7 @@ chip::UtfString {{target}}UtfString(env, {{>item}}); {{else}} std::string {{target}}ClassName = "java/lang/{{asJavaBasicTypeForZclType type true}}"; std::string {{target}}CtorSignature = "({{asJniSignature type false}})V"; -chip::JniReferences::GetInstance().CreateBoxedObject<{{zapTypeToDecodableClusterObjectType type ns=parent.parent.name forceNotNullable=true forceNotOptional=true}}>({{target}}ClassName.c_str(), {{target}}CtorSignature.c_str(), {{>item}}, {{target}}); +chip::JniReferences::GetInstance().CreateBoxedObject<{{zapTypeToDecodableClusterObjectType type ns=cluster forceNotNullable=true forceNotOptional=true}}>({{target}}ClassName.c_str(), {{target}}CtorSignature.c_str(), {{>item}}, {{target}}); {{/if}} {{#if isOptional}} chip::JniReferences::GetInstance().CreateOptional({{target}}, {{target}}); diff --git a/src/controller/java/templates/partials/encode_value.zapt b/src/controller/java/templates/partials/encode_value.zapt index 8903ac6b6c6f0d..14f244f0837f7d 100644 --- a/src/controller/java/templates/partials/encode_value.zapt +++ b/src/controller/java/templates/partials/encode_value.zapt @@ -3,9 +3,9 @@ chip::JniReferences::GetInstance().GetOptionalValue({{source}}, {{source}}); {{/if}} {{#if isNullable}} {{#if_chip_enum type}} - decltype({{target}}) {{source}}Value; + decltype({{target}})::UnderlyingType {{source}}Value; if ({{source}} != nullptr) { - {{source}}Value = static_cast(chip::JniReferences::GetInstance().{{asJavaBoxedType type}}ToPrimitive({{source}})); + {{source}}Value = static_cast(chip::JniReferences::GetInstance().{{asJavaBoxedType type}}ToPrimitive({{source}})); } {{else}} {{#if isArray}} @@ -41,9 +41,9 @@ chip::JniReferences::GetInstance().GetOptionalValue({{source}}, {{source}}); {{#*inline "value"}} {{! TODO Implement complex types parsing in order to properly set the request parameters }} {{#if isArray}} -{{zapTypeToEncodableClusterObjectType type ns=parent.parent.name}}() +{{zapTypeToEncodableClusterObjectType type ns=cluster}}() {{else if isStruct}} -{{zapTypeToEncodableClusterObjectType type ns=parent.parent.name}}() +{{zapTypeToEncodableClusterObjectType type ns=cluster}}() {{else if (isOctetString type)}} chip::JniByteArray(env, static_cast({{source}})).byteSpan() {{else if (isCharString type)}} @@ -62,10 +62,10 @@ chip::JniUtfString(env, static_cast({{source}})).charSpan() {{/inline}} {{target}} = {{#if isOptional}} -{{zapTypeToEncodableClusterObjectType type ns=parent.parent.name}}( +{{zapTypeToEncodableClusterObjectType type ns=cluster}}( {{/if}} {{#if isNullable}} - {{source}} == nullptr ? chip::app::DataModel::Nullable<{{chipType}}>() : chip::app::DataModel::Nullable<{{chipType}}>({{source}}Value) + {{source}} == nullptr ? {{zapTypeToEncodableClusterObjectType type ns=cluster forceNotOptional=true}}() : {{zapTypeToEncodableClusterObjectType type ns=cluster forceNotOptional=true}}({{source}}Value) {{else}} {{! TODO If the inline partial is indented, generation fails with "result.split is not a function". }} {{>value}} diff --git a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp index 352341ba22b17d..2a6651e251fb23 100644 --- a/src/controller/java/zap-generated/CHIPClusters-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClusters-JNI.cpp @@ -9547,6 +9547,114 @@ JNI_METHOD(void, DoorLockCluster, unlockWithTimeout) onSuccess.release(); onFailure.release(); } +JNI_METHOD(void, DoorLockCluster, subscribeLockStateAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + DoorLockCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->SubscribeAttributeLockState(onSuccess->Cancel(), onFailure->Cancel(), static_cast(minInterval), + static_cast(maxInterval)); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, DoorLockCluster, reportLockStateAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onReport( + Platform::New(callback, true), Platform::Delete); + VerifyOrReturn(onReport.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native report callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + DoorLockCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReportAttributeLockState(onReport->Cancel()); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error registering for attribute reporting", err)); + + onReport.release(); +} +JNI_METHOD(void, DoorLockCluster, subscribeLockTypeAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + DoorLockCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->SubscribeAttributeLockType(onSuccess->Cancel(), onFailure->Cancel(), static_cast(minInterval), + static_cast(maxInterval)); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, DoorLockCluster, reportLockTypeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onReport( + Platform::New(callback, true), Platform::Delete); + VerifyOrReturn(onReport.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native report callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + DoorLockCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReportAttributeLockType(onReport->Cancel()); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error registering for attribute reporting", err)); + + onReport.release(); +} JNI_METHOD(void, DoorLockCluster, subscribeActuatorEnabledAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) { @@ -26944,6 +27052,98 @@ JNI_METHOD(void, TestClusterCluster, reportVendorIdAttribute)(JNIEnv * env, jobj onReport.release(); } +JNI_METHOD(void, TestClusterCluster, writeEnumAttrAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value) +{ + chip::DeviceLayer::StackLock lock; + using TypeInfo = chip::app::Clusters::TestCluster::Attributes::EnumAttr::TypeInfo; + TypeInfo::Type cppValue; + + cppValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, TestClusterCluster, subscribeEnumAttrAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->SubscribeAttributeEnumAttr(onSuccess->Cancel(), onFailure->Cancel(), static_cast(minInterval), + static_cast(maxInterval)); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, reportEnumAttrAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onReport( + Platform::New(callback, true), Platform::Delete); + VerifyOrReturn(onReport.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native report callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReportAttributeEnumAttr(onReport->Cancel()); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error registering for attribute reporting", err)); + + onReport.release(); +} + JNI_METHOD(void, TestClusterCluster, writeRangeRestrictedInt8uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value) { @@ -29493,10 +29693,10 @@ JNI_METHOD(void, TestClusterCluster, writeNullableEnum8Attribute) using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableEnum8::TypeInfo; TypeInfo::Type cppValue; - decltype(cppValue) valueValue; + decltype(cppValue)::UnderlyingType valueValue; if (value != nullptr) { - valueValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + valueValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); } cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); @@ -29590,10 +29790,10 @@ JNI_METHOD(void, TestClusterCluster, writeNullableEnum16Attribute) using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableEnum16::TypeInfo; TypeInfo::Type cppValue; - decltype(cppValue) valueValue; + decltype(cppValue)::UnderlyingType valueValue; if (value != nullptr) { - valueValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + valueValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); } cppValue = value == nullptr ? chip::app::DataModel::Nullable() : chip::app::DataModel::Nullable(valueValue); @@ -30074,6 +30274,105 @@ JNI_METHOD(void, TestClusterCluster, reportNullableCharStringAttribute) onReport.release(); } +JNI_METHOD(void, TestClusterCluster, writeNullableEnumAttrAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value) +{ + chip::DeviceLayer::StackLock lock; + using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableEnumAttr::TypeInfo; + TypeInfo::Type cppValue; + + decltype(cppValue)::UnderlyingType valueValue; + if (value != nullptr) + { + valueValue = static_cast(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + } + cppValue = value == nullptr ? chip::app::DataModel::Nullable() + : chip::app::DataModel::Nullable(valueValue); + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} +JNI_METHOD(void, TestClusterCluster, subscribeNullableEnumAttrAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jint minInterval, jint maxInterval) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->SubscribeAttributeNullableEnumAttr(onSuccess->Cancel(), onFailure->Cancel(), + static_cast(minInterval), static_cast(maxInterval)); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error subscribing to attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, TestClusterCluster, reportNullableEnumAttrAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + std::unique_ptr onReport( + Platform::New(callback, true), Platform::Delete); + VerifyOrReturn(onReport.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native report callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + err = cppCluster->ReportAttributeNullableEnumAttr(onReport->Cancel()); + VerifyOrReturn(err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error registering for attribute reporting", err)); + + onReport.release(); +} + JNI_METHOD(void, TestClusterCluster, writeNullableRangeRestrictedInt8uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value) { diff --git a/src/controller/java/zap-generated/CHIPClustersRead-JNI.cpp b/src/controller/java/zap-generated/CHIPClustersRead-JNI.cpp index 86c7c6fcef6831..9521b343f60d04 100644 --- a/src/controller/java/zap-generated/CHIPClustersRead-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClustersRead-JNI.cpp @@ -4864,6 +4864,75 @@ JNI_METHOD(void, DiagnosticLogsCluster, readAttributeListAttribute)(JNIEnv * env onFailure.release(); } +JNI_METHOD(void, DoorLockCluster, readLockStateAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + using TypeInfo = chip::app::Clusters::DoorLock::Attributes::LockState::TypeInfo; + std::unique_ptr onSuccess( + chip::Platform::New(callback, false), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::DoorLockCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + err = cppCluster->ReadAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + +JNI_METHOD(void, DoorLockCluster, readLockTypeAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + using TypeInfo = chip::app::Clusters::DoorLock::Attributes::LockType::TypeInfo; + std::unique_ptr onSuccess( + chip::Platform::New(callback, false), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::DoorLockCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + err = cppCluster->ReadAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + JNI_METHOD(void, DoorLockCluster, readActuatorEnabledAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { chip::DeviceLayer::StackLock lock; @@ -7336,8 +7405,10 @@ JNI_METHOD(void, IlluminanceMeasurementCluster, readLightSensorTypeAttribute) { chip::DeviceLayer::StackLock lock; using TypeInfo = chip::app::Clusters::IlluminanceMeasurement::Attributes::LightSensorType::TypeInfo; - std::unique_ptr onSuccess( - chip::Platform::New(callback, false), chip::Platform::Delete); + std::unique_ptr + onSuccess(chip::Platform::New(callback, false), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -7823,8 +7894,9 @@ JNI_METHOD(void, LevelControlCluster, readOnLevelAttribute)(JNIEnv * env, jobjec { chip::DeviceLayer::StackLock lock; using TypeInfo = chip::app::Clusters::LevelControl::Attributes::OnLevel::TypeInfo; - std::unique_ptr onSuccess( - chip::Platform::New(callback, false), chip::Platform::Delete); + std::unique_ptr onSuccess( + chip::Platform::New(callback, false), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -7930,8 +8002,9 @@ JNI_METHOD(void, LevelControlCluster, readDefaultMoveRateAttribute)(JNIEnv * env { chip::DeviceLayer::StackLock lock; using TypeInfo = chip::app::Clusters::LevelControl::Attributes::DefaultMoveRate::TypeInfo; - std::unique_ptr onSuccess( - chip::Platform::New(callback, false), chip::Platform::Delete); + std::unique_ptr + onSuccess(chip::Platform::New(callback, false), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -14437,6 +14510,40 @@ JNI_METHOD(void, TestClusterCluster, readListNullablesAndOptionalsStructAttribut onFailure.release(); } +JNI_METHOD(void, TestClusterCluster, readEnumAttrAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + using TypeInfo = chip::app::Clusters::TestCluster::Attributes::EnumAttr::TypeInfo; + std::unique_ptr onSuccess( + chip::Platform::New(callback, false), chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + err = cppCluster->ReadAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + JNI_METHOD(void, TestClusterCluster, readRangeRestrictedInt8uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { @@ -14721,8 +14828,9 @@ JNI_METHOD(void, TestClusterCluster, readNullableBitmap8Attribute)(JNIEnv * env, { chip::DeviceLayer::StackLock lock; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableBitmap8::TypeInfo; - std::unique_ptr onSuccess( - chip::Platform::New(callback, false), chip::Platform::Delete); + std::unique_ptr + onSuccess(chip::Platform::New(callback, false), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -14860,8 +14968,9 @@ JNI_METHOD(void, TestClusterCluster, readNullableInt8uAttribute)(JNIEnv * env, j { chip::DeviceLayer::StackLock lock; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableInt8u::TypeInfo; - std::unique_ptr onSuccess( - chip::Platform::New(callback, false), chip::Platform::Delete); + std::unique_ptr + onSuccess(chip::Platform::New(callback, false), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -15419,8 +15528,9 @@ JNI_METHOD(void, TestClusterCluster, readNullableEnum8Attribute)(JNIEnv * env, j { chip::DeviceLayer::StackLock lock; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableEnum8::TypeInfo; - std::unique_ptr onSuccess( - chip::Platform::New(callback, false), chip::Platform::Delete); + std::unique_ptr + onSuccess(chip::Platform::New(callback, false), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); @@ -15632,13 +15742,50 @@ JNI_METHOD(void, TestClusterCluster, readNullableCharStringAttribute) onFailure.release(); } +JNI_METHOD(void, TestClusterCluster, readNullableEnumAttrAttribute)(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) +{ + chip::DeviceLayer::StackLock lock; + using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableEnumAttr::TypeInfo; + std::unique_ptr + onSuccess(chip::Platform::New(callback, false), + chip::Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + chip::Platform::New(callback), chip::Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::TestClusterCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = + chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + err = cppCluster->ReadAttribute(onSuccess->mContext, successFn->mCall, failureFn->mCall); + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error reading attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + JNI_METHOD(void, TestClusterCluster, readNullableRangeRestrictedInt8uAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback) { chip::DeviceLayer::StackLock lock; using TypeInfo = chip::app::Clusters::TestCluster::Attributes::NullableRangeRestrictedInt8u::TypeInfo; - std::unique_ptr onSuccess( - chip::Platform::New(callback, false), chip::Platform::Delete); + std::unique_ptr + onSuccess(chip::Platform::New(callback, false), + chip::Platform::Delete); VerifyOrReturn(onSuccess.get() != nullptr, chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index 732b9e38730975..eb8c78b70e8585 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -3602,6 +3602,65 @@ void CHIPDiagnosticLogsAttributeListAttributeCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); } +CHIPDoorLockLockStateAttributeCallback::CHIPDoorLockLockStateAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPDoorLockLockStateAttributeCallback::~CHIPDoorLockLockStateAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPDoorLockLockStateAttributeCallback::CallbackFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject javaValue; + + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + javaValueClassName.c_str(), javaValueCtorSignature.c_str(), value.Value(), javaValue); + + env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); +} + CHIPDoorLockAttributeListAttributeCallback::CHIPDoorLockAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -5663,6 +5722,67 @@ void CHIPIlluminanceMeasurementMaxMeasuredValueAttributeCallback::CallbackFn(voi env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } +CHIPIlluminanceMeasurementLightSensorTypeAttributeCallback::CHIPIlluminanceMeasurementLightSensorTypeAttributeCallback( + jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPIlluminanceMeasurementLightSensorTypeAttributeCallback::~CHIPIlluminanceMeasurementLightSensorTypeAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPIlluminanceMeasurementLightSensorTypeAttributeCallback::CallbackFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject javaValue; + + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + + env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); +} + CHIPIlluminanceMeasurementAttributeListAttributeCallback::CHIPIlluminanceMeasurementAttributeListAttributeCallback( jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), @@ -5841,6 +5961,64 @@ void CHIPKeypadInputAttributeListAttributeCallback::CallbackFn(void * context, env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); } +CHIPLevelControlOnLevelAttributeCallback::CHIPLevelControlOnLevelAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPLevelControlOnLevelAttributeCallback::~CHIPLevelControlOnLevelAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPLevelControlOnLevelAttributeCallback::CallbackFn(void * context, const chip::app::DataModel::Nullable & value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject javaValue; + + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + + env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); +} + CHIPLevelControlOnTransitionTimeAttributeCallback::CHIPLevelControlOnTransitionTimeAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), @@ -5963,6 +6141,67 @@ void CHIPLevelControlOffTransitionTimeAttributeCallback::CallbackFn(void * conte env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } +CHIPLevelControlDefaultMoveRateAttributeCallback::CHIPLevelControlDefaultMoveRateAttributeCallback(jobject javaCallback, + bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPLevelControlDefaultMoveRateAttributeCallback::~CHIPLevelControlDefaultMoveRateAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPLevelControlDefaultMoveRateAttributeCallback::CallbackFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject javaValue; + + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + + env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); +} + CHIPLevelControlAttributeListAttributeCallback::CHIPLevelControlAttributeListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), @@ -10104,6 +10343,67 @@ void CHIPTestClusterNullableBooleanAttributeCallback::CallbackFn(void * context, env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } +CHIPTestClusterNullableBitmap8AttributeCallback::CHIPTestClusterNullableBitmap8AttributeCallback(jobject javaCallback, + bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPTestClusterNullableBitmap8AttributeCallback::~CHIPTestClusterNullableBitmap8AttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPTestClusterNullableBitmap8AttributeCallback::CallbackFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject javaValue; + + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + + env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); +} + CHIPTestClusterNullableBitmap16AttributeCallback::CHIPTestClusterNullableBitmap16AttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), @@ -10287,6 +10587,65 @@ void CHIPTestClusterNullableBitmap64AttributeCallback::CallbackFn(void * context env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } +CHIPTestClusterNullableInt8uAttributeCallback::CHIPTestClusterNullableInt8uAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPTestClusterNullableInt8uAttributeCallback::~CHIPTestClusterNullableInt8uAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPTestClusterNullableInt8uAttributeCallback::CallbackFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject javaValue; + + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + + env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); +} + CHIPTestClusterNullableInt16uAttributeCallback::CHIPTestClusterNullableInt16uAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), @@ -11199,6 +11558,65 @@ void CHIPTestClusterNullableInt64sAttributeCallback::CallbackFn(void * context, env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } +CHIPTestClusterNullableEnum8AttributeCallback::CHIPTestClusterNullableEnum8AttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPTestClusterNullableEnum8AttributeCallback::~CHIPTestClusterNullableEnum8AttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPTestClusterNullableEnum8AttributeCallback::CallbackFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject javaValue; + + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + + env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); +} + CHIPTestClusterNullableEnum16AttributeCallback::CHIPTestClusterNullableEnum16AttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), @@ -11500,6 +11918,128 @@ void CHIPTestClusterNullableCharStringAttributeCallback::CallbackFn(void * conte env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); } +CHIPTestClusterNullableEnumAttrAttributeCallback::CHIPTestClusterNullableEnumAttrAttributeCallback(jobject javaCallback, + bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPTestClusterNullableEnumAttrAttributeCallback::~CHIPTestClusterNullableEnumAttrAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPTestClusterNullableEnumAttrAttributeCallback::CallbackFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject javaValue; + + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject( + javaValueClassName.c_str(), javaValueCtorSignature.c_str(), value.Value(), javaValue); + + env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); +} + +CHIPTestClusterNullableRangeRestrictedInt8uAttributeCallback::CHIPTestClusterNullableRangeRestrictedInt8uAttributeCallback( + jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPTestClusterNullableRangeRestrictedInt8uAttributeCallback::~CHIPTestClusterNullableRangeRestrictedInt8uAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPTestClusterNullableRangeRestrictedInt8uAttributeCallback::CallbackFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject javaValue; + + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + + env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); +} + CHIPTestClusterNullableRangeRestrictedInt8sAttributeCallback::CHIPTestClusterNullableRangeRestrictedInt8sAttributeCallback( jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.h b/src/controller/java/zap-generated/CHIPReadCallbacks.h index 3eefb14538cdb2..91f74eeb1b94a9 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.h +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.h @@ -1045,6 +1045,30 @@ class CHIPDiagnosticLogsAttributeListAttributeCallback bool keepAlive; }; +class CHIPDoorLockLockStateAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPDoorLockLockStateAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPDoorLockLockStateAttributeCallback(); + + static void maybeDestroy(CHIPDoorLockLockStateAttributeCallback * callback) + { + if (!callback->keepAlive) + { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, + const chip::app::DataModel::Nullable & value); + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + class CHIPDoorLockAttributeListAttributeCallback : public chip::Callback::Callback { @@ -1562,6 +1586,30 @@ class CHIPIlluminanceMeasurementMaxMeasuredValueAttributeCallback bool keepAlive; }; +class CHIPIlluminanceMeasurementLightSensorTypeAttributeCallback + : public chip::Callback::Callback +{ +public: + CHIPIlluminanceMeasurementLightSensorTypeAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPIlluminanceMeasurementLightSensorTypeAttributeCallback(); + + static void maybeDestroy(CHIPIlluminanceMeasurementLightSensorTypeAttributeCallback * callback) + { + if (!callback->keepAlive) + { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + class CHIPIlluminanceMeasurementAttributeListAttributeCallback : public chip::Callback::Callback { @@ -1610,6 +1658,30 @@ class CHIPKeypadInputAttributeListAttributeCallback bool keepAlive; }; +class CHIPLevelControlOnLevelAttributeCallback + : public chip::Callback::Callback +{ +public: + CHIPLevelControlOnLevelAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPLevelControlOnLevelAttributeCallback(); + + static void maybeDestroy(CHIPLevelControlOnLevelAttributeCallback * callback) + { + if (!callback->keepAlive) + { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + class CHIPLevelControlOnTransitionTimeAttributeCallback : public chip::Callback::Callback { @@ -1658,6 +1730,30 @@ class CHIPLevelControlOffTransitionTimeAttributeCallback bool keepAlive; }; +class CHIPLevelControlDefaultMoveRateAttributeCallback + : public chip::Callback::Callback +{ +public: + CHIPLevelControlDefaultMoveRateAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPLevelControlDefaultMoveRateAttributeCallback(); + + static void maybeDestroy(CHIPLevelControlDefaultMoveRateAttributeCallback * callback) + { + if (!callback->keepAlive) + { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + class CHIPLevelControlAttributeListAttributeCallback : public chip::Callback::Callback { @@ -2684,6 +2780,30 @@ class CHIPTestClusterNullableBooleanAttributeCallback bool keepAlive; }; +class CHIPTestClusterNullableBitmap8AttributeCallback + : public chip::Callback::Callback +{ +public: + CHIPTestClusterNullableBitmap8AttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPTestClusterNullableBitmap8AttributeCallback(); + + static void maybeDestroy(CHIPTestClusterNullableBitmap8AttributeCallback * callback) + { + if (!callback->keepAlive) + { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + class CHIPTestClusterNullableBitmap16AttributeCallback : public chip::Callback::Callback { @@ -2756,6 +2876,30 @@ class CHIPTestClusterNullableBitmap64AttributeCallback bool keepAlive; }; +class CHIPTestClusterNullableInt8uAttributeCallback + : public chip::Callback::Callback +{ +public: + CHIPTestClusterNullableInt8uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPTestClusterNullableInt8uAttributeCallback(); + + static void maybeDestroy(CHIPTestClusterNullableInt8uAttributeCallback * callback) + { + if (!callback->keepAlive) + { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + class CHIPTestClusterNullableInt16uAttributeCallback : public chip::Callback::Callback { @@ -3116,6 +3260,30 @@ class CHIPTestClusterNullableInt64sAttributeCallback bool keepAlive; }; +class CHIPTestClusterNullableEnum8AttributeCallback + : public chip::Callback::Callback +{ +public: + CHIPTestClusterNullableEnum8AttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPTestClusterNullableEnum8AttributeCallback(); + + static void maybeDestroy(CHIPTestClusterNullableEnum8AttributeCallback * callback) + { + if (!callback->keepAlive) + { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + class CHIPTestClusterNullableEnum16AttributeCallback : public chip::Callback::Callback { @@ -3236,6 +3404,55 @@ class CHIPTestClusterNullableCharStringAttributeCallback bool keepAlive; }; +class CHIPTestClusterNullableEnumAttrAttributeCallback + : public chip::Callback::Callback +{ +public: + CHIPTestClusterNullableEnumAttrAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPTestClusterNullableEnumAttrAttributeCallback(); + + static void maybeDestroy(CHIPTestClusterNullableEnumAttrAttributeCallback * callback) + { + if (!callback->keepAlive) + { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, + const chip::app::DataModel::Nullable & value); + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + +class CHIPTestClusterNullableRangeRestrictedInt8uAttributeCallback + : public chip::Callback::Callback +{ +public: + CHIPTestClusterNullableRangeRestrictedInt8uAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPTestClusterNullableRangeRestrictedInt8uAttributeCallback(); + + static void maybeDestroy(CHIPTestClusterNullableRangeRestrictedInt8uAttributeCallback * callback) + { + if (!callback->keepAlive) + { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + class CHIPTestClusterNullableRangeRestrictedInt8sAttributeCallback : public chip::Callback::Callback { diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index 5f0e085a4c4879..0fd8b74d0470d9 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -4456,12 +4456,44 @@ void onSuccess( void onError(Exception error); } + public interface LockStateAttributeCallback { + void onSuccess(@Nullable Integer value); + + void onError(Exception ex); + } + public interface AttributeListAttributeCallback { void onSuccess(List valueList); void onError(Exception ex); } + public void readLockStateAttribute(LockStateAttributeCallback callback) { + readLockStateAttribute(chipClusterPtr, callback); + } + + public void subscribeLockStateAttribute( + DefaultClusterCallback callback, int minInterval, int maxInterval) { + subscribeLockStateAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + + public void reportLockStateAttribute(IntegerAttributeCallback callback) { + reportLockStateAttribute(chipClusterPtr, callback); + } + + public void readLockTypeAttribute(IntegerAttributeCallback callback) { + readLockTypeAttribute(chipClusterPtr, callback); + } + + public void subscribeLockTypeAttribute( + DefaultClusterCallback callback, int minInterval, int maxInterval) { + subscribeLockTypeAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + + public void reportLockTypeAttribute(IntegerAttributeCallback callback) { + reportLockTypeAttribute(chipClusterPtr, callback); + } + public void readActuatorEnabledAttribute(BooleanAttributeCallback callback) { readActuatorEnabledAttribute(chipClusterPtr, callback); } @@ -4492,6 +4524,24 @@ public void reportClusterRevisionAttribute(IntegerAttributeCallback callback) { reportClusterRevisionAttribute(chipClusterPtr, callback); } + private native void readLockStateAttribute( + long chipClusterPtr, LockStateAttributeCallback callback); + + private native void subscribeLockStateAttribute( + long chipClusterPtr, DefaultClusterCallback callback, int minInterval, int maxInterval); + + private native void reportLockStateAttribute( + long chipClusterPtr, IntegerAttributeCallback callback); + + private native void readLockTypeAttribute( + long chipClusterPtr, IntegerAttributeCallback callback); + + private native void subscribeLockTypeAttribute( + long chipClusterPtr, DefaultClusterCallback callback, int minInterval, int maxInterval); + + private native void reportLockTypeAttribute( + long chipClusterPtr, IntegerAttributeCallback callback); + private native void readActuatorEnabledAttribute( long chipClusterPtr, BooleanAttributeCallback callback); @@ -6152,6 +6202,12 @@ public interface MaxMeasuredValueAttributeCallback { void onError(Exception ex); } + public interface LightSensorTypeAttributeCallback { + void onSuccess(@Nullable Integer value); + + void onError(Exception ex); + } + public interface AttributeListAttributeCallback { void onSuccess(List valueList); @@ -6210,7 +6266,7 @@ public void reportToleranceAttribute(IntegerAttributeCallback callback) { reportToleranceAttribute(chipClusterPtr, callback); } - public void readLightSensorTypeAttribute(IntegerAttributeCallback callback) { + public void readLightSensorTypeAttribute(LightSensorTypeAttributeCallback callback) { readLightSensorTypeAttribute(chipClusterPtr, callback); } @@ -6277,7 +6333,7 @@ private native void reportToleranceAttribute( long chipClusterPtr, IntegerAttributeCallback callback); private native void readLightSensorTypeAttribute( - long chipClusterPtr, IntegerAttributeCallback callback); + long chipClusterPtr, LightSensorTypeAttributeCallback callback); private native void subscribeLightSensorTypeAttribute( long chipClusterPtr, DefaultClusterCallback callback, int minInterval, int maxInterval); @@ -6474,6 +6530,12 @@ private native void stop( private native void stopWithOnOff(long chipClusterPtr, DefaultClusterCallback Callback); + public interface OnLevelAttributeCallback { + void onSuccess(@Nullable Integer value); + + void onError(Exception ex); + } + public interface OnTransitionTimeAttributeCallback { void onSuccess(@Nullable Integer value); @@ -6486,6 +6548,12 @@ public interface OffTransitionTimeAttributeCallback { void onError(Exception ex); } + public interface DefaultMoveRateAttributeCallback { + void onSuccess(@Nullable Integer value); + + void onError(Exception ex); + } + public interface AttributeListAttributeCallback { void onSuccess(List valueList); @@ -6617,7 +6685,7 @@ public void reportOnOffTransitionTimeAttribute(IntegerAttributeCallback callback reportOnOffTransitionTimeAttribute(chipClusterPtr, callback); } - public void readOnLevelAttribute(IntegerAttributeCallback callback) { + public void readOnLevelAttribute(OnLevelAttributeCallback callback) { readOnLevelAttribute(chipClusterPtr, callback); } @@ -6670,7 +6738,7 @@ public void reportOffTransitionTimeAttribute(IntegerAttributeCallback callback) reportOffTransitionTimeAttribute(chipClusterPtr, callback); } - public void readDefaultMoveRateAttribute(IntegerAttributeCallback callback) { + public void readDefaultMoveRateAttribute(DefaultMoveRateAttributeCallback callback) { readDefaultMoveRateAttribute(chipClusterPtr, callback); } @@ -6810,7 +6878,7 @@ private native void reportOnOffTransitionTimeAttribute( long chipClusterPtr, IntegerAttributeCallback callback); private native void readOnLevelAttribute( - long chipClusterPtr, IntegerAttributeCallback callback); + long chipClusterPtr, OnLevelAttributeCallback callback); private native void writeOnLevelAttribute( long chipClusterPtr, DefaultClusterCallback callback, @Nullable Integer value); @@ -6846,7 +6914,7 @@ private native void reportOffTransitionTimeAttribute( long chipClusterPtr, IntegerAttributeCallback callback); private native void readDefaultMoveRateAttribute( - long chipClusterPtr, IntegerAttributeCallback callback); + long chipClusterPtr, DefaultMoveRateAttributeCallback callback); private native void writeDefaultMoveRateAttribute( long chipClusterPtr, DefaultClusterCallback callback, @Nullable Integer value); @@ -11454,6 +11522,12 @@ public interface NullableBooleanAttributeCallback { void onError(Exception ex); } + public interface NullableBitmap8AttributeCallback { + void onSuccess(@Nullable Integer value); + + void onError(Exception ex); + } + public interface NullableBitmap16AttributeCallback { void onSuccess(@Nullable Integer value); @@ -11472,6 +11546,12 @@ public interface NullableBitmap64AttributeCallback { void onError(Exception ex); } + public interface NullableInt8uAttributeCallback { + void onSuccess(@Nullable Integer value); + + void onError(Exception ex); + } + public interface NullableInt16uAttributeCallback { void onSuccess(@Nullable Integer value); @@ -11562,6 +11642,12 @@ public interface NullableInt64sAttributeCallback { void onError(Exception ex); } + public interface NullableEnum8AttributeCallback { + void onSuccess(@Nullable Integer value); + + void onError(Exception ex); + } + public interface NullableEnum16AttributeCallback { void onSuccess(@Nullable Integer value); @@ -11592,6 +11678,18 @@ public interface NullableCharStringAttributeCallback { void onError(Exception ex); } + public interface NullableEnumAttrAttributeCallback { + void onSuccess(@Nullable Integer value); + + void onError(Exception ex); + } + + public interface NullableRangeRestrictedInt8uAttributeCallback { + void onSuccess(@Nullable Integer value); + + void onError(Exception ex); + } + public interface NullableRangeRestrictedInt8sAttributeCallback { void onSuccess(@Nullable Integer value); @@ -12178,6 +12276,23 @@ public void readListNullablesAndOptionalsStructAttribute( readListNullablesAndOptionalsStructAttribute(chipClusterPtr, callback); } + public void readEnumAttrAttribute(IntegerAttributeCallback callback) { + readEnumAttrAttribute(chipClusterPtr, callback); + } + + public void writeEnumAttrAttribute(DefaultClusterCallback callback, Integer value) { + writeEnumAttrAttribute(chipClusterPtr, callback, value); + } + + public void subscribeEnumAttrAttribute( + DefaultClusterCallback callback, int minInterval, int maxInterval) { + subscribeEnumAttrAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + + public void reportEnumAttrAttribute(IntegerAttributeCallback callback) { + reportEnumAttrAttribute(chipClusterPtr, callback); + } + public void readRangeRestrictedInt8uAttribute(IntegerAttributeCallback callback) { readRangeRestrictedInt8uAttribute(chipClusterPtr, callback); } @@ -12295,7 +12410,7 @@ public void reportNullableBooleanAttribute(BooleanAttributeCallback callback) { reportNullableBooleanAttribute(chipClusterPtr, callback); } - public void readNullableBitmap8Attribute(IntegerAttributeCallback callback) { + public void readNullableBitmap8Attribute(NullableBitmap8AttributeCallback callback) { readNullableBitmap8Attribute(chipClusterPtr, callback); } @@ -12367,7 +12482,7 @@ public void reportNullableBitmap64Attribute(LongAttributeCallback callback) { reportNullableBitmap64Attribute(chipClusterPtr, callback); } - public void readNullableInt8uAttribute(IntegerAttributeCallback callback) { + public void readNullableInt8uAttribute(NullableInt8uAttributeCallback callback) { readNullableInt8uAttribute(chipClusterPtr, callback); } @@ -12655,7 +12770,7 @@ public void reportNullableInt64sAttribute(LongAttributeCallback callback) { reportNullableInt64sAttribute(chipClusterPtr, callback); } - public void readNullableEnum8Attribute(IntegerAttributeCallback callback) { + public void readNullableEnum8Attribute(NullableEnum8AttributeCallback callback) { readNullableEnum8Attribute(chipClusterPtr, callback); } @@ -12763,7 +12878,26 @@ public void reportNullableCharStringAttribute(CharStringAttributeCallback callba reportNullableCharStringAttribute(chipClusterPtr, callback); } - public void readNullableRangeRestrictedInt8uAttribute(IntegerAttributeCallback callback) { + public void readNullableEnumAttrAttribute(NullableEnumAttrAttributeCallback callback) { + readNullableEnumAttrAttribute(chipClusterPtr, callback); + } + + public void writeNullableEnumAttrAttribute( + DefaultClusterCallback callback, @Nullable Integer value) { + writeNullableEnumAttrAttribute(chipClusterPtr, callback, value); + } + + public void subscribeNullableEnumAttrAttribute( + DefaultClusterCallback callback, int minInterval, int maxInterval) { + subscribeNullableEnumAttrAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + + public void reportNullableEnumAttrAttribute(IntegerAttributeCallback callback) { + reportNullableEnumAttrAttribute(chipClusterPtr, callback); + } + + public void readNullableRangeRestrictedInt8uAttribute( + NullableRangeRestrictedInt8uAttributeCallback callback) { readNullableRangeRestrictedInt8uAttribute(chipClusterPtr, callback); } @@ -13219,6 +13353,18 @@ private native void reportVendorIdAttribute( private native void readListNullablesAndOptionalsStructAttribute( long chipClusterPtr, ListNullablesAndOptionalsStructAttributeCallback callback); + private native void readEnumAttrAttribute( + long chipClusterPtr, IntegerAttributeCallback callback); + + private native void writeEnumAttrAttribute( + long chipClusterPtr, DefaultClusterCallback callback, Integer value); + + private native void subscribeEnumAttrAttribute( + long chipClusterPtr, DefaultClusterCallback callback, int minInterval, int maxInterval); + + private native void reportEnumAttrAttribute( + long chipClusterPtr, IntegerAttributeCallback callback); + private native void readRangeRestrictedInt8uAttribute( long chipClusterPtr, IntegerAttributeCallback callback); @@ -13301,7 +13447,7 @@ private native void reportNullableBooleanAttribute( long chipClusterPtr, BooleanAttributeCallback callback); private native void readNullableBitmap8Attribute( - long chipClusterPtr, IntegerAttributeCallback callback); + long chipClusterPtr, NullableBitmap8AttributeCallback callback); private native void writeNullableBitmap8Attribute( long chipClusterPtr, DefaultClusterCallback callback, @Nullable Integer value); @@ -13349,7 +13495,7 @@ private native void reportNullableBitmap64Attribute( long chipClusterPtr, LongAttributeCallback callback); private native void readNullableInt8uAttribute( - long chipClusterPtr, IntegerAttributeCallback callback); + long chipClusterPtr, NullableInt8uAttributeCallback callback); private native void writeNullableInt8uAttribute( long chipClusterPtr, DefaultClusterCallback callback, @Nullable Integer value); @@ -13541,7 +13687,7 @@ private native void reportNullableInt64sAttribute( long chipClusterPtr, LongAttributeCallback callback); private native void readNullableEnum8Attribute( - long chipClusterPtr, IntegerAttributeCallback callback); + long chipClusterPtr, NullableEnum8AttributeCallback callback); private native void writeNullableEnum8Attribute( long chipClusterPtr, DefaultClusterCallback callback, @Nullable Integer value); @@ -13612,9 +13758,21 @@ private native void subscribeNullableCharStringAttribute( private native void reportNullableCharStringAttribute( long chipClusterPtr, CharStringAttributeCallback callback); - private native void readNullableRangeRestrictedInt8uAttribute( + private native void readNullableEnumAttrAttribute( + long chipClusterPtr, NullableEnumAttrAttributeCallback callback); + + private native void writeNullableEnumAttrAttribute( + long chipClusterPtr, DefaultClusterCallback callback, @Nullable Integer value); + + private native void subscribeNullableEnumAttrAttribute( + long chipClusterPtr, DefaultClusterCallback callback, int minInterval, int maxInterval); + + private native void reportNullableEnumAttrAttribute( long chipClusterPtr, IntegerAttributeCallback callback); + private native void readNullableRangeRestrictedInt8uAttribute( + long chipClusterPtr, NullableRangeRestrictedInt8uAttributeCallback callback); + private native void writeNullableRangeRestrictedInt8uAttribute( long chipClusterPtr, DefaultClusterCallback callback, @Nullable Integer value); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java index 721e855c307979..78b0ee53f04c1a 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java @@ -1869,6 +1869,31 @@ public Map> getReadAttributeMap() { "readAttributeListAttribute", readDiagnosticLogsAttributeListAttributeInteractionInfo); readAttributeMap.put("diagnosticLogs", readDiagnosticLogsInteractionInfo); Map readDoorLockInteractionInfo = new LinkedHashMap<>(); + Map readDoorLockLockStateCommandParams = + new LinkedHashMap(); + InteractionInfo readDoorLockLockStateAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DoorLockCluster) cluster) + .readLockStateAttribute( + (ChipClusters.DoorLockCluster.LockStateAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readDoorLockLockStateCommandParams); + readDoorLockInteractionInfo.put( + "readLockStateAttribute", readDoorLockLockStateAttributeInteractionInfo); + Map readDoorLockLockTypeCommandParams = + new LinkedHashMap(); + InteractionInfo readDoorLockLockTypeAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.DoorLockCluster) cluster) + .readLockTypeAttribute((ChipClusters.IntegerAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readDoorLockLockTypeCommandParams); + readDoorLockInteractionInfo.put( + "readLockTypeAttribute", readDoorLockLockTypeAttributeInteractionInfo); Map readDoorLockActuatorEnabledCommandParams = new LinkedHashMap(); InteractionInfo readDoorLockActuatorEnabledAttributeInteractionInfo = @@ -2816,7 +2841,9 @@ public Map> getReadAttributeMap() { new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.IlluminanceMeasurementCluster) cluster) - .readLightSensorTypeAttribute((ChipClusters.IntegerAttributeCallback) callback); + .readLightSensorTypeAttribute( + (ChipClusters.IlluminanceMeasurementCluster.LightSensorTypeAttributeCallback) + callback); }, () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), readIlluminanceMeasurementLightSensorTypeCommandParams); @@ -2999,7 +3026,8 @@ public Map> getReadAttributeMap() { new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.LevelControlCluster) cluster) - .readOnLevelAttribute((ChipClusters.IntegerAttributeCallback) callback); + .readOnLevelAttribute( + (ChipClusters.LevelControlCluster.OnLevelAttributeCallback) callback); }, () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), readLevelControlOnLevelCommandParams); @@ -3040,7 +3068,8 @@ public Map> getReadAttributeMap() { new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.LevelControlCluster) cluster) - .readDefaultMoveRateAttribute((ChipClusters.IntegerAttributeCallback) callback); + .readDefaultMoveRateAttribute( + (ChipClusters.LevelControlCluster.DefaultMoveRateAttributeCallback) callback); }, () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), readLevelControlDefaultMoveRateCommandParams); @@ -5496,6 +5525,18 @@ public Map> getReadAttributeMap() { readTestClusterInteractionInfo.put( "readListNullablesAndOptionalsStructAttribute", readTestClusterListNullablesAndOptionalsStructAttributeInteractionInfo); + Map readTestClusterEnumAttrCommandParams = + new LinkedHashMap(); + InteractionInfo readTestClusterEnumAttrAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.TestClusterCluster) cluster) + .readEnumAttrAttribute((ChipClusters.IntegerAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readTestClusterEnumAttrCommandParams); + readTestClusterInteractionInfo.put( + "readEnumAttrAttribute", readTestClusterEnumAttrAttributeInteractionInfo); Map readTestClusterRangeRestrictedInt8uCommandParams = new LinkedHashMap(); InteractionInfo readTestClusterRangeRestrictedInt8uAttributeInteractionInfo = @@ -5612,7 +5653,8 @@ public Map> getReadAttributeMap() { new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) - .readNullableBitmap8Attribute((ChipClusters.IntegerAttributeCallback) callback); + .readNullableBitmap8Attribute( + (ChipClusters.TestClusterCluster.NullableBitmap8AttributeCallback) callback); }, () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), readTestClusterNullableBitmap8CommandParams); @@ -5663,7 +5705,8 @@ public Map> getReadAttributeMap() { new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) - .readNullableInt8uAttribute((ChipClusters.IntegerAttributeCallback) callback); + .readNullableInt8uAttribute( + (ChipClusters.TestClusterCluster.NullableInt8uAttributeCallback) callback); }, () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), readTestClusterNullableInt8uCommandParams); @@ -5870,7 +5913,8 @@ public Map> getReadAttributeMap() { new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) - .readNullableEnum8Attribute((ChipClusters.IntegerAttributeCallback) callback); + .readNullableEnum8Attribute( + (ChipClusters.TestClusterCluster.NullableEnum8AttributeCallback) callback); }, () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), readTestClusterNullableEnum8CommandParams); @@ -5949,6 +5993,19 @@ public Map> getReadAttributeMap() { readTestClusterInteractionInfo.put( "readNullableCharStringAttribute", readTestClusterNullableCharStringAttributeInteractionInfo); + Map readTestClusterNullableEnumAttrCommandParams = + new LinkedHashMap(); + InteractionInfo readTestClusterNullableEnumAttrAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.TestClusterCluster) cluster) + .readNullableEnumAttrAttribute( + (ChipClusters.TestClusterCluster.NullableEnumAttrAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readTestClusterNullableEnumAttrCommandParams); + readTestClusterInteractionInfo.put( + "readNullableEnumAttrAttribute", readTestClusterNullableEnumAttrAttributeInteractionInfo); Map readTestClusterNullableRangeRestrictedInt8uCommandParams = new LinkedHashMap(); InteractionInfo readTestClusterNullableRangeRestrictedInt8uAttributeInteractionInfo = @@ -5956,7 +6013,9 @@ public Map> getReadAttributeMap() { (cluster, callback, commandArguments) -> { ((ChipClusters.TestClusterCluster) cluster) .readNullableRangeRestrictedInt8uAttribute( - (ChipClusters.IntegerAttributeCallback) callback); + (ChipClusters.TestClusterCluster + .NullableRangeRestrictedInt8uAttributeCallback) + callback); }, () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), readTestClusterNullableRangeRestrictedInt8uCommandParams); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java index 676f6a853b8e33..ddd9ff2fc1151f 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java @@ -1302,6 +1302,22 @@ public Map> getWriteAttributeMap() { writeTestClusterVendorIdCommandParams); writeTestClusterInteractionInfo.put( "writeVendorIdAttribute", writeTestClusterVendorIdAttributeInteractionInfo); + Map writeTestClusterEnumAttrCommandParams = + new LinkedHashMap(); + CommandParameterInfo testClusterenumAttrCommandParameterInfo = + new CommandParameterInfo("value", int.class); + writeTestClusterEnumAttrCommandParams.put("value", testClusterenumAttrCommandParameterInfo); + InteractionInfo writeTestClusterEnumAttrAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.TestClusterCluster) cluster) + .writeEnumAttrAttribute( + (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); + }, + () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), + writeTestClusterEnumAttrCommandParams); + writeTestClusterInteractionInfo.put( + "writeEnumAttrAttribute", writeTestClusterEnumAttrAttributeInteractionInfo); Map writeTestClusterRangeRestrictedInt8uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusterrangeRestrictedInt8uCommandParameterInfo = @@ -1872,6 +1888,23 @@ public Map> getWriteAttributeMap() { writeTestClusterInteractionInfo.put( "writeNullableCharStringAttribute", writeTestClusterNullableCharStringAttributeInteractionInfo); + Map writeTestClusterNullableEnumAttrCommandParams = + new LinkedHashMap(); + CommandParameterInfo testClusternullableEnumAttrCommandParameterInfo = + new CommandParameterInfo("value", int.class); + writeTestClusterNullableEnumAttrCommandParams.put( + "value", testClusternullableEnumAttrCommandParameterInfo); + InteractionInfo writeTestClusterNullableEnumAttrAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.TestClusterCluster) cluster) + .writeNullableEnumAttrAttribute( + (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); + }, + () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), + writeTestClusterNullableEnumAttrCommandParams); + writeTestClusterInteractionInfo.put( + "writeNullableEnumAttrAttribute", writeTestClusterNullableEnumAttrAttributeInteractionInfo); Map writeTestClusterNullableRangeRestrictedInt8uCommandParams = new LinkedHashMap(); CommandParameterInfo testClusternullableRangeRestrictedInt8uCommandParameterInfo = diff --git a/src/darwin/Framework/CHIP/templates/CHIPCallbackBridge-src.zapt b/src/darwin/Framework/CHIP/templates/CHIPCallbackBridge-src.zapt index afaeeaa0d7faa8..d2f27a991d8cf8 100644 --- a/src/darwin/Framework/CHIP/templates/CHIPCallbackBridge-src.zapt +++ b/src/darwin/Framework/CHIP/templates/CHIPCallbackBridge-src.zapt @@ -52,4 +52,11 @@ {{/chip_cluster_responses}} {{/chip_client_clusters}} +{{#zcl_clusters}} +{{#zcl_enums}} +{{#>CHIPCallbackBridge type=(asType label) isNullable=false ns=parent.name}}{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}AttributeCallback{{/CHIPCallbackBridge}} +{{#>CHIPCallbackBridge type=(asType label) isNullable=true ns=parent.name}}Nullable{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}AttributeCallback{{/CHIPCallbackBridge}} +{{/zcl_enums}} +{{/zcl_clusters}} + {{/if}} diff --git a/src/darwin/Framework/CHIP/templates/CHIPCallbackBridge_internal.zapt b/src/darwin/Framework/CHIP/templates/CHIPCallbackBridge_internal.zapt index 49f6f24bd9881c..dc20e898fad878 100644 --- a/src/darwin/Framework/CHIP/templates/CHIPCallbackBridge_internal.zapt +++ b/src/darwin/Framework/CHIP/templates/CHIPCallbackBridge_internal.zapt @@ -21,6 +21,13 @@ typedef void (*CHIP{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase nam {{/chip_cluster_responses}} {{/chip_client_clusters}} +{{#zcl_clusters}} +{{#zcl_enums}} +typedef void (*{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}AttributeCallback)(void *, chip::app::Clusters::{{asUpperCamelCase parent.name}}::{{asType label}}); +typedef void (*Nullable{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}AttributeCallback)(void *, const chip::app::DataModel::Nullable &); +{{/zcl_enums}} +{{/zcl_clusters}} + {{#>CHIPCallbackBridge header="1" partial-type="Status" }}DefaultSuccessCallback{{/CHIPCallbackBridge}} {{#>CHIPCallbackBridge header="1" partial-type="CommandStatus" }}CommandSuccessCallback{{/CHIPCallbackBridge}} {{#>CHIPCallbackBridge header="1" type="Octet_String" isNullable=false ns="chip"}}OctetStringAttributeCallback{{/CHIPCallbackBridge}} @@ -66,4 +73,11 @@ typedef void (*CHIP{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase nam {{/chip_cluster_responses}} {{/chip_client_clusters}} +{{#zcl_clusters}} +{{#zcl_enums}} +{{#>CHIPCallbackBridge header="1" type=(asType label) isNullable=false ns=parent.name}}{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}AttributeCallback{{/CHIPCallbackBridge}} +{{#>CHIPCallbackBridge header="1" type=(asType label) isNullable=true ns=parent.name}}Nullable{{asUpperCamelCase parent.name}}Cluster{{asUpperCamelCase name}}AttributeCallback{{/CHIPCallbackBridge}} +{{/zcl_enums}} +{{/zcl_clusters}} + {{/if}} diff --git a/src/darwin/Framework/CHIP/templates/CHIPClustersObjc-src.zapt b/src/darwin/Framework/CHIP/templates/CHIPClustersObjc-src.zapt index 18e676902ad48d..4019105463d104 100644 --- a/src/darwin/Framework/CHIP/templates/CHIPClustersObjc-src.zapt +++ b/src/darwin/Framework/CHIP/templates/CHIPClustersObjc-src.zapt @@ -92,6 +92,8 @@ using namespace chip::app::Clusters; {{~#if isNullable}}Nullable{{/if~}} {{~#if (isStrEqual (asUpperCamelCase type) (asUpperCamelCase "vendor_id"))~}} VendorId + {{~else if isEnum~}} + {{asUpperCamelCase ../name}}Cluster{{asUpperCamelCase type}} {{~else~}} {{chipCallback.name}} {{~/if~}} diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm index b31f305bad7aa2..6d6715ff9fd450 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm @@ -3949,3 +3949,2201 @@ } DispatchSuccess(context, response); }; + +void CHIPIdentifyClusterIdentifyEffectIdentifierAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::Identify::IdentifyEffectIdentifier value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableIdentifyClusterIdentifyEffectIdentifierAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPIdentifyClusterIdentifyEffectVariantAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::Identify::IdentifyEffectVariant value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableIdentifyClusterIdentifyEffectVariantAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPIdentifyClusterIdentifyIdentifyTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::Identify::IdentifyIdentifyType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableIdentifyClusterIdentifyIdentifyTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPOnOffClusterOnOffDelayedAllOffEffectVariantAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::OnOff::OnOffDelayedAllOffEffectVariant value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableOnOffClusterOnOffDelayedAllOffEffectVariantAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPOnOffClusterOnOffDyingLightEffectVariantAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::OnOff::OnOffDyingLightEffectVariant value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableOnOffClusterOnOffDyingLightEffectVariantAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPOnOffClusterOnOffEffectIdentifierAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::OnOff::OnOffEffectIdentifier value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableOnOffClusterOnOffEffectIdentifierAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPLevelControlClusterMoveModeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::LevelControl::MoveMode value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableLevelControlClusterMoveModeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPLevelControlClusterStepModeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::LevelControl::StepMode value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableLevelControlClusterStepModeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPApplianceControlClusterApplianceStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ApplianceControl::ApplianceStatus value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableApplianceControlClusterApplianceStatusAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPApplianceControlClusterCommandIdentificationAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ApplianceControl::CommandIdentification value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableApplianceControlClusterCommandIdentificationAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPApplianceControlClusterWarningEventAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ApplianceControl::WarningEvent value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableApplianceControlClusterWarningEventAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPAccessControlClusterAuthModeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::AccessControl::AuthMode value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableAccessControlClusterAuthModeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPAccessControlClusterPrivilegeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::AccessControl::Privilege value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableAccessControlClusterPrivilegeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPBridgedActionsClusterActionErrorEnumAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::BridgedActions::ActionErrorEnum value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableBridgedActionsClusterActionErrorEnumAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPBridgedActionsClusterActionStateEnumAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::BridgedActions::ActionStateEnum value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableBridgedActionsClusterActionStateEnumAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPBridgedActionsClusterActionTypeEnumAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::BridgedActions::ActionTypeEnum value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableBridgedActionsClusterActionTypeEnumAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPBridgedActionsClusterEndpointListTypeEnumAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::BridgedActions::EndpointListTypeEnum value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableBridgedActionsClusterEndpointListTypeEnumAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPOtaSoftwareUpdateProviderClusterOTAApplyUpdateActionAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::OtaSoftwareUpdateProvider::OTAApplyUpdateAction value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableOtaSoftwareUpdateProviderClusterOTAApplyUpdateActionAttributeCallbackBridge::OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPOtaSoftwareUpdateProviderClusterOTADownloadProtocolAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::OtaSoftwareUpdateProvider::OTADownloadProtocol value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableOtaSoftwareUpdateProviderClusterOTADownloadProtocolAttributeCallbackBridge::OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPOtaSoftwareUpdateProviderClusterOTAQueryStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::OtaSoftwareUpdateProvider::OTAQueryStatus value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableOtaSoftwareUpdateProviderClusterOTAQueryStatusAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::ChangeReasonEnum value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAAnnouncementReason value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge::OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::UpdateStateEnum value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPGeneralCommissioningClusterGeneralCommissioningErrorAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::GeneralCommissioning::GeneralCommissioningError value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableGeneralCommissioningClusterGeneralCommissioningErrorAttributeCallbackBridge::OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPGeneralCommissioningClusterRegulatoryLocationTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableGeneralCommissioningClusterRegulatoryLocationTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPNetworkCommissioningClusterNetworkCommissioningErrorAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::NetworkCommissioning::NetworkCommissioningError value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableNetworkCommissioningClusterNetworkCommissioningErrorAttributeCallbackBridge::OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDiagnosticLogsClusterLogsIntentAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DiagnosticLogs::LogsIntent value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDiagnosticLogsClusterLogsIntentAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDiagnosticLogsClusterLogsStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DiagnosticLogs::LogsStatus value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDiagnosticLogsClusterLogsStatusAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDiagnosticLogsClusterLogsTransferProtocolAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DiagnosticLogs::LogsTransferProtocol value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDiagnosticLogsClusterLogsTransferProtocolAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPGeneralDiagnosticsClusterBootReasonTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::GeneralDiagnostics::BootReasonType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableGeneralDiagnosticsClusterBootReasonTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPGeneralDiagnosticsClusterHardwareFaultTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::GeneralDiagnostics::HardwareFaultType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableGeneralDiagnosticsClusterHardwareFaultTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPGeneralDiagnosticsClusterInterfaceTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::GeneralDiagnostics::InterfaceType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableGeneralDiagnosticsClusterInterfaceTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPGeneralDiagnosticsClusterNetworkFaultTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::GeneralDiagnostics::NetworkFaultType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableGeneralDiagnosticsClusterNetworkFaultTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPGeneralDiagnosticsClusterRadioFaultTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::GeneralDiagnostics::RadioFaultType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableGeneralDiagnosticsClusterRadioFaultTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPThreadNetworkDiagnosticsClusterNetworkFaultAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ThreadNetworkDiagnostics::NetworkFault value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableThreadNetworkDiagnosticsClusterNetworkFaultAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPThreadNetworkDiagnosticsClusterRoutingRoleAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ThreadNetworkDiagnostics::RoutingRole value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableThreadNetworkDiagnosticsClusterRoutingRoleAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPThreadNetworkDiagnosticsClusterThreadConnectionStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ThreadNetworkDiagnostics::ThreadConnectionStatus value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableThreadNetworkDiagnosticsClusterThreadConnectionStatusAttributeCallbackBridge::OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPWiFiNetworkDiagnosticsClusterAssociationFailureCauseAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::WiFiNetworkDiagnostics::AssociationFailureCause value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableWiFiNetworkDiagnosticsClusterAssociationFailureCauseAttributeCallbackBridge::OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPWiFiNetworkDiagnosticsClusterSecurityTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::WiFiNetworkDiagnostics::SecurityType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableWiFiNetworkDiagnosticsClusterSecurityTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPWiFiNetworkDiagnosticsClusterWiFiConnectionStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::WiFiNetworkDiagnostics::WiFiConnectionStatus value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableWiFiNetworkDiagnosticsClusterWiFiConnectionStatusAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPWiFiNetworkDiagnosticsClusterWiFiVersionTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::WiFiNetworkDiagnostics::WiFiVersionType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableWiFiNetworkDiagnosticsClusterWiFiVersionTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPEthernetNetworkDiagnosticsClusterPHYRateTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::EthernetNetworkDiagnostics::PHYRateType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableEthernetNetworkDiagnosticsClusterPHYRateTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPAdministratorCommissioningClusterCommissioningWindowStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatus value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableAdministratorCommissioningClusterCommissioningWindowStatusAttributeCallbackBridge::OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPAdministratorCommissioningClusterStatusCodeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::AdministratorCommissioning::StatusCode value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableAdministratorCommissioningClusterStatusCodeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPOperationalCredentialsClusterNodeOperationalCertStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::OperationalCredentials::NodeOperationalCertStatus value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableOperationalCredentialsClusterNodeOperationalCertStatusAttributeCallbackBridge::OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPGroupKeyManagementClusterGroupKeySecurityPolicyAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::GroupKeyManagement::GroupKeySecurityPolicy value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableGroupKeyManagementClusterGroupKeySecurityPolicyAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDlAlarmCodeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DoorLock::DlAlarmCode value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDlAlarmCodeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDlCredentialRuleAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DoorLock::DlCredentialRule value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDlCredentialRuleAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDlCredentialTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DoorLock::DlCredentialType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDlCredentialTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDlDataOperationTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DoorLock::DlDataOperationType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDlDataOperationTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDlDoorLockStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DoorLock::DlDoorLockStatus value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDlDoorLockStatusAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDlDoorStateAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DoorLock::DlDoorState value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDlDoorStateAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDlLockDataTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DoorLock::DlLockDataType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDlLockDataTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDlLockOperationTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DoorLock::DlLockOperationType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDlLockOperationTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDlLockStateAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DoorLock::DlLockState value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDlLockStateAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDlLockTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DoorLock::DlLockType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDlLockTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDlOperatingModeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DoorLock::DlOperatingMode value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDlOperatingModeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDlOperationErrorAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DoorLock::DlOperationError value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDlOperationErrorAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDlOperationSourceAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DoorLock::DlOperationSource value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDlOperationSourceAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDlStatusAttributeCallbackBridge::OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DlStatus value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDlStatusAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDlUserStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DoorLock::DlUserStatus value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDlUserStatusAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDlUserTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DoorLock::DlUserType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDlUserTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDoorLockOperationEventCodeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DoorLock::DoorLockOperationEventCode value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDoorLockOperationEventCodeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDoorLockProgrammingEventCodeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DoorLock::DoorLockProgrammingEventCode value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDoorLockProgrammingEventCodeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDoorLockSetPinOrIdStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DoorLock::DoorLockSetPinOrIdStatus value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDoorLockSetPinOrIdStatusAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDoorLockUserStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DoorLock::DoorLockUserStatus value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDoorLockUserStatusAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPDoorLockClusterDoorLockUserTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::DoorLock::DoorLockUserType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableDoorLockClusterDoorLockUserTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPPumpConfigurationAndControlClusterPumpControlModeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullablePumpConfigurationAndControlClusterPumpControlModeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPPumpConfigurationAndControlClusterPumpOperationModeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullablePumpConfigurationAndControlClusterPumpOperationModeAttributeCallbackBridge::OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPThermostatClusterSetpointAdjustModeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::Thermostat::SetpointAdjustMode value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableThermostatClusterSetpointAdjustModeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPColorControlClusterColorLoopActionAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ColorControl::ColorLoopAction value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableColorControlClusterColorLoopActionAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPColorControlClusterColorLoopDirectionAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ColorControl::ColorLoopDirection value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableColorControlClusterColorLoopDirectionAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPColorControlClusterColorModeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ColorControl::ColorMode value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableColorControlClusterColorModeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPColorControlClusterHueDirectionAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ColorControl::HueDirection value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableColorControlClusterHueDirectionAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPColorControlClusterHueMoveModeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ColorControl::HueMoveMode value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableColorControlClusterHueMoveModeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPColorControlClusterHueStepModeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ColorControl::HueStepMode value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableColorControlClusterHueStepModeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPColorControlClusterSaturationMoveModeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ColorControl::SaturationMoveMode value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableColorControlClusterSaturationMoveModeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPColorControlClusterSaturationStepModeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ColorControl::SaturationStepMode value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableColorControlClusterSaturationStepModeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPIlluminanceMeasurementClusterLightSensorTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::IlluminanceMeasurement::LightSensorType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableIlluminanceMeasurementClusterLightSensorTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPIasZoneClusterIasEnrollResponseCodeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::IasZone::IasEnrollResponseCode value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableIasZoneClusterIasEnrollResponseCodeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPIasZoneClusterIasZoneTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::IasZone::IasZoneType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedShort:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableIasZoneClusterIasZoneTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedShort:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPIasAceClusterIasAceAlarmStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::IasAce::IasAceAlarmStatus value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableIasAceClusterIasAceAlarmStatusAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPIasAceClusterIasAceArmModeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::IasAce::IasAceArmMode value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableIasAceClusterIasAceArmModeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPIasAceClusterIasAceArmNotificationAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::IasAce::IasAceArmNotification value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableIasAceClusterIasAceArmNotificationAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPIasAceClusterIasAceAudibleNotificationAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::IasAce::IasAceAudibleNotification value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableIasAceClusterIasAceAudibleNotificationAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPIasAceClusterIasAceBypassResultAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::IasAce::IasAceBypassResult value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableIasAceClusterIasAceBypassResultAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPIasAceClusterIasAcePanelStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::IasAce::IasAcePanelStatus value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableIasAceClusterIasAcePanelStatusAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPIasAceClusterIasZoneTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::IasAce::IasZoneType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedShort:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableIasAceClusterIasZoneTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedShort:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPTvChannelClusterTvChannelErrorTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::TvChannel::TvChannelErrorType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableTvChannelClusterTvChannelErrorTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPTvChannelClusterTvChannelLineupInfoTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::TvChannel::TvChannelLineupInfoType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableTvChannelClusterTvChannelLineupInfoTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPTargetNavigatorClusterNavigateTargetStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::TargetNavigator::NavigateTargetStatus value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableTargetNavigatorClusterNavigateTargetStatusAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPMediaPlaybackClusterMediaPlaybackStateAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::MediaPlayback::MediaPlaybackState value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableMediaPlaybackClusterMediaPlaybackStateAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPMediaPlaybackClusterMediaPlaybackStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::MediaPlayback::MediaPlaybackStatus value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableMediaPlaybackClusterMediaPlaybackStatusAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPMediaInputClusterMediaInputTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::MediaInput::MediaInputType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableMediaInputClusterMediaInputTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPKeypadInputClusterKeypadInputCecKeyCodeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::KeypadInput::KeypadInputCecKeyCode value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableKeypadInputClusterKeypadInputCecKeyCodeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPKeypadInputClusterKeypadInputStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::KeypadInput::KeypadInputStatus value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableKeypadInputClusterKeypadInputStatusAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPContentLauncherClusterContentLaunchMetricTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ContentLauncher::ContentLaunchMetricType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableContentLauncherClusterContentLaunchMetricTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPContentLauncherClusterContentLaunchParameterEnumAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ContentLauncher::ContentLaunchParameterEnum value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableContentLauncherClusterContentLaunchParameterEnumAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPContentLauncherClusterContentLaunchStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ContentLauncher::ContentLaunchStatus value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableContentLauncherClusterContentLaunchStatusAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPContentLauncherClusterContentLaunchStreamingTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ContentLauncher::ContentLaunchStreamingType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableContentLauncherClusterContentLaunchStreamingTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPAudioOutputClusterAudioOutputTypeAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::AudioOutput::AudioOutputType value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableAudioOutputClusterAudioOutputTypeAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPApplicationLauncherClusterApplicationLauncherStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ApplicationLauncher::ApplicationLauncherStatus value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableApplicationLauncherClusterApplicationLauncherStatusAttributeCallbackBridge::OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPApplicationBasicClusterApplicationBasicStatusAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ApplicationBasic::ApplicationBasicStatus value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableApplicationBasicClusterApplicationBasicStatusAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPTestClusterClusterSimpleEnumAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::TestCluster::SimpleEnum value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableTestClusterClusterSimpleEnumAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPMessagingClusterEventIdAttributeCallbackBridge::OnSuccessFn(void * context, chip::app::Clusters::Messaging::EventId value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableMessagingClusterEventIdAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPMessagingClusterMessagingControlConfirmationAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::Messaging::MessagingControlConfirmation value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableMessagingClusterMessagingControlConfirmationAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPMessagingClusterMessagingControlEnhancedConfirmationAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::Messaging::MessagingControlEnhancedConfirmation value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableMessagingClusterMessagingControlEnhancedConfirmationAttributeCallbackBridge::OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPMessagingClusterMessagingControlImportanceAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::Messaging::MessagingControlImportance value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableMessagingClusterMessagingControlImportanceAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPMessagingClusterMessagingControlTransmissionAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::Messaging::MessagingControlTransmission value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableMessagingClusterMessagingControlTransmissionAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPApplianceEventsAndAlertClusterEventIdentificationAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::ApplianceEventsAndAlert::EventIdentification value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableApplianceEventsAndAlertClusterEventIdentificationAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h index 222ac7295de380..48f408e1246a50 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h @@ -154,6 +154,396 @@ typedef void (*CHIPTestClusterClusterTestNullableOptionalResponseCallbackType)( typedef void (*CHIPTestClusterClusterTestSpecificResponseCallbackType)( void *, const chip::app::Clusters::TestCluster::Commands::TestSpecificResponse::DecodableType &); +typedef void (*IdentifyClusterIdentifyEffectIdentifierAttributeCallback)(void *, + chip::app::Clusters::Identify::IdentifyEffectIdentifier); +typedef void (*NullableIdentifyClusterIdentifyEffectIdentifierAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*IdentifyClusterIdentifyEffectVariantAttributeCallback)(void *, chip::app::Clusters::Identify::IdentifyEffectVariant); +typedef void (*NullableIdentifyClusterIdentifyEffectVariantAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*IdentifyClusterIdentifyIdentifyTypeAttributeCallback)(void *, chip::app::Clusters::Identify::IdentifyIdentifyType); +typedef void (*NullableIdentifyClusterIdentifyIdentifyTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*OnOffClusterOnOffDelayedAllOffEffectVariantAttributeCallback)( + void *, chip::app::Clusters::OnOff::OnOffDelayedAllOffEffectVariant); +typedef void (*NullableOnOffClusterOnOffDelayedAllOffEffectVariantAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*OnOffClusterOnOffDyingLightEffectVariantAttributeCallback)(void *, + chip::app::Clusters::OnOff::OnOffDyingLightEffectVariant); +typedef void (*NullableOnOffClusterOnOffDyingLightEffectVariantAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*OnOffClusterOnOffEffectIdentifierAttributeCallback)(void *, chip::app::Clusters::OnOff::OnOffEffectIdentifier); +typedef void (*NullableOnOffClusterOnOffEffectIdentifierAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*LevelControlClusterMoveModeAttributeCallback)(void *, chip::app::Clusters::LevelControl::MoveMode); +typedef void (*NullableLevelControlClusterMoveModeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*LevelControlClusterStepModeAttributeCallback)(void *, chip::app::Clusters::LevelControl::StepMode); +typedef void (*NullableLevelControlClusterStepModeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ApplianceControlClusterApplianceStatusAttributeCallback)(void *, + chip::app::Clusters::ApplianceControl::ApplianceStatus); +typedef void (*NullableApplianceControlClusterApplianceStatusAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ApplianceControlClusterCommandIdentificationAttributeCallback)( + void *, chip::app::Clusters::ApplianceControl::CommandIdentification); +typedef void (*NullableApplianceControlClusterCommandIdentificationAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ApplianceControlClusterWarningEventAttributeCallback)(void *, chip::app::Clusters::ApplianceControl::WarningEvent); +typedef void (*NullableApplianceControlClusterWarningEventAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*AccessControlClusterAuthModeAttributeCallback)(void *, chip::app::Clusters::AccessControl::AuthMode); +typedef void (*NullableAccessControlClusterAuthModeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*AccessControlClusterPrivilegeAttributeCallback)(void *, chip::app::Clusters::AccessControl::Privilege); +typedef void (*NullableAccessControlClusterPrivilegeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*BridgedActionsClusterActionErrorEnumAttributeCallback)(void *, chip::app::Clusters::BridgedActions::ActionErrorEnum); +typedef void (*NullableBridgedActionsClusterActionErrorEnumAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*BridgedActionsClusterActionStateEnumAttributeCallback)(void *, chip::app::Clusters::BridgedActions::ActionStateEnum); +typedef void (*NullableBridgedActionsClusterActionStateEnumAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*BridgedActionsClusterActionTypeEnumAttributeCallback)(void *, chip::app::Clusters::BridgedActions::ActionTypeEnum); +typedef void (*NullableBridgedActionsClusterActionTypeEnumAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*BridgedActionsClusterEndpointListTypeEnumAttributeCallback)( + void *, chip::app::Clusters::BridgedActions::EndpointListTypeEnum); +typedef void (*NullableBridgedActionsClusterEndpointListTypeEnumAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*OtaSoftwareUpdateProviderClusterOTAApplyUpdateActionAttributeCallback)( + void *, chip::app::Clusters::OtaSoftwareUpdateProvider::OTAApplyUpdateAction); +typedef void (*NullableOtaSoftwareUpdateProviderClusterOTAApplyUpdateActionAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*OtaSoftwareUpdateProviderClusterOTADownloadProtocolAttributeCallback)( + void *, chip::app::Clusters::OtaSoftwareUpdateProvider::OTADownloadProtocol); +typedef void (*NullableOtaSoftwareUpdateProviderClusterOTADownloadProtocolAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*OtaSoftwareUpdateProviderClusterOTAQueryStatusAttributeCallback)( + void *, chip::app::Clusters::OtaSoftwareUpdateProvider::OTAQueryStatus); +typedef void (*NullableOtaSoftwareUpdateProviderClusterOTAQueryStatusAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*OtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallback)( + void *, chip::app::Clusters::OtaSoftwareUpdateRequestor::ChangeReasonEnum); +typedef void (*NullableOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*OtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallback)( + void *, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAAnnouncementReason); +typedef void (*NullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*OtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallback)( + void *, chip::app::Clusters::OtaSoftwareUpdateRequestor::UpdateStateEnum); +typedef void (*NullableOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*GeneralCommissioningClusterGeneralCommissioningErrorAttributeCallback)( + void *, chip::app::Clusters::GeneralCommissioning::GeneralCommissioningError); +typedef void (*NullableGeneralCommissioningClusterGeneralCommissioningErrorAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*GeneralCommissioningClusterRegulatoryLocationTypeAttributeCallback)( + void *, chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType); +typedef void (*NullableGeneralCommissioningClusterRegulatoryLocationTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*NetworkCommissioningClusterNetworkCommissioningErrorAttributeCallback)( + void *, chip::app::Clusters::NetworkCommissioning::NetworkCommissioningError); +typedef void (*NullableNetworkCommissioningClusterNetworkCommissioningErrorAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DiagnosticLogsClusterLogsIntentAttributeCallback)(void *, chip::app::Clusters::DiagnosticLogs::LogsIntent); +typedef void (*NullableDiagnosticLogsClusterLogsIntentAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DiagnosticLogsClusterLogsStatusAttributeCallback)(void *, chip::app::Clusters::DiagnosticLogs::LogsStatus); +typedef void (*NullableDiagnosticLogsClusterLogsStatusAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DiagnosticLogsClusterLogsTransferProtocolAttributeCallback)( + void *, chip::app::Clusters::DiagnosticLogs::LogsTransferProtocol); +typedef void (*NullableDiagnosticLogsClusterLogsTransferProtocolAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*GeneralDiagnosticsClusterBootReasonTypeAttributeCallback)(void *, + chip::app::Clusters::GeneralDiagnostics::BootReasonType); +typedef void (*NullableGeneralDiagnosticsClusterBootReasonTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*GeneralDiagnosticsClusterHardwareFaultTypeAttributeCallback)( + void *, chip::app::Clusters::GeneralDiagnostics::HardwareFaultType); +typedef void (*NullableGeneralDiagnosticsClusterHardwareFaultTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*GeneralDiagnosticsClusterInterfaceTypeAttributeCallback)(void *, + chip::app::Clusters::GeneralDiagnostics::InterfaceType); +typedef void (*NullableGeneralDiagnosticsClusterInterfaceTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*GeneralDiagnosticsClusterNetworkFaultTypeAttributeCallback)( + void *, chip::app::Clusters::GeneralDiagnostics::NetworkFaultType); +typedef void (*NullableGeneralDiagnosticsClusterNetworkFaultTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*GeneralDiagnosticsClusterRadioFaultTypeAttributeCallback)(void *, + chip::app::Clusters::GeneralDiagnostics::RadioFaultType); +typedef void (*NullableGeneralDiagnosticsClusterRadioFaultTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ThreadNetworkDiagnosticsClusterNetworkFaultAttributeCallback)( + void *, chip::app::Clusters::ThreadNetworkDiagnostics::NetworkFault); +typedef void (*NullableThreadNetworkDiagnosticsClusterNetworkFaultAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ThreadNetworkDiagnosticsClusterRoutingRoleAttributeCallback)( + void *, chip::app::Clusters::ThreadNetworkDiagnostics::RoutingRole); +typedef void (*NullableThreadNetworkDiagnosticsClusterRoutingRoleAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ThreadNetworkDiagnosticsClusterThreadConnectionStatusAttributeCallback)( + void *, chip::app::Clusters::ThreadNetworkDiagnostics::ThreadConnectionStatus); +typedef void (*NullableThreadNetworkDiagnosticsClusterThreadConnectionStatusAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*WiFiNetworkDiagnosticsClusterAssociationFailureCauseAttributeCallback)( + void *, chip::app::Clusters::WiFiNetworkDiagnostics::AssociationFailureCause); +typedef void (*NullableWiFiNetworkDiagnosticsClusterAssociationFailureCauseAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*WiFiNetworkDiagnosticsClusterSecurityTypeAttributeCallback)( + void *, chip::app::Clusters::WiFiNetworkDiagnostics::SecurityType); +typedef void (*NullableWiFiNetworkDiagnosticsClusterSecurityTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*WiFiNetworkDiagnosticsClusterWiFiConnectionStatusAttributeCallback)( + void *, chip::app::Clusters::WiFiNetworkDiagnostics::WiFiConnectionStatus); +typedef void (*NullableWiFiNetworkDiagnosticsClusterWiFiConnectionStatusAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*WiFiNetworkDiagnosticsClusterWiFiVersionTypeAttributeCallback)( + void *, chip::app::Clusters::WiFiNetworkDiagnostics::WiFiVersionType); +typedef void (*NullableWiFiNetworkDiagnosticsClusterWiFiVersionTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*EthernetNetworkDiagnosticsClusterPHYRateTypeAttributeCallback)( + void *, chip::app::Clusters::EthernetNetworkDiagnostics::PHYRateType); +typedef void (*NullableEthernetNetworkDiagnosticsClusterPHYRateTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*AdministratorCommissioningClusterCommissioningWindowStatusAttributeCallback)( + void *, chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatus); +typedef void (*NullableAdministratorCommissioningClusterCommissioningWindowStatusAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*AdministratorCommissioningClusterStatusCodeAttributeCallback)( + void *, chip::app::Clusters::AdministratorCommissioning::StatusCode); +typedef void (*NullableAdministratorCommissioningClusterStatusCodeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*OperationalCredentialsClusterNodeOperationalCertStatusAttributeCallback)( + void *, chip::app::Clusters::OperationalCredentials::NodeOperationalCertStatus); +typedef void (*NullableOperationalCredentialsClusterNodeOperationalCertStatusAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*GroupKeyManagementClusterGroupKeySecurityPolicyAttributeCallback)( + void *, chip::app::Clusters::GroupKeyManagement::GroupKeySecurityPolicy); +typedef void (*NullableGroupKeyManagementClusterGroupKeySecurityPolicyAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDlAlarmCodeAttributeCallback)(void *, chip::app::Clusters::DoorLock::DlAlarmCode); +typedef void (*NullableDoorLockClusterDlAlarmCodeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDlCredentialRuleAttributeCallback)(void *, chip::app::Clusters::DoorLock::DlCredentialRule); +typedef void (*NullableDoorLockClusterDlCredentialRuleAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDlCredentialTypeAttributeCallback)(void *, chip::app::Clusters::DoorLock::DlCredentialType); +typedef void (*NullableDoorLockClusterDlCredentialTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDlDataOperationTypeAttributeCallback)(void *, chip::app::Clusters::DoorLock::DlDataOperationType); +typedef void (*NullableDoorLockClusterDlDataOperationTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDlDoorLockStatusAttributeCallback)(void *, chip::app::Clusters::DoorLock::DlDoorLockStatus); +typedef void (*NullableDoorLockClusterDlDoorLockStatusAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDlDoorStateAttributeCallback)(void *, chip::app::Clusters::DoorLock::DlDoorState); +typedef void (*NullableDoorLockClusterDlDoorStateAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDlLockDataTypeAttributeCallback)(void *, chip::app::Clusters::DoorLock::DlLockDataType); +typedef void (*NullableDoorLockClusterDlLockDataTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDlLockOperationTypeAttributeCallback)(void *, chip::app::Clusters::DoorLock::DlLockOperationType); +typedef void (*NullableDoorLockClusterDlLockOperationTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDlLockStateAttributeCallback)(void *, chip::app::Clusters::DoorLock::DlLockState); +typedef void (*NullableDoorLockClusterDlLockStateAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDlLockTypeAttributeCallback)(void *, chip::app::Clusters::DoorLock::DlLockType); +typedef void (*NullableDoorLockClusterDlLockTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDlOperatingModeAttributeCallback)(void *, chip::app::Clusters::DoorLock::DlOperatingMode); +typedef void (*NullableDoorLockClusterDlOperatingModeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDlOperationErrorAttributeCallback)(void *, chip::app::Clusters::DoorLock::DlOperationError); +typedef void (*NullableDoorLockClusterDlOperationErrorAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDlOperationSourceAttributeCallback)(void *, chip::app::Clusters::DoorLock::DlOperationSource); +typedef void (*NullableDoorLockClusterDlOperationSourceAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDlStatusAttributeCallback)(void *, chip::app::Clusters::DoorLock::DlStatus); +typedef void (*NullableDoorLockClusterDlStatusAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDlUserStatusAttributeCallback)(void *, chip::app::Clusters::DoorLock::DlUserStatus); +typedef void (*NullableDoorLockClusterDlUserStatusAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDlUserTypeAttributeCallback)(void *, chip::app::Clusters::DoorLock::DlUserType); +typedef void (*NullableDoorLockClusterDlUserTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDoorLockOperationEventCodeAttributeCallback)( + void *, chip::app::Clusters::DoorLock::DoorLockOperationEventCode); +typedef void (*NullableDoorLockClusterDoorLockOperationEventCodeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDoorLockProgrammingEventCodeAttributeCallback)( + void *, chip::app::Clusters::DoorLock::DoorLockProgrammingEventCode); +typedef void (*NullableDoorLockClusterDoorLockProgrammingEventCodeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDoorLockSetPinOrIdStatusAttributeCallback)(void *, + chip::app::Clusters::DoorLock::DoorLockSetPinOrIdStatus); +typedef void (*NullableDoorLockClusterDoorLockSetPinOrIdStatusAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDoorLockUserStatusAttributeCallback)(void *, chip::app::Clusters::DoorLock::DoorLockUserStatus); +typedef void (*NullableDoorLockClusterDoorLockUserStatusAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*DoorLockClusterDoorLockUserTypeAttributeCallback)(void *, chip::app::Clusters::DoorLock::DoorLockUserType); +typedef void (*NullableDoorLockClusterDoorLockUserTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*PumpConfigurationAndControlClusterPumpControlModeAttributeCallback)( + void *, chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode); +typedef void (*NullablePumpConfigurationAndControlClusterPumpControlModeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*PumpConfigurationAndControlClusterPumpOperationModeAttributeCallback)( + void *, chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode); +typedef void (*NullablePumpConfigurationAndControlClusterPumpOperationModeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ThermostatClusterSetpointAdjustModeAttributeCallback)(void *, chip::app::Clusters::Thermostat::SetpointAdjustMode); +typedef void (*NullableThermostatClusterSetpointAdjustModeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ColorControlClusterColorLoopActionAttributeCallback)(void *, chip::app::Clusters::ColorControl::ColorLoopAction); +typedef void (*NullableColorControlClusterColorLoopActionAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ColorControlClusterColorLoopDirectionAttributeCallback)(void *, + chip::app::Clusters::ColorControl::ColorLoopDirection); +typedef void (*NullableColorControlClusterColorLoopDirectionAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ColorControlClusterColorModeAttributeCallback)(void *, chip::app::Clusters::ColorControl::ColorMode); +typedef void (*NullableColorControlClusterColorModeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ColorControlClusterHueDirectionAttributeCallback)(void *, chip::app::Clusters::ColorControl::HueDirection); +typedef void (*NullableColorControlClusterHueDirectionAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ColorControlClusterHueMoveModeAttributeCallback)(void *, chip::app::Clusters::ColorControl::HueMoveMode); +typedef void (*NullableColorControlClusterHueMoveModeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ColorControlClusterHueStepModeAttributeCallback)(void *, chip::app::Clusters::ColorControl::HueStepMode); +typedef void (*NullableColorControlClusterHueStepModeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ColorControlClusterSaturationMoveModeAttributeCallback)(void *, + chip::app::Clusters::ColorControl::SaturationMoveMode); +typedef void (*NullableColorControlClusterSaturationMoveModeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ColorControlClusterSaturationStepModeAttributeCallback)(void *, + chip::app::Clusters::ColorControl::SaturationStepMode); +typedef void (*NullableColorControlClusterSaturationStepModeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*IlluminanceMeasurementClusterLightSensorTypeAttributeCallback)( + void *, chip::app::Clusters::IlluminanceMeasurement::LightSensorType); +typedef void (*NullableIlluminanceMeasurementClusterLightSensorTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*IasZoneClusterIasEnrollResponseCodeAttributeCallback)(void *, chip::app::Clusters::IasZone::IasEnrollResponseCode); +typedef void (*NullableIasZoneClusterIasEnrollResponseCodeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*IasZoneClusterIasZoneTypeAttributeCallback)(void *, chip::app::Clusters::IasZone::IasZoneType); +typedef void (*NullableIasZoneClusterIasZoneTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*IasAceClusterIasAceAlarmStatusAttributeCallback)(void *, chip::app::Clusters::IasAce::IasAceAlarmStatus); +typedef void (*NullableIasAceClusterIasAceAlarmStatusAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*IasAceClusterIasAceArmModeAttributeCallback)(void *, chip::app::Clusters::IasAce::IasAceArmMode); +typedef void (*NullableIasAceClusterIasAceArmModeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*IasAceClusterIasAceArmNotificationAttributeCallback)(void *, chip::app::Clusters::IasAce::IasAceArmNotification); +typedef void (*NullableIasAceClusterIasAceArmNotificationAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*IasAceClusterIasAceAudibleNotificationAttributeCallback)(void *, + chip::app::Clusters::IasAce::IasAceAudibleNotification); +typedef void (*NullableIasAceClusterIasAceAudibleNotificationAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*IasAceClusterIasAceBypassResultAttributeCallback)(void *, chip::app::Clusters::IasAce::IasAceBypassResult); +typedef void (*NullableIasAceClusterIasAceBypassResultAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*IasAceClusterIasAcePanelStatusAttributeCallback)(void *, chip::app::Clusters::IasAce::IasAcePanelStatus); +typedef void (*NullableIasAceClusterIasAcePanelStatusAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*IasAceClusterIasZoneTypeAttributeCallback)(void *, chip::app::Clusters::IasAce::IasZoneType); +typedef void (*NullableIasAceClusterIasZoneTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*TvChannelClusterTvChannelErrorTypeAttributeCallback)(void *, chip::app::Clusters::TvChannel::TvChannelErrorType); +typedef void (*NullableTvChannelClusterTvChannelErrorTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*TvChannelClusterTvChannelLineupInfoTypeAttributeCallback)(void *, + chip::app::Clusters::TvChannel::TvChannelLineupInfoType); +typedef void (*NullableTvChannelClusterTvChannelLineupInfoTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*TargetNavigatorClusterNavigateTargetStatusAttributeCallback)( + void *, chip::app::Clusters::TargetNavigator::NavigateTargetStatus); +typedef void (*NullableTargetNavigatorClusterNavigateTargetStatusAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*MediaPlaybackClusterMediaPlaybackStateAttributeCallback)(void *, + chip::app::Clusters::MediaPlayback::MediaPlaybackState); +typedef void (*NullableMediaPlaybackClusterMediaPlaybackStateAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*MediaPlaybackClusterMediaPlaybackStatusAttributeCallback)(void *, + chip::app::Clusters::MediaPlayback::MediaPlaybackStatus); +typedef void (*NullableMediaPlaybackClusterMediaPlaybackStatusAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*MediaInputClusterMediaInputTypeAttributeCallback)(void *, chip::app::Clusters::MediaInput::MediaInputType); +typedef void (*NullableMediaInputClusterMediaInputTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*KeypadInputClusterKeypadInputCecKeyCodeAttributeCallback)(void *, + chip::app::Clusters::KeypadInput::KeypadInputCecKeyCode); +typedef void (*NullableKeypadInputClusterKeypadInputCecKeyCodeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*KeypadInputClusterKeypadInputStatusAttributeCallback)(void *, chip::app::Clusters::KeypadInput::KeypadInputStatus); +typedef void (*NullableKeypadInputClusterKeypadInputStatusAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ContentLauncherClusterContentLaunchMetricTypeAttributeCallback)( + void *, chip::app::Clusters::ContentLauncher::ContentLaunchMetricType); +typedef void (*NullableContentLauncherClusterContentLaunchMetricTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ContentLauncherClusterContentLaunchParameterEnumAttributeCallback)( + void *, chip::app::Clusters::ContentLauncher::ContentLaunchParameterEnum); +typedef void (*NullableContentLauncherClusterContentLaunchParameterEnumAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ContentLauncherClusterContentLaunchStatusAttributeCallback)( + void *, chip::app::Clusters::ContentLauncher::ContentLaunchStatus); +typedef void (*NullableContentLauncherClusterContentLaunchStatusAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ContentLauncherClusterContentLaunchStreamingTypeAttributeCallback)( + void *, chip::app::Clusters::ContentLauncher::ContentLaunchStreamingType); +typedef void (*NullableContentLauncherClusterContentLaunchStreamingTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*AudioOutputClusterAudioOutputTypeAttributeCallback)(void *, chip::app::Clusters::AudioOutput::AudioOutputType); +typedef void (*NullableAudioOutputClusterAudioOutputTypeAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ApplicationLauncherClusterApplicationLauncherStatusAttributeCallback)( + void *, chip::app::Clusters::ApplicationLauncher::ApplicationLauncherStatus); +typedef void (*NullableApplicationLauncherClusterApplicationLauncherStatusAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ApplicationBasicClusterApplicationBasicStatusAttributeCallback)( + void *, chip::app::Clusters::ApplicationBasic::ApplicationBasicStatus); +typedef void (*NullableApplicationBasicClusterApplicationBasicStatusAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*TestClusterClusterSimpleEnumAttributeCallback)(void *, chip::app::Clusters::TestCluster::SimpleEnum); +typedef void (*NullableTestClusterClusterSimpleEnumAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*MessagingClusterEventIdAttributeCallback)(void *, chip::app::Clusters::Messaging::EventId); +typedef void (*NullableMessagingClusterEventIdAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*MessagingClusterMessagingControlConfirmationAttributeCallback)( + void *, chip::app::Clusters::Messaging::MessagingControlConfirmation); +typedef void (*NullableMessagingClusterMessagingControlConfirmationAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*MessagingClusterMessagingControlEnhancedConfirmationAttributeCallback)( + void *, chip::app::Clusters::Messaging::MessagingControlEnhancedConfirmation); +typedef void (*NullableMessagingClusterMessagingControlEnhancedConfirmationAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*MessagingClusterMessagingControlImportanceAttributeCallback)( + void *, chip::app::Clusters::Messaging::MessagingControlImportance); +typedef void (*NullableMessagingClusterMessagingControlImportanceAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*MessagingClusterMessagingControlTransmissionAttributeCallback)( + void *, chip::app::Clusters::Messaging::MessagingControlTransmission); +typedef void (*NullableMessagingClusterMessagingControlTransmissionAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); +typedef void (*ApplianceEventsAndAlertClusterEventIdentificationAttributeCallback)( + void *, chip::app::Clusters::ApplianceEventsAndAlert::EventIdentification); +typedef void (*NullableApplianceEventsAndAlertClusterEventIdentificationAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); + class CHIPDefaultSuccessCallbackBridge : public CHIPCallbackBridge { public: @@ -2380,3 +2770,2784 @@ class CHIPTestClusterClusterTestSpecificResponseCallbackBridge static void OnSuccessFn(void * context, const chip::app::Clusters::TestCluster::Commands::TestSpecificResponse::DecodableType & data); }; + +class CHIPIdentifyClusterIdentifyEffectIdentifierAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPIdentifyClusterIdentifyEffectIdentifierAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::Identify::IdentifyEffectIdentifier value); +}; + +class CHIPNullableIdentifyClusterIdentifyEffectIdentifierAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableIdentifyClusterIdentifyEffectIdentifierAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPIdentifyClusterIdentifyEffectVariantAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPIdentifyClusterIdentifyEffectVariantAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::Identify::IdentifyEffectVariant value); +}; + +class CHIPNullableIdentifyClusterIdentifyEffectVariantAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableIdentifyClusterIdentifyEffectVariantAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPIdentifyClusterIdentifyIdentifyTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPIdentifyClusterIdentifyIdentifyTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::Identify::IdentifyIdentifyType value); +}; + +class CHIPNullableIdentifyClusterIdentifyIdentifyTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableIdentifyClusterIdentifyIdentifyTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPOnOffClusterOnOffDelayedAllOffEffectVariantAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPOnOffClusterOnOffDelayedAllOffEffectVariantAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::OnOff::OnOffDelayedAllOffEffectVariant value); +}; + +class CHIPNullableOnOffClusterOnOffDelayedAllOffEffectVariantAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableOnOffClusterOnOffDelayedAllOffEffectVariantAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPOnOffClusterOnOffDyingLightEffectVariantAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPOnOffClusterOnOffDyingLightEffectVariantAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::OnOff::OnOffDyingLightEffectVariant value); +}; + +class CHIPNullableOnOffClusterOnOffDyingLightEffectVariantAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableOnOffClusterOnOffDyingLightEffectVariantAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPOnOffClusterOnOffEffectIdentifierAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPOnOffClusterOnOffEffectIdentifierAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::OnOff::OnOffEffectIdentifier value); +}; + +class CHIPNullableOnOffClusterOnOffEffectIdentifierAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableOnOffClusterOnOffEffectIdentifierAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPLevelControlClusterMoveModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPLevelControlClusterMoveModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::LevelControl::MoveMode value); +}; + +class CHIPNullableLevelControlClusterMoveModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableLevelControlClusterMoveModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPLevelControlClusterStepModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPLevelControlClusterStepModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::LevelControl::StepMode value); +}; + +class CHIPNullableLevelControlClusterStepModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableLevelControlClusterStepModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPApplianceControlClusterApplianceStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPApplianceControlClusterApplianceStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ApplianceControl::ApplianceStatus value); +}; + +class CHIPNullableApplianceControlClusterApplianceStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableApplianceControlClusterApplianceStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPApplianceControlClusterCommandIdentificationAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPApplianceControlClusterCommandIdentificationAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ApplianceControl::CommandIdentification value); +}; + +class CHIPNullableApplianceControlClusterCommandIdentificationAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableApplianceControlClusterCommandIdentificationAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPApplianceControlClusterWarningEventAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPApplianceControlClusterWarningEventAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ApplianceControl::WarningEvent value); +}; + +class CHIPNullableApplianceControlClusterWarningEventAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableApplianceControlClusterWarningEventAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPAccessControlClusterAuthModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPAccessControlClusterAuthModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::AccessControl::AuthMode value); +}; + +class CHIPNullableAccessControlClusterAuthModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableAccessControlClusterAuthModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPAccessControlClusterPrivilegeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPAccessControlClusterPrivilegeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::AccessControl::Privilege value); +}; + +class CHIPNullableAccessControlClusterPrivilegeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableAccessControlClusterPrivilegeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPBridgedActionsClusterActionErrorEnumAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPBridgedActionsClusterActionErrorEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::BridgedActions::ActionErrorEnum value); +}; + +class CHIPNullableBridgedActionsClusterActionErrorEnumAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableBridgedActionsClusterActionErrorEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPBridgedActionsClusterActionStateEnumAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPBridgedActionsClusterActionStateEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::BridgedActions::ActionStateEnum value); +}; + +class CHIPNullableBridgedActionsClusterActionStateEnumAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableBridgedActionsClusterActionStateEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPBridgedActionsClusterActionTypeEnumAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPBridgedActionsClusterActionTypeEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::BridgedActions::ActionTypeEnum value); +}; + +class CHIPNullableBridgedActionsClusterActionTypeEnumAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableBridgedActionsClusterActionTypeEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPBridgedActionsClusterEndpointListTypeEnumAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPBridgedActionsClusterEndpointListTypeEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::BridgedActions::EndpointListTypeEnum value); +}; + +class CHIPNullableBridgedActionsClusterEndpointListTypeEnumAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableBridgedActionsClusterEndpointListTypeEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPOtaSoftwareUpdateProviderClusterOTAApplyUpdateActionAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPOtaSoftwareUpdateProviderClusterOTAApplyUpdateActionAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::OtaSoftwareUpdateProvider::OTAApplyUpdateAction value); +}; + +class CHIPNullableOtaSoftwareUpdateProviderClusterOTAApplyUpdateActionAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableOtaSoftwareUpdateProviderClusterOTAApplyUpdateActionAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPOtaSoftwareUpdateProviderClusterOTADownloadProtocolAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPOtaSoftwareUpdateProviderClusterOTADownloadProtocolAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::OtaSoftwareUpdateProvider::OTADownloadProtocol value); +}; + +class CHIPNullableOtaSoftwareUpdateProviderClusterOTADownloadProtocolAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableOtaSoftwareUpdateProviderClusterOTADownloadProtocolAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPOtaSoftwareUpdateProviderClusterOTAQueryStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPOtaSoftwareUpdateProviderClusterOTAQueryStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::OtaSoftwareUpdateProvider::OTAQueryStatus value); +}; + +class CHIPNullableOtaSoftwareUpdateProviderClusterOTAQueryStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableOtaSoftwareUpdateProviderClusterOTAQueryStatusAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::ChangeReasonEnum value); +}; + +class CHIPNullableOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableOtaSoftwareUpdateRequestorClusterChangeReasonEnumAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::OTAAnnouncementReason value); +}; + +class CHIPNullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableOtaSoftwareUpdateRequestorClusterOTAAnnouncementReasonAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge( + queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn( + void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::OtaSoftwareUpdateRequestor::UpdateStateEnum value); +}; + +class CHIPNullableOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableOtaSoftwareUpdateRequestorClusterUpdateStateEnumAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPGeneralCommissioningClusterGeneralCommissioningErrorAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPGeneralCommissioningClusterGeneralCommissioningErrorAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::GeneralCommissioning::GeneralCommissioningError value); +}; + +class CHIPNullableGeneralCommissioningClusterGeneralCommissioningErrorAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableGeneralCommissioningClusterGeneralCommissioningErrorAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPGeneralCommissioningClusterRegulatoryLocationTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPGeneralCommissioningClusterRegulatoryLocationTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::GeneralCommissioning::RegulatoryLocationType value); +}; + +class CHIPNullableGeneralCommissioningClusterRegulatoryLocationTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableGeneralCommissioningClusterRegulatoryLocationTypeAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPNetworkCommissioningClusterNetworkCommissioningErrorAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNetworkCommissioningClusterNetworkCommissioningErrorAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::NetworkCommissioning::NetworkCommissioningError value); +}; + +class CHIPNullableNetworkCommissioningClusterNetworkCommissioningErrorAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableNetworkCommissioningClusterNetworkCommissioningErrorAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDiagnosticLogsClusterLogsIntentAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDiagnosticLogsClusterLogsIntentAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DiagnosticLogs::LogsIntent value); +}; + +class CHIPNullableDiagnosticLogsClusterLogsIntentAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDiagnosticLogsClusterLogsIntentAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDiagnosticLogsClusterLogsStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDiagnosticLogsClusterLogsStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DiagnosticLogs::LogsStatus value); +}; + +class CHIPNullableDiagnosticLogsClusterLogsStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDiagnosticLogsClusterLogsStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDiagnosticLogsClusterLogsTransferProtocolAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDiagnosticLogsClusterLogsTransferProtocolAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DiagnosticLogs::LogsTransferProtocol value); +}; + +class CHIPNullableDiagnosticLogsClusterLogsTransferProtocolAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDiagnosticLogsClusterLogsTransferProtocolAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPGeneralDiagnosticsClusterBootReasonTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPGeneralDiagnosticsClusterBootReasonTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::GeneralDiagnostics::BootReasonType value); +}; + +class CHIPNullableGeneralDiagnosticsClusterBootReasonTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableGeneralDiagnosticsClusterBootReasonTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPGeneralDiagnosticsClusterHardwareFaultTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPGeneralDiagnosticsClusterHardwareFaultTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::GeneralDiagnostics::HardwareFaultType value); +}; + +class CHIPNullableGeneralDiagnosticsClusterHardwareFaultTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableGeneralDiagnosticsClusterHardwareFaultTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPGeneralDiagnosticsClusterInterfaceTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPGeneralDiagnosticsClusterInterfaceTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::GeneralDiagnostics::InterfaceType value); +}; + +class CHIPNullableGeneralDiagnosticsClusterInterfaceTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableGeneralDiagnosticsClusterInterfaceTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPGeneralDiagnosticsClusterNetworkFaultTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPGeneralDiagnosticsClusterNetworkFaultTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::GeneralDiagnostics::NetworkFaultType value); +}; + +class CHIPNullableGeneralDiagnosticsClusterNetworkFaultTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableGeneralDiagnosticsClusterNetworkFaultTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPGeneralDiagnosticsClusterRadioFaultTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPGeneralDiagnosticsClusterRadioFaultTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::GeneralDiagnostics::RadioFaultType value); +}; + +class CHIPNullableGeneralDiagnosticsClusterRadioFaultTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableGeneralDiagnosticsClusterRadioFaultTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPThreadNetworkDiagnosticsClusterNetworkFaultAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPThreadNetworkDiagnosticsClusterNetworkFaultAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ThreadNetworkDiagnostics::NetworkFault value); +}; + +class CHIPNullableThreadNetworkDiagnosticsClusterNetworkFaultAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableThreadNetworkDiagnosticsClusterNetworkFaultAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPThreadNetworkDiagnosticsClusterRoutingRoleAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPThreadNetworkDiagnosticsClusterRoutingRoleAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ThreadNetworkDiagnostics::RoutingRole value); +}; + +class CHIPNullableThreadNetworkDiagnosticsClusterRoutingRoleAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableThreadNetworkDiagnosticsClusterRoutingRoleAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPThreadNetworkDiagnosticsClusterThreadConnectionStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPThreadNetworkDiagnosticsClusterThreadConnectionStatusAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ThreadNetworkDiagnostics::ThreadConnectionStatus value); +}; + +class CHIPNullableThreadNetworkDiagnosticsClusterThreadConnectionStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableThreadNetworkDiagnosticsClusterThreadConnectionStatusAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge( + queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn( + void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPWiFiNetworkDiagnosticsClusterAssociationFailureCauseAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPWiFiNetworkDiagnosticsClusterAssociationFailureCauseAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::WiFiNetworkDiagnostics::AssociationFailureCause value); +}; + +class CHIPNullableWiFiNetworkDiagnosticsClusterAssociationFailureCauseAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableWiFiNetworkDiagnosticsClusterAssociationFailureCauseAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPWiFiNetworkDiagnosticsClusterSecurityTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPWiFiNetworkDiagnosticsClusterSecurityTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::WiFiNetworkDiagnostics::SecurityType value); +}; + +class CHIPNullableWiFiNetworkDiagnosticsClusterSecurityTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableWiFiNetworkDiagnosticsClusterSecurityTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPWiFiNetworkDiagnosticsClusterWiFiConnectionStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPWiFiNetworkDiagnosticsClusterWiFiConnectionStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::WiFiNetworkDiagnostics::WiFiConnectionStatus value); +}; + +class CHIPNullableWiFiNetworkDiagnosticsClusterWiFiConnectionStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableWiFiNetworkDiagnosticsClusterWiFiConnectionStatusAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPWiFiNetworkDiagnosticsClusterWiFiVersionTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPWiFiNetworkDiagnosticsClusterWiFiVersionTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::WiFiNetworkDiagnostics::WiFiVersionType value); +}; + +class CHIPNullableWiFiNetworkDiagnosticsClusterWiFiVersionTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableWiFiNetworkDiagnosticsClusterWiFiVersionTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPEthernetNetworkDiagnosticsClusterPHYRateTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPEthernetNetworkDiagnosticsClusterPHYRateTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::EthernetNetworkDiagnostics::PHYRateType value); +}; + +class CHIPNullableEthernetNetworkDiagnosticsClusterPHYRateTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableEthernetNetworkDiagnosticsClusterPHYRateTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPAdministratorCommissioningClusterCommissioningWindowStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPAdministratorCommissioningClusterCommissioningWindowStatusAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::AdministratorCommissioning::CommissioningWindowStatus value); +}; + +class CHIPNullableAdministratorCommissioningClusterCommissioningWindowStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableAdministratorCommissioningClusterCommissioningWindowStatusAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge( + queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn( + void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPAdministratorCommissioningClusterStatusCodeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPAdministratorCommissioningClusterStatusCodeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::AdministratorCommissioning::StatusCode value); +}; + +class CHIPNullableAdministratorCommissioningClusterStatusCodeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableAdministratorCommissioningClusterStatusCodeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPOperationalCredentialsClusterNodeOperationalCertStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPOperationalCredentialsClusterNodeOperationalCertStatusAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::OperationalCredentials::NodeOperationalCertStatus value); +}; + +class CHIPNullableOperationalCredentialsClusterNodeOperationalCertStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableOperationalCredentialsClusterNodeOperationalCertStatusAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge( + queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn( + void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPGroupKeyManagementClusterGroupKeySecurityPolicyAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPGroupKeyManagementClusterGroupKeySecurityPolicyAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::GroupKeyManagement::GroupKeySecurityPolicy value); +}; + +class CHIPNullableGroupKeyManagementClusterGroupKeySecurityPolicyAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableGroupKeyManagementClusterGroupKeySecurityPolicyAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDlAlarmCodeAttributeCallbackBridge : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDlAlarmCodeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DlAlarmCode value); +}; + +class CHIPNullableDoorLockClusterDlAlarmCodeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDlAlarmCodeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDlCredentialRuleAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDlCredentialRuleAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DlCredentialRule value); +}; + +class CHIPNullableDoorLockClusterDlCredentialRuleAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDlCredentialRuleAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDlCredentialTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDlCredentialTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DlCredentialType value); +}; + +class CHIPNullableDoorLockClusterDlCredentialTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDlCredentialTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDlDataOperationTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDlDataOperationTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DlDataOperationType value); +}; + +class CHIPNullableDoorLockClusterDlDataOperationTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDlDataOperationTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDlDoorLockStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDlDoorLockStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DlDoorLockStatus value); +}; + +class CHIPNullableDoorLockClusterDlDoorLockStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDlDoorLockStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDlDoorStateAttributeCallbackBridge : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDlDoorStateAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DlDoorState value); +}; + +class CHIPNullableDoorLockClusterDlDoorStateAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDlDoorStateAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDlLockDataTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDlLockDataTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DlLockDataType value); +}; + +class CHIPNullableDoorLockClusterDlLockDataTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDlLockDataTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDlLockOperationTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDlLockOperationTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DlLockOperationType value); +}; + +class CHIPNullableDoorLockClusterDlLockOperationTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDlLockOperationTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDlLockStateAttributeCallbackBridge : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDlLockStateAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DlLockState value); +}; + +class CHIPNullableDoorLockClusterDlLockStateAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDlLockStateAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDlLockTypeAttributeCallbackBridge : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDlLockTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DlLockType value); +}; + +class CHIPNullableDoorLockClusterDlLockTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDlLockTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDlOperatingModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDlOperatingModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DlOperatingMode value); +}; + +class CHIPNullableDoorLockClusterDlOperatingModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDlOperatingModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDlOperationErrorAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDlOperationErrorAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DlOperationError value); +}; + +class CHIPNullableDoorLockClusterDlOperationErrorAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDlOperationErrorAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDlOperationSourceAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDlOperationSourceAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DlOperationSource value); +}; + +class CHIPNullableDoorLockClusterDlOperationSourceAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDlOperationSourceAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDlStatusAttributeCallbackBridge : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDlStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DlStatus value); +}; + +class CHIPNullableDoorLockClusterDlStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDlStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDlUserStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDlUserStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DlUserStatus value); +}; + +class CHIPNullableDoorLockClusterDlUserStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDlUserStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDlUserTypeAttributeCallbackBridge : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDlUserTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DlUserType value); +}; + +class CHIPNullableDoorLockClusterDlUserTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDlUserTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDoorLockOperationEventCodeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDoorLockOperationEventCodeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DoorLockOperationEventCode value); +}; + +class CHIPNullableDoorLockClusterDoorLockOperationEventCodeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDoorLockOperationEventCodeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDoorLockProgrammingEventCodeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDoorLockProgrammingEventCodeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DoorLockProgrammingEventCode value); +}; + +class CHIPNullableDoorLockClusterDoorLockProgrammingEventCodeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDoorLockProgrammingEventCodeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDoorLockSetPinOrIdStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDoorLockSetPinOrIdStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DoorLockSetPinOrIdStatus value); +}; + +class CHIPNullableDoorLockClusterDoorLockSetPinOrIdStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDoorLockSetPinOrIdStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDoorLockUserStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDoorLockUserStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DoorLockUserStatus value); +}; + +class CHIPNullableDoorLockClusterDoorLockUserStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDoorLockUserStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPDoorLockClusterDoorLockUserTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPDoorLockClusterDoorLockUserTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::DoorLock::DoorLockUserType value); +}; + +class CHIPNullableDoorLockClusterDoorLockUserTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableDoorLockClusterDoorLockUserTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPPumpConfigurationAndControlClusterPumpControlModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPPumpConfigurationAndControlClusterPumpControlModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::PumpConfigurationAndControl::PumpControlMode value); +}; + +class CHIPNullablePumpConfigurationAndControlClusterPumpControlModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullablePumpConfigurationAndControlClusterPumpControlModeAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPPumpConfigurationAndControlClusterPumpOperationModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPPumpConfigurationAndControlClusterPumpOperationModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::PumpConfigurationAndControl::PumpOperationMode value); +}; + +class CHIPNullablePumpConfigurationAndControlClusterPumpOperationModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullablePumpConfigurationAndControlClusterPumpOperationModeAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPThermostatClusterSetpointAdjustModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPThermostatClusterSetpointAdjustModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::Thermostat::SetpointAdjustMode value); +}; + +class CHIPNullableThermostatClusterSetpointAdjustModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableThermostatClusterSetpointAdjustModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPColorControlClusterColorLoopActionAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPColorControlClusterColorLoopActionAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ColorControl::ColorLoopAction value); +}; + +class CHIPNullableColorControlClusterColorLoopActionAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableColorControlClusterColorLoopActionAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPColorControlClusterColorLoopDirectionAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPColorControlClusterColorLoopDirectionAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ColorControl::ColorLoopDirection value); +}; + +class CHIPNullableColorControlClusterColorLoopDirectionAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableColorControlClusterColorLoopDirectionAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPColorControlClusterColorModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPColorControlClusterColorModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ColorControl::ColorMode value); +}; + +class CHIPNullableColorControlClusterColorModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableColorControlClusterColorModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPColorControlClusterHueDirectionAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPColorControlClusterHueDirectionAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ColorControl::HueDirection value); +}; + +class CHIPNullableColorControlClusterHueDirectionAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableColorControlClusterHueDirectionAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPColorControlClusterHueMoveModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPColorControlClusterHueMoveModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ColorControl::HueMoveMode value); +}; + +class CHIPNullableColorControlClusterHueMoveModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableColorControlClusterHueMoveModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPColorControlClusterHueStepModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPColorControlClusterHueStepModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ColorControl::HueStepMode value); +}; + +class CHIPNullableColorControlClusterHueStepModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableColorControlClusterHueStepModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPColorControlClusterSaturationMoveModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPColorControlClusterSaturationMoveModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ColorControl::SaturationMoveMode value); +}; + +class CHIPNullableColorControlClusterSaturationMoveModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableColorControlClusterSaturationMoveModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPColorControlClusterSaturationStepModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPColorControlClusterSaturationStepModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ColorControl::SaturationStepMode value); +}; + +class CHIPNullableColorControlClusterSaturationStepModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableColorControlClusterSaturationStepModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPIlluminanceMeasurementClusterLightSensorTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPIlluminanceMeasurementClusterLightSensorTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::IlluminanceMeasurement::LightSensorType value); +}; + +class CHIPNullableIlluminanceMeasurementClusterLightSensorTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableIlluminanceMeasurementClusterLightSensorTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPIasZoneClusterIasEnrollResponseCodeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPIasZoneClusterIasEnrollResponseCodeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::IasZone::IasEnrollResponseCode value); +}; + +class CHIPNullableIasZoneClusterIasEnrollResponseCodeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableIasZoneClusterIasEnrollResponseCodeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPIasZoneClusterIasZoneTypeAttributeCallbackBridge : public CHIPCallbackBridge +{ +public: + CHIPIasZoneClusterIasZoneTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::IasZone::IasZoneType value); +}; + +class CHIPNullableIasZoneClusterIasZoneTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableIasZoneClusterIasZoneTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPIasAceClusterIasAceAlarmStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPIasAceClusterIasAceAlarmStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::IasAce::IasAceAlarmStatus value); +}; + +class CHIPNullableIasAceClusterIasAceAlarmStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableIasAceClusterIasAceAlarmStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPIasAceClusterIasAceArmModeAttributeCallbackBridge : public CHIPCallbackBridge +{ +public: + CHIPIasAceClusterIasAceArmModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::IasAce::IasAceArmMode value); +}; + +class CHIPNullableIasAceClusterIasAceArmModeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableIasAceClusterIasAceArmModeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPIasAceClusterIasAceArmNotificationAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPIasAceClusterIasAceArmNotificationAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::IasAce::IasAceArmNotification value); +}; + +class CHIPNullableIasAceClusterIasAceArmNotificationAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableIasAceClusterIasAceArmNotificationAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPIasAceClusterIasAceAudibleNotificationAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPIasAceClusterIasAceAudibleNotificationAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::IasAce::IasAceAudibleNotification value); +}; + +class CHIPNullableIasAceClusterIasAceAudibleNotificationAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableIasAceClusterIasAceAudibleNotificationAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPIasAceClusterIasAceBypassResultAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPIasAceClusterIasAceBypassResultAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::IasAce::IasAceBypassResult value); +}; + +class CHIPNullableIasAceClusterIasAceBypassResultAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableIasAceClusterIasAceBypassResultAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPIasAceClusterIasAcePanelStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPIasAceClusterIasAcePanelStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::IasAce::IasAcePanelStatus value); +}; + +class CHIPNullableIasAceClusterIasAcePanelStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableIasAceClusterIasAcePanelStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPIasAceClusterIasZoneTypeAttributeCallbackBridge : public CHIPCallbackBridge +{ +public: + CHIPIasAceClusterIasZoneTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::IasAce::IasZoneType value); +}; + +class CHIPNullableIasAceClusterIasZoneTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableIasAceClusterIasZoneTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, const chip::app::DataModel::Nullable & value); +}; + +class CHIPTvChannelClusterTvChannelErrorTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPTvChannelClusterTvChannelErrorTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::TvChannel::TvChannelErrorType value); +}; + +class CHIPNullableTvChannelClusterTvChannelErrorTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableTvChannelClusterTvChannelErrorTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPTvChannelClusterTvChannelLineupInfoTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPTvChannelClusterTvChannelLineupInfoTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::TvChannel::TvChannelLineupInfoType value); +}; + +class CHIPNullableTvChannelClusterTvChannelLineupInfoTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableTvChannelClusterTvChannelLineupInfoTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPTargetNavigatorClusterNavigateTargetStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPTargetNavigatorClusterNavigateTargetStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::TargetNavigator::NavigateTargetStatus value); +}; + +class CHIPNullableTargetNavigatorClusterNavigateTargetStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableTargetNavigatorClusterNavigateTargetStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPMediaPlaybackClusterMediaPlaybackStateAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPMediaPlaybackClusterMediaPlaybackStateAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::MediaPlayback::MediaPlaybackState value); +}; + +class CHIPNullableMediaPlaybackClusterMediaPlaybackStateAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableMediaPlaybackClusterMediaPlaybackStateAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPMediaPlaybackClusterMediaPlaybackStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPMediaPlaybackClusterMediaPlaybackStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::MediaPlayback::MediaPlaybackStatus value); +}; + +class CHIPNullableMediaPlaybackClusterMediaPlaybackStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableMediaPlaybackClusterMediaPlaybackStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPMediaInputClusterMediaInputTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPMediaInputClusterMediaInputTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::MediaInput::MediaInputType value); +}; + +class CHIPNullableMediaInputClusterMediaInputTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableMediaInputClusterMediaInputTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPKeypadInputClusterKeypadInputCecKeyCodeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPKeypadInputClusterKeypadInputCecKeyCodeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::KeypadInput::KeypadInputCecKeyCode value); +}; + +class CHIPNullableKeypadInputClusterKeypadInputCecKeyCodeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableKeypadInputClusterKeypadInputCecKeyCodeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPKeypadInputClusterKeypadInputStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPKeypadInputClusterKeypadInputStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::KeypadInput::KeypadInputStatus value); +}; + +class CHIPNullableKeypadInputClusterKeypadInputStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableKeypadInputClusterKeypadInputStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPContentLauncherClusterContentLaunchMetricTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPContentLauncherClusterContentLaunchMetricTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ContentLauncher::ContentLaunchMetricType value); +}; + +class CHIPNullableContentLauncherClusterContentLaunchMetricTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableContentLauncherClusterContentLaunchMetricTypeAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPContentLauncherClusterContentLaunchParameterEnumAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPContentLauncherClusterContentLaunchParameterEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ContentLauncher::ContentLaunchParameterEnum value); +}; + +class CHIPNullableContentLauncherClusterContentLaunchParameterEnumAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableContentLauncherClusterContentLaunchParameterEnumAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPContentLauncherClusterContentLaunchStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPContentLauncherClusterContentLaunchStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ContentLauncher::ContentLaunchStatus value); +}; + +class CHIPNullableContentLauncherClusterContentLaunchStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableContentLauncherClusterContentLaunchStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPContentLauncherClusterContentLaunchStreamingTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPContentLauncherClusterContentLaunchStreamingTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ContentLauncher::ContentLaunchStreamingType value); +}; + +class CHIPNullableContentLauncherClusterContentLaunchStreamingTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableContentLauncherClusterContentLaunchStreamingTypeAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPAudioOutputClusterAudioOutputTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPAudioOutputClusterAudioOutputTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::AudioOutput::AudioOutputType value); +}; + +class CHIPNullableAudioOutputClusterAudioOutputTypeAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableAudioOutputClusterAudioOutputTypeAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPApplicationLauncherClusterApplicationLauncherStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPApplicationLauncherClusterApplicationLauncherStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ApplicationLauncher::ApplicationLauncherStatus value); +}; + +class CHIPNullableApplicationLauncherClusterApplicationLauncherStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableApplicationLauncherClusterApplicationLauncherStatusAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPApplicationBasicClusterApplicationBasicStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPApplicationBasicClusterApplicationBasicStatusAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ApplicationBasic::ApplicationBasicStatus value); +}; + +class CHIPNullableApplicationBasicClusterApplicationBasicStatusAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableApplicationBasicClusterApplicationBasicStatusAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPTestClusterClusterSimpleEnumAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPTestClusterClusterSimpleEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::TestCluster::SimpleEnum value); +}; + +class CHIPNullableTestClusterClusterSimpleEnumAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableTestClusterClusterSimpleEnumAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPMessagingClusterEventIdAttributeCallbackBridge : public CHIPCallbackBridge +{ +public: + CHIPMessagingClusterEventIdAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::Messaging::EventId value); +}; + +class CHIPNullableMessagingClusterEventIdAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableMessagingClusterEventIdAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, const chip::app::DataModel::Nullable & value); +}; + +class CHIPMessagingClusterMessagingControlConfirmationAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPMessagingClusterMessagingControlConfirmationAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::Messaging::MessagingControlConfirmation value); +}; + +class CHIPNullableMessagingClusterMessagingControlConfirmationAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableMessagingClusterMessagingControlConfirmationAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPMessagingClusterMessagingControlEnhancedConfirmationAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPMessagingClusterMessagingControlEnhancedConfirmationAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::Messaging::MessagingControlEnhancedConfirmation value); +}; + +class CHIPNullableMessagingClusterMessagingControlEnhancedConfirmationAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableMessagingClusterMessagingControlEnhancedConfirmationAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPMessagingClusterMessagingControlImportanceAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPMessagingClusterMessagingControlImportanceAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::Messaging::MessagingControlImportance value); +}; + +class CHIPNullableMessagingClusterMessagingControlImportanceAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableMessagingClusterMessagingControlImportanceAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPMessagingClusterMessagingControlTransmissionAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPMessagingClusterMessagingControlTransmissionAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::Messaging::MessagingControlTransmission value); +}; + +class CHIPNullableMessagingClusterMessagingControlTransmissionAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableMessagingClusterMessagingControlTransmissionAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPApplianceEventsAndAlertClusterEventIdentificationAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPApplianceEventsAndAlertClusterEventIdentificationAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::ApplianceEventsAndAlert::EventIdentification value); +}; + +class CHIPNullableApplianceEventsAndAlertClusterEventIdentificationAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableApplianceEventsAndAlertClusterEventIdentificationAttributeCallbackBridge(dispatch_queue_t queue, + ResponseHandler handler, + CHIPActionBlock action, + bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, + OnSuccessFn, keepAlive){}; + + static void + OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h index 9dc8e79ae0a133..c9683253ae02cd 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h @@ -1274,6 +1274,21 @@ NS_ASSUME_NONNULL_BEGIN - (void)unlockWithTimeoutWithParams:(CHIPDoorLockClusterUnlockWithTimeoutParams *)params completionHandler:(StatusCompletion)completionHandler; +- (void)readAttributeLockStateWithCompletionHandler:(void (^)( + NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; +- (void)subscribeAttributeLockStateWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + responseHandler:(ResponseHandler)responseHandler; +- (void)reportAttributeLockStateWithResponseHandler:(void (^)( + NSNumber * _Nullable value, NSError * _Nullable error))responseHandler; + +- (void)readAttributeLockTypeWithCompletionHandler:(void (^)( + NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; +- (void)subscribeAttributeLockTypeWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + responseHandler:(ResponseHandler)responseHandler; +- (void)reportAttributeLockTypeWithResponseHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))responseHandler; + - (void)readAttributeActuatorEnabledWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; - (void)subscribeAttributeActuatorEnabledWithMinInterval:(uint16_t)minInterval @@ -3615,6 +3630,14 @@ NS_ASSUME_NONNULL_BEGIN - (void)readAttributeListNullablesAndOptionalsStructWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler; +- (void)readAttributeEnumAttrWithCompletionHandler:(void (^)( + NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; +- (void)writeAttributeEnumAttrWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; +- (void)subscribeAttributeEnumAttrWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + responseHandler:(ResponseHandler)responseHandler; +- (void)reportAttributeEnumAttrWithResponseHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))responseHandler; + - (void)readAttributeRangeRestrictedInt8uWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; - (void)writeAttributeRangeRestrictedInt8uWithValue:(NSNumber * _Nonnull)value @@ -3916,6 +3939,15 @@ NS_ASSUME_NONNULL_BEGIN - (void)reportAttributeNullableCharStringWithResponseHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))responseHandler; +- (void)readAttributeNullableEnumAttrWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler; +- (void)writeAttributeNullableEnumAttrWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; +- (void)subscribeAttributeNullableEnumAttrWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + responseHandler:(ResponseHandler)responseHandler; +- (void)reportAttributeNullableEnumAttrWithResponseHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))responseHandler; + - (void)readAttributeNullableRangeRestrictedInt8uWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; - (void)writeAttributeNullableRangeRestrictedInt8uWithValue:(NSNumber * _Nullable)value diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index 47a0ebefca7140..a27813dc27700e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -6773,6 +6773,83 @@ new CHIPCommandSuccessCallbackBridge( }); } +- (void)readAttributeLockStateWithCompletionHandler:(void (^)( + NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + new CHIPNullableDoorLockClusterDlLockStateAttributeCallbackBridge( + self.callbackQueue, + ^(NSError * _Nullable error, id _Nullable value) { + completionHandler(value, error); + }, + ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = DoorLock::Attributes::LockState::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeLockStateWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + responseHandler:(ResponseHandler)responseHandler +{ + new CHIPNullableInt8uAttributeCallbackBridge( + self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.SubscribeAttributeLockState(success, failure, minInterval, maxInterval); + }); +} + +- (void)reportAttributeLockStateWithResponseHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))responseHandler +{ + new CHIPNullableInt8uAttributeCallbackBridge( + self.callbackQueue, + ^(NSError * _Nullable error, id _Nullable value) { + responseHandler(value, error); + }, + ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReportAttributeLockState(success); + }, + true); +} + +- (void)readAttributeLockTypeWithCompletionHandler:(void (^)( + NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + new CHIPDoorLockClusterDlLockTypeAttributeCallbackBridge( + self.callbackQueue, + ^(NSError * _Nullable error, id _Nullable value) { + completionHandler(value, error); + }, + ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = DoorLock::Attributes::LockType::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeLockTypeWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + responseHandler:(ResponseHandler)responseHandler +{ + new CHIPInt8uAttributeCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.SubscribeAttributeLockType(success, failure, minInterval, maxInterval); + }); +} + +- (void)reportAttributeLockTypeWithResponseHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))responseHandler +{ + new CHIPInt8uAttributeCallbackBridge( + self.callbackQueue, + ^(NSError * _Nullable error, id _Nullable value) { + responseHandler(value, error); + }, + ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReportAttributeLockType(success); + }, + true); +} + - (void)readAttributeActuatorEnabledWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { @@ -19449,6 +19526,62 @@ new CHIPTestClusterListNullablesAndOptionalsStructListAttributeCallbackBridge( }); } +- (void)readAttributeEnumAttrWithCompletionHandler:(void (^)( + NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + new CHIPTestClusterClusterSimpleEnumAttributeCallbackBridge( + self.callbackQueue, + ^(NSError * _Nullable error, id _Nullable value) { + completionHandler(value, error); + }, + ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = TestCluster::Attributes::EnumAttr::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)writeAttributeEnumAttrWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler +{ + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(NSError * _Nullable error, id _Nullable ignored) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = TestCluster::Attributes::EnumAttr::TypeInfo; + TypeInfo::Type cppValue; + cppValue = static_cast>(value.unsignedCharValue); + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeEnumAttrWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + responseHandler:(ResponseHandler)responseHandler +{ + new CHIPInt8uAttributeCallbackBridge(self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.SubscribeAttributeEnumAttr(success, failure, minInterval, maxInterval); + }); +} + +- (void)reportAttributeEnumAttrWithResponseHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))responseHandler +{ + new CHIPInt8uAttributeCallbackBridge( + self.callbackQueue, + ^(NSError * _Nullable error, id _Nullable value) { + responseHandler(value, error); + }, + ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReportAttributeEnumAttr(success); + }, + true); +} + - (void)readAttributeRangeRestrictedInt8uWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { @@ -21488,6 +21621,69 @@ new CHIPNullableCharStringAttributeCallbackBridge( true); } +- (void)readAttributeNullableEnumAttrWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler +{ + new CHIPNullableTestClusterClusterSimpleEnumAttributeCallbackBridge( + self.callbackQueue, + ^(NSError * _Nullable error, id _Nullable value) { + completionHandler(value, error); + }, + ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = TestCluster::Attributes::NullableEnumAttr::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)writeAttributeNullableEnumAttrWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler +{ + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(NSError * _Nullable error, id _Nullable ignored) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = TestCluster::Attributes::NullableEnumAttr::TypeInfo; + TypeInfo::Type cppValue; + if (value == nil) { + cppValue.SetNull(); + } else { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>(value.unsignedCharValue); + } + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeNullableEnumAttrWithMinInterval:(uint16_t)minInterval + maxInterval:(uint16_t)maxInterval + responseHandler:(ResponseHandler)responseHandler +{ + new CHIPNullableInt8uAttributeCallbackBridge( + self.callbackQueue, responseHandler, ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.SubscribeAttributeNullableEnumAttr(success, failure, minInterval, maxInterval); + }); +} + +- (void)reportAttributeNullableEnumAttrWithResponseHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))responseHandler +{ + new CHIPNullableInt8uAttributeCallbackBridge( + self.callbackQueue, + ^(NSError * _Nullable error, id _Nullable value) { + responseHandler(value, error); + }, + ^(Cancelable * success, Cancelable * failure) { + return self.cppCluster.ReportAttributeNullableEnumAttr(success); + }, + true); +} + - (void)readAttributeNullableRangeRestrictedInt8uWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index b9872fb31e1814..e249d0f32fb8d5 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -34700,6 +34700,54 @@ - (void)testSendClusterDiagnosticLogsReadAttributeAttributeListWithCompletionHan [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterDoorLockReadAttributeLockStateWithCompletionHandler +{ + dispatch_queue_t queue = dispatch_get_main_queue(); + + XCTestExpectation * connectedExpectation = + [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + WaitForCommissionee(connectedExpectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; + + CHIPDevice * device = GetConnectedDevice(); + CHIPDoorLock * cluster = [[CHIPDoorLock alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + XCTestExpectation * expectation = [self expectationWithDescription:@"DoorLockReadAttributeLockStateWithCompletionHandler"]; + + [cluster readAttributeLockStateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"DoorLock LockState Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterDoorLockReadAttributeLockTypeWithCompletionHandler +{ + dispatch_queue_t queue = dispatch_get_main_queue(); + + XCTestExpectation * connectedExpectation = + [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + WaitForCommissionee(connectedExpectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; + + CHIPDevice * device = GetConnectedDevice(); + CHIPDoorLock * cluster = [[CHIPDoorLock alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + XCTestExpectation * expectation = [self expectationWithDescription:@"DoorLockReadAttributeLockTypeWithCompletionHandler"]; + + [cluster readAttributeLockTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"DoorLock LockType Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterDoorLockReadAttributeActuatorEnabledWithCompletionHandler { dispatch_queue_t queue = dispatch_get_main_queue(); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 040fc0bb02ab6d..ec60419bcf21c0 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -15882,6 +15882,171 @@ class DoorLockUnlockWithTimeout : public ModelCommand chip::app::Clusters::DoorLock::Commands::UnlockWithTimeout::Type mRequest; }; +/* + * Attribute LockState + */ +class ReadDoorLockLockState : public ModelCommand +{ +public: + ReadDoorLockLockState() : ModelCommand("read") + { + AddArgument("attr-name", "lock-state"); + ModelCommand::AddArguments(); + } + + ~ReadDoorLockLockState() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x00) on endpoint %" PRIu8, endpointId); + + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttribute(this, OnAttributeResponse, + OnDefaultFailure); + } + + static void OnAttributeResponse(void * context, + const chip::app::DataModel::Nullable & value) + { + OnGeneralAttributeResponse(context, "DoorLock.LockState response", value); + } +}; + +class ReportDoorLockLockState : public ModelCommand +{ +public: + ReportDoorLockLockState() : ModelCommand("report") + { + AddArgument("attr-name", "lock-state"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportDoorLockLockState() + { + delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; + delete onFailureCallback; + delete onReportCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, endpointId); + + ReturnErrorOnFailure(cluster.ReportAttributeLockState(onReportCallback->Cancel())); + + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeLockState(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + chip::Callback::Callback * onReportCallback = + new chip::Callback::Callback(OnInt8uAttributeReport, this); + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + +/* + * Attribute LockType + */ +class ReadDoorLockLockType : public ModelCommand +{ +public: + ReadDoorLockLockType() : ModelCommand("read") + { + AddArgument("attr-name", "lock-type"); + ModelCommand::AddArguments(); + } + + ~ReadDoorLockLockType() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x00) on endpoint %" PRIu8, endpointId); + + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttribute(this, OnAttributeResponse, + OnDefaultFailure); + } + + static void OnAttributeResponse(void * context, chip::app::Clusters::DoorLock::DlLockType value) + { + OnGeneralAttributeResponse(context, "DoorLock.LockType response", value); + } +}; + +class ReportDoorLockLockType : public ModelCommand +{ +public: + ReportDoorLockLockType() : ModelCommand("report") + { + AddArgument("attr-name", "lock-type"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportDoorLockLockType() + { + delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; + delete onFailureCallback; + delete onReportCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0101) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::DoorLockCluster cluster; + cluster.Associate(device, endpointId); + + ReturnErrorOnFailure(cluster.ReportAttributeLockType(onReportCallback->Cancel())); + + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeLockType(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + chip::Callback::Callback * onReportCallback = + new chip::Callback::Callback(OnInt8uAttributeReport, this); + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute ActuatorEnabled */ @@ -39021,6 +39186,114 @@ class ReadTestClusterListNullablesAndOptionalsStruct : public ModelCommand } }; +/* + * Attribute EnumAttr + */ +class ReadTestClusterEnumAttr : public ModelCommand +{ +public: + ReadTestClusterEnumAttr() : ModelCommand("read") + { + AddArgument("attr-name", "enum-attr"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterEnumAttr() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x00) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttribute(this, OnAttributeResponse, + OnDefaultFailure); + } + + static void OnAttributeResponse(void * context, chip::app::Clusters::TestCluster::SimpleEnum value) + { + OnGeneralAttributeResponse(context, "TestCluster.EnumAttr response", value); + } +}; + +class WriteTestClusterEnumAttr : public ModelCommand +{ +public: + WriteTestClusterEnumAttr() : ModelCommand("write") + { + AddArgument("attr-name", "enum-attr"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterEnumAttr() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttribute( + mValue, this, OnDefaultSuccessResponse, OnDefaultFailure, mTimedInteractionTimeoutMs); + } + +private: + chip::app::Clusters::TestCluster::SimpleEnum mValue; +}; + +class ReportTestClusterEnumAttr : public ModelCommand +{ +public: + ReportTestClusterEnumAttr() : ModelCommand("report") + { + AddArgument("attr-name", "enum-attr"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportTestClusterEnumAttr() + { + delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; + delete onFailureCallback; + delete onReportCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + + ReturnErrorOnFailure(cluster.ReportAttributeEnumAttr(onReportCallback->Cancel())); + + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeEnumAttr(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + chip::Callback::Callback * onReportCallback = + new chip::Callback::Callback(OnInt8uAttributeReport, this); + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute RangeRestrictedInt8u */ @@ -42571,6 +42844,115 @@ class ReportTestClusterNullableCharString : public ModelCommand bool mWait; }; +/* + * Attribute NullableEnumAttr + */ +class ReadTestClusterNullableEnumAttr : public ModelCommand +{ +public: + ReadTestClusterNullableEnumAttr() : ModelCommand("read") + { + AddArgument("attr-name", "nullable-enum-attr"); + ModelCommand::AddArguments(); + } + + ~ReadTestClusterNullableEnumAttr() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x00) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttribute( + this, OnAttributeResponse, OnDefaultFailure); + } + + static void OnAttributeResponse(void * context, + const chip::app::DataModel::Nullable & value) + { + OnGeneralAttributeResponse(context, "TestCluster.NullableEnumAttr response", value); + } +}; + +class WriteTestClusterNullableEnumAttr : public ModelCommand +{ +public: + WriteTestClusterNullableEnumAttr() : ModelCommand("write") + { + AddArgument("attr-name", "nullable-enum-attr"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteTestClusterNullableEnumAttr() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x01) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + return cluster.WriteAttribute( + mValue, this, OnDefaultSuccessResponse, OnDefaultFailure, mTimedInteractionTimeoutMs); + } + +private: + chip::app::DataModel::Nullable mValue; +}; + +class ReportTestClusterNullableEnumAttr : public ModelCommand +{ +public: + ReportTestClusterNullableEnumAttr() : ModelCommand("report") + { + AddArgument("attr-name", "nullable-enum-attr"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportTestClusterNullableEnumAttr() + { + delete onSuccessCallback; + delete onSuccessCallbackWithoutExit; + delete onFailureCallback; + delete onReportCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + + ReturnErrorOnFailure(cluster.ReportAttributeNullableEnumAttr(onReportCallback->Cancel())); + + chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); + return cluster.SubscribeAttributeNullableEnumAttr(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnDefaultSuccessResponse, this); + chip::Callback::Callback * onSuccessCallbackWithoutExit = + new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); + chip::Callback::Callback * onReportCallback = + new chip::Callback::Callback(OnInt8uAttributeReport, this); + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute NullableRangeRestrictedInt8u */ @@ -54609,6 +54991,10 @@ void registerClusterDoorLock(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // @@ -55545,6 +55931,9 @@ void registerClusterTestCluster(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // @@ -55644,6 +56033,9 @@ void registerClusterTestCluster(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // diff --git a/zzz_generated/chip-tool/zap-generated/reporting/Commands.h b/zzz_generated/chip-tool/zap-generated/reporting/Commands.h index ba98f5abae0929..14594d63dc76f3 100644 --- a/zzz_generated/chip-tool/zap-generated/reporting/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/reporting/Commands.h @@ -135,6 +135,8 @@ class Listen : public ReportingCommand delete onReportColorControlClusterRevisionCallback; delete onReportContentLauncherClusterRevisionCallback; delete onReportDescriptorClusterRevisionCallback; + delete onReportDoorLockLockStateCallback; + delete onReportDoorLockLockTypeCallback; delete onReportDoorLockActuatorEnabledCallback; delete onReportDoorLockClusterRevisionCallback; delete onReportElectricalMeasurementMeasurementTypeCallback; @@ -342,6 +344,7 @@ class Listen : public ReportingCommand delete onReportTestClusterEpochUsCallback; delete onReportTestClusterEpochSCallback; delete onReportTestClusterVendorIdCallback; + delete onReportTestClusterEnumAttrCallback; delete onReportTestClusterRangeRestrictedInt8uCallback; delete onReportTestClusterRangeRestrictedInt8sCallback; delete onReportTestClusterRangeRestrictedInt16uCallback; @@ -374,6 +377,7 @@ class Listen : public ReportingCommand delete onReportTestClusterNullableFloatDoubleCallback; delete onReportTestClusterNullableOctetStringCallback; delete onReportTestClusterNullableCharStringCallback; + delete onReportTestClusterNullableEnumAttrCallback; delete onReportTestClusterNullableRangeRestrictedInt8uCallback; delete onReportTestClusterNullableRangeRestrictedInt8sCallback; delete onReportTestClusterNullableRangeRestrictedInt16uCallback; @@ -752,6 +756,10 @@ class Listen : public ReportingCommand BasicAttributeFilter); callbacksMgr.AddReportCallback(remoteId, endpointId, 0x001D, 0xFFFD, onReportDescriptorClusterRevisionCallback->Cancel(), BasicAttributeFilter); + callbacksMgr.AddReportCallback(remoteId, endpointId, 0x0101, 0x0000, onReportDoorLockLockStateCallback->Cancel(), + BasicAttributeFilter); + callbacksMgr.AddReportCallback(remoteId, endpointId, 0x0101, 0x0001, onReportDoorLockLockTypeCallback->Cancel(), + BasicAttributeFilter); callbacksMgr.AddReportCallback(remoteId, endpointId, 0x0101, 0x0002, onReportDoorLockActuatorEnabledCallback->Cancel(), BasicAttributeFilter); callbacksMgr.AddReportCallback(remoteId, endpointId, 0x0101, 0xFFFD, onReportDoorLockClusterRevisionCallback->Cancel(), @@ -1273,6 +1281,8 @@ class Listen : public ReportingCommand BasicAttributeFilter); callbacksMgr.AddReportCallback(remoteId, endpointId, 0x050F, 0x0022, onReportTestClusterVendorIdCallback->Cancel(), BasicAttributeFilter); + callbacksMgr.AddReportCallback(remoteId, endpointId, 0x050F, 0x0024, onReportTestClusterEnumAttrCallback->Cancel(), + BasicAttributeFilter); callbacksMgr.AddReportCallback(remoteId, endpointId, 0x050F, 0x0026, onReportTestClusterRangeRestrictedInt8uCallback->Cancel(), BasicAttributeFilter); @@ -1345,6 +1355,8 @@ class Listen : public ReportingCommand callbacksMgr.AddReportCallback(remoteId, endpointId, 0x050F, 0x801E, onReportTestClusterNullableCharStringCallback->Cancel(), BasicAttributeFilter); + callbacksMgr.AddReportCallback(remoteId, endpointId, 0x050F, 0x8024, onReportTestClusterNullableEnumAttrCallback->Cancel(), + BasicAttributeFilter); callbacksMgr.AddReportCallback(remoteId, endpointId, 0x050F, 0x8026, onReportTestClusterNullableRangeRestrictedInt8uCallback->Cancel(), BasicAttributeFilter); @@ -2083,6 +2095,12 @@ class Listen : public ReportingCommand onReportDescriptorClusterRevisionCallback = new chip::Callback::Callback( ReadDescriptorClusterRevision::OnAttributeResponse, this); + chip::Callback::Callback * onReportDoorLockLockStateCallback = + new chip::Callback::Callback( + ReadDoorLockLockState::OnAttributeResponse, this); + chip::Callback::Callback * onReportDoorLockLockTypeCallback = + new chip::Callback::Callback( + ReadDoorLockLockType::OnAttributeResponse, this); chip::Callback::Callback * onReportDoorLockActuatorEnabledCallback = new chip::Callback::Callback( @@ -2844,6 +2862,9 @@ class Listen : public ReportingCommand chip::Callback::Callback * onReportTestClusterVendorIdCallback = new chip::Callback::Callback( ReadTestClusterVendorId::OnAttributeResponse, this); + chip::Callback::Callback * onReportTestClusterEnumAttrCallback = + new chip::Callback::Callback( + ReadTestClusterEnumAttr::OnAttributeResponse, this); chip::Callback::Callback * onReportTestClusterRangeRestrictedInt8uCallback = new chip::Callback::Callback( @@ -2971,6 +2992,10 @@ class Listen : public ReportingCommand onReportTestClusterNullableCharStringCallback = new chip::Callback::Callback( ReadTestClusterNullableCharString::OnAttributeResponse, this); + chip::Callback::Callback * + onReportTestClusterNullableEnumAttrCallback = + new chip::Callback::Callback( + ReadTestClusterNullableEnumAttr::OnAttributeResponse, this); chip::Callback::Callback * onReportTestClusterNullableRangeRestrictedInt8uCallback = new chip::Callback::Callback( diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp index c0c7fecec95233..a8ffd71446c0b9 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.cpp @@ -5045,6 +5045,40 @@ CHIP_ERROR DoorLockCluster::UnlockWithTimeout(Callback::Cancelable * onSuccessCa } // DoorLock Cluster Attributes +CHIP_ERROR DoorLockCluster::SubscribeAttributeLockState(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t minInterval, + uint16_t maxInterval) +{ + chip::app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = DoorLock::Attributes::LockState::Id; + return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR DoorLockCluster::ReportAttributeLockState(Callback::Cancelable * onReportCallback) +{ + return RequestAttributeReporting(DoorLock::Attributes::LockState::Id, onReportCallback, + BasicAttributeFilter); +} + +CHIP_ERROR DoorLockCluster::SubscribeAttributeLockType(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t minInterval, + uint16_t maxInterval) +{ + chip::app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = DoorLock::Attributes::LockType::Id; + return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR DoorLockCluster::ReportAttributeLockType(Callback::Cancelable * onReportCallback) +{ + return RequestAttributeReporting(DoorLock::Attributes::LockType::Id, onReportCallback, + BasicAttributeFilter); +} + CHIP_ERROR DoorLockCluster::SubscribeAttributeActuatorEnabled(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t minInterval, uint16_t maxInterval) @@ -12733,6 +12767,23 @@ CHIP_ERROR TestClusterCluster::ReportAttributeVendorId(Callback::Cancelable * on BasicAttributeFilter); } +CHIP_ERROR TestClusterCluster::SubscribeAttributeEnumAttr(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t minInterval, + uint16_t maxInterval) +{ + chip::app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = TestCluster::Attributes::EnumAttr::Id; + return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReportAttributeEnumAttr(Callback::Cancelable * onReportCallback) +{ + return RequestAttributeReporting(TestCluster::Attributes::EnumAttr::Id, onReportCallback, + BasicAttributeFilter); +} + CHIP_ERROR TestClusterCluster::SubscribeAttributeRangeRestrictedInt8u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t minInterval, uint16_t maxInterval) @@ -13277,6 +13328,23 @@ CHIP_ERROR TestClusterCluster::ReportAttributeNullableCharString(Callback::Cance BasicAttributeFilter); } +CHIP_ERROR TestClusterCluster::SubscribeAttributeNullableEnumAttr(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t minInterval, + uint16_t maxInterval) +{ + chip::app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mAttributeId = TestCluster::Attributes::NullableEnumAttr::Id; + return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); +} + +CHIP_ERROR TestClusterCluster::ReportAttributeNullableEnumAttr(Callback::Cancelable * onReportCallback) +{ + return RequestAttributeReporting(TestCluster::Attributes::NullableEnumAttr::Id, onReportCallback, + BasicAttributeFilter); +} + CHIP_ERROR TestClusterCluster::SubscribeAttributeNullableRangeRestrictedInt8u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t minInterval, uint16_t maxInterval) diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h index 4c116c47e7b0bf..3019e78382cfbd 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClusters.h @@ -726,6 +726,12 @@ class DLL_EXPORT DoorLockCluster : public ClusterBase uint16_t timeout, chip::ByteSpan pinCode); // Cluster Attributes + CHIP_ERROR SubscribeAttributeLockState(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval); + CHIP_ERROR ReportAttributeLockState(Callback::Cancelable * onReportCallback); + CHIP_ERROR SubscribeAttributeLockType(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval); + CHIP_ERROR ReportAttributeLockType(Callback::Cancelable * onReportCallback); CHIP_ERROR SubscribeAttributeActuatorEnabled(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t minInterval, uint16_t maxInterval); CHIP_ERROR ReportAttributeActuatorEnabled(Callback::Cancelable * onReportCallback); @@ -1946,6 +1952,9 @@ class DLL_EXPORT TestClusterCluster : public ClusterBase CHIP_ERROR SubscribeAttributeVendorId(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t minInterval, uint16_t maxInterval); CHIP_ERROR ReportAttributeVendorId(Callback::Cancelable * onReportCallback); + CHIP_ERROR SubscribeAttributeEnumAttr(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, + uint16_t minInterval, uint16_t maxInterval); + CHIP_ERROR ReportAttributeEnumAttr(Callback::Cancelable * onReportCallback); CHIP_ERROR SubscribeAttributeRangeRestrictedInt8u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t minInterval, uint16_t maxInterval); @@ -2053,6 +2062,10 @@ class DLL_EXPORT TestClusterCluster : public ClusterBase Callback::Cancelable * onFailureCallback, uint16_t minInterval, uint16_t maxInterval); CHIP_ERROR ReportAttributeNullableCharString(Callback::Cancelable * onReportCallback); + CHIP_ERROR SubscribeAttributeNullableEnumAttr(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback, uint16_t minInterval, + uint16_t maxInterval); + CHIP_ERROR ReportAttributeNullableEnumAttr(Callback::Cancelable * onReportCallback); CHIP_ERROR SubscribeAttributeNullableRangeRestrictedInt8u(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t minInterval, uint16_t maxInterval); From 88085b2df1eab57e348a10b20ca11aad2aa0c9f9 Mon Sep 17 00:00:00 2001 From: Kevin Schoedel <67607049+kpschoedel@users.noreply.github.com> Date: Wed, 8 Dec 2021 16:49:53 -0500 Subject: [PATCH 07/28] Fix missing __APPLE_USE_RFC_3542 (#12753) * Fix missing __APPLE_USE_RFC_3542 #### Problem In splitting `UDPEndPoint.cpp` by implementation, the definition of `__APPLE_USE_RFC_3542` was lost, which caused `IPV6_PKTINFO` to not be defined and corresponding parts of `UDPEndPoint` not to be built. #### Change overview Add `#define __APPLE_USE_RFC_3542` to the top of `UDPEndPointImplSockets.cpp`, as it had been in `UDPEndPoint.cpp`. #### Testing CI * Update src/inet/UDPEndPointImplSockets.cpp Co-authored-by: Tennessee Carmel-Veilleux * Fix trailing whitespace Co-authored-by: Andrei Litvin Co-authored-by: Tennessee Carmel-Veilleux --- src/inet/UDPEndPointImplSockets.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/inet/UDPEndPointImplSockets.cpp b/src/inet/UDPEndPointImplSockets.cpp index ffae9f1f533d34..23428fa49c4a63 100644 --- a/src/inet/UDPEndPointImplSockets.cpp +++ b/src/inet/UDPEndPointImplSockets.cpp @@ -21,6 +21,9 @@ * This file implements Inet::UDPEndPoint using sockets. */ +// Required to properly support underlying RFC3542-related fields to IPV6_PKTINFO +// on Darwin. +#define __APPLE_USE_RFC_3542 #include #include From d8ac848f325705a567a46e4935613a0c483a1123 Mon Sep 17 00:00:00 2001 From: Pankaj Garg Date: Wed, 8 Dec 2021 13:54:52 -0800 Subject: [PATCH 08/28] Integrate CASE MRP parameters with controller and CASE server (#12738) * Integrate CASE MRP parameters with controller and CASE server * fix tests * fix test build --- src/app/CASEClient.cpp | 4 +-- src/app/CASEClient.h | 2 ++ src/app/OperationalDeviceProxy.cpp | 3 +- src/app/OperationalDeviceProxy.h | 2 ++ src/controller/CHIPDeviceController.cpp | 1 + src/controller/CHIPDeviceController.h | 4 +-- src/protocols/secure_channel/CASEServer.cpp | 3 +- src/protocols/secure_channel/CASESession.cpp | 30 +++++++++++++------- src/protocols/secure_channel/PASESession.cpp | 15 ++++++++-- src/transport/PairingSession.cpp | 10 +++---- src/transport/PairingSession.h | 4 +-- src/transport/tests/TestPairingSession.cpp | 15 +++++----- 12 files changed, 58 insertions(+), 35 deletions(-) diff --git a/src/app/CASEClient.cpp b/src/app/CASEClient.cpp index c0fe3c4b89090b..e4bba8e6c9e0b1 100644 --- a/src/app/CASEClient.cpp +++ b/src/app/CASEClient.cpp @@ -43,8 +43,8 @@ CHIP_ERROR CASEClient::EstablishSession(PeerId peer, const Transport::PeerAddres uint16_t keyID = 0; ReturnErrorOnFailure(mInitParams.idAllocator->Allocate(keyID)); - ReturnErrorOnFailure( - mCASESession.EstablishSession(peerAddress, mInitParams.fabricInfo, peer.GetNodeId(), keyID, exchange, this)); + ReturnErrorOnFailure(mCASESession.EstablishSession(peerAddress, mInitParams.fabricInfo, peer.GetNodeId(), keyID, exchange, this, + mInitParams.mrpLocalConfig)); mConnectionSuccessCallback = onConnection; mConnectionFailureCallback = onFailure; mConectionContext = context; diff --git a/src/app/CASEClient.h b/src/app/CASEClient.h index 22b68ecfde34c2..24a502a5ff0621 100644 --- a/src/app/CASEClient.h +++ b/src/app/CASEClient.h @@ -35,6 +35,8 @@ struct CASEClientInitParams Messaging::ExchangeManager * exchangeMgr = nullptr; SessionIDAllocator * idAllocator = nullptr; FabricInfo * fabricInfo = nullptr; + + Optional mrpLocalConfig = Optional::Missing(); }; class DLL_EXPORT CASEClient : public SessionEstablishmentDelegate diff --git a/src/app/OperationalDeviceProxy.cpp b/src/app/OperationalDeviceProxy.cpp index 81e0b29ab7d20f..46ebccb0681be4 100644 --- a/src/app/OperationalDeviceProxy.cpp +++ b/src/app/OperationalDeviceProxy.cpp @@ -150,7 +150,8 @@ bool OperationalDeviceProxy::GetAddress(Inet::IPAddress & addr, uint16_t & port) CHIP_ERROR OperationalDeviceProxy::EstablishConnection() { mCASEClient = mInitParams.clientPool->Allocate(CASEClientInitParams{ mInitParams.sessionManager, mInitParams.exchangeMgr, - mInitParams.idAllocator, mInitParams.fabricInfo }); + mInitParams.idAllocator, mInitParams.fabricInfo, + mInitParams.mrpLocalConfig }); ReturnErrorCodeIf(mCASEClient == nullptr, CHIP_ERROR_NO_MEMORY); CHIP_ERROR err = mCASEClient->EstablishSession(mPeerId, mDeviceAddress, mMRPConfig, HandleCASEConnected, HandleCASEConnectionFailure, this); diff --git a/src/app/OperationalDeviceProxy.h b/src/app/OperationalDeviceProxy.h index 3ff7c4967e83eb..b67384b873e3f1 100644 --- a/src/app/OperationalDeviceProxy.h +++ b/src/app/OperationalDeviceProxy.h @@ -57,6 +57,8 @@ struct DeviceProxyInitParams Controller::DeviceControllerInteractionModelDelegate * imDelegate = nullptr; + Optional mrpLocalConfig = Optional::Missing(); + CHIP_ERROR Validate() { ReturnErrorCodeIf(sessionManager == nullptr, CHIP_ERROR_INCORRECT_STATE); diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index 8944c8484fad1c..186c3cab4388a7 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -153,6 +153,7 @@ CHIP_ERROR DeviceController::Init(ControllerInitParams params) .fabricInfo = params.systemState->Fabrics()->FindFabricWithIndex(mFabricIndex), .clientPool = &mCASEClientPool, .imDelegate = params.systemState->IMDelegate(), + .mrpLocalConfig = Optional::Value(mMRPConfig), }; CASESessionManagerConfig sessionManagerConfig = { diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index 17597334dfabd0..c810c6a18df075 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -388,6 +388,8 @@ class DLL_EXPORT DeviceController : public SessionReleaseDelegate, uint16_t mVendorId; + ReliableMessageProtocolConfig mMRPConfig = gDefaultMRPConfig; + //////////// SessionReleaseDelegate Implementation /////////////// void OnSessionReleased(SessionHandle session) override; @@ -819,8 +821,6 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, Callback::Callback mDeviceNOCChainCallback; SetUpCodePairer mSetUpCodePairer; - - ReliableMessageProtocolConfig mMRPConfig = gDefaultMRPConfig; }; } // namespace Controller diff --git a/src/protocols/secure_channel/CASEServer.cpp b/src/protocols/secure_channel/CASEServer.cpp index 926210afb49964..a40c4f81f0dab1 100644 --- a/src/protocols/secure_channel/CASEServer.cpp +++ b/src/protocols/secure_channel/CASEServer.cpp @@ -74,7 +74,8 @@ CHIP_ERROR CASEServer::InitCASEHandshake(Messaging::ExchangeContext * ec) ReturnErrorOnFailure(mIDAllocator->Allocate(mSessionKeyId)); // Setup CASE state machine using the credentials for the current fabric. - ReturnErrorOnFailure(GetSession().ListenForSessionEstablishment(mSessionKeyId, mFabrics, this)); + ReturnErrorOnFailure(GetSession().ListenForSessionEstablishment( + mSessionKeyId, mFabrics, this, Optional::Value(gDefaultMRPConfig))); // Hand over the exchange context to the CASE session. ec->SetDelegate(&GetSession()); diff --git a/src/protocols/secure_channel/CASESession.cpp b/src/protocols/secure_channel/CASESession.cpp index cde2d4f333a0f3..581c14bd517153 100644 --- a/src/protocols/secure_channel/CASESession.cpp +++ b/src/protocols/secure_channel/CASESession.cpp @@ -291,12 +291,12 @@ CHIP_ERROR CASESession::DeriveSecureSession(CryptoContext & session, CryptoConte CHIP_ERROR CASESession::SendSigma1() { - size_t data_len = TLV::EstimateStructOverhead(kSigmaParamRandomNumberSize, // initiatorRandom + const size_t mrpParamsSize = mLocalMRPConfig.HasValue() ? TLV::EstimateStructOverhead(sizeof(uint16_t), sizeof(uint16_t)) : 0; + size_t data_len = TLV::EstimateStructOverhead(kSigmaParamRandomNumberSize, // initiatorRandom sizeof(uint16_t), // initiatorSessionId, kSHA256_Hash_Length, // destinationId kP256_PublicKey_Length, // InitiatorEphPubKey, - /* TLV::EstimateStructOverhead(sizeof(uint16_t), - sizeof(uint16)_t), // initiatorMRPParams */ + mrpParamsSize, // initiatorMRPParams kCASEResumptionIDSize, CHIP_CRYPTO_AEAD_MIC_LENGTH_BYTES); System::PacketBufferTLVWriter tlvWriter; @@ -461,8 +461,9 @@ CHIP_ERROR CASESession::HandleSigma1(System::PacketBufferHandle && msg) CHIP_ERROR CASESession::SendSigma2Resume(const ByteSpan & initiatorRandom) { - size_t max_sigma2_resume_data_len = TLV::EstimateStructOverhead(kCASEResumptionIDSize, CHIP_CRYPTO_AEAD_MIC_LENGTH_BYTES, - sizeof(uint16_t) /*, kMRPOptionalParamsLength, */); + const size_t mrpParamsSize = mLocalMRPConfig.HasValue() ? TLV::EstimateStructOverhead(sizeof(uint16_t), sizeof(uint16_t)) : 0; + size_t max_sigma2_resume_data_len = + TLV::EstimateStructOverhead(kCASEResumptionIDSize, CHIP_CRYPTO_AEAD_MIC_LENGTH_BYTES, sizeof(uint16_t), mrpParamsSize); System::PacketBufferTLVWriter tlvWriter; System::PacketBufferHandle msg_R2_resume; @@ -603,8 +604,9 @@ CHIP_ERROR CASESession::SendSigma2() CHIP_CRYPTO_AEAD_MIC_LENGTH_BYTES)); // Construct Sigma2 Msg - size_t data_len = TLV::EstimateStructOverhead(kSigmaParamRandomNumberSize, sizeof(uint16_t), kP256_PublicKey_Length, - msg_r2_signed_enc_len, CHIP_CRYPTO_AEAD_MIC_LENGTH_BYTES); + const size_t mrpParamsSize = mLocalMRPConfig.HasValue() ? TLV::EstimateStructOverhead(sizeof(uint16_t), sizeof(uint16_t)) : 0; + size_t data_len = TLV::EstimateStructOverhead(kSigmaParamRandomNumberSize, sizeof(uint16_t), kP256_PublicKey_Length, + msg_r2_signed_enc_len, CHIP_CRYPTO_AEAD_MIC_LENGTH_BYTES, mrpParamsSize); System::PacketBufferHandle msg_R2 = System::PacketBufferHandle::New(data_len); VerifyOrReturnError(!msg_R2.IsNull(), CHIP_ERROR_NO_MEMORY); @@ -623,7 +625,7 @@ CHIP_ERROR CASESession::SendSigma2() if (mLocalMRPConfig.HasValue()) { ChipLogDetail(SecureChannel, "Including MRP parameters"); - ReturnErrorOnFailure(EncodeMRPParameters(TLV::ContextTag(5), mLocalMRPConfig.Value(), tlvWriter)); + ReturnErrorOnFailure(EncodeMRPParameters(TLV::ContextTag(5), mLocalMRPConfig.Value(), tlvWriterMsg2)); } ReturnErrorOnFailure(tlvWriterMsg2.EndContainer(outerContainerType)); ReturnErrorOnFailure(tlvWriterMsg2.Finalize(&msg_R2)); @@ -680,7 +682,10 @@ CHIP_ERROR CASESession::HandleSigma2Resume(System::PacketBufferHandle && msg) VerifyOrExit(TLV::TagNumFromTag(tlvReader.GetTag()) == ++decodeTagIdSeq, err = CHIP_ERROR_INVALID_TLV_TAG); SuccessOrExit(err = tlvReader.Get(responderSessionId)); - SuccessOrExit(err = DecodeMRPParametersIfPresent(tlvReader)); + if (tlvReader.Next() != CHIP_END_OF_TLV) + { + SuccessOrExit(err = DecodeMRPParametersIfPresent(TLV::ContextTag(4), tlvReader)); + } ChipLogDetail(SecureChannel, "Peer assigned session session ID %d", responderSessionId); SetPeerSessionId(responderSessionId); @@ -852,7 +857,10 @@ CHIP_ERROR CASESession::HandleSigma2(System::PacketBufferHandle && msg) SetPeerCATs(peerCATs); // Retrieve responderMRPParams if present - SuccessOrExit(err = DecodeMRPParametersIfPresent(tlvReader)); + if (tlvReader.Next() != CHIP_END_OF_TLV) + { + SuccessOrExit(err = DecodeMRPParametersIfPresent(TLV::ContextTag(5), tlvReader)); + } exit: if (err != CHIP_NO_ERROR) @@ -1378,7 +1386,7 @@ CHIP_ERROR CASESession::ParseSigma1(TLV::ContiguousBufferTLVReader & tlvReader, CHIP_ERROR err = tlvReader.Next(); if (err == CHIP_NO_ERROR && tlvReader.GetTag() == ContextTag(kInitiatorMRPParamsTag)) { - ReturnErrorOnFailure(DecodeMRPParametersIfPresent(tlvReader)); + ReturnErrorOnFailure(DecodeMRPParametersIfPresent(TLV::ContextTag(kInitiatorMRPParamsTag), tlvReader)); err = tlvReader.Next(); } diff --git a/src/protocols/secure_channel/PASESession.cpp b/src/protocols/secure_channel/PASESession.cpp index 5598f4cf915106..d43f01c5ae0eb8 100644 --- a/src/protocols/secure_channel/PASESession.cpp +++ b/src/protocols/secure_channel/PASESession.cpp @@ -442,7 +442,10 @@ CHIP_ERROR PASESession::HandlePBKDFParamRequest(System::PacketBufferHandle && ms VerifyOrExit(TLV::TagNumFromTag(tlvReader.GetTag()) == ++decodeTagIdSeq, err = CHIP_ERROR_INVALID_TLV_TAG); SuccessOrExit(err = tlvReader.Get(hasPBKDFParameters)); - SuccessOrExit(err = DecodeMRPParametersIfPresent(tlvReader)); + if (tlvReader.Next() != CHIP_END_OF_TLV) + { + SuccessOrExit(err = DecodeMRPParametersIfPresent(TLV::ContextTag(5), tlvReader)); + } err = SendPBKDFParamResponse(ByteSpan(initiatorRandom), hasPBKDFParameters); SuccessOrExit(err); @@ -562,7 +565,10 @@ CHIP_ERROR PASESession::HandlePBKDFParamResponse(System::PacketBufferHandle && m if (mHavePBKDFParameters) { - SuccessOrExit(err = DecodeMRPParametersIfPresent(tlvReader)); + if (tlvReader.Next() != CHIP_END_OF_TLV) + { + SuccessOrExit(err = DecodeMRPParametersIfPresent(TLV::ContextTag(5), tlvReader)); + } // TODO - Add a unit test that exercises mHavePBKDFParameters path err = SetupSpake2p(mIterationCount, ByteSpan(mSalt, mSaltLength)); @@ -585,7 +591,10 @@ CHIP_ERROR PASESession::HandlePBKDFParamResponse(System::PacketBufferHandle && m SuccessOrExit(err = tlvReader.ExitContainer(containerType)); - SuccessOrExit(err = DecodeMRPParametersIfPresent(tlvReader)); + if (tlvReader.Next() != CHIP_END_OF_TLV) + { + SuccessOrExit(err = DecodeMRPParametersIfPresent(TLV::ContextTag(5), tlvReader)); + } err = SetupSpake2p(iterCount, ByteSpan(salt, saltLength)); SuccessOrExit(err); diff --git a/src/transport/PairingSession.cpp b/src/transport/PairingSession.cpp index affc27f51367a2..c19d4251a97943 100644 --- a/src/transport/PairingSession.cpp +++ b/src/transport/PairingSession.cpp @@ -36,15 +36,13 @@ CHIP_ERROR PairingSession::EncodeMRPParameters(TLV::Tag tag, const ReliableMessa return tlvWriter.EndContainer(mrpParamsContainer); } -CHIP_ERROR PairingSession::DecodeMRPParametersIfPresent(TLV::ContiguousBufferTLVReader & tlvReader) +CHIP_ERROR PairingSession::DecodeMRPParametersIfPresent(TLV::Tag expectedTag, TLV::ContiguousBufferTLVReader & tlvReader) { // The MRP parameters are optional. - CHIP_ERROR err = tlvReader.Next(); - if (err == CHIP_END_OF_TLV) + if (tlvReader.GetTag() != expectedTag) { return CHIP_NO_ERROR; } - ReturnErrorOnFailure(err); TLV::TLVType containerType = TLV::kTLVType_Structure; ReturnErrorOnFailure(tlvReader.EnterContainer(containerType)); @@ -63,10 +61,10 @@ CHIP_ERROR PairingSession::DecodeMRPParametersIfPresent(TLV::ContiguousBufferTLV mMRPConfig.mIdleRetransTimeout = System::Clock::Milliseconds32(tlvElementValue); // The next element is optional. If it's not present, return CHIP_NO_ERROR. - err = tlvReader.Next(); + CHIP_ERROR err = tlvReader.Next(); if (err == CHIP_END_OF_TLV) { - return CHIP_NO_ERROR; + return tlvReader.ExitContainer(containerType); } ReturnErrorOnFailure(err); } diff --git a/src/transport/PairingSession.h b/src/transport/PairingSession.h index b0f4769de6af4d..27e69a1c6a6542 100644 --- a/src/transport/PairingSession.h +++ b/src/transport/PairingSession.h @@ -163,7 +163,7 @@ class DLL_EXPORT PairingSession } /** - * Try to decode the next element (pointed by the TLV reader) as MRP parameters. + * Try to decode the current element (pointed by the TLV reader) as MRP parameters. * If the MRP parameters are found, mMRPConfig is updated with the devoded values. * * MRP parameters are optional. So, if the TLV reader is not pointing to the MRP parameters, @@ -172,7 +172,7 @@ class DLL_EXPORT PairingSession * If the parameters are present, but TLV reader fails to correctly parse it, the function will * return the corresponding error. */ - CHIP_ERROR DecodeMRPParametersIfPresent(TLV::ContiguousBufferTLVReader & tlvReader); + CHIP_ERROR DecodeMRPParametersIfPresent(TLV::Tag expectedTag, TLV::ContiguousBufferTLVReader & tlvReader); // TODO: remove Clear, we should create a new instance instead reset the old instance. void Clear() diff --git a/src/transport/tests/TestPairingSession.cpp b/src/transport/tests/TestPairingSession.cpp index 7d7869805930f7..60cc82d41586fe 100644 --- a/src/transport/tests/TestPairingSession.cpp +++ b/src/transport/tests/TestPairingSession.cpp @@ -43,9 +43,9 @@ class TestPairingSession : public PairingSession public: CHIP_ERROR DeriveSecureSession(CryptoContext & session, CryptoContext::SessionRole role) override { return CHIP_NO_ERROR; } - CHIP_ERROR DecodeMRPParametersIfPresent(System::PacketBufferTLVReader & tlvReader) + CHIP_ERROR DecodeMRPParametersIfPresent(TLV::Tag expectedTag, System::PacketBufferTLVReader & tlvReader) { - return PairingSession::DecodeMRPParametersIfPresent(tlvReader); + return PairingSession::DecodeMRPParametersIfPresent(expectedTag, tlvReader); } }; @@ -62,8 +62,7 @@ void PairingSessionEncodeDecodeMRPParams(nlTestSuite * inSuite, void * inContext TLV::TLVType outerContainerType = TLV::kTLVType_NotSpecified; NL_TEST_ASSERT(inSuite, writer.StartContainer(TLV::AnonymousTag, TLV::kTLVType_Structure, outerContainerType) == CHIP_NO_ERROR); - CHIP_ERROR err = PairingSession::EncodeMRPParameters(TLV::ContextTag(1), config, writer); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, PairingSession::EncodeMRPParameters(TLV::ContextTag(1), config, writer) == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, writer.EndContainer(outerContainerType) == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, writer.Finalize(&buf) == CHIP_NO_ERROR); @@ -75,8 +74,8 @@ void PairingSessionEncodeDecodeMRPParams(nlTestSuite * inSuite, void * inContext NL_TEST_ASSERT(inSuite, reader.Next(containerType, TLV::AnonymousTag) == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, reader.EnterContainer(containerType) == CHIP_NO_ERROR); - err = session.DecodeMRPParametersIfPresent(reader); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, reader.Next() == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, session.DecodeMRPParametersIfPresent(TLV::ContextTag(1), reader) == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, session.GetMRPConfig().mIdleRetransTimeout == config.mIdleRetransTimeout); NL_TEST_ASSERT(inSuite, session.GetMRPConfig().mActiveRetransTimeout == config.mActiveRetransTimeout); @@ -92,6 +91,7 @@ void PairingSessionTryDecodeMissingMRPParams(nlTestSuite * inSuite, void * inCon TLV::TLVType outerContainerType = TLV::kTLVType_NotSpecified; NL_TEST_ASSERT(inSuite, writer.StartContainer(TLV::AnonymousTag, TLV::kTLVType_Structure, outerContainerType) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, writer.Put(TLV::ContextTag(1), static_cast(0x1234)) == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, writer.EndContainer(outerContainerType) == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, writer.Finalize(&buf) == CHIP_NO_ERROR); @@ -101,7 +101,8 @@ void PairingSessionTryDecodeMissingMRPParams(nlTestSuite * inSuite, void * inCon reader.Init(std::move(buf)); NL_TEST_ASSERT(inSuite, reader.Next(containerType, TLV::AnonymousTag) == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, reader.EnterContainer(containerType) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, session.DecodeMRPParametersIfPresent(reader) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, reader.Next() == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, session.DecodeMRPParametersIfPresent(TLV::ContextTag(2), reader) == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, session.GetMRPConfig().mIdleRetransTimeout == gDefaultMRPConfig.mIdleRetransTimeout); NL_TEST_ASSERT(inSuite, session.GetMRPConfig().mActiveRetransTimeout == gDefaultMRPConfig.mActiveRetransTimeout); From 45847078a27240a3e32fd342a53d4350ec7c9024 Mon Sep 17 00:00:00 2001 From: yunhanw-google Date: Wed, 8 Dec 2021 14:14:10 -0800 Subject: [PATCH 09/28] Cleanup IM (#12716) * Remove command.cpp and update the rest of codes * run codegen * deleting the ctor that takes non-const ref as arg in IM Builder --- .../ameba/main/DeviceCallbacks.cpp | 4 +- .../esp32/main/DeviceCallbacks.cpp | 4 +- examples/all-clusters-app/linux/main.cpp | 4 +- .../p6/src/ClusterManager.cpp | 2 +- .../ameba/main/DeviceCallbacks.cpp | 2 +- .../ota-provider-common/OTAProviderExample.h | 2 +- examples/thermostat/linux/main.cpp | 4 +- .../account-login/AccountLoginManager.cpp | 2 +- .../ApplicationBasicManager.cpp | 2 +- .../android/java/ContentLauncherManager.cpp | 1 - examples/tv-app/linux/AppImpl.cpp | 2 +- .../account-login/AccountLoginManager.cpp | 2 +- .../ApplicationBasicManager.cpp | 2 +- .../ContentLauncherManager.cpp | 1 - .../media-playback/MediaPlaybackManager.cpp | 2 +- examples/tv-app/linux/main.cpp | 4 +- src/app/BUILD.gn | 2 - src/app/Command.cpp | 121 ----------------- src/app/Command.h | 124 ------------------ src/app/CommandHandler.cpp | 111 +++++++++++++--- src/app/CommandHandler.h | 68 +++++++++- src/app/CommandSender.cpp | 114 +++++++++++++--- src/app/CommandSender.h | 58 +++++++- src/app/InteractionModelEngine.cpp | 3 - src/app/MessageDef/Builder.h | 2 + src/app/MessageDef/EventDataIB.cpp | 12 +- src/app/MessageDef/EventDataIB.h | 12 +- src/app/ReadClient.cpp | 2 +- src/app/WriteClient.cpp | 32 ++--- src/app/WriteHandler.cpp | 21 +-- src/app/tests/TestMessageDef.cpp | 2 +- src/app/tests/TestReadInteraction.cpp | 2 +- src/app/tests/TestReportingEngine.cpp | 12 +- src/app/util/ContentAppPlatform.cpp | 1 - .../util/ember-compatibility-functions.cpp | 32 ++++- src/app/util/ember-compatibility-functions.h | 5 +- src/app/util/im-client-callbacks.cpp | 3 +- src/app/util/im-client-callbacks.h | 4 +- .../app/CHIPClientCallbacks-src.zapt | 1 - .../templates/app/CHIPClientCallbacks.zapt | 1 - .../zap-templates/templates/app/callback.zapt | 1 - .../app/im-cluster-command-handler.zapt | 31 ++--- src/controller/CHIPDeviceController.cpp | 2 +- src/controller/tests/data_model/TestRead.cpp | 18 ++- .../zap-generated/CHIPClientCallbacks.cpp | 1 - .../zap-generated/CHIPClientCallbacks.h | 1 - .../zap-generated/IMClusterCommandHandler.cpp | 120 +++++++++++------ .../app-common/zap-generated/callback.h | 1 - .../zap-generated/IMClusterCommandHandler.cpp | 45 ++++--- .../zap-generated/CHIPClientCallbacks.cpp | 1 - .../zap-generated/CHIPClientCallbacks.h | 1 - .../zap-generated/IMClusterCommandHandler.cpp | 68 +--------- .../zap-generated/CHIPClientCallbacks.cpp | 1 - .../zap-generated/CHIPClientCallbacks.h | 1 - .../zap-generated/IMClusterCommandHandler.cpp | 72 ++++++---- .../zap-generated/IMClusterCommandHandler.cpp | 41 +++--- .../zap-generated/IMClusterCommandHandler.cpp | 33 +++-- .../zap-generated/CHIPClientCallbacks.cpp | 1 - .../zap-generated/CHIPClientCallbacks.h | 1 - .../zap-generated/IMClusterCommandHandler.cpp | 36 +++-- .../zap-generated/IMClusterCommandHandler.cpp | 49 ++++--- .../zap-generated/IMClusterCommandHandler.cpp | 45 ++++--- .../zap-generated/CHIPClientCallbacks.cpp | 1 - .../zap-generated/CHIPClientCallbacks.h | 1 - .../zap-generated/IMClusterCommandHandler.cpp | 49 ++++--- .../zap-generated/CHIPClientCallbacks.cpp | 1 - .../zap-generated/CHIPClientCallbacks.h | 1 - .../zap-generated/IMClusterCommandHandler.cpp | 41 +++--- .../zap-generated/IMClusterCommandHandler.cpp | 37 +++--- .../zap-generated/CHIPClientCallbacks.cpp | 1 - .../zap-generated/CHIPClientCallbacks.h | 1 - .../zap-generated/IMClusterCommandHandler.cpp | 68 ++++++---- .../zap-generated/CHIPClientCallbacks.cpp | 1 - .../zap-generated/CHIPClientCallbacks.h | 1 - .../zap-generated/IMClusterCommandHandler.cpp | 110 ++++++++++------ .../zap-generated/IMClusterCommandHandler.cpp | 89 ++++++++----- .../zap-generated/IMClusterCommandHandler.cpp | 41 +++--- 77 files changed, 929 insertions(+), 869 deletions(-) delete mode 100644 src/app/Command.cpp delete mode 100644 src/app/Command.h diff --git a/examples/all-clusters-app/ameba/main/DeviceCallbacks.cpp b/examples/all-clusters-app/ameba/main/DeviceCallbacks.cpp index 3860c772891b74..5ff6b6713d4ed3 100644 --- a/examples/all-clusters-app/ameba/main/DeviceCallbacks.cpp +++ b/examples/all-clusters-app/ameba/main/DeviceCallbacks.cpp @@ -27,7 +27,7 @@ #include "CHIPDeviceManager.h" #include #include -#include +#include #include #include #include @@ -161,7 +161,7 @@ void DeviceCallbacks::OnIdentifyPostAttributeChangeCallback(EndpointId endpointI return; } -bool emberAfBasicClusterMfgSpecificPingCallback(chip::app::Command * commandObj) +bool emberAfBasicClusterMfgSpecificPingCallback(chip::app::CommandHandler * commandObj) { emberAfSendDefaultResponse(emberAfCurrentCommand(), EMBER_ZCL_STATUS_SUCCESS); return true; diff --git a/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp b/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp index edccd2b899e960..a32f077e21cfc0 100644 --- a/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp +++ b/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp @@ -35,7 +35,7 @@ #include "route_hook/esp_route_hook.h" #include #include -#include +#include #include #include #include @@ -254,7 +254,7 @@ void DeviceCallbacks::OnColorControlAttributeChangeCallback(EndpointId endpointI } #endif -bool emberAfBasicClusterMfgSpecificPingCallback(chip::app::Command * commandObj) +bool emberAfBasicClusterMfgSpecificPingCallback(chip::app::CommandHandler * commandObj) { emberAfSendDefaultResponse(emberAfCurrentCommand(), EMBER_ZCL_STATUS_SUCCESS); return true; diff --git a/examples/all-clusters-app/linux/main.cpp b/examples/all-clusters-app/linux/main.cpp index 4c3048e3225a71..3c8d5faa5a8e39 100644 --- a/examples/all-clusters-app/linux/main.cpp +++ b/examples/all-clusters-app/linux/main.cpp @@ -16,13 +16,13 @@ * limitations under the License. */ -#include +#include #include #include #include "AppMain.h" -bool emberAfBasicClusterMfgSpecificPingCallback(chip::app::Command * commandObj) +bool emberAfBasicClusterMfgSpecificPingCallback(chip::app::CommandHandler * commandObj) { emberAfSendDefaultResponse(emberAfCurrentCommand(), EMBER_ZCL_STATUS_SUCCESS); return true; diff --git a/examples/all-clusters-app/p6/src/ClusterManager.cpp b/examples/all-clusters-app/p6/src/ClusterManager.cpp index 9a0f2fcd8afbb8..4d550f8c4fdaf8 100644 --- a/examples/all-clusters-app/p6/src/ClusterManager.cpp +++ b/examples/all-clusters-app/p6/src/ClusterManager.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/examples/lighting-app/ameba/main/DeviceCallbacks.cpp b/examples/lighting-app/ameba/main/DeviceCallbacks.cpp index c51bfb33670e18..8f5e45b8dfc882 100755 --- a/examples/lighting-app/ameba/main/DeviceCallbacks.cpp +++ b/examples/lighting-app/ameba/main/DeviceCallbacks.cpp @@ -27,7 +27,7 @@ #include "CHIPDeviceManager.h" #include #include -#include +#include #include #include #include diff --git a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.h b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.h index 64027d56420f52..3a7fdcf5c7e0c5 100644 --- a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.h +++ b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.h @@ -18,7 +18,7 @@ #pragma once -#include +#include #include /** diff --git a/examples/thermostat/linux/main.cpp b/examples/thermostat/linux/main.cpp index a5185b11d4f0d7..8ad5cb5033d1af 100644 --- a/examples/thermostat/linux/main.cpp +++ b/examples/thermostat/linux/main.cpp @@ -19,7 +19,7 @@ #include "AppMain.h" #include #include -#include +#include #include #include @@ -27,7 +27,7 @@ using namespace chip; using namespace chip::app; // using namespace chip::app::Clusters; -bool emberAfBasicClusterMfgSpecificPingCallback(chip::app::Command * commandObj) +bool emberAfBasicClusterMfgSpecificPingCallback(chip::app::CommandHandler * commandObj) { emberAfSendDefaultResponse(emberAfCurrentCommand(), EMBER_ZCL_STATUS_SUCCESS); return true; diff --git a/examples/tv-app/android/include/account-login/AccountLoginManager.cpp b/examples/tv-app/android/include/account-login/AccountLoginManager.cpp index f599b71645b8cc..76975580ebc747 100644 --- a/examples/tv-app/android/include/account-login/AccountLoginManager.cpp +++ b/examples/tv-app/android/include/account-login/AccountLoginManager.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include using namespace std; diff --git a/examples/tv-app/android/include/application-basic/ApplicationBasicManager.cpp b/examples/tv-app/android/include/application-basic/ApplicationBasicManager.cpp index 6c6a1d7f9be7b4..5a1c21e4074268 100644 --- a/examples/tv-app/android/include/application-basic/ApplicationBasicManager.cpp +++ b/examples/tv-app/android/include/application-basic/ApplicationBasicManager.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/examples/tv-app/android/java/ContentLauncherManager.cpp b/examples/tv-app/android/java/ContentLauncherManager.cpp index c44a56e7160618..c84cbcc6a6fc75 100644 --- a/examples/tv-app/android/java/ContentLauncherManager.cpp +++ b/examples/tv-app/android/java/ContentLauncherManager.cpp @@ -25,7 +25,6 @@ #include #include -#include #include #include #include diff --git a/examples/tv-app/linux/AppImpl.cpp b/examples/tv-app/linux/AppImpl.cpp index b652642fe1af13..6faf926dd77b17 100644 --- a/examples/tv-app/linux/AppImpl.cpp +++ b/examples/tv-app/linux/AppImpl.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/examples/tv-app/linux/include/account-login/AccountLoginManager.cpp b/examples/tv-app/linux/include/account-login/AccountLoginManager.cpp index f599b71645b8cc..76975580ebc747 100644 --- a/examples/tv-app/linux/include/account-login/AccountLoginManager.cpp +++ b/examples/tv-app/linux/include/account-login/AccountLoginManager.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include using namespace std; diff --git a/examples/tv-app/linux/include/application-basic/ApplicationBasicManager.cpp b/examples/tv-app/linux/include/application-basic/ApplicationBasicManager.cpp index 35c9f712ad4b67..0bdcc220c5dc84 100644 --- a/examples/tv-app/linux/include/application-basic/ApplicationBasicManager.cpp +++ b/examples/tv-app/linux/include/application-basic/ApplicationBasicManager.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp b/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp index 7e670ddd2cd0cb..87ffd6d9a97410 100644 --- a/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp +++ b/examples/tv-app/linux/include/content-launcher/ContentLauncherManager.cpp @@ -24,7 +24,6 @@ #include #include -#include #include #include #include diff --git a/examples/tv-app/linux/include/media-playback/MediaPlaybackManager.cpp b/examples/tv-app/linux/include/media-playback/MediaPlaybackManager.cpp index 3146f0c3d79036..28dcf54a00c8c0 100644 --- a/examples/tv-app/linux/include/media-playback/MediaPlaybackManager.cpp +++ b/examples/tv-app/linux/include/media-playback/MediaPlaybackManager.cpp @@ -16,7 +16,7 @@ */ #include "MediaPlaybackManager.h" -#include +#include #include #include diff --git a/examples/tv-app/linux/main.cpp b/examples/tv-app/linux/main.cpp index 73433186f7a2b0..35ca1a8d5fabf2 100644 --- a/examples/tv-app/linux/main.cpp +++ b/examples/tv-app/linux/main.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include @@ -46,7 +46,7 @@ using namespace chip::Transport; using namespace chip::DeviceLayer; using namespace chip::AppPlatform; -bool emberAfBasicClusterMfgSpecificPingCallback(chip::app::Command * commandObj) +bool emberAfBasicClusterMfgSpecificPingCallback(chip::app::CommandHandler * commandObj) { emberAfSendDefaultResponse(emberAfCurrentCommand(), EMBER_ZCL_STATUS_SUCCESS); return true; diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index 60ff26ea660c86..f159ae54470ce4 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -45,8 +45,6 @@ static_library("app") { "CASEClientPool.h", "CASESessionManager.cpp", "CASESessionManager.h", - "Command.cpp", - "Command.h", "CommandHandler.cpp", "CommandSender.cpp", "DeviceProxy.cpp", diff --git a/src/app/Command.cpp b/src/app/Command.cpp deleted file mode 100644 index b73c074c6ac8a2..00000000000000 --- a/src/app/Command.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * - * Copyright (c) 2020-2021 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * This file defines Base class for a CHIP IM Command - * - */ - -#include "Command.h" -#include -#include - -namespace chip { -namespace app { - -Command::Command() {} - -CHIP_ERROR Command::Finalize(System::PacketBufferHandle & commandPacket) -{ - VerifyOrReturnError(mState == CommandState::AddedCommand, CHIP_ERROR_INCORRECT_STATE); - return mCommandMessageWriter.Finalize(&commandPacket); -} - -void Command::Abort() -{ - // - // If the exchange context hasn't already been gracefully closed - // (signaled by setting it to null), then we need to forcibly - // tear it down. - // - if (mpExchangeCtx != nullptr) - { - // We (or more precisely our subclass) might be a delegate for this - // exchange, and we don't want the OnExchangeClosing notification in - // that case. Null out the delegate to avoid that. - // - // TODO: This makes all sorts of assumptions about what the delegate is - // (notice the "might" above!) that might not hold in practice. We - // really need a better solution here.... - mpExchangeCtx->SetDelegate(nullptr); - mpExchangeCtx->Abort(); - mpExchangeCtx = nullptr; - } -} - -void Command::Close() -{ - // - // Shortly after this call to close and when handling an inbound message, it's entirely possible - // for this object (courtesy of its derived class) to be destroyed - // *before* the call unwinds all the way back to ExchangeContext::HandleMessage. - // - // As part of tearing down the exchange, there is logic there to invoke the delegate to notify - // it of impending closure - which is this object, which just got destroyed! - // - // So prevent a use-after-free, set delegate to null. - // - // For more details, see #10344. - // - if (mpExchangeCtx != nullptr) - { - mpExchangeCtx->SetDelegate(nullptr); - } - - mpExchangeCtx = nullptr; -} - -const char * Command::GetStateStr() const -{ -#if CHIP_DETAIL_LOGGING - switch (mState) - { - case CommandState::Idle: - return "Idle"; - - case CommandState::AddingCommand: - return "AddingCommand"; - - case CommandState::AddedCommand: - return "AddedCommand"; - - case CommandState::AwaitingTimedStatus: - return "AwaitingTimedStatus"; - - case CommandState::CommandSent: - return "CommandSent"; - - case CommandState::ResponseReceived: - return "ResponseReceived"; - - case CommandState::AwaitingDestruction: - return "AwaitingDestruction"; - } -#endif // CHIP_DETAIL_LOGGING - return "N/A"; -} - -void Command::MoveToState(const CommandState aTargetState) -{ - mState = aTargetState; - ChipLogDetail(DataManagement, "ICR moving to [%10.10s]", GetStateStr()); -} - -} // namespace app -} // namespace chip diff --git a/src/app/Command.h b/src/app/Command.h deleted file mode 100644 index 9fbeff757fcc4a..00000000000000 --- a/src/app/Command.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * - * Copyright (c) 2020-2021 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * This file defines Base class for a CHIP IM Command - * - */ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace chip { -namespace app { - -class Command -{ -public: - enum class CommandState - { - Idle, ///< Default state that the object starts out in, where no work has commenced - AddingCommand, ///< In the process of adding a command. - AddedCommand, ///< A command has been completely encoded and is awaiting transmission. - AwaitingTimedStatus, ///< Sent a Timed Request and waiting for response. - CommandSent, ///< The command has been sent successfully. - ResponseReceived, ///< Received a response to our invoke and request and processing the response. - AwaitingDestruction, ///< The object has completed its work and is awaiting destruction by the application. - }; - - /* - * Destructor - as part of destruction, it will abort the exchange context - * if a valid one still exists. - * - * See Abort() for details on when that might occur. - */ - virtual ~Command() { Abort(); } - - CHIP_ERROR Finalize(System::PacketBufferHandle & commandPacket); - - virtual CHIP_ERROR AddStatus(const ConcreteCommandPath & aCommandPath, const Protocols::InteractionModel::Status aStatus) - { - return CHIP_ERROR_NOT_IMPLEMENTED; - } - - virtual CHIP_ERROR AddClusterSpecificSuccess(const ConcreteCommandPath & aCommandPath, ClusterStatus aClusterStatus) - { - return CHIP_ERROR_NOT_IMPLEMENTED; - } - - virtual CHIP_ERROR AddClusterSpecificFailure(const ConcreteCommandPath & aCommandPath, ClusterStatus aClusterStatus) - { - return CHIP_ERROR_NOT_IMPLEMENTED; - } - - /** - * Gets the inner exchange context object, without ownership. - * - * @return The inner exchange context, might be nullptr if no - * exchange context has been assigned or the context - * has been released. - */ - Messaging::ExchangeContext * GetExchangeContext() const { return mpExchangeCtx; } - -protected: - Command(); - - /* - * The actual closure of the exchange happens automatically in the exchange layer. - * This function just sets the internally tracked exchange pointer to null to align - * with the exchange layer so as to prevent further closure if Abort() is called later. - */ - void Close(); - - void MoveToState(const CommandState aTargetState); - const char * GetStateStr() const; - - Messaging::ExchangeContext * mpExchangeCtx = nullptr; - uint8_t mCommandIndex = 0; - CommandState mState = CommandState::Idle; - chip::System::PacketBufferTLVWriter mCommandMessageWriter; - bool mBufferAllocated = false; - -private: - /* - * This forcibly closes the exchange context if a valid one is pointed to. Such a situation does - * not arise during normal message processing flows that all normally call Close() above. This can only - * arise due to application-initiated destruction of the object when this object is handling receiving/sending - * message payloads. - */ - void Abort(); - - friend class TestCommandInteraction; -}; -} // namespace app -} // namespace chip diff --git a/src/app/CommandHandler.cpp b/src/app/CommandHandler.cpp index 913969adec9e1a..5ed3abd1f74a7e 100644 --- a/src/app/CommandHandler.cpp +++ b/src/app/CommandHandler.cpp @@ -23,8 +23,6 @@ */ #include "CommandHandler.h" -#include "Command.h" -#include "CommandSender.h" #include "InteractionModelEngine.h" #include "messaging/ExchangeContext.h" @@ -54,8 +52,6 @@ CHIP_ERROR CommandHandler::AllocateBuffer() mInvokeResponseBuilder.CreateInvokeResponses(); ReturnErrorOnFailure(mInvokeResponseBuilder.GetError()); - - mCommandIndex = 0; mBufferAllocated = true; } @@ -66,7 +62,7 @@ CHIP_ERROR CommandHandler::OnInvokeCommandRequest(Messaging::ExchangeContext * e System::PacketBufferHandle && payload, bool isTimedInvoke) { System::PacketBufferHandle response; - VerifyOrReturnError(mState == CommandState::Idle, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(mState == State::Idle, CHIP_ERROR_INCORRECT_STATE); // NOTE: we already know this is an InvokeCommand Request message because we explicitly registered with the // Exchange Manager for unsolicited InvokeCommand Requests. @@ -144,7 +140,7 @@ CHIP_ERROR CommandHandler::ProcessInvokeRequest(System::PacketBufferHandle && pa void CommandHandler::Close() { mSuppressResponse = false; - MoveToState(CommandState::AwaitingDestruction); + MoveToState(State::AwaitingDestruction); // We must finish all async work before we can shut down a CommandHandler. The actual CommandHandler MUST finish their work // in reasonable time or there is a bug. The only case for releasing CommandHandler without CommandHandler::Handle releasing its @@ -152,7 +148,24 @@ void CommandHandler::Close() VerifyOrDieWithMsg(mPendingWork == 0, DataManagement, "CommandHandler::Close() called with %zu unfinished async work items", mPendingWork); - Command::Close(); + // + // Shortly after this call to close and when handling an inbound message, it's entirely possible + // for this object (courtesy of its derived class) to be destroyed + // *before* the call unwinds all the way back to ExchangeContext::HandleMessage. + // + // As part of tearing down the exchange, there is logic there to invoke the delegate to notify + // it of impending closure - which is this object, which just got destroyed! + // + // So prevent a use-after-free, set delegate to null. + // + // For more details, see #10344. + // + if (mpExchangeCtx != nullptr) + { + mpExchangeCtx->SetDelegate(nullptr); + } + + mpExchangeCtx = nullptr; if (mpCallback) { @@ -197,7 +210,7 @@ CHIP_ERROR CommandHandler::SendCommandResponse() System::PacketBufferHandle commandPacket; VerifyOrReturnError(mPendingWork == 0, CHIP_ERROR_INCORRECT_STATE); - VerifyOrReturnError(mState == CommandState::AddedCommand, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(mState == State::AddedCommand, CHIP_ERROR_INCORRECT_STATE); VerifyOrReturnError(mpExchangeCtx != nullptr, CHIP_ERROR_INCORRECT_STATE); ReturnErrorOnFailure(Finalize(commandPacket)); @@ -206,7 +219,7 @@ CHIP_ERROR CommandHandler::SendCommandResponse() // The ExchangeContext is automatically freed here, and it makes mpExchangeCtx be temporarily dangling, but in // all cases, we are going to call Close immediately after this function, which nulls out mpExchangeCtx. - MoveToState(CommandState::CommandSent); + MoveToState(State::CommandSent); return CHIP_NO_ERROR; } @@ -332,7 +345,7 @@ CHIP_ERROR CommandHandler::PrepareCommand(const ConcreteCommandPath & aCommandPa // // We must not be in the middle of preparing a command, or having prepared or sent one. // - VerifyOrReturnError(mState == CommandState::Idle, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(mState == State::Idle, CHIP_ERROR_INCORRECT_STATE); InvokeResponseIBs::Builder & invokeResponses = mInvokeResponseBuilder.GetInvokeResponses(); InvokeResponseIB::Builder & invokeResponse = invokeResponses.CreateInvokeResponse(); ReturnErrorOnFailure(invokeResponses.GetError()); @@ -347,14 +360,14 @@ CHIP_ERROR CommandHandler::PrepareCommand(const ConcreteCommandPath & aCommandPa ReturnErrorOnFailure(commandData.GetWriter()->StartContainer(TLV::ContextTag(to_underlying(CommandDataIB::Tag::kData)), TLV::kTLVType_Structure, mDataElementContainerType)); } - MoveToState(CommandState::AddingCommand); + MoveToState(State::AddingCommand); return CHIP_NO_ERROR; } CHIP_ERROR CommandHandler::FinishCommand(bool aStartDataStruct) { - VerifyOrReturnError(mState == CommandState::AddingCommand, CHIP_ERROR_INCORRECT_STATE); - CommandDataIB::Builder commandData = mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetCommand(); + VerifyOrReturnError(mState == State::AddingCommand, CHIP_ERROR_INCORRECT_STATE); + CommandDataIB::Builder & commandData = mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetCommand(); if (aStartDataStruct) { ReturnErrorOnFailure(commandData.GetWriter()->EndContainer(mDataElementContainerType)); @@ -363,7 +376,7 @@ CHIP_ERROR CommandHandler::FinishCommand(bool aStartDataStruct) ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().EndOfInvokeResponseIB().GetError()); ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().EndOfInvokeResponses().GetError()); ReturnErrorOnFailure(mInvokeResponseBuilder.EndOfInvokeResponseMessage().GetError()); - MoveToState(CommandState::AddedCommand); + MoveToState(State::AddedCommand); return CHIP_NO_ERROR; } @@ -373,7 +386,7 @@ CHIP_ERROR CommandHandler::PrepareStatus(const ConcreteCommandPath & aCommandPat // // We must not be in the middle of preparing a command, or having prepared or sent one. // - VerifyOrReturnError(mState == CommandState::Idle, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(mState == State::Idle, CHIP_ERROR_INCORRECT_STATE); InvokeResponseIBs::Builder & invokeResponses = mInvokeResponseBuilder.GetInvokeResponses(); InvokeResponseIB::Builder & invokeResponse = invokeResponses.CreateInvokeResponse(); ReturnErrorOnFailure(invokeResponses.GetError()); @@ -382,25 +395,25 @@ CHIP_ERROR CommandHandler::PrepareStatus(const ConcreteCommandPath & aCommandPat CommandPathIB::Builder & path = commandStatus.CreatePath(); ReturnErrorOnFailure(commandStatus.GetError()); ReturnErrorOnFailure(path.Encode(aCommandPath)); - MoveToState(CommandState::AddingCommand); + MoveToState(State::AddingCommand); return CHIP_NO_ERROR; } CHIP_ERROR CommandHandler::FinishStatus() { - VerifyOrReturnError(mState == CommandState::AddingCommand, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(mState == State::AddingCommand, CHIP_ERROR_INCORRECT_STATE); ReturnErrorOnFailure( mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().GetStatus().EndOfCommandStatusIB().GetError()); ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().GetInvokeResponse().EndOfInvokeResponseIB().GetError()); ReturnErrorOnFailure(mInvokeResponseBuilder.GetInvokeResponses().EndOfInvokeResponses().GetError()); ReturnErrorOnFailure(mInvokeResponseBuilder.EndOfInvokeResponseMessage().GetError()); - MoveToState(CommandState::AddedCommand); + MoveToState(State::AddedCommand); return CHIP_NO_ERROR; } TLV::TLVWriter * CommandHandler::GetCommandDataIBTLVWriter() { - if (mState != CommandState::AddingCommand) + if (mState != State::AddingCommand) { return nullptr; } @@ -443,6 +456,66 @@ CommandHandler::Handle::Handle(CommandHandler * handle) } } +CHIP_ERROR CommandHandler::Finalize(System::PacketBufferHandle & commandPacket) +{ + VerifyOrReturnError(mState == State::AddedCommand, CHIP_ERROR_INCORRECT_STATE); + return mCommandMessageWriter.Finalize(&commandPacket); +} + +const char * CommandHandler::GetStateStr() const +{ +#if CHIP_DETAIL_LOGGING + switch (mState) + { + case State::Idle: + return "Idle"; + + case State::AddingCommand: + return "AddingCommand"; + + case State::AddedCommand: + return "AddedCommand"; + + case State::AwaitingTimedStatus: + return "AwaitingTimedStatus"; + + case State::CommandSent: + return "CommandSent"; + + case State::AwaitingDestruction: + return "AwaitingDestruction"; + } +#endif // CHIP_DETAIL_LOGGING + return "N/A"; +} + +void CommandHandler::MoveToState(const State aTargetState) +{ + mState = aTargetState; + ChipLogDetail(DataManagement, "ICR moving to [%10.10s]", GetStateStr()); +} + +void CommandHandler::Abort() +{ + // + // If the exchange context hasn't already been gracefully closed + // (signaled by setting it to null), then we need to forcibly + // tear it down. + // + if (mpExchangeCtx != nullptr) + { + // We (or more precisely our subclass) might be a delegate for this + // exchange, and we don't want the OnExchangeClosing notification in + // that case. Null out the delegate to avoid that. + // + // TODO: This makes all sorts of assumptions about what the delegate is + // (notice the "might" above!) that might not hold in practice. We + // really need a better solution here.... + mpExchangeCtx->SetDelegate(nullptr); + mpExchangeCtx->Abort(); + mpExchangeCtx = nullptr; + } +} } // namespace app } // namespace chip diff --git a/src/app/CommandHandler.h b/src/app/CommandHandler.h index 97bb39b3fffa62..6cc3ff194e8ce6 100644 --- a/src/app/CommandHandler.h +++ b/src/app/CommandHandler.h @@ -24,12 +24,13 @@ #pragma once -#include #include +#include #include #include #include #include +#include #include #include #include @@ -37,6 +38,7 @@ #include #include #include +#include #include #include @@ -44,9 +46,16 @@ namespace chip { namespace app { -class CommandHandler : public Command +class CommandHandler { public: + /* + * Destructor - as part of destruction, it will abort the exchange context + * if a valid one still exists. + * + * See Abort() for details on when that might occur. + */ + virtual ~CommandHandler() { Abort(); } class Callback { public: @@ -135,11 +144,11 @@ class CommandHandler : public Command */ CHIP_ERROR OnInvokeCommandRequest(Messaging::ExchangeContext * ec, const PayloadHeader & payloadHeader, System::PacketBufferHandle && payload, bool isTimedInvoke); - CHIP_ERROR AddStatus(const ConcreteCommandPath & aCommandPath, const Protocols::InteractionModel::Status aStatus) override; + CHIP_ERROR AddStatus(const ConcreteCommandPath & aCommandPath, const Protocols::InteractionModel::Status aStatus); - CHIP_ERROR AddClusterSpecificSuccess(const ConcreteCommandPath & aCommandPath, ClusterStatus aClusterStatus) override; + CHIP_ERROR AddClusterSpecificSuccess(const ConcreteCommandPath & aCommandPath, ClusterStatus aClusterStatus); - CHIP_ERROR AddClusterSpecificFailure(const ConcreteCommandPath & aCommandPath, ClusterStatus aClusterStatus) override; + CHIP_ERROR AddClusterSpecificFailure(const ConcreteCommandPath & aCommandPath, ClusterStatus aClusterStatus); CHIP_ERROR ProcessInvokeRequest(System::PacketBufferHandle && payload, bool isTimedInvoke); CHIP_ERROR PrepareCommand(const ConcreteCommandPath & aCommandPath, bool aStartDataStruct = true); @@ -176,10 +185,50 @@ class CommandHandler : public Command */ bool IsTimedInvoke() const { return mTimedRequest; } + enum class CommandState + { + Idle, ///< Default state that the object starts out in, where no work has commenced + AddingCommand, ///< In the process of adding a command. + AddedCommand, ///< A command has been completely encoded and is awaiting transmission. + AwaitingTimedStatus, ///< Sent a Timed Request and waiting for response. + CommandSent, ///< The command has been sent successfully. + ResponseReceived, ///< Received a response to our invoke and request and processing the response. + AwaitingDestruction, ///< The object has completed its work and is awaiting destruction by the application. + }; + + /* + * This forcibly closes the exchange context if a valid one is pointed to. Such a situation does + * not arise during normal message processing flows that all normally call Close() above. This can only + * arise due to application-initiated destruction of the object when this object is handling receiving/sending + * message payloads. + */ + void Abort(); + + /** + * Gets the inner exchange context object, without ownership. + * + * @return The inner exchange context, might be nullptr if no + * exchange context has been assigned or the context + * has been released. + */ + Messaging::ExchangeContext * GetExchangeContext() const { return mpExchangeCtx; } + private: friend class TestCommandInteraction; friend class CommandHandler::Handle; + enum class State + { + Idle, ///< Default state that the object starts out in, where no work has commenced + AddingCommand, ///< In the process of adding a command. + AddedCommand, ///< A command has been completely encoded and is awaiting transmission. + AwaitingTimedStatus, ///< Sent a Timed Request and waiting for response. + CommandSent, ///< The command has been sent successfully. + AwaitingDestruction, ///< The object has completed its work and is awaiting destruction by the application. + }; + + void MoveToState(const State aTargetState); + const char * GetStateStr() const; /** * IncrementHoldOff will increase the inner refcount of the CommandHandler. * @@ -202,6 +251,8 @@ class CommandHandler : public Command */ CHIP_ERROR AllocateBuffer(); + CHIP_ERROR Finalize(System::PacketBufferHandle & commandPacket); + /** * Called internally to signal the completion of all work on this object, gracefully close the * exchange (by calling into the base class) and finally, signal to a registerd callback that it's @@ -214,12 +265,17 @@ class CommandHandler : public Command CHIP_ERROR AddStatusInternal(const ConcreteCommandPath & aCommandPath, const Protocols::InteractionModel::Status aStatus, const Optional & aClusterStatus); - Callback * mpCallback = nullptr; + Messaging::ExchangeContext * mpExchangeCtx = nullptr; + Callback * mpCallback = nullptr; InvokeResponseMessage::Builder mInvokeResponseBuilder; TLV::TLVType mDataElementContainerType = TLV::kTLVType_NotSpecified; size_t mPendingWork = 0; bool mSuppressResponse = false; bool mTimedRequest = false; + + State mState = State::Idle; + chip::System::PacketBufferTLVWriter mCommandMessageWriter; + bool mBufferAllocated = false; }; } // namespace app diff --git a/src/app/CommandSender.cpp b/src/app/CommandSender.cpp index 49afe08e0a8fe2..ca8ab54035ebe7 100644 --- a/src/app/CommandSender.cpp +++ b/src/app/CommandSender.cpp @@ -23,8 +23,6 @@ */ #include "CommandSender.h" -#include "Command.h" -#include "CommandHandler.h" #include "InteractionModelEngine.h" #include "StatusResponse.h" #include @@ -56,7 +54,6 @@ CHIP_ERROR CommandSender::AllocateBuffer() mInvokeRequestBuilder.CreateInvokeRequests(); ReturnErrorOnFailure(mInvokeRequestBuilder.GetError()); - mCommandIndex = 0; mBufferAllocated = true; } @@ -65,7 +62,7 @@ CHIP_ERROR CommandSender::AllocateBuffer() CHIP_ERROR CommandSender::SendCommandRequest(SessionHandle session, System::Clock::Timeout timeout) { - VerifyOrReturnError(mState == CommandState::AddedCommand, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(mState == State::AddedCommand, CHIP_ERROR_INCORRECT_STATE); ReturnErrorOnFailure(Finalize(mPendingInvokeData)); @@ -78,7 +75,7 @@ CHIP_ERROR CommandSender::SendCommandRequest(SessionHandle session, System::Cloc if (mTimedInvokeTimeoutMs.HasValue()) { ReturnErrorOnFailure(TimedRequest::Send(mpExchangeCtx, mTimedInvokeTimeoutMs.Value())); - MoveToState(CommandState::AwaitingTimedStatus); + MoveToState(State::AwaitingTimedStatus); return CHIP_NO_ERROR; } @@ -92,7 +89,7 @@ CHIP_ERROR CommandSender::SendInvokeRequest() ReturnErrorOnFailure(mpExchangeCtx->SendMessage(MsgType::InvokeCommandRequest, std::move(mPendingInvokeData), SendMessageFlags::kExpectResponse)); - MoveToState(CommandState::CommandSent); + MoveToState(State::CommandSent); return CHIP_NO_ERROR; } @@ -100,16 +97,16 @@ CHIP_ERROR CommandSender::SendInvokeRequest() CHIP_ERROR CommandSender::OnMessageReceived(Messaging::ExchangeContext * apExchangeContext, const PayloadHeader & aPayloadHeader, System::PacketBufferHandle && aPayload) { - if (mState == CommandState::CommandSent) + if (mState == State::CommandSent) { - MoveToState(CommandState::ResponseReceived); + MoveToState(State::ResponseReceived); } CHIP_ERROR err = CHIP_NO_ERROR; StatusIB status(Protocols::InteractionModel::Status::Failure); VerifyOrExit(apExchangeContext == mpExchangeCtx, err = CHIP_ERROR_INCORRECT_STATE); - if (mState == CommandState::AwaitingTimedStatus) + if (mState == State::AwaitingTimedStatus) { err = HandleTimedStatus(aPayloadHeader, std::move(aPayload), status); // Skip all other processing here (which is for the response to the @@ -142,7 +139,7 @@ CHIP_ERROR CommandSender::OnMessageReceived(Messaging::ExchangeContext * apExcha } } - if (mState != CommandState::CommandSent) + if (mState != State::CommandSent) { Close(); } @@ -207,9 +204,26 @@ void CommandSender::Close() { mSuppressResponse = false; mTimedRequest = false; - MoveToState(CommandState::AwaitingDestruction); + MoveToState(State::AwaitingDestruction); - Command::Close(); + // + // Shortly after this call to close and when handling an inbound message, it's entirely possible + // for this object (courtesy of its derived class) to be destroyed + // *before* the call unwinds all the way back to ExchangeContext::HandleMessage. + // + // As part of tearing down the exchange, there is logic there to invoke the delegate to notify + // it of impending closure - which is this object, which just got destroyed! + // + // So prevent a use-after-free, set delegate to null. + // + // For more details, see #10344. + // + if (mpExchangeCtx != nullptr) + { + mpExchangeCtx->SetDelegate(nullptr); + } + + mpExchangeCtx = nullptr; if (mpCallback) { @@ -305,7 +319,7 @@ CHIP_ERROR CommandSender::PrepareCommand(const CommandPathParams & aCommandPathP // // We must not be in the middle of preparing a command, or having prepared or sent one. // - VerifyOrReturnError(mState == CommandState::Idle, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(mState == State::Idle, CHIP_ERROR_INCORRECT_STATE); InvokeRequests::Builder & invokeRequests = mInvokeRequestBuilder.GetInvokeRequests(); CommandDataIB::Builder & invokeRequest = invokeRequests.CreateCommandData(); ReturnErrorOnFailure(invokeRequests.GetError()); @@ -319,7 +333,7 @@ CHIP_ERROR CommandSender::PrepareCommand(const CommandPathParams & aCommandPathP TLV::kTLVType_Structure, mDataElementContainerType)); } - MoveToState(CommandState::AddingCommand); + MoveToState(State::AddingCommand); return CHIP_NO_ERROR; } @@ -327,9 +341,9 @@ CHIP_ERROR CommandSender::FinishCommand(bool aEndDataStruct) { CHIP_ERROR err = CHIP_NO_ERROR; - VerifyOrReturnError(mState == CommandState::AddingCommand, err = CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(mState == State::AddingCommand, err = CHIP_ERROR_INCORRECT_STATE); - CommandDataIB::Builder commandData = mInvokeRequestBuilder.GetInvokeRequests().GetCommandData(); + CommandDataIB::Builder & commandData = mInvokeRequestBuilder.GetInvokeRequests().GetCommandData(); if (aEndDataStruct) { @@ -340,14 +354,14 @@ CHIP_ERROR CommandSender::FinishCommand(bool aEndDataStruct) ReturnErrorOnFailure(mInvokeRequestBuilder.GetInvokeRequests().EndOfInvokeRequests().GetError()); ReturnErrorOnFailure(mInvokeRequestBuilder.EndOfInvokeRequestMessage().GetError()); - MoveToState(CommandState::AddedCommand); + MoveToState(State::AddedCommand); return CHIP_NO_ERROR; } TLV::TLVWriter * CommandSender::GetCommandDataIBTLVWriter() { - if (mState != CommandState::AddingCommand) + if (mState != State::AddingCommand) { return nullptr; } @@ -380,5 +394,69 @@ CHIP_ERROR CommandSender::FinishCommand(const Optional & aTimedInvokeT return CHIP_NO_ERROR; } +CHIP_ERROR CommandSender::Finalize(System::PacketBufferHandle & commandPacket) +{ + VerifyOrReturnError(mState == State::AddedCommand, CHIP_ERROR_INCORRECT_STATE); + return mCommandMessageWriter.Finalize(&commandPacket); +} + +const char * CommandSender::GetStateStr() const +{ +#if CHIP_DETAIL_LOGGING + switch (mState) + { + case State::Idle: + return "Idle"; + + case State::AddingCommand: + return "AddingCommand"; + + case State::AddedCommand: + return "AddedCommand"; + + case State::AwaitingTimedStatus: + return "AwaitingTimedStatus"; + + case State::CommandSent: + return "CommandSent"; + + case State::ResponseReceived: + return "ResponseReceived"; + + case State::AwaitingDestruction: + return "AwaitingDestruction"; + } +#endif // CHIP_DETAIL_LOGGING + return "N/A"; +} + +void CommandSender::MoveToState(const State aTargetState) +{ + mState = aTargetState; + ChipLogDetail(DataManagement, "ICR moving to [%10.10s]", GetStateStr()); +} + +void CommandSender::Abort() +{ + // + // If the exchange context hasn't already been gracefully closed + // (signaled by setting it to null), then we need to forcibly + // tear it down. + // + if (mpExchangeCtx != nullptr) + { + // We (or more precisely our subclass) might be a delegate for this + // exchange, and we don't want the OnExchangeClosing notification in + // that case. Null out the delegate to avoid that. + // + // TODO: This makes all sorts of assumptions about what the delegate is + // (notice the "might" above!) that might not hold in practice. We + // really need a better solution here.... + mpExchangeCtx->SetDelegate(nullptr); + mpExchangeCtx->Abort(); + mpExchangeCtx = nullptr; + } +} + } // namespace app } // namespace chip diff --git a/src/app/CommandSender.h b/src/app/CommandSender.h index 1ed1c7a9cfa05f..496e1c28cd98b3 100644 --- a/src/app/CommandSender.h +++ b/src/app/CommandSender.h @@ -26,11 +26,16 @@ #include +#include +#include +#include +#include #include #include #include #include #include +#include #include #include #include @@ -39,19 +44,33 @@ #include #include #include - -#include -#include -#include +#include #define COMMON_STATUS_SUCCESS 0 namespace chip { namespace app { -class CommandSender final : public Command, public Messaging::ExchangeDelegate +class CommandSender final : public Messaging::ExchangeDelegate { public: + /* + * Destructor - as part of destruction, it will abort the exchange context + * if a valid one still exists. + * + * See Abort() for details on when that might occur. + */ + virtual ~CommandSender() { Abort(); } + + /** + * Gets the inner exchange context object, without ownership. + * + * @return The inner exchange context, might be nullptr if no + * exchange context has been assigned or the context + * has been released. + */ + Messaging::ExchangeContext * GetExchangeContext() const { return mpExchangeCtx; } + class Callback { public: @@ -199,6 +218,20 @@ class CommandSender final : public Command, public Messaging::ExchangeDelegate private: friend class TestCommandInteraction; + enum class State + { + Idle, ///< Default state that the object starts out in, where no work has commenced + AddingCommand, ///< In the process of adding a command. + AddedCommand, ///< A command has been completely encoded and is awaiting transmission. + AwaitingTimedStatus, ///< Sent a Timed Request and waiting for response. + CommandSent, ///< The command has been sent successfully. + ResponseReceived, ///< Received a response to our invoke and request and processing the response. + AwaitingDestruction, ///< The object has completed its work and is awaiting destruction by the application. + }; + + void MoveToState(const State aTargetState); + const char * GetStateStr() const; + /* * Allocates a packet buffer used for encoding an invoke request payload. * @@ -221,6 +254,14 @@ class CommandSender final : public Command, public Messaging::ExchangeDelegate // void Close(); + /* + * This forcibly closes the exchange context if a valid one is pointed to. Such a situation does + * not arise during normal message processing flows that all normally call Close() above. This can only + * arise due to application-initiated destruction of the object when this object is handling receiving/sending + * message payloads. + */ + void Abort(); + CHIP_ERROR ProcessInvokeResponse(System::PacketBufferHandle && payload); CHIP_ERROR ProcessInvokeResponseIB(InvokeResponseIB::Parser & aInvokeResponse); @@ -239,6 +280,9 @@ class CommandSender final : public Command, public Messaging::ExchangeDelegate CHIP_ERROR FinishCommand(const Optional & aTimedInvokeTimeoutMs); + CHIP_ERROR Finalize(System::PacketBufferHandle & commandPacket); + + Messaging::ExchangeContext * mpExchangeCtx = nullptr; Callback * mpCallback = nullptr; Messaging::ExchangeManager * mpExchangeMgr = nullptr; InvokeRequestMessage::Builder mInvokeRequestBuilder; @@ -252,6 +296,10 @@ class CommandSender final : public Command, public Messaging::ExchangeDelegate TLV::TLVType mDataElementContainerType = TLV::kTLVType_NotSpecified; bool mSuppressResponse = false; bool mTimedRequest = false; + + State mState = State::Idle; + chip::System::PacketBufferTLVWriter mCommandMessageWriter; + bool mBufferAllocated = false; }; } // namespace app diff --git a/src/app/InteractionModelEngine.cpp b/src/app/InteractionModelEngine.cpp index 471ac33b2b115b..9e7110240f8c08 100644 --- a/src/app/InteractionModelEngine.cpp +++ b/src/app/InteractionModelEngine.cpp @@ -24,9 +24,6 @@ */ #include "InteractionModelEngine.h" -#include "Command.h" -#include "CommandHandler.h" -#include "CommandSender.h" #include namespace chip { diff --git a/src/app/MessageDef/Builder.h b/src/app/MessageDef/Builder.h index 1ffbb3e78afdcf..4b0ae96b203c25 100644 --- a/src/app/MessageDef/Builder.h +++ b/src/app/MessageDef/Builder.h @@ -87,6 +87,8 @@ class Builder void EndOfContainer(); + Builder(Builder &) = delete; + protected: CHIP_ERROR mError; chip::TLV::TLVWriter * mpWriter; diff --git a/src/app/MessageDef/EventDataIB.cpp b/src/app/MessageDef/EventDataIB.cpp index 8e553eeb12654f..b810c4f34249ed 100644 --- a/src/app/MessageDef/EventDataIB.cpp +++ b/src/app/MessageDef/EventDataIB.cpp @@ -485,7 +485,7 @@ EventPathIB::Builder & EventDataIB::Builder::CreatePath() return mPath; } -EventDataIB::Builder EventDataIB::Builder::Priority(const uint8_t aPriority) +EventDataIB::Builder & EventDataIB::Builder::Priority(const uint8_t aPriority) { // skip if error has already been set if (mError == CHIP_NO_ERROR) @@ -495,7 +495,7 @@ EventDataIB::Builder EventDataIB::Builder::Priority(const uint8_t aPriority) return *this; } -EventDataIB::Builder EventDataIB::Builder::EventNumber(const uint64_t aEventNumber) +EventDataIB::Builder & EventDataIB::Builder::EventNumber(const uint64_t aEventNumber) { // skip if error has already been set if (mError == CHIP_NO_ERROR) @@ -505,7 +505,7 @@ EventDataIB::Builder EventDataIB::Builder::EventNumber(const uint64_t aEventNumb return *this; } -EventDataIB::Builder EventDataIB::Builder::EpochTimestamp(const uint64_t aEpochTimestamp) +EventDataIB::Builder & EventDataIB::Builder::EpochTimestamp(const uint64_t aEpochTimestamp) { // skip if error has already been set if (mError == CHIP_NO_ERROR) @@ -515,7 +515,7 @@ EventDataIB::Builder EventDataIB::Builder::EpochTimestamp(const uint64_t aEpochT return *this; } -EventDataIB::Builder EventDataIB::Builder::SystemTimestamp(const uint64_t aSystemTimestamp) +EventDataIB::Builder & EventDataIB::Builder::SystemTimestamp(const uint64_t aSystemTimestamp) { // skip if error has already been set if (mError == CHIP_NO_ERROR) @@ -525,7 +525,7 @@ EventDataIB::Builder EventDataIB::Builder::SystemTimestamp(const uint64_t aSyste return *this; } -EventDataIB::Builder EventDataIB::Builder::DeltaEpochTimestamp(const uint64_t aDeltaEpochTimestamp) +EventDataIB::Builder & EventDataIB::Builder::DeltaEpochTimestamp(const uint64_t aDeltaEpochTimestamp) { // skip if error has already been set if (mError == CHIP_NO_ERROR) @@ -535,7 +535,7 @@ EventDataIB::Builder EventDataIB::Builder::DeltaEpochTimestamp(const uint64_t aD return *this; } -EventDataIB::Builder EventDataIB::Builder::DeltaSystemTimestamp(const uint64_t aDeltaSystemTimestamp) +EventDataIB::Builder & EventDataIB::Builder::DeltaSystemTimestamp(const uint64_t aDeltaSystemTimestamp) { // skip if error has already been set if (mError == CHIP_NO_ERROR) diff --git a/src/app/MessageDef/EventDataIB.h b/src/app/MessageDef/EventDataIB.h index 0e0f662becbeab..4e52d7d2474cc8 100644 --- a/src/app/MessageDef/EventDataIB.h +++ b/src/app/MessageDef/EventDataIB.h @@ -185,7 +185,7 @@ class Builder : public StructBuilder * * @return A reference to *this */ - EventDataIB::Builder Priority(const uint8_t aPriority); + EventDataIB::Builder & Priority(const uint8_t aPriority); /** * @brief Inject Number into the TLV stream to indicate the number associated with @@ -196,7 +196,7 @@ class Builder : public StructBuilder * * @return A reference to *this */ - EventDataIB::Builder EventNumber(const EventNumber aEventNumber); + EventDataIB::Builder & EventNumber(const EventNumber aEventNumber); /** * @brief Inject EpochTimestamp into the TLV stream. @@ -206,7 +206,7 @@ class Builder : public StructBuilder * * @return A reference to *this */ - EventDataIB::Builder EpochTimestamp(const uint64_t aEpochTimestamp); + EventDataIB::Builder & EpochTimestamp(const uint64_t aEpochTimestamp); /** * @brief Inject SystemTimestamp into the TLV stream. If Epoch time is not available, time since boot @@ -216,7 +216,7 @@ class Builder : public StructBuilder * * @return A reference to *this */ - EventDataIB::Builder SystemTimestamp(const uint64_t aSystemTimestamp); + EventDataIB::Builder & SystemTimestamp(const uint64_t aSystemTimestamp); /** * @brief Inject DeltaEpochTimestamp into the TLV stream. @@ -227,7 +227,7 @@ class Builder : public StructBuilder * * @return A reference to *this */ - EventDataIB::Builder DeltaEpochTimestamp(const uint64_t aDeltaEpochTimestamp); + EventDataIB::Builder & DeltaEpochTimestamp(const uint64_t aDeltaEpochTimestamp); /** * @brief Inject DeltaSystemTimestamp into the TLV stream. @@ -238,7 +238,7 @@ class Builder : public StructBuilder * * @return A reference to *this */ - EventDataIB::Builder DeltaSystemTimestamp(const uint64_t aDeltaSystemTimestamp); + EventDataIB::Builder & DeltaSystemTimestamp(const uint64_t aDeltaSystemTimestamp); /** * @brief Mark the end of this EventDataIB diff --git a/src/app/ReadClient.cpp b/src/app/ReadClient.cpp index 2110044bd996b3..2ad95422a844b8 100644 --- a/src/app/ReadClient.cpp +++ b/src/app/ReadClient.cpp @@ -222,7 +222,7 @@ CHIP_ERROR ReadClient::GenerateAttributePathList(AttributePathIBs::Builder & aAt for (size_t index = 0; index < aAttributePathParamsListSize; index++) { VerifyOrReturnError(apAttributePathParamsList[index].IsValidAttributePath(), CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH); - AttributePathIB::Builder path = aAttributePathIBsBuilder.CreatePath(); + AttributePathIB::Builder & path = aAttributePathIBsBuilder.CreatePath(); ReturnErrorOnFailure(aAttributePathIBsBuilder.GetError()); ReturnErrorOnFailure(path.Encode(apAttributePathParamsList[index])); } diff --git a/src/app/WriteClient.cpp b/src/app/WriteClient.cpp index a1db198e7ec326..36501ee780d35f 100644 --- a/src/app/WriteClient.cpp +++ b/src/app/WriteClient.cpp @@ -149,15 +149,11 @@ CHIP_ERROR WriteClient::PrepareAttribute(const AttributePathParams & attributePa CHIP_ERROR WriteClient::FinishAttribute() { - CHIP_ERROR err = CHIP_NO_ERROR; - - AttributeDataIB::Builder AttributeDataIB = mWriteRequestBuilder.GetWriteRequests().GetAttributeDataIBBuilder(); - AttributeDataIB.EndOfAttributeDataIB(); - SuccessOrExit(err = AttributeDataIB.GetError()); + AttributeDataIB::Builder & attributeDataIB = mWriteRequestBuilder.GetWriteRequests().GetAttributeDataIBBuilder(); + attributeDataIB.EndOfAttributeDataIB(); + ReturnErrorOnFailure(attributeDataIB.GetError()); MoveToState(State::AddAttribute); - -exit: - return err; + return CHIP_NO_ERROR; } TLV::TLVWriter * WriteClient::GetAttributeDataIBTLVWriter() @@ -167,22 +163,14 @@ TLV::TLVWriter * WriteClient::GetAttributeDataIBTLVWriter() CHIP_ERROR WriteClient::FinalizeMessage(System::PacketBufferHandle & aPacket) { - CHIP_ERROR err = CHIP_NO_ERROR; - AttributeDataIBs::Builder AttributeDataIBsBuilder; - VerifyOrExit(mState == State::AddAttribute, err = CHIP_ERROR_INCORRECT_STATE); - AttributeDataIBsBuilder = mWriteRequestBuilder.GetWriteRequests().EndOfAttributeDataIBs(); - err = AttributeDataIBsBuilder.GetError(); - SuccessOrExit(err); + VerifyOrReturnError(mState == State::AddAttribute, CHIP_ERROR_INCORRECT_STATE); + AttributeDataIBs::Builder & attributeDataIBsBuilder = mWriteRequestBuilder.GetWriteRequests().EndOfAttributeDataIBs(); + ReturnErrorOnFailure(attributeDataIBsBuilder.GetError()); mWriteRequestBuilder.IsFabricFiltered(false).EndOfWriteRequestMessage(); - err = mWriteRequestBuilder.GetError(); - SuccessOrExit(err); - - err = mMessageWriter.Finalize(&aPacket); - SuccessOrExit(err); - -exit: - return err; + ReturnErrorOnFailure(mWriteRequestBuilder.GetError()); + ReturnErrorOnFailure(mMessageWriter.Finalize(&aPacket)); + return CHIP_NO_ERROR; } const char * WriteClient::GetStateStr() const diff --git a/src/app/WriteHandler.cpp b/src/app/WriteHandler.cpp index 8b76d2ace34406..37d5b2387ff6c6 100644 --- a/src/app/WriteHandler.cpp +++ b/src/app/WriteHandler.cpp @@ -79,22 +79,13 @@ Status WriteHandler::OnWriteRequest(Messaging::ExchangeContext * apExchangeConte CHIP_ERROR WriteHandler::FinalizeMessage(System::PacketBufferHandle & packet) { - CHIP_ERROR err = CHIP_NO_ERROR; - AttributeStatusIBs::Builder attributeStatuses; - VerifyOrExit(mState == State::AddStatus, err = CHIP_ERROR_INCORRECT_STATE); - attributeStatuses = mWriteResponseBuilder.GetWriteResponses().EndOfAttributeStatuses(); - err = attributeStatuses.GetError(); - SuccessOrExit(err); - + VerifyOrReturnError(mState == State::AddStatus, CHIP_ERROR_INCORRECT_STATE); + AttributeStatusIBs::Builder & attributeStatusIBs = mWriteResponseBuilder.GetWriteResponses().EndOfAttributeStatuses(); + ReturnErrorOnFailure(attributeStatusIBs.GetError()); mWriteResponseBuilder.EndOfWriteResponseMessage(); - err = mWriteResponseBuilder.GetError(); - SuccessOrExit(err); - - err = mMessageWriter.Finalize(&packet); - SuccessOrExit(err); - -exit: - return err; + ReturnErrorOnFailure(mWriteResponseBuilder.GetError()); + ReturnErrorOnFailure(mMessageWriter.Finalize(&packet)); + return CHIP_NO_ERROR; } CHIP_ERROR WriteHandler::SendWriteResponse() diff --git a/src/app/tests/TestMessageDef.cpp b/src/app/tests/TestMessageDef.cpp index eedc42f664ca56..9451e2061de198 100644 --- a/src/app/tests/TestMessageDef.cpp +++ b/src/app/tests/TestMessageDef.cpp @@ -135,7 +135,7 @@ void ParseClusterPathIB(nlTestSuite * apSuite, chip::TLV::TLVReader & aReader) void BuildDataVersionFilterIB(nlTestSuite * apSuite, DataVersionFilterIB::Builder & aDataVersionFilterIBBuilder) { - ClusterPathIB::Builder clusterPathBuilder = aDataVersionFilterIBBuilder.CreatePath(); + ClusterPathIB::Builder & clusterPathBuilder = aDataVersionFilterIBBuilder.CreatePath(); NL_TEST_ASSERT(apSuite, clusterPathBuilder.GetError() == CHIP_NO_ERROR); BuildClusterPathIB(apSuite, clusterPathBuilder); aDataVersionFilterIBBuilder.DataVersion(2).EndOfDataVersionFilterIB(); diff --git a/src/app/tests/TestReadInteraction.cpp b/src/app/tests/TestReadInteraction.cpp index 9af284ff9b301b..f34232c7c8adcd 100644 --- a/src/app/tests/TestReadInteraction.cpp +++ b/src/app/tests/TestReadInteraction.cpp @@ -535,7 +535,7 @@ void TestReadInteraction::TestReadHandlerInvalidAttributePath(nlTestSuite * apSu err = readRequestBuilder.Init(&writer); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - AttributePathIBs::Builder attributePathListBuilder = readRequestBuilder.CreateAttributeRequests(); + AttributePathIBs::Builder & attributePathListBuilder = readRequestBuilder.CreateAttributeRequests(); NL_TEST_ASSERT(apSuite, attributePathListBuilder.GetError() == CHIP_NO_ERROR); AttributePathIB::Builder & attributePathBuilder = attributePathListBuilder.CreatePath(); diff --git a/src/app/tests/TestReportingEngine.cpp b/src/app/tests/TestReportingEngine.cpp index dac801851cc044..6e72217447e329 100644 --- a/src/app/tests/TestReportingEngine.cpp +++ b/src/app/tests/TestReportingEngine.cpp @@ -87,20 +87,12 @@ void TestReportingEngine::TestBuildAndSendSingleReportData(nlTestSuite * apSuite NL_TEST_ASSERT(apSuite, readRequestBuilder.GetError() == CHIP_NO_ERROR); AttributePathIB::Builder & attributePathBuilder1 = attributePathListBuilder.CreatePath(); NL_TEST_ASSERT(apSuite, attributePathListBuilder.GetError() == CHIP_NO_ERROR); - attributePathBuilder1 = attributePathBuilder1.Node(1) - .Endpoint(kTestEndpointId) - .Cluster(kTestClusterId) - .Attribute(kTestFieldId1) - .EndOfAttributePathIB(); + attributePathBuilder1.Node(1).Endpoint(kTestEndpointId).Cluster(kTestClusterId).Attribute(kTestFieldId1).EndOfAttributePathIB(); NL_TEST_ASSERT(apSuite, attributePathBuilder1.GetError() == CHIP_NO_ERROR); AttributePathIB::Builder & attributePathBuilder2 = attributePathListBuilder.CreatePath(); NL_TEST_ASSERT(apSuite, attributePathListBuilder.GetError() == CHIP_NO_ERROR); - attributePathBuilder2 = attributePathBuilder2.Node(1) - .Endpoint(kTestEndpointId) - .Cluster(kTestClusterId) - .Attribute(kTestFieldId2) - .EndOfAttributePathIB(); + attributePathBuilder2.Node(1).Endpoint(kTestEndpointId).Cluster(kTestClusterId).Attribute(kTestFieldId2).EndOfAttributePathIB(); NL_TEST_ASSERT(apSuite, attributePathBuilder2.GetError() == CHIP_NO_ERROR); attributePathListBuilder.EndOfAttributePathIBs(); diff --git a/src/app/util/ContentAppPlatform.cpp b/src/app/util/ContentAppPlatform.cpp index e99e5b607ca3ac..a38e76419be029 100644 --- a/src/app/util/ContentAppPlatform.cpp +++ b/src/app/util/ContentAppPlatform.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/src/app/util/ember-compatibility-functions.cpp b/src/app/util/ember-compatibility-functions.cpp index c7a59776b3bdd9..fda1eebdabdc91 100644 --- a/src/app/util/ember-compatibility-functions.cpp +++ b/src/app/util/ember-compatibility-functions.cpp @@ -22,7 +22,6 @@ */ #include -#include #include #include #include @@ -64,7 +63,7 @@ constexpr size_t kAttributeReadBufferSize = (ATTRIBUTE_LARGEST >= 8 ? ATTRIBUTE_ EmberAfClusterCommand imCompatibilityEmberAfCluster; EmberApsFrame imCompatibilityEmberApsFrame; EmberAfInterpanHeader imCompatibilityInterpanHeader; -Command * currentCommandObject; +CommandHandler * currentCommandObject; // BasicType maps the type to basic int(8|16|32|64)(s|u) types. EmberAfAttributeType BaseType(EmberAfAttributeType type) @@ -137,7 +136,30 @@ EmberAfAttributeType BaseType(EmberAfAttributeType type) } // namespace -void SetupEmberAfObjects(Command * command, const ConcreteCommandPath & commandPath) +void SetupEmberAfCommandSender(CommandSender * command, const ConcreteCommandPath & commandPath) +{ + Messaging::ExchangeContext * commandExchangeCtx = command->GetExchangeContext(); + + imCompatibilityEmberApsFrame.clusterId = commandPath.mClusterId; + imCompatibilityEmberApsFrame.destinationEndpoint = commandPath.mEndpointId; + imCompatibilityEmberApsFrame.sourceEndpoint = 1; // source endpoint is fixed to 1 for now. + imCompatibilityEmberApsFrame.sequence = + (commandExchangeCtx != nullptr ? static_cast(commandExchangeCtx->GetExchangeId() & 0xFF) : 0); + + if (commandExchangeCtx->IsGroupExchangeContext()) + { + imCompatibilityEmberAfCluster.type = EMBER_INCOMING_MULTICAST; + } + + imCompatibilityEmberAfCluster.commandId = commandPath.mCommandId; + imCompatibilityEmberAfCluster.apsFrame = &imCompatibilityEmberApsFrame; + imCompatibilityEmberAfCluster.interPanHeader = &imCompatibilityInterpanHeader; + imCompatibilityEmberAfCluster.source = commandExchangeCtx; + + emAfCurrentCommand = &imCompatibilityEmberAfCluster; +} + +void SetupEmberAfCommandHandler(CommandHandler * command, const ConcreteCommandPath & commandPath) { Messaging::ExchangeContext * commandExchangeCtx = command->GetExchangeContext(); @@ -359,7 +381,7 @@ CHIP_ERROR ReadSingleClusterData(FabricIndex aAccessingFabricIndex, const Concre if (attributeMetadata == nullptr) { - AttributeReportIB::Builder attributeReport = aAttributeReports.CreateAttributeReport(); + AttributeReportIB::Builder & attributeReport = aAttributeReports.CreateAttributeReport(); ReturnErrorOnFailure(aAttributeReports.GetError()); // This path is not actually supported. @@ -381,7 +403,7 @@ CHIP_ERROR ReadSingleClusterData(FabricIndex aAccessingFabricIndex, const Concre } } - AttributeReportIB::Builder attributeReport = aAttributeReports.CreateAttributeReport(); + AttributeReportIB::Builder & attributeReport = aAttributeReports.CreateAttributeReport(); ReturnErrorOnFailure(aAttributeReports.GetError()); TLV::TLVWriter backup; diff --git a/src/app/util/ember-compatibility-functions.h b/src/app/util/ember-compatibility-functions.h index 12f2527d8428e5..0c551121747e60 100644 --- a/src/app/util/ember-compatibility-functions.h +++ b/src/app/util/ember-compatibility-functions.h @@ -23,7 +23,7 @@ #pragma once -#include +#include #include #include #include @@ -32,7 +32,8 @@ namespace chip { namespace app { namespace Compatibility { -void SetupEmberAfObjects(Command * command, const ConcreteCommandPath & commandPath); +void SetupEmberAfCommandSender(CommandSender * command, const ConcreteCommandPath & commandPath); +void SetupEmberAfCommandHandler(CommandHandler * command, const ConcreteCommandPath & commandPath); bool IMEmberAfSendDefaultResponseWithCallback(EmberAfStatus status); void ResetEmberAfObjects(); diff --git a/src/app/util/im-client-callbacks.cpp b/src/app/util/im-client-callbacks.cpp index 7b523ea4354fb2..662064effb5675 100644 --- a/src/app/util/im-client-callbacks.cpp +++ b/src/app/util/im-client-callbacks.cpp @@ -20,7 +20,6 @@ #include #include -#include #include #include #include @@ -277,7 +276,7 @@ static void LogIMStatus(Protocols::InteractionModel::Status status) // Singleton instance of the callbacks manager static app::CHIPDeviceCallbacksMgr & gCallbacks = app::CHIPDeviceCallbacksMgr::GetInstance(); -bool IMDefaultResponseCallback(const app::Command * commandObj, EmberAfStatus status) +bool IMDefaultResponseCallback(const app::CommandSender * commandObj, EmberAfStatus status) { ChipLogProgress(Zcl, "DefaultResponse:"); ChipLogProgress(Zcl, " Transaction: %p", commandObj); diff --git a/src/app/util/im-client-callbacks.h b/src/app/util/im-client-callbacks.h index 2a8ffb6eb58be0..631b13bef72b91 100644 --- a/src/app/util/im-client-callbacks.h +++ b/src/app/util/im-client-callbacks.h @@ -18,7 +18,7 @@ #pragma once #include -#include +#include #include #include #include @@ -29,7 +29,7 @@ // Note: The IMDefaultResponseCallback is a bridge to the old CallbackMgr before IM is landed, so it still accepts EmberAfStatus // instead of IM status code. // #6308 should handle IM error code on the application side, either modify this function or remove this. -bool IMDefaultResponseCallback(const chip::app::Command * commandObj, EmberAfStatus status); +bool IMDefaultResponseCallback(const chip::app::CommandSender * commandObj, EmberAfStatus status); bool IMReadReportAttributesResponseCallback(const chip::app::ReadClient * apReadClient, const chip::app::ConcreteAttributePath * aPath, chip::TLV::TLVReader * apData, chip::Protocols::InteractionModel::Status status); diff --git a/src/app/zap-templates/templates/app/CHIPClientCallbacks-src.zapt b/src/app/zap-templates/templates/app/CHIPClientCallbacks-src.zapt index 19f059ea290694..9cb96ce81028b3 100644 --- a/src/app/zap-templates/templates/app/CHIPClientCallbacks-src.zapt +++ b/src/app/zap-templates/templates/app/CHIPClientCallbacks-src.zapt @@ -5,7 +5,6 @@ #include -#include #include #include #include diff --git a/src/app/zap-templates/templates/app/CHIPClientCallbacks.zapt b/src/app/zap-templates/templates/app/CHIPClientCallbacks.zapt index 366f132904349b..5cf6bbf433098e 100644 --- a/src/app/zap-templates/templates/app/CHIPClientCallbacks.zapt +++ b/src/app/zap-templates/templates/app/CHIPClientCallbacks.zapt @@ -3,7 +3,6 @@ {{#if (chip_has_client_clusters)}} #pragma once -#include #include #include #include diff --git a/src/app/zap-templates/templates/app/callback.zapt b/src/app/zap-templates/templates/app/callback.zapt index 4f9e0a2ca71614..adfdb0553fff5e 100644 --- a/src/app/zap-templates/templates/app/callback.zapt +++ b/src/app/zap-templates/templates/app/callback.zapt @@ -8,7 +8,6 @@ #include #include -#include #include #include #include diff --git a/src/app/zap-templates/templates/app/im-cluster-command-handler.zapt b/src/app/zap-templates/templates/app/im-cluster-command-handler.zapt index 1b0f52ce202752..bb840e882179c9 100644 --- a/src/app/zap-templates/templates/app/im-cluster-command-handler.zapt +++ b/src/app/zap-templates/templates/app/im-cluster-command-handler.zapt @@ -8,7 +8,8 @@ #include #include #include -#include "app/util/util.h" +#include +#include #include #include #include @@ -19,14 +20,6 @@ namespace chip { namespace app { -namespace { -void ReportCommandUnsupported(Command * aCommandObj, const ConcreteCommandPath & aCommandPath) -{ - aCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); - ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); -} -} // anonymous namespace - // Cluster specific command parsing namespace Clusters { @@ -61,8 +54,11 @@ void Dispatch{{asUpperCamelCase side}}Command({{#if (isServer side)}}CommandHand } {{#last}} default: { + {{#if (isServer parent.side)}} // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + {{/if}} return; } } @@ -70,8 +66,8 @@ void Dispatch{{asUpperCamelCase side}}Command({{#if (isServer side)}}CommandHand if (CHIP_NO_ERROR != TLVError {{#unless (isServer parent.side)}}|| CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount{{/unless}} || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); {{#if (isServer parent.side)}} + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); {{else}} ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId); @@ -83,7 +79,10 @@ void Dispatch{{asUpperCamelCase side}}Command({{#if (isServer side)}}CommandHand } {{/last}} {{else}} - ReportCommandUnsupported(apCommandObj, aCommandPath); + {{#if (isServer parent.side)}} + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + {{/if}} {{/chip_available_cluster_commands}} } @@ -96,7 +95,7 @@ void Dispatch{{asUpperCamelCase side}}Command({{#if (isServer side)}}CommandHand void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandHandler * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandHandler(apCommandObj, aCommandPath); switch (aCommandPath.mClusterId) { @@ -121,7 +120,7 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandSender * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandSender(apCommandObj, aCommandPath); TLV::TLVType dataTlvType; SuccessOrExit(aReader.EnterContainer(dataTlvType)); @@ -136,10 +135,6 @@ void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPa {{/chip_client_clusters}} default: ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mClusterId)); - apCommandObj->AddStatus( - aCommandPath, - Protocols::InteractionModel::Status::UnsupportedCluster - ); break; } diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index 186c3cab4388a7..27e748ee29cc39 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -92,7 +92,7 @@ using namespace chip::Credentials; // For some applications those does not implement IMDelegate, the DeviceControllerInteractionModelDelegate will dispatch the // response to IMDefaultResponseCallback CHIPClientCallbacks, for the applications those implemented IMDelegate, this function will // not be used. -bool __attribute__((weak)) IMDefaultResponseCallback(const chip::app::Command * commandObj, EmberAfStatus status) +bool __attribute__((weak)) IMDefaultResponseCallback(const chip::app::CommandSender * commandObj, EmberAfStatus status) { return false; } diff --git a/src/controller/tests/data_model/TestRead.cpp b/src/controller/tests/data_model/TestRead.cpp index f5e6da67dc437c..d4ca48226397e3 100644 --- a/src/controller/tests/data_model/TestRead.cpp +++ b/src/controller/tests/data_model/TestRead.cpp @@ -65,8 +65,10 @@ CHIP_ERROR ReadSingleClusterData(FabricIndex aAccessingFabricIndex, const Concre if (responseDirective == kSendDataResponse) { - auto attributeReport = aAttributeReports.CreateAttributeReport(); - AttributeDataIB::Builder attributeData = attributeReport.CreateAttributeData(); + AttributeReportIB::Builder & attributeReport = aAttributeReports.CreateAttributeReport(); + ReturnErrorOnFailure(aAttributeReports.GetError()); + AttributeDataIB::Builder & attributeData = attributeReport.CreateAttributeData(); + ReturnErrorOnFailure(attributeReport.GetError()); TestCluster::Attributes::ListStructOctetString::TypeInfo::Type value; TestCluster::Structs::TestListStructOctet::Type valueBuf[4]; @@ -80,7 +82,7 @@ CHIP_ERROR ReadSingleClusterData(FabricIndex aAccessingFabricIndex, const Concre } attributeData.DataVersion(0); - AttributePathIB::Builder attributePath = attributeData.CreatePath(); + AttributePathIB::Builder & attributePath = attributeData.CreatePath(); attributePath.Endpoint(aPath.mEndpointId).Cluster(aPath.mClusterId).Attribute(aPath.mAttributeId).EndOfAttributePathIB(); ReturnErrorOnFailure(attributePath.GetError()); @@ -91,13 +93,15 @@ CHIP_ERROR ReadSingleClusterData(FabricIndex aAccessingFabricIndex, const Concre } else { - auto attributeReport = aAttributeReports.CreateAttributeReport(); - AttributeStatusIB::Builder attributeStatus = attributeReport.CreateAttributeStatus(); - AttributePathIB::Builder attributePath = attributeStatus.CreatePath(); + AttributeReportIB::Builder & attributeReport = aAttributeReports.CreateAttributeReport(); + ReturnErrorOnFailure(aAttributeReports.GetError()); + AttributeStatusIB::Builder & attributeStatus = attributeReport.CreateAttributeStatus(); + AttributePathIB::Builder & attributePath = attributeStatus.CreatePath(); attributePath.Endpoint(aPath.mEndpointId).Cluster(aPath.mClusterId).Attribute(aPath.mAttributeId).EndOfAttributePathIB(); ReturnErrorOnFailure(attributePath.GetError()); - StatusIB::Builder errorStatus = attributeStatus.CreateErrorStatus(); + StatusIB::Builder & errorStatus = attributeStatus.CreateErrorStatus(); + ReturnErrorOnFailure(attributeStatus.GetError()); errorStatus.EncodeStatusIB(StatusIB(Protocols::InteractionModel::Status::Busy)); attributeStatus.EndOfAttributeStatusIB(); ReturnErrorOnFailure(attributeStatus.GetError()); diff --git a/zzz_generated/all-clusters-app/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/all-clusters-app/zap-generated/CHIPClientCallbacks.cpp index 8aa5b5c517f332..19dd77a3aad51f 100644 --- a/zzz_generated/all-clusters-app/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/all-clusters-app/zap-generated/CHIPClientCallbacks.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/zzz_generated/all-clusters-app/zap-generated/CHIPClientCallbacks.h b/zzz_generated/all-clusters-app/zap-generated/CHIPClientCallbacks.h index 499a1924413099..9e7856a0222adf 100644 --- a/zzz_generated/all-clusters-app/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/all-clusters-app/zap-generated/CHIPClientCallbacks.h @@ -21,7 +21,6 @@ #include #include -#include #include #include #include diff --git a/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp index 110214e9b8b25b..09ade7a02ec4f8 100644 --- a/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp @@ -20,13 +20,14 @@ #include #include -#include "app/util/util.h" #include #include #include #include #include +#include #include +#include #include #include @@ -36,15 +37,6 @@ namespace chip { namespace app { -namespace { -void ReportCommandUnsupported(Command * aCommandObj, const ConcreteCommandPath & aCommandPath) -{ - aCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); - ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, - ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); -} -} // anonymous namespace - // Cluster specific command parsing namespace Clusters { @@ -94,7 +86,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -142,7 +136,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -161,7 +157,9 @@ namespace Basic { void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) { - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); } } // namespace Basic @@ -199,7 +197,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -401,7 +401,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -440,7 +442,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -677,7 +681,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -716,7 +722,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -774,7 +782,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -858,7 +868,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -897,7 +909,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -954,7 +968,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1056,7 +1072,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1095,7 +1113,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1134,7 +1154,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1236,7 +1258,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1420,8 +1444,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -1429,7 +1451,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -1447,7 +1468,9 @@ namespace OtaSoftwareUpdateProvider { void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) { - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); } } // namespace OtaSoftwareUpdateProvider @@ -1494,7 +1517,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1609,7 +1634,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1702,7 +1729,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1741,7 +1770,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1934,7 +1965,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1973,7 +2006,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -2012,7 +2047,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -2069,7 +2106,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -2088,7 +2127,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandHandler * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandHandler(apCommandObj, aCommandPath); switch (aCommandPath.mClusterId) { @@ -2179,7 +2218,7 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandSender * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandSender(apCommandObj, aCommandPath); TLV::TLVType dataTlvType; SuccessOrExit(aReader.EnterContainer(dataTlvType)); @@ -2190,7 +2229,6 @@ void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPa break; default: ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mClusterId)); - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCluster); break; } diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index c0040cd82b2dfb..1f11cfb9ce36ed 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -25,7 +25,6 @@ #include #include -#include #include #include #include diff --git a/zzz_generated/bridge-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/bridge-app/zap-generated/IMClusterCommandHandler.cpp index b2c6ddff88e13e..c3aaf1dfcce90c 100644 --- a/zzz_generated/bridge-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/bridge-app/zap-generated/IMClusterCommandHandler.cpp @@ -20,13 +20,14 @@ #include #include -#include "app/util/util.h" #include #include #include #include #include +#include #include +#include #include #include @@ -36,15 +37,6 @@ namespace chip { namespace app { -namespace { -void ReportCommandUnsupported(Command * aCommandObj, const ConcreteCommandPath & aCommandPath) -{ - aCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); - ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, - ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); -} -} // anonymous namespace - // Cluster specific command parsing namespace Clusters { @@ -94,7 +86,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -133,7 +127,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -191,7 +187,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -293,7 +291,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -395,7 +395,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -452,7 +454,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -567,7 +571,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -586,7 +592,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandHandler * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandHandler(apCommandObj, aCommandPath); switch (aCommandPath.mClusterId) { @@ -623,7 +629,7 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandSender * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandSender(apCommandObj, aCommandPath); TLV::TLVType dataTlvType; SuccessOrExit(aReader.EnterContainer(dataTlvType)); @@ -631,7 +637,6 @@ void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPa { default: ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mClusterId)); - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCluster); break; } diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp index c82b88c229b4bf..00bcbff4b09695 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h index e9d94f07b384f6..4fa16312e84526 100644 --- a/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/controller-clusters/zap-generated/CHIPClientCallbacks.h @@ -21,7 +21,6 @@ #include #include -#include #include #include #include diff --git a/zzz_generated/controller-clusters/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/controller-clusters/zap-generated/IMClusterCommandHandler.cpp index 7b7c8e8f806474..67d5a9260e2f86 100644 --- a/zzz_generated/controller-clusters/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/controller-clusters/zap-generated/IMClusterCommandHandler.cpp @@ -20,13 +20,14 @@ #include #include -#include "app/util/util.h" #include #include #include #include #include +#include #include +#include #include #include @@ -36,15 +37,6 @@ namespace chip { namespace app { -namespace { -void ReportCommandUnsupported(Command * aCommandObj, const ConcreteCommandPath & aCommandPath) -{ - aCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); - ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, - ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); -} -} // anonymous namespace - // Cluster specific command parsing namespace Clusters { @@ -126,8 +118,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -135,7 +125,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -230,8 +219,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -239,7 +226,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -397,8 +383,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -406,7 +390,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -509,8 +492,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -518,7 +499,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -1077,8 +1057,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -1086,7 +1064,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -1307,8 +1284,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -1316,7 +1291,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -1604,8 +1578,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -1613,7 +1585,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -1703,8 +1674,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -1712,7 +1681,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -1802,8 +1770,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -1811,7 +1777,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -2492,8 +2457,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -2501,7 +2464,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -3047,8 +3009,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -3056,7 +3016,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -3239,8 +3198,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -3248,7 +3205,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -3532,8 +3488,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -3541,7 +3495,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -3993,8 +3946,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -4002,7 +3953,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -4098,8 +4048,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -4107,7 +4055,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -4202,8 +4149,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -4211,7 +4156,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -4671,8 +4615,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -4680,7 +4622,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -4698,7 +4639,7 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandHandler * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandHandler(apCommandObj, aCommandPath); switch (aCommandPath.mClusterId) { @@ -4714,7 +4655,7 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandSender * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandSender(apCommandObj, aCommandPath); TLV::TLVType dataTlvType; SuccessOrExit(aReader.EnterContainer(dataTlvType)); @@ -4773,7 +4714,6 @@ void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPa break; default: ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mClusterId)); - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCluster); break; } diff --git a/zzz_generated/lighting-app/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/lighting-app/zap-generated/CHIPClientCallbacks.cpp index 8aa5b5c517f332..19dd77a3aad51f 100644 --- a/zzz_generated/lighting-app/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/lighting-app/zap-generated/CHIPClientCallbacks.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/zzz_generated/lighting-app/zap-generated/CHIPClientCallbacks.h b/zzz_generated/lighting-app/zap-generated/CHIPClientCallbacks.h index 499a1924413099..9e7856a0222adf 100644 --- a/zzz_generated/lighting-app/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/lighting-app/zap-generated/CHIPClientCallbacks.h @@ -21,7 +21,6 @@ #include #include -#include #include #include #include diff --git a/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp index 6e9b21e99a8dd0..e4a6e20f188fad 100644 --- a/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/lighting-app/zap-generated/IMClusterCommandHandler.cpp @@ -20,13 +20,14 @@ #include #include -#include "app/util/util.h" #include #include #include #include #include +#include #include +#include #include #include @@ -36,15 +37,6 @@ namespace chip { namespace app { -namespace { -void ReportCommandUnsupported(Command * aCommandObj, const ConcreteCommandPath & aCommandPath) -{ - aCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); - ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, - ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); -} -} // anonymous namespace - // Cluster specific command parsing namespace Clusters { @@ -94,7 +86,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -296,7 +290,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -335,7 +331,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -374,7 +372,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -432,7 +432,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -489,7 +491,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -591,7 +595,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -693,7 +699,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -877,8 +885,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -886,7 +892,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -969,7 +974,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1084,7 +1091,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1123,7 +1132,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1162,7 +1173,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1201,7 +1214,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1220,7 +1235,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandHandler * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandHandler(apCommandObj, aCommandPath); switch (aCommandPath.mClusterId) { @@ -1275,7 +1290,7 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandSender * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandSender(apCommandObj, aCommandPath); TLV::TLVType dataTlvType; SuccessOrExit(aReader.EnterContainer(dataTlvType)); @@ -1286,7 +1301,6 @@ void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPa break; default: ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mClusterId)); - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCluster); break; } diff --git a/zzz_generated/lock-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/lock-app/zap-generated/IMClusterCommandHandler.cpp index 96de6025e1ac59..c4fac34ec28d46 100644 --- a/zzz_generated/lock-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/lock-app/zap-generated/IMClusterCommandHandler.cpp @@ -20,13 +20,14 @@ #include #include -#include "app/util/util.h" #include #include #include #include #include +#include #include +#include #include #include @@ -36,15 +37,6 @@ namespace chip { namespace app { -namespace { -void ReportCommandUnsupported(Command * aCommandObj, const ConcreteCommandPath & aCommandPath) -{ - aCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); - ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, - ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); -} -} // anonymous namespace - // Cluster specific command parsing namespace Clusters { @@ -94,7 +86,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -133,7 +127,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -191,7 +187,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -293,7 +291,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -350,7 +350,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -465,7 +467,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -484,7 +488,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandHandler * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandHandler(apCommandObj, aCommandPath); switch (aCommandPath.mClusterId) { @@ -518,7 +522,7 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandSender * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandSender(apCommandObj, aCommandPath); TLV::TLVType dataTlvType; SuccessOrExit(aReader.EnterContainer(dataTlvType)); @@ -526,7 +530,6 @@ void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPa { default: ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mClusterId)); - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCluster); break; } diff --git a/zzz_generated/ota-provider-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/ota-provider-app/zap-generated/IMClusterCommandHandler.cpp index 9ffc417766c69e..96f6ce364a037f 100644 --- a/zzz_generated/ota-provider-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/ota-provider-app/zap-generated/IMClusterCommandHandler.cpp @@ -20,13 +20,14 @@ #include #include -#include "app/util/util.h" #include #include #include #include #include +#include #include +#include #include #include @@ -36,15 +37,6 @@ namespace chip { namespace app { -namespace { -void ReportCommandUnsupported(Command * aCommandObj, const ConcreteCommandPath & aCommandPath) -{ - aCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); - ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, - ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); -} -} // anonymous namespace - // Cluster specific command parsing namespace Clusters { @@ -92,7 +84,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -194,7 +188,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -253,7 +249,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -349,7 +347,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -368,7 +368,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandHandler * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandHandler(apCommandObj, aCommandPath); switch (aCommandPath.mClusterId) { @@ -396,7 +396,7 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandSender * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandSender(apCommandObj, aCommandPath); TLV::TLVType dataTlvType; SuccessOrExit(aReader.EnterContainer(dataTlvType)); @@ -404,7 +404,6 @@ void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPa { default: ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mClusterId)); - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCluster); break; } diff --git a/zzz_generated/ota-requestor-app/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/ota-requestor-app/zap-generated/CHIPClientCallbacks.cpp index 8aa5b5c517f332..19dd77a3aad51f 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/ota-requestor-app/zap-generated/CHIPClientCallbacks.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/zzz_generated/ota-requestor-app/zap-generated/CHIPClientCallbacks.h b/zzz_generated/ota-requestor-app/zap-generated/CHIPClientCallbacks.h index 499a1924413099..9e7856a0222adf 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/ota-requestor-app/zap-generated/CHIPClientCallbacks.h @@ -21,7 +21,6 @@ #include #include -#include #include #include #include diff --git a/zzz_generated/ota-requestor-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/ota-requestor-app/zap-generated/IMClusterCommandHandler.cpp index 4ce300b05aac68..a15f71c4739fb6 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/ota-requestor-app/zap-generated/IMClusterCommandHandler.cpp @@ -20,13 +20,14 @@ #include #include -#include "app/util/util.h" #include #include #include #include #include +#include #include +#include #include #include @@ -36,15 +37,6 @@ namespace chip { namespace app { -namespace { -void ReportCommandUnsupported(Command * aCommandObj, const ConcreteCommandPath & aCommandPath) -{ - aCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); - ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, - ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); -} -} // anonymous namespace - // Cluster specific command parsing namespace Clusters { @@ -92,7 +84,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -194,7 +188,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -378,8 +374,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -387,7 +381,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -426,7 +419,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -541,7 +536,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -560,7 +557,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandHandler * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandHandler(apCommandObj, aCommandPath); switch (aCommandPath.mClusterId) { @@ -588,7 +585,7 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandSender * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandSender(apCommandObj, aCommandPath); TLV::TLVType dataTlvType; SuccessOrExit(aReader.EnterContainer(dataTlvType)); @@ -599,7 +596,6 @@ void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPa break; default: ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mClusterId)); - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCluster); break; } diff --git a/zzz_generated/placeholder/app1/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/placeholder/app1/zap-generated/IMClusterCommandHandler.cpp index f8563cc33d3aca..87de76850fcaa7 100644 --- a/zzz_generated/placeholder/app1/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/placeholder/app1/zap-generated/IMClusterCommandHandler.cpp @@ -20,13 +20,14 @@ #include #include -#include "app/util/util.h" #include #include #include #include #include +#include #include +#include #include #include @@ -36,15 +37,6 @@ namespace chip { namespace app { -namespace { -void ReportCommandUnsupported(Command * aCommandObj, const ConcreteCommandPath & aCommandPath) -{ - aCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); - ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, - ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); -} -} // anonymous namespace - // Cluster specific command parsing namespace Clusters { @@ -91,7 +83,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -149,7 +143,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -233,7 +229,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -281,7 +279,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -383,7 +383,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -440,7 +442,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -555,7 +559,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -648,7 +654,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -667,7 +675,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandHandler * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandHandler(apCommandObj, aCommandPath); switch (aCommandPath.mClusterId) { @@ -707,7 +715,7 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandSender * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandSender(apCommandObj, aCommandPath); TLV::TLVType dataTlvType; SuccessOrExit(aReader.EnterContainer(dataTlvType)); @@ -715,7 +723,6 @@ void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPa { default: ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mClusterId)); - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCluster); break; } diff --git a/zzz_generated/placeholder/app2/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/placeholder/app2/zap-generated/IMClusterCommandHandler.cpp index af1309de3e2bbd..b3ebba1d16b48b 100644 --- a/zzz_generated/placeholder/app2/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/placeholder/app2/zap-generated/IMClusterCommandHandler.cpp @@ -20,13 +20,14 @@ #include #include -#include "app/util/util.h" #include #include #include #include #include +#include #include +#include #include #include @@ -36,15 +37,6 @@ namespace chip { namespace app { -namespace { -void ReportCommandUnsupported(Command * aCommandObj, const ConcreteCommandPath & aCommandPath) -{ - aCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); - ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, - ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); -} -} // anonymous namespace - // Cluster specific command parsing namespace Clusters { @@ -83,7 +75,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -167,7 +161,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -215,7 +211,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -317,7 +315,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -374,7 +374,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -489,7 +491,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -582,7 +586,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -601,7 +607,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandHandler * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandHandler(apCommandObj, aCommandPath); switch (aCommandPath.mClusterId) { @@ -638,7 +644,7 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandSender * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandSender(apCommandObj, aCommandPath); TLV::TLVType dataTlvType; SuccessOrExit(aReader.EnterContainer(dataTlvType)); @@ -646,7 +652,6 @@ void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPa { default: ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mClusterId)); - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCluster); break; } diff --git a/zzz_generated/pump-app/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/pump-app/zap-generated/CHIPClientCallbacks.cpp index 98ee177d541321..9fa7ce3727a302 100644 --- a/zzz_generated/pump-app/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/pump-app/zap-generated/CHIPClientCallbacks.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/zzz_generated/pump-app/zap-generated/CHIPClientCallbacks.h b/zzz_generated/pump-app/zap-generated/CHIPClientCallbacks.h index fc342f8e9f5788..3d45ea2ad67826 100644 --- a/zzz_generated/pump-app/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/pump-app/zap-generated/CHIPClientCallbacks.h @@ -21,7 +21,6 @@ #include #include -#include #include #include #include diff --git a/zzz_generated/pump-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/pump-app/zap-generated/IMClusterCommandHandler.cpp index 73c5dc774d64ef..3456db9fddf13b 100644 --- a/zzz_generated/pump-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/pump-app/zap-generated/IMClusterCommandHandler.cpp @@ -20,13 +20,14 @@ #include #include -#include "app/util/util.h" #include #include #include #include #include +#include #include +#include #include #include @@ -36,15 +37,6 @@ namespace chip { namespace app { -namespace { -void ReportCommandUnsupported(Command * aCommandObj, const ConcreteCommandPath & aCommandPath) -{ - aCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); - ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, - ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); -} -} // anonymous namespace - // Cluster specific command parsing namespace Clusters { @@ -94,7 +86,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -113,7 +107,9 @@ namespace Basic { void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) { - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); } } // namespace Basic @@ -142,7 +138,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -200,7 +198,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -302,7 +302,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -404,7 +406,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -461,7 +465,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -576,7 +582,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -595,7 +603,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandHandler * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandHandler(apCommandObj, aCommandPath); switch (aCommandPath.mClusterId) { @@ -635,7 +643,7 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandSender * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandSender(apCommandObj, aCommandPath); TLV::TLVType dataTlvType; SuccessOrExit(aReader.EnterContainer(dataTlvType)); @@ -643,7 +651,6 @@ void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPa { default: ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mClusterId)); - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCluster); break; } diff --git a/zzz_generated/pump-controller-app/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/pump-controller-app/zap-generated/CHIPClientCallbacks.cpp index 98ee177d541321..9fa7ce3727a302 100644 --- a/zzz_generated/pump-controller-app/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/pump-controller-app/zap-generated/CHIPClientCallbacks.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/zzz_generated/pump-controller-app/zap-generated/CHIPClientCallbacks.h b/zzz_generated/pump-controller-app/zap-generated/CHIPClientCallbacks.h index fc342f8e9f5788..3d45ea2ad67826 100644 --- a/zzz_generated/pump-controller-app/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/pump-controller-app/zap-generated/CHIPClientCallbacks.h @@ -21,7 +21,6 @@ #include #include -#include #include #include #include diff --git a/zzz_generated/pump-controller-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/pump-controller-app/zap-generated/IMClusterCommandHandler.cpp index 199373d627dd6e..73be1238d2bc81 100644 --- a/zzz_generated/pump-controller-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/pump-controller-app/zap-generated/IMClusterCommandHandler.cpp @@ -20,13 +20,14 @@ #include #include -#include "app/util/util.h" #include #include #include #include #include +#include #include +#include #include #include @@ -36,15 +37,6 @@ namespace chip { namespace app { -namespace { -void ReportCommandUnsupported(Command * aCommandObj, const ConcreteCommandPath & aCommandPath) -{ - aCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); - ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, - ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); -} -} // anonymous namespace - // Cluster specific command parsing namespace Clusters { @@ -94,7 +86,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -113,7 +107,9 @@ namespace Basic { void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) { - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); } } // namespace Basic @@ -142,7 +138,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -200,7 +198,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -302,7 +302,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -417,7 +419,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -436,7 +440,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandHandler * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandHandler(apCommandObj, aCommandPath); switch (aCommandPath.mClusterId) { @@ -470,7 +474,7 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandSender * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandSender(apCommandObj, aCommandPath); TLV::TLVType dataTlvType; SuccessOrExit(aReader.EnterContainer(dataTlvType)); @@ -478,7 +482,6 @@ void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPa { default: ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mClusterId)); - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCluster); break; } diff --git a/zzz_generated/temperature-measurement-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/temperature-measurement-app/zap-generated/IMClusterCommandHandler.cpp index a47f49b3591c3f..23ad8124dc54a1 100644 --- a/zzz_generated/temperature-measurement-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/temperature-measurement-app/zap-generated/IMClusterCommandHandler.cpp @@ -20,13 +20,14 @@ #include #include -#include "app/util/util.h" #include #include #include #include #include +#include #include +#include #include #include @@ -36,15 +37,6 @@ namespace chip { namespace app { -namespace { -void ReportCommandUnsupported(Command * aCommandObj, const ConcreteCommandPath & aCommandPath) -{ - aCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); - ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, - ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); -} -} // anonymous namespace - // Cluster specific command parsing namespace Clusters { @@ -94,7 +86,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -133,7 +127,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -191,7 +187,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -275,7 +273,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -390,7 +390,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -409,7 +411,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandHandler * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandHandler(apCommandObj, aCommandPath); switch (aCommandPath.mClusterId) { @@ -440,7 +442,7 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandSender * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandSender(apCommandObj, aCommandPath); TLV::TLVType dataTlvType; SuccessOrExit(aReader.EnterContainer(dataTlvType)); @@ -448,7 +450,6 @@ void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPa { default: ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mClusterId)); - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCluster); break; } diff --git a/zzz_generated/thermostat/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/thermostat/zap-generated/CHIPClientCallbacks.cpp index b36455f164431b..ca33113ab4ecf9 100644 --- a/zzz_generated/thermostat/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/thermostat/zap-generated/CHIPClientCallbacks.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/zzz_generated/thermostat/zap-generated/CHIPClientCallbacks.h b/zzz_generated/thermostat/zap-generated/CHIPClientCallbacks.h index 53b3d4568ab56e..667bdbbff27e3c 100644 --- a/zzz_generated/thermostat/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/thermostat/zap-generated/CHIPClientCallbacks.h @@ -21,7 +21,6 @@ #include #include -#include #include #include #include diff --git a/zzz_generated/thermostat/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/thermostat/zap-generated/IMClusterCommandHandler.cpp index 22ae47395baee1..c0d77342ca5e5e 100644 --- a/zzz_generated/thermostat/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/thermostat/zap-generated/IMClusterCommandHandler.cpp @@ -20,13 +20,14 @@ #include #include -#include "app/util/util.h" #include #include #include #include #include +#include #include +#include #include #include @@ -36,15 +37,6 @@ namespace chip { namespace app { -namespace { -void ReportCommandUnsupported(Command * aCommandObj, const ConcreteCommandPath & aCommandPath) -{ - aCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); - ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, - ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); -} -} // anonymous namespace - // Cluster specific command parsing namespace Clusters { @@ -94,7 +86,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -113,7 +107,9 @@ namespace Basic { void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) { - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); } } // namespace Basic @@ -151,7 +147,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -190,7 +188,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -248,7 +248,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -332,7 +334,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -423,8 +427,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -432,7 +434,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -479,7 +480,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -581,7 +584,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -640,7 +645,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -755,7 +762,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -848,7 +857,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -923,7 +934,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -942,7 +955,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandHandler * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandHandler(apCommandObj, aCommandPath); switch (aCommandPath.mClusterId) { @@ -994,7 +1007,7 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandSender * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandSender(apCommandObj, aCommandPath); TLV::TLVType dataTlvType; SuccessOrExit(aReader.EnterContainer(dataTlvType)); @@ -1005,7 +1018,6 @@ void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPa break; default: ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mClusterId)); - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCluster); break; } diff --git a/zzz_generated/tv-app/zap-generated/CHIPClientCallbacks.cpp b/zzz_generated/tv-app/zap-generated/CHIPClientCallbacks.cpp index 1d751ad6530fab..7d36f8a2df83c5 100644 --- a/zzz_generated/tv-app/zap-generated/CHIPClientCallbacks.cpp +++ b/zzz_generated/tv-app/zap-generated/CHIPClientCallbacks.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include #include diff --git a/zzz_generated/tv-app/zap-generated/CHIPClientCallbacks.h b/zzz_generated/tv-app/zap-generated/CHIPClientCallbacks.h index 8f342fd8e7c87f..81bf5630a3945e 100644 --- a/zzz_generated/tv-app/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/tv-app/zap-generated/CHIPClientCallbacks.h @@ -21,7 +21,6 @@ #include #include -#include #include #include #include diff --git a/zzz_generated/tv-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/tv-app/zap-generated/IMClusterCommandHandler.cpp index 48487d87cf0693..c991cb4d79a547 100644 --- a/zzz_generated/tv-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/tv-app/zap-generated/IMClusterCommandHandler.cpp @@ -20,13 +20,14 @@ #include #include -#include "app/util/util.h" #include #include #include #include #include +#include #include +#include #include #include @@ -36,15 +37,6 @@ namespace chip { namespace app { -namespace { -void ReportCommandUnsupported(Command * aCommandObj, const ConcreteCommandPath & aCommandPath) -{ - aCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); - ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, - ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); -} -} // anonymous namespace - // Cluster specific command parsing namespace Clusters { @@ -82,7 +74,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -142,7 +136,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -181,7 +177,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -220,7 +218,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -268,7 +268,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -287,7 +289,9 @@ namespace Basic { void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) { - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); } } // namespace Basic @@ -325,7 +329,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -373,7 +379,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -412,7 +420,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -634,8 +644,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -643,7 +651,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -700,7 +707,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -739,7 +748,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -841,7 +852,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -880,7 +893,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -946,7 +961,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1075,7 +1092,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1622,8 +1641,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -1631,7 +1648,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -1732,7 +1748,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1791,7 +1809,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1848,7 +1868,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -2133,8 +2155,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa break; } default: { - // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); return; } } @@ -2142,7 +2162,6 @@ void DispatchClientCommand(CommandSender * apCommandObj, const ConcreteCommandPa if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled) { - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); ChipLogProgress(Zcl, "Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT ", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32, @@ -2256,7 +2275,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -2313,7 +2334,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -2352,7 +2375,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -2371,7 +2396,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandHandler * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandHandler(apCommandObj, aCommandPath); switch (aCommandPath.mClusterId) { @@ -2450,7 +2475,7 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandSender * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandSender(apCommandObj, aCommandPath); TLV::TLVType dataTlvType; SuccessOrExit(aReader.EnterContainer(dataTlvType)); @@ -2467,7 +2492,6 @@ void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPa break; default: ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mClusterId)); - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCluster); break; } diff --git a/zzz_generated/tv-casting-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/tv-casting-app/zap-generated/IMClusterCommandHandler.cpp index 15f46f525258e3..efdf48cc266c72 100644 --- a/zzz_generated/tv-casting-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/tv-casting-app/zap-generated/IMClusterCommandHandler.cpp @@ -20,13 +20,14 @@ #include #include -#include "app/util/util.h" #include #include #include #include #include +#include #include +#include #include #include @@ -36,15 +37,6 @@ namespace chip { namespace app { -namespace { -void ReportCommandUnsupported(Command * aCommandObj, const ConcreteCommandPath & aCommandPath) -{ - aCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); - ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, - ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); -} -} // anonymous namespace - // Cluster specific command parsing namespace Clusters { @@ -94,7 +86,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -142,7 +136,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -161,7 +157,9 @@ namespace Basic { void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) { - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); } } // namespace Basic @@ -199,7 +197,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -355,7 +355,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -394,7 +396,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -631,7 +635,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -689,7 +695,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -773,7 +781,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -812,7 +822,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -860,7 +872,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -962,7 +976,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1064,7 +1080,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1123,7 +1141,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1180,7 +1200,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1295,7 +1317,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1388,7 +1412,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1445,7 +1471,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -1464,7 +1492,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandHandler * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandHandler(apCommandObj, aCommandPath); switch (aCommandPath.mClusterId) { @@ -1534,7 +1562,7 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandSender * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandSender(apCommandObj, aCommandPath); TLV::TLVType dataTlvType; SuccessOrExit(aReader.EnterContainer(dataTlvType)); @@ -1542,7 +1570,6 @@ void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPa { default: ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mClusterId)); - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCluster); break; } diff --git a/zzz_generated/window-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/window-app/zap-generated/IMClusterCommandHandler.cpp index c8011a1c54ea7a..3dac45db55a84e 100644 --- a/zzz_generated/window-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/window-app/zap-generated/IMClusterCommandHandler.cpp @@ -20,13 +20,14 @@ #include #include -#include "app/util/util.h" #include #include #include #include #include +#include #include +#include #include #include @@ -36,15 +37,6 @@ namespace chip { namespace app { -namespace { -void ReportCommandUnsupported(Command * aCommandObj, const ConcreteCommandPath & aCommandPath) -{ - aCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); - ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, - ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); -} -} // anonymous namespace - // Cluster specific command parsing namespace Clusters { @@ -94,7 +86,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -152,7 +146,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -209,7 +205,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -311,7 +309,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -426,7 +426,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -519,7 +521,9 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } default: { // Unrecognized command ID, error status will apply. - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); return; } } @@ -538,7 +542,7 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandHandler * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandHandler(apCommandObj, aCommandPath); switch (aCommandPath.mClusterId) { @@ -572,7 +576,7 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandSender * apCommandObj) { - Compatibility::SetupEmberAfObjects(apCommandObj, aCommandPath); + Compatibility::SetupEmberAfCommandSender(apCommandObj, aCommandPath); TLV::TLVType dataTlvType; SuccessOrExit(aReader.EnterContainer(dataTlvType)); @@ -580,7 +584,6 @@ void DispatchSingleClusterResponseCommand(const ConcreteCommandPath & aCommandPa { default: ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mClusterId)); - apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCluster); break; } From c69451a1fba2ddb61efa0685ffa67808e5cf76cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Thu, 9 Dec 2021 00:37:31 +0100 Subject: [PATCH 10/28] [ota-requestor] Build QueryImage based on Basic cluster attributes (#12671) --- .../ota-requestor-app.zap | 5 +- .../clusters/ota-requestor/OTARequestor.cpp | 160 +++++++++--------- src/app/clusters/ota-requestor/OTARequestor.h | 3 + src/lib/core/DataModelTypes.h | 7 +- .../zap-generated/IMClusterCommandHandler.cpp | 12 ++ .../PluginApplicationCallbacks.h | 1 + .../zap-generated/callback-stub.cpp | 8 + .../zap-generated/endpoint_config.h | 99 +++++++---- .../zap-generated/gen_config.h | 6 + 9 files changed, 186 insertions(+), 115 deletions(-) diff --git a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap index 37947998492ac5..3456fc0f833bf5 100644 --- a/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap +++ b/examples/ota-requestor-app/ota-requestor-common/ota-requestor-app.zap @@ -776,7 +776,7 @@ "mfgCode": null, "define": "BASIC_CLUSTER", "side": "server", - "enabled": 0, + "enabled": 1, "commands": [ { "name": "StartUp", @@ -3711,5 +3711,6 @@ "endpointVersion": 1, "deviceIdentifier": 22 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/src/app/clusters/ota-requestor/OTARequestor.cpp b/src/app/clusters/ota-requestor/OTARequestor.cpp index 44927a74147412..224e974cb5ba77 100644 --- a/src/app/clusters/ota-requestor/OTARequestor.cpp +++ b/src/app/clusters/ota-requestor/OTARequestor.cpp @@ -29,6 +29,7 @@ #include "BDXDownloader.h" +#include #include #include #include @@ -36,29 +37,13 @@ #include #include -using chip::ByteSpan; -using chip::CASESessionManager; -using chip::CASESessionManagerConfig; -using chip::CharSpan; -using chip::DeviceProxy; -using chip::EndpointId; -using chip::FabricIndex; -using chip::FabricInfo; -using chip::NodeId; -using chip::OnDeviceConnected; -using chip::OnDeviceConnectionFailure; -using chip::PeerId; -using chip::Server; -using chip::VendorId; -using chip::bdx::TransferSession; -using chip::Callback::Callback; -using chip::System::Layer; -using chip::Transport::PeerAddress; -// using namespace chip::ArgParser; +using namespace chip; +using namespace chip::app::Clusters; +using namespace chip::bdx; using namespace chip::Messaging; using namespace chip::app::Clusters::OtaSoftwareUpdateProvider::Commands; -using chip::Inet::IPAddress; +namespace { // Global instance of the OTARequestorInterface. OTARequestorInterface * globalOTARequestorInstance = nullptr; @@ -66,24 +51,14 @@ constexpr uint32_t kImmediateStartDelayMs = 1; // Start the timer with this valu // Callbacks for connection management void OnConnected(void * context, chip::OperationalDeviceProxy * deviceProxy); -Callback mOnConnectedCallback(OnConnected, nullptr); +Callback::Callback mOnConnectedCallback(OnConnected, nullptr); void OnConnectionFailure(void * context, NodeId deviceId, CHIP_ERROR error); -Callback mOnConnectionFailureCallback(OnConnectionFailure, nullptr); +Callback::Callback mOnConnectionFailureCallback(OnConnectionFailure, nullptr); void OnQueryImageResponse(void * context, const QueryImageResponse::DecodableType & response); void OnQueryImageFailure(void * context, EmberAfStatus status); -void SetRequestorInstance(OTARequestorInterface * instance) -{ - globalOTARequestorInstance = instance; -} - -OTARequestorInterface * GetRequestorInstance() -{ - return globalOTARequestorInstance; -} - void StartDelayTimerHandler(chip::System::Layer * systemLayer, void * appState) { VerifyOrReturn(appState != nullptr); @@ -95,6 +70,17 @@ void OnQueryImageFailure(void * context, EmberAfStatus status) ChipLogDetail(SoftwareUpdate, "QueryImage failure response %" PRIu8, status); } +// Called whenever FindOrEstablishSession is successful. Finds the Requestor instance +// and calls the corresponding OTARequestor member function +void OnConnected(void * context, chip::OperationalDeviceProxy * deviceProxy) +{ + OTARequestor * requestorCore = static_cast(GetRequestorInstance()); + + VerifyOrDie(requestorCore != nullptr); + + requestorCore->mOnConnected(context, deviceProxy); +} + void OnConnectionFailure(void * context, NodeId deviceId, CHIP_ERROR error) { ChipLogError(SoftwareUpdate, "failed to connect to 0x%" PRIX64 ": %" CHIP_ERROR_FORMAT, deviceId, error.Format()); @@ -104,10 +90,27 @@ void OnQueryImageResponse(void * context, const QueryImageResponse::DecodableTyp { OTARequestor * requestorCore = static_cast(GetRequestorInstance()); - assert(requestorCore != nullptr); + VerifyOrDie(requestorCore != nullptr); requestorCore->mOnQueryImageResponse(context, response); } +} // namespace + +void SetRequestorInstance(OTARequestorInterface * instance) +{ + globalOTARequestorInstance = instance; +} + +OTARequestorInterface * GetRequestorInstance() +{ + return globalOTARequestorInstance; +} + +struct OTARequestor::QueryImageRequest +{ + char location[2]; + QueryImage::Type args; +}; void OTARequestor::mOnQueryImageResponse(void * context, const QueryImageResponse::DecodableType & response) { @@ -297,7 +300,7 @@ void OTARequestor::ConnectToProvider() // Explicitly calling UpdateDeviceData() should not be needed once OperationalDeviceProxy can resolve IP address from node ID // and fabric index - PeerAddress addr = PeerAddress::UDP(mIpAddress, CHIP_PORT); + Transport::PeerAddress addr = Transport::PeerAddress::UDP(mIpAddress, CHIP_PORT); operationalDeviceProxy->UpdateDeviceData(addr, operationalDeviceProxy->GetMRPConfig()); CHIP_ERROR err = operationalDeviceProxy->Connect(&mOnConnectedCallback, &mOnConnectionFailureCallback); @@ -307,58 +310,25 @@ void OTARequestor::ConnectToProvider() } } -// Called whenever FindOrEstablishSession is successful. Finds the Requestor instance -// and calls the corresponding OTARequestor member function -void OnConnected(void * context, chip::OperationalDeviceProxy * deviceProxy) -{ - OTARequestor * requestorCore = static_cast(GetRequestorInstance()); - - assert(requestorCore != nullptr); - - requestorCore->mOnConnected(context, deviceProxy); -} - // Member function called whenever FindOrEstablishSession is successful void OTARequestor::mOnConnected(void * context, chip::DeviceProxy * deviceProxy) { switch (onConnectedState) { case kQueryImage: { - CHIP_ERROR err = CHIP_NO_ERROR; - chip::Controller::OtaSoftwareUpdateProviderCluster cluster; constexpr EndpointId kOtaProviderEndpoint = 0; - // These QueryImage params have been chosen arbitrarily - constexpr VendorId kExampleVendorId = VendorId::Common; - constexpr uint16_t kExampleProductId = 77; - constexpr uint16_t kExampleHWVersion = 3; - constexpr uint16_t kExampleSoftwareVersion = 0; - constexpr EmberAfOTADownloadProtocol kExampleProtocolsSupported[] = { EMBER_ZCL_OTA_DOWNLOAD_PROTOCOL_BDX_SYNCHRONOUS }; - const char locationBuf[] = { 'U', 'S' }; - CharSpan exampleLocation(locationBuf); - constexpr bool kExampleClientCanConsent = false; - ByteSpan metadata; - - err = cluster.Associate(deviceProxy, kOtaProviderEndpoint); - if (err != CHIP_NO_ERROR) - { - ChipLogError(SoftwareUpdate, "Associate() failed: %" CHIP_ERROR_FORMAT, err.Format()); - return; - } - QueryImage::Type args; - args.vendorId = kExampleVendorId; - args.productId = kExampleProductId; - args.softwareVersion = kExampleSoftwareVersion; - args.protocolsSupported = kExampleProtocolsSupported; - args.hardwareVersion.Emplace(kExampleHWVersion); - args.location.Emplace(exampleLocation); - args.requestorCanConsent.Emplace(kExampleClientCanConsent); - args.metadataForProvider.Emplace(metadata); - err = cluster.InvokeCommand(args, /* context = */ nullptr, OnQueryImageResponse, OnQueryImageFailure); - if (err != CHIP_NO_ERROR) - { - ChipLogError(SoftwareUpdate, "QueryImage() failed: %" CHIP_ERROR_FORMAT, err.Format()); - } + QueryImageRequest request; + CHIP_ERROR err = BuildQueryImageRequest(request); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(SoftwareUpdate, "Failed to build QueryImage command: %" CHIP_ERROR_FORMAT, err.Format())); + + Controller::OtaSoftwareUpdateProviderCluster cluster; + cluster.Associate(deviceProxy, kOtaProviderEndpoint); + + err = cluster.InvokeCommand(request.args, /* context = */ nullptr, OnQueryImageResponse, OnQueryImageFailure); + VerifyOrReturn(err == CHIP_NO_ERROR, + ChipLogError(SoftwareUpdate, "Failed to send QueryImage command: %" CHIP_ERROR_FORMAT, err.Format())); break; } @@ -410,3 +380,37 @@ void OTARequestor::TriggerImmediateQuery() // Perhaps we don't need a separate function ConnectToProvider, revisit this ConnectToProvider(); } + +CHIP_ERROR OTARequestor::BuildQueryImageRequest(QueryImageRequest & request) +{ + constexpr EmberAfOTADownloadProtocol kProtocolsSupported[] = { EMBER_ZCL_OTA_DOWNLOAD_PROTOCOL_BDX_SYNCHRONOUS }; + constexpr bool kRequestorCanConsent = false; + QueryImage::Type & args = request.args; + + uint16_t vendorId; + VerifyOrReturnError(Basic::Attributes::VendorID::Get(kRootEndpointId, &vendorId) == EMBER_ZCL_STATUS_SUCCESS, + CHIP_ERROR_READ_FAILED); + args.vendorId = static_cast(vendorId); + + VerifyOrReturnError(Basic::Attributes::ProductID::Get(kRootEndpointId, &args.productId) == EMBER_ZCL_STATUS_SUCCESS, + CHIP_ERROR_READ_FAILED); + + VerifyOrReturnError(Basic::Attributes::SoftwareVersion::Get(kRootEndpointId, &args.softwareVersion) == EMBER_ZCL_STATUS_SUCCESS, + CHIP_ERROR_READ_FAILED); + + args.protocolsSupported = kProtocolsSupported; + args.requestorCanConsent.SetValue(kRequestorCanConsent); + + uint16_t hardwareVersion; + if (Basic::Attributes::HardwareVersion::Get(kRootEndpointId, &hardwareVersion) == EMBER_ZCL_STATUS_SUCCESS) + { + args.hardwareVersion.SetValue(hardwareVersion); + } + + if (Basic::Attributes::Location::Get(kRootEndpointId, MutableCharSpan(request.location)) == EMBER_ZCL_STATUS_SUCCESS) + { + args.location.SetValue(CharSpan(request.location)); + } + + return CHIP_NO_ERROR; +} diff --git a/src/app/clusters/ota-requestor/OTARequestor.h b/src/app/clusters/ota-requestor/OTARequestor.h index a0755fe74ca956..5f028a5ea8dbae 100644 --- a/src/app/clusters/ota-requestor/OTARequestor.h +++ b/src/app/clusters/ota-requestor/OTARequestor.h @@ -85,6 +85,8 @@ class OTARequestor : public OTARequestorInterface kStartBDX, }; + struct QueryImageRequest; + // TODO: the application should define this, along with initializing the BDXDownloader // This class is purely for delivering messages and sending outgoing messages to/from the BDXDownloader. @@ -169,4 +171,5 @@ class OTARequestor : public OTARequestorInterface // Functions CHIP_ERROR SetupCASESessionManager(chip::FabricIndex fabricIndex); + CHIP_ERROR BuildQueryImageRequest(QueryImageRequest & req); }; diff --git a/src/lib/core/DataModelTypes.h b/src/lib/core/DataModelTypes.h index 406818a96abf22..9b2b7b64fb5162 100644 --- a/src/lib/core/DataModelTypes.h +++ b/src/lib/core/DataModelTypes.h @@ -43,9 +43,10 @@ typedef uint32_t FieldId; typedef uint16_t ListIndex; typedef uint32_t TransactionId; -static constexpr FabricIndex kUndefinedFabricIndex = 0; -static constexpr EndpointId kInvalidEndpointId = 0xFFFF; -static constexpr ListIndex kInvalidListIndex = 0xFFFF; // List index is a uint16 thus 0xFFFF is a invalid list index. +constexpr FabricIndex kUndefinedFabricIndex = 0; +constexpr EndpointId kInvalidEndpointId = 0xFFFF; +constexpr EndpointId kRootEndpointId = 0; +constexpr ListIndex kInvalidListIndex = 0xFFFF; // List index is a uint16 thus 0xFFFF is a invalid list index. // ClusterId, AttributeId and EventId are MEIs, // 0xFFFF is not a valid manufacturer code, thus 0xFFFF'FFFF is not a valid MEI. diff --git a/zzz_generated/ota-requestor-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/ota-requestor-app/zap-generated/IMClusterCommandHandler.cpp index a15f71c4739fb6..fbdaea73b60146 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/ota-requestor-app/zap-generated/IMClusterCommandHandler.cpp @@ -41,6 +41,15 @@ namespace app { namespace Clusters { +namespace Basic { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + ReportCommandUnsupported(apCommandObj, aCommandPath); +} + +} // namespace Basic + namespace GeneralCommissioning { void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) @@ -561,6 +570,9 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: switch (aCommandPath.mClusterId) { + case Clusters::Basic::Id: + Clusters::Basic::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; case Clusters::GeneralCommissioning::Id: Clusters::GeneralCommissioning::DispatchServerCommand(apCommandObj, aCommandPath, aReader); break; diff --git a/zzz_generated/ota-requestor-app/zap-generated/PluginApplicationCallbacks.h b/zzz_generated/ota-requestor-app/zap-generated/PluginApplicationCallbacks.h index 759ae6494cfb01..5e0a39c4c44479 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/PluginApplicationCallbacks.h +++ b/zzz_generated/ota-requestor-app/zap-generated/PluginApplicationCallbacks.h @@ -22,6 +22,7 @@ #include #define MATTER_PLUGINS_INIT \ + MatterBasicPluginServerInitCallback(); \ MatterGeneralCommissioningPluginServerInitCallback(); \ MatterNetworkCommissioningPluginServerInitCallback(); \ MatterOtaSoftwareUpdateProviderPluginClientInitCallback(); \ diff --git a/zzz_generated/ota-requestor-app/zap-generated/callback-stub.cpp b/zzz_generated/ota-requestor-app/zap-generated/callback-stub.cpp index 87bbd91ee33619..ccadfab0aacdeb 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/callback-stub.cpp +++ b/zzz_generated/ota-requestor-app/zap-generated/callback-stub.cpp @@ -29,6 +29,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) { switch (clusterId) { + case ZCL_BASIC_CLUSTER_ID: + emberAfBasicClusterInitCallback(endpoint); + break; case ZCL_GENERAL_COMMISSIONING_CLUSTER_ID: emberAfGeneralCommissioningClusterInitCallback(endpoint); break; @@ -50,6 +53,11 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) } } +void __attribute__((weak)) emberAfBasicClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfGeneralCommissioningClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/zzz_generated/ota-requestor-app/zap-generated/endpoint_config.h b/zzz_generated/ota-requestor-app/zap-generated/endpoint_config.h index 4e9b63188b20c8..f221ff4d734912 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/endpoint_config.h +++ b/zzz_generated/ota-requestor-app/zap-generated/endpoint_config.h @@ -27,12 +27,17 @@ #define GENERATED_DEFAULTS \ { \ \ - /* Endpoint: 0, Cluster: General Commissioning (server), big-endian */ \ + /* Endpoint: 0, Cluster: Basic (server), big-endian */ \ \ - /* 0 - Breadcrumb, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + /* 0 - SoftwareVersion, */ \ + 0x00, 0x00, 0x00, 0x00, \ \ - /* 8 - BasicCommissioningInfoList, */ \ + /* Endpoint: 0, Cluster: General Commissioning (server), big-endian */ \ + \ + /* 4 - Breadcrumb, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + \ + /* 12 - BasicCommissioningInfoList, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -48,12 +53,12 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 262 - FeatureMap, */ \ + /* 266 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Network Commissioning (server), big-endian */ \ \ - /* 266 - FeatureMap, */ \ + /* 270 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x01, \ } @@ -61,12 +66,17 @@ #define GENERATED_DEFAULTS \ { \ \ - /* Endpoint: 0, Cluster: General Commissioning (server), little-endian */ \ + /* Endpoint: 0, Cluster: Basic (server), little-endian */ \ + \ + /* 0 - SoftwareVersion, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* Endpoint: 0, Cluster: General Commissioning (server), little-endian */ \ \ - /* 0 - Breadcrumb, */ \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ + /* 4 - Breadcrumb, */ \ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 8 - BasicCommissioningInfoList, */ \ + /* 12 - BasicCommissioningInfoList, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ @@ -82,18 +92,18 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 262 - FeatureMap, */ \ + /* 266 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Network Commissioning (server), little-endian */ \ \ - /* 266 - FeatureMap, */ \ + /* 270 - FeatureMap, */ \ 0x01, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (4) +#define GENERATED_DEFAULTS_COUNT (5) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -121,12 +131,28 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 18 +#define GENERATED_ATTRIBUTE_COUNT 30 #define GENERATED_ATTRIBUTES \ { \ \ - /* Endpoint: 0, Cluster: OTA Software Update Provider (client) */ \ - { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + /* Endpoint: 0, Cluster: Basic (server) */ \ + { 0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(1) }, /* InteractionModelVersion */ \ + { 0x0001, ZAP_TYPE(CHAR_STRING), 33, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ + { 0x0002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* VendorID */ \ + { 0x0003, ZAP_TYPE(CHAR_STRING), 33, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* ProductName */ \ + { 0x0004, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* ProductID */ \ + { 0x0005, ZAP_TYPE(CHAR_STRING), 33, ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_EMPTY_DEFAULT() }, /* NodeLabel */ \ + { 0x0006, ZAP_TYPE(CHAR_STRING), 3, ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_EMPTY_DEFAULT() }, /* Location */ \ + { 0x0007, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(0) }, /* HardwareVersion */ \ + { 0x0008, ZAP_TYPE(CHAR_STRING), 65, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* HardwareVersionString */ \ + { 0x0009, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_LONG_DEFAULTS_INDEX(0) }, /* SoftwareVersion */ \ + { 0x000A, ZAP_TYPE(CHAR_STRING), 65, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* SoftwareVersionString */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ + \ + /* Endpoint: 0, Cluster: OTA Software Update Provider (client) */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(CLIENT), ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: OTA Software Update Requestor (server) */ \ { 0x0001, ZAP_TYPE(OCTET_STRING), 17, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* default ota provider */ \ @@ -134,15 +160,15 @@ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: General Commissioning (server) */ \ - { 0x0000, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(0) }, /* Breadcrumb */ \ - { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(8) }, /* BasicCommissioningInfoList */ \ + { 0x0000, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(4) }, /* Breadcrumb */ \ + { 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(12) }, /* BasicCommissioningInfoList */ \ { 0x0002, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* RegulatoryConfig */ \ { 0x0003, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* LocationCapability */ \ - { 0xFFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(262) }, /* FeatureMap */ \ + { 0xFFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(266) }, /* FeatureMap */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Network Commissioning (server) */ \ - { 0xFFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(266) }, /* FeatureMap */ \ + { 0xFFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(270) }, /* FeatureMap */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ @@ -160,26 +186,35 @@ #define ZAP_ATTRIBUTE_INDEX(index) ((EmberAfAttributeMetadata *) (&generatedAttributes[index])) // Cluster function static arrays -#define GENERATED_FUNCTION_ARRAYS +#define GENERATED_FUNCTION_ARRAYS \ + const EmberAfGenericClusterFunction chipFuncArrayBasicServer[] = { \ + (EmberAfGenericClusterFunction) emberAfBasicClusterServerInitCallback, \ + }; #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 5 +#define GENERATED_CLUSTER_COUNT 6 #define GENERATED_CLUSTERS \ { \ - { \ - 0x0029, ZAP_ATTRIBUTE_INDEX(0), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ - }, /* Endpoint: 0, Cluster: OTA Software Update Provider (client) */ \ + { 0x0028, \ + ZAP_ATTRIBUTE_INDEX(0), \ + 12, \ + 246, \ + ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ + chipFuncArrayBasicServer }, /* Endpoint: 0, Cluster: Basic (server) */ \ + { \ + 0x0029, ZAP_ATTRIBUTE_INDEX(12), 1, 2, ZAP_CLUSTER_MASK(CLIENT), NULL \ + }, /* Endpoint: 0, Cluster: OTA Software Update Provider (client) */ \ { \ - 0x002A, ZAP_ATTRIBUTE_INDEX(1), 3, 20, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x002A, ZAP_ATTRIBUTE_INDEX(13), 3, 20, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: OTA Software Update Requestor (server) */ \ { \ - 0x0030, ZAP_ATTRIBUTE_INDEX(4), 6, 270, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0030, ZAP_ATTRIBUTE_INDEX(16), 6, 270, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: General Commissioning (server) */ \ { \ - 0x0031, ZAP_ATTRIBUTE_INDEX(10), 2, 6, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0031, ZAP_ATTRIBUTE_INDEX(22), 2, 6, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Network Commissioning (server) */ \ { \ - 0x003E, ZAP_ATTRIBUTE_INDEX(12), 6, 4, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x003E, ZAP_ATTRIBUTE_INDEX(24), 6, 4, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ } @@ -188,17 +223,17 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 5, 302 }, \ + { ZAP_CLUSTER_INDEX(0), 6, 548 }, \ } // Largest attribute size is needed for various buffers #define ATTRIBUTE_LARGEST (401) // Total size of singleton attributes -#define ATTRIBUTE_SINGLETONS_SIZE (0) +#define ATTRIBUTE_SINGLETONS_SIZE (246) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (302) +#define ATTRIBUTE_MAX_SIZE (548) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (1) diff --git a/zzz_generated/ota-requestor-app/zap-generated/gen_config.h b/zzz_generated/ota-requestor-app/zap-generated/gen_config.h index 63e61e4f155001..0dc804287607e4 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/gen_config.h +++ b/zzz_generated/ota-requestor-app/zap-generated/gen_config.h @@ -29,6 +29,7 @@ #define EMBER_APS_UNICAST_MESSAGE_COUNT 10 /**** Cluster endpoint counts ****/ +#define EMBER_AF_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_GENERAL_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_NETWORK_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_OTA_PROVIDER_CLUSTER_CLIENT_ENDPOINT_COUNT (1) @@ -37,6 +38,11 @@ /**** Cluster Plugins ****/ +// Use this macro to check if the server side of the Basic cluster is included +#define ZCL_USING_BASIC_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_BASIC_SERVER +#define EMBER_AF_PLUGIN_BASIC + // Use this macro to check if the server side of the General Commissioning cluster is included #define ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_SERVER #define EMBER_AF_PLUGIN_GENERAL_COMMISSIONING_SERVER From 56402e593b0006265b056fae0a5c5be3aa6fa8ac Mon Sep 17 00:00:00 2001 From: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com> Date: Wed, 8 Dec 2021 19:09:02 -0500 Subject: [PATCH 11/28] Enable group server on all-apps-cluster (#12701) * Add group server update test * generated files --- .../all-clusters-common/all-clusters-app.zap | 4 +- .../tests/suites/TestDescriptorCluster.yaml | 1 + .../Framework/CHIPTests/CHIPClustersTests.m | 41 ++--- .../zap-generated/endpoint_config.h | 170 ++++++++++-------- .../zap-generated/gen_config.h | 2 +- .../chip-tool/zap-generated/test/Commands.h | 42 ++--- 6 files changed, 143 insertions(+), 117 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 8cc34bd744017b..5457d4a1390dba 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -233,7 +233,7 @@ "mfgCode": null, "define": "GROUPS_CLUSTER", "side": "server", - "enabled": 0, + "enabled": 1, "commands": [ { "name": "AddGroupResponse", @@ -17129,7 +17129,7 @@ "mfgCode": null, "define": "GROUPS_CLUSTER", "side": "server", - "enabled": 0, + "enabled": 1, "commands": [ { "name": "AddGroupResponse", diff --git a/src/app/tests/suites/TestDescriptorCluster.yaml b/src/app/tests/suites/TestDescriptorCluster.yaml index fcc43768ecc833..7d7a355c583a47 100644 --- a/src/app/tests/suites/TestDescriptorCluster.yaml +++ b/src/app/tests/suites/TestDescriptorCluster.yaml @@ -35,6 +35,7 @@ tests: response: value: [ 0x0003, # Identify + 0x0004, # Groups 0x001D, # Descriptor 0x001E, # Binding 0x001F, # Access Control diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index e249d0f32fb8d5..9ec46b56905baf 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -29845,27 +29845,28 @@ - (void)testSendClusterTestDescriptorCluster_000002_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue count], 20); + XCTAssertEqual([actualValue count], 21); XCTAssertEqual([actualValue[0] unsignedIntValue], 3UL); - XCTAssertEqual([actualValue[1] unsignedIntValue], 29UL); - XCTAssertEqual([actualValue[2] unsignedIntValue], 30UL); - XCTAssertEqual([actualValue[3] unsignedIntValue], 31UL); - XCTAssertEqual([actualValue[4] unsignedIntValue], 40UL); - XCTAssertEqual([actualValue[5] unsignedIntValue], 41UL); - XCTAssertEqual([actualValue[6] unsignedIntValue], 42UL); - XCTAssertEqual([actualValue[7] unsignedIntValue], 46UL); - XCTAssertEqual([actualValue[8] unsignedIntValue], 48UL); - XCTAssertEqual([actualValue[9] unsignedIntValue], 49UL); - XCTAssertEqual([actualValue[10] unsignedIntValue], 50UL); - XCTAssertEqual([actualValue[11] unsignedIntValue], 51UL); - XCTAssertEqual([actualValue[12] unsignedIntValue], 52UL); - XCTAssertEqual([actualValue[13] unsignedIntValue], 53UL); - XCTAssertEqual([actualValue[14] unsignedIntValue], 54UL); - XCTAssertEqual([actualValue[15] unsignedIntValue], 55UL); - XCTAssertEqual([actualValue[16] unsignedIntValue], 60UL); - XCTAssertEqual([actualValue[17] unsignedIntValue], 62UL); - XCTAssertEqual([actualValue[18] unsignedIntValue], 63UL); - XCTAssertEqual([actualValue[19] unsignedIntValue], 1029UL); + XCTAssertEqual([actualValue[1] unsignedIntValue], 4UL); + XCTAssertEqual([actualValue[2] unsignedIntValue], 29UL); + XCTAssertEqual([actualValue[3] unsignedIntValue], 30UL); + XCTAssertEqual([actualValue[4] unsignedIntValue], 31UL); + XCTAssertEqual([actualValue[5] unsignedIntValue], 40UL); + XCTAssertEqual([actualValue[6] unsignedIntValue], 41UL); + XCTAssertEqual([actualValue[7] unsignedIntValue], 42UL); + XCTAssertEqual([actualValue[8] unsignedIntValue], 46UL); + XCTAssertEqual([actualValue[9] unsignedIntValue], 48UL); + XCTAssertEqual([actualValue[10] unsignedIntValue], 49UL); + XCTAssertEqual([actualValue[11] unsignedIntValue], 50UL); + XCTAssertEqual([actualValue[12] unsignedIntValue], 51UL); + XCTAssertEqual([actualValue[13] unsignedIntValue], 52UL); + XCTAssertEqual([actualValue[14] unsignedIntValue], 53UL); + XCTAssertEqual([actualValue[15] unsignedIntValue], 54UL); + XCTAssertEqual([actualValue[16] unsignedIntValue], 55UL); + XCTAssertEqual([actualValue[17] unsignedIntValue], 60UL); + XCTAssertEqual([actualValue[18] unsignedIntValue], 62UL); + XCTAssertEqual([actualValue[19] unsignedIntValue], 63UL); + XCTAssertEqual([actualValue[20] unsignedIntValue], 1029UL); } [expectation fulfill]; diff --git a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h index 0cc27cd1252ba5..0fc09ca84ce58d 100644 --- a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h @@ -1477,7 +1477,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 563 +#define GENERATED_ATTRIBUTE_COUNT 567 #define GENERATED_ATTRIBUTES \ { \ \ @@ -1487,6 +1487,10 @@ { 0x0001, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x0) }, /* identify type */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* ClusterRevision */ \ \ + /* Endpoint: 0, Cluster: Groups (server) */ \ + { 0x0000, ZAP_TYPE(BITMAP8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* name support */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ + \ /* Endpoint: 0, Cluster: Descriptor (server) */ \ { 0x0000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* device list */ \ { 0x0001, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* server list */ \ @@ -2254,6 +2258,10 @@ { 0x050D, ZAP_TYPE(INT16S), 2, 0, ZAP_SIMPLE_DEFAULT(0xffff) }, /* active power max */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ \ + /* Endpoint: 2, Cluster: Groups (server) */ \ + { 0x0000, ZAP_TYPE(BITMAP8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* name support */ \ + { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ + \ /* Endpoint: 2, Cluster: On/Off (server) */ \ { 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* OnOff */ \ { 0x4000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(1) }, /* GlobalSceneControl */ \ @@ -2286,12 +2294,12 @@ (EmberAfGenericClusterFunction) emberAfIdentifyClusterServerInitCallback, \ (EmberAfGenericClusterFunction) MatterIdentifyClusterServerAttributeChangedCallback, \ }; \ - const EmberAfGenericClusterFunction chipFuncArrayBasicServer[] = { \ - (EmberAfGenericClusterFunction) emberAfBasicClusterServerInitCallback, \ - }; \ const EmberAfGenericClusterFunction chipFuncArrayGroupsServer[] = { \ (EmberAfGenericClusterFunction) emberAfGroupsClusterServerInitCallback, \ }; \ + const EmberAfGenericClusterFunction chipFuncArrayBasicServer[] = { \ + (EmberAfGenericClusterFunction) emberAfBasicClusterServerInitCallback, \ + }; \ const EmberAfGenericClusterFunction chipFuncArrayScenesServer[] = { \ (EmberAfGenericClusterFunction) emberAfScenesClusterServerInitCallback, \ }; \ @@ -2324,7 +2332,7 @@ }; #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 68 +#define GENERATED_CLUSTER_COUNT 70 #define GENERATED_CLUSTERS \ { \ { 0x0003, \ @@ -2333,248 +2341,262 @@ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ chipFuncArrayIdentifyServer }, /* Endpoint: 0, Cluster: Identify (server) */ \ + { 0x0004, \ + ZAP_ATTRIBUTE_INDEX(3), \ + 2, \ + 3, \ + ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ + chipFuncArrayGroupsServer }, /* Endpoint: 0, Cluster: Groups (server) */ \ { \ - 0x001D, ZAP_ATTRIBUTE_INDEX(3), 5, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x001D, ZAP_ATTRIBUTE_INDEX(5), 5, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Descriptor (server) */ \ - { 0x001E, ZAP_ATTRIBUTE_INDEX(8), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL }, /* Endpoint: 0, Cluster: Binding (server) */ \ { \ - 0x001F, ZAP_ATTRIBUTE_INDEX(9), 3, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x001E, ZAP_ATTRIBUTE_INDEX(10), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + }, /* Endpoint: 0, Cluster: Binding (server) */ \ + { \ + 0x001F, ZAP_ATTRIBUTE_INDEX(11), 3, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Access Control (server) */ \ { 0x0028, \ - ZAP_ATTRIBUTE_INDEX(12), \ + ZAP_ATTRIBUTE_INDEX(14), \ 20, \ 687, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayBasicServer }, /* Endpoint: 0, Cluster: Basic (server) */ \ { \ - 0x0029, ZAP_ATTRIBUTE_INDEX(32), 0, 0, ZAP_CLUSTER_MASK(CLIENT), NULL \ + 0x0029, ZAP_ATTRIBUTE_INDEX(34), 0, 0, ZAP_CLUSTER_MASK(CLIENT), NULL \ }, /* Endpoint: 0, Cluster: OTA Software Update Provider (client) */ \ { \ - 0x0029, ZAP_ATTRIBUTE_INDEX(32), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0029, ZAP_ATTRIBUTE_INDEX(34), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: OTA Software Update Provider (server) */ \ { \ - 0x002A, ZAP_ATTRIBUTE_INDEX(33), 3, 20, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x002A, ZAP_ATTRIBUTE_INDEX(35), 3, 20, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: OTA Software Update Requestor (server) */ \ { \ - 0x002E, ZAP_ATTRIBUTE_INDEX(36), 2, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x002E, ZAP_ATTRIBUTE_INDEX(38), 2, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Power Source Configuration (server) */ \ { \ - 0x0030, ZAP_ATTRIBUTE_INDEX(38), 6, 270, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0030, ZAP_ATTRIBUTE_INDEX(40), 6, 270, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: General Commissioning (server) */ \ { \ - 0x0031, ZAP_ATTRIBUTE_INDEX(44), 2, 6, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0031, ZAP_ATTRIBUTE_INDEX(46), 2, 6, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Network Commissioning (server) */ \ { \ - 0x0032, ZAP_ATTRIBUTE_INDEX(46), 0, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0032, ZAP_ATTRIBUTE_INDEX(48), 0, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Diagnostic Logs (server) */ \ { \ - 0x0033, ZAP_ATTRIBUTE_INDEX(46), 9, 17, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0033, ZAP_ATTRIBUTE_INDEX(48), 9, 17, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: General Diagnostics (server) */ \ { \ - 0x0034, ZAP_ATTRIBUTE_INDEX(55), 6, 30, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0034, ZAP_ATTRIBUTE_INDEX(57), 6, 30, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Software Diagnostics (server) */ \ { \ - 0x0035, ZAP_ATTRIBUTE_INDEX(61), 65, 247, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0035, ZAP_ATTRIBUTE_INDEX(63), 65, 247, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Thread Network Diagnostics (server) */ \ { \ - 0x0036, ZAP_ATTRIBUTE_INDEX(126), 15, 58, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0036, ZAP_ATTRIBUTE_INDEX(128), 15, 58, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ { \ - 0x0037, ZAP_ATTRIBUTE_INDEX(141), 11, 57, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0037, ZAP_ATTRIBUTE_INDEX(143), 11, 57, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ { \ - 0x003C, ZAP_ATTRIBUTE_INDEX(152), 4, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x003C, ZAP_ATTRIBUTE_INDEX(154), 4, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ { \ - 0x003E, ZAP_ATTRIBUTE_INDEX(156), 6, 4, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x003E, ZAP_ATTRIBUTE_INDEX(158), 6, 4, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ { \ - 0x003F, ZAP_ATTRIBUTE_INDEX(162), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x003F, ZAP_ATTRIBUTE_INDEX(164), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Group Key Management (server) */ \ { \ - 0x0405, ZAP_ATTRIBUTE_INDEX(165), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0405, ZAP_ATTRIBUTE_INDEX(167), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 0, Cluster: Relative Humidity Measurement (server) */ \ { 0x0003, \ - ZAP_ATTRIBUTE_INDEX(169), \ + ZAP_ATTRIBUTE_INDEX(171), \ 3, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ chipFuncArrayIdentifyServer }, /* Endpoint: 1, Cluster: Identify (server) */ \ { 0x0004, \ - ZAP_ATTRIBUTE_INDEX(172), \ + ZAP_ATTRIBUTE_INDEX(174), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayGroupsServer }, /* Endpoint: 1, Cluster: Groups (server) */ \ { 0x0005, \ - ZAP_ATTRIBUTE_INDEX(174), \ + ZAP_ATTRIBUTE_INDEX(176), \ 6, \ 8, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayScenesServer }, /* Endpoint: 1, Cluster: Scenes (server) */ \ { 0x0006, \ - ZAP_ATTRIBUTE_INDEX(180), \ + ZAP_ATTRIBUTE_INDEX(182), \ 7, \ 13, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayOnOffServer }, /* Endpoint: 1, Cluster: On/Off (server) */ \ { \ - 0x0007, ZAP_ATTRIBUTE_INDEX(187), 3, 4, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0007, ZAP_ATTRIBUTE_INDEX(189), 3, 4, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: On/off Switch Configuration (server) */ \ { 0x0008, \ - ZAP_ATTRIBUTE_INDEX(190), \ + ZAP_ATTRIBUTE_INDEX(192), \ 15, \ 23, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayLevelControlServer }, /* Endpoint: 1, Cluster: Level Control (server) */ \ { \ - 0x000F, ZAP_ATTRIBUTE_INDEX(205), 4, 5, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x000F, ZAP_ATTRIBUTE_INDEX(207), 4, 5, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Binary Input (Basic) (server) */ \ { \ - 0x001D, ZAP_ATTRIBUTE_INDEX(209), 5, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x001D, ZAP_ATTRIBUTE_INDEX(211), 5, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Descriptor (server) */ \ { \ - 0x001E, ZAP_ATTRIBUTE_INDEX(214), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x001E, ZAP_ATTRIBUTE_INDEX(216), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Binding (server) */ \ { \ - 0x0025, ZAP_ATTRIBUTE_INDEX(215), 4, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0025, ZAP_ATTRIBUTE_INDEX(217), 4, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Bridged Actions (server) */ \ { \ - 0x002F, ZAP_ATTRIBUTE_INDEX(219), 11, 88, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x002F, ZAP_ATTRIBUTE_INDEX(221), 11, 88, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Power Source (server) */ \ { \ - 0x0039, ZAP_ATTRIBUTE_INDEX(230), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0039, ZAP_ATTRIBUTE_INDEX(232), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Bridged Device Basic (server) */ \ { \ - 0x003B, ZAP_ATTRIBUTE_INDEX(231), 5, 9, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x003B, ZAP_ATTRIBUTE_INDEX(233), 5, 9, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Switch (server) */ \ { \ - 0x0040, ZAP_ATTRIBUTE_INDEX(236), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0040, ZAP_ATTRIBUTE_INDEX(238), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Fixed Label (server) */ \ { \ - 0x0045, ZAP_ATTRIBUTE_INDEX(238), 2, 3, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0045, ZAP_ATTRIBUTE_INDEX(240), 2, 3, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Boolean State (server) */ \ { \ - 0x0050, ZAP_ATTRIBUTE_INDEX(240), 6, 38, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0050, ZAP_ATTRIBUTE_INDEX(242), 6, 38, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Mode Select (server) */ \ { 0x0101, \ - ZAP_ATTRIBUTE_INDEX(246), \ + ZAP_ATTRIBUTE_INDEX(248), \ 8, \ 14, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ chipFuncArrayDoorLockServer }, /* Endpoint: 1, Cluster: Door Lock (server) */ \ { \ - 0x0102, ZAP_ATTRIBUTE_INDEX(254), 20, 35, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0102, ZAP_ATTRIBUTE_INDEX(256), 20, 35, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Window Covering (server) */ \ { \ - 0x0103, ZAP_ATTRIBUTE_INDEX(274), 5, 7, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0103, ZAP_ATTRIBUTE_INDEX(276), 5, 7, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Barrier Control (server) */ \ { \ 0x0200, \ - ZAP_ATTRIBUTE_INDEX(279), \ + ZAP_ATTRIBUTE_INDEX(281), \ 26, \ 54, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ chipFuncArrayPumpConfigurationAndControlServer \ }, /* Endpoint: 1, Cluster: Pump Configuration and Control (server) */ \ { \ - 0x0201, ZAP_ATTRIBUTE_INDEX(305), 19, 34, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0201, ZAP_ATTRIBUTE_INDEX(307), 19, 34, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Thermostat (server) */ \ { \ 0x0204, \ - ZAP_ATTRIBUTE_INDEX(324), \ + ZAP_ATTRIBUTE_INDEX(326), \ 4, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ chipFuncArrayThermostatUserInterfaceConfigurationServer \ }, /* Endpoint: 1, Cluster: Thermostat User Interface Configuration (server) */ \ { 0x0300, \ - ZAP_ATTRIBUTE_INDEX(328), \ + ZAP_ATTRIBUTE_INDEX(330), \ 53, \ 341, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayColorControlServer }, /* Endpoint: 1, Cluster: Color Control (server) */ \ { \ - 0x0400, ZAP_ATTRIBUTE_INDEX(381), 6, 11, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0400, ZAP_ATTRIBUTE_INDEX(383), 6, 11, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Illuminance Measurement (server) */ \ { \ - 0x0402, ZAP_ATTRIBUTE_INDEX(387), 5, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0402, ZAP_ATTRIBUTE_INDEX(389), 5, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Temperature Measurement (server) */ \ { \ - 0x0403, ZAP_ATTRIBUTE_INDEX(392), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0403, ZAP_ATTRIBUTE_INDEX(394), 4, 8, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Pressure Measurement (server) */ \ { \ - 0x0404, ZAP_ATTRIBUTE_INDEX(396), 5, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0404, ZAP_ATTRIBUTE_INDEX(398), 5, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Flow Measurement (server) */ \ { \ - 0x0405, ZAP_ATTRIBUTE_INDEX(401), 5, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0405, ZAP_ATTRIBUTE_INDEX(403), 5, 10, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Relative Humidity Measurement (server) */ \ { 0x0406, \ - ZAP_ATTRIBUTE_INDEX(406), \ + ZAP_ATTRIBUTE_INDEX(408), \ 4, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayOccupancySensingServer }, /* Endpoint: 1, Cluster: Occupancy Sensing (server) */ \ { 0x0500, \ - ZAP_ATTRIBUTE_INDEX(410), \ + ZAP_ATTRIBUTE_INDEX(412), \ 6, \ 16, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION) | \ ZAP_CLUSTER_MASK(MESSAGE_SENT_FUNCTION), \ chipFuncArrayIasZoneServer }, /* Endpoint: 1, Cluster: IAS Zone (server) */ \ { \ - 0x0503, ZAP_ATTRIBUTE_INDEX(416), 2, 35, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0503, ZAP_ATTRIBUTE_INDEX(418), 2, 35, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Wake on LAN (server) */ \ { \ - 0x0504, ZAP_ATTRIBUTE_INDEX(418), 4, 322, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0504, ZAP_ATTRIBUTE_INDEX(420), 4, 322, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: TV Channel (server) */ \ { \ - 0x0505, ZAP_ATTRIBUTE_INDEX(422), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0505, ZAP_ATTRIBUTE_INDEX(424), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Target Navigator (server) */ \ { \ - 0x0506, ZAP_ATTRIBUTE_INDEX(424), 9, 59, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0506, ZAP_ATTRIBUTE_INDEX(426), 9, 59, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Media Playback (server) */ \ { \ - 0x0507, ZAP_ATTRIBUTE_INDEX(433), 3, 257, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0507, ZAP_ATTRIBUTE_INDEX(435), 3, 257, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Media Input (server) */ \ { \ - 0x0508, ZAP_ATTRIBUTE_INDEX(436), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0508, ZAP_ATTRIBUTE_INDEX(438), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Low Power (server) */ \ { \ - 0x0509, ZAP_ATTRIBUTE_INDEX(437), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0509, ZAP_ATTRIBUTE_INDEX(439), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Keypad Input (server) */ \ { \ - 0x050A, ZAP_ATTRIBUTE_INDEX(438), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050A, ZAP_ATTRIBUTE_INDEX(440), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Content Launcher (server) */ \ { \ - 0x050B, ZAP_ATTRIBUTE_INDEX(441), 3, 257, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050B, ZAP_ATTRIBUTE_INDEX(443), 3, 257, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Audio Output (server) */ \ { \ - 0x050C, ZAP_ATTRIBUTE_INDEX(444), 4, 258, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050C, ZAP_ATTRIBUTE_INDEX(446), 4, 258, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Application Launcher (server) */ \ { \ - 0x050D, ZAP_ATTRIBUTE_INDEX(448), 8, 108, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050D, ZAP_ATTRIBUTE_INDEX(450), 8, 108, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Application Basic (server) */ \ { \ - 0x050E, ZAP_ATTRIBUTE_INDEX(456), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050E, ZAP_ATTRIBUTE_INDEX(458), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Account Login (server) */ \ { \ - 0x050F, ZAP_ATTRIBUTE_INDEX(457), 78, 3285, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050F, ZAP_ATTRIBUTE_INDEX(459), 78, 3285, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Test Cluster (server) */ \ { \ - 0x0B04, ZAP_ATTRIBUTE_INDEX(535), 12, 28, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0B04, ZAP_ATTRIBUTE_INDEX(537), 12, 28, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Electrical Measurement (server) */ \ + { 0x0004, \ + ZAP_ATTRIBUTE_INDEX(549), \ + 2, \ + 3, \ + ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ + chipFuncArrayGroupsServer }, /* Endpoint: 2, Cluster: Groups (server) */ \ { 0x0006, \ - ZAP_ATTRIBUTE_INDEX(547), \ + ZAP_ATTRIBUTE_INDEX(551), \ 7, \ 13, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayOnOffServer }, /* Endpoint: 2, Cluster: On/Off (server) */ \ { \ - 0x001D, ZAP_ATTRIBUTE_INDEX(554), 5, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x001D, ZAP_ATTRIBUTE_INDEX(558), 5, 0, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 2, Cluster: Descriptor (server) */ \ { 0x0406, \ - ZAP_ATTRIBUTE_INDEX(559), \ + ZAP_ATTRIBUTE_INDEX(563), \ 4, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -2586,7 +2608,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 21, 1927 }, { ZAP_CLUSTER_INDEX(21), 44, 6400 }, { ZAP_CLUSTER_INDEX(65), 3, 18 }, \ + { ZAP_CLUSTER_INDEX(0), 22, 1930 }, { ZAP_CLUSTER_INDEX(22), 44, 6400 }, { ZAP_CLUSTER_INDEX(66), 4, 21 }, \ } // Largest attribute size is needed for various buffers @@ -2596,7 +2618,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (689) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (8345) +#define ATTRIBUTE_MAX_SIZE (8351) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (3) diff --git a/zzz_generated/all-clusters-app/zap-generated/gen_config.h b/zzz_generated/all-clusters-app/zap-generated/gen_config.h index 0630089311861f..27f14da1394675 100644 --- a/zzz_generated/all-clusters-app/zap-generated/gen_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/gen_config.h @@ -54,7 +54,7 @@ #define EMBER_AF_GENERAL_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_GENERAL_DIAGNOSTICS_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_GROUP_KEY_MANAGEMENT_CLUSTER_SERVER_ENDPOINT_COUNT (1) -#define EMBER_AF_GROUPS_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_GROUPS_CLUSTER_SERVER_ENDPOINT_COUNT (3) #define EMBER_AF_IAS_ZONE_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_IDENTIFY_CLUSTER_SERVER_ENDPOINT_COUNT (2) #define EMBER_AF_ILLUMINANCE_MEASUREMENT_CLUSTER_SERVER_ENDPOINT_COUNT (1) diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 711df2959903d8..2366369503ad04 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -47646,44 +47646,46 @@ class TestDescriptorCluster : public TestCommand VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 0)); VerifyOrReturn(CheckValue("serverList[0]", iter.GetValue(), 3UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 1)); - VerifyOrReturn(CheckValue("serverList[1]", iter.GetValue(), 29UL)); + VerifyOrReturn(CheckValue("serverList[1]", iter.GetValue(), 4UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 2)); - VerifyOrReturn(CheckValue("serverList[2]", iter.GetValue(), 30UL)); + VerifyOrReturn(CheckValue("serverList[2]", iter.GetValue(), 29UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 3)); - VerifyOrReturn(CheckValue("serverList[3]", iter.GetValue(), 31UL)); + VerifyOrReturn(CheckValue("serverList[3]", iter.GetValue(), 30UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 4)); - VerifyOrReturn(CheckValue("serverList[4]", iter.GetValue(), 40UL)); + VerifyOrReturn(CheckValue("serverList[4]", iter.GetValue(), 31UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 5)); - VerifyOrReturn(CheckValue("serverList[5]", iter.GetValue(), 41UL)); + VerifyOrReturn(CheckValue("serverList[5]", iter.GetValue(), 40UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 6)); - VerifyOrReturn(CheckValue("serverList[6]", iter.GetValue(), 42UL)); + VerifyOrReturn(CheckValue("serverList[6]", iter.GetValue(), 41UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 7)); - VerifyOrReturn(CheckValue("serverList[7]", iter.GetValue(), 46UL)); + VerifyOrReturn(CheckValue("serverList[7]", iter.GetValue(), 42UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 8)); - VerifyOrReturn(CheckValue("serverList[8]", iter.GetValue(), 48UL)); + VerifyOrReturn(CheckValue("serverList[8]", iter.GetValue(), 46UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 9)); - VerifyOrReturn(CheckValue("serverList[9]", iter.GetValue(), 49UL)); + VerifyOrReturn(CheckValue("serverList[9]", iter.GetValue(), 48UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 10)); - VerifyOrReturn(CheckValue("serverList[10]", iter.GetValue(), 50UL)); + VerifyOrReturn(CheckValue("serverList[10]", iter.GetValue(), 49UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 11)); - VerifyOrReturn(CheckValue("serverList[11]", iter.GetValue(), 51UL)); + VerifyOrReturn(CheckValue("serverList[11]", iter.GetValue(), 50UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 12)); - VerifyOrReturn(CheckValue("serverList[12]", iter.GetValue(), 52UL)); + VerifyOrReturn(CheckValue("serverList[12]", iter.GetValue(), 51UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 13)); - VerifyOrReturn(CheckValue("serverList[13]", iter.GetValue(), 53UL)); + VerifyOrReturn(CheckValue("serverList[13]", iter.GetValue(), 52UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 14)); - VerifyOrReturn(CheckValue("serverList[14]", iter.GetValue(), 54UL)); + VerifyOrReturn(CheckValue("serverList[14]", iter.GetValue(), 53UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 15)); - VerifyOrReturn(CheckValue("serverList[15]", iter.GetValue(), 55UL)); + VerifyOrReturn(CheckValue("serverList[15]", iter.GetValue(), 54UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 16)); - VerifyOrReturn(CheckValue("serverList[16]", iter.GetValue(), 60UL)); + VerifyOrReturn(CheckValue("serverList[16]", iter.GetValue(), 55UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 17)); - VerifyOrReturn(CheckValue("serverList[17]", iter.GetValue(), 62UL)); + VerifyOrReturn(CheckValue("serverList[17]", iter.GetValue(), 60UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 18)); - VerifyOrReturn(CheckValue("serverList[18]", iter.GetValue(), 63UL)); + VerifyOrReturn(CheckValue("serverList[18]", iter.GetValue(), 62UL)); VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 19)); - VerifyOrReturn(CheckValue("serverList[19]", iter.GetValue(), 1029UL)); - VerifyOrReturn(CheckNoMoreListItems("serverList", iter, 20)); + VerifyOrReturn(CheckValue("serverList[19]", iter.GetValue(), 63UL)); + VerifyOrReturn(CheckNextListItemDecodes("serverList", iter, 20)); + VerifyOrReturn(CheckValue("serverList[20]", iter.GetValue(), 1029UL)); + VerifyOrReturn(CheckNoMoreListItems("serverList", iter, 21)); NextTest(); } From 78ad213e3088e2e6317dbcd43b5e5f1c9a493145 Mon Sep 17 00:00:00 2001 From: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com> Date: Wed, 8 Dec 2021 19:30:27 -0500 Subject: [PATCH 12/28] Convert array to linked list to support dynamic endpoints (#12635) * Convert array to linked list --- .../identify-server/identify-server.cpp | 41 +++++++++++-------- .../identify-server/identify-server.h | 9 +++- .../clusters/on-off-server/on-off-server.cpp | 41 +++++++++++-------- .../clusters/on-off-server/on-off-server.h | 8 +++- 4 files changed, 61 insertions(+), 38 deletions(-) diff --git a/src/app/clusters/identify-server/identify-server.cpp b/src/app/clusters/identify-server/identify-server.cpp index c2f0fa4610d19f..ce7805dacd2748 100644 --- a/src/app/clusters/identify-server/identify-server.cpp +++ b/src/app/clusters/identify-server/identify-server.cpp @@ -64,42 +64,47 @@ using namespace chip; using namespace chip::app; using namespace chip::app::Clusters::Identify; -static std::array instances = { 0 }; +static Identify * firstIdentify = nullptr; static void onIdentifyClusterTick(chip::System::Layer * systemLayer, void * appState); static Identify * inst(EndpointId endpoint) { - for (size_t i = 0; i < instances.size(); i++) + Identify * current = firstIdentify; + while (current != nullptr && current->mEndpoint != endpoint) { - if (nullptr != instances[i] && endpoint == instances[i]->mEndpoint) - { - return instances[i]; - } + current = current->next(); } - return nullptr; + return current; } static inline void reg(Identify * inst) { - for (size_t i = 0; i < instances.size(); i++) - { - if (nullptr == instances[i]) - { - instances[i] = inst; - break; - } - } + inst->setNext(firstIdentify); + firstIdentify = inst; } static inline void unreg(Identify * inst) { - for (size_t i = 0; i < instances.size(); i++) + if (firstIdentify == inst) { - if (inst == instances[i]) + firstIdentify = firstIdentify->next(); + } + else + { + Identify * previous = firstIdentify; + Identify * current = firstIdentify->next(); + + while (current != nullptr && current != inst) + { + previous = current; + current = current->next(); + } + + if (current != nullptr) { - instances[i] = nullptr; + previous->setNext(current->next()); } } } diff --git a/src/app/clusters/identify-server/identify-server.h b/src/app/clusters/identify-server/identify-server.h index 38f53afedc045a..355c59914e42b5 100644 --- a/src/app/clusters/identify-server/identify-server.h +++ b/src/app/clusters/identify-server/identify-server.h @@ -58,5 +58,12 @@ struct Identify EmberAfIdentifyEffectIdentifier mCurrentEffectIdentifier; EmberAfIdentifyEffectIdentifier mTargetEffectIdentifier; uint8_t mEffectVariant; - bool mActive = false; + bool mActive = false; + Identify * nextIdentify = nullptr; + + bool hasNext() { return this->nextIdentify != nullptr; } + + Identify * next() { return this->nextIdentify; } + + void setNext(Identify * inst) { this->nextIdentify = inst; } }; diff --git a/src/app/clusters/on-off-server/on-off-server.cpp b/src/app/clusters/on-off-server/on-off-server.cpp index a92fba179ec750..8f764faa5ee6a7 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -68,7 +68,7 @@ using namespace chip::app::Clusters::OnOff; * Attributes Definition *********************************************************/ -static std::array instances = { 0 }; +static OnOffEffect * firstEffect = nullptr; OnOffServer OnOffServer::instance; /********************************************************** @@ -539,36 +539,41 @@ EmberEventControl * OnOffServer::configureEventControl(EndpointId endpoint) static OnOffEffect * inst(EndpointId endpoint) { - for (size_t i = 0; i < instances.size(); i++) + OnOffEffect * current = firstEffect; + while (current != nullptr && current->mEndpoint != endpoint) { - if (nullptr != instances[i] && endpoint == instances[i]->mEndpoint) - { - return instances[i]; - } + current = current->next(); } - return nullptr; + return current; } static inline void reg(OnOffEffect * inst) { - for (size_t i = 0; i < instances.size(); i++) - { - if (nullptr == instances[i]) - { - instances[i] = inst; - break; - } - } + inst->setNext(firstEffect); + firstEffect = inst; } static inline void unreg(OnOffEffect * inst) { - for (size_t i = 0; i < instances.size(); i++) + if (firstEffect == inst) { - if (inst == instances[i]) + firstEffect = firstEffect->next(); + } + else + { + OnOffEffect * previous = firstEffect; + OnOffEffect * current = firstEffect->next(); + + while (current != nullptr && current != inst) + { + previous = current; + current = current->next(); + } + + if (current != nullptr) { - instances[i] = nullptr; + previous->setNext(current->next()); } } } diff --git a/src/app/clusters/on-off-server/on-off-server.h b/src/app/clusters/on-off-server/on-off-server.h index 932a756ea21f48..0d7626d3e6c349 100644 --- a/src/app/clusters/on-off-server/on-off-server.h +++ b/src/app/clusters/on-off-server/on-off-server.h @@ -82,7 +82,7 @@ struct OnOffEffect OffWithEffectTriggerCommand mOffWithEffectTrigger = nullptr; uint8_t mEffectIdentifier; uint8_t mEffectVariant; - bool mActive = false; + OnOffEffect * nextEffect = nullptr; OnOffEffect( chip::EndpointId endpoint, OffWithEffectTriggerCommand offWithEffectTrigger, @@ -95,6 +95,12 @@ struct OnOffEffect */ uint8_t effectVariant = static_cast(EMBER_ZCL_ON_OFF_DELAYED_ALL_OFF_EFFECT_VARIANT_FADE_TO_OFF_IN_0P8_SECONDS)); ~OnOffEffect(); + + bool hasNext() { return this->nextEffect != nullptr; } + + OnOffEffect * next() { return this->nextEffect; } + + void setNext(OnOffEffect * inst) { this->nextEffect = inst; } }; /********************************************************** From 6fa971a242942f252c8dc32ddf44aee3e5337ee1 Mon Sep 17 00:00:00 2001 From: Liju Jayakumar <26148162+lijujayakumar@users.noreply.github.com> Date: Wed, 8 Dec 2021 17:05:30 -0800 Subject: [PATCH 13/28] [Android]-Custom CommissioningFlow - Redirect back to ChipTool after commissioning (#12712) * [Android] - Custom CommissioningFlow - Define URL for redirection back to CHIPTools * Update src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/CHIPToolActivity.kt Co-authored-by: Austin Hsieh <77706079+austinh0@users.noreply.github.com> * [Android]-Custom CommissioningFlow - detailed logging added Co-authored-by: Austin Hsieh <77706079+austinh0@users.noreply.github.com> --- .../CHIPTool/app/src/main/AndroidManifest.xml | 11 +++- .../google/chip/chiptool/CHIPToolActivity.kt | 65 +++++++++++++++++++ .../app/src/main/res/values/strings.xml | 3 +- 3 files changed, 76 insertions(+), 3 deletions(-) diff --git a/src/android/CHIPTool/app/src/main/AndroidManifest.xml b/src/android/CHIPTool/app/src/main/AndroidManifest.xml index e681e19cf9f54d..9e7ee8657d45e9 100644 --- a/src/android/CHIPTool/app/src/main/AndroidManifest.xml +++ b/src/android/CHIPTool/app/src/main/AndroidManifest.xml @@ -1,8 +1,9 @@ - + @@ -30,12 +31,18 @@ + + + + + + - + diff --git a/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/CHIPToolActivity.kt b/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/CHIPToolActivity.kt index fa906cbd3c1d48..1168686289d4f6 100644 --- a/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/CHIPToolActivity.kt +++ b/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/CHIPToolActivity.kt @@ -22,6 +22,7 @@ import android.net.Uri import android.nfc.NdefMessage import android.nfc.NfcAdapter import android.os.Bundle +import android.util.Base64 import android.util.Log import android.widget.Toast import androidx.appcompat.app.AlertDialog @@ -44,6 +45,7 @@ import com.google.chip.chiptool.setuppayloadscanner.BarcodeFragment import com.google.chip.chiptool.setuppayloadscanner.CHIPDeviceDetailsFragment import com.google.chip.chiptool.setuppayloadscanner.CHIPDeviceInfo import com.google.chip.chiptool.setuppayloadscanner.CHIPLedgerDetailsFragment +import org.json.JSONObject class CHIPToolActivity : AppCompatActivity(), @@ -72,6 +74,10 @@ class CHIPToolActivity : if (intent?.action == NfcAdapter.ACTION_NDEF_DISCOVERED) onNfcIntent(intent) + + if (Intent.ACTION_VIEW == intent?.action) { + onReturnIntent(intent) + } } override fun onSaveInstanceState(outState: Bundle) { @@ -222,6 +228,65 @@ class CHIPToolActivity : .show() } + private fun onReturnIntent(intent: Intent) { + val appLinkData = intent.data + // Require URI schema "mt:" + if (!appLinkData?.scheme.equals("mt", true)) { + Log.d(TAG, "Unrecognized URI schema : ${appLinkData?.scheme}") + return + } + // Require URI host "modelinfo" + if (!appLinkData?.host.equals("modelinfo", true)) { + Log.d(TAG, "Unrecognized URI host : ${appLinkData?.host}") + return + } + + // parse payload + try { + val payloadBase64String = appLinkData?.getQueryParameter("payload") + if (payloadBase64String.isNullOrEmpty()) { + Log.d(TAG, "Unrecognized payload") + return + } + + val decodeBytes = Base64.decode(payloadBase64String, Base64.DEFAULT) + val payloadString = String(decodeBytes) + val payload = JSONObject(payloadString) + + // parse payload from JSON + val setupPayload = SetupPayload() + // set defaults + setupPayload.discoveryCapabilities = setOf() + setupPayload.optionalQRCodeInfo = mapOf() + + // read from payload + setupPayload.version = payload.getInt("version") + setupPayload.vendorId = payload.getInt("vendorId") + setupPayload.productId = payload.getInt("productId") + setupPayload.commissioningFlow = payload.getInt("commissioningFlow") + setupPayload.discriminator = payload.getInt("discriminator") + setupPayload.setupPinCode = payload.getLong("setupPinCode") + + val deviceInfo = CHIPDeviceInfo.fromSetupPayload(setupPayload) + val buttons = arrayOf( + getString(R.string.nfc_tag_action_show) + ) + + AlertDialog.Builder(this) + .setTitle(R.string.provision_custom_flow_alert_title) + .setItems(buttons) { _, _ -> + onCHIPDeviceInfoReceived(deviceInfo) + } + .create() + .show() + + } catch (ex: UnrecognizedQrCodeException) { + Log.e(TAG, "Unrecognized Payload", ex) + Toast.makeText(this, "Unrecognized Setup Payload", Toast.LENGTH_SHORT).show() + return + } + } + companion object { private const val TAG = "CHIPToolActivity" private const val ADDRESS_COMMISSIONING_FRAGMENT_TAG = "address_commissioning_fragment" diff --git a/src/android/CHIPTool/app/src/main/res/values/strings.xml b/src/android/CHIPTool/app/src/main/res/values/strings.xml index 99a36d9141d3c2..093940527c9f55 100644 --- a/src/android/CHIPTool/app/src/main/res/values/strings.xml +++ b/src/android/CHIPTool/app/src/main/res/values/strings.xml @@ -141,11 +141,12 @@ Loading... Redirect Not available + Commissioning flow Completed. https://dcl.dev.dsr-corporation.com/api/modelinfo/models result custom - + mt://modelinfo Retrieve Endpoint List Invoke Select a command From 1423df5b0ae4d901fcbb3763c12ac5a22208f0ae Mon Sep 17 00:00:00 2001 From: jmartinez-silabs <67972863+jmartinez-silabs@users.noreply.github.com> Date: Wed, 8 Dec 2021 21:32:32 -0500 Subject: [PATCH 14/28] remove unnecessary static cast (#12751) --- .../OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp index 831ea9de87b3d1..ac309d1aa2f1de 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp @@ -863,7 +863,7 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_WriteThreadNetw } } - err = encoder.Encode(static_cast(routingRole)); + err = encoder.Encode(routingRole); } break; From bba082ba8df831e9af53668acf1ba4e77c19f989 Mon Sep 17 00:00:00 2001 From: Jerry Johns Date: Wed, 8 Dec 2021 19:23:41 -0800 Subject: [PATCH 15/28] Fix mismatched expectations on index retrieval in Ember cluster lookup (#12750) AttributePathExpandIterator uses emberAfClusterIndex to look up the index of a cluster within a given endpoint. This in turn calls into emberAfFindClusterInTypeWithMfgCode to find that index. This returns an index that indexes into all clusters in that endpoint regardless of type. Later on however, it uses emberAfGetNthClusterId to retrieve the actual cluster index for a given index. However, this function applies the index as though it's indexing into a list of clusters that match the masking criteria (i.e server or client). This results in it retrieving the wrong cluster in cases where there is a mix of client and server clusters on a given endpoint. Since most places use this 'scoped index', this PR fixes emberAfFindClusterInTypeWithMfgCode to return a scoped index instead. Problem: Marc noted that when reading the WifiDiagnostics cluster, that on the server, the logs indicated a retrieval of a ClusterId 0x36, but the subsequent logs in the reporting engine seemed to indicate it was picking up ClusterId 0x37 oddly enough. Testing: Validated that the above bug no longer happens, as well as reading out the entire device using wildcards in the REPL to ensure everything still works. --- src/app/util/attribute-storage.cpp | 25 +++++++++++++------------ src/app/util/attribute-storage.h | 11 +++++++++++ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/app/util/attribute-storage.cpp b/src/app/util/attribute-storage.cpp index 235d4f52b92ebc..12a0b795f1bdbe 100644 --- a/src/app/util/attribute-storage.cpp +++ b/src/app/util/attribute-storage.cpp @@ -643,32 +643,33 @@ EmberAfStatus emAfReadOrWriteAttribute(EmberAfAttributeSearchRecord * attRecord, return EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE; // Sorry, attribute was not found. } -// Check if a cluster is implemented or not. If yes, the cluster is returned. -// If the cluster is not manufacturerSpecific [ClusterId < FC00] then -// manufacturerCode argument is ignored otherwise checked. -// -// mask = 0 -> find either client or server -// mask = CLUSTER_MASK_CLIENT -> find client -// mask = CLUSTER_MASK_SERVER -> find server EmberAfCluster * emberAfFindClusterInTypeWithMfgCode(EmberAfEndpointType * endpointType, ClusterId clusterId, EmberAfClusterMask mask, uint16_t manufacturerCode, uint8_t * index) { uint8_t i; + uint8_t scopedIndex = 0; + for (i = 0; i < endpointType->clusterCount; i++) { EmberAfCluster * cluster = &(endpointType->cluster[i]); - if (cluster->clusterId == clusterId && - (mask == 0 || (mask == CLUSTER_MASK_CLIENT && emberAfClusterIsClient(cluster)) || + + if ((mask == 0 || (mask == CLUSTER_MASK_CLIENT && emberAfClusterIsClient(cluster)) || (mask == CLUSTER_MASK_SERVER && emberAfClusterIsServer(cluster)))) { - if (index) + if (cluster->clusterId == clusterId) { - *index = i; + if (index) + { + *index = scopedIndex; + } + + return cluster; } - return cluster; + scopedIndex++; } } + return NULL; } diff --git a/src/app/util/attribute-storage.h b/src/app/util/attribute-storage.h index ca2c4fbf21fdd6..873a4eeb437d6c 100644 --- a/src/app/util/attribute-storage.h +++ b/src/app/util/attribute-storage.h @@ -127,6 +127,17 @@ EmberAfStatus emAfReadOrWriteAttribute(EmberAfAttributeSearchRecord * attRecord, bool emAfMatchCluster(EmberAfCluster * cluster, EmberAfAttributeSearchRecord * attRecord); bool emAfMatchAttribute(EmberAfCluster * cluster, EmberAfAttributeMetadata * am, EmberAfAttributeSearchRecord * attRecord); +// Check if a cluster is implemented or not. If yes, the cluster is returned. +// If the cluster is not manufacturerSpecific [ClusterId < FC00] then +// manufacturerCode argument is ignored otherwise checked. +// +// mask = 0 -> find either client or server +// mask = CLUSTER_MASK_CLIENT -> find client +// mask = CLUSTER_MASK_SERVER -> find server +// +// If a pointer to an index is provided, it will be updated to point to the relative index of the cluster +// within the set of clusters that match the mask criteria. +// EmberAfCluster * emberAfFindClusterInTypeWithMfgCode(EmberAfEndpointType * endpointType, chip::ClusterId clusterId, EmberAfClusterMask mask, uint16_t manufacturerCode, uint8_t * index = nullptr); From a583812c350e1b8af8d0f473f6870fa29209c858 Mon Sep 17 00:00:00 2001 From: jmartinez-silabs <67972863+jmartinez-silabs@users.noreply.github.com> Date: Wed, 8 Dec 2021 23:54:30 -0500 Subject: [PATCH 16/28] Add support for matter cli in EFR32 example apps (#12749) * Support matter shell in all efr32 example apps * add source set and start task for other examples * add shell_common example cmds * restyle --- examples/lighting-app/efr32/BUILD.gn | 3 +- examples/lighting-app/efr32/src/main.cpp | 8 + examples/lock-app/efr32/BUILD.gn | 3 +- examples/lock-app/efr32/src/main.cpp | 8 + examples/pigweed-app/efr32/BUILD.gn | 2 +- examples/platform/efr32/BUILD.gn | 17 +- examples/platform/efr32/matter_shell.cpp | 88 ++++++++ examples/platform/efr32/matter_shell.h | 27 +++ examples/platform/efr32/{uart.c => uart.cpp} | 18 +- examples/shell/efr32/BUILD.gn | 3 +- examples/shell/efr32/src/main.cpp | 35 +--- examples/window-app/efr32/BUILD.gn | 3 +- examples/window-app/efr32/src/main.cpp | 8 + src/lib/shell/BUILD.gn | 2 +- src/lib/shell/MainLoopEFR32.cpp | 204 +++++++++++++++++++ src/test_driver/efr32/BUILD.gn | 2 +- third_party/efr32_sdk/efr32_sdk.gni | 8 + 17 files changed, 397 insertions(+), 42 deletions(-) create mode 100644 examples/platform/efr32/matter_shell.cpp create mode 100644 examples/platform/efr32/matter_shell.h rename examples/platform/efr32/{uart.c => uart.cpp} (97%) create mode 100644 src/lib/shell/MainLoopEFR32.cpp diff --git a/examples/lighting-app/efr32/BUILD.gn b/examples/lighting-app/efr32/BUILD.gn index 142cb8dff3e051..82f8ac26266806 100644 --- a/examples/lighting-app/efr32/BUILD.gn +++ b/examples/lighting-app/efr32/BUILD.gn @@ -84,7 +84,7 @@ efr32_executable("lighting_app") { "${examples_plat_dir}/LEDWidget.cpp", "${examples_plat_dir}/heap_4_silabs.c", "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/uart.c", + "${examples_plat_dir}/uart.cpp", "src/AppTask.cpp", "src/LightingManager.cpp", "src/ZclCallbacks.cpp", @@ -101,6 +101,7 @@ efr32_executable("lighting_app") { "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", "${chip_root}/third_party/openthread/repo:libopenthread-cli-ftd", "${chip_root}/third_party/openthread/repo:libopenthread-ftd", + "${examples_plat_dir}:efr-matter-shell", ] include_dirs = [ "include" ] diff --git a/examples/lighting-app/efr32/src/main.cpp b/examples/lighting-app/efr32/src/main.cpp index 1648398333fbf8..943f0993a7af35 100644 --- a/examples/lighting-app/efr32/src/main.cpp +++ b/examples/lighting-app/efr32/src/main.cpp @@ -66,6 +66,10 @@ #include "Rpc.h" #endif +#ifdef ENABLE_CHIP_SHELL +#include "matter_shell.h" +#endif + using namespace ::chip; using namespace ::chip::Inet; using namespace ::chip::DeviceLayer; @@ -177,6 +181,10 @@ int main(void) appError(ret); } +#ifdef ENABLE_CHIP_SHELL + chip::startShellTask(); +#endif + EFR32_LOG("Starting FreeRTOS scheduler"); sl_system_kernel_start(); diff --git a/examples/lock-app/efr32/BUILD.gn b/examples/lock-app/efr32/BUILD.gn index 165b388f11c369..f36729cd64920b 100644 --- a/examples/lock-app/efr32/BUILD.gn +++ b/examples/lock-app/efr32/BUILD.gn @@ -81,7 +81,7 @@ efr32_executable("lock_app") { "${examples_plat_dir}/LEDWidget.cpp", "${examples_plat_dir}/heap_4_silabs.c", "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/uart.c", + "${examples_plat_dir}/uart.cpp", "src/AppTask.cpp", "src/BoltLockManager.cpp", "src/ZclCallbacks.cpp", @@ -98,6 +98,7 @@ efr32_executable("lock_app") { "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", "${chip_root}/third_party/openthread/repo:libopenthread-cli-ftd", "${chip_root}/third_party/openthread/repo:libopenthread-ftd", + "${examples_plat_dir}:efr-matter-shell", ] include_dirs = [ "include" ] diff --git a/examples/lock-app/efr32/src/main.cpp b/examples/lock-app/efr32/src/main.cpp index 012b1ddd63f162..c92b9e71c8b7d5 100644 --- a/examples/lock-app/efr32/src/main.cpp +++ b/examples/lock-app/efr32/src/main.cpp @@ -52,6 +52,10 @@ #include "Rpc.h" #endif +#ifdef ENABLE_CHIP_SHELL +#include "matter_shell.h" +#endif + #if CHIP_ENABLE_OPENTHREAD #include #include @@ -174,6 +178,10 @@ int main(void) appError(ret); } +#ifdef ENABLE_CHIP_SHELL + chip::startShellTask(); +#endif + EFR32_LOG("Starting FreeRTOS scheduler"); sl_system_kernel_start(); diff --git a/examples/pigweed-app/efr32/BUILD.gn b/examples/pigweed-app/efr32/BUILD.gn index f6b4f9934e0016..7ecb027c152ca4 100644 --- a/examples/pigweed-app/efr32/BUILD.gn +++ b/examples/pigweed-app/efr32/BUILD.gn @@ -57,7 +57,7 @@ efr32_executable("pigweed_app") { "${examples_plat_dir}/PigweedLogger.cpp", "${examples_plat_dir}/heap_4_silabs.c", "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/uart.c", + "${examples_plat_dir}/uart.cpp", "src/main.cpp", ] diff --git a/examples/platform/efr32/BUILD.gn b/examples/platform/efr32/BUILD.gn index 652c05ec0ab31f..185651c5de3a61 100644 --- a/examples/platform/efr32/BUILD.gn +++ b/examples/platform/efr32/BUILD.gn @@ -14,7 +14,7 @@ import("//build_overrides/chip.gni") import("//build_overrides/efr32_sdk.gni") - +import("${chip_root}/src/lib/lib.gni") import("${efr32_sdk_build_root}/efr32_sdk.gni") config("chip_examples_project_config") { @@ -49,3 +49,18 @@ source_set("openthread_core_config_efr32_chip_examples") { public_configs = [ ":chip_examples_project_config" ] } + +source_set("efr-matter-shell") { + if (chip_build_libshell) { + defines = [ "ENABLE_CHIP_SHELL" ] + + sources = [ "matter_shell.cpp" ] + include_dirs = [ "." ] + + public_deps = [ + "${chip_root}/examples/shell/shell_common:shell_common", + "${chip_root}/src/lib/shell:shell", + "${chip_root}/src/lib/shell:shell_core", + ] + } +} diff --git a/examples/platform/efr32/matter_shell.cpp b/examples/platform/efr32/matter_shell.cpp new file mode 100644 index 00000000000000..50b5af84947a91 --- /dev/null +++ b/examples/platform/efr32/matter_shell.cpp @@ -0,0 +1,88 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "matter_shell.h" +#include +#include +#include +#include +#include + +using namespace ::chip; +using chip::Shell::Engine; + +namespace { + +#define SHELL_TASK_STACK_SIZE 2048 +#define SHELL_TASK_PRIORITY 5 +TaskHandle_t shellTaskHandle; +StackType_t shellStack[SHELL_TASK_STACK_SIZE / sizeof(StackType_t)]; +StaticTask_t shellTaskStruct; + +void MatterShellTask(void * args) +{ + chip::Shell::Engine::Root().RunMainLoop(); +} + +} // namespace + +extern "C" unsigned int sleep(unsigned int seconds) +{ + const TickType_t xDelay = 1000 * seconds / portTICK_PERIOD_MS; + vTaskDelay(xDelay); + return 0; +} + +namespace chip { + +void NotifyShellProcess() +{ + xTaskNotifyGive(shellTaskHandle); +} + +void NotifyShellProcessFromISR() +{ + BaseType_t yieldRequired = pdFALSE; + if (shellTaskHandle != NULL) + { + vTaskNotifyGiveFromISR(shellTaskHandle, &yieldRequired); + } + portYIELD_FROM_ISR(yieldRequired); +} + +void WaitForShellActivity() +{ + ulTaskNotifyTake(pdTRUE, portMAX_DELAY); +} + +void startShellTask() +{ + int status = chip::Shell::streamer_init(chip::Shell::streamer_get()); + assert(status == 0); + + // For now also register commands from shell_common (shell app). + // TODO move at least OTCLI to default commands in lib/shell/commands + cmd_misc_init(); + cmd_otcli_init(); + cmd_ping_init(); + cmd_send_init(); + + shellTaskHandle = xTaskCreateStatic(MatterShellTask, "matter_cli", ArraySize(shellStack), NULL, SHELL_TASK_PRIORITY, shellStack, + &shellTaskStruct); +} + +} // namespace chip diff --git a/examples/platform/efr32/matter_shell.h b/examples/platform/efr32/matter_shell.h new file mode 100644 index 00000000000000..9b818bfe8a412b --- /dev/null +++ b/examples/platform/efr32/matter_shell.h @@ -0,0 +1,27 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +namespace chip { + +void NotifyShellProcess(); +void NotifyShellProcessFromISR(); +void WaitForShellActivity(); +void startShellTask(); + +} // namespace chip diff --git a/examples/platform/efr32/uart.c b/examples/platform/efr32/uart.cpp similarity index 97% rename from examples/platform/efr32/uart.c rename to examples/platform/efr32/uart.cpp index 8d5b7fe37ab6f7..0fed6bde861c8c 100644 --- a/examples/platform/efr32/uart.c +++ b/examples/platform/efr32/uart.cpp @@ -15,14 +15,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "uart.h" #include "AppConfig.h" +#include "matter_shell.h" + +#ifdef __cplusplus +extern "C" { +#endif #include "assert.h" #include "em_core.h" #include "em_usart.h" #include "sl_board_control.h" #include "sl_uartdrv_instances.h" #include "sl_uartdrv_usart_vcom_config.h" +#include "uart.h" #include "uartdrv.h" #include #include @@ -192,6 +197,9 @@ void uartConsoleInit(void) void USART_IRQHandler(void) { +#ifdef ENABLE_CHIP_SHELL + chip::NotifyShellProcessFromISR(); +#endif #ifndef PW_RPC_ENABLED otSysEventSignalPending(); #endif @@ -212,6 +220,10 @@ static void UART_rx_callback(UARTDRV_Handle_t handle, Ecode_t transferStatus, ui } UARTDRV_Receive(sl_uartdrv_usart_vcom_handle, data, transferCount, UART_rx_callback); + +#ifdef ENABLE_CHIP_SHELL + chip::NotifyShellProcessFromISR(); +#endif #ifndef PW_RPC_ENABLED otSysEventSignalPending(); #endif @@ -267,3 +279,7 @@ int16_t uartConsoleRead(char * Buf, uint16_t NbBytesToRead) return (int16_t) RetrieveFromFifo(&sReceiveFifo, (uint8_t *) Buf, NbBytesToRead); } + +#ifdef __cplusplus +} +#endif diff --git a/examples/shell/efr32/BUILD.gn b/examples/shell/efr32/BUILD.gn index 13476fff6009d4..a18df44f8f9989 100644 --- a/examples/shell/efr32/BUILD.gn +++ b/examples/shell/efr32/BUILD.gn @@ -58,7 +58,7 @@ efr32_executable("shell_app") { sources = [ "${examples_plat_dir}/heap_4_silabs.c", "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/uart.c", + "${examples_plat_dir}/uart.cpp", "src/main.cpp", ] @@ -70,6 +70,7 @@ efr32_executable("shell_app") { "${chip_root}/third_party/openthread/platforms:libopenthread-platform", "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", "${chip_root}/third_party/openthread/repo:libopenthread-ftd", + "${examples_plat_dir}:efr-matter-shell", ] include_dirs = [ "include" ] diff --git a/examples/shell/efr32/src/main.cpp b/examples/shell/efr32/src/main.cpp index 2cbebee810be40..88fa56e00f92c7 100644 --- a/examples/shell/efr32/src/main.cpp +++ b/examples/shell/efr32/src/main.cpp @@ -36,6 +36,7 @@ #include #include +#include "matter_shell.h" #include #include #include @@ -63,13 +64,6 @@ using namespace ::chip; using namespace ::chip::DeviceLayer; using chip::Shell::Engine; -#define SHELL_TASK_STACK_SIZE 8192 -#define SHELL_TASK_PRIORITY 3 -static TaskHandle_t sShellTaskHandle; -#define APP_TASK_STACK_SIZE (1536) -static StackType_t appStack[APP_TASK_STACK_SIZE / sizeof(StackType_t)]; -static StaticTask_t appTaskStruct; - // ================================================================================ // Supporting functions // ================================================================================ @@ -87,13 +81,6 @@ void appError(CHIP_ERROR error) appError(static_cast(error.AsInteger())); } -extern "C" unsigned int sleep(unsigned int seconds) -{ - const TickType_t xDelay = 1000 * seconds / portTICK_PERIOD_MS; - vTaskDelay(xDelay); - return 0; -} - extern "C" void vApplicationIdleHook(void) { // FreeRTOS Idle callback @@ -102,11 +89,6 @@ extern "C" void vApplicationIdleHook(void) Internal::EFR32Config::RepackNvm3Flash(); } -static void shell_task(void * args) -{ - Engine::Root().RunMainLoop(); -} - // ================================================================================ // Main Code // ================================================================================ @@ -174,19 +156,6 @@ int main(void) } #endif // CHIP_ENABLE_OPENTHREAD - int status = chip::Shell::streamer_init(chip::Shell::streamer_get()); - assert(status == 0); - - cmd_misc_init(); - cmd_otcli_init(); - cmd_ping_init(); - cmd_send_init(); - - sShellTaskHandle = xTaskCreateStatic(shell_task, APP_TASK_NAME, ArraySize(appStack), NULL, 1, appStack, &appTaskStruct); - if (!sShellTaskHandle) - { - EFR32_LOG("MEMORY ERROR!!!"); - } - + chip::startShellTask(); sl_system_kernel_start(); } diff --git a/examples/window-app/efr32/BUILD.gn b/examples/window-app/efr32/BUILD.gn index 4d72f31371a670..b2b6cb7a48eda7 100644 --- a/examples/window-app/efr32/BUILD.gn +++ b/examples/window-app/efr32/BUILD.gn @@ -71,7 +71,7 @@ efr32_executable("window_app") { "${examples_plat_dir}/LEDWidget.cpp", "${examples_plat_dir}/heap_4_silabs.c", "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/uart.c", + "${examples_plat_dir}/uart.cpp", "${project_dir}/common/src/WindowApp.cpp", "${project_dir}/common/src/ZclCallbacks.cpp", "src/WindowAppImpl.cpp", @@ -88,6 +88,7 @@ efr32_executable("window_app") { "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", "${chip_root}/third_party/openthread/repo:libopenthread-cli-ftd", "${chip_root}/third_party/openthread/repo:libopenthread-ftd", + "${examples_plat_dir}:efr-matter-shell", ] include_dirs = [ diff --git a/examples/window-app/efr32/src/main.cpp b/examples/window-app/efr32/src/main.cpp index 8a099063a6796a..b9d4e3070a4d01 100644 --- a/examples/window-app/efr32/src/main.cpp +++ b/examples/window-app/efr32/src/main.cpp @@ -46,6 +46,10 @@ #include #endif +#ifdef ENABLE_CHIP_SHELL +#include "matter_shell.h" +#endif + using namespace ::chip::DeviceLayer; // ================================================================================ @@ -140,6 +144,10 @@ int main(void) } #endif // CHIP_ENABLE_OPENTHREAD +#ifdef ENABLE_CHIP_SHELL + chip::startShellTask(); +#endif + WindowApp & app = WindowApp::Instance(); EFR32_LOG("Starting App"); diff --git a/src/lib/shell/BUILD.gn b/src/lib/shell/BUILD.gn index 8aeb3bb7ef3b07..6f5ff3feaf2b84 100644 --- a/src/lib/shell/BUILD.gn +++ b/src/lib/shell/BUILD.gn @@ -50,7 +50,7 @@ static_library("shell") { ] } else if (chip_device_platform == "efr32") { sources += [ - "MainLoopDefault.cpp", + "MainLoopEFR32.cpp", "streamer_efr32.cpp", ] } else if (chip_device_platform == "k32w0") { diff --git a/src/lib/shell/MainLoopEFR32.cpp b/src/lib/shell/MainLoopEFR32.cpp new file mode 100644 index 00000000000000..32f4a1cc2012e4 --- /dev/null +++ b/src/lib/shell/MainLoopEFR32.cpp @@ -0,0 +1,204 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "matter_shell.h" +#include "streamer.h" +#include +#include +#include + +#include +#include + +using chip::FormatCHIPError; +using chip::Platform::MemoryAlloc; +using chip::Platform::MemoryFree; +using chip::Shell::Engine; +using chip::Shell::streamer_get; + +namespace { + +constexpr const char kShellPrompt[] = "matterCli > "; + +void ReadLine(char * buffer, size_t max) +{ + ssize_t read = 0; + bool done = false; + char * inptr = buffer; + + // Read in characters until we get a new line or we hit our max size. + while (((inptr - buffer) < static_cast(max)) && !done) + { + chip::WaitForShellActivity(); + if (read == 0) + { + read = streamer_read(streamer_get(), inptr, 1); + } + + // Process any characters we just read in. + while (read > 0) + { + switch (*inptr) + { + case '\r': + case '\n': + streamer_printf(streamer_get(), "\r\n"); + *inptr = 0; // null terminate + done = true; + break; + case 0x7F: + // delete backspace character + 1 more + inptr -= 2; + if (inptr >= buffer - 1) + { + streamer_printf(streamer_get(), "\b \b"); + } + else + { + inptr = buffer - 1; + } + break; + default: + if (isprint(static_cast(*inptr)) || *inptr == '\t') + { + streamer_printf(streamer_get(), "%c", *inptr); + } + else + { + inptr--; + } + break; + } + + inptr++; + read--; + } + } +} + +bool IsSeparator(char ch) +{ + return (ch == ' ') || (ch == '\t') || (ch == '\r') || (ch == '\n'); +} + +bool IsEscape(char ch) +{ + return (ch == '\\'); +} + +bool IsEscapable(char ch) +{ + return IsSeparator(ch) || IsEscape(ch); +} + +int TokenizeLine(char * buffer, char ** tokens, int max_tokens) +{ + size_t len = strlen(buffer); + int cursor = 0; + size_t i = 0; + + // Strip leading spaces + while (buffer[i] && buffer[i] == ' ') + { + i++; + } + + if (len <= i) + { + return 0; + } + + // The first token starts at the beginning. + tokens[cursor++] = &buffer[i]; + + for (; i < len && cursor < max_tokens; i++) + { + if (IsEscape(buffer[i]) && IsEscapable(buffer[i + 1])) + { + // include the null terminator: strlen(cmd) = strlen(cmd + 1) + 1 + memmove(&buffer[i], &buffer[i + 1], strlen(&buffer[i])); + } + else if (IsSeparator(buffer[i])) + { + buffer[i] = 0; + if (!IsSeparator(buffer[i + 1])) + { + tokens[cursor++] = &buffer[i + 1]; + } + } + } + + tokens[cursor] = nullptr; + + return cursor; +} + +void ProcessShellLine(intptr_t args) +{ + int argc; + char * argv[CHIP_SHELL_MAX_TOKENS]; + + char * line = reinterpret_cast(args); + argc = TokenizeLine(line, argv, CHIP_SHELL_MAX_TOKENS); + + if (argc > 0) + { + CHIP_ERROR retval = Engine::Root().ExecCommand(argc, argv); + + if (retval != CHIP_NO_ERROR) + { + char errorStr[160]; + bool errorStrFound = FormatCHIPError(errorStr, sizeof(errorStr), retval); + if (!errorStrFound) + { + errorStr[0] = 0; + } + streamer_printf(streamer_get(), "Error %s: %s\r\n", argv[0], errorStr); + } + else + { + streamer_printf(streamer_get(), "Done\r\n", argv[0]); + } + } + MemoryFree(line); + streamer_printf(streamer_get(), kShellPrompt); +} + +} // namespace + +namespace chip { +namespace Shell { + +void Engine::RunMainLoop() +{ + Engine::Root().RegisterDefaultCommands(); + streamer_printf(streamer_get(), kShellPrompt); + + while (true) + { + char * line = static_cast(Platform::MemoryAlloc(CHIP_SHELL_MAX_LINE_SIZE)); + ReadLine(line, CHIP_SHELL_MAX_LINE_SIZE); +#if CONFIG_DEVICE_LAYER + DeviceLayer::PlatformMgr().ScheduleWork(ProcessShellLine, reinterpret_cast(line)); +#else + ProcessShellLine(reinterpret_cast(line)); +#endif + } +} + +} // namespace Shell +} // namespace chip diff --git a/src/test_driver/efr32/BUILD.gn b/src/test_driver/efr32/BUILD.gn index d5bb25ff017f49..d43ed2aaf74382 100644 --- a/src/test_driver/efr32/BUILD.gn +++ b/src/test_driver/efr32/BUILD.gn @@ -69,7 +69,7 @@ efr32_executable("efr32_device_tests") { "${examples_plat_dir}/PigweedLogger.cpp", "${examples_plat_dir}/heap_4_silabs.c", "${examples_plat_dir}/init_efrPlatform.cpp", - "${examples_plat_dir}/uart.c", + "${examples_plat_dir}/uart.cpp", "src/main.cpp", ] diff --git a/third_party/efr32_sdk/efr32_sdk.gni b/third_party/efr32_sdk/efr32_sdk.gni index 012a10058341e6..82191ec80ca1e1 100644 --- a/third_party/efr32_sdk/efr32_sdk.gni +++ b/third_party/efr32_sdk/efr32_sdk.gni @@ -17,6 +17,7 @@ import("//build_overrides/efr32_sdk.gni") import("//build_overrides/jlink.gni") import("//build_overrides/mbedtls.gni") +import("${chip_root}/src/lib/lib.gni") import("efr32_board.gni") declare_args() { @@ -145,6 +146,13 @@ template("efr32_sdk") { defines += board_defines + if (chip_build_libshell) { + defines += [ + "ENABLE_CHIP_SHELL", + "OPENTHREAD_CONFIG_CLI_TRANSPORT=OT_CLI_TRANSPORT_CONSOLE", + ] + } + if (efr32_family == "efr32mg12") { _include_dirs += [ "${efr32_sdk_root}/hardware/driver/memlcd/inc/memlcd_usart", From 6ea2c9017d55720fb997fcadc5e1c0555579c512 Mon Sep 17 00:00:00 2001 From: Song GUO Date: Thu, 9 Dec 2021 14:42:08 +0800 Subject: [PATCH 17/28] Run Codegen (#12770) --- .../zap-generated/IMClusterCommandHandler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zzz_generated/ota-requestor-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/ota-requestor-app/zap-generated/IMClusterCommandHandler.cpp index fbdaea73b60146..09464c4f9b17ce 100644 --- a/zzz_generated/ota-requestor-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/ota-requestor-app/zap-generated/IMClusterCommandHandler.cpp @@ -45,7 +45,9 @@ namespace Basic { void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) { - ReportCommandUnsupported(apCommandObj, aCommandPath); + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); } } // namespace Basic From f18d8b78b3edfffb7c06f3eb69b74403fe32b6c8 Mon Sep 17 00:00:00 2001 From: Carol Yang Date: Wed, 8 Dec 2021 23:11:08 -0800 Subject: [PATCH 18/28] [OTA] Use CASESessionManager to establish CASE sessions from OTARequestor class (#12636) --- .../OTAProviderExample.cpp | 26 +- examples/ota-requestor-app/linux/main.cpp | 61 ++-- src/app/CASESessionManager.h | 3 + .../clusters/ota-requestor/BDXDownloader.cpp | 61 ++++ .../clusters/ota-requestor/BDXDownloader.h | 12 + .../ota-requestor/ClusterInterface.cpp | 2 +- .../clusters/ota-requestor/OTARequestor.cpp | 321 ++++++++---------- src/app/clusters/ota-requestor/OTARequestor.h | 115 ++++--- .../ota-requestor/OTARequestorInterface.h | 4 + src/app/server/Server.h | 22 +- src/lib/core/CHIPError.h | 16 + 11 files changed, 379 insertions(+), 264 deletions(-) diff --git a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp index 3cc95d329c7b58..fe53145f19af96 100644 --- a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp +++ b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp @@ -20,17 +20,23 @@ #include #include +#include #include +#include #include #include #include -#include // For chip::kTestDeviceNodeId #include using chip::ByteSpan; using chip::CharSpan; +using chip::FabricIndex; +using chip::FabricInfo; +using chip::MutableCharSpan; +using chip::NodeId; using chip::Optional; +using chip::Server; using chip::Span; using chip::app::Clusters::OTAProviderDelegate; using namespace chip::app::Clusters::OtaSoftwareUpdateProvider::Commands; @@ -57,19 +63,18 @@ void GenerateUpdateToken(uint8_t * buf, size_t bufSize) } } -bool GenerateBdxUri(const Span & fileDesignator, Span outUri, size_t availableSize) +bool GenerateBdxUri(NodeId nodeId, CharSpan fileDesignator, MutableCharSpan outUri) { static constexpr char bdxPrefix[] = "bdx://"; - chip::NodeId nodeId = chip::kTestDeviceNodeId; // TODO: read this dynamically size_t nodeIdHexStrLen = sizeof(nodeId) * 2; size_t expectedLength = strlen(bdxPrefix) + nodeIdHexStrLen + 1 + fileDesignator.size(); - if (expectedLength >= availableSize) + if (expectedLength >= outUri.size()) { return false; } - size_t written = static_cast(snprintf(outUri.data(), availableSize, "%s" ChipLogFormatX64 "/%s", bdxPrefix, + size_t written = static_cast(snprintf(outUri.data(), outUri.size(), "%s" ChipLogFormatX64 "/%s", bdxPrefix, ChipLogValueX64(nodeId), fileDesignator.data())); return expectedLength == written; @@ -115,9 +120,16 @@ EmberAfStatus OTAProviderExample::HandleQueryImage(chip::app::CommandHandler * c if (strlen(mOTAFilePath)) { + // TODO: This uses the current node as the provider to supply the OTA image. This can be configurable such that the provider + // supplying the response is not the provider supplying the OTA image. + FabricIndex fabricIndex = commandObj->GetExchangeContext()->GetSessionHandle().GetFabricIndex(); + FabricInfo * fabricInfo = Server::GetInstance().GetFabricTable().FindFabricWithIndex(fabricIndex); + NodeId nodeId = fabricInfo->GetPeerId().GetNodeId(); + // Only doing BDX transport for now - GenerateBdxUri(Span(mOTAFilePath, strlen(mOTAFilePath)), Span(uriBuf, 0), kUriMaxLen); - ChipLogDetail(SoftwareUpdate, "generated URI: %s", uriBuf); + MutableCharSpan uri(uriBuf, kUriMaxLen); + GenerateBdxUri(nodeId, CharSpan(mOTAFilePath, strlen(mOTAFilePath)), uri); + ChipLogDetail(SoftwareUpdate, "Generated URI: %.*s", static_cast(uri.size()), uri.data()); } // Set Status for the Query Image Response diff --git a/examples/ota-requestor-app/linux/main.cpp b/examples/ota-requestor-app/linux/main.cpp index fc004f357376ed..4f38efd37420a2 100644 --- a/examples/ota-requestor-app/linux/main.cpp +++ b/examples/ota-requestor-app/linux/main.cpp @@ -16,7 +16,8 @@ * limitations under the License. */ -#include +#include +#include #include #include #include @@ -30,30 +31,38 @@ using chip::BDXDownloader; using chip::ByteSpan; +using chip::CASEClientPool; using chip::CharSpan; -using chip::DeviceProxy; using chip::EndpointId; using chip::FabricIndex; +using chip::GetRequestorInstance; using chip::LinuxOTAImageProcessor; using chip::NodeId; using chip::OnDeviceConnected; using chip::OnDeviceConnectionFailure; +using chip::OperationalDeviceProxyPool; +using chip::OTADownloader; using chip::OTAImageProcessorParams; +using chip::OTARequestor; using chip::PeerId; using chip::Server; using chip::VendorId; using chip::Callback::Callback; -using chip::Inet::IPAddress; using chip::System::Layer; using chip::Transport::PeerAddress; using namespace chip::ArgParser; using namespace chip::Messaging; using namespace chip::app::Clusters::OtaSoftwareUpdateProvider::Commands; -OTARequestor requestorCore; -LinuxOTARequestorDriver requestorUser; -BDXDownloader downloader; -LinuxOTAImageProcessor imageProcessor; +constexpr size_t kMaxActiveCaseClients = 2; +constexpr size_t kMaxActiveDevices = 8; + +OTARequestor gRequestorCore; +LinuxOTARequestorDriver gRequestorUser; +BDXDownloader gDownloader; +LinuxOTAImageProcessor gImageProcessor; +CASEClientPool gCASEClientPool; +OperationalDeviceProxyPool gDevicePool; bool HandleOptions(const char * aProgram, OptionSet * aOptions, int aIdentifier, const char * aName, const char * aValue); void OnStartDelayTimerHandler(Layer * systemLayer, void * appState); @@ -62,10 +71,8 @@ constexpr uint16_t kOptionProviderNodeId = 'n'; constexpr uint16_t kOptionProviderFabricIndex = 'f'; constexpr uint16_t kOptionUdpPort = 'u'; constexpr uint16_t kOptionDiscriminator = 'd'; -constexpr uint16_t kOptionIPAddress = 'i'; constexpr uint16_t kOptionDelayQuery = 'q'; -const char * ipAddress = NULL; NodeId providerNodeId = 0x0; FabricIndex providerFabricIndex = 1; uint16_t requestorSecurePort = 0; @@ -77,8 +84,6 @@ OptionDef cmdLineOptionsDef[] = { { "providerFabricIndex", chip::ArgParser::kArgumentRequired, kOptionProviderFabricIndex }, { "udpPort", chip::ArgParser::kArgumentRequired, kOptionUdpPort }, { "discriminator", chip::ArgParser::kArgumentRequired, kOptionDiscriminator }, - // TODO: This can be removed once OperationalDeviceProxy can resolve the IP Address from Node ID - { "ipaddress", chip::ArgParser::kArgumentRequired, kOptionIPAddress }, { "delayQuery", chip::ArgParser::kArgumentRequired, kOptionDelayQuery }, {}, }; @@ -95,8 +100,6 @@ OptionSet cmdLineOptions = { HandleOptions, cmdLineOptionsDef, "PROGRAM OPTIONS" " -d/--discriminator \n" " A 12-bit value used to discern between multiple commissionable CHIP device\n" " advertisements. If none is specified, default value is 3840.\n" - " -i/--ipaddress \n" - " The IP Address of the OTA Provider to connect to. This value must be supplied.\n" " -q/--delayQuery