From 0c3f012c71cf3466ad5fe6d236b47e2bce914c7b Mon Sep 17 00:00:00 2001 From: Karsten Sperling <113487422+ksperling-apple@users.noreply.github.com> Date: Thu, 22 Feb 2024 01:58:17 +1300 Subject: [PATCH 01/29] Disable WiFi PDC support by default for 1.3 (#32234) Fixes #32169 --- src/platform/Darwin/CHIPDevicePlatformConfig.h | 1 - src/platform/Linux/CHIPDevicePlatformConfig.h | 1 - src/platform/Linux/NetworkCommissioningWiFiDriver.cpp | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/platform/Darwin/CHIPDevicePlatformConfig.h b/src/platform/Darwin/CHIPDevicePlatformConfig.h index 15fdaa476e3645..7a5140494c22dd 100644 --- a/src/platform/Darwin/CHIPDevicePlatformConfig.h +++ b/src/platform/Darwin/CHIPDevicePlatformConfig.h @@ -25,7 +25,6 @@ // ==================== Platform Adaptations ==================== -#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_PDC 1 #define CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION 0 #define CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP 0 diff --git a/src/platform/Linux/CHIPDevicePlatformConfig.h b/src/platform/Linux/CHIPDevicePlatformConfig.h index 70ed39d62899d5..530e2716308842 100644 --- a/src/platform/Linux/CHIPDevicePlatformConfig.h +++ b/src/platform/Linux/CHIPDevicePlatformConfig.h @@ -26,7 +26,6 @@ // ==================== Platform Adaptations ==================== #if CHIP_DEVICE_CONFIG_ENABLE_WIFI -#define CHIP_DEVICE_CONFIG_ENABLE_WIFI_PDC 1 #define CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION 1 #define CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP 0 #else diff --git a/src/platform/Linux/NetworkCommissioningWiFiDriver.cpp b/src/platform/Linux/NetworkCommissioningWiFiDriver.cpp index 4b5b3c0b6b5e7d..16e4b7f0d7fbde 100644 --- a/src/platform/Linux/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/Linux/NetworkCommissioningWiFiDriver.cpp @@ -44,12 +44,12 @@ constexpr char kWiFiCredentialsKeyName[] = "wifi-pass"; constexpr char kWifiNetworkIdentityKeyName[] = "wifi-ni"; constexpr char kWifiClientIdentityKeyName[] = "wifi-ci"; constexpr char kWifiClientIdentityKeypairKeyName[] = "wifi-cik"; +#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI_PDC inline CHIP_ERROR IgnoreNotFound(CHIP_ERROR err) { return (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND) ? CHIP_NO_ERROR : err; } -#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI_PDC } // namespace // NOTE: For WiFiDriver, we uses two network configs, one is mSavedNetwork, and another is mStagingNetwork, during init, it will From a64773a912e09f65cfe00f527dd8d85123c69c83 Mon Sep 17 00:00:00 2001 From: Matthew Swartwout Date: Wed, 21 Feb 2024 05:52:25 -0800 Subject: [PATCH 02/29] Initialize scalar members in TLVReader (#32129) * Initialize scalar members in TLVReader The documented return values for multiple TLVReader functions do match the actual return value for the uninitialize case. Explicitly initialize members with null/0 values to match the documentation. * Restyled by clang-format * Don't inline constructor * Restyled by clang-format --------- Co-authored-by: Restyled.io --- src/lib/core/TLVReader.cpp | 6 ++++++ src/lib/core/TLVReader.h | 2 ++ src/lib/core/tests/TestTLV.cpp | 23 +++++++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/src/lib/core/TLVReader.cpp b/src/lib/core/TLVReader.cpp index abef9af1636ca5..8368b9fb0fac04 100644 --- a/src/lib/core/TLVReader.cpp +++ b/src/lib/core/TLVReader.cpp @@ -49,6 +49,12 @@ using namespace chip::Encoding; static const uint8_t sTagSizes[] = { 0, 1, 2, 4, 2, 4, 6, 8 }; +TLVReader::TLVReader() : + ImplicitProfileId(kProfileIdNotSpecified), AppData(nullptr), mElemLenOrVal(0), mBackingStore(nullptr), mReadPoint(nullptr), + mBufEnd(nullptr), mLenRead(0), mMaxLen(0), mContainerType(kTLVType_NotSpecified), mControlByte(kTLVControlByte_NotSpecified), + mContainerOpen(false) +{} + void TLVReader::Init(const uint8_t * data, size_t dataLen) { // TODO: Maybe we can just make mMaxLen and mLenRead size_t instead? diff --git a/src/lib/core/TLVReader.h b/src/lib/core/TLVReader.h index bfb6b47f14d3f4..e86812cc2dc16b 100644 --- a/src/lib/core/TLVReader.h +++ b/src/lib/core/TLVReader.h @@ -86,6 +86,8 @@ class DLL_EXPORT TLVReader friend class TLVUpdater; public: + TLVReader(); + /** * Initializes a TLVReader object from another TLVReader object. * diff --git a/src/lib/core/tests/TestTLV.cpp b/src/lib/core/tests/TestTLV.cpp index fce0a5d17ae484..f71bce13fbd70b 100644 --- a/src/lib/core/tests/TestTLV.cpp +++ b/src/lib/core/tests/TestTLV.cpp @@ -3832,6 +3832,27 @@ void TestTLVReader_SkipOverContainer(nlTestSuite * inSuite) ForEachElement(inSuite, reader, nullptr, TestTLVReader_SkipOverContainer_ProcessElement); } +/** + * Tests using an uninitialized TLVReader. + */ +void TestTLVReaderUninitialized(nlTestSuite * inSuite) +{ + TLVReader reader; + + NL_TEST_ASSERT(inSuite, reader.GetType() == kTLVType_NotSpecified); + NL_TEST_ASSERT(inSuite, reader.GetLength() == 0); + NL_TEST_ASSERT(inSuite, reader.GetControlByte() == kTLVControlByte_NotSpecified); + NL_TEST_ASSERT(inSuite, reader.GetContainerType() == kTLVType_NotSpecified); + NL_TEST_ASSERT(inSuite, reader.GetLengthRead() == 0); + NL_TEST_ASSERT(inSuite, reader.GetRemainingLength() == 0); + NL_TEST_ASSERT(inSuite, reader.GetTotalLength() == 0); + NL_TEST_ASSERT(inSuite, reader.GetBackingStore() == nullptr); + NL_TEST_ASSERT(inSuite, reader.IsElementDouble() == false); + NL_TEST_ASSERT(inSuite, reader.GetReadPoint() == nullptr); + NL_TEST_ASSERT(inSuite, reader.ImplicitProfileId == kProfileIdNotSpecified); + NL_TEST_ASSERT(inSuite, reader.AppData == nullptr); +} + /** * Test CHIP TLV Reader */ @@ -3852,6 +3873,8 @@ void CheckTLVReader(nlTestSuite * inSuite, void * inContext) TestTLVReader_NextOverContainer(inSuite); TestTLVReader_SkipOverContainer(inSuite); + + TestTLVReaderUninitialized(inSuite); } /** From e1a4a01ca6c5715153381449b6d73bece6995756 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Wed, 21 Feb 2024 17:35:34 +0100 Subject: [PATCH 03/29] Extend GAutoPtr to conventionally get receiver (#32115) * Extend GAutoPtr to conventionally get receiver * Replace explicit use of MakeUniquePointerReceiver with GetReceiver() * Replace g_clear_error with .reset() * Add missing GLibTypeDeleter.h dependency to Tizen platform --- src/platform/GLibTypeDeleter.h | 12 +++- .../Linux/ConnectivityManagerImpl.cpp | 55 ++++++++----------- src/platform/Linux/ThreadStackManagerImpl.cpp | 28 ++++------ src/platform/Linux/bluez/AdapterIterator.cpp | 2 +- .../Linux/bluez/BluezAdvertisement.cpp | 8 +-- src/platform/Linux/bluez/BluezConnection.cpp | 10 ++-- src/platform/Linux/bluez/BluezEndpoint.cpp | 15 +++-- .../Linux/bluez/ChipDeviceScanner.cpp | 15 ++--- src/platform/Tizen/BLEManagerImpl.cpp | 12 ++-- src/platform/Tizen/BUILD.gn | 1 + src/platform/Tizen/DnssdImpl.cpp | 10 ++-- src/platform/Tizen/WiFiManager.cpp | 10 ++-- 12 files changed, 84 insertions(+), 94 deletions(-) diff --git a/src/platform/GLibTypeDeleter.h b/src/platform/GLibTypeDeleter.h index e6d9bfd0d2c1ed..f217d559e9cc66 100644 --- a/src/platform/GLibTypeDeleter.h +++ b/src/platform/GLibTypeDeleter.h @@ -29,10 +29,10 @@ class UniquePointerReceiver { public: UniquePointerReceiver(std::unique_ptr & target) : mTarget(target) {} - ~UniquePointerReceiver() { mTarget.reset(mValue); } T *& Get() { return mValue; } + T ** operator&() { return &mValue; } private: std::unique_ptr & mTarget; @@ -151,6 +151,14 @@ struct GAutoPtrDeleter }; template -using GAutoPtr = std::unique_ptr::deleter>; +class GAutoPtr : public std::unique_ptr::deleter> +{ +public: + using deleter = typename GAutoPtrDeleter::deleter; + using std::unique_ptr::unique_ptr; + + // Convenience method to get a UniquePointerReceiver for this object. + UniquePointerReceiver GetReceiver() { return MakeUniquePointerReceiver(*this); } +}; } // namespace chip diff --git a/src/platform/Linux/ConnectivityManagerImpl.cpp b/src/platform/Linux/ConnectivityManagerImpl.cpp index eef7ce883f0042..2a57a99d507976 100644 --- a/src/platform/Linux/ConnectivityManagerImpl.cpp +++ b/src/platform/Linux/ConnectivityManagerImpl.cpp @@ -266,8 +266,7 @@ void ConnectivityManagerImpl::_ClearWiFiStationProvision() if (mWiFiStationMode != kWiFiStationMode_ApplicationControlled) { GAutoPtr err; - wpa_fi_w1_wpa_supplicant1_interface_call_remove_all_networks_sync(mWpaSupplicant.iface, nullptr, - &MakeUniquePointerReceiver(err).Get()); + wpa_fi_w1_wpa_supplicant1_interface_call_remove_all_networks_sync(mWpaSupplicant.iface, nullptr, &err.GetReceiver()); if (err != nullptr) { @@ -388,7 +387,7 @@ void ConnectivityManagerImpl::_OnWpaPropertiesChanged(WpaFiW1Wpa_supplicant1Inte WiFiDiagnosticsDelegate * delegate = GetDiagnosticDataProvider().GetWiFiDiagnosticsDelegate(); - g_variant_get(changedProperties, "a{sv}", &MakeUniquePointerReceiver(iter).Get()); + g_variant_get(changedProperties, "a{sv}", &iter.GetReceiver()); while (g_variant_iter_loop(iter.get(), "{&sv}", &key, &value)) { @@ -497,8 +496,7 @@ void ConnectivityManagerImpl::_OnWpaInterfaceProxyReady(GObject * sourceObject, std::lock_guard lock(mWpaSupplicantMutex); - WpaFiW1Wpa_supplicant1Interface * iface = - wpa_fi_w1_wpa_supplicant1_interface_proxy_new_for_bus_finish(res, &MakeUniquePointerReceiver(err).Get()); + WpaFiW1Wpa_supplicant1Interface * iface = wpa_fi_w1_wpa_supplicant1_interface_proxy_new_for_bus_finish(res, &err.GetReceiver()); if (mWpaSupplicant.iface) { @@ -552,8 +550,7 @@ void ConnectivityManagerImpl::_OnWpaBssProxyReady(GObject * sourceObject, GAsync std::lock_guard lock(mWpaSupplicantMutex); - WpaFiW1Wpa_supplicant1BSS * bss = - wpa_fi_w1_wpa_supplicant1_bss_proxy_new_for_bus_finish(res, &MakeUniquePointerReceiver(err).Get()); + WpaFiW1Wpa_supplicant1BSS * bss = wpa_fi_w1_wpa_supplicant1_bss_proxy_new_for_bus_finish(res, &err.GetReceiver()); if (mWpaSupplicant.bss) { @@ -584,7 +581,7 @@ void ConnectivityManagerImpl::_OnWpaInterfaceReady(GObject * sourceObject, GAsyn std::lock_guard lock(mWpaSupplicantMutex); gboolean result = wpa_fi_w1_wpa_supplicant1_call_get_interface_finish(mWpaSupplicant.proxy, &mWpaSupplicant.interfacePath, res, - &MakeUniquePointerReceiver(err).Get()); + &err.GetReceiver()); if (result) { mWpaSupplicant.state = GDBusWpaSupplicant::WPA_GOT_INTERFACE_PATH; @@ -622,7 +619,7 @@ void ConnectivityManagerImpl::_OnWpaInterfaceReady(GObject * sourceObject, GAsyn args = g_variant_builder_end(&builder); result = wpa_fi_w1_wpa_supplicant1_call_create_interface_sync(mWpaSupplicant.proxy, args, &mWpaSupplicant.interfacePath, - nullptr, &MakeUniquePointerReceiver(error).Get()); + nullptr, &error.GetReceiver()); if (result) { @@ -747,7 +744,7 @@ void ConnectivityManagerImpl::_OnWpaProxyReady(GObject * sourceObject, GAsyncRes std::lock_guard lock(mWpaSupplicantMutex); - mWpaSupplicant.proxy = wpa_fi_w1_wpa_supplicant1_proxy_new_for_bus_finish(res, &MakeUniquePointerReceiver(err).Get()); + mWpaSupplicant.proxy = wpa_fi_w1_wpa_supplicant1_proxy_new_for_bus_finish(res, &err.GetReceiver()); if (mWpaSupplicant.proxy != nullptr && err.get() == nullptr) { mWpaSupplicant.state = GDBusWpaSupplicant::WPA_CONNECTED; @@ -898,7 +895,7 @@ void ConnectivityManagerImpl::DriveAPState() GAutoPtr error(nullptr); gboolean result = wpa_fi_w1_wpa_supplicant1_interface_call_remove_network_sync( - mWpaSupplicant.iface, mWpaSupplicant.networkPath, nullptr, &MakeUniquePointerReceiver(error).Get()); + mWpaSupplicant.iface, mWpaSupplicant.networkPath, nullptr, &error.GetReceiver()); if (result) { @@ -963,7 +960,7 @@ CHIP_ERROR ConnectivityManagerImpl::ConfigureWiFiAP() args = g_variant_builder_end(&builder); gboolean result = wpa_fi_w1_wpa_supplicant1_interface_call_add_network_sync( - mWpaSupplicant.iface, args, &mWpaSupplicant.networkPath, nullptr, &MakeUniquePointerReceiver(err).Get()); + mWpaSupplicant.iface, args, &mWpaSupplicant.networkPath, nullptr, &err.GetReceiver()); if (result) { @@ -972,7 +969,7 @@ CHIP_ERROR ConnectivityManagerImpl::ConfigureWiFiAP() ChipLogProgress(DeviceLayer, "wpa_supplicant: added network: SSID: %s: %s", ssid, mWpaSupplicant.networkPath); result = wpa_fi_w1_wpa_supplicant1_interface_call_select_network_sync(mWpaSupplicant.iface, mWpaSupplicant.networkPath, - nullptr, &MakeUniquePointerReceiver(error).Get()); + nullptr, &error.GetReceiver()); if (result) { ChipLogProgress(DeviceLayer, "wpa_supplicant: succeeded to start softAP: SSID: %s", ssid); @@ -1033,7 +1030,7 @@ ConnectivityManagerImpl::_ConnectWiFiNetworkAsync(GVariant * args, GAutoPtr error; result = wpa_fi_w1_wpa_supplicant1_interface_call_remove_network_sync(mWpaSupplicant.iface, networkPath, nullptr, - &MakeUniquePointerReceiver(error).Get()); + &error.GetReceiver()); if (result) { @@ -1055,7 +1052,7 @@ ConnectivityManagerImpl::_ConnectWiFiNetworkAsync(GVariant * args, } result = wpa_fi_w1_wpa_supplicant1_interface_call_add_network_sync(mWpaSupplicant.iface, args, &mWpaSupplicant.networkPath, - nullptr, &MakeUniquePointerReceiver(err).Get()); + nullptr, &err.GetReceiver()); if (result) { @@ -1127,7 +1124,7 @@ static CHIP_ERROR AddOrReplaceBlob(WpaFiW1Wpa_supplicant1Interface * iface, cons const char * name = (strncmp(nameOrRef, refPrefix.data(), refPrefix.size()) == 0) ? nameOrRef + refPrefix.size() : nameOrRef; GAutoPtr err; - if (!wpa_fi_w1_wpa_supplicant1_interface_call_remove_blob_sync(iface, name, nullptr, &MakeUniquePointerReceiver(err).Get())) + if (!wpa_fi_w1_wpa_supplicant1_interface_call_remove_blob_sync(iface, name, nullptr, &err.GetReceiver())) { GAutoPtr remoteError(g_dbus_error_get_remote_error(err.get())); if (!(remoteError && strcmp(remoteError.get(), kWpaSupplicantBlobUnknown) == 0)) @@ -1138,8 +1135,7 @@ static CHIP_ERROR AddOrReplaceBlob(WpaFiW1Wpa_supplicant1Interface * iface, cons err.reset(); } if (!wpa_fi_w1_wpa_supplicant1_interface_call_add_blob_sync( - iface, name, g_variant_new_fixed_array(G_VARIANT_TYPE_BYTE, data.data(), data.size(), 1), nullptr, - &MakeUniquePointerReceiver(err).Get())) + iface, name, g_variant_new_fixed_array(G_VARIANT_TYPE_BYTE, data.data(), data.size(), 1), nullptr, &err.GetReceiver())) { ChipLogError(DeviceLayer, "wpa_supplicant: failed to add blob: %s", err ? err->message : "unknown error"); return CHIP_ERROR_INTERNAL; @@ -1239,8 +1235,8 @@ void ConnectivityManagerImpl::_ConnectWiFiNetworkAsyncCallback(GObject * sourceO std::lock_guard lock(mWpaSupplicantMutex); { - gboolean result = wpa_fi_w1_wpa_supplicant1_interface_call_select_network_finish(mWpaSupplicant.iface, res, - &MakeUniquePointerReceiver(err).Get()); + gboolean result = + wpa_fi_w1_wpa_supplicant1_interface_call_select_network_finish(mWpaSupplicant.iface, res, &err.GetReceiver()); if (!result) { ChipLogError(DeviceLayer, "Failed to perform connect network: %s", err == nullptr ? "unknown error" : err->message); @@ -1257,8 +1253,7 @@ void ConnectivityManagerImpl::_ConnectWiFiNetworkAsyncCallback(GObject * sourceO return; } - result = wpa_fi_w1_wpa_supplicant1_interface_call_save_config_sync(mWpaSupplicant.iface, nullptr, - &MakeUniquePointerReceiver(err).Get()); + result = wpa_fi_w1_wpa_supplicant1_interface_call_save_config_sync(mWpaSupplicant.iface, nullptr, &err.GetReceiver()); if (result) { ChipLogProgress(DeviceLayer, "wpa_supplicant: save config succeeded!"); @@ -1335,8 +1330,7 @@ CHIP_ERROR ConnectivityManagerImpl::CommitConfig() ChipLogProgress(DeviceLayer, "wpa_supplicant: save config"); - result = wpa_fi_w1_wpa_supplicant1_interface_call_save_config_sync(mWpaSupplicant.iface, nullptr, - &MakeUniquePointerReceiver(err).Get()); + result = wpa_fi_w1_wpa_supplicant1_interface_call_save_config_sync(mWpaSupplicant.iface, nullptr, &err.GetReceiver()); if (!result) { @@ -1486,8 +1480,7 @@ CHIP_ERROR ConnectivityManagerImpl::GetConfiguredNetwork(NetworkCommissioning::N } GAutoPtr networkInfo(wpa_fi_w1_wpa_supplicant1_network_proxy_new_for_bus_sync( - G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, kWpaSupplicantServiceName, networkPath, nullptr, - &MakeUniquePointerReceiver(err).Get())); + G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, kWpaSupplicantServiceName, networkPath, nullptr, &err.GetReceiver())); if (networkInfo == nullptr) { return CHIP_ERROR_INTERNAL; @@ -1518,7 +1511,7 @@ CHIP_ERROR ConnectivityManagerImpl::StopAutoScan() ChipLogDetail(DeviceLayer, "wpa_supplicant: disabling auto scan"); result = wpa_fi_w1_wpa_supplicant1_interface_call_auto_scan_sync( - mWpaSupplicant.iface, "" /* empty string means disabling auto scan */, nullptr, &MakeUniquePointerReceiver(err).Get()); + mWpaSupplicant.iface, "" /* empty string means disabling auto scan */, nullptr, &err.GetReceiver()); if (!result) { ChipLogError(DeviceLayer, "wpa_supplicant: Failed to stop auto network scan: %s", err ? err->message : "unknown"); @@ -1548,8 +1541,7 @@ CHIP_ERROR ConnectivityManagerImpl::StartWiFiScan(ByteSpan ssid, WiFiDriver::Sca g_variant_builder_add(&builder, "{sv}", "Type", g_variant_new_string("active")); args = g_variant_builder_end(&builder); - result = wpa_fi_w1_wpa_supplicant1_interface_call_scan_sync(mWpaSupplicant.iface, args, nullptr, - &MakeUniquePointerReceiver(err).Get()); + result = wpa_fi_w1_wpa_supplicant1_interface_call_scan_sync(mWpaSupplicant.iface, args, nullptr, &err.GetReceiver()); if (result) { @@ -1676,9 +1668,8 @@ bool ConnectivityManagerImpl::_GetBssInfo(const gchar * bssPath, NetworkCommissi // with the proxy object. GAutoPtr err; - GAutoPtr bss( - wpa_fi_w1_wpa_supplicant1_bss_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, kWpaSupplicantServiceName, - bssPath, nullptr, &MakeUniquePointerReceiver(err).Get())); + GAutoPtr bss(wpa_fi_w1_wpa_supplicant1_bss_proxy_new_for_bus_sync( + G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, kWpaSupplicantServiceName, bssPath, nullptr, &err.GetReceiver())); if (bss == nullptr) { diff --git a/src/platform/Linux/ThreadStackManagerImpl.cpp b/src/platform/Linux/ThreadStackManagerImpl.cpp index a8f6c23f1e5a24..5fd865df5485ad 100644 --- a/src/platform/Linux/ThreadStackManagerImpl.cpp +++ b/src/platform/Linux/ThreadStackManagerImpl.cpp @@ -85,7 +85,7 @@ CHIP_ERROR ThreadStackManagerImpl::GLibMatterContextInitThreadStack(ThreadStackM GAutoPtr err; self->mProxy.reset(openthread_io_openthread_border_router_proxy_new_for_bus_sync( G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, kDBusOpenThreadService, kDBusOpenThreadObjectPath, nullptr, - &MakeUniquePointerReceiver(err).Get())); + &err.GetReceiver())); VerifyOrReturnError( self->mProxy != nullptr, CHIP_ERROR_INTERNAL, ChipLogError(DeviceLayer, "openthread: failed to create openthread dbus proxy %s", err ? err->message : "unknown error")); @@ -123,7 +123,7 @@ void ThreadStackManagerImpl::OnDbusPropertiesChanged(OpenthreadIoOpenthreadBorde GVariant * value; GAutoPtr iter; - g_variant_get(changed_properties, "a{sv}", &MakeUniquePointerReceiver(iter).Get()); + g_variant_get(changed_properties, "a{sv}", &iter.GetReceiver()); if (!iter) return; while (g_variant_iter_loop(iter.get(), "{&sv}", &key, &value)) @@ -193,7 +193,7 @@ bool ThreadStackManagerImpl::_HaveRouteToAddress(const Inet::IPAddress & destAdd if (g_variant_n_children(routes.get()) > 0) { GAutoPtr iter; - g_variant_get(routes.get(), "av", &MakeUniquePointerReceiver(iter).Get()); + g_variant_get(routes.get(), "av", &iter.GetReceiver()); if (!iter) return false; @@ -207,14 +207,13 @@ bool ThreadStackManagerImpl::_HaveRouteToAddress(const Inet::IPAddress & destAdd guchar preference; gboolean stable; gboolean nextHopIsThisDevice; - g_variant_get(route, "(&vqybb)", &MakeUniquePointerReceiver(prefix).Get(), &rloc16, &preference, &stable, - &nextHopIsThisDevice); + g_variant_get(route, "(&vqybb)", &prefix.GetReceiver(), &rloc16, &preference, &stable, &nextHopIsThisDevice); if (!prefix) continue; GAutoPtr address; guchar prefixLength; - g_variant_get(prefix.get(), "(&vy)", &MakeUniquePointerReceiver(address).Get(), &prefixLength); + g_variant_get(prefix.get(), "(&vy)", &address.GetReceiver(), &prefixLength); if (!address) continue; @@ -273,8 +272,7 @@ CHIP_ERROR ThreadStackManagerImpl::_GetThreadProvision(Thread::OperationalDatase GAutoPtr err; GAutoPtr response(g_dbus_proxy_call_sync(G_DBUS_PROXY(mProxy.get()), "org.freedesktop.DBus.Properties.Get", g_variant_new("(ss)", "io.openthread.BorderRouter", "ActiveDatasetTlvs"), - G_DBUS_CALL_FLAGS_NONE, -1, nullptr, - &MakeUniquePointerReceiver(err).Get())); + G_DBUS_CALL_FLAGS_NONE, -1, nullptr, &err.GetReceiver())); if (err) { @@ -330,7 +328,7 @@ bool ThreadStackManagerImpl::_IsThreadEnabled() GAutoPtr err; GAutoPtr response(g_dbus_proxy_call_sync(G_DBUS_PROXY(mProxy.get()), "org.freedesktop.DBus.Properties.Get", g_variant_new("(ss)", "io.openthread.BorderRouter", "DeviceRole"), - G_DBUS_CALL_FLAGS_NONE, -1, nullptr, &MakeUniquePointerReceiver(err).Get())); + G_DBUS_CALL_FLAGS_NONE, -1, nullptr, &err.GetReceiver())); if (err) { @@ -390,8 +388,7 @@ CHIP_ERROR ThreadStackManagerImpl::_SetThreadEnabled(bool val) else { GAutoPtr err; - gboolean result = - openthread_io_openthread_border_router_call_reset_sync(mProxy.get(), nullptr, &MakeUniquePointerReceiver(err).Get()); + gboolean result = openthread_io_openthread_border_router_call_reset_sync(mProxy.get(), nullptr, &err.GetReceiver()); if (err) { ChipLogError(DeviceLayer, "openthread: _SetThreadEnabled calling %s failed: %s", "Reset", err->message); @@ -413,8 +410,7 @@ void ThreadStackManagerImpl::_OnThreadBrAttachFinished(GObject * source_object, GAutoPtr attachRes; GAutoPtr err; { - gboolean result = openthread_io_openthread_border_router_call_attach_finish(this_->mProxy.get(), res, - &MakeUniquePointerReceiver(err).Get()); + gboolean result = openthread_io_openthread_border_router_call_attach_finish(this_->mProxy.get(), res, &err.GetReceiver()); if (!result) { ChipLogError(DeviceLayer, "Failed to perform finish Thread network scan: %s", @@ -612,8 +608,8 @@ void ThreadStackManagerImpl::_OnNetworkScanFinished(GAsyncResult * res) GAutoPtr scan_result; GAutoPtr err; { - gboolean result = openthread_io_openthread_border_router_call_scan_finish( - mProxy.get(), &MakeUniquePointerReceiver(scan_result).Get(), res, &MakeUniquePointerReceiver(err).Get()); + gboolean result = openthread_io_openthread_border_router_call_scan_finish(mProxy.get(), &scan_result.GetReceiver(), res, + &err.GetReceiver()); if (!result) { ChipLogError(DeviceLayer, "Failed to perform finish Thread network scan: %s", @@ -635,7 +631,7 @@ void ThreadStackManagerImpl::_OnNetworkScanFinished(GAsyncResult * res) if (g_variant_n_children(scan_result.get()) > 0) { GAutoPtr iter; - g_variant_get(scan_result.get(), "a(tstayqqynyybb)", &MakeUniquePointerReceiver(iter).Get()); + g_variant_get(scan_result.get(), "a(tstayqqynyybb)", &iter.GetReceiver()); if (!iter) { delete scanResult; diff --git a/src/platform/Linux/bluez/AdapterIterator.cpp b/src/platform/Linux/bluez/AdapterIterator.cpp index 3197be4e73e175..e69c473f52bbfe 100644 --- a/src/platform/Linux/bluez/AdapterIterator.cpp +++ b/src/platform/Linux/bluez/AdapterIterator.cpp @@ -57,7 +57,7 @@ CHIP_ERROR AdapterIterator::Initialize(AdapterIterator * self) self->mManager = g_dbus_object_manager_client_new_for_bus_sync( G_BUS_TYPE_SYSTEM, G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE, BLUEZ_INTERFACE, "/", bluez_object_manager_client_get_proxy_type, nullptr /* unused user data in the Proxy Type Func */, - nullptr /*destroy notify */, nullptr /* cancellable */, &MakeUniquePointerReceiver(error).Get()); + nullptr /* destroy notify */, nullptr /* cancellable */, &error.GetReceiver()); VerifyOrExit(self->mManager != nullptr, ChipLogError(DeviceLayer, "Failed to get DBUS object manager for listing adapters."); err = CHIP_ERROR_INTERNAL); diff --git a/src/platform/Linux/bluez/BluezAdvertisement.cpp b/src/platform/Linux/bluez/BluezAdvertisement.cpp index 1b95aae41a4f11..196529816b59ab 100644 --- a/src/platform/Linux/bluez/BluezAdvertisement.cpp +++ b/src/platform/Linux/bluez/BluezAdvertisement.cpp @@ -118,7 +118,7 @@ CHIP_ERROR BluezAdvertisement::Init(const BluezEndpoint & aEndpoint, const char mpRoot = reinterpret_cast(g_object_ref(aEndpoint.GetGattApplicationObjectManager())); mpAdapter = reinterpret_cast(g_object_ref(aEndpoint.GetAdapter())); - g_object_get(G_OBJECT(mpRoot), "object-path", &MakeUniquePointerReceiver(rootPath).Get(), nullptr); + g_object_get(G_OBJECT(mpRoot), "object-path", &rootPath.GetReceiver(), nullptr); mpAdvPath = g_strdup_printf("%s/advertising", rootPath.get()); mpAdvUUID = g_strdup(aAdvUUID); @@ -241,8 +241,7 @@ void BluezAdvertisement::StartDone(GObject * aObject, GAsyncResult * aResult) GAutoPtr error; gboolean success = FALSE; - success = - bluez_leadvertising_manager1_call_register_advertisement_finish(advMgr, aResult, &MakeUniquePointerReceiver(error).Get()); + success = bluez_leadvertising_manager1_call_register_advertisement_finish(advMgr, aResult, &error.GetReceiver()); if (success == FALSE) { g_dbus_object_manager_server_unexport(mpRoot, mpAdvPath); @@ -304,8 +303,7 @@ void BluezAdvertisement::StopDone(GObject * aObject, GAsyncResult * aResult) GAutoPtr error; gboolean success = FALSE; - success = - bluez_leadvertising_manager1_call_unregister_advertisement_finish(advMgr, aResult, &MakeUniquePointerReceiver(error).Get()); + success = bluez_leadvertising_manager1_call_unregister_advertisement_finish(advMgr, aResult, &error.GetReceiver()); if (success == FALSE) { diff --git a/src/platform/Linux/bluez/BluezConnection.cpp b/src/platform/Linux/bluez/BluezConnection.cpp index 39b5bb0bdb8ba6..d2d5745a4c37c2 100644 --- a/src/platform/Linux/bluez/BluezConnection.cpp +++ b/src/platform/Linux/bluez/BluezConnection.cpp @@ -180,7 +180,7 @@ CHIP_ERROR BluezConnection::BluezDisconnect(BluezConnection * conn) ChipLogDetail(DeviceLayer, "%s peer=%s", __func__, conn->GetPeerAddress()); - success = bluez_device1_call_disconnect_sync(conn->mpDevice, nullptr, &MakeUniquePointerReceiver(error).Get()); + success = bluez_device1_call_disconnect_sync(conn->mpDevice, nullptr, &error.GetReceiver()); VerifyOrExit(success == TRUE, ChipLogError(DeviceLayer, "FAIL: Disconnect: %s", error->message)); exit: @@ -284,7 +284,7 @@ CHIP_ERROR BluezConnection::SendIndicationImpl(ConnectionDataBundle * data) VerifyOrExit(len <= static_cast(std::numeric_limits::max()), ChipLogError(DeviceLayer, "FAIL: buffer too large in %s", __func__)); auto status = g_io_channel_write_chars(data->mConn.mC2Channel.mChannel.get(), buf, static_cast(len), &written, - &MakeUniquePointerReceiver(error).Get()); + &error.GetReceiver()); VerifyOrExit(status == G_IO_STATUS_NORMAL, ChipLogError(DeviceLayer, "FAIL: C2 Indicate: %s", error->message)); } else @@ -311,7 +311,7 @@ void BluezConnection::SendWriteRequestDone(GObject * aObject, GAsyncResult * aRe { BluezGattCharacteristic1 * c1 = BLUEZ_GATT_CHARACTERISTIC1(aObject); GAutoPtr error; - gboolean success = bluez_gatt_characteristic1_call_write_value_finish(c1, aResult, &MakeUniquePointerReceiver(error).Get()); + gboolean success = bluez_gatt_characteristic1_call_write_value_finish(c1, aResult, &error.GetReceiver()); VerifyOrReturn(success == TRUE, ChipLogError(DeviceLayer, "FAIL: SendWriteRequest : %s", error->message)); BLEManagerImpl::HandleWriteComplete(static_cast(apConnection)); @@ -360,7 +360,7 @@ void BluezConnection::SubscribeCharacteristicDone(GObject * aObject, GAsyncResul { BluezGattCharacteristic1 * c2 = BLUEZ_GATT_CHARACTERISTIC1(aObject); GAutoPtr error; - gboolean success = bluez_gatt_characteristic1_call_write_value_finish(c2, aResult, &MakeUniquePointerReceiver(error).Get()); + gboolean success = bluez_gatt_characteristic1_call_write_value_finish(c2, aResult, &error.GetReceiver()); VerifyOrReturn(success == TRUE, ChipLogError(DeviceLayer, "FAIL: SubscribeCharacteristic : %s", error->message)); @@ -392,7 +392,7 @@ void BluezConnection::UnsubscribeCharacteristicDone(GObject * aObject, GAsyncRes { BluezGattCharacteristic1 * c2 = BLUEZ_GATT_CHARACTERISTIC1(aObject); GAutoPtr error; - gboolean success = bluez_gatt_characteristic1_call_write_value_finish(c2, aResult, &MakeUniquePointerReceiver(error).Get()); + gboolean success = bluez_gatt_characteristic1_call_write_value_finish(c2, aResult, &error.GetReceiver()); VerifyOrReturn(success == TRUE, ChipLogError(DeviceLayer, "FAIL: UnsubscribeCharacteristic : %s", error->message)); diff --git a/src/platform/Linux/bluez/BluezEndpoint.cpp b/src/platform/Linux/bluez/BluezEndpoint.cpp index 3baca7d127f20a..e68b28b8f421a8 100644 --- a/src/platform/Linux/bluez/BluezEndpoint.cpp +++ b/src/platform/Linux/bluez/BluezEndpoint.cpp @@ -264,8 +264,7 @@ void BluezEndpoint::RegisterGattApplicationDone(GObject * aObject, GAsyncResult GAutoPtr error; BluezGattManager1 * gattMgr = BLUEZ_GATT_MANAGER1(aObject); - gboolean success = - bluez_gatt_manager1_call_register_application_finish(gattMgr, aResult, &MakeUniquePointerReceiver(error).Get()); + gboolean success = bluez_gatt_manager1_call_register_application_finish(gattMgr, aResult, &error.GetReceiver()); VerifyOrReturn(success == TRUE, { ChipLogError(DeviceLayer, "FAIL: RegisterApplication : %s", error->message); @@ -614,16 +613,16 @@ void BluezEndpoint::SetupGattServer(GDBusConnection * aConn) CHIP_ERROR BluezEndpoint::StartupEndpointBindings() { GAutoPtr err; - GAutoPtr conn(g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, &MakeUniquePointerReceiver(err).Get())); + GAutoPtr conn(g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, &err.GetReceiver())); VerifyOrReturnError(conn != nullptr, CHIP_ERROR_INTERNAL, ChipLogError(DeviceLayer, "FAIL: get bus sync in %s, error: %s", __func__, err->message)); SetupGattServer(conn.get()); - mpObjMgr = g_dbus_object_manager_client_new_sync( - conn.get(), G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE, BLUEZ_INTERFACE, "/", bluez_object_manager_client_get_proxy_type, - nullptr /* unused user data in the Proxy Type Func */, nullptr /*destroy notify */, nullptr /* cancellable */, - &MakeUniquePointerReceiver(err).Get()); + mpObjMgr = g_dbus_object_manager_client_new_sync(conn.get(), G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE, BLUEZ_INTERFACE, "/", + bluez_object_manager_client_get_proxy_type, + nullptr /* unused user data in the Proxy Type Func */, + nullptr /*destroy notify */, nullptr /* cancellable */, &err.GetReceiver()); VerifyOrReturnError(mpObjMgr != nullptr, CHIP_ERROR_INTERNAL, ChipLogError(DeviceLayer, "FAIL: Error getting object manager client: %s", err->message)); @@ -729,7 +728,7 @@ CHIP_ERROR BluezEndpoint::ConnectDeviceImpl(BluezDevice1 & aDevice) for (uint16_t i = 0; i < kMaxConnectRetries; i++) { GAutoPtr error; - if (bluez_device1_call_connect_sync(&aDevice, mConnectCancellable.get(), &MakeUniquePointerReceiver(error).Get())) + if (bluez_device1_call_connect_sync(&aDevice, mConnectCancellable.get(), &error.GetReceiver())) { ChipLogDetail(DeviceLayer, "ConnectDevice complete"); return CHIP_NO_ERROR; diff --git a/src/platform/Linux/bluez/ChipDeviceScanner.cpp b/src/platform/Linux/bluez/ChipDeviceScanner.cpp index 5d9cbf25c9028b..03b26aa08e3dc7 100644 --- a/src/platform/Linux/bluez/ChipDeviceScanner.cpp +++ b/src/platform/Linux/bluez/ChipDeviceScanner.cpp @@ -72,7 +72,7 @@ CHIP_ERROR ChipDeviceScanner::Init(BluezAdapter1 * adapter, ChipDeviceScannerDel self->mManager = g_dbus_object_manager_client_new_for_bus_sync( G_BUS_TYPE_SYSTEM, G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE, BLUEZ_INTERFACE, "/", bluez_object_manager_client_get_proxy_type, nullptr /* unused user data in the Proxy Type Func */, - nullptr /* destroy notify */, nullptr /* cancellable */, &MakeUniquePointerReceiver(err).Get()); + nullptr /* destroy notify */, nullptr /* cancellable */, &err.GetReceiver()); VerifyOrReturnError(self->mManager != nullptr, CHIP_ERROR_INTERNAL, ChipLogError(Ble, "Failed to get D-Bus object manager for device scanning: %s", err->message)); return CHIP_NO_ERROR; @@ -205,8 +205,7 @@ CHIP_ERROR ChipDeviceScanner::MainLoopStopScan(ChipDeviceScanner * self) self->mInterfaceChangedSignal = 0; } - if (!bluez_adapter1_call_stop_discovery_sync(self->mAdapter, nullptr /* not cancellable */, - &MakeUniquePointerReceiver(error).Get())) + if (!bluez_adapter1_call_stop_discovery_sync(self->mAdapter, nullptr /* not cancellable */, &error.GetReceiver())) { ChipLogError(Ble, "Failed to stop discovery %s", error->message); return CHIP_ERROR_INTERNAL; @@ -268,7 +267,7 @@ void ChipDeviceScanner::RemoveDevice(BluezDevice1 & device) const auto devicePath = g_dbus_proxy_get_object_path(G_DBUS_PROXY(&device)); GAutoPtr error; - if (!bluez_adapter1_call_remove_device_sync(mAdapter, devicePath, nullptr, &MakeUniquePointerReceiver(error).Get())) + if (!bluez_adapter1_call_remove_device_sync(mAdapter, devicePath, nullptr, &error.GetReceiver())) { ChipLogDetail(Ble, "Failed to remove device %s: %s", StringOrNullMarker(devicePath), error->message); } @@ -303,17 +302,15 @@ CHIP_ERROR ChipDeviceScanner::MainLoopStartScan(ChipDeviceScanner * self) g_variant_builder_add(&filterBuilder, "{sv}", "Transport", g_variant_new_string("le")); GVariant * filter = g_variant_builder_end(&filterBuilder); - if (!bluez_adapter1_call_set_discovery_filter_sync(self->mAdapter, filter, self->mCancellable.get(), - &MakeUniquePointerReceiver(error).Get())) + if (!bluez_adapter1_call_set_discovery_filter_sync(self->mAdapter, filter, self->mCancellable.get(), &error.GetReceiver())) { // Not critical: ignore if fails ChipLogError(Ble, "Failed to set discovery filters: %s", error->message); - g_clear_error(&MakeUniquePointerReceiver(error).Get()); + error.reset(); } ChipLogProgress(Ble, "BLE initiating scan."); - if (!bluez_adapter1_call_start_discovery_sync(self->mAdapter, self->mCancellable.get(), - &MakeUniquePointerReceiver(error).Get())) + if (!bluez_adapter1_call_start_discovery_sync(self->mAdapter, self->mCancellable.get(), &error.GetReceiver())) { ChipLogError(Ble, "Failed to start discovery: %s", error->message); return CHIP_ERROR_INTERNAL; diff --git a/src/platform/Tizen/BLEManagerImpl.cpp b/src/platform/Tizen/BLEManagerImpl.cpp index 0a1a9468d00b06..4d4c3e77316fc7 100644 --- a/src/platform/Tizen/BLEManagerImpl.cpp +++ b/src/platform/Tizen/BLEManagerImpl.cpp @@ -208,11 +208,11 @@ void BLEManagerImpl::ReadValueRequestedCb(const char * remoteAddress, int reques GAutoPtr uuid; GAutoPtr value; - VerifyOrReturn(__GetAttInfo(gattHandle, &MakeUniquePointerReceiver(uuid).Get(), &type) == BT_ERROR_NONE, + VerifyOrReturn(__GetAttInfo(gattHandle, &uuid.GetReceiver(), &type) == BT_ERROR_NONE, ChipLogError(DeviceLayer, "Failed to fetch GATT Attribute from GATT handle")); ChipLogProgress(DeviceLayer, "Gatt read requested on %s: uuid=%s", __ConvertAttTypeToStr(type), StringOrNullMarker(uuid.get())); - ret = bt_gatt_get_value(gattHandle, &MakeUniquePointerReceiver(value).Get(), &len); + ret = bt_gatt_get_value(gattHandle, &value.GetReceiver(), &len); VerifyOrReturn(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_get_value() failed: %s", get_error_message(ret))); ChipLogByteSpan(DeviceLayer, ByteSpan(Uint8::from_const_char(value.get()), len)); @@ -233,7 +233,7 @@ void BLEManagerImpl::WriteValueRequestedCb(const char * remoteAddress, int reque conn = static_cast(g_hash_table_lookup(mConnectionMap, remoteAddress)); VerifyOrReturn(conn != nullptr, ChipLogError(DeviceLayer, "Failed to find connection info")); - VerifyOrReturn(__GetAttInfo(gattHandle, &MakeUniquePointerReceiver(uuid).Get(), &type) == BT_ERROR_NONE, + VerifyOrReturn(__GetAttInfo(gattHandle, &uuid.GetReceiver(), &type) == BT_ERROR_NONE, ChipLogError(DeviceLayer, "Failed to fetch GATT Attribute from GATT handle")); ChipLogProgress(DeviceLayer, "Gatt write requested on %s: uuid=%s len=%d", __ConvertAttTypeToStr(type), StringOrNullMarker(uuid.get()), len); @@ -268,7 +268,7 @@ void BLEManagerImpl::NotificationStateChangedCb(bool notify, bt_gatt_server_h se VerifyOrReturn(conn != nullptr, ChipLogError(DeviceLayer, "Failed to find connection info")); - int ret = __GetAttInfo(charHandle, &MakeUniquePointerReceiver(uuid).Get(), &type); + int ret = __GetAttInfo(charHandle, &uuid.GetReceiver(), &type); VerifyOrReturn(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "Failed to fetch GATT Attribute from CHAR handle: %s", get_error_message(ret))); @@ -776,7 +776,7 @@ static bool __GattClientForeachCharCb(int total, int index, bt_gatt_h charHandle GAutoPtr uuid; auto conn = static_cast(data); - int ret = __GetAttInfo(charHandle, &MakeUniquePointerReceiver(uuid).Get(), &type); + int ret = __GetAttInfo(charHandle, &uuid.GetReceiver(), &type); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "Failed to fetch GATT Attribute from CHAR handle: %s", get_error_message(ret))); @@ -803,7 +803,7 @@ static bool __GattClientForeachServiceCb(int total, int index, bt_gatt_h svcHand auto conn = static_cast(data); ChipLogProgress(DeviceLayer, "__GattClientForeachServiceCb"); - int ret = __GetAttInfo(svcHandle, &MakeUniquePointerReceiver(uuid).Get(), &type); + int ret = __GetAttInfo(svcHandle, &uuid.GetReceiver(), &type); VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "Failed to fetch GATT Attribute from SVC handle: %s", get_error_message(ret))); diff --git a/src/platform/Tizen/BUILD.gn b/src/platform/Tizen/BUILD.gn index 0d0f329be1bd5e..f2f972635a054d 100644 --- a/src/platform/Tizen/BUILD.gn +++ b/src/platform/Tizen/BUILD.gn @@ -31,6 +31,7 @@ static_library("Tizen") { sources = [ "../DeviceSafeQueue.cpp", "../DeviceSafeQueue.h", + "../GLibTypeDeleter.h", "../SingletonConfigurationManager.cpp", "AppPreference.cpp", "AppPreference.h", diff --git a/src/platform/Tizen/DnssdImpl.cpp b/src/platform/Tizen/DnssdImpl.cpp index 8d383ac48f5d13..cc3e5a1e8f76a6 100644 --- a/src/platform/Tizen/DnssdImpl.cpp +++ b/src/platform/Tizen/DnssdImpl.cpp @@ -181,13 +181,13 @@ void OnBrowse(dnssd_service_state_e state, dnssd_service_h service, void * data) chip::GAutoPtr ifaceName; uint32_t interfaceId = 0; - ret = dnssd_service_get_type(service, &MakeUniquePointerReceiver(type).Get()); + ret = dnssd_service_get_type(service, &type.GetReceiver()); VerifyOrExit(ret == DNSSD_ERROR_NONE, ChipLogError(DeviceLayer, "dnssd_service_get_type() failed: %s", get_error_message(ret))); - ret = dnssd_service_get_name(service, &MakeUniquePointerReceiver(name).Get()); + ret = dnssd_service_get_name(service, &name.GetReceiver()); VerifyOrExit(ret == DNSSD_ERROR_NONE, ChipLogError(DeviceLayer, "dnssd_service_get_name() failed: %s", get_error_message(ret))); - ret = dnssd_service_get_interface(service, &MakeUniquePointerReceiver(ifaceName).Get()); + ret = dnssd_service_get_interface(service, &ifaceName.GetReceiver()); VerifyOrExit(ret == DNSSD_ERROR_NONE, ChipLogError(DeviceLayer, "dnssd_service_get_interface() failed: %s", get_error_message(ret))); @@ -305,12 +305,12 @@ void OnResolve(dnssd_error_e result, dnssd_service_h service, void * userData) chip::Inet::IPAddress ipAddr; CHIP_ERROR err = CHIP_NO_ERROR; - int ret = dnssd_service_get_name(service, &MakeUniquePointerReceiver(name).Get()); + int ret = dnssd_service_get_name(service, &name.GetReceiver()); VerifyOrExit(ret == DNSSD_ERROR_NONE, ChipLogError(DeviceLayer, "dnssd_service_get_name() failed: %s", get_error_message(ret))); chip::Platform::CopyString(rCtx->mResult.mName, name.get()); - ret = dnssd_service_get_ip(service, &MakeUniquePointerReceiver(ipv4).Get(), &MakeUniquePointerReceiver(ipv6).Get()); + ret = dnssd_service_get_ip(service, &ipv4.GetReceiver(), &ipv6.GetReceiver()); VerifyOrExit(ret == DNSSD_ERROR_NONE, ChipLogError(DeviceLayer, "dnssd_service_get_ip() failed: %s", get_error_message(ret))); // If both IPv4 and IPv6 are set, IPv6 address has higher priority. diff --git a/src/platform/Tizen/WiFiManager.cpp b/src/platform/Tizen/WiFiManager.cpp index ed43377e5e0142..50e8b9206401d7 100644 --- a/src/platform/Tizen/WiFiManager.cpp +++ b/src/platform/Tizen/WiFiManager.cpp @@ -400,14 +400,14 @@ bool WiFiManager::_FoundAPOnScanCb(wifi_manager_ap_h ap, void * userData) wifi_manager_security_type_e type; WiFiScanResponse scannedAP; - wifiErr = wifi_manager_ap_get_essid(ap, &MakeUniquePointerReceiver(essid).Get()); + wifiErr = wifi_manager_ap_get_essid(ap, &essid.GetReceiver()); VerifyOrExit(wifiErr == WIFI_MANAGER_ERROR_NONE, ChipLogError(DeviceLayer, "FAIL: get AP essid [%s]", get_error_message(wifiErr))); ChipLogProgress(DeviceLayer, "Essid Found: %s\n", essid.get()); scannedAP.ssidLen = static_cast(std::min(strlen(essid.get()), sizeof(scannedAP.ssid))); memcpy(scannedAP.ssid, essid.get(), scannedAP.ssidLen); - wifiErr = wifi_manager_ap_get_bssid(ap, &MakeUniquePointerReceiver(bssid).Get()); + wifiErr = wifi_manager_ap_get_bssid(ap, &bssid.GetReceiver()); VerifyOrExit(wifiErr == WIFI_MANAGER_ERROR_NONE, ChipLogError(DeviceLayer, "Fail: get AP bssid [%s]", get_error_message(wifiErr))); memcpy(scannedAP.bssid, bssid.get(), std::min(strlen(bssid.get()), sizeof(scannedAP.bssid))); @@ -443,7 +443,7 @@ bool WiFiManager::_FoundAPCb(wifi_manager_ap_h ap, void * userData) bool isPassphraseRequired = false; auto clonedAp = reinterpret_cast(userData); - wifiErr = wifi_manager_ap_get_essid(ap, &MakeUniquePointerReceiver(essid).Get()); + wifiErr = wifi_manager_ap_get_essid(ap, &essid.GetReceiver()); VerifyOrExit(wifiErr == WIFI_MANAGER_ERROR_NONE, ChipLogError(DeviceLayer, "FAIL: get AP essid [%s]", get_error_message(wifiErr))); @@ -503,7 +503,7 @@ bool WiFiManager::_ConfigListCb(const wifi_manager_config_h config, void * userD GAutoPtr name; wifi_manager_security_type_e securityType = WIFI_MANAGER_SECURITY_TYPE_NONE; - wifi_manager_config_get_name(config, &MakeUniquePointerReceiver(name).Get()); + wifi_manager_config_get_name(config, &name.GetReceiver()); wifi_manager_config_get_security_type(config, &securityType); wifiErr = wifi_manager_config_remove(sInstance.mWiFiManagerHandle, config); @@ -1155,7 +1155,7 @@ CHIP_ERROR WiFiManager::GetConfiguredNetwork(NetworkCommissioning::Network & net return CHIP_ERROR_INCORRECT_STATE; } GAutoPtr essid; - int wifiErr = wifi_manager_ap_get_essid(connectedAp, &MakeUniquePointerReceiver(essid).Get()); + int wifiErr = wifi_manager_ap_get_essid(connectedAp, &essid.GetReceiver()); VerifyOrReturnError(wifiErr == WIFI_MANAGER_ERROR_NONE, CHIP_ERROR_INTERNAL, ChipLogError(DeviceLayer, "FAIL: get essid [%s]", get_error_message(wifiErr))); network.networkIDLen = static_cast(std::min(strlen(essid.get()), sizeof(network.networkID))); From e8cf8f0c6053ca93bf08b53b8fe194de17ea2831 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 21 Feb 2024 11:54:39 -0500 Subject: [PATCH 04/29] Mark ServerEndpoint Darwin objects as Sendable in Swift. (#32088) These are allowed to be accessed concurrently from multiple threads, so are Sendable. --- src/darwin/Framework/CHIP/ServerEndpoint/MTRAccessGrant.h | 1 + src/darwin/Framework/CHIP/ServerEndpoint/MTRDeviceTypeRevision.h | 1 + src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.h | 1 + src/darwin/Framework/CHIP/ServerEndpoint/MTRServerCluster.h | 1 + src/darwin/Framework/CHIP/ServerEndpoint/MTRServerEndpoint.h | 1 + 5 files changed, 5 insertions(+) diff --git a/src/darwin/Framework/CHIP/ServerEndpoint/MTRAccessGrant.h b/src/darwin/Framework/CHIP/ServerEndpoint/MTRAccessGrant.h index e0b25449755f16..e0dc4bd052f0f4 100644 --- a/src/darwin/Framework/CHIP/ServerEndpoint/MTRAccessGrant.h +++ b/src/darwin/Framework/CHIP/ServerEndpoint/MTRAccessGrant.h @@ -24,6 +24,7 @@ NS_ASSUME_NONNULL_BEGIN * An access grant, which can be represented as an entry in the Matter Access * Control cluster. */ +NS_SWIFT_SENDABLE MTR_NEWLY_AVAILABLE @interface MTRAccessGrant : NSObject diff --git a/src/darwin/Framework/CHIP/ServerEndpoint/MTRDeviceTypeRevision.h b/src/darwin/Framework/CHIP/ServerEndpoint/MTRDeviceTypeRevision.h index 7f4f88b0cfd643..dc95ddcddaeaeb 100644 --- a/src/darwin/Framework/CHIP/ServerEndpoint/MTRDeviceTypeRevision.h +++ b/src/darwin/Framework/CHIP/ServerEndpoint/MTRDeviceTypeRevision.h @@ -23,6 +23,7 @@ NS_ASSUME_NONNULL_BEGIN * A representation of a "device type revision" in the sense used in the Matter * specification. This has an identifier and a version number. */ +NS_SWIFT_SENDABLE MTR_NEWLY_AVAILABLE @interface MTRDeviceTypeRevision : NSObject diff --git a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.h b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.h index 46e95bfb39a7bd..7d8c27b74b55d3 100644 --- a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.h +++ b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.h @@ -25,6 +25,7 @@ NS_ASSUME_NONNULL_BEGIN * MTRDeviceController. An attribute has an identifier and a value, and may or * may not be writable. */ +NS_SWIFT_SENDABLE MTR_NEWLY_AVAILABLE @interface MTRServerAttribute : NSObject diff --git a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerCluster.h b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerCluster.h index 48604dd2a76797..02b0f4b274374d 100644 --- a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerCluster.h +++ b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerCluster.h @@ -24,6 +24,7 @@ NS_ASSUME_NONNULL_BEGIN /** * A representation of a server cluster implemented by an MTRDeviceController. */ +NS_SWIFT_SENDABLE MTR_NEWLY_AVAILABLE @interface MTRServerCluster : NSObject diff --git a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerEndpoint.h b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerEndpoint.h index 13dbe8454d759e..9716692ea8895d 100644 --- a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerEndpoint.h +++ b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerEndpoint.h @@ -25,6 +25,7 @@ NS_ASSUME_NONNULL_BEGIN /** * A representation of an endpoint implemented by an MTRDeviceController. */ +NS_SWIFT_SENDABLE MTR_NEWLY_AVAILABLE @interface MTRServerEndpoint : NSObject From 7be1b2e418e0063d8117b0ea31163703c2972105 Mon Sep 17 00:00:00 2001 From: Jean-Francois Penven <67962328+jepenven-silabs@users.noreply.github.com> Date: Wed, 21 Feb 2024 12:01:26 -0500 Subject: [PATCH 05/29] [Silabs] Silabs fix app error (#32238) * fix main * Fix app errorr --- examples/platform/silabs/main.cpp | 10 ++++++---- examples/platform/silabs/silabs_utils.cpp | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/platform/silabs/main.cpp b/examples/platform/silabs/main.cpp index 3c9829edd1954f..a3155194e8d1dd 100644 --- a/examples/platform/silabs/main.cpp +++ b/examples/platform/silabs/main.cpp @@ -71,8 +71,9 @@ int main(void) void application_start(void * unused) { - if (SilabsMatterConfig::InitMatter(BLE_DEV_NAME) != CHIP_NO_ERROR) - appError(CHIP_ERROR_INTERNAL); + CHIP_ERROR err = SilabsMatterConfig::InitMatter(BLE_DEV_NAME); + if (err != CHIP_NO_ERROR) + appError(err); gExampleDeviceInfoProvider.SetStorageDelegate(&chip::Server::GetInstance().GetPersistentStorage()); chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); @@ -83,8 +84,9 @@ void application_start(void * unused) chip::DeviceLayer::PlatformMgr().UnlockChipStack(); SILABS_LOG("Starting App Task"); - if (AppTask::GetAppTask().StartAppTask() != CHIP_NO_ERROR) - appError(CHIP_ERROR_INTERNAL); + err = AppTask::GetAppTask().StartAppTask(); + if (err != CHIP_NO_ERROR) + appError(err); vTaskDelete(main_Task); } diff --git a/examples/platform/silabs/silabs_utils.cpp b/examples/platform/silabs/silabs_utils.cpp index 7231836c15bf7e..c8a068a328955c 100644 --- a/examples/platform/silabs/silabs_utils.cpp +++ b/examples/platform/silabs/silabs_utils.cpp @@ -27,7 +27,7 @@ void appError(int err) snprintf(faultMessage, sizeof faultMessage, "App Critical Error:%d", err); SILABS_LOG("!!!!!!!!!!!! %s !!!!!!!!!!!", faultMessage); chip::DeviceLayer::Silabs::OnSoftwareFaultEventHandler(faultMessage); - vTaskDelay(pdMS_TO_TICKS(1000)); + vTaskSuspendAll(); /* Force an assert. */ chipAbort(); } From 40fc3ea8e9da0a76371bd8bf2050efa69a7efe9e Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 21 Feb 2024 13:03:41 -0500 Subject: [PATCH 06/29] Improve "need a custom toolchain" message to log more information. (#32239) Logging what gn thinks is going on for the host/target OS and cpu can help diagnose why we didn't find toolchain in the big if cascade. --- build/config/BUILDCONFIG.gn | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn index 9d2f17d1acf86e..01626726e0b9af 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -127,7 +127,9 @@ if (_chip_defaults.custom_toolchain != "") { "Unsupported target_cpu: ${current_cpu}. Shall be arm for webOS") } } else { - assert(false, "No toolchain specified, please specify custom_toolchain") + assert( + false, + "No toolchain specified, please specify custom_toolchain for host_os='${host_os}', target_os='${target_os}', host_cpu='${host_cpu}', target_cpu='${target_cpu}'") } set_default_toolchain(_default_toolchain) From f72008cb8a283093245517797fcc21cb0fb3a317 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 21 Feb 2024 13:21:36 -0500 Subject: [PATCH 07/29] Correctly annotate things that are unused when logging is disabled. (#32141) We don't seem to have very good CI coverage for the logging-disabled configurations. Also removes UNUSED_VAR and UNUSED_PARAMETER use in favor of the standard [[maybe_unused]]. Fixes https://github.com/project-chip/connectedhomeip/issues/32113 --- .../bridge-app/asr/subdevice/SubDeviceManager.cpp | 7 +++---- examples/bridge-app/esp32/main/main.cpp | 7 +++---- examples/bridge-app/linux/main.cpp | 7 +++---- examples/bridge-app/telink/src/AppTask.cpp | 7 +++---- examples/chip-tool/commands/common/DeviceScanner.cpp | 2 +- .../discover/DiscoverCommissionersCommand.cpp | 2 +- examples/common/websocket-server/WebSocketServer.cpp | 6 +++--- examples/light-switch-app/genio/src/main.cpp | 2 -- examples/lighting-app/genio/src/AppTask.cpp | 2 -- examples/lighting-app/genio/src/main.cpp | 2 -- examples/lock-app/genio/src/AppTask.cpp | 2 -- examples/lock-app/genio/src/main.cpp | 2 -- examples/ota-requestor-app/genio/src/AppTask.cpp | 2 -- examples/ota-requestor-app/genio/src/main.cpp | 2 -- .../silabs/efr32/rs911x/hal/efx32_ncp_host.c | 12 ++++-------- examples/platform/silabs/efr32/rs911x/hal/efx_spi.c | 5 +---- examples/thermostat/genio/src/main.cpp | 2 -- examples/tv-casting-app/linux/CastingUtils.cpp | 4 ++-- .../tv-casting-common/core/CastingPlayer.cpp | 2 +- .../tv-casting-common/src/CastingServer.cpp | 2 +- .../tv-casting-common/src/ZCLCallbacks.cpp | 4 ++-- src/app/app-platform/ContentAppPlatform.cpp | 9 ++++----- src/app/server/DefaultAclStorage.cpp | 2 +- src/app/util/types_stub.h | 6 ------ src/controller/tests/data_model/TestRead.cpp | 2 +- src/crypto/tests/TestChipCryptoPAL.cpp | 2 +- 26 files changed, 35 insertions(+), 69 deletions(-) diff --git a/examples/bridge-app/asr/subdevice/SubDeviceManager.cpp b/examples/bridge-app/asr/subdevice/SubDeviceManager.cpp index ab0f2ef3b707a1..9d4eda96e98438 100644 --- a/examples/bridge-app/asr/subdevice/SubDeviceManager.cpp +++ b/examples/bridge-app/asr/subdevice/SubDeviceManager.cpp @@ -91,12 +91,11 @@ CHIP_ERROR RemoveDeviceEndpoint(SubDevice * dev) { if (gSubDevices[index] == dev) { - EndpointId ep = emberAfClearDynamicEndpoint(index); - gSubDevices[index] = NULL; - ChipLogProgress(DeviceLayer, "Removed device %s from dynamic endpoint %d (index=%d)", dev->GetName(), ep, index); // Silence complaints about unused ep when progress logging // disabled. - UNUSED_VAR(ep); + [[maybe_unused]] EndpointId ep = emberAfClearDynamicEndpoint(index); + gSubDevices[index] = NULL; + ChipLogProgress(DeviceLayer, "Removed device %s from dynamic endpoint %d (index=%d)", dev->GetName(), ep, index); return CHIP_NO_ERROR; } } diff --git a/examples/bridge-app/esp32/main/main.cpp b/examples/bridge-app/esp32/main/main.cpp index 27cdb3c5e2dab5..07db2ba94a534f 100644 --- a/examples/bridge-app/esp32/main/main.cpp +++ b/examples/bridge-app/esp32/main/main.cpp @@ -201,12 +201,11 @@ CHIP_ERROR RemoveDeviceEndpoint(Device * dev) { if (gDevices[index] == dev) { - EndpointId ep = emberAfClearDynamicEndpoint(index); - gDevices[index] = NULL; - ChipLogProgress(DeviceLayer, "Removed device %s from dynamic endpoint %d (index=%d)", dev->GetName(), ep, index); // Silence complaints about unused ep when progress logging // disabled. - UNUSED_VAR(ep); + [[maybe_unused]] EndpointId ep = emberAfClearDynamicEndpoint(index); + gDevices[index] = NULL; + ChipLogProgress(DeviceLayer, "Removed device %s from dynamic endpoint %d (index=%d)", dev->GetName(), ep, index); return CHIP_NO_ERROR; } } diff --git a/examples/bridge-app/linux/main.cpp b/examples/bridge-app/linux/main.cpp index 80c8b17b7fbed5..c569e7c06e8b45 100644 --- a/examples/bridge-app/linux/main.cpp +++ b/examples/bridge-app/linux/main.cpp @@ -300,12 +300,11 @@ int RemoveDeviceEndpoint(Device * dev) { // Todo: Update this to schedule the work rather than use this lock DeviceLayer::StackLock lock; - EndpointId ep = emberAfClearDynamicEndpoint(index); - gDevices[index] = nullptr; - ChipLogProgress(DeviceLayer, "Removed device %s from dynamic endpoint %d (index=%d)", dev->GetName(), ep, index); // Silence complaints about unused ep when progress logging // disabled. - UNUSED_VAR(ep); + [[maybe_unused]] EndpointId ep = emberAfClearDynamicEndpoint(index); + gDevices[index] = nullptr; + ChipLogProgress(DeviceLayer, "Removed device %s from dynamic endpoint %d (index=%d)", dev->GetName(), ep, index); return index; } index++; diff --git a/examples/bridge-app/telink/src/AppTask.cpp b/examples/bridge-app/telink/src/AppTask.cpp index d21897bd2d36b6..72a997c91e9511 100644 --- a/examples/bridge-app/telink/src/AppTask.cpp +++ b/examples/bridge-app/telink/src/AppTask.cpp @@ -224,12 +224,11 @@ CHIP_ERROR RemoveDeviceEndpoint(Device * dev) { if (gDevices[index] == dev) { - EndpointId ep = emberAfClearDynamicEndpoint(index); - gDevices[index] = NULL; - ChipLogProgress(DeviceLayer, "Removed device %s from dynamic endpoint %d (index=%d)", dev->GetName(), ep, index); // Silence complaints about unused ep when progress logging // disabled. - UNUSED_VAR(ep); + [[maybe_unused]] EndpointId ep = emberAfClearDynamicEndpoint(index); + gDevices[index] = NULL; + ChipLogProgress(DeviceLayer, "Removed device %s from dynamic endpoint %d (index=%d)", dev->GetName(), ep, index); return CHIP_NO_ERROR; } } diff --git a/examples/chip-tool/commands/common/DeviceScanner.cpp b/examples/chip-tool/commands/common/DeviceScanner.cpp index 29d31c1fc80565..35d74bd06c844f 100644 --- a/examples/chip-tool/commands/common/DeviceScanner.cpp +++ b/examples/chip-tool/commands/common/DeviceScanner.cpp @@ -218,7 +218,7 @@ void DeviceScanner::Log() const auto resultsCount = mDiscoveredResults.size(); VerifyOrReturn(resultsCount > 0, ChipLogProgress(chipTool, "No device discovered.")); - uint16_t index = 0; + [[maybe_unused]] uint16_t index = 0; for (auto & instance : mDiscoveredResults) { ChipLogProgress(chipTool, "Instance Name: %s ", instance.first.c_str()); diff --git a/examples/chip-tool/commands/discover/DiscoverCommissionersCommand.cpp b/examples/chip-tool/commands/discover/DiscoverCommissionersCommand.cpp index 0d1c9a032de02c..57c7574c4ea2e3 100644 --- a/examples/chip-tool/commands/discover/DiscoverCommissionersCommand.cpp +++ b/examples/chip-tool/commands/discover/DiscoverCommissionersCommand.cpp @@ -29,7 +29,7 @@ CHIP_ERROR DiscoverCommissionersCommand::RunCommand() void DiscoverCommissionersCommand::Shutdown() { - int commissionerCount = 0; + [[maybe_unused]] int commissionerCount = 0; for (int i = 0; i < CHIP_DEVICE_CONFIG_MAX_DISCOVERED_NODES; i++) { const Dnssd::DiscoveredNodeData * commissioner = mCommissionableNodeController.GetDiscoveredCommissioner(i); diff --git a/examples/common/websocket-server/WebSocketServer.cpp b/examples/common/websocket-server/WebSocketServer.cpp index 623dda3dc47527..2dba035601ea0e 100644 --- a/examples/common/websocket-server/WebSocketServer.cpp +++ b/examples/common/websocket-server/WebSocketServer.cpp @@ -24,9 +24,9 @@ #include #include -constexpr uint16_t kDefaultWebSocketServerPort = 9002; -constexpr uint16_t kMaxMessageBufferLen = 8192; -constexpr char kWebSocketServerReadyMessage[] = "== WebSocket Server Ready"; +constexpr uint16_t kDefaultWebSocketServerPort = 9002; +constexpr uint16_t kMaxMessageBufferLen = 8192; +[[maybe_unused]] constexpr char kWebSocketServerReadyMessage[] = "== WebSocket Server Ready"; namespace { lws * gWebSocketInstance = nullptr; diff --git a/examples/light-switch-app/genio/src/main.cpp b/examples/light-switch-app/genio/src/main.cpp index 93bb82a21b0735..d545409c706913 100644 --- a/examples/light-switch-app/genio/src/main.cpp +++ b/examples/light-switch-app/genio/src/main.cpp @@ -51,8 +51,6 @@ using namespace ::chip; using namespace ::chip::Inet; using namespace ::chip::DeviceLayer; -#define UNUSED_PARAMETER(a) (a = a) - volatile int apperror_cnt; /*************************************************************************** diff --git a/examples/lighting-app/genio/src/AppTask.cpp b/examples/lighting-app/genio/src/AppTask.cpp index 6a121673a002a6..d948087833c4dd 100644 --- a/examples/lighting-app/genio/src/AppTask.cpp +++ b/examples/lighting-app/genio/src/AppTask.cpp @@ -66,8 +66,6 @@ #error "Must have portYIELD_FROM_ISR or portEND_SWITCHING_ISR" #endif -#define UNUSED_PARAMETER(a) (a = a) - #if defined(ENABLE_CHIP_SHELL) using chip::Shell::Engine; using chip::Shell::PrintCommandHelp; diff --git a/examples/lighting-app/genio/src/main.cpp b/examples/lighting-app/genio/src/main.cpp index ab578f3f2c75bd..22f654eb5f2f50 100644 --- a/examples/lighting-app/genio/src/main.cpp +++ b/examples/lighting-app/genio/src/main.cpp @@ -51,8 +51,6 @@ using namespace ::chip; using namespace ::chip::Inet; using namespace ::chip::DeviceLayer; -#define UNUSED_PARAMETER(a) (a = a) - volatile int apperror_cnt; /*************************************************************************** diff --git a/examples/lock-app/genio/src/AppTask.cpp b/examples/lock-app/genio/src/AppTask.cpp index 7a438dd4974d3d..1c2f0719790196 100644 --- a/examples/lock-app/genio/src/AppTask.cpp +++ b/examples/lock-app/genio/src/AppTask.cpp @@ -60,8 +60,6 @@ #error "Must have portYIELD_FROM_ISR or portEND_SWITCHING_ISR" #endif -#define UNUSED_PARAMETER(a) (a = a) - namespace { TimerHandle_t sFunctionTimer; // FreeRTOS app sw timer. diff --git a/examples/lock-app/genio/src/main.cpp b/examples/lock-app/genio/src/main.cpp index 416c81c53436d7..92b16a39663ee4 100644 --- a/examples/lock-app/genio/src/main.cpp +++ b/examples/lock-app/genio/src/main.cpp @@ -51,8 +51,6 @@ using namespace ::chip; using namespace ::chip::Inet; using namespace ::chip::DeviceLayer; -#define UNUSED_PARAMETER(a) (a = a) - volatile int apperror_cnt; /*************************************************************************** diff --git a/examples/ota-requestor-app/genio/src/AppTask.cpp b/examples/ota-requestor-app/genio/src/AppTask.cpp index 43c92cf26adeeb..50d1d080a5b7b4 100644 --- a/examples/ota-requestor-app/genio/src/AppTask.cpp +++ b/examples/ota-requestor-app/genio/src/AppTask.cpp @@ -53,8 +53,6 @@ #error "Must have portYIELD_FROM_ISR or portEND_SWITCHING_ISR" #endif -#define UNUSED_PARAMETER(a) (a = a) - namespace { TaskHandle_t sAppTaskHandle; diff --git a/examples/ota-requestor-app/genio/src/main.cpp b/examples/ota-requestor-app/genio/src/main.cpp index dcd85fbb920859..e3676c5c9eacbd 100644 --- a/examples/ota-requestor-app/genio/src/main.cpp +++ b/examples/ota-requestor-app/genio/src/main.cpp @@ -53,8 +53,6 @@ using namespace ::chip; using namespace ::chip::Inet; using namespace ::chip::DeviceLayer; -#define UNUSED_PARAMETER(a) (a = a) - volatile int apperror_cnt; static void OTAEventsHandler(const DeviceLayer::ChipDeviceEvent * event, intptr_t arg) diff --git a/examples/platform/silabs/efr32/rs911x/hal/efx32_ncp_host.c b/examples/platform/silabs/efr32/rs911x/hal/efx32_ncp_host.c index 82976deb6a3b09..9f07d3f8f22c16 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/efx32_ncp_host.c +++ b/examples/platform/silabs/efr32/rs911x/hal/efx32_ncp_host.c @@ -57,11 +57,9 @@ LDMA_TransferCfg_t ldmaRXConfig; static osSemaphoreId_t transfer_done_semaphore = NULL; -static bool dma_callback(unsigned int channel, unsigned int sequenceNo, void * userParam) +static bool dma_callback([[maybe_unused]] unsigned int channel, [[maybe_unused]] unsigned int sequenceNo, + [[maybe_unused]] void * userParam) { - UNUSED_PARAMETER(channel); - UNUSED_PARAMETER(sequenceNo); - UNUSED_PARAMETER(userParam); #if defined(SL_CATLOG_POWER_MANAGER_PRESENT) sl_power_manager_remove_em_requirement(SL_POWER_MANAGER_EM1); #endif @@ -69,10 +67,8 @@ static bool dma_callback(unsigned int channel, unsigned int sequenceNo, void * u return false; } -static void gpio_interrupt(uint8_t interrupt_number) +static void gpio_interrupt([[maybe_unused]] uint8_t interrupt_number) { - UNUSED_PARAMETER(interrupt_number); - if (NULL != init_config.rx_irq) { init_config.rx_irq(); @@ -312,4 +308,4 @@ void sl_si91x_host_disable_bus_interrupt(void) bool sl_si91x_host_is_in_irq_context(void) { return (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) != 0U; -} \ No newline at end of file +} diff --git a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c b/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c index ad6b5ed5e3418d..9097177b73a585 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c +++ b/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c @@ -171,10 +171,7 @@ void sl_wfx_host_reset_chip(void) vTaskDelay(pdMS_TO_TICKS(3)); } -void gpio_interrupt(uint8_t interrupt_number) -{ - UNUSED_PARAMETER(interrupt_number); -} +void gpio_interrupt([[maybe_unused]] uint8_t interrupt_number) {} /***************************************************************** * @fn void rsi_hal_board_init(void) diff --git a/examples/thermostat/genio/src/main.cpp b/examples/thermostat/genio/src/main.cpp index 93bb82a21b0735..d545409c706913 100644 --- a/examples/thermostat/genio/src/main.cpp +++ b/examples/thermostat/genio/src/main.cpp @@ -51,8 +51,6 @@ using namespace ::chip; using namespace ::chip::Inet; using namespace ::chip::DeviceLayer; -#define UNUSED_PARAMETER(a) (a = a) - volatile int apperror_cnt; /*************************************************************************** diff --git a/examples/tv-casting-app/linux/CastingUtils.cpp b/examples/tv-casting-app/linux/CastingUtils.cpp index 02b9467d884614..d4d71b5dd2c0ae 100644 --- a/examples/tv-casting-app/linux/CastingUtils.cpp +++ b/examples/tv-casting-app/linux/CastingUtils.cpp @@ -105,7 +105,7 @@ void InitCommissioningFlow(intptr_t commandArg) commissioner->LogDetail(); if (associatedConnectableVideoPlayer.HasValue()) { - TargetVideoPlayerInfo * targetVideoPlayerInfo = associatedConnectableVideoPlayer.Value(); + [[maybe_unused]] TargetVideoPlayerInfo * targetVideoPlayerInfo = associatedConnectableVideoPlayer.Value(); ChipLogProgress(AppServer, "Previously connected with nodeId 0x" ChipLogFormatX64 " fabricIndex: %d", ChipLogValueX64(targetVideoPlayerInfo->GetNodeId()), targetVideoPlayerInfo->GetFabricIndex()); } @@ -305,7 +305,7 @@ void PrintFabrics() ChipLogError(AppServer, " -- Not initialized"); continue; } - NodeId myNodeId = fb.GetNodeId(); + [[maybe_unused]] NodeId myNodeId = fb.GetNodeId(); ChipLogProgress(NotSpecified, "---- Current Fabric nodeId=0x" ChipLogFormatX64 " fabricId=0x" ChipLogFormatX64 " fabricIndex=%d", ChipLogValueX64(myNodeId), ChipLogValueX64(fb.GetFabricId()), fabricIndex); diff --git a/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.cpp b/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.cpp index 41d9feb52977eb..f34b6b2ef16c34 100644 --- a/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.cpp +++ b/examples/tv-casting-app/tv-casting-common/core/CastingPlayer.cpp @@ -257,7 +257,7 @@ void CastingPlayer::LogDetail() const { for (unsigned j = 0; j < mAttributes.numIPs; j++) { - char * ipAddressOut = mAttributes.ipAddresses[j].ToString(buf); + [[maybe_unused]] char * ipAddressOut = mAttributes.ipAddresses[j].ToString(buf); ChipLogDetail(AppServer, "\tIP Address #%d: %s", j + 1, ipAddressOut); } } diff --git a/examples/tv-casting-app/tv-casting-common/src/CastingServer.cpp b/examples/tv-casting-app/tv-casting-common/src/CastingServer.cpp index 98f6b197a59e33..a3de0a263c3efe 100644 --- a/examples/tv-casting-app/tv-casting-common/src/CastingServer.cpp +++ b/examples/tv-casting-app/tv-casting-common/src/CastingServer.cpp @@ -695,7 +695,7 @@ void CastingServer::SetDefaultFabricIndex(std::functionGetEndpointId(); - EndpointId ep = emberAfClearDynamicEndpoint(index); - mContentApps[index] = nullptr; - ChipLogProgress(DeviceLayer, "Removed device %d from dynamic endpoint %d (index=%d)", - app->GetApplicationBasicDelegate()->HandleGetVendorId(), ep, index); // Silence complaints about unused ep when progress logging // disabled. - UNUSED_VAR(ep); + /*[[maybe_unused]]*/ EndpointId ep = emberAfClearDynamicEndpoint(index); + mContentApps[index] = nullptr; + ChipLogProgress(DeviceLayer, "Removed device %d from dynamic endpoint %d (index=%d)", + app->GetApplicationBasicDelegate()->HandleGetVendorId(), ep, index); if (curEndpoint == mCurrentAppEndpointId) { mCurrentAppEndpointId = kNoCurrentEndpointId; diff --git a/src/app/server/DefaultAclStorage.cpp b/src/app/server/DefaultAclStorage.cpp index 58d0d18feedda6..6f40cce2599893 100644 --- a/src/app/server/DefaultAclStorage.cpp +++ b/src/app/server/DefaultAclStorage.cpp @@ -138,7 +138,7 @@ CHIP_ERROR DefaultAclStorage::Init(PersistentStorageDelegate & persistentStorage CHIP_ERROR err; - size_t count = 0; + [[maybe_unused]] size_t count = 0; for (auto it = first; it != last; ++it) { diff --git a/src/app/util/types_stub.h b/src/app/util/types_stub.h index ac26684f850cd7..dbd1ea184169e1 100644 --- a/src/app/util/types_stub.h +++ b/src/app/util/types_stub.h @@ -166,12 +166,6 @@ typedef struct } EmberEventControl; -/** - * @description Useful macro for avoiding compiler warnings related to unused - * function arguments or unused variables. - */ -#define UNUSED_VAR(x) (void) (x) - /** * @brief Returns the value of the bitmask \c bits within * the register or byte \c reg. diff --git a/src/controller/tests/data_model/TestRead.cpp b/src/controller/tests/data_model/TestRead.cpp index 917c3a1251e344..fc2cfaf516524b 100644 --- a/src/controller/tests/data_model/TestRead.cpp +++ b/src/controller/tests/data_model/TestRead.cpp @@ -475,7 +475,7 @@ void TestReadInteraction::TestReadSubscribeAttributeResponseWithCache(nlTestSuit // app::InteractionModelEngine::GetInstance()->RegisterReadHandlerAppCallback(&gTestReadInteraction); - int testId = 0; + [[maybe_unused]] int testId = 0; // Read of E2C3A1(dedup), E*C3A1(E1C3A1 not exit, E2C3A1 exist), E2C3A* (5 supported attributes) // Expect no versions would be cached. diff --git a/src/crypto/tests/TestChipCryptoPAL.cpp b/src/crypto/tests/TestChipCryptoPAL.cpp index b2e12568b7c222..db5ee6b74480cd 100644 --- a/src/crypto/tests/TestChipCryptoPAL.cpp +++ b/src/crypto/tests/TestChipCryptoPAL.cpp @@ -2715,7 +2715,7 @@ static void TestVIDPID_StringExtraction(nlTestSuite * inSuite, void * inContext) }; // clang-format on - int caseIdx = 0; + [[maybe_unused]] int caseIdx = 0; for (const auto & testCase : kTestCases) { AttestationCertVidPid vidpid; From 9aeff06a884f352de973192575a44524a7da6290 Mon Sep 17 00:00:00 2001 From: arun-silabs <141724790+arun-silabs@users.noreply.github.com> Date: Thu, 22 Feb 2024 00:15:42 +0530 Subject: [PATCH 08/29] [Silabs] [WiFi] Modified logs in which AP's password is printed. (#32166) * Modified logs in which AP's password is printed. * Restyled by clang-format --------- Co-authored-by: Restyled.io --- examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.c | 3 +-- examples/platform/silabs/SiWx917/SiWx917/wfx_rsi_host.c | 2 +- examples/platform/silabs/efr32/rs911x/rsi_if.c | 6 ++---- examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.c b/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.c index f78539d9817170..6dcfcfaf46aaac 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.c +++ b/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.c @@ -569,8 +569,7 @@ static sl_status_t wfx_rsi_do_join(void) } else { - SILABS_LOG("%s: WLAN: connecting to %s==%s, sec=%d", __func__, &wfx_rsi.sec.ssid[0], &wfx_rsi.sec.passkey[0], - wfx_rsi.sec.security); + SILABS_LOG("%s: WLAN: connecting to %s, sec=%d", __func__, &wfx_rsi.sec.ssid[0], wfx_rsi.sec.security); /* * Join the network diff --git a/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi_host.c b/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi_host.c index 8f1f895f9683f9..0c7efc723eb049 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi_host.c +++ b/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi_host.c @@ -178,7 +178,7 @@ sl_status_t wfx_connect_to_ap(void) { if (wfx_rsi.dev_state & WFX_RSI_ST_STA_PROVISIONED) { - SILABS_LOG("%s: connecting to access point -> SSID: %s, PSK:%s", __func__, &wfx_rsi.sec.ssid[0], &wfx_rsi.sec.passkey[0]); + SILABS_LOG("%s: connecting to access point -> SSID: %s", __func__, &wfx_rsi.sec.ssid[0]); xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_START_JOIN); } else diff --git a/examples/platform/silabs/efr32/rs911x/rsi_if.c b/examples/platform/silabs/efr32/rs911x/rsi_if.c index c43389761dcdfc..1ba06d0e715c16 100644 --- a/examples/platform/silabs/efr32/rs911x/rsi_if.c +++ b/examples/platform/silabs/efr32/rs911x/rsi_if.c @@ -466,8 +466,7 @@ static void wfx_rsi_save_ap_info() // translation break; } - SILABS_LOG("%s: WLAN: connecting to %s==%s, sec=%d, status=%02x", __func__, &wfx_rsi.sec.ssid[0], &wfx_rsi.sec.passkey[0], - wfx_rsi.sec.security, status); + SILABS_LOG("%s: WLAN: connecting to %s, sec=%d, status=%02x", __func__, &wfx_rsi.sec.ssid[0], wfx_rsi.sec.security, status); } /******************************************************************************************** @@ -511,8 +510,7 @@ static void wfx_rsi_do_join(void) return; } - SILABS_LOG("%s: WLAN: connecting to %s==%s, sec=%d", __func__, &wfx_rsi.sec.ssid[0], &wfx_rsi.sec.passkey[0], - wfx_rsi.sec.security); + SILABS_LOG("%s: WLAN: connecting to %s, sec=%d", __func__, &wfx_rsi.sec.ssid[0], wfx_rsi.sec.security); /* * Join the network diff --git a/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c b/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c index 331895bd3e524e..15915851c11a20 100644 --- a/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c +++ b/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c @@ -180,7 +180,7 @@ sl_status_t wfx_connect_to_ap(void) { if (wfx_rsi.dev_state & WFX_RSI_ST_STA_PROVISIONED) { - SILABS_LOG("%s: connecting to access point -> SSID: %s, PSK:%s", __func__, &wfx_rsi.sec.ssid[0], &wfx_rsi.sec.passkey[0]); + SILABS_LOG("%s: connecting to access point -> SSID: %s", __func__, &wfx_rsi.sec.ssid[0]); xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_START_JOIN); } else From 4158d55db3f936b58cc944d10fd538a8585144f3 Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Thu, 22 Feb 2024 08:52:08 +0900 Subject: [PATCH 09/29] Add excetpion try-catch in getConnectedPointer (#32237) --- .../clusterclient/BasicClientFragment.kt | 16 ++++- .../clusterclient/GroupSettingFragment.kt | 72 ++++++++++++------- .../clusterclient/MultiAdminClientFragment.kt | 44 +++++++++--- .../clusterclient/OnOffClientFragment.kt | 48 ++++++++++--- .../clusterclient/OpCredClientFragment.kt | 16 ++++- .../OtaProviderClientFragment.kt | 56 ++++++++++++--- .../clusterclient/SensorClientFragment.kt | 16 ++++- .../clusterclient/WildcardFragment.kt | 46 ++++++++++-- .../ClusterDetailFragment.kt | 10 ++- .../ClusterInteractionFragment.kt | 9 ++- 10 files changed, 269 insertions(+), 64 deletions(-) diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/BasicClientFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/BasicClientFragment.kt index f38cacbd259073..3ef61298930268 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/BasicClientFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/BasicClientFragment.kt @@ -139,7 +139,13 @@ class BasicClientFragment : Fragment() { val attributeId = BasicInformation.Attribute.valueOf(attributeName).id val devicePtr = - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } ChipClient.getDeviceController(requireContext()) .readPath( @@ -182,7 +188,13 @@ class BasicClientFragment : Fragment() { private suspend fun sendWriteAttribute(attribute: BasicInformation.Attribute, tlv: ByteArray) { val clusterId = BasicInformation.ID val devicePtr = - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } ChipClient.getDeviceController(requireContext()) .write( diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/GroupSettingFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/GroupSettingFragment.kt index 8943801c080c80..bbaacbd3c997ba 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/GroupSettingFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/GroupSettingFragment.kt @@ -271,11 +271,16 @@ class GroupSettingFragment : Fragment() { private suspend fun sendKeySetWrite( groupKeySetStruct: GroupKeyManagementClusterGroupKeySetStruct ) { - val cluster = - ChipClusters.GroupKeyManagementCluster( - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), - 0 - ) + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + val cluster = ChipClusters.GroupKeyManagementCluster(devicePtr, 0) + cluster.keySetWrite( object : ChipClusters.DefaultClusterCallback { override fun onError(e: Exception?) { @@ -311,11 +316,15 @@ class GroupSettingFragment : Fragment() { } private suspend fun writeGroupKeyMap(groupId: UInt, groupKeySetId: UInt) { - val cluster = - ChipClusters.GroupKeyManagementCluster( - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), - 0 - ) + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + val cluster = ChipClusters.GroupKeyManagementCluster(devicePtr, 0) cluster.writeGroupKeyMapAttribute( object : ChipClusters.DefaultClusterCallback { override fun onError(e: Exception?) { @@ -356,11 +365,16 @@ class GroupSettingFragment : Fragment() { } private suspend fun sendAddGroup(groupId: UInt, groupName: String) { - val cluster = - ChipClusters.GroupsCluster( - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), - 0 - ) + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + val cluster = ChipClusters.GroupsCluster(devicePtr, 0) + cluster.addGroup( object : ChipClusters.GroupsCluster.AddGroupResponseCallback { override fun onError(e: Exception?) { @@ -379,11 +393,15 @@ class GroupSettingFragment : Fragment() { } private suspend fun readAccessControl() { - val cluster = - ChipClusters.AccessControlCluster( - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), - 0 - ) + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + val cluster = ChipClusters.AccessControlCluster(devicePtr, 0) cluster.readAclAttribute( object : ChipClusters.AccessControlCluster.AclAttributeCallback { override fun onError(e: Exception?) { @@ -437,12 +455,16 @@ class GroupSettingFragment : Fragment() { groupId: UInt, privilege: UInt ) { + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } // If GroupID is already added to AccessControl, do not add it. - val cluster = - ChipClusters.AccessControlCluster( - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), - 0 - ) + val cluster = ChipClusters.AccessControlCluster(devicePtr, 0) val sendEntry = ArrayList() for (entry in value) { if ( diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/MultiAdminClientFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/MultiAdminClientFragment.kt index a82f0ee60ccf35..08443d6ffb4ffc 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/MultiAdminClientFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/MultiAdminClientFragment.kt @@ -121,8 +121,16 @@ class MultiAdminClientFragment : Fragment() { private suspend fun sendBasicCommissioningCommandClick() { val testDuration = binding.timeoutEd.text.toString().toInt() + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } deviceController.openPairingWindowCallback( - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), + devicePtr, testDuration, object : OpenCommissioningCallback { override fun onError(status: Int, deviceId: Long) { @@ -140,7 +148,13 @@ class MultiAdminClientFragment : Fragment() { val testDuration = binding.timeoutEd.text.toString().toInt() val testIteration = 1000 val devicePointer = - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } var setupPinCode: Long? = null if (!binding.setupPinCodeEd.text.toString().isEmpty()) { @@ -181,6 +195,14 @@ class MultiAdminClientFragment : Fragment() { null ) + val devicePointer = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } deviceController.invoke( object : InvokeCallback { override fun onError(ex: Exception?) { @@ -193,7 +215,7 @@ class MultiAdminClientFragment : Fragment() { showMessage("Revoke Commissioning success") } }, - getConnectedDevicePointer(), + devicePointer, invokeElement, timedInvokeTimeout, 0 @@ -208,6 +230,16 @@ class MultiAdminClientFragment : Fragment() { val attributeId = attribute.id val attributeName = attribute.name val attributePath = ChipAttributePath.newInstance(endpointId, clusterId, attributeId) + + val devicePointer = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + deviceController.readAttributePath( object : ReportCallback { override fun onReport(nodeState: NodeState?) { @@ -230,16 +262,12 @@ class MultiAdminClientFragment : Fragment() { showMessage("read $attributeName - error : ${e?.message}") } }, - getConnectedDevicePointer(), + devicePointer, listOf(attributePath), 0 ) } - private suspend fun getConnectedDevicePointer(): Long { - return ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) - } - private fun showMessage(msg: String) { requireActivity().runOnUiThread { binding.multiAdminClusterCommandStatus.text = msg } } diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OnOffClientFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OnOffClientFragment.kt index 7994deb2f07a13..d4b55194147fca 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OnOffClientFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OnOffClientFragment.kt @@ -105,6 +105,15 @@ class OnOffClientFragment : Fragment() { val attributePath = ChipAttributePath.newInstance(endpointId, clusterId, attributeId) + val devicePointer = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + ChipClient.getDeviceController(requireContext()) .readPath( object : ReportCallback { @@ -128,7 +137,7 @@ class OnOffClientFragment : Fragment() { showMessage("On/Off attribute value: $value") } }, - getConnectedDevicePointer(), + devicePointer, listOf(attributePath), null, false, @@ -181,6 +190,15 @@ class OnOffClientFragment : Fragment() { ) } + val devicePointer = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + deviceController.subscribeToPath( subscriptionEstablishedCallback, resubscriptionAttemptCallback, @@ -211,7 +229,7 @@ class OnOffClientFragment : Fragment() { showReportMessage(message) } }, - getConnectedDevicePointer(), + devicePointer, listOf(attributePath), null, minInterval, @@ -265,6 +283,15 @@ class OnOffClientFragment : Fragment() { null ) + val devicePointer = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + deviceController.invoke( object : InvokeCallback { override fun onError(ex: Exception?) { @@ -277,7 +304,7 @@ class OnOffClientFragment : Fragment() { showMessage("MoveToLevel command success") } }, - getConnectedDevicePointer(), + devicePointer, invokeElement, 0, 0 @@ -298,6 +325,15 @@ class OnOffClientFragment : Fragment() { null ) + val devicePointer = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + deviceController.invoke( object : InvokeCallback { override fun onError(ex: Exception?) { @@ -310,17 +346,13 @@ class OnOffClientFragment : Fragment() { showMessage("${commandId.name} command success") } }, - getConnectedDevicePointer(), + devicePointer, invokeElement, 0, 0 ) } - private suspend fun getConnectedDevicePointer(): Long { - return ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) - } - private fun showMessage(msg: String) { requireActivity().runOnUiThread { binding.commandStatusTv.text = msg } } diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OpCredClientFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OpCredClientFragment.kt index 0314f9d82e652c..1fd8db6c97a13b 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OpCredClientFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OpCredClientFragment.kt @@ -100,7 +100,13 @@ class OpCredClientFragment : Fragment() { val attributeId = attribute.id val devicePtr = - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } ChipClient.getDeviceController(requireContext()) .readPath( @@ -137,7 +143,13 @@ class OpCredClientFragment : Fragment() { private suspend fun sendRemoveFabricsBtnClick(fabricIndex: UInt) { val devicePtr = - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } // TODO : Need to be implement poj-to-tlv val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OtaProviderClientFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OtaProviderClientFragment.kt index c27159193ed2dc..5d2d62ee76a690 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OtaProviderClientFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/OtaProviderClientFragment.kt @@ -114,6 +114,14 @@ class OtaProviderClientFragment : Fragment() { val attributeId = ClusterIDMapping.AccessControl.Attribute.Acl.id val attributePath = ChipAttributePath.newInstance(endpointId, clusterId, attributeId) + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } deviceController.readAttributePath( object : ReportCallback { override fun onError( @@ -136,7 +144,7 @@ class OtaProviderClientFragment : Fragment() { requireActivity().runOnUiThread { showAddAccessControlDialog(tlv) } } }, - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), + devicePtr, listOf(attributePath), 0 ) @@ -217,6 +225,15 @@ class OtaProviderClientFragment : Fragment() { newEntry.toTlv(AnonymousTag, tlvWriter) tlvWriter.endArray() + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + deviceController.write( object : WriteAttributesCallback { override fun onError(attributePath: ChipAttributePath?, e: Exception?) { @@ -229,7 +246,7 @@ class OtaProviderClientFragment : Fragment() { showMessage("$attributePath : Write response: $status") } }, - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), + devicePtr, listOf( AttributeWriteRequest.newInstance( 0, @@ -249,6 +266,14 @@ class OtaProviderClientFragment : Fragment() { val clusterId = ClusterIDMapping.OtaSoftwareUpdateRequestor.ID val attributeId = attribute.id val path = ChipAttributePath.newInstance(endpointId, clusterId, attributeId) + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } deviceController.readAttributePath( object : ReportCallback { override fun onError( @@ -279,7 +304,7 @@ class OtaProviderClientFragment : Fragment() { showMessage("OtaSoftwareUpdateRequestor ${attribute.name} value: $value") } }, - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), + devicePtr, listOf(path), 0 ) @@ -344,6 +369,15 @@ class OtaProviderClientFragment : Fragment() { val writeRequest = AttributeWriteRequest.newInstance(endpoint, clusterId, attributeId, tlv) + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + deviceController.write( object : WriteAttributesCallback { override fun onError(attributePath: ChipAttributePath?, e: Exception?) { @@ -356,7 +390,7 @@ class OtaProviderClientFragment : Fragment() { showMessage("$attributePath : Write response: $status") } }, - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), + devicePtr, listOf(writeRequest), 0, 0 @@ -461,11 +495,17 @@ class OtaProviderClientFragment : Fragment() { private suspend fun sendAnnounceOTAProviderBtnClick() { requireActivity().runOnUiThread { updateOTAStatusBtnClick() } + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return + } + val otaRequestCluster = - ChipClusters.OtaSoftwareUpdateRequestorCluster( - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), - OTA_REQUESTER_ENDPOINT_ID - ) + ChipClusters.OtaSoftwareUpdateRequestorCluster(devicePtr, OTA_REQUESTER_ENDPOINT_ID) otaRequestCluster.announceOTAProvider( object : DefaultClusterCallback { override fun onSuccess() { diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/SensorClientFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/SensorClientFragment.kt index cad12a5a54bc98..88d9ed63c4f91e 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/SensorClientFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/SensorClientFragment.kt @@ -155,7 +155,13 @@ class SensorClientFragment : Fragment() { val clusterName = binding.clusterNameSpinner.selectedItem.toString() val clusterId = CLUSTERS[clusterName]!!["clusterId"] as Long val attributeId = CLUSTERS[clusterName]!!["attributeId"] as Long - val device = ChipClient.getConnectedDevicePointer(requireContext(), deviceId) + val device = + try { + ChipClient.getConnectedDevicePointer(requireContext(), deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + return + } val callback = makeReadCallback(clusterName, false) deviceController.readAttributePath( @@ -177,7 +183,13 @@ class SensorClientFragment : Fragment() { val clusterName = binding.clusterNameSpinner.selectedItem.toString() val clusterId = CLUSTERS[clusterName]!!["clusterId"] as Long val attributeId = CLUSTERS[clusterName]!!["attributeId"] as Long - val device = ChipClient.getConnectedDevicePointer(requireContext(), deviceId) + val device = + try { + ChipClient.getConnectedDevicePointer(requireContext(), deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + return + } val callback = makeReadCallback(clusterName, true) deviceController.subscribeToAttributePath( diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt index af119581a7047f..5b49a6d9ab05ab 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt @@ -270,12 +270,18 @@ class WildcardFragment : Fragment() { "ResubscriptionAttempt terminationCause:$terminationCause, nextResubscribeIntervalMsec:$nextResubscribeIntervalMsec" ) } - + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + return + } deviceController.subscribeToPath( subscriptionEstablishedCallback, resubscriptionAttemptCallback, reportCallback, - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), + devicePtr, attributePath.ifEmpty { null }, eventPath.ifEmpty { null }, minInterval, @@ -288,9 +294,16 @@ class WildcardFragment : Fragment() { } private suspend fun read(isFabricFiltered: Boolean, eventMin: Long?) { + val devicePtr = + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + return + } deviceController.readPath( reportCallback, - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId), + devicePtr, attributePath.ifEmpty { null }, eventPath.ifEmpty { null }, isFabricFiltered, @@ -351,10 +364,16 @@ class WildcardFragment : Fragment() { version ) } - + val devicePtr = + try { + addressUpdateFragment.getDevicePointer(requireContext()) + } catch (e: IllegalStateException) { + Log.d(TAG, "getDevicePointer exception", e) + return + } deviceController.write( writeAttributeCallback, - addressUpdateFragment.getDevicePointer(requireContext()), + devicePtr, listOf(writeRequest), timedRequestTimeoutMs, imTimeoutMs @@ -379,9 +398,16 @@ class WildcardFragment : Fragment() { } else { InvokeElement.newInstance(endpointId, clusterId, commandId, null, jsonString) } + val devicePtr = + try { + addressUpdateFragment.getDevicePointer(requireContext()) + } catch (e: IllegalStateException) { + Log.d(TAG, "getDevicePointer exception", e) + return + } deviceController.invoke( invokeCallback, - addressUpdateFragment.getDevicePointer(requireContext()), + devicePtr, invokeElement, timedRequestTimeoutMs, imTimeoutMs @@ -555,7 +581,13 @@ class WildcardFragment : Fragment() { val clusterId = 62L // OperationalCredentials val attributeId = 5L // CurrentFabricIndex val deviceId = addressUpdateFragment.deviceId - val devicePointer = ChipClient.getConnectedDevicePointer(context, deviceId) + val devicePointer = + try { + ChipClient.getConnectedDevicePointer(context, deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + return 0U + } return suspendCoroutine { cont -> deviceController.readAttributePath( object : ReportCallback { diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt index eb14eee23770bd..09270003a41a5e 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterDetailFragment.kt @@ -67,7 +67,15 @@ class ClusterDetailFragment : Fragment() { _binding = ClusterDetailFragmentBinding.inflate(inflater, container, false) scope = viewLifecycleOwner.lifecycleScope deviceId = checkNotNull(requireArguments().getLong(DEVICE_ID)) - scope.launch { devicePtr = getConnectedDevicePointer(requireContext(), deviceId) } + scope.launch { + try { + devicePtr = getConnectedDevicePointer(requireContext(), deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("Get DevicePointer fail!") + return@launch + } + } endpointId = checkNotNull(requireArguments().getInt(ENDPOINT_ID_KEY)) historyCommand = requireArguments().getSerializable(HISTORY_COMMAND) as HistoryCommand? deviceController.setCompletionListener(GenericChipDeviceListener()) diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterInteractionFragment.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterInteractionFragment.kt index d723a93b674f7f..8847da71b87271 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterInteractionFragment.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/ClusterInteractionFragment.kt @@ -1,6 +1,7 @@ package com.google.chip.chiptool.clusterclient.clusterinteraction import android.os.Bundle +import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -45,7 +46,13 @@ class ClusterInteractionFragment : Fragment() { binding.getEndpointListBtn.setOnClickListener { scope.launch { devicePtr = - ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + try { + ChipClient.getConnectedDevicePointer(requireContext(), addressUpdateFragment.deviceId) + } catch (e: IllegalStateException) { + Log.d(TAG, "getConnectedDevicePointer exception", e) + showMessage("getConnectedDevicePointer fail!") + return@launch + } showMessage("Retrieving endpoints") binding.endpointList.visibility = View.VISIBLE } From c4927d453ae7d1c63c44dc3f2acc6f67f7bed539 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 21 Feb 2024 22:23:08 -0500 Subject: [PATCH 10/29] Pull in EventLogging into src/app:app (#32230) * Pull in EventLogging into src/app:app * Fix typo * Restyle --------- Co-authored-by: Andrei Litvin --- .github/workflows/lint.yml | 2 -- src/app/BUILD.gn | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d811fe05fa888f..66405b9e615b6d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -100,8 +100,6 @@ jobs: --known-failure app/CompatEnumNames.h \ --known-failure app/data-model/ListLargeSystemExtensions.h \ --known-failure app/EventHeader.h \ - --known-failure app/EventLoggingDelegate.h \ - --known-failure app/EventLogging.h \ --known-failure app/EventLoggingTypes.h \ --known-failure app/InteractionModelHelper.h \ --known-failure app/ReadClient.h \ diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index 3dfbbbffe56daf..ec520e005b0d80 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -233,6 +233,8 @@ static_library("app") { "DefaultAttributePersistenceProvider.h", "DeferredAttributePersistenceProvider.cpp", "DeferredAttributePersistenceProvider.h", + "EventLogging.h", + "EventLoggingDelegate.h", "EventManagement.cpp", "EventManagement.h", "FailSafeContext.cpp", From 8fbe0a71deb96ade73282558a583386b80dbcd5a Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Thu, 22 Feb 2024 04:24:44 +0100 Subject: [PATCH 11/29] [CI] Add --trace_decode supports when starting an accessory from a YAML test (#32221) --- .../pseudo_clusters/clusters/accessory_server_bridge.py | 3 +++ .../pseudo_clusters/clusters/system_commands.py | 1 + 2 files changed, 4 insertions(+) diff --git a/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/accessory_server_bridge.py b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/accessory_server_bridge.py index a8991deb9b7870..15ebdf46428830 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/accessory_server_bridge.py +++ b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/accessory_server_bridge.py @@ -77,6 +77,9 @@ def _get_start_options(request): elif name == 'crashLogPath': options.append('--crash_log') options.append(str(value)) + elif name == 'traceDecode': + options.append('--trace_decode') + options.append(str(value)) elif name == 'registerKey': pass else: diff --git a/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/system_commands.py b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/system_commands.py index 77028c39d72a9a..92bab169f7e0c6 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/system_commands.py +++ b/scripts/py_matter_yamltests/matter_yamltests/pseudo_clusters/clusters/system_commands.py @@ -33,6 +33,7 @@ + From 5634f0622b9c96f8c7dca10584085b20f86c1323 Mon Sep 17 00:00:00 2001 From: doru91 Date: Thu, 22 Feb 2024 16:26:50 +0200 Subject: [PATCH 12/29] Enable LIT for NXP K32W0/K32W1 platforms (#32258) * [nxp][k32w0][k32w1][comtact-sensor] update zap file Boolean state cluster * enable missing mandatory attributes (EventList) General commissioning cluster * enable missing mandatory attributes (GeneratedCommandList, AcceptedCommandList, EventList, AttributeList, FeatureMap) Basic Information Cluster * enable missing mandatory attributes (GeneratedCommandList, AcceptedCommandList, EventList, AttributeList) General Diagnostics Cluster * enable mandatory attributes introduced in Matter 1.3 (UpTime, TimeSnapshot, TimeSnapshotResponse) * enable missing mandatory attributes (GeneratedCommandList, AcceptedCommandList, EventList, AttributeList) Network Commissioning Cluster * enable optional attributes introduced in Matter 1.3 (SupportedThreadFeatures, ThreadVersion) * update cluster revision * enable missing mandatory attributes (GeneratedCommandList, AcceptedCommandList, EventList, AttributeList) Thread Network Diagnostics: * update cluster revision Access Control * enable missing mandatory attributes (GeneratedCommandList, AcceptedCommandList, EventList, AttributeList) Signed-off-by: Doru Gucea * [nxp][k32w0][k32w1][contact-sensor] Refactor files for LIT enablement * examples/contact-sensor-app/nxp/zap was renamed to examples/contact-sensor-app/nxp/zap-sit * created a new set of zap files for lit: examples/contact-sensor-app/nxp/zap-lit * moved icd common defines to nxp_sdk.gni * fixed naming around icd parameters * added lit application code (see READMEs for detailed instructions) Signed-off-by: Doru Gucea * [nxp][k32w1] update software version allow configuration of CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING/ CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION through gn arguments. Signed-off-by: Doru Gucea * [nxp][k32w0][k32w1] fix restyle and readme Signed-off-by: Doru Gucea --------- Signed-off-by: Doru Gucea --- .../nxp/k32w/k32w0/BUILD.gn | 15 +- .../nxp/k32w/k32w0/README.md | 42 + .../nxp/k32w/k32w0/args.gni | 2 + .../nxp/k32w/k32w0/main/AppTask.cpp | 57 +- .../nxp/k32w/k32w0/main/include/AppTask.h | 4 + .../nxp/k32w/k32w0/main/include/app_config.h | 1 + .../nxp/k32w/k32w1/BUILD.gn | 13 +- .../nxp/k32w/k32w1/README.md | 54 +- .../nxp/k32w/k32w1/args.gni | 2 + .../k32w/k32w1/include/CHIPProjectConfig.h | 4 +- .../nxp/k32w/k32w1/main/AppTask.cpp | 43 + .../nxp/k32w/k32w1/main/include/AppTask.h | 4 + .../nxp/k32w/k32w1/main/include/app_config.h | 1 + .../nxp/{zap => zap-lit}/BUILD.gn | 2 +- .../nxp/zap-lit/contact-sensor-app.matter | 1687 +++++++ .../nxp/zap-lit/contact-sensor-app.zap | 4161 +++++++++++++++++ .../contact-sensor-app/nxp/zap-sit/BUILD.gn | 25 + .../contact-sensor-app.matter | 33 +- .../{zap => zap-sit}/contact-sensor-app.zap | 475 +- .../k32w/k32w1/include/CHIPProjectConfig.h | 4 +- .../nxp/k32w/k32w0/CHIPPlatformConfig.h | 4 +- .../nxp/k32w/k32w1/CHIPPlatformConfig.h | 4 +- third_party/nxp/k32w0_sdk/k32w0_sdk.gni | 25 +- third_party/nxp/k32w1_sdk/k32w1_sdk.gni | 26 +- third_party/nxp/nxp_sdk.gni | 11 +- 25 files changed, 6636 insertions(+), 63 deletions(-) rename examples/contact-sensor-app/nxp/{zap => zap-lit}/BUILD.gn (96%) create mode 100644 examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter create mode 100644 examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.zap create mode 100644 examples/contact-sensor-app/nxp/zap-sit/BUILD.gn rename examples/contact-sensor-app/nxp/{zap => zap-sit}/contact-sensor-app.matter (97%) rename examples/contact-sensor-app/nxp/{zap => zap-sit}/contact-sensor-app.zap (88%) diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn b/examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn index cc87b4fc1532d6..c9b50a84ceb770 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/BUILD.gn @@ -19,6 +19,7 @@ import("//build_overrides/openthread.gni") import("${k32w0_sdk_build_root}/k32w0_executable.gni") import("${k32w0_sdk_build_root}/k32w0_sdk.gni") +import("${chip_root}/src/app/icd/icd.gni") import("${chip_root}/src/crypto/crypto.gni") import("${chip_root}/src/lib/core/core.gni") import("${chip_root}/src/platform/device.gni") @@ -75,6 +76,8 @@ k32w0_sdk("sdk") { k32w0_executable("contact_sensor_app") { output_name = "chip-k32w0x-contact-example" + defines = [] + sources = [ "${k32w0_platform_dir}/util/LEDWidget.cpp", "${k32w0_platform_dir}/util/include/LEDWidget.h", @@ -93,13 +96,12 @@ k32w0_executable("contact_sensor_app") { "${k32w0_platform_dir}/common/CustomFactoryDataProvider.h", ] - defines = [ "CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER=1" ] + defines += [ "CHIP_DEVICE_CONFIG_USE_CUSTOM_PROVIDER=1" ] } deps = [ ":sdk", "${chip_root}/examples/common/QRCode", - "${chip_root}/examples/contact-sensor-app/contact-sensor-common", "${chip_root}/examples/providers:device_info_provider", "${chip_root}/src/lib", "${chip_root}/src/platform:syscalls_stub", @@ -119,6 +121,15 @@ k32w0_executable("contact_sensor_app") { ] } + #lit and sit are using different zap files + if (chip_enable_icd_lit) { + deps += [ "${chip_root}/examples/contact-sensor-app/nxp/zap-lit/" ] + + defines += [ "CHIP_ENABLE_LIT=1" ] + } else { + deps += [ "${chip_root}/examples/contact-sensor-app/nxp/zap-sit/" ] + } + cflags = [ "-Wconversion" ] output_dir = root_out_dir diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/README.md b/examples/contact-sensor-app/nxp/k32w/k32w0/README.md index 27ae15b672eb05..c325895886a093 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/README.md +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/README.md @@ -22,6 +22,7 @@ network. - [Building](#building) - [Overwrite board config files](#overwrite-board-config-files) - [Known issues building](#known-issues-building) +- [Long Idle Time ICD Support](#long-idle-time-icd-support) - [Manufacturing data](#manufacturing-data) - [Flashing and debugging](#flashing-and-debugging) - [Pigweed Tokenizer](#pigweed-tokenizer) @@ -95,6 +96,11 @@ be discoverable over Bluetooth LE. For security reasons, you must start Bluetooth LE advertising manually after powering up the device by pressing Button USERINTERFACE. +## LIT ICD Active Mode + +If the device is acting as a LIT ICD and it's already commissioned, then Button +USERINTERFACE can be pressed for forcing the switch to Active Mode. + ### Bluetooth LE Rendezvous In this example, the commissioning procedure (called rendezvous) is done over @@ -258,6 +264,42 @@ pycryptodome 3.9.8 The resulting output file can be found in out/debug/chip-k32w0x-contact-example. +## Long Idle Time ICD Support + +By default, contact-sensor is compiled as SIT ICD (Short Idle Time +Intermittently Connected Device) - see rules from k32w0_sdk.gni: + +``` +chip_ot_idle_interval_ms = 2000 # 2s Idle Intervals +chip_ot_active_interval_ms = 500 # 500ms Active Intervals + +nxp_idle_mode_duration_s = 600 # 10min Idle Mode Interval +nxp_active_mode_duration_ms = 10000 # 10s Active Mode Interval +nxp_active_mode_threshold_ms = 1000 # 1s Active Mode Threshold +nxp_icd_supported_clients_per_fabric = 2 # 2 registration slots per fabric +``` + +If LIT ICD support is needed then `chip_enable_icd_lit=true` must be specified +as gn argument and the above parameters can be modified to comply with LIT +requirements (e.g.: LIT devices must configure +`chip_ot_idle_interval_ms > 15000`). Example LIT configuration: + +``` +chip_ot_idle_interval_ms = 15000 # 15s Idle Intervals +chip_ot_active_interval_ms = 500 # 500ms Active Intervals + +nxp_idle_mode_duration_s = 3600 # 60min Idle Mode Interval +nxp_active_mode_duration_ms = 0 # 0 Active Mode Interval +nxp_active_mode_threshold_ms = 30000 # 30s Active Mode Threshold +``` + +ICD parameters that may be disabled once LIT functionality is enabled: + +``` +chip_persist_subscriptions: try to re-establish subscriptions from the server side after reboot +chip_subscription_timeout_resumption: same as above but retries are using a Fibonacci backoff +``` + ### Overwrite board config files The example uses template/reference board configuration files. diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/args.gni b/examples/contact-sensor-app/nxp/k32w/k32w0/args.gni index 02a388daab9e1a..6e931d00452fcd 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/args.gni +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/args.gni @@ -24,5 +24,7 @@ chip_stack_lock_tracking = "fatal" chip_enable_ble = true chip_enable_icd_server = true +chip_enable_icd_lit = false +icd_enforce_sit_slow_poll_limit = true chip_persist_subscriptions = true chip_subscription_timeout_resumption = true diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp index a46ea5db28df64..17aea9d5897907 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -71,6 +71,9 @@ static LEDWidget sContactSensorLED; static bool sIsThreadProvisioned = false; static bool sHaveBLEConnections = false; +#if CHIP_ENABLE_LIT +static bool sIsDeviceCommissioned = false; +#endif static uint32_t eventMask = 0; @@ -448,6 +451,12 @@ void AppTask::ButtonEventHandler(uint8_t pin_no, uint8_t button_action) { button_event.Handler = ResetActionEventHandler; } +#endif +#if CHIP_ENABLE_LIT + if (button_action == USER_ACTIVE_MODE_TRIGGER_PUSH) + { + button_event.Handler = UserActiveModeHandler; + } #endif } @@ -486,6 +495,16 @@ void AppTask::HandleKeyboard(void) #if (defined OM15082) ButtonEventHandler(RESET_BUTTON, RESET_BUTTON_PUSH); break; +#elif CHIP_ENABLE_LIT + if (sIsDeviceCommissioned) + { + ButtonEventHandler(BLE_BUTTON, USER_ACTIVE_MODE_TRIGGER_PUSH); + } + else + { + ButtonEventHandler(BLE_BUTTON, BLE_BUTTON_PUSH); + } + break; #else ButtonEventHandler(BLE_BUTTON, BLE_BUTTON_PUSH); break; @@ -497,7 +516,15 @@ void AppTask::HandleKeyboard(void) ButtonEventHandler(OTA_BUTTON, OTA_BUTTON_PUSH); break; case gKBD_EventPB4_c: - ButtonEventHandler(BLE_BUTTON, BLE_BUTTON_PUSH); +#if CHIP_ENABLE_LIT + if (sIsDeviceCommissioned) + { + ButtonEventHandler(BLE_BUTTON, USER_ACTIVE_MODE_TRIGGER_PUSH); + } + else +#endif + + ButtonEventHandler(BLE_BUTTON, BLE_BUTTON_PUSH); break; #if !(defined OM15082) case gKBD_EventLongPB1_c: @@ -694,6 +721,28 @@ void AppTask::BleStartAdvertising(intptr_t arg) } } +#if CHIP_ENABLE_LIT +void AppTask::UserActiveModeHandler(void * aGenericEvent) +{ + AppEvent * aEvent = (AppEvent *) aGenericEvent; + + if (aEvent->ButtonEvent.PinNo != BLE_BUTTON) + return; + + if (sAppTask.mFunction != Function::kNoneSelected) + { + K32W_LOG("Another function is scheduled. Could not request ICD Active Mode!"); + return; + } + PlatformMgr().ScheduleWork(AppTask::UserActiveModeTrigger, 0); +} + +void AppTask::UserActiveModeTrigger(intptr_t arg) +{ + ICDNotifier::GetInstance().NotifyNetworkActivityNotification(); +} +#endif + void AppTask::MatterEventHandler(const ChipDeviceEvent * event, intptr_t) { if (event->Type == DeviceEventType::kServiceProvisioningChange && event->ServiceProvisioningChange.IsServiceProvisioned) @@ -707,6 +756,12 @@ void AppTask::MatterEventHandler(const ChipDeviceEvent * event, intptr_t) sIsThreadProvisioned = FALSE; } } +#if CHIP_ENABLE_LIT + else if (event->Type == DeviceEventType::kCommissioningComplete) + { + sIsDeviceCommissioned = TRUE; + } +#endif #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR if (event->Type == DeviceEventType::kDnssdInitialized) diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/main/include/AppTask.h b/examples/contact-sensor-app/nxp/k32w/k32w0/main/include/AppTask.h index 867a496de1e56d..c3203d78eb543e 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/main/include/AppTask.h +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/main/include/AppTask.h @@ -85,6 +85,10 @@ class AppTask static void ContactActionEventHandler(void * aGenericEvent); static void ResetActionEventHandler(void * aGenericEvent); static void InstallEventHandler(void * aGenericEvent); +#if CHIP_ENABLE_LIT + static void UserActiveModeHandler(void * aGenericEvent); + static void UserActiveModeTrigger(intptr_t arg); +#endif static void ButtonEventHandler(uint8_t pin_no, uint8_t button_action); static void TimerEventHandler(TimerHandle_t xTimer); diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/main/include/app_config.h b/examples/contact-sensor-app/nxp/k32w/k32w0/main/include/app_config.h index 5343e1e56a3af9..61b9866055c1b5 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/main/include/app_config.h +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/main/include/app_config.h @@ -31,6 +31,7 @@ #define CONTACT_SENSOR_BUTTON_PUSH 2 #define OTA_BUTTON_PUSH 3 #define BLE_BUTTON_PUSH 4 +#define USER_ACTIVE_MODE_TRIGGER_PUSH 5 #define APP_BUTTON_PUSH 1 diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/BUILD.gn b/examples/contact-sensor-app/nxp/k32w/k32w1/BUILD.gn index ed49c7bdd4f7a3..e44c1a9c71bd40 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/BUILD.gn +++ b/examples/contact-sensor-app/nxp/k32w/k32w1/BUILD.gn @@ -23,6 +23,7 @@ import("${nxp_sdk_build_root}/${nxp_sdk_name}/nxp_executable.gni") import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni") +import("${chip_root}/src/app/icd/icd.gni") import("${chip_root}/src/crypto/crypto.gni") import("${chip_root}/src/lib/core/core.gni") import("${chip_root}/src/platform/device.gni") @@ -74,6 +75,8 @@ k32w1_sdk("sdk") { k32w1_executable("contact_sensor_app") { output_name = "chip-k32w1-contact-example" + defines = [] + sources = [ "${k32w1_platform_dir}/util/LEDWidget.cpp", "${k32w1_platform_dir}/util/include/LEDWidget.h", @@ -89,7 +92,6 @@ k32w1_executable("contact_sensor_app") { deps = [ ":sdk", "${chip_root}/examples/common/QRCode", - "${chip_root}/examples/contact-sensor-app/nxp/zap", "${chip_root}/examples/providers:device_info_provider", "${chip_root}/src/lib", "${chip_root}/src/platform:syscalls_stub", @@ -109,6 +111,15 @@ k32w1_executable("contact_sensor_app") { ] } + #lit and sit are using different zap files + if (chip_enable_icd_lit) { + deps += [ "${chip_root}/examples/contact-sensor-app/nxp/zap-lit/" ] + + defines += [ "CHIP_ENABLE_LIT=1" ] + } else { + deps += [ "${chip_root}/examples/contact-sensor-app/nxp/zap-sit/" ] + } + cflags = [ "-Wconversion" ] output_dir = root_out_dir diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/README.md b/examples/contact-sensor-app/nxp/k32w/k32w1/README.md index 28983f45c89578..ff3496d7b862ac 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/README.md +++ b/examples/contact-sensor-app/nxp/k32w/k32w1/README.md @@ -19,6 +19,7 @@ into an existing Matter network and can be controlled by this network. - [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous) - [Device UI](#device-ui) - [Building](#building) +- [Long Idle Time ICD Support](#long-idle-time-icd-support) - [Manufacturing data](#manufacturing-data) - [Flashing](#flashing) - [Flashing the NBU image](#flashing-the-nbu-image) @@ -100,13 +101,15 @@ will not work. **RGB LED** shows the state of the simulated contact sensor. when the LED is lit, the sensor is contacted, when not lit, the sensor is non-contacted. -**Button SW2** can be used to start BLE advertising. A SHORT press of the button -will enable Bluetooth LE advertising for a predefined period of time. A LONG -Press Button SW2 initiates a factory reset. After an initial period of 3 -seconds, LED 2 and RGB LED will flash in unison to signal the pending reset. -After 6 seconds will cause the device to reset its persistent configuration and -initiate a reboot. The reset action can be cancelled by press SW2 button at any -point before the 6 second limit. +**Button SW2**. SHORT press function is overloaded depending on the device type +and commissioning state. If the device is not commissioned, a SHORT press of the +button will enable Bluetooth LE advertising for a predefined period of time. If +the device is commissioned and is acting as a LIT ICD then a SHORT press of the +button will enable Active Mode. A LONG Press of Button SW2 initiates a factory +reset. After an initial period of 3 seconds, LED 2 and RGB LED will flash in +unison to signal the pending reset. After 6 seconds will cause the device to +reset its persistent configuration and initiate a reboot. The reset action can +be cancelled by press SW2 button at any point before the 6 second limit. **Button SW3** can be used to change the state of the simulated contact sensor. The button behaves as a toggle, swapping the state every time it is short @@ -141,6 +144,43 @@ After a successful build, the `elf` and `srec` files are found in `out/debug/` - build, the `elf` and `srec` files are found in `out/debug/` - `see the files prefixed with chip-k32w1-contact-example`. +## Long Idle Time ICD Support + +By default, contact-sensor is compiled as SIT ICD (Short Idle Time +Intermittently Connected Device) - see rules from k32w1_sdk.gni: + +``` +chip_ot_idle_interval_ms = 2000 # 2s Idle Intervals +chip_ot_active_interval_ms = 500 # 500ms Active Intervals + +nxp_idle_mode_duration_s = 600 # 10min Idle Mode Interval +nxp_active_mode_duration_ms = 10000 # 10s Active Mode Interval +nxp_active_mode_threshold_ms = 1000 # 1s Active Mode Threshold +nxp_icd_supported_clients_per_fabric = 2 # 2 registration slots per fabric +``` + +If LIT ICD support is needed then `chip_enable_icd_lit=true` must be specified +as gn argument and the above parameters can be modified to comply with LIT +requirements (e.g.: LIT devices must configure +`chip_ot_idle_interval_ms > 15000`). Example LIT configuration: + +``` +chip_ot_idle_interval_ms = 15000 # 15s Idle Intervals +chip_ot_active_interval_ms = 500 # 500ms Active Intervals + +nxp_idle_mode_duration_s = 3600 # 60min Idle Mode Interval +nxp_active_mode_duration_ms = 0 # 0 Active Mode Interval +nxp_active_mode_threshold_ms = 30000 # 30s Active Mode Threshold +``` + +ICD parameters that may be disabled once LIT functionality is enabled: + +``` +chip_persist_subscriptions: try once to re-establish subscriptions from the server side after reboot +chip_subscription_timeout_resumption: same as above + try to re-establish timeout out subscriptions +using Fibonacci backoff for retries pacing. +``` + ## Manufacturing data Use `chip_with_factory_data=1` in the gn build command to enable factory data. diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/args.gni b/examples/contact-sensor-app/nxp/k32w/k32w1/args.gni index 18c41cb457bc86..b25f000cd85d1c 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/args.gni +++ b/examples/contact-sensor-app/nxp/k32w/k32w1/args.gni @@ -24,5 +24,7 @@ chip_stack_lock_tracking = "fatal" chip_enable_ble = true chip_enable_icd_server = true +chip_enable_icd_lit = false +icd_enforce_sit_slow_poll_limit = true chip_persist_subscriptions = true chip_subscription_timeout_resumption = true diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h b/examples/contact-sensor-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h index 8846799ed6edc9..808b70aad0cab7 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h +++ b/examples/contact-sensor-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h @@ -132,11 +132,11 @@ * {MAJOR_VERSION}.0d{MINOR_VERSION} */ #ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "03-2022-te8" +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING NXP_CONFIG_DEVICE_SOFTWARE_VERSION_STRING #endif #ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 42020 +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION NXP_CONFIG_DEVICE_SOFTWARE_VERSION #endif #ifndef CHIP_DEVICE_CONFIG_DEVICE_VENDOR_NAME diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/main/AppTask.cpp b/examples/contact-sensor-app/nxp/k32w/k32w1/main/AppTask.cpp index 10039bb8c9270e..3e9380254bd428 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/main/AppTask.cpp +++ b/examples/contact-sensor-app/nxp/k32w/k32w1/main/AppTask.cpp @@ -78,6 +78,9 @@ static LEDWidget sContactSensorLED; static bool sIsThreadProvisioned = false; static bool sHaveBLEConnections = false; +#if CHIP_ENABLE_LIT +static bool sIsDeviceCommissioned = false; +#endif static uint32_t eventMask = 0; @@ -398,6 +401,12 @@ void AppTask::ButtonEventHandler(uint8_t pin_no, uint8_t button_action) { button_event.Handler = ResetActionEventHandler; } +#if CHIP_ENABLE_LIT + else if (button_action == USER_ACTIVE_MODE_TRIGGER_PUSH) + { + button_event.Handler = UserActiveModeHandler; + } +#endif } sAppTask.PostEvent(&button_event); @@ -418,6 +427,12 @@ button_status_t AppTask::KBD_Callback(void * buttonHandle, button_callback_messa { ButtonEventHandler(BLE_BUTTON, RESET_BUTTON_PUSH); } +#if CHIP_ENABLE_LIT + else if (sIsDeviceCommissioned) + { + ButtonEventHandler(BLE_BUTTON, USER_ACTIVE_MODE_TRIGGER_PUSH); + } +#endif else { ButtonEventHandler(BLE_BUTTON, BLE_BUTTON_PUSH); @@ -616,6 +631,28 @@ void AppTask::BleStartAdvertising(intptr_t arg) } } +#if CHIP_ENABLE_LIT +void AppTask::UserActiveModeHandler(void * aGenericEvent) +{ + AppEvent * aEvent = (AppEvent *) aGenericEvent; + + if (aEvent->ButtonEvent.PinNo != BLE_BUTTON) + return; + + if (sAppTask.mFunction != Function::kNoneSelected) + { + K32W_LOG("Another function is scheduled. Could not request ICD Active Mode!"); + return; + } + PlatformMgr().ScheduleWork(AppTask::UserActiveModeTrigger, 0); +} + +void AppTask::UserActiveModeTrigger(intptr_t arg) +{ + ICDNotifier::GetInstance().NotifyNetworkActivityNotification(); +} +#endif + void AppTask::MatterEventHandler(const ChipDeviceEvent * event, intptr_t) { if (event->Type == DeviceEventType::kServiceProvisioningChange && event->ServiceProvisioningChange.IsServiceProvisioned) @@ -629,6 +666,12 @@ void AppTask::MatterEventHandler(const ChipDeviceEvent * event, intptr_t) sIsThreadProvisioned = FALSE; } } +#if CHIP_ENABLE_LIT + else if (event->Type == DeviceEventType::kCommissioningComplete) + { + sIsDeviceCommissioned = TRUE; + } +#endif #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR if (event->Type == DeviceEventType::kDnssdInitialized) diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/AppTask.h b/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/AppTask.h index bc19b0a9862ebd..2338131f06c4b0 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/AppTask.h +++ b/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/AppTask.h @@ -87,6 +87,10 @@ class AppTask static void ContactActionEventHandler(void * aGenericEvent); static void ResetActionEventHandler(void * aGenericEvent); static void InstallEventHandler(void * aGenericEvent); +#if CHIP_ENABLE_LIT + static void UserActiveModeHandler(void * aGenericEvent); + static void UserActiveModeTrigger(intptr_t arg); +#endif static void ButtonEventHandler(uint8_t pin_no, uint8_t button_action); static void TimerEventHandler(TimerHandle_t xTimer); diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/app_config.h b/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/app_config.h index fbcf14fe7d88d7..7001f636dbd0d7 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/app_config.h +++ b/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/app_config.h @@ -30,6 +30,7 @@ #define CONTACT_SENSOR_BUTTON_PUSH 2 #define SOFT_RESET_BUTTON_PUSH 3 #define BLE_BUTTON_PUSH 4 +#define USER_ACTIVE_MODE_TRIGGER_PUSH 5 #define APP_BUTTON_PUSH 1 diff --git a/examples/contact-sensor-app/nxp/zap/BUILD.gn b/examples/contact-sensor-app/nxp/zap-lit/BUILD.gn similarity index 96% rename from examples/contact-sensor-app/nxp/zap/BUILD.gn rename to examples/contact-sensor-app/nxp/zap-lit/BUILD.gn index be4913cf3552ee..7adfcbb7790a35 100644 --- a/examples/contact-sensor-app/nxp/zap/BUILD.gn +++ b/examples/contact-sensor-app/nxp/zap-lit/BUILD.gn @@ -16,7 +16,7 @@ import("//build_overrides/chip.gni") import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") import("${chip_root}/src/app/chip_data_model.gni") -chip_data_model("zap") { +chip_data_model("zap-lit") { zap_file = "contact-sensor-app.zap" zap_pregenerated_dir = diff --git a/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter b/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter new file mode 100644 index 00000000000000..9a6eeb77ef10f2 --- /dev/null +++ b/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.matter @@ -0,0 +1,1687 @@ +// This IDL was generated automatically by ZAP. +// It is for view/code review purposes only. + +/** Attributes and commands for putting a device into Identification mode (e.g. flashing a light). */ +cluster Identify = 3 { + revision 4; + + enum EffectIdentifierEnum : enum8 { + kBlink = 0; + kBreathe = 1; + kOkay = 2; + kChannelChange = 11; + kFinishEffect = 254; + kStopEffect = 255; + } + + enum EffectVariantEnum : enum8 { + kDefault = 0; + } + + enum IdentifyTypeEnum : enum8 { + kNone = 0; + kLightOutput = 1; + kVisibleIndicator = 2; + kAudibleBeep = 3; + kDisplay = 4; + kActuator = 5; + } + + attribute int16u identifyTime = 0; + readonly attribute IdentifyTypeEnum identifyType = 1; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct IdentifyRequest { + int16u identifyTime = 0; + } + + request struct TriggerEffectRequest { + EffectIdentifierEnum effectIdentifier = 0; + EffectVariantEnum effectVariant = 1; + } + + /** Command description for Identify */ + command access(invoke: manage) Identify(IdentifyRequest): DefaultSuccess = 0; + /** Command description for TriggerEffect */ + command access(invoke: manage) TriggerEffect(TriggerEffectRequest): DefaultSuccess = 64; +} + +/** The Descriptor Cluster is meant to replace the support from the Zigbee Device Object (ZDO) for describing a node, its endpoints and clusters. */ +cluster Descriptor = 29 { + revision 2; + + bitmap Feature : bitmap32 { + kTagList = 0x1; + } + + struct DeviceTypeStruct { + devtype_id deviceType = 0; + int16u revision = 1; + } + + struct SemanticTagStruct { + nullable vendor_id mfgCode = 0; + enum8 namespaceID = 1; + enum8 tag = 2; + optional nullable char_string label = 3; + } + + readonly attribute DeviceTypeStruct deviceTypeList[] = 0; + readonly attribute cluster_id serverList[] = 1; + readonly attribute cluster_id clientList[] = 2; + readonly attribute endpoint_no partsList[] = 3; + readonly attribute optional SemanticTagStruct tagList[] = 4; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + +/** The Access Control Cluster exposes a data model view of a + Node's Access Control List (ACL), which codifies the rules used to manage + and enforce Access Control for the Node's endpoints and their associated + cluster instances. */ +cluster AccessControl = 31 { + revision 1; // NOTE: Default/not specifically set + + enum AccessControlEntryAuthModeEnum : enum8 { + kPASE = 1; + kCASE = 2; + kGroup = 3; + } + + enum AccessControlEntryPrivilegeEnum : enum8 { + kView = 1; + kProxyView = 2; + kOperate = 3; + kManage = 4; + kAdminister = 5; + } + + enum ChangeTypeEnum : enum8 { + kChanged = 0; + kAdded = 1; + kRemoved = 2; + } + + struct AccessControlTargetStruct { + nullable cluster_id cluster = 0; + nullable endpoint_no endpoint = 1; + nullable devtype_id deviceType = 2; + } + + fabric_scoped struct AccessControlEntryStruct { + fabric_sensitive AccessControlEntryPrivilegeEnum privilege = 1; + fabric_sensitive AccessControlEntryAuthModeEnum authMode = 2; + nullable fabric_sensitive int64u subjects[] = 3; + nullable fabric_sensitive AccessControlTargetStruct targets[] = 4; + fabric_idx fabricIndex = 254; + } + + fabric_scoped struct AccessControlExtensionStruct { + fabric_sensitive octet_string<128> data = 1; + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) AccessControlEntryChanged = 0 { + nullable node_id adminNodeID = 1; + nullable int16u adminPasscodeID = 2; + ChangeTypeEnum changeType = 3; + nullable AccessControlEntryStruct latestValue = 4; + fabric_idx fabricIndex = 254; + } + + fabric_sensitive info event access(read: administer) AccessControlExtensionChanged = 1 { + nullable node_id adminNodeID = 1; + nullable int16u adminPasscodeID = 2; + ChangeTypeEnum changeType = 3; + nullable AccessControlExtensionStruct latestValue = 4; + fabric_idx fabricIndex = 254; + } + + attribute access(read: administer, write: administer) AccessControlEntryStruct acl[] = 0; + attribute access(read: administer, write: administer) optional AccessControlExtensionStruct extension[] = 1; + readonly attribute int16u subjectsPerAccessControlEntry = 2; + readonly attribute int16u targetsPerAccessControlEntry = 3; + readonly attribute int16u accessControlEntriesPerFabric = 4; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + +/** This cluster provides attributes and events for determining basic information about Nodes, which supports both + Commissioning and operational determination of Node characteristics, such as Vendor ID, Product ID and serial number, + which apply to the whole Node. Also allows setting user device information such as location. */ +cluster BasicInformation = 40 { + revision 3; + + enum ColorEnum : enum8 { + kBlack = 0; + kNavy = 1; + kGreen = 2; + kTeal = 3; + kMaroon = 4; + kPurple = 5; + kOlive = 6; + kGray = 7; + kBlue = 8; + kLime = 9; + kAqua = 10; + kRed = 11; + kFuchsia = 12; + kYellow = 13; + kWhite = 14; + kNickel = 15; + kChrome = 16; + kBrass = 17; + kCopper = 18; + kSilver = 19; + kGold = 20; + } + + enum ProductFinishEnum : enum8 { + kOther = 0; + kMatte = 1; + kSatin = 2; + kPolished = 3; + kRugged = 4; + kFabric = 5; + } + + struct CapabilityMinimaStruct { + int16u caseSessionsPerFabric = 0; + int16u subscriptionsPerFabric = 1; + } + + struct ProductAppearanceStruct { + ProductFinishEnum finish = 0; + nullable ColorEnum primaryColor = 1; + } + + critical event StartUp = 0 { + int32u softwareVersion = 0; + } + + critical event ShutDown = 1 { + } + + info event Leave = 2 { + fabric_idx fabricIndex = 0; + } + + info event ReachableChanged = 3 { + boolean reachableNewValue = 0; + } + + readonly attribute int16u dataModelRevision = 0; + readonly attribute char_string<32> vendorName = 1; + readonly attribute vendor_id vendorID = 2; + readonly attribute char_string<32> productName = 3; + readonly attribute int16u productID = 4; + attribute access(write: manage) char_string<32> nodeLabel = 5; + attribute access(write: administer) char_string<2> location = 6; + readonly attribute int16u hardwareVersion = 7; + readonly attribute char_string<64> hardwareVersionString = 8; + readonly attribute int32u softwareVersion = 9; + readonly attribute char_string<64> softwareVersionString = 10; + readonly attribute optional char_string<16> manufacturingDate = 11; + readonly attribute optional char_string<32> partNumber = 12; + readonly attribute optional long_char_string<256> productURL = 13; + readonly attribute optional char_string<64> productLabel = 14; + readonly attribute optional char_string<32> serialNumber = 15; + attribute access(write: manage) optional boolean localConfigDisabled = 16; + readonly attribute optional boolean reachable = 17; + readonly attribute optional char_string<32> uniqueID = 18; + readonly attribute CapabilityMinimaStruct capabilityMinima = 19; + readonly attribute optional ProductAppearanceStruct productAppearance = 20; + readonly attribute int32u specificationVersion = 21; + readonly attribute int16u maxPathsPerInvoke = 22; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + command MfgSpecificPing(): DefaultSuccess = 0; +} + +/** Provides an interface for providing OTA software updates */ +cluster OtaSoftwareUpdateProvider = 41 { + revision 1; // NOTE: Default/not specifically set + + enum ApplyUpdateActionEnum : enum8 { + kProceed = 0; + kAwaitNextAction = 1; + kDiscontinue = 2; + } + + enum DownloadProtocolEnum : enum8 { + kBDXSynchronous = 0; + kBDXAsynchronous = 1; + kHTTPS = 2; + kVendorSpecific = 3; + } + + enum StatusEnum : enum8 { + kUpdateAvailable = 0; + kBusy = 1; + kNotAvailable = 2; + kDownloadProtocolNotSupported = 3; + } + + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct QueryImageRequest { + vendor_id vendorID = 0; + int16u productID = 1; + int32u softwareVersion = 2; + DownloadProtocolEnum protocolsSupported[] = 3; + optional int16u hardwareVersion = 4; + optional char_string<2> location = 5; + optional boolean requestorCanConsent = 6; + optional octet_string<512> metadataForProvider = 7; + } + + response struct QueryImageResponse = 1 { + StatusEnum status = 0; + optional int32u delayedActionTime = 1; + optional char_string<256> imageURI = 2; + optional int32u softwareVersion = 3; + optional char_string<64> softwareVersionString = 4; + optional octet_string<32> updateToken = 5; + optional boolean userConsentNeeded = 6; + optional octet_string<512> metadataForRequestor = 7; + } + + request struct ApplyUpdateRequestRequest { + octet_string<32> updateToken = 0; + int32u newVersion = 1; + } + + response struct ApplyUpdateResponse = 3 { + ApplyUpdateActionEnum action = 0; + int32u delayedActionTime = 1; + } + + request struct NotifyUpdateAppliedRequest { + octet_string<32> updateToken = 0; + int32u softwareVersion = 1; + } + + /** Determine availability of a new Software Image */ + command QueryImage(QueryImageRequest): QueryImageResponse = 0; + /** Determine next action to take for a downloaded Software Image */ + command ApplyUpdateRequest(ApplyUpdateRequestRequest): ApplyUpdateResponse = 2; + /** Notify OTA Provider that an update was applied */ + command NotifyUpdateApplied(NotifyUpdateAppliedRequest): DefaultSuccess = 4; +} + +/** Provides an interface for downloading and applying OTA software updates */ +cluster OtaSoftwareUpdateRequestor = 42 { + revision 1; // NOTE: Default/not specifically set + + enum AnnouncementReasonEnum : enum8 { + kSimpleAnnouncement = 0; + kUpdateAvailable = 1; + kUrgentUpdateAvailable = 2; + } + + enum ChangeReasonEnum : enum8 { + kUnknown = 0; + kSuccess = 1; + kFailure = 2; + kTimeOut = 3; + kDelayByProvider = 4; + } + + enum UpdateStateEnum : enum8 { + kUnknown = 0; + kIdle = 1; + kQuerying = 2; + kDelayedOnQuery = 3; + kDownloading = 4; + kApplying = 5; + kDelayedOnApply = 6; + kRollingBack = 7; + kDelayedOnUserConsent = 8; + } + + fabric_scoped struct ProviderLocation { + node_id providerNodeID = 1; + endpoint_no endpoint = 2; + fabric_idx fabricIndex = 254; + } + + info event StateTransition = 0 { + UpdateStateEnum previousState = 0; + UpdateStateEnum newState = 1; + ChangeReasonEnum reason = 2; + nullable int32u targetSoftwareVersion = 3; + } + + critical event VersionApplied = 1 { + int32u softwareVersion = 0; + int16u productID = 1; + } + + info event DownloadError = 2 { + int32u softwareVersion = 0; + int64u bytesDownloaded = 1; + nullable int8u progressPercent = 2; + nullable int64s platformCode = 3; + } + + attribute access(write: administer) ProviderLocation defaultOTAProviders[] = 0; + readonly attribute boolean updatePossible = 1; + readonly attribute UpdateStateEnum updateState = 2; + readonly attribute nullable int8u updateStateProgress = 3; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct AnnounceOTAProviderRequest { + node_id providerNodeID = 0; + vendor_id vendorID = 1; + AnnouncementReasonEnum announcementReason = 2; + optional octet_string<512> metadataForNode = 3; + endpoint_no endpoint = 4; + } + + /** Announce the presence of an OTA Provider */ + command AnnounceOTAProvider(AnnounceOTAProviderRequest): DefaultSuccess = 0; +} + +/** This cluster is used to manage global aspects of the Commissioning flow. */ +cluster GeneralCommissioning = 48 { + revision 1; // NOTE: Default/not specifically set + + enum CommissioningErrorEnum : enum8 { + kOK = 0; + kValueOutsideRange = 1; + kInvalidAuthentication = 2; + kNoFailSafe = 3; + kBusyWithOtherAdmin = 4; + } + + enum RegulatoryLocationTypeEnum : enum8 { + kIndoor = 0; + kOutdoor = 1; + kIndoorOutdoor = 2; + } + + struct BasicCommissioningInfo { + int16u failSafeExpiryLengthSeconds = 0; + int16u maxCumulativeFailsafeSeconds = 1; + } + + attribute access(write: administer) int64u breadcrumb = 0; + readonly attribute BasicCommissioningInfo basicCommissioningInfo = 1; + readonly attribute RegulatoryLocationTypeEnum regulatoryConfig = 2; + readonly attribute RegulatoryLocationTypeEnum locationCapability = 3; + readonly attribute boolean supportsConcurrentConnection = 4; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct ArmFailSafeRequest { + int16u expiryLengthSeconds = 0; + int64u breadcrumb = 1; + } + + response struct ArmFailSafeResponse = 1 { + CommissioningErrorEnum errorCode = 0; + char_string<128> debugText = 1; + } + + request struct SetRegulatoryConfigRequest { + RegulatoryLocationTypeEnum newRegulatoryConfig = 0; + char_string<2> countryCode = 1; + int64u breadcrumb = 2; + } + + response struct SetRegulatoryConfigResponse = 3 { + CommissioningErrorEnum errorCode = 0; + char_string debugText = 1; + } + + response struct CommissioningCompleteResponse = 5 { + CommissioningErrorEnum errorCode = 0; + char_string debugText = 1; + } + + /** Arm the persistent fail-safe timer with an expiry time of now + ExpiryLengthSeconds using device clock */ + command access(invoke: administer) ArmFailSafe(ArmFailSafeRequest): ArmFailSafeResponse = 0; + /** Set the regulatory configuration to be used during commissioning */ + command access(invoke: administer) SetRegulatoryConfig(SetRegulatoryConfigRequest): SetRegulatoryConfigResponse = 2; + /** Signals the Server that the Client has successfully completed all steps of Commissioning/Recofiguration needed during fail-safe period. */ + fabric command access(invoke: administer) CommissioningComplete(): CommissioningCompleteResponse = 4; +} + +/** Functionality to configure, enable, disable network credentials and access on a Matter device. */ +cluster NetworkCommissioning = 49 { + revision 1; // NOTE: Default/not specifically set + + enum NetworkCommissioningStatusEnum : enum8 { + kSuccess = 0; + kOutOfRange = 1; + kBoundsExceeded = 2; + kNetworkIDNotFound = 3; + kDuplicateNetworkID = 4; + kNetworkNotFound = 5; + kRegulatoryError = 6; + kAuthFailure = 7; + kUnsupportedSecurity = 8; + kOtherConnectionFailure = 9; + kIPV6Failed = 10; + kIPBindFailed = 11; + kUnknownError = 12; + } + + enum WiFiBandEnum : enum8 { + k2G4 = 0; + k3G65 = 1; + k5G = 2; + k6G = 3; + k60G = 4; + k1G = 5; + } + + bitmap Feature : bitmap32 { + kWiFiNetworkInterface = 0x1; + kThreadNetworkInterface = 0x2; + kEthernetNetworkInterface = 0x4; + kPerDeviceCredentials = 0x8; + } + + bitmap ThreadCapabilitiesBitmap : bitmap16 { + kIsBorderRouterCapable = 0x1; + kIsRouterCapable = 0x2; + kIsSleepyEndDeviceCapable = 0x4; + kIsFullThreadDevice = 0x8; + kIsSynchronizedSleepyEndDeviceCapable = 0x10; + } + + bitmap WiFiSecurityBitmap : bitmap8 { + kUnencrypted = 0x1; + kWEP = 0x2; + kWPAPersonal = 0x4; + kWPA2Personal = 0x8; + kWPA3Personal = 0x10; + kWPA3MatterPDC = 0x20; + } + + struct NetworkInfoStruct { + octet_string<32> networkID = 0; + boolean connected = 1; + optional nullable octet_string<20> networkIdentifier = 2; + optional nullable octet_string<20> clientIdentifier = 3; + } + + struct ThreadInterfaceScanResultStruct { + int16u panId = 0; + int64u extendedPanId = 1; + char_string<16> networkName = 2; + int16u channel = 3; + int8u version = 4; + octet_string<8> extendedAddress = 5; + int8s rssi = 6; + int8u lqi = 7; + } + + struct WiFiInterfaceScanResultStruct { + WiFiSecurityBitmap security = 0; + octet_string<32> ssid = 1; + octet_string<6> bssid = 2; + int16u channel = 3; + WiFiBandEnum wiFiBand = 4; + int8s rssi = 5; + } + + readonly attribute access(read: administer) int8u maxNetworks = 0; + readonly attribute access(read: administer) NetworkInfoStruct networks[] = 1; + readonly attribute optional int8u scanMaxTimeSeconds = 2; + readonly attribute optional int8u connectMaxTimeSeconds = 3; + attribute access(write: administer) boolean interfaceEnabled = 4; + readonly attribute access(read: administer) nullable NetworkCommissioningStatusEnum lastNetworkingStatus = 5; + readonly attribute access(read: administer) nullable octet_string<32> lastNetworkID = 6; + readonly attribute access(read: administer) nullable int32s lastConnectErrorValue = 7; + readonly attribute optional WiFiBandEnum supportedWiFiBands[] = 8; + readonly attribute optional ThreadCapabilitiesBitmap supportedThreadFeatures = 9; + readonly attribute optional int16u threadVersion = 10; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct ScanNetworksRequest { + optional nullable octet_string<32> ssid = 0; + optional int64u breadcrumb = 1; + } + + response struct ScanNetworksResponse = 1 { + NetworkCommissioningStatusEnum networkingStatus = 0; + optional char_string debugText = 1; + optional WiFiInterfaceScanResultStruct wiFiScanResults[] = 2; + optional ThreadInterfaceScanResultStruct threadScanResults[] = 3; + } + + request struct AddOrUpdateWiFiNetworkRequest { + octet_string<32> ssid = 0; + octet_string<64> credentials = 1; + optional int64u breadcrumb = 2; + optional octet_string<140> networkIdentity = 3; + optional octet_string<20> clientIdentifier = 4; + optional octet_string<32> possessionNonce = 5; + } + + request struct AddOrUpdateThreadNetworkRequest { + octet_string<254> operationalDataset = 0; + optional int64u breadcrumb = 1; + } + + request struct RemoveNetworkRequest { + octet_string<32> networkID = 0; + optional int64u breadcrumb = 1; + } + + response struct NetworkConfigResponse = 5 { + NetworkCommissioningStatusEnum networkingStatus = 0; + optional char_string<512> debugText = 1; + optional int8u networkIndex = 2; + optional octet_string<140> clientIdentity = 3; + optional octet_string<64> possessionSignature = 4; + } + + request struct ConnectNetworkRequest { + octet_string<32> networkID = 0; + optional int64u breadcrumb = 1; + } + + response struct ConnectNetworkResponse = 7 { + NetworkCommissioningStatusEnum networkingStatus = 0; + optional char_string debugText = 1; + nullable int32s errorValue = 2; + } + + request struct ReorderNetworkRequest { + octet_string<32> networkID = 0; + int8u networkIndex = 1; + optional int64u breadcrumb = 2; + } + + request struct QueryIdentityRequest { + octet_string<20> keyIdentifier = 0; + optional octet_string<32> possessionNonce = 1; + } + + response struct QueryIdentityResponse = 10 { + octet_string<140> identity = 0; + optional octet_string<64> possessionSignature = 1; + } + + /** Detemine the set of networks the device sees as available. */ + command access(invoke: administer) ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0; + /** Add or update the credentials for a given Wi-Fi network. */ + command access(invoke: administer) AddOrUpdateWiFiNetwork(AddOrUpdateWiFiNetworkRequest): NetworkConfigResponse = 2; + /** Add or update the credentials for a given Thread network. */ + command access(invoke: administer) AddOrUpdateThreadNetwork(AddOrUpdateThreadNetworkRequest): NetworkConfigResponse = 3; + /** Remove the definition of a given network (including its credentials). */ + command access(invoke: administer) RemoveNetwork(RemoveNetworkRequest): NetworkConfigResponse = 4; + /** Connect to the specified network, using previously-defined credentials. */ + command access(invoke: administer) ConnectNetwork(ConnectNetworkRequest): ConnectNetworkResponse = 6; + /** Modify the order in which networks will be presented in the Networks attribute. */ + command access(invoke: administer) ReorderNetwork(ReorderNetworkRequest): NetworkConfigResponse = 8; + /** Retrieve details about and optionally proof of possession of a network client identity. */ + command access(invoke: administer) QueryIdentity(QueryIdentityRequest): QueryIdentityResponse = 9; +} + +/** The General Diagnostics Cluster, along with other diagnostics clusters, provide a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. */ +cluster GeneralDiagnostics = 51 { + revision 2; + + enum BootReasonEnum : enum8 { + kUnspecified = 0; + kPowerOnReboot = 1; + kBrownOutReset = 2; + kSoftwareWatchdogReset = 3; + kHardwareWatchdogReset = 4; + kSoftwareUpdateCompleted = 5; + kSoftwareReset = 6; + } + + enum HardwareFaultEnum : enum8 { + kUnspecified = 0; + kRadio = 1; + kSensor = 2; + kResettableOverTemp = 3; + kNonResettableOverTemp = 4; + kPowerSource = 5; + kVisualDisplayFault = 6; + kAudioOutputFault = 7; + kUserInterfaceFault = 8; + kNonVolatileMemoryError = 9; + kTamperDetected = 10; + } + + enum InterfaceTypeEnum : enum8 { + kUnspecified = 0; + kWiFi = 1; + kEthernet = 2; + kCellular = 3; + kThread = 4; + } + + enum NetworkFaultEnum : enum8 { + kUnspecified = 0; + kHardwareFailure = 1; + kNetworkJammed = 2; + kConnectionFailed = 3; + } + + enum RadioFaultEnum : enum8 { + kUnspecified = 0; + kWiFiFault = 1; + kCellularFault = 2; + kThreadFault = 3; + kNFCFault = 4; + kBLEFault = 5; + kEthernetFault = 6; + } + + bitmap Feature : bitmap32 { + kDataModelTest = 0x1; + } + + struct NetworkInterface { + char_string<32> name = 0; + boolean isOperational = 1; + nullable boolean offPremiseServicesReachableIPv4 = 2; + nullable boolean offPremiseServicesReachableIPv6 = 3; + octet_string<8> hardwareAddress = 4; + octet_string IPv4Addresses[] = 5; + octet_string IPv6Addresses[] = 6; + InterfaceTypeEnum type = 7; + } + + critical event HardwareFaultChange = 0 { + HardwareFaultEnum current[] = 0; + HardwareFaultEnum previous[] = 1; + } + + critical event RadioFaultChange = 1 { + RadioFaultEnum current[] = 0; + RadioFaultEnum previous[] = 1; + } + + critical event NetworkFaultChange = 2 { + NetworkFaultEnum current[] = 0; + NetworkFaultEnum previous[] = 1; + } + + critical event BootReason = 3 { + BootReasonEnum bootReason = 0; + } + + readonly attribute NetworkInterface networkInterfaces[] = 0; + readonly attribute int16u rebootCount = 1; + readonly attribute optional int64u upTime = 2; + readonly attribute optional int32u totalOperationalHours = 3; + readonly attribute optional BootReasonEnum bootReason = 4; + readonly attribute optional HardwareFaultEnum activeHardwareFaults[] = 5; + readonly attribute optional RadioFaultEnum activeRadioFaults[] = 6; + readonly attribute optional NetworkFaultEnum activeNetworkFaults[] = 7; + readonly attribute boolean testEventTriggersEnabled = 8; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct TestEventTriggerRequest { + octet_string<16> enableKey = 0; + int64u eventTrigger = 1; + } + + response struct TimeSnapshotResponse = 2 { + systime_ms systemTimeMs = 0; + nullable posix_ms posixTimeMs = 1; + } + + request struct PayloadTestRequestRequest { + octet_string<16> enableKey = 0; + int8u value = 1; + int16u count = 2; + } + + response struct PayloadTestResponse = 4 { + octet_string payload = 0; + } + + /** Provide a means for certification tests to trigger some test-plan-specific events */ + command access(invoke: manage) TestEventTrigger(TestEventTriggerRequest): DefaultSuccess = 0; + /** Take a snapshot of system time and epoch time. */ + command TimeSnapshot(): TimeSnapshotResponse = 1; + /** Request a variable length payload response. */ + command PayloadTestRequest(PayloadTestRequestRequest): PayloadTestResponse = 3; +} + +/** The Software Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems. */ +cluster SoftwareDiagnostics = 52 { + revision 1; // NOTE: Default/not specifically set + + bitmap Feature : bitmap32 { + kWatermarks = 0x1; + } + + struct ThreadMetricsStruct { + int64u id = 0; + optional char_string<8> name = 1; + optional int32u stackFreeCurrent = 2; + optional int32u stackFreeMinimum = 3; + optional int32u stackSize = 4; + } + + info event SoftwareFault = 0 { + int64u id = 0; + optional char_string name = 1; + optional octet_string faultRecording = 2; + } + + readonly attribute optional ThreadMetricsStruct threadMetrics[] = 0; + readonly attribute optional int64u currentHeapFree = 1; + readonly attribute optional int64u currentHeapUsed = 2; + readonly attribute optional int64u currentHeapHighWatermark = 3; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + /** Reception of this command SHALL reset the values: The StackFreeMinimum field of the ThreadMetrics attribute, CurrentHeapHighWaterMark attribute. */ + command access(invoke: manage) ResetWatermarks(): DefaultSuccess = 0; +} + +/** The Thread Network Diagnostics Cluster provides a means to acquire standardized diagnostics metrics that MAY be used by a Node to assist a user or Administrative Node in diagnosing potential problems */ +cluster ThreadNetworkDiagnostics = 53 { + revision 1; // NOTE: Default/not specifically set + + enum ConnectionStatusEnum : enum8 { + kConnected = 0; + kNotConnected = 1; + } + + enum NetworkFaultEnum : enum8 { + kUnspecified = 0; + kLinkDown = 1; + kHardwareFailure = 2; + kNetworkJammed = 3; + } + + enum RoutingRoleEnum : enum8 { + kUnspecified = 0; + kUnassigned = 1; + kSleepyEndDevice = 2; + kEndDevice = 3; + kREED = 4; + kRouter = 5; + kLeader = 6; + } + + bitmap Feature : bitmap32 { + kPacketCounts = 0x1; + kErrorCounts = 0x2; + kMLECounts = 0x4; + kMACCounts = 0x8; + } + + struct NeighborTableStruct { + int64u extAddress = 0; + int32u age = 1; + int16u rloc16 = 2; + int32u linkFrameCounter = 3; + int32u mleFrameCounter = 4; + int8u lqi = 5; + nullable int8s averageRssi = 6; + nullable int8s lastRssi = 7; + int8u frameErrorRate = 8; + int8u messageErrorRate = 9; + boolean rxOnWhenIdle = 10; + boolean fullThreadDevice = 11; + boolean fullNetworkData = 12; + boolean isChild = 13; + } + + struct OperationalDatasetComponents { + boolean activeTimestampPresent = 0; + boolean pendingTimestampPresent = 1; + boolean masterKeyPresent = 2; + boolean networkNamePresent = 3; + boolean extendedPanIdPresent = 4; + boolean meshLocalPrefixPresent = 5; + boolean delayPresent = 6; + boolean panIdPresent = 7; + boolean channelPresent = 8; + boolean pskcPresent = 9; + boolean securityPolicyPresent = 10; + boolean channelMaskPresent = 11; + } + + struct RouteTableStruct { + int64u extAddress = 0; + int16u rloc16 = 1; + int8u routerId = 2; + int8u nextHop = 3; + int8u pathCost = 4; + int8u LQIIn = 5; + int8u LQIOut = 6; + int8u age = 7; + boolean allocated = 8; + boolean linkEstablished = 9; + } + + struct SecurityPolicy { + int16u rotationTime = 0; + int16u flags = 1; + } + + info event ConnectionStatus = 0 { + ConnectionStatusEnum connectionStatus = 0; + } + + info event NetworkFaultChange = 1 { + NetworkFaultEnum current[] = 0; + NetworkFaultEnum previous[] = 1; + } + + readonly attribute nullable int16u channel = 0; + readonly attribute nullable RoutingRoleEnum routingRole = 1; + readonly attribute nullable char_string<16> networkName = 2; + readonly attribute nullable int16u panId = 3; + readonly attribute nullable int64u extendedPanId = 4; + readonly attribute nullable octet_string<17> meshLocalPrefix = 5; + readonly attribute optional int64u overrunCount = 6; + readonly attribute NeighborTableStruct neighborTable[] = 7; + readonly attribute RouteTableStruct routeTable[] = 8; + readonly attribute nullable int32u partitionId = 9; + readonly attribute nullable int16u weighting = 10; + readonly attribute nullable int16u dataVersion = 11; + readonly attribute nullable int16u stableDataVersion = 12; + readonly attribute nullable int8u leaderRouterId = 13; + readonly attribute optional int16u detachedRoleCount = 14; + readonly attribute optional int16u childRoleCount = 15; + readonly attribute optional int16u routerRoleCount = 16; + readonly attribute optional int16u leaderRoleCount = 17; + readonly attribute optional int16u attachAttemptCount = 18; + readonly attribute optional int16u partitionIdChangeCount = 19; + readonly attribute optional int16u betterPartitionAttachAttemptCount = 20; + readonly attribute optional int16u parentChangeCount = 21; + readonly attribute optional int32u txTotalCount = 22; + readonly attribute optional int32u txUnicastCount = 23; + readonly attribute optional int32u txBroadcastCount = 24; + readonly attribute optional int32u txAckRequestedCount = 25; + readonly attribute optional int32u txAckedCount = 26; + readonly attribute optional int32u txNoAckRequestedCount = 27; + readonly attribute optional int32u txDataCount = 28; + readonly attribute optional int32u txDataPollCount = 29; + readonly attribute optional int32u txBeaconCount = 30; + readonly attribute optional int32u txBeaconRequestCount = 31; + readonly attribute optional int32u txOtherCount = 32; + readonly attribute optional int32u txRetryCount = 33; + readonly attribute optional int32u txDirectMaxRetryExpiryCount = 34; + readonly attribute optional int32u txIndirectMaxRetryExpiryCount = 35; + readonly attribute optional int32u txErrCcaCount = 36; + readonly attribute optional int32u txErrAbortCount = 37; + readonly attribute optional int32u txErrBusyChannelCount = 38; + readonly attribute optional int32u rxTotalCount = 39; + readonly attribute optional int32u rxUnicastCount = 40; + readonly attribute optional int32u rxBroadcastCount = 41; + readonly attribute optional int32u rxDataCount = 42; + readonly attribute optional int32u rxDataPollCount = 43; + readonly attribute optional int32u rxBeaconCount = 44; + readonly attribute optional int32u rxBeaconRequestCount = 45; + readonly attribute optional int32u rxOtherCount = 46; + readonly attribute optional int32u rxAddressFilteredCount = 47; + readonly attribute optional int32u rxDestAddrFilteredCount = 48; + readonly attribute optional int32u rxDuplicatedCount = 49; + readonly attribute optional int32u rxErrNoFrameCount = 50; + readonly attribute optional int32u rxErrUnknownNeighborCount = 51; + readonly attribute optional int32u rxErrInvalidSrcAddrCount = 52; + readonly attribute optional int32u rxErrSecCount = 53; + readonly attribute optional int32u rxErrFcsCount = 54; + readonly attribute optional int32u rxErrOtherCount = 55; + readonly attribute optional nullable int64u activeTimestamp = 56; + readonly attribute optional nullable int64u pendingTimestamp = 57; + readonly attribute optional nullable int32u delay = 58; + readonly attribute nullable SecurityPolicy securityPolicy = 59; + readonly attribute nullable octet_string<4> channelPage0Mask = 60; + readonly attribute nullable OperationalDatasetComponents operationalDatasetComponents = 61; + readonly attribute NetworkFaultEnum activeNetworkFaultsList[] = 62; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + /** Reception of this command SHALL reset the OverrunCount attributes to 0 */ + command access(invoke: manage) ResetCounts(): DefaultSuccess = 0; +} + +/** Commands to trigger a Node to allow a new Administrator to commission it. */ +cluster AdministratorCommissioning = 60 { + revision 1; // NOTE: Default/not specifically set + + enum CommissioningWindowStatusEnum : enum8 { + kWindowNotOpen = 0; + kEnhancedWindowOpen = 1; + kBasicWindowOpen = 2; + } + + enum StatusCode : enum8 { + kBusy = 2; + kPAKEParameterError = 3; + kWindowNotOpen = 4; + } + + bitmap Feature : bitmap32 { + kBasic = 0x1; + } + + readonly attribute CommissioningWindowStatusEnum windowStatus = 0; + readonly attribute nullable fabric_idx adminFabricIndex = 1; + readonly attribute nullable vendor_id adminVendorId = 2; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct OpenCommissioningWindowRequest { + int16u commissioningTimeout = 0; + octet_string PAKEPasscodeVerifier = 1; + int16u discriminator = 2; + int32u iterations = 3; + octet_string<32> salt = 4; + } + + request struct OpenBasicCommissioningWindowRequest { + int16u commissioningTimeout = 0; + } + + /** This command is used by a current Administrator to instruct a Node to go into commissioning mode using enhanced commissioning method. */ + timed command access(invoke: administer) OpenCommissioningWindow(OpenCommissioningWindowRequest): DefaultSuccess = 0; + /** This command is used by a current Administrator to instruct a Node to go into commissioning mode using basic commissioning method, if the node supports it. */ + timed command access(invoke: administer) OpenBasicCommissioningWindow(OpenBasicCommissioningWindowRequest): DefaultSuccess = 1; + /** This command is used by a current Administrator to instruct a Node to revoke any active Open Commissioning Window or Open Basic Commissioning Window command. */ + timed command access(invoke: administer) RevokeCommissioning(): DefaultSuccess = 2; +} + +/** This cluster is used to add or remove Operational Credentials on a Commissionee or Node, as well as manage the associated Fabrics. */ +cluster OperationalCredentials = 62 { + revision 1; // NOTE: Default/not specifically set + + enum CertificateChainTypeEnum : enum8 { + kDACCertificate = 1; + kPAICertificate = 2; + } + + enum NodeOperationalCertStatusEnum : enum8 { + kOK = 0; + kInvalidPublicKey = 1; + kInvalidNodeOpId = 2; + kInvalidNOC = 3; + kMissingCsr = 4; + kTableFull = 5; + kInvalidAdminSubject = 6; + kFabricConflict = 9; + kLabelConflict = 10; + kInvalidFabricIndex = 11; + } + + fabric_scoped struct FabricDescriptorStruct { + octet_string<65> rootPublicKey = 1; + vendor_id vendorID = 2; + fabric_id fabricID = 3; + node_id nodeID = 4; + char_string<32> label = 5; + fabric_idx fabricIndex = 254; + } + + fabric_scoped struct NOCStruct { + fabric_sensitive octet_string noc = 1; + nullable fabric_sensitive octet_string icac = 2; + fabric_idx fabricIndex = 254; + } + + readonly attribute access(read: administer) NOCStruct NOCs[] = 0; + readonly attribute FabricDescriptorStruct fabrics[] = 1; + readonly attribute int8u supportedFabrics = 2; + readonly attribute int8u commissionedFabrics = 3; + readonly attribute octet_string trustedRootCertificates[] = 4; + readonly attribute int8u currentFabricIndex = 5; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct AttestationRequestRequest { + octet_string<32> attestationNonce = 0; + } + + response struct AttestationResponse = 1 { + octet_string<900> attestationElements = 0; + octet_string<64> attestationSignature = 1; + } + + request struct CertificateChainRequestRequest { + CertificateChainTypeEnum certificateType = 0; + } + + response struct CertificateChainResponse = 3 { + octet_string<600> certificate = 0; + } + + request struct CSRRequestRequest { + octet_string<32> CSRNonce = 0; + optional boolean isForUpdateNOC = 1; + } + + response struct CSRResponse = 5 { + octet_string NOCSRElements = 0; + octet_string attestationSignature = 1; + } + + request struct AddNOCRequest { + octet_string<400> NOCValue = 0; + optional octet_string<400> ICACValue = 1; + octet_string<16> IPKValue = 2; + int64u caseAdminSubject = 3; + vendor_id adminVendorId = 4; + } + + request struct UpdateNOCRequest { + octet_string NOCValue = 0; + optional octet_string ICACValue = 1; + } + + response struct NOCResponse = 8 { + NodeOperationalCertStatusEnum statusCode = 0; + optional fabric_idx fabricIndex = 1; + optional char_string<128> debugText = 2; + } + + request struct UpdateFabricLabelRequest { + char_string<32> label = 0; + } + + request struct RemoveFabricRequest { + fabric_idx fabricIndex = 0; + } + + request struct AddTrustedRootCertificateRequest { + octet_string rootCACertificate = 0; + } + + /** Sender is requesting attestation information from the receiver. */ + command access(invoke: administer) AttestationRequest(AttestationRequestRequest): AttestationResponse = 0; + /** Sender is requesting a device attestation certificate from the receiver. */ + command access(invoke: administer) CertificateChainRequest(CertificateChainRequestRequest): CertificateChainResponse = 2; + /** Sender is requesting a certificate signing request (CSR) from the receiver. */ + command access(invoke: administer) CSRRequest(CSRRequestRequest): CSRResponse = 4; + /** Sender is requesting to add the new node operational certificates. */ + command access(invoke: administer) AddNOC(AddNOCRequest): NOCResponse = 6; + /** Sender is requesting to update the node operational certificates. */ + fabric command access(invoke: administer) UpdateNOC(UpdateNOCRequest): NOCResponse = 7; + /** This command SHALL be used by an Administrative Node to set the user-visible Label field for a given Fabric, as reflected by entries in the Fabrics attribute. */ + fabric command access(invoke: administer) UpdateFabricLabel(UpdateFabricLabelRequest): NOCResponse = 9; + /** This command is used by Administrative Nodes to remove a given fabric index and delete all associated fabric-scoped data. */ + command access(invoke: administer) RemoveFabric(RemoveFabricRequest): NOCResponse = 10; + /** This command SHALL add a Trusted Root CA Certificate, provided as its CHIP Certificate representation. */ + command access(invoke: administer) AddTrustedRootCertificate(AddTrustedRootCertificateRequest): DefaultSuccess = 11; +} + +/** The Group Key Management Cluster is the mechanism by which group keys are managed. */ +cluster GroupKeyManagement = 63 { + revision 1; // NOTE: Default/not specifically set + + enum GroupKeySecurityPolicyEnum : enum8 { + kTrustFirst = 0; + kCacheAndSync = 1; + } + + bitmap Feature : bitmap32 { + kCacheAndSync = 0x1; + } + + fabric_scoped struct GroupInfoMapStruct { + group_id groupId = 1; + endpoint_no endpoints[] = 2; + optional char_string<16> groupName = 3; + fabric_idx fabricIndex = 254; + } + + fabric_scoped struct GroupKeyMapStruct { + group_id groupId = 1; + int16u groupKeySetID = 2; + fabric_idx fabricIndex = 254; + } + + struct GroupKeySetStruct { + int16u groupKeySetID = 0; + GroupKeySecurityPolicyEnum groupKeySecurityPolicy = 1; + nullable octet_string<16> epochKey0 = 2; + nullable epoch_us epochStartTime0 = 3; + nullable octet_string<16> epochKey1 = 4; + nullable epoch_us epochStartTime1 = 5; + nullable octet_string<16> epochKey2 = 6; + nullable epoch_us epochStartTime2 = 7; + } + + attribute access(write: manage) GroupKeyMapStruct groupKeyMap[] = 0; + readonly attribute GroupInfoMapStruct groupTable[] = 1; + readonly attribute int16u maxGroupsPerFabric = 2; + readonly attribute int16u maxGroupKeysPerFabric = 3; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct KeySetWriteRequest { + GroupKeySetStruct groupKeySet = 0; + } + + request struct KeySetReadRequest { + int16u groupKeySetID = 0; + } + + response struct KeySetReadResponse = 2 { + GroupKeySetStruct groupKeySet = 0; + } + + request struct KeySetRemoveRequest { + int16u groupKeySetID = 0; + } + + response struct KeySetReadAllIndicesResponse = 5 { + int16u groupKeySetIDs[] = 0; + } + + /** Write a new set of keys for the given key set id. */ + fabric command access(invoke: administer) KeySetWrite(KeySetWriteRequest): DefaultSuccess = 0; + /** Read the keys for a given key set id. */ + fabric command access(invoke: administer) KeySetRead(KeySetReadRequest): KeySetReadResponse = 1; + /** Revoke a Root Key from a Group */ + fabric command access(invoke: administer) KeySetRemove(KeySetRemoveRequest): DefaultSuccess = 3; + /** Return the list of Group Key Sets associated with the accessing fabric */ + fabric command access(invoke: administer) KeySetReadAllIndices(): KeySetReadAllIndicesResponse = 4; +} + +/** This cluster provides an interface to a boolean state called StateValue. */ +cluster BooleanState = 69 { + revision 1; + + info event StateChange = 0 { + boolean stateValue = 0; + } + + readonly attribute boolean stateValue = 0; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; +} + +/** Allows servers to ensure that listed clients are notified when a server is available for communication. */ +cluster IcdManagement = 70 { + revision 2; + + enum OperatingModeEnum : enum8 { + kSIT = 0; + kLIT = 1; + } + + bitmap Feature : bitmap32 { + kCheckInProtocolSupport = 0x1; + kUserActiveModeTrigger = 0x2; + kLongIdleTimeSupport = 0x4; + } + + bitmap UserActiveModeTriggerBitmap : bitmap32 { + kPowerCycle = 0x1; + kSettingsMenu = 0x2; + kCustomInstruction = 0x4; + kDeviceManual = 0x8; + kActuateSensor = 0x10; + kActuateSensorSeconds = 0x20; + kActuateSensorTimes = 0x40; + kActuateSensorLightsBlink = 0x80; + kResetButton = 0x100; + kResetButtonLightsBlink = 0x200; + kResetButtonSeconds = 0x400; + kResetButtonTimes = 0x800; + kSetupButton = 0x1000; + kSetupButtonSeconds = 0x2000; + kSetupButtonLightsBlink = 0x4000; + kSetupButtonTimes = 0x8000; + kAppDefinedButton = 0x10000; + } + + fabric_scoped struct MonitoringRegistrationStruct { + fabric_sensitive node_id checkInNodeID = 1; + fabric_sensitive int64u monitoredSubject = 2; + fabric_idx fabricIndex = 254; + } + + readonly attribute int32u idleModeDuration = 0; + readonly attribute int32u activeModeDuration = 1; + readonly attribute int16u activeModeThreshold = 2; + readonly attribute access(read: administer) optional MonitoringRegistrationStruct registeredClients[] = 3; + readonly attribute access(read: administer) optional int32u ICDCounter = 4; + readonly attribute optional int16u clientsSupportedPerFabric = 5; + readonly attribute optional UserActiveModeTriggerBitmap userActiveModeTriggerHint = 6; + readonly attribute optional char_string<128> userActiveModeTriggerInstruction = 7; + readonly attribute optional OperatingModeEnum operatingMode = 8; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + request struct RegisterClientRequest { + node_id checkInNodeID = 0; + int64u monitoredSubject = 1; + octet_string<16> key = 2; + optional octet_string<16> verificationKey = 3; + } + + response struct RegisterClientResponse = 1 { + int32u ICDCounter = 0; + } + + request struct UnregisterClientRequest { + node_id checkInNodeID = 0; + optional octet_string<16> verificationKey = 1; + } + + response struct StayActiveResponse = 4 { + int32u promisedActiveDuration = 0; + } + + /** Register a client to the end device */ + fabric command access(invoke: manage) RegisterClient(RegisterClientRequest): RegisterClientResponse = 0; + /** Unregister a client from an end device */ + fabric command access(invoke: manage) UnregisterClient(UnregisterClientRequest): DefaultSuccess = 2; + /** Request the end device to stay in Active Mode for an additional ActiveModeThreshold */ + command access(invoke: manage) StayActiveRequest(): StayActiveResponse = 3; +} + +endpoint 0 { + device type ma_rootdevice = 22, version 2; + + binding cluster OtaSoftwareUpdateProvider; + + server cluster Descriptor { + callback attribute deviceTypeList; + callback attribute serverList; + callback attribute clientList; + callback attribute partsList; + callback attribute featureMap; + callback attribute clusterRevision; + } + + server cluster AccessControl { + emits event AccessControlEntryChanged; + emits event AccessControlExtensionChanged; + callback attribute acl; + callback attribute subjectsPerAccessControlEntry; + callback attribute targetsPerAccessControlEntry; + callback attribute accessControlEntriesPerFabric; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0; + callback attribute clusterRevision; + } + + server cluster BasicInformation { + emits event StartUp; + emits event ShutDown; + emits event Leave; + callback attribute dataModelRevision; + callback attribute vendorName; + callback attribute vendorID; + callback attribute productName; + callback attribute productID; + persist attribute nodeLabel; + callback attribute location; + callback attribute hardwareVersion; + callback attribute hardwareVersionString; + callback attribute softwareVersion; + callback attribute softwareVersionString; + callback attribute capabilityMinima; + callback attribute specificationVersion; + callback attribute maxPathsPerInvoke; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 2; + } + + server cluster OtaSoftwareUpdateRequestor { + emits event StateTransition; + emits event VersionApplied; + emits event DownloadError; + callback attribute defaultOTAProviders; + ram attribute updatePossible default = 1; + ram attribute updateState default = 0; + ram attribute updateStateProgress default = 0; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + + handle command AnnounceOTAProvider; + } + + server cluster GeneralCommissioning { + ram attribute breadcrumb default = 0x0000000000000000; + callback attribute basicCommissioningInfo; + callback attribute regulatoryConfig; + callback attribute locationCapability; + callback attribute supportsConcurrentConnection; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + + handle command ArmFailSafe; + handle command ArmFailSafeResponse; + handle command SetRegulatoryConfig; + handle command SetRegulatoryConfigResponse; + handle command CommissioningComplete; + handle command CommissioningCompleteResponse; + } + + server cluster NetworkCommissioning { + ram attribute maxNetworks; + callback attribute networks; + ram attribute scanMaxTimeSeconds; + ram attribute connectMaxTimeSeconds; + ram attribute interfaceEnabled; + ram attribute lastNetworkingStatus; + ram attribute lastNetworkID; + ram attribute lastConnectErrorValue; + ram attribute supportedThreadFeatures; + ram attribute threadVersion; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 2; + ram attribute clusterRevision default = 2; + + handle command ScanNetworks; + handle command ScanNetworksResponse; + handle command AddOrUpdateThreadNetwork; + handle command RemoveNetwork; + handle command NetworkConfigResponse; + handle command ConnectNetwork; + handle command ConnectNetworkResponse; + handle command ReorderNetwork; + } + + server cluster GeneralDiagnostics { + emits event BootReason; + callback attribute networkInterfaces; + callback attribute rebootCount; + callback attribute upTime; + callback attribute activeNetworkFaults; + callback attribute testEventTriggersEnabled default = false; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + callback attribute featureMap; + callback attribute clusterRevision; + + handle command TestEventTrigger; + handle command TimeSnapshot; + handle command TimeSnapshotResponse; + } + + server cluster SoftwareDiagnostics { + callback attribute threadMetrics; + callback attribute currentHeapFree; + callback attribute currentHeapUsed; + callback attribute currentHeapHighWatermark; + callback attribute featureMap; + ram attribute clusterRevision default = 1; + + handle command ResetWatermarks; + } + + server cluster ThreadNetworkDiagnostics { + callback attribute channel; + callback attribute routingRole; + callback attribute networkName; + callback attribute panId; + callback attribute extendedPanId; + callback attribute meshLocalPrefix; + callback attribute overrunCount; + callback attribute neighborTable; + callback attribute routeTable; + callback attribute partitionId; + callback attribute weighting; + callback attribute dataVersion; + callback attribute stableDataVersion; + callback attribute leaderRouterId; + callback attribute detachedRoleCount; + callback attribute childRoleCount; + callback attribute routerRoleCount; + callback attribute leaderRoleCount; + callback attribute attachAttemptCount; + callback attribute partitionIdChangeCount; + callback attribute betterPartitionAttachAttemptCount; + callback attribute parentChangeCount; + callback attribute txTotalCount; + callback attribute txUnicastCount; + callback attribute txBroadcastCount; + callback attribute txAckRequestedCount; + callback attribute txAckedCount; + callback attribute txNoAckRequestedCount; + callback attribute txDataCount; + callback attribute txDataPollCount; + callback attribute txBeaconCount; + callback attribute txBeaconRequestCount; + callback attribute txOtherCount; + callback attribute txRetryCount; + callback attribute txDirectMaxRetryExpiryCount; + callback attribute txIndirectMaxRetryExpiryCount; + callback attribute txErrCcaCount; + callback attribute txErrAbortCount; + callback attribute txErrBusyChannelCount; + callback attribute rxTotalCount; + callback attribute rxUnicastCount; + callback attribute rxBroadcastCount; + callback attribute rxDataCount; + callback attribute rxDataPollCount; + callback attribute rxBeaconCount; + callback attribute rxBeaconRequestCount; + callback attribute rxOtherCount; + callback attribute rxAddressFilteredCount; + callback attribute rxDestAddrFilteredCount; + callback attribute rxDuplicatedCount; + callback attribute rxErrNoFrameCount; + callback attribute rxErrUnknownNeighborCount; + callback attribute rxErrInvalidSrcAddrCount; + callback attribute rxErrSecCount; + callback attribute rxErrFcsCount; + callback attribute rxErrOtherCount; + callback attribute securityPolicy; + callback attribute channelPage0Mask; + callback attribute operationalDatasetComponents; + callback attribute activeNetworkFaultsList; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0x000F; + ram attribute clusterRevision default = 2; + + handle command ResetCounts; + } + + server cluster AdministratorCommissioning { + callback attribute windowStatus; + callback attribute adminFabricIndex; + callback attribute adminVendorId; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + + handle command OpenCommissioningWindow; + handle command RevokeCommissioning; + } + + server cluster OperationalCredentials { + callback attribute NOCs; + callback attribute fabrics; + callback attribute supportedFabrics; + callback attribute commissionedFabrics; + callback attribute trustedRootCertificates; + callback attribute currentFabricIndex; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + + handle command AttestationRequest; + handle command AttestationResponse; + handle command CertificateChainRequest; + handle command CertificateChainResponse; + handle command CSRRequest; + handle command CSRResponse; + handle command AddNOC; + handle command UpdateNOC; + handle command NOCResponse; + handle command UpdateFabricLabel; + handle command RemoveFabric; + handle command AddTrustedRootCertificate; + } + + server cluster GroupKeyManagement { + callback attribute groupKeyMap; + callback attribute groupTable; + callback attribute maxGroupsPerFabric; + callback attribute maxGroupKeysPerFabric; + callback attribute featureMap; + callback attribute clusterRevision; + + handle command KeySetWrite; + handle command KeySetRead; + handle command KeySetReadResponse; + handle command KeySetRemove; + handle command KeySetReadAllIndices; + handle command KeySetReadAllIndicesResponse; + } + + server cluster IcdManagement { + callback attribute idleModeDuration; + callback attribute activeModeDuration; + callback attribute activeModeThreshold; + callback attribute registeredClients; + callback attribute ICDCounter; + callback attribute clientsSupportedPerFabric; + ram attribute userActiveModeTriggerHint default = 4096; + ram attribute userActiveModeTriggerInstruction default = "Push setup button for Active Mode"; + ram attribute operatingMode default = 0; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0x0007; + ram attribute clusterRevision default = 2; + + handle command RegisterClient; + handle command RegisterClientResponse; + handle command UnregisterClient; + handle command StayActiveRequest; + handle command StayActiveResponse; + } +} +endpoint 1 { + device type ma_contactsensor = 21, version 1; + + + server cluster Identify { + ram attribute identifyTime default = 0x0000; + ram attribute identifyType default = 0x0; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 4; + + handle command Identify; + handle command TriggerEffect; + } + + server cluster Descriptor { + callback attribute deviceTypeList; + callback attribute serverList; + callback attribute clientList; + callback attribute partsList; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute attributeList; + callback attribute featureMap; + callback attribute clusterRevision; + } + + server cluster BooleanState { + emits event StateChange; + ram attribute stateValue default = 0; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + } +} + + diff --git a/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.zap b/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.zap new file mode 100644 index 00000000000000..3e5035049d7808 --- /dev/null +++ b/examples/contact-sensor-app/nxp/zap-lit/contact-sensor-app.zap @@ -0,0 +1,4161 @@ +{ + "fileFormat": 2, + "featureLevel": 99, + "creator": "zap", + "keyValuePairs": [ + { + "key": "commandDiscovery", + "value": "1" + }, + { + "key": "defaultResponsePolicy", + "value": "always" + }, + { + "key": "manufacturerCodes", + "value": "0x1002" + } + ], + "package": [ + { + "pathRelativity": "relativeToZap", + "path": "../../../../src/app/zap-templates/zcl/zcl.json", + "type": "zcl-properties", + "category": "matter", + "version": 1, + "description": "Matter SDK ZCL data" + }, + { + "pathRelativity": "relativeToZap", + "path": "../../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", + "version": "chip-v1" + } + ], + "endpointTypes": [ + { + "id": 1, + "name": "MA-rootdevice", + "deviceTypeRef": { + "code": 22, + "profileId": 259, + "label": "MA-rootdevice", + "name": "MA-rootdevice" + }, + "deviceTypes": [ + { + "code": 22, + "profileId": 259, + "label": "MA-rootdevice", + "name": "MA-rootdevice" + } + ], + "deviceVersions": [ + 2 + ], + "deviceIdentifiers": [ + 22 + ], + "deviceTypeName": "MA-rootdevice", + "deviceTypeCode": 22, + "deviceTypeProfileId": 259, + "clusters": [ + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "DeviceTypeList", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ServerList", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientList", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PartsList", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Access Control", + "code": 31, + "mfgCode": null, + "define": "ACCESS_CONTROL_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "ACL", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SubjectsPerAccessControlEntry", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TargetsPerAccessControlEntry", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AccessControlEntriesPerFabric", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "AccessControlEntryChanged", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "AccessControlExtensionChanged", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, + { + "name": "Basic Information", + "code": 40, + "mfgCode": null, + "define": "BASIC_INFORMATION_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "DataModelRevision", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "VendorName", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "VendorID", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "vendor_id", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductName", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ProductID", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "NodeLabel", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "NVM", + "singleton": 1, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "Location", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "HardwareVersion", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "HardwareVersionString", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SoftwareVersion", + "code": 9, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SoftwareVersionString", + "code": 10, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CapabilityMinima", + "code": 19, + "mfgCode": null, + "side": "server", + "type": "CapabilityMinimaStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SpecificationVersion", + "code": 21, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaxPathsPerInvoke", + "code": 22, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 1, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "StartUp", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "ShutDown", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "Leave", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, + { + "name": "OTA Software Update Provider", + "code": 41, + "mfgCode": null, + "define": "OTA_SOFTWARE_UPDATE_PROVIDER_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "QueryImage", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "QueryImageResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ApplyUpdateRequest", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "ApplyUpdateResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "NotifyUpdateApplied", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "OTA Software Update Requestor", + "code": 42, + "mfgCode": null, + "define": "OTA_SOFTWARE_UPDATE_REQUESTOR_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "AnnounceOTAProvider", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "DefaultOTAProviders", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "UpdatePossible", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "UpdateState", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "UpdateStateEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "UpdateStateProgress", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "StateTransition", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "VersionApplied", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "DownloadError", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, + { + "name": "General Commissioning", + "code": 48, + "mfgCode": null, + "define": "GENERAL_COMMISSIONING_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "ArmFailSafe", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ArmFailSafeResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "SetRegulatoryConfig", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "SetRegulatoryConfigResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "CommissioningComplete", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "CommissioningCompleteResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "Breadcrumb", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000000000000000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "BasicCommissioningInfo", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "BasicCommissioningInfo", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RegulatoryConfig", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "RegulatoryLocationTypeEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LocationCapability", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "RegulatoryLocationTypeEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SupportsConcurrentConnection", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Network Commissioning", + "code": 49, + "mfgCode": null, + "define": "NETWORK_COMMISSIONING_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "ScanNetworks", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ScanNetworksResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "AddOrUpdateThreadNetwork", + "code": 3, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RemoveNetwork", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "NetworkConfigResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "ConnectNetwork", + "code": 6, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "ConnectNetworkResponse", + "code": 7, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "ReorderNetwork", + "code": 8, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "MaxNetworks", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Networks", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ScanMaxTimeSeconds", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ConnectMaxTimeSeconds", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "InterfaceEnabled", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LastNetworkingStatus", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "NetworkCommissioningStatusEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LastNetworkID", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "octet_string", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "LastConnectErrorValue", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "int32s", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SupportedThreadFeatures", + "code": 9, + "mfgCode": null, + "side": "server", + "type": "ThreadCapabilitiesBitmap", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ThreadVersion", + "code": 10, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "General Diagnostics", + "code": 51, + "mfgCode": null, + "define": "GENERAL_DIAGNOSTICS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "TestEventTrigger", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "TimeSnapshot", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "TimeSnapshotResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "NetworkInterfaces", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RebootCount", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "UpTime", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveNetworkFaults", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "TestEventTriggersEnabled", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "false", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "BootReason", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, + { + "name": "Software Diagnostics", + "code": 52, + "mfgCode": null, + "define": "SOFTWARE_DIAGNOSTICS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "ResetWatermarks", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "ThreadMetrics", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentHeapFree", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentHeapUsed", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentHeapHighWatermark", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Thread Network Diagnostics", + "code": 53, + "mfgCode": null, + "define": "THREAD_NETWORK_DIAGNOSTICS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "ResetCounts", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "Channel", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RoutingRole", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "RoutingRoleEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "NetworkName", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "PanId", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ExtendedPanId", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "MeshLocalPrefix", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "octet_string", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "OverrunCount", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "NeighborTable", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RouteTable", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "PartitionId", + "code": 9, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "Weighting", + "code": 10, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "DataVersion", + "code": 11, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "StableDataVersion", + "code": 12, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "LeaderRouterId", + "code": 13, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "DetachedRoleCount", + "code": 14, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ChildRoleCount", + "code": 15, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RouterRoleCount", + "code": 16, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "LeaderRoleCount", + "code": 17, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "AttachAttemptCount", + "code": 18, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "PartitionIdChangeCount", + "code": 19, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "BetterPartitionAttachAttemptCount", + "code": 20, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ParentChangeCount", + "code": 21, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxTotalCount", + "code": 22, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxUnicastCount", + "code": 23, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxBroadcastCount", + "code": 24, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxAckRequestedCount", + "code": 25, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxAckedCount", + "code": 26, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxNoAckRequestedCount", + "code": 27, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxDataCount", + "code": 28, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxDataPollCount", + "code": 29, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxBeaconCount", + "code": 30, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxBeaconRequestCount", + "code": 31, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxOtherCount", + "code": 32, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxRetryCount", + "code": 33, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxDirectMaxRetryExpiryCount", + "code": 34, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxIndirectMaxRetryExpiryCount", + "code": 35, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxErrCcaCount", + "code": 36, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxErrAbortCount", + "code": 37, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TxErrBusyChannelCount", + "code": 38, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxTotalCount", + "code": 39, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxUnicastCount", + "code": 40, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxBroadcastCount", + "code": 41, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxDataCount", + "code": 42, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxDataPollCount", + "code": 43, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxBeaconCount", + "code": 44, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxBeaconRequestCount", + "code": 45, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxOtherCount", + "code": 46, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxAddressFilteredCount", + "code": 47, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxDestAddrFilteredCount", + "code": 48, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxDuplicatedCount", + "code": 49, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrNoFrameCount", + "code": 50, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrUnknownNeighborCount", + "code": 51, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrInvalidSrcAddrCount", + "code": 52, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrSecCount", + "code": 53, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrFcsCount", + "code": 54, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "RxErrOtherCount", + "code": 55, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SecurityPolicy", + "code": 59, + "mfgCode": null, + "side": "server", + "type": "SecurityPolicy", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ChannelPage0Mask", + "code": 60, + "mfgCode": null, + "side": "server", + "type": "octet_string", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "OperationalDatasetComponents", + "code": 61, + "mfgCode": null, + "side": "server", + "type": "OperationalDatasetComponents", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ActiveNetworkFaultsList", + "code": 62, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x000F", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Administrator Commissioning", + "code": 60, + "mfgCode": null, + "define": "ADMINISTRATOR_COMMISSIONING_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "OpenCommissioningWindow", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RevokeCommissioning", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "WindowStatus", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "CommissioningWindowStatusEnum", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AdminFabricIndex", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "fabric_idx", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AdminVendorId", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "vendor_id", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Operational Credentials", + "code": 62, + "mfgCode": null, + "define": "OPERATIONAL_CREDENTIALS_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "AttestationRequest", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "AttestationResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "CertificateChainRequest", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "CertificateChainResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "CSRRequest", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "CSRResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "AddNOC", + "code": 6, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "UpdateNOC", + "code": 7, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "NOCResponse", + "code": 8, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "UpdateFabricLabel", + "code": 9, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RemoveFabric", + "code": 10, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "AddTrustedRootCertificate", + "code": 11, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "NOCs", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Fabrics", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "SupportedFabrics", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CommissionedFabrics", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "TrustedRootCertificates", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CurrentFabricIndex", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Group Key Management", + "code": 63, + "mfgCode": null, + "define": "GROUP_KEY_MANAGEMENT_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "KeySetWrite", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "KeySetRead", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "KeySetReadResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "KeySetRemove", + "code": 3, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "KeySetReadAllIndices", + "code": 4, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "KeySetReadAllIndicesResponse", + "code": 5, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "GroupKeyMap", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GroupTable", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaxGroupsPerFabric", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "MaxGroupKeysPerFabric", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "ICD Management", + "code": 70, + "mfgCode": null, + "define": "ICD_MANAGEMENT_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "RegisterClient", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "RegisterClientResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + }, + { + "name": "UnregisterClient", + "code": 2, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "StayActiveRequest", + "code": 3, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "StayActiveResponse", + "code": 4, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "IdleModeDuration", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveModeDuration", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ActiveModeThreshold", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "RegisteredClients", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ICDCounter", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "int32u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientsSupportedPerFabric", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "UserActiveModeTriggerHint", + "code": 6, + "mfgCode": null, + "side": "server", + "type": "UserActiveModeTriggerBitmap", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4096", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "UserActiveModeTriggerInstruction", + "code": 7, + "mfgCode": null, + "side": "server", + "type": "char_string", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "Push setup button for Active Mode", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "OperatingMode", + "code": 8, + "mfgCode": null, + "side": "server", + "type": "OperatingModeEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0007", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + } + ] + }, + { + "id": 2, + "name": "MA-dimmablelight", + "deviceTypeRef": { + "code": 21, + "profileId": 259, + "label": "MA-contactsensor", + "name": "MA-contactsensor" + }, + "deviceTypes": [ + { + "code": 21, + "profileId": 259, + "label": "MA-contactsensor", + "name": "MA-contactsensor" + } + ], + "deviceVersions": [ + 1 + ], + "deviceIdentifiers": [ + 21 + ], + "deviceTypeName": "MA-contactsensor", + "deviceTypeCode": 21, + "deviceTypeProfileId": 259, + "clusters": [ + { + "name": "Identify", + "code": 3, + "mfgCode": null, + "define": "IDENTIFY_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "Identify", + "code": 0, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "TriggerEffect", + "code": 64, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + } + ], + "attributes": [ + { + "name": "IdentifyTime", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0000", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "IdentifyType", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "IdentifyTypeEnum", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Descriptor", + "code": 29, + "mfgCode": null, + "define": "DESCRIPTOR_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "DeviceTypeList", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ServerList", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientList", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "PartsList", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Boolean State", + "code": 69, + "mfgCode": null, + "define": "BOOLEAN_STATE_CLUSTER", + "side": "server", + "enabled": 1, + "attributes": [ + { + "name": "StateValue", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "boolean", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "StateChange", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + } + ] + } + ], + "endpoints": [ + { + "endpointTypeName": "MA-rootdevice", + "endpointTypeIndex": 0, + "profileId": 259, + "endpointId": 0, + "networkId": 0 + }, + { + "endpointTypeName": "MA-dimmablelight", + "endpointTypeIndex": 1, + "profileId": 259, + "endpointId": 1, + "networkId": 0 + } + ] +} \ No newline at end of file diff --git a/examples/contact-sensor-app/nxp/zap-sit/BUILD.gn b/examples/contact-sensor-app/nxp/zap-sit/BUILD.gn new file mode 100644 index 00000000000000..e9a20db41208d3 --- /dev/null +++ b/examples/contact-sensor-app/nxp/zap-sit/BUILD.gn @@ -0,0 +1,25 @@ +# Copyright (c) 2023 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. + +import("//build_overrides/chip.gni") +import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") +import("${chip_root}/src/app/chip_data_model.gni") + +chip_data_model("zap-sit") { + zap_file = "contact-sensor-app.zap" + + zap_pregenerated_dir = + "${chip_root}/zzz_generated/contact-sensor-app/nxp/zap-generated" + is_server = true +} diff --git a/examples/contact-sensor-app/nxp/zap/contact-sensor-app.matter b/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.matter similarity index 97% rename from examples/contact-sensor-app/nxp/zap/contact-sensor-app.matter rename to examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.matter index 03736833bb02d3..479f8baa86284c 100644 --- a/examples/contact-sensor-app/nxp/zap/contact-sensor-app.matter +++ b/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.matter @@ -1370,6 +1370,9 @@ endpoint 0 { callback attribute subjectsPerAccessControlEntry; callback attribute targetsPerAccessControlEntry; callback attribute accessControlEntriesPerFabric; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; callback attribute clusterRevision; @@ -1393,6 +1396,10 @@ endpoint 0 { callback attribute capabilityMinima; callback attribute specificationVersion; callback attribute maxPathsPerInvoke; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 2; } @@ -1417,6 +1424,10 @@ endpoint 0 { callback attribute regulatoryConfig; callback attribute locationCapability; callback attribute supportsConcurrentConnection; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; @@ -1437,8 +1448,14 @@ endpoint 0 { ram attribute lastNetworkingStatus; ram attribute lastNetworkID; ram attribute lastConnectErrorValue; + ram attribute supportedThreadFeatures; + ram attribute threadVersion; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; ram attribute featureMap default = 2; - ram attribute clusterRevision default = 1; + ram attribute clusterRevision default = 2; handle command ScanNetworks; handle command ScanNetworksResponse; @@ -1454,12 +1471,19 @@ endpoint 0 { emits event BootReason; callback attribute networkInterfaces; callback attribute rebootCount; + callback attribute upTime; callback attribute activeNetworkFaults; callback attribute testEventTriggersEnabled default = false; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; callback attribute featureMap; callback attribute clusterRevision; handle command TestEventTrigger; + handle command TimeSnapshot; + handle command TimeSnapshotResponse; } server cluster SoftwareDiagnostics { @@ -1534,8 +1558,12 @@ endpoint 0 { callback attribute channelPage0Mask; callback attribute operationalDatasetComponents; callback attribute activeNetworkFaultsList; + callback attribute generatedCommandList; + callback attribute acceptedCommandList; + callback attribute eventList; + callback attribute attributeList; ram attribute featureMap default = 0x000F; - ram attribute clusterRevision default = 1; + ram attribute clusterRevision default = 2; handle command ResetCounts; } @@ -1637,6 +1665,7 @@ endpoint 1 { ram attribute stateValue default = 0; callback attribute generatedCommandList; callback attribute acceptedCommandList; + callback attribute eventList; callback attribute attributeList; ram attribute featureMap default = 0; ram attribute clusterRevision default = 1; diff --git a/examples/contact-sensor-app/nxp/zap/contact-sensor-app.zap b/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.zap similarity index 88% rename from examples/contact-sensor-app/nxp/zap/contact-sensor-app.zap rename to examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.zap index bf037957bd2629..d7145e74d9fe0b 100644 --- a/examples/contact-sensor-app/nxp/zap/contact-sensor-app.zap +++ b/examples/contact-sensor-app/nxp/zap-sit/contact-sensor-app.zap @@ -139,10 +139,10 @@ "side": "server", "type": "bitmap32", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -238,6 +238,54 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AttributeList", "code": 65531, @@ -514,7 +562,7 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -530,7 +578,71 @@ "storageOption": "External", "singleton": 1, "bounded": 0, - "defaultValue": "", + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 1, + "bounded": 0, + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -938,6 +1050,70 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "FeatureMap", "code": 65532, @@ -1174,6 +1350,102 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "SupportedThreadFeatures", + "code": 9, + "mfgCode": null, + "side": "server", + "type": "ThreadCapabilitiesBitmap", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ThreadVersion", + "code": 10, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "FeatureMap", "code": 65532, @@ -1200,7 +1472,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": "2", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -1223,6 +1495,22 @@ "source": "client", "isIncoming": 1, "isEnabled": 1 + }, + { + "name": "TimeSnapshot", + "code": 1, + "mfgCode": null, + "source": "client", + "isIncoming": 1, + "isEnabled": 1 + }, + { + "name": "TimeSnapshotResponse", + "code": 2, + "mfgCode": null, + "source": "server", + "isIncoming": 0, + "isEnabled": 1 } ], "attributes": [ @@ -1258,6 +1546,22 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "UpTime", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "int64u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ActiveNetworkFaults", "code": 7, @@ -1290,6 +1594,70 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "FeatureMap", "code": 65532, @@ -1297,10 +1665,10 @@ "side": "server", "type": "bitmap32", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -1313,10 +1681,10 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": null, "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2427,6 +2795,70 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "FeatureMap", "code": 65532, @@ -2453,7 +2885,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": "2", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -3411,10 +3843,10 @@ "side": "server", "type": "bitmap32", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -3494,6 +3926,22 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": null, + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "AttributeList", "code": 65531, @@ -3571,6 +4019,5 @@ "endpointId": 1, "networkId": 0 } - ], - "log": [] + ] } \ No newline at end of file diff --git a/examples/lighting-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h b/examples/lighting-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h index 536b822d776377..05f8042ed28138 100644 --- a/examples/lighting-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h +++ b/examples/lighting-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h @@ -139,11 +139,11 @@ * {MAJOR_VERSION}.0d{MINOR_VERSION} */ #ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "03-2022-te8" +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING NXP_CONFIG_DEVICE_SOFTWARE_VERSION_STRING #endif #ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION -#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 42020 +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION NXP_CONFIG_DEVICE_SOFTWARE_VERSION #endif #ifndef CHIP_DEVICE_CONFIG_DEVICE_VENDOR_NAME diff --git a/src/platform/nxp/k32w/k32w0/CHIPPlatformConfig.h b/src/platform/nxp/k32w/k32w0/CHIPPlatformConfig.h index 830024033fc0e7..8ae71ce32aeae2 100644 --- a/src/platform/nxp/k32w/k32w0/CHIPPlatformConfig.h +++ b/src/platform/nxp/k32w/k32w0/CHIPPlatformConfig.h @@ -80,11 +80,11 @@ #if NXP_ICD_ENABLED #ifndef CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC -#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC NXP_IDLE_MODE_INTERVAL +#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC NXP_IDLE_MODE_DURATION_SEC #endif // CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC #ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS -#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS NXP_ACTIVE_MODE_INTERVAL +#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS NXP_ACTIVE_MODE_DURATION_MS #endif // CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS #ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS diff --git a/src/platform/nxp/k32w/k32w1/CHIPPlatformConfig.h b/src/platform/nxp/k32w/k32w1/CHIPPlatformConfig.h index cacc28dd4a60d6..9d43598ca3583f 100644 --- a/src/platform/nxp/k32w/k32w1/CHIPPlatformConfig.h +++ b/src/platform/nxp/k32w/k32w1/CHIPPlatformConfig.h @@ -80,11 +80,11 @@ #if NXP_ICD_ENABLED #ifndef CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC -#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC NXP_IDLE_MODE_INTERVAL +#define CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC NXP_IDLE_MODE_DURATION_SEC #endif // CHIP_CONFIG_ICD_IDLE_MODE_DURATION_SEC #ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS -#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS NXP_ACTIVE_MODE_INTERVAL +#define CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS NXP_ACTIVE_MODE_DURATION_MS #endif // CHIP_CONFIG_ICD_ACTIVE_MODE_DURATION_MS #ifndef CHIP_CONFIG_ICD_ACTIVE_MODE_THRESHOLD_MS diff --git a/third_party/nxp/k32w0_sdk/k32w0_sdk.gni b/third_party/nxp/k32w0_sdk/k32w0_sdk.gni index ab37141606f19a..754ac91df80875 100644 --- a/third_party/nxp/k32w0_sdk/k32w0_sdk.gni +++ b/third_party/nxp/k32w0_sdk/k32w0_sdk.gni @@ -49,19 +49,18 @@ declare_args() { ota_custom_entry_address = "0x000C1000" use_antenna_diversity = 0 - #ICD Matter Configuration flags + chip_with_ota_encryption = 0 + chip_with_ota_key = "1234567890ABCDEFA1B2C3D4E5F6F1B4" + chip_with_sdk_package = 1 - chip_ot_idle_interval_ms = 2000 # 2s Idle Intervals - chip_ot_active_interval_ms = 500 # 500ms Active Intervals + # ICD Matter Configuration flags + nxp_ot_idle_interval_ms = 2000 # 2s Idle Intervals + nxp_ot_active_interval_ms = 500 # 500ms Active Intervals - nxp_idle_mode_interval_s = 600 # 10min Idle Mode Interval - nxp_active_mode_interval_ms = 10000 # 10s Active Mode Interval + nxp_idle_mode_duration_s = 600 # 10min Idle Mode Interval + nxp_active_mode_duration_ms = 10000 # 10s Active Mode Interval nxp_active_mode_threshold_ms = 1000 # 1s Active Mode Threshold nxp_icd_supported_clients_per_fabric = 2 # 2 registration slots per fabric - - chip_with_ota_encryption = 0 - chip_with_ota_key = "1234567890ABCDEFA1B2C3D4E5F6F1B4" - chip_with_sdk_package = 1 } assert(k32w0_sdk_root != "", "k32w0_sdk_root must be specified") @@ -367,12 +366,12 @@ template("k32w0_sdk") { "gResetSystemReset_d=1", # TODO: move these platform specific defines to args.gni - "NXP_OT_IDLE_INTERVAL=${chip_ot_idle_interval_ms}", - "NXP_OT_ACTIVE_INTERVAL=${chip_ot_active_interval_ms}", + "NXP_OT_IDLE_INTERVAL=${nxp_ot_idle_interval_ms}", + "NXP_OT_ACTIVE_INTERVAL=${nxp_ot_active_interval_ms}", "NXP_ICD_ENABLED=1", "NXP_ACTIVE_MODE_THRESHOLD=${nxp_active_mode_threshold_ms}", - "NXP_ACTIVE_MODE_INTERVAL=${nxp_active_mode_interval_ms}", - "NXP_IDLE_MODE_INTERVAL=${nxp_idle_mode_interval_s}", + "NXP_ACTIVE_MODE_DURATION_MS=${nxp_active_mode_duration_ms}", + "NXP_IDLE_MODE_DURATION_SEC=${nxp_idle_mode_duration_s}", "NXP_ICD_SUPPORTED_CLIENTS_PER_FABRIC=${nxp_icd_supported_clients_per_fabric}", ] diff --git a/third_party/nxp/k32w1_sdk/k32w1_sdk.gni b/third_party/nxp/k32w1_sdk/k32w1_sdk.gni index 7a8bf40afe7a04..d6d9f6146086d7 100644 --- a/third_party/nxp/k32w1_sdk/k32w1_sdk.gni +++ b/third_party/nxp/k32w1_sdk/k32w1_sdk.gni @@ -36,15 +36,6 @@ declare_args() { use_smu2_dynamic = false use_hw_sha256 = false use_hw_aes = false - - # ICD Matter Configuration flags - chip_ot_idle_interval_ms = 2000 # 2s Idle Intervals - chip_ot_active_interval_ms = 500 # 500ms Active Intervals - - nxp_idle_mode_interval_s = 600 # 10min Idle Mode Interval - nxp_active_mode_interval_ms = 10000 # 10s Active Mode Interval - nxp_active_mode_threshold_ms = 1000 # 1s Active Mode Threshold - nxp_icd_supported_clients_per_fabric = 2 # 2 registration slots per fabric } openthread_nxp_root = "${chip_root}/third_party/openthread/ot-nxp" @@ -270,12 +261,12 @@ template("k32w1_sdk") { "gConnectPowerLeveldBm_c=0", #move these platform specific defines to args.gni - "NXP_OT_IDLE_INTERVAL=${chip_ot_idle_interval_ms}", - "NXP_OT_ACTIVE_INTERVAL=${chip_ot_active_interval_ms}", + "NXP_OT_IDLE_INTERVAL=${nxp_ot_idle_interval_ms}", + "NXP_OT_ACTIVE_INTERVAL=${nxp_ot_active_interval_ms}", "NXP_ICD_ENABLED=1", "NXP_ACTIVE_MODE_THRESHOLD=${nxp_active_mode_threshold_ms}", - "NXP_ACTIVE_MODE_INTERVAL=${nxp_active_mode_interval_ms}", - "NXP_IDLE_MODE_INTERVAL=${nxp_idle_mode_interval_s}", + "NXP_ACTIVE_MODE_DURATION_MS=${nxp_active_mode_duration_ms}", + "NXP_IDLE_MODE_DURATION_SEC=${nxp_idle_mode_duration_s}", "NXP_ICD_SUPPORTED_CLIENTS_PER_FABRIC=${nxp_icd_supported_clients_per_fabric}", ] @@ -358,6 +349,15 @@ template("k32w1_sdk") { defines += [ "USE_HW_AES" ] } + if (nxp_software_version != "") { + defines += + [ "NXP_CONFIG_DEVICE_SOFTWARE_VERSION=${nxp_software_version}" ] + } + + if (nxp_software_version_string != "") { + defines += [ "NXP_CONFIG_DEVICE_SOFTWARE_VERSION_STRING=\"${nxp_software_version_string}\"" ] + } + if (defined(invoker.defines)) { defines += invoker.defines } diff --git a/third_party/nxp/nxp_sdk.gni b/third_party/nxp/nxp_sdk.gni index d87d99d2911ae2..da66a0d51c5721 100644 --- a/third_party/nxp/nxp_sdk.gni +++ b/third_party/nxp/nxp_sdk.gni @@ -45,7 +45,16 @@ declare_args() { nxp_software_version = 1 # Defines the current software string version - nxp_software_version_string = "1.1" + nxp_software_version_string = "1.3" + + # ICD Matter Configuration flags + nxp_ot_idle_interval_ms = 2000 # 2s Idle Intervals + nxp_ot_active_interval_ms = 500 # 500ms Active Intervals + + nxp_idle_mode_duration_s = 600 # 10min Idle Mode Interval + nxp_active_mode_duration_ms = 10000 # 10s Active Mode Interval + nxp_active_mode_threshold_ms = 1000 # 1s Active Mode Threshold + nxp_icd_supported_clients_per_fabric = 2 # 2 registration slots per fabric } declare_args() { From fc61ca0790d392a61ef616847ab36e8a006e4a1d Mon Sep 17 00:00:00 2001 From: dinabenamar <108664279+dinabenamar@users.noreply.github.com> Date: Thu, 22 Feb 2024 16:25:32 +0100 Subject: [PATCH 13/29] [Docker][NXP] Update Docker image for RW61X SDK (#32240) --- integrations/docker/images/base/chip-build/version | 2 +- .../docker/images/stage-2/chip-build-rw61x/Dockerfile | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integrations/docker/images/base/chip-build/version b/integrations/docker/images/base/chip-build/version index 3f8f2543a19424..7c7cf32a71a021 100644 --- a/integrations/docker/images/base/chip-build/version +++ b/integrations/docker/images/base/chip-build/version @@ -1 +1 @@ -36 : [Silabs] Update GeckoSDK and WIFI SDK +37 : [NXP] Update Docker image for RW61X SDK diff --git a/integrations/docker/images/stage-2/chip-build-rw61x/Dockerfile b/integrations/docker/images/stage-2/chip-build-rw61x/Dockerfile index 02053b183b402c..399609fe170c49 100644 --- a/integrations/docker/images/stage-2/chip-build-rw61x/Dockerfile +++ b/integrations/docker/images/stage-2/chip-build-rw61x/Dockerfile @@ -14,9 +14,9 @@ WORKDIR /opt/sdk # Setup RW61x SDK RUN set -x \ && mkdir -p rw61x \ - && wget https://www.nxp.com/lgfiles/bsps/SDK_2_13_2_RD-RW612-BGA.zip \ - && unzip SDK_2_13_2_RD-RW612-BGA.zip -d rw61x \ - && rm -rf SDK_2_13_2_RD-RW612-BGA.zip \ + && wget https://www.nxp.com/lgfiles/bsps/SDK_2_13_3_RD-RW612-BGA.zip \ + && unzip SDK_2_13_3_RD-RW612-BGA.zip -d rw61x \ + && rm -rf SDK_2_13_3_RD-RW612-BGA.zip \ && : # last line FROM ghcr.io/project-chip/chip-build:${VERSION} From c5ab509360749485cd1267b2b43d27ed4f3c29ea Mon Sep 17 00:00:00 2001 From: chirag-silabs <100861685+chirag-silabs@users.noreply.github.com> Date: Thu, 22 Feb 2024 21:15:05 +0530 Subject: [PATCH 14/29] [Silabs][SiWx917] 917 SoC and NCP sleepy Improvements for the better power consumption (#32216) * letting our device sleep when it is uncommissioned * using the default clk for the 917 SoC * reducing the firmware retry to 5 * formatting changes reverting which was not needed * Restyled by clang-format * fix the warning for the 917 SoC * Restyled by clang-format * addressing review comments --------- Co-authored-by: Restyled.io --- examples/platform/silabs/BaseApplication.cpp | 26 ++++++++- examples/platform/silabs/BaseApplication.h | 15 +++++ examples/platform/silabs/MatterConfig.cpp | 10 ++-- .../silabs/SiWx917/SiWx917/sl_wifi_if.c | 31 ++++++++--- .../platform/silabs/SiWx917/SiWx917/wfx_rsi.h | 2 +- .../silabs/SiWx917/SiWx917/wfx_rsi_host.c | 7 ++- .../efr32/rs911x/hal/sl_board_configuration.h | 2 - .../platform/silabs/efr32/rs911x/wfx_rsi.h | 4 ++ .../silabs/efr32/rs911x/wfx_rsi_host.c | 16 ++++++ .../silabs/ConnectivityManagerImpl_WIFI.cpp | 4 ++ .../silabs/SiWx917/OTAImageProcessorImpl.cpp | 55 +++++++++++++++---- .../silabs/SiWx917/wifi/wfx_host_events.h | 6 +- .../silabs/SiWx917/wifi/wfx_notify.cpp | 40 ++++++++++++++ .../silabs/efr32/wifi/wfx_host_events.h | 7 +++ .../platformAbstraction/WiseMcuSpam.cpp | 2 + 15 files changed, 193 insertions(+), 34 deletions(-) diff --git a/examples/platform/silabs/BaseApplication.cpp b/examples/platform/silabs/BaseApplication.cpp index 4216dbb4864452..c98882f30aba96 100644 --- a/examples/platform/silabs/BaseApplication.cpp +++ b/examples/platform/silabs/BaseApplication.cpp @@ -146,6 +146,9 @@ Identify gIdentify = { bool BaseApplication::sIsProvisioned = false; bool BaseApplication::sIsFactoryResetTriggered = false; LEDWidget * BaseApplication::sAppActionLed = nullptr; +#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 +BaseApplicationDelegate BaseApplication::sAppDelegate = BaseApplicationDelegate(); +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 #ifdef DIC_ENABLE namespace { @@ -163,6 +166,28 @@ void AppSpecificConnectivityEventCallback(const ChipDeviceEvent * event, intptr_ } // namespace #endif // DIC_ENABLE +#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 +void BaseApplicationDelegate::OnCommissioningSessionStarted() +{ + isComissioningStarted = true; +} +void BaseApplicationDelegate::OnCommissioningSessionStopped() +{ + isComissioningStarted = false; +} +void BaseApplicationDelegate::OnCommissioningWindowClosed() +{ + if (!BaseApplication::GetProvisionStatus() && !isComissioningStarted) + { + int32_t status = wfx_power_save(RSI_SLEEP_MODE_8, STANDBY_POWER_SAVE_WITH_RAM_RETENTION); + if (status != SL_STATUS_OK) + { + ChipLogError(DeviceLayer, "Failed to enable the TA Deep Sleep"); + } + } +} +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 + /********************************************************** * AppTask Definitions *********************************************************/ @@ -261,7 +286,6 @@ CHIP_ERROR BaseApplication::Init() #if CHIP_ENABLE_OPENTHREAD BaseApplication::sIsProvisioned = ConnectivityMgr().IsThreadProvisioned(); #endif - return err; } diff --git a/examples/platform/silabs/BaseApplication.h b/examples/platform/silabs/BaseApplication.h index 1714f47024f2c2..1a5c55587d76fe 100644 --- a/examples/platform/silabs/BaseApplication.h +++ b/examples/platform/silabs/BaseApplication.h @@ -30,6 +30,7 @@ #include "FreeRTOS.h" #include "timers.h" // provides FreeRTOS timer support #include +#include #include #include #include @@ -62,6 +63,17 @@ #define APP_ERROR_START_TIMER_FAILED CHIP_APPLICATION_ERROR(0x05) #define APP_ERROR_STOP_TIMER_FAILED CHIP_APPLICATION_ERROR(0x06) +#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 +class BaseApplicationDelegate : public AppDelegate +{ +private: + bool isComissioningStarted; + void OnCommissioningSessionStarted() override; + void OnCommissioningSessionStopped() override; + void OnCommissioningWindowClosed() override; +}; +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 + /********************************************************** * BaseApplication Declaration *********************************************************/ @@ -75,6 +87,9 @@ class BaseApplication static bool sIsProvisioned; static bool sIsFactoryResetTriggered; static LEDWidget * sAppActionLed; +#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 + static BaseApplicationDelegate sAppDelegate; +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 /** * @brief Create AppTask task and Event Queue diff --git a/examples/platform/silabs/MatterConfig.cpp b/examples/platform/silabs/MatterConfig.cpp index e9fed8d924c3e0..32bf04cf0e0f7b 100644 --- a/examples/platform/silabs/MatterConfig.cpp +++ b/examples/platform/silabs/MatterConfig.cpp @@ -18,6 +18,7 @@ */ #include "AppConfig.h" +#include "BaseApplication.h" #include "OTAConfig.h" #include @@ -254,6 +255,9 @@ CHIP_ERROR SilabsMatterConfig::InitMatter(const char * appName) initParams.endpointNativeParams = static_cast(&nativeParams); #endif +#if CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 + initParams.appDelegate = &BaseApplication::sAppDelegate; +#endif // CHIP_CONFIG_ENABLE_ICD_SERVER && SLI_SI917 // Init Matter Server and Start Event Loop err = chip::Server::GetInstance().Init(initParams); @@ -303,10 +307,6 @@ CHIP_ERROR SilabsMatterConfig::InitWiFi(void) extern "C" void vApplicationIdleHook(void) { #if SIWX_917 && CHIP_CONFIG_ENABLE_ICD_SERVER - if (ConnectivityMgr().IsWiFiStationConnected()) - { - // Let the M4 sleep once commissioning is done and device is in idle state - sl_wfx_host_si91x_sleep_wakeup(); - } + sl_wfx_host_si91x_sleep_wakeup(); #endif } diff --git a/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.c b/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.c index 6dcfcfaf46aaac..c5044fcf255a8e 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.c +++ b/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.c @@ -44,6 +44,7 @@ #if SL_ICD_ENABLED && SIWX_917 #include "rsi_rom_power_save.h" #include "sl_si91x_button_pin_config.h" +#include "sl_si91x_driver.h" #include "sl_si91x_m4_ps.h" // TODO: should be removed once we are getting the press interrupt for button 0 with sleep @@ -188,8 +189,8 @@ sl_status_t join_callback_handler(sl_wifi_event_t event, char * result, uint32_t SILABS_LOG("F: Join Event received with %u bytes payload\n", result_length); callback_status = *(sl_status_t *) result; wfx_rsi.dev_state &= ~(WFX_RSI_ST_STA_CONNECTED); - wfx_retry_interval_handler(is_wifi_disconnection_event, wfx_rsi.join_retries++); is_wifi_disconnection_event = true; + wfx_retry_interval_handler(is_wifi_disconnection_event, wfx_rsi.join_retries++); if (is_wifi_disconnection_event || wfx_rsi.join_retries <= WFX_RSI_CONFIG_MAX_JOIN) { xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_START_JOIN); @@ -256,28 +257,36 @@ void sl_wfx_host_si91x_sleep_wakeup() * @brief * Setting the RS911x in DTIM sleep based mode * - * @param[in] None + * @param[in] sl_si91x_ble_state : State to set for the BLE + sl_si91x_wifi_state : State to set for the WiFi * @return * None *********************************************************************/ -int32_t wfx_rsi_power_save() +int32_t wfx_rsi_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_si91x_performance_profile_t sl_si91x_wifi_state) { int32_t status; - status = rsi_bt_power_save_profile(2, 0); + + status = rsi_bt_power_save_profile(sl_si91x_ble_state, 0); if (status != RSI_SUCCESS) { SILABS_LOG("BT Powersave Config Failed, Error Code : 0x%lX", status); return status; } - - sl_wifi_performance_profile_t wifi_profile = { .profile = ASSOCIATED_POWER_SAVE }; + sl_wifi_performance_profile_t wifi_profile = { .profile = sl_si91x_wifi_state }; status = sl_wifi_set_performance_profile(&wifi_profile); if (status != RSI_SUCCESS) { SILABS_LOG("Powersave Config Failed, Error Code : 0x%lX", status); return status; } - wfx_rsi.dev_state |= WFX_RSI_ST_SLEEP_READY; + if (sl_si91x_wifi_state == HIGH_PERFORMANCE) + { + wfx_rsi.dev_state &= ~(WFX_RSI_ST_SLEEP_READY); + } + else + { + wfx_rsi.dev_state |= WFX_RSI_ST_SLEEP_READY; + } return status; } #endif /* SL_ICD_ENABLED */ @@ -376,7 +385,7 @@ static sl_status_t wfx_rsi_init(void) } // Initiate and program the key required for TRNG hardware engine - status = sl_si91x_trng_program_key(trngKey, TRNGKEY_SIZE); + status = sl_si91x_trng_program_key((uint32_t *) trngKey, TRNGKEY_SIZE); if (status != SL_STATUS_OK) { SILABS_LOG("TRNG Key Programming Failed"); @@ -581,10 +590,14 @@ static sl_status_t wfx_rsi_do_join(void) sl_wifi_set_join_callback(join_callback_handler, NULL); +#if SL_ICD_ENABLED // Setting the listen interval to 0 which will set it to DTIM interval sl_wifi_listen_interval_t sleep_interval = { .listen_interval = 0 }; status = sl_wifi_set_listen_interval(SL_WIFI_CLIENT_INTERFACE, sleep_interval); + sl_wifi_advanced_client_configuration_t client_config = { .max_retry_attempts = 5 }; + sl_wifi_set_advanced_client_configuration(SL_WIFI_CLIENT_INTERFACE, &client_config); +#endif // SL_ICD_ENABLED /* Try to connect Wifi with given Credentials * untill there is a success or maximum number of tries allowed */ @@ -629,11 +642,11 @@ static sl_status_t wfx_rsi_do_join(void) wfx_rsi.join_retries); wfx_rsi.join_retries += 1; wfx_rsi.dev_state &= ~(WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED); + wfx_retry_interval_handler(is_wifi_disconnection_event, wfx_rsi.join_retries); if (is_wifi_disconnection_event || wfx_rsi.join_retries <= MAX_JOIN_RETRIES_COUNT) { xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_START_JOIN); } - wfx_retry_interval_handler(is_wifi_disconnection_event, wfx_rsi.join_retries); } } } diff --git a/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h b/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h index 6721071a1de181..998b3ac1ef5d7a 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h +++ b/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi.h @@ -95,7 +95,7 @@ int32_t wfx_rsi_disconnect(); int32_t wfx_wifi_rsi_init(void); #if SL_ICD_ENABLED void sl_wfx_host_si91x_sleep_wakeup(); -int32_t wfx_rsi_power_save(); +int32_t wfx_rsi_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_si91x_performance_profile_t sl_si91x_wifi_state); #endif /* SL_ICD_ENABLED */ #ifdef __cplusplus diff --git a/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi_host.c b/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi_host.c index 0c7efc723eb049..85525fc1bc6dd0 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi_host.c +++ b/examples/platform/silabs/SiWx917/SiWx917/wfx_rsi_host.c @@ -194,13 +194,14 @@ sl_status_t wfx_connect_to_ap(void) * @fn sl_status_t wfx_power_save() * @brief * Implements the power save in sleepy application - * @param[in] None + * @param[in] sl_si91x_ble_state : State to set for the BLE + sl_si91x_wifi_state : State to set for the WiFi * @return SL_STATUS_OK if successful, * SL_STATUS_FAIL otherwise ***********************************************************************/ -sl_status_t wfx_power_save() +sl_status_t wfx_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_si91x_performance_profile_t sl_si91x_wifi_state) { - if (wfx_rsi_power_save() != SL_STATUS_OK) + if (wfx_rsi_power_save(sl_si91x_ble_state, sl_si91x_wifi_state) != SL_STATUS_OK) { return SL_STATUS_FAIL; } diff --git a/examples/platform/silabs/efr32/rs911x/hal/sl_board_configuration.h b/examples/platform/silabs/efr32/rs911x/hal/sl_board_configuration.h index 4310bf719f8179..5591467580bbc4 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/sl_board_configuration.h +++ b/examples/platform/silabs/efr32/rs911x/hal/sl_board_configuration.h @@ -48,6 +48,4 @@ typedef struct #define INTERRUPT_PIN PIN(A, 7) #define SLEEP_CONFIRM_PIN PIN(A, 5) /* Exp hdr 7 */ #endif - -#define NETWORK_INTERFACE_VALID(x) (x == SL_NET_DEFAULT_WIFI_CLIENT_INTERFACE) || (x == SL_NET_DEFAULT_WIFI_AP_INTERFACE) #endif /* _RSI_BOARD_CONFIGURATION_H_ */ \ No newline at end of file diff --git a/examples/platform/silabs/efr32/rs911x/wfx_rsi.h b/examples/platform/silabs/efr32/rs911x/wfx_rsi.h index 4d692064a5768f..07217056cef11b 100644 --- a/examples/platform/silabs/efr32/rs911x/wfx_rsi.h +++ b/examples/platform/silabs/efr32/rs911x/wfx_rsi.h @@ -92,7 +92,11 @@ int32_t wfx_rsi_get_ap_ext(wfx_wifi_scan_ext_t * extra_info); int32_t wfx_rsi_reset_count(); int32_t wfx_rsi_disconnect(); #if SL_ICD_ENABLED +#if SLI_SI917 +int32_t wfx_rsi_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_si91x_performance_profile_t sl_si91x_wifi_state); +#else int32_t wfx_rsi_power_save(); +#endif /* SLI_SI917 */ #endif /* SL_ICD_ENABLED */ #ifdef __cplusplus diff --git a/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c b/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c index 15915851c11a20..8764c0a9dda8bb 100644 --- a/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c +++ b/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c @@ -192,6 +192,21 @@ sl_status_t wfx_connect_to_ap(void) } #if SL_ICD_ENABLED +#if SLI_SI917 +/********************************************************************* + * @fn sl_status_t wfx_power_save() + * @brief + * Implements the power save in sleepy application + * @param[in] sl_si91x_ble_state : State to set for the BLE + sl_si91x_wifi_state : State to set for the WiFi + * @return SL_STATUS_OK if successful, + * SL_STATUS_FAIL otherwise + ***********************************************************************/ +sl_status_t wfx_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_si91x_performance_profile_t sl_si91x_wifi_state) +{ + return (wfx_rsi_power_save(sl_si91x_ble_state, sl_si91x_wifi_state) ? SL_STATUS_FAIL : SL_STATUS_OK); +} +#else // For RS9116 /********************************************************************* * @fn sl_status_t wfx_power_save() * @brief @@ -204,6 +219,7 @@ sl_status_t wfx_power_save() { return (wfx_rsi_power_save() ? SL_STATUS_FAIL : SL_STATUS_OK); } +#endif /* SLI_SI917 */ #endif /* SL_ICD_ENABLED */ /********************************************************************* diff --git a/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp b/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp index c1a1a7de4c0ed1..214b0974668fbb 100644 --- a/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp +++ b/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp @@ -368,7 +368,11 @@ void ConnectivityManagerImpl::OnStationConnected() (void) PlatformMgr().PostEvent(&event); // Setting the rs911x in the power save mode #if (CHIP_CONFIG_ENABLE_ICD_SERVER && RS911X_WIFI) +#if SLI_SI917 + sl_status_t err = wfx_power_save(RSI_SLEEP_MODE_2, ASSOCIATED_POWER_SAVE); +#else sl_status_t err = wfx_power_save(); +#endif /* SLI_SI917 */ if (err != SL_STATUS_OK) { ChipLogError(DeviceLayer, "Power save config for Wifi failed"); diff --git a/src/platform/silabs/SiWx917/OTAImageProcessorImpl.cpp b/src/platform/silabs/SiWx917/OTAImageProcessorImpl.cpp index b4755995e36b01..7e581135fde8bd 100644 --- a/src/platform/silabs/SiWx917/OTAImageProcessorImpl.cpp +++ b/src/platform/silabs/SiWx917/OTAImageProcessorImpl.cpp @@ -20,8 +20,8 @@ #include #include +#include "wfx_host_events.h" #include - #ifdef __cplusplus extern "C" { #endif @@ -35,8 +35,7 @@ extern "C" { #define RPS_HEADER 1 #define RPS_DATA 2 -/// No error, operation OK -#define SL_BOOTLOADER_OK 0L + #define SL_STATUS_FW_UPDATE_DONE SL_STATUS_SI91X_NO_AP_FOUND uint8_t flag = RPS_HEADER; @@ -124,7 +123,7 @@ CHIP_ERROR OTAImageProcessorImpl::ConfirmCurrentImage() void OTAImageProcessorImpl::HandlePrepareDownload(intptr_t context) { - int32_t err = SL_BOOTLOADER_OK; + int32_t status = SL_STATUS_OK; auto * imageProcessor = reinterpret_cast(context); if (imageProcessor == nullptr) @@ -148,15 +147,21 @@ void OTAImageProcessorImpl::HandlePrepareDownload(intptr_t context) imageProcessor->mHeaderParser.Init(); - // Not calling bootloader_eraseStorageSlot(mSlotId) here because we erase during each write + // Setting the device is in high performace - no-sleepy mode while OTA tranfer +#if (CHIP_CONFIG_ENABLE_ICD_SERVER) + status = wfx_power_save(RSI_ACTIVE, HIGH_PERFORMANCE); + if (status != SL_STATUS_OK) + { + ChipLogError(DeviceLayer, "Failed to enable the TA Deep Sleep"); + } +#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER*/ imageProcessor->mDownloader->OnPreparedForDownload(CHIP_NO_ERROR); } void OTAImageProcessorImpl::HandleFinalize(intptr_t context) { - uint32_t err = SL_BOOTLOADER_OK; - int32_t status = 0; + int32_t status = SL_STATUS_OK; auto * imageProcessor = reinterpret_cast(context); if (imageProcessor == nullptr) { @@ -177,7 +182,7 @@ void OTAImageProcessorImpl::HandleFinalize(intptr_t context) } else { - ChipLogError(SoftwareUpdate, "ERROR: In HandleFinalize for last chunk rsi_fwup() error %ld", status); + ChipLogError(SoftwareUpdate, "ERROR: In HandleFinalize for last chunk sl_si91x_fwup_load() error %ld", status); imageProcessor->mDownloader->EndDownload(CHIP_ERROR_WRITE_FAILED); return; } @@ -185,12 +190,21 @@ void OTAImageProcessorImpl::HandleFinalize(intptr_t context) } imageProcessor->ReleaseBlock(); + // Setting the device back to power save mode when transfer is completed successfully +#if (CHIP_CONFIG_ENABLE_ICD_SERVER) + sl_status_t err = wfx_power_save(RSI_SLEEP_MODE_2, ASSOCIATED_POWER_SAVE); + if (err != SL_STATUS_OK) + { + ChipLogError(DeviceLayer, "Power save config for Wifi failed"); + } +#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER*/ + ChipLogProgress(SoftwareUpdate, "OTA image downloaded successfully"); } void OTAImageProcessorImpl::HandleApply(intptr_t context) { - uint32_t err = SL_BOOTLOADER_OK; + int32_t status = SL_STATUS_OK; ChipLogProgress(SoftwareUpdate, "OTAImageProcessorImpl::HandleApply()"); @@ -199,6 +213,15 @@ void OTAImageProcessorImpl::HandleApply(intptr_t context) ChipLogProgress(SoftwareUpdate, "OTA image downloaded successfully in HandleApply"); + // Setting the device is in high performace - no-sleepy mode before soft reset as soft reset is not happening in sleep mode +#if (CHIP_CONFIG_ENABLE_ICD_SERVER) + status = wfx_power_save(RSI_ACTIVE, HIGH_PERFORMANCE); + if (status != SL_STATUS_OK) + { + ChipLogError(DeviceLayer, "Failed to enable the TA Deep Sleep"); + } +#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER*/ + if (mReset) { ChipLogProgress(SoftwareUpdate, "M4 Firmware update complete"); @@ -217,14 +240,22 @@ void OTAImageProcessorImpl::HandleAbort(intptr_t context) return; } + // Setting the device back to power save mode when transfer is aborted in the middle +#if (CHIP_CONFIG_ENABLE_ICD_SERVER) + sl_status_t err = wfx_power_save(RSI_SLEEP_MODE_2, ASSOCIATED_POWER_SAVE); + if (err != SL_STATUS_OK) + { + ChipLogError(DeviceLayer, "Power save config for Wifi failed"); + } +#endif /* CHIP_CONFIG_ENABLE_ICD_SERVER*/ + // Not clearing the image storage area as it is done during each write imageProcessor->ReleaseBlock(); } void OTAImageProcessorImpl::HandleProcessBlock(intptr_t context) { - uint32_t err = SL_BOOTLOADER_OK; - int32_t status = 0; + int32_t status = SL_STATUS_OK; int32_t content_block = 0; auto * imageProcessor = reinterpret_cast(context); if (imageProcessor == nullptr) @@ -280,7 +311,7 @@ void OTAImageProcessorImpl::HandleProcessBlock(intptr_t context) } else { - ChipLogError(SoftwareUpdate, "ERROR: In HandleFinalize for last chunk rsi_fwup() error %ld", status); + ChipLogError(SoftwareUpdate, "ERROR: In HandleProcessBlock sl_si91x_fwup_load() error %ld", status); imageProcessor->mDownloader->EndDownload(CHIP_ERROR_WRITE_FAILED); return; } diff --git a/src/platform/silabs/SiWx917/wifi/wfx_host_events.h b/src/platform/silabs/SiWx917/wifi/wfx_host_events.h index e153a12c0461ae..455563e1899bb8 100644 --- a/src/platform/silabs/SiWx917/wifi/wfx_host_events.h +++ b/src/platform/silabs/SiWx917/wifi/wfx_host_events.h @@ -32,6 +32,9 @@ #include "sl_status.h" +#include "rsi_common_apis.h" +#include "sl_wifi_device.h" + #define SL_WIFI_ALLOCATE_COMMAND_BUFFER_WAIT_TIME_MS 1000 /* Wi-Fi events*/ #define SL_WFX_STARTUP_IND_ID (1) @@ -246,7 +249,8 @@ sl_status_t sl_si91x_host_process_data_frame(sl_wifi_interface_t interface, sl_w void * sl_si91x_host_get_buffer_data(sl_wifi_buffer_t * buffer, uint16_t offset, uint16_t * data_length); #if SL_ICD_ENABLED -sl_status_t wfx_power_save(); +sl_status_t wfx_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_si91x_performance_profile_t sl_si91x_wifi_state); +void sl_button_on_change(uint8_t btn, uint8_t btnAction); #endif /* SL_ICD_ENABLED */ void wfx_ipv6_notify(int got_ip); diff --git a/src/platform/silabs/SiWx917/wifi/wfx_notify.cpp b/src/platform/silabs/SiWx917/wifi/wfx_notify.cpp index 3d0f56cf14f442..ac5e8c304f5dcf 100644 --- a/src/platform/silabs/SiWx917/wifi/wfx_notify.cpp +++ b/src/platform/silabs/SiWx917/wifi/wfx_notify.cpp @@ -31,6 +31,18 @@ #include "wfx_rsi.h" #endif +#if SL_ICD_ENABLED +#ifdef __cplusplus +extern "C" { +#endif +#include "sl_si91x_m4_ps.h" +extern "C" uint8_t m4_alarm_initialization_done; +extern "C" void set_alarm_interrupt_timer(uint16_t interval); +#ifdef __cplusplus +} +#endif +#endif // SL_ICD_ENABLED + #include // #include #include @@ -191,6 +203,12 @@ void wfx_ip_changed_notify(int got_ip) ********************************************************************************************/ void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retryJoin) { +#if SL_ICD_ENABLED + if (m4_alarm_initialization_done == false) + { + initialize_m4_alarm(); + } +#endif // SL_ICD_ENABLED if (!is_wifi_disconnection_event) { /* After the reboot or a commissioning time device failed to connect with AP. @@ -199,7 +217,22 @@ void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retry if (retryJoin < MAX_JOIN_RETRIES_COUNT) { SILABS_LOG("wfx_retry_interval_handler : Next attempt after %d Seconds", CONVERT_MS_TO_SEC(WLAN_RETRY_TIMER_MS)); +#if SL_ICD_ENABLED + // TODO: cleanup the retry logic MATTER-1921 + if (!chip::Server::GetInstance().GetCommissioningWindowManager().IsCommissioningWindowOpen()) + { + set_alarm_interrupt_timer(WLAN_RETRY_TIMER_MS / 1000); + wfx_rsi_power_save(RSI_SLEEP_MODE_8, STANDBY_POWER_SAVE_WITH_RAM_RETENTION); + // TODO: remove this once TICKLESS_IDLE is applied. MATTER-3134 + sl_wfx_host_si91x_sleep_wakeup(); + } + else + { + vTaskDelay(pdMS_TO_TICKS(WLAN_RETRY_TIMER_MS)); + } +#else vTaskDelay(pdMS_TO_TICKS(WLAN_RETRY_TIMER_MS)); +#endif // SL_ICD_ENABLED } else { @@ -218,7 +251,14 @@ void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retry retryInterval = WLAN_MAX_RETRY_TIMER_MS; } SILABS_LOG("wfx_retry_interval_handler : Next attempt after %d Seconds", CONVERT_MS_TO_SEC(retryInterval)); +#if SL_ICD_ENABLED + set_alarm_interrupt_timer(retryInterval / 1000); + wfx_rsi_power_save(RSI_SLEEP_MODE_8, STANDBY_POWER_SAVE_WITH_RAM_RETENTION); + // TODO: remove this once TICKLESS_IDLE is applied. MATTER-3134 + sl_wfx_host_si91x_sleep_wakeup(); +#else vTaskDelay(pdMS_TO_TICKS(retryInterval)); +#endif // SL_ICD_ENABLED retryInterval += retryInterval; } } diff --git a/src/platform/silabs/efr32/wifi/wfx_host_events.h b/src/platform/silabs/efr32/wifi/wfx_host_events.h index 4070cf4ea93700..c9f451f8ac063a 100644 --- a/src/platform/silabs/efr32/wifi/wfx_host_events.h +++ b/src/platform/silabs/efr32/wifi/wfx_host_events.h @@ -103,6 +103,9 @@ typedef struct __attribute__((__packed__)) sl_wfx_mib_req_s #include "sl_status.h" #include "sl_wifi_constants.h" +#include "rsi_common_apis.h" +#include "sl_wifi_device.h" + #define SL_WIFI_ALLOCATE_COMMAND_BUFFER_WAIT_TIME_MS 1000 #endif @@ -365,7 +368,11 @@ void * wfx_rsi_alloc_pkt(void); #ifdef RS911X_WIFI /* RSI Power Save */ #if SL_ICD_ENABLED +#if SLI_SI917 +sl_status_t wfx_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_si91x_performance_profile_t sl_si91x_wifi_state); +#else sl_status_t wfx_power_save(); +#endif /* SLI_SI917 */ #endif /* SL_ICD_ENABLED */ /* RSI for LWIP */ void wfx_rsi_pkt_add_data(void * p, uint8_t * buf, uint16_t len, uint16_t off); diff --git a/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp b/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp index 1015d959ee0825..f57b73f0499d41 100644 --- a/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp +++ b/src/platform/silabs/platformAbstraction/WiseMcuSpam.cpp @@ -55,8 +55,10 @@ CHIP_ERROR SilabsPlatform::Init(void) // TODO: Setting the highest priority for SVCall_IRQn to avoid the HardFault issue NVIC_SetPriority(SVCall_IRQn, CORE_INTERRUPT_HIGHEST_PRIORITY); +#if !CHIP_CONFIG_ENABLE_ICD_SERVER // Configuration the clock rate soc_pll_config(); +#endif #if SILABS_LOG_ENABLED silabsInitLog(); From 93da26309ae76b1d5a4a3875e7ebb853ab18e848 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 22 Feb 2024 11:31:00 -0500 Subject: [PATCH 15/29] Remove unnecessary include from OperationalSessionSetupPool.h (#32229) * Remove backwards circular include * Since we include bits, remove the forward declaration (since now things are not broken anymore due to circularity) --------- Co-authored-by: Andrei Litvin --- src/app/CASESessionManager.h | 2 -- src/app/OperationalSessionSetupPool.h | 1 - 2 files changed, 3 deletions(-) diff --git a/src/app/CASESessionManager.h b/src/app/CASESessionManager.h index 92fb7a9ba783c7..3e668fa905cbdf 100644 --- a/src/app/CASESessionManager.h +++ b/src/app/CASESessionManager.h @@ -30,8 +30,6 @@ namespace chip { -class OperationalSessionSetupPoolDelegate; - struct CASESessionManagerConfig { CASEClientInitParams sessionInitParams; diff --git a/src/app/OperationalSessionSetupPool.h b/src/app/OperationalSessionSetupPool.h index 583c7e8d4cc64b..30160a1cb572c9 100644 --- a/src/app/OperationalSessionSetupPool.h +++ b/src/app/OperationalSessionSetupPool.h @@ -17,7 +17,6 @@ #pragma once -#include #include #include #include From 24b5b5462974e80981a78290a04f4306e1dcdb81 Mon Sep 17 00:00:00 2001 From: yunhanw-google Date: Thu, 22 Feb 2024 09:33:58 -0800 Subject: [PATCH 16/29] [Android] Move kotlin tlv/jsontlv out from java device controller lib (#32252) * remove kotlin tlv/jsontlv from java device controller lib * Restyled by gn --------- Co-authored-by: Restyled.io --- BUILD.gn | 2 ++ src/controller/java/BUILD.gn | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index a96f2a2e67265a..0992c61b0510c6 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -182,7 +182,9 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { deps += [ "${chip_root}/src/app/server/java", "${chip_root}/src/controller/java", + "${chip_root}/src/controller/java:jsontlv", "${chip_root}/src/controller/java:onboarding_payload", + "${chip_root}/src/controller/java:tlv", "${chip_root}/src/platform/android:java", ] } diff --git a/src/controller/java/BUILD.gn b/src/controller/java/BUILD.gn index 678a03a6bf63bc..31dbaafc9fb21f 100644 --- a/src/controller/java/BUILD.gn +++ b/src/controller/java/BUILD.gn @@ -442,8 +442,6 @@ android_library("java") { deps = [ ":chipcluster", ":chipclusterID", - ":jsontlv", - ":tlv", "${chip_root}/third_party/java_deps:annotation", ] From a2c53a27dbbad2f5ed2d83335e0d0c7817c59baa Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 22 Feb 2024 12:55:03 -0500 Subject: [PATCH 17/29] Make MTRServerCluster threadsafe. (#32245) * Make MTRServerCluster threadsafe. If two API clients are both touching the same instance of MTRServerCluster on different threads, we should handle that correctly. * Address review comments. --- .../CHIP/ServerEndpoint/MTRServerAttribute.h | 10 +- .../CHIP/ServerEndpoint/MTRServerCluster.h | 10 +- .../CHIP/ServerEndpoint/MTRServerCluster.mm | 104 +++++++++++++++++- .../MTRServerCluster_Internal.h | 24 ++-- .../CHIP/ServerEndpoint/MTRServerEndpoint.mm | 14 +-- 5 files changed, 132 insertions(+), 30 deletions(-) diff --git a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.h b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.h index 7d8c27b74b55d3..f9c7e7ca6dfe4b 100644 --- a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.h +++ b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerAttribute.h @@ -24,6 +24,8 @@ NS_ASSUME_NONNULL_BEGIN * A representation of an attribute implemented on a server cluster by an * MTRDeviceController. An attribute has an identifier and a value, and may or * may not be writable. + * + * MTRServerAttribute's API can be accessed from any thread. */ NS_SWIFT_SENDABLE MTR_NEWLY_AVAILABLE @@ -51,13 +53,13 @@ MTR_NEWLY_AVAILABLE */ - (BOOL)setValue:(NSDictionary *)value; -@property (nonatomic, copy, readonly) NSNumber * attributeID; -@property (nonatomic, copy, readonly) NSDictionary * value; +@property (atomic, copy, readonly) NSNumber * attributeID; +@property (atomic, copy, readonly) NSDictionary * value; /** * The privilege level necessary to read this attribute. */ -@property (nonatomic, assign, readonly) MTRAccessControlEntryPrivilege requiredReadPrivilege; -@property (nonatomic, assign, readonly, getter=isWritable) BOOL writable; +@property (atomic, assign, readonly) MTRAccessControlEntryPrivilege requiredReadPrivilege; +@property (atomic, assign, readonly, getter=isWritable) BOOL writable; @end diff --git a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerCluster.h b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerCluster.h index 02b0f4b274374d..591d3afec59779 100644 --- a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerCluster.h +++ b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerCluster.h @@ -23,6 +23,8 @@ NS_ASSUME_NONNULL_BEGIN /** * A representation of a server cluster implemented by an MTRDeviceController. + * + * MTRServerCluster's API can be accessed from any thread. */ NS_SWIFT_SENDABLE MTR_NEWLY_AVAILABLE @@ -90,9 +92,9 @@ MTR_NEWLY_AVAILABLE */ + (MTRServerCluster *)newDescriptorCluster; -@property (nonatomic, copy, readonly) NSNumber * clusterID; +@property (atomic, copy, readonly) NSNumber * clusterID; -@property (nonatomic, copy, readonly) NSNumber * clusterRevision; +@property (atomic, copy, readonly) NSNumber * clusterRevision; /** * The list of entities that are allowed to access this cluster instance. This @@ -100,12 +102,12 @@ MTR_NEWLY_AVAILABLE * * Defaults to empty list, which means no additional access grants. */ -@property (nonatomic, copy, readonly) NSArray * accessGrants; +@property (atomic, copy, readonly) NSArray * accessGrants; /** * The list of attributes supported by the cluster. */ -@property (nonatomic, copy, readonly) NSArray * attributes; +@property (atomic, copy, readonly) NSArray * attributes; @end diff --git a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerCluster.mm b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerCluster.mm index c0fba9e9bda64d..7439c0ff6a453a 100644 --- a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerCluster.mm +++ b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerCluster.mm @@ -20,11 +20,12 @@ #import "MTRServerAttribute_Internal.h" #import "MTRServerCluster_Internal.h" #import "MTRServerEndpoint_Internal.h" +#import "MTRUnfairLock.h" +#import "NSDataSpanConversion.h" + #import #import -#import "NSDataSpanConversion.h" - #include #include #include @@ -71,11 +72,26 @@ @implementation MTRServerCluster { std::unique_ptr _attributeAccessInterface; // We can't use something like std::unique_ptr // because EmberAfAttributeMetadata does not have a default constructor, so - // we can't alloc and then initializer later. + // we can't alloc and then initialize later. std::vector _matterAttributeMetadata; std::unique_ptr _matterAcceptedCommandList; std::unique_ptr _matterGeneratedCommandList; + + NSSet * _matterAccessGrants; + + chip::EndpointId _parentEndpoint; + + // _acceptedCommands and _generatedCommands are touched directly by our API + // consumer. + NSArray * _acceptedCommands; + NSArray * _generatedCommands; + + /** + * _lock always protects access to all our mutable ivars (the ones that are + * modified after init). + */ + os_unfair_lock _lock; } - (nullable instancetype)initWithClusterID:(NSNumber *)clusterID revision:(NSNumber *)revision @@ -117,6 +133,7 @@ - (instancetype)initInternalWithClusterID:(NSNumber *)clusterID revision:(NSNumb return nil; } + _lock = OS_UNFAIR_LOCK_INIT; _clusterID = [clusterID copy]; _clusterRevision = [revision copy]; _accessGrants = [[NSMutableSet alloc] init]; @@ -141,6 +158,8 @@ - (instancetype)initInternalWithClusterID:(NSNumber *)clusterID revision:(NSNumb - (void)updateMatterAccessGrants { + os_unfair_lock_assert_owner(&_lock); + MTRDeviceController * deviceController = _deviceController; if (deviceController == nil) { // _matterAccessGrants will be updated when we get bound to a controller. @@ -149,6 +168,7 @@ - (void)updateMatterAccessGrants NSSet * grants = [_accessGrants copy]; [deviceController asyncDispatchToMatterQueue:^{ + std::lock_guard lock(self->_lock); self->_matterAccessGrants = grants; } errorHandler:nil]; @@ -156,6 +176,8 @@ - (void)updateMatterAccessGrants - (void)addAccessGrant:(MTRAccessGrant *)accessGrant { + std::lock_guard lock(self->_lock); + [_accessGrants addObject:accessGrant]; [self updateMatterAccessGrants]; @@ -163,13 +185,24 @@ - (void)addAccessGrant:(MTRAccessGrant *)accessGrant - (void)removeAccessGrant:(MTRAccessGrant *)accessGrant; { + std::lock_guard lock(self->_lock); + [_accessGrants removeObject:accessGrant]; [self updateMatterAccessGrants]; } +- (NSArray *)matterAccessGrants +{ + std::lock_guard lock(self->_lock); + + return [_matterAccessGrants allObjects]; +} + - (BOOL)addAttribute:(MTRServerAttribute *)attribute { + std::lock_guard lock(self->_lock); + MTRDeviceController * deviceController = _deviceController; if (deviceController != nil) { MTR_LOG_ERROR("Cannot add attribute on cluster %llx which is already in use", _clusterID.unsignedLongLongValue); @@ -213,6 +246,8 @@ - (BOOL)addAttribute:(MTRServerAttribute *)attribute - (BOOL)associateWithController:(nullable MTRDeviceController *)controller { + std::lock_guard lock(self->_lock); + MTRDeviceController * existingController = _deviceController; if (existingController != nil) { #if MTR_PER_CONTROLLER_STORAGE_ENABLED @@ -313,7 +348,7 @@ - (BOOL)associateWithController:(nullable MTRDeviceController *)controller _deviceController = controller; - MTR_LOG_DEFAULT("Associated %@, attribute count %llu, with controller", self, + MTR_LOG_DEFAULT("Associated %@, attribute count %llu, with controller", [self _descriptionWhileLocked], static_cast(attributeCount)); return YES; @@ -321,6 +356,8 @@ - (BOOL)associateWithController:(nullable MTRDeviceController *)controller - (void)invalidate { + std::lock_guard lock(_lock); + // Undo any work associateWithController did. for (MTRServerAttribute * attr in _attributes) { [attr invalidate]; @@ -342,6 +379,8 @@ - (void)registerMatterCluster { assertChipStackLockedByCurrentThread(); + std::lock_guard lock(_lock); + if (!registerAttributeAccessOverride(_attributeAccessInterface.get())) { // This should only happen if we somehow managed to register an // AttributeAccessInterface for the same (endpoint, cluster) pair. @@ -354,6 +393,8 @@ - (void)unregisterMatterCluster { assertChipStackLockedByCurrentThread(); + std::lock_guard lock(_lock); + if (_attributeAccessInterface != nullptr) { unregisterAttributeAccessOverride(_attributeAccessInterface.get()); } @@ -361,38 +402,84 @@ - (void)unregisterMatterCluster - (NSArray *)accessGrants { + std::lock_guard lock(_lock); + return [_accessGrants allObjects]; } - (NSArray *)attributes { + std::lock_guard lock(_lock); + return [_attributes copy]; } -- (void)setParentEndpoint:(EndpointId)endpoint +- (BOOL)addToEndpoint:(chip::EndpointId)endpoint { + std::lock_guard lock(_lock); + + if (_parentEndpoint != kInvalidEndpointId) { + MTR_LOG_ERROR("Cannot add cluster " ChipLogFormatMEI " to endpoint %" PRIu32 "; already added to endpoint %" PRIu32, + ChipLogValueMEI(_clusterID.unsignedLongLongValue), endpoint, _parentEndpoint); + return NO; + } + _parentEndpoint = endpoint; // Update it on all the attributes, in case the attributes were added to us // before we were added to the endpoint. for (MTRServerAttribute * attr in _attributes) { [attr updateParentCluster:ConcreteClusterPath(endpoint, static_cast(_clusterID.unsignedLongLongValue))]; } + return YES; +} + +- (chip::EndpointId)parentEndpoint +{ + std::lock_guard lock(_lock); + return _parentEndpoint; } - (Span)matterAttributeMetadata { // This is always called after our _matterAttributeMetadata has been set up // by associateWithController. + std::lock_guard lock(_lock); return Span(_matterAttributeMetadata.data(), _matterAttributeMetadata.size()); } +- (void)setAcceptedCommands:(NSArray *)acceptedCommands +{ + std::lock_guard lock(_lock); + _acceptedCommands = [acceptedCommands copy]; +} + +- (NSArray *)acceptedCommands +{ + std::lock_guard lock(_lock); + return [_acceptedCommands copy]; +} + +- (void)setGeneratedCommands:(NSArray *)generatedCommands +{ + std::lock_guard lock(_lock); + _generatedCommands = [generatedCommands copy]; +} + +- (NSArray *)generatedCommands +{ + std::lock_guard lock(_lock); + return [_generatedCommands copy]; +} + - (CommandId *)matterAcceptedCommands { + std::lock_guard lock(_lock); return _matterAcceptedCommandList.get(); } - (CommandId *)matterGeneratedCommands { + std::lock_guard lock(_lock); return _matterGeneratedCommandList.get(); } @@ -413,6 +500,13 @@ - (CommandId *)matterGeneratedCommands - (NSString *)description { + std::lock_guard lock(_lock); + return [self _descriptionWhileLocked]; +} + +- (NSString *)_descriptionWhileLocked +{ + os_unfair_lock_assert_owner(&_lock); return [NSString stringWithFormat:@"", _parentEndpoint, ChipLogValueMEI(_clusterID.unsignedLongLongValue)]; } diff --git a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerCluster_Internal.h b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerCluster_Internal.h index 4ae3d0db348533..253885b7d82e98 100644 --- a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerCluster_Internal.h +++ b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerCluster_Internal.h @@ -57,40 +57,46 @@ NS_ASSUME_NONNULL_BEGIN - (void)invalidate; /** - * The access grants the Matter stack can observe. Only modified while in - * Initializing state or on the Matter queue. + * Add the cluster to an endpoint with the given endpoint ID. Will return NO + * if the cluster is already added to an endpoint. */ -@property (nonatomic, strong, readonly) NSSet * matterAccessGrants; +- (BOOL)addToEndpoint:(chip::EndpointId)endpoint; + +/** + * The access grants the Matter stack can observe. Only modified while + * associating with a controller or on the Matter queue. + */ +@property (atomic, copy, readonly) NSArray * matterAccessGrants; /** * parentEndpoint will be kInvalidEndpointId until the cluster is added to an endpoint. */ -@property (nonatomic, assign) chip::EndpointId parentEndpoint; +@property (atomic, assign, readonly) chip::EndpointId parentEndpoint; /** * The attribute metadata for the cluster. Only valid after associateWithController: has succeeded. */ -@property (nonatomic, assign, readonly) chip::Span matterAttributeMetadata; +@property (atomic, assign, readonly) chip::Span matterAttributeMetadata; /** * The list of accepted command IDs. */ -@property (nonatomic, copy, nullable) NSArray * acceptedCommands; +@property (atomic, copy, nullable) NSArray * acceptedCommands; /** * The list of generated command IDs. */ -@property (nonatomic, copy, nullable) NSArray * generatedCommands; +@property (atomic, copy, nullable) NSArray * generatedCommands; /** * The list of accepted commands IDs in the format the Matter stack needs. */ -@property (nonatomic, assign, nullable, readonly) chip::CommandId * matterAcceptedCommands; +@property (atomic, assign, nullable, readonly) chip::CommandId * matterAcceptedCommands; /** * The list of generated commands IDs in the format the Matter stack needs. */ -@property (nonatomic, assign, nullable, readonly) chip::CommandId * matterGeneratedCommands; +@property (atomic, assign, nullable, readonly) chip::CommandId * matterGeneratedCommands; @end diff --git a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerEndpoint.mm b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerEndpoint.mm index c58b1ac4fa7744..c7553230f3748e 100644 --- a/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerEndpoint.mm +++ b/src/darwin/Framework/CHIP/ServerEndpoint/MTRServerEndpoint.mm @@ -154,20 +154,18 @@ - (BOOL)addServerCluster:(MTRServerCluster *)serverCluster return NO; } - if (serverCluster.parentEndpoint != kInvalidEndpointId) { - MTR_LOG_ERROR("Cannot add cluster to endpoint %llu; already added to endpoint %" PRIu32, _endpointID.unsignedLongLongValue, serverCluster.parentEndpoint); - return NO; - } - for (MTRServerCluster * existingCluster in _serverClusters) { if ([existingCluster.clusterID isEqual:serverCluster.clusterID]) { - MTR_LOG_ERROR("Cannot add second cluster with ID %llx on endpoint %llu", serverCluster.clusterID.unsignedLongLongValue, _endpointID.unsignedLongLongValue); + MTR_LOG_ERROR("Cannot add second cluster with ID " ChipLogFormatMEI " on endpoint %llu", ChipLogValueMEI(serverCluster.clusterID.unsignedLongLongValue), _endpointID.unsignedLongLongValue); return NO; } } + if (![serverCluster addToEndpoint:static_cast(_endpointID.unsignedLongLongValue)]) { + return NO; + } [_serverClusters addObject:serverCluster]; - serverCluster.parentEndpoint = static_cast(_endpointID.unsignedLongLongValue); + return YES; } @@ -401,7 +399,7 @@ - (void)invalidate NSMutableArray * grants = [[_matterAccessGrants allObjects] mutableCopy]; for (MTRServerCluster * cluster in _serverClusters) { if ([cluster.clusterID isEqual:clusterID]) { - [grants addObjectsFromArray:[cluster.matterAccessGrants allObjects]]; + [grants addObjectsFromArray:cluster.matterAccessGrants]; } } From b2da1b043c4cd6b7140d6373655c03bdaff502ae Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 22 Feb 2024 13:44:16 -0500 Subject: [PATCH 18/29] Move CommandSender and PendingResponseTracker to IM. (#32227) * Move CommandSender and PendingResponseTracker to IM. Previous location of these files was `app` however this created apparent circular dependencies for includes. * Restyle * CommandSender is now tracked * Move read and write clients to interactionmodel as well * Also pull in interactionmodelhelper .... this is a very poorly named file --------- Co-authored-by: Andrei Litvin --- .github/workflows/lint.yml | 4 ---- src/app/BUILD.gn | 30 ++++++++++++++++-------------- src/app/CommandSender.cpp | 8 +------- 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 66405b9e615b6d..69613217033e8b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -95,14 +95,11 @@ jobs: --known-failure app/att-storage.h \ --known-failure app/CommandHandler.h \ --known-failure app/CommandHandlerInterface.h \ - --known-failure app/CommandSender.h \ --known-failure app/CommandSenderLegacyCallback.h \ --known-failure app/CompatEnumNames.h \ --known-failure app/data-model/ListLargeSystemExtensions.h \ --known-failure app/EventHeader.h \ --known-failure app/EventLoggingTypes.h \ - --known-failure app/InteractionModelHelper.h \ - --known-failure app/ReadClient.h \ --known-failure app/ReadHandler.h \ --known-failure app/ReadPrepareParams.h \ --known-failure app/reporting/tests/MockReportScheduler.cpp \ @@ -132,7 +129,6 @@ jobs: --known-failure app/util/odd-sized-integers.h \ --known-failure app/util/util.cpp \ --known-failure app/util/util.h \ - --known-failure app/WriteClient.h \ --known-failure app/WriteHandler.h \ --known-failure lib/core/CHIPVendorIdentifiers.hpp \ --known-failure platform/DeviceSafeQueue.cpp \ diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index ec520e005b0d80..f714560afc15cb 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -140,16 +140,24 @@ static_library("interaction-model") { "CASEClientPool.h", "CASESessionManager.cpp", "CASESessionManager.h", + "CommandSender.cpp", + "CommandSender.h", "DeviceProxy.cpp", "DeviceProxy.h", "InteractionModelDelegatePointers.cpp", "InteractionModelDelegatePointers.h", "InteractionModelEngine.cpp", "InteractionModelEngine.h", + "InteractionModelHelper.h", "InteractionModelTimeout.h", "OperationalSessionSetup.cpp", "OperationalSessionSetup.h", "OperationalSessionSetupPool.h", + "PendingResponseTracker.h", + "PendingResponseTrackerImpl.cpp", + "PendingResponseTrackerImpl.h", + "ReadClient.h", # TODO: cpp is only included conditionally. Needs logic + # fixing "RequiredPrivilege.cpp", "RequiredPrivilege.h", "StatusResponse.cpp", @@ -157,6 +165,10 @@ static_library("interaction-model") { "SubscriptionResumptionStorage.h", "TimedHandler.cpp", "TimedHandler.h", + "TimedRequest.cpp", + "TimedRequest.h", + "WriteClient.cpp", + "WriteClient.h", "reporting/Engine.cpp", "reporting/Engine.h", "reporting/ReportScheduler.h", @@ -184,6 +196,10 @@ static_library("interaction-model") { public_configs = [ "${chip_root}/src:includes" ] + if (chip_enable_read_client) { + sources += [ "ReadClient.cpp" ] + } + if (chip_persist_subscriptions) { sources += [ "SimpleSubscriptionResumptionStorage.cpp", @@ -228,7 +244,6 @@ static_library("app") { "CommandResponseHelper.h", "CommandResponseSender.cpp", "CommandResponseSender.h", - "CommandSender.cpp", "DefaultAttributePersistenceProvider.cpp", "DefaultAttributePersistenceProvider.h", "DeferredAttributePersistenceProvider.cpp", @@ -240,26 +255,17 @@ static_library("app") { "FailSafeContext.cpp", "FailSafeContext.h", "OTAUserConsentCommon.h", - "PendingResponseTracker.h", - "PendingResponseTrackerImpl.cpp", - "PendingResponseTrackerImpl.h", "ReadHandler.cpp", "SafeAttributePersistenceProvider.h", - "TimedRequest.cpp", - "TimedRequest.h", "TimerDelegates.cpp", "TimerDelegates.h", - "WriteClient.cpp", "WriteHandler.cpp", # TODO: the following items cannot be included due to interaction-model circularity # (app depending on im and im including these headers): # Name with _ so that linter does not recognize it # "CommandHandler._h" - # "CommandSender._h", - # "ReadClient._h", # "ReadHandler._h", - # "WriteClient._h", # "WriteHandler._h" # TODO: the following items cannot be included due to platform includes not being @@ -288,10 +294,6 @@ static_library("app") { "BufferedReadCallback.h", "ClusterStateCache.cpp", "ClusterStateCache.h", - "ReadClient.cpp", - - # TODO: cannot include "ReadClient._h" because interaction-model backreference - # Name with _ so that linter does not recognize it ] } diff --git a/src/app/CommandSender.cpp b/src/app/CommandSender.cpp index 03ce2786b93d8d..18f4e755835076 100644 --- a/src/app/CommandSender.cpp +++ b/src/app/CommandSender.cpp @@ -16,15 +16,9 @@ * limitations under the License. */ -/** - * @file - * This file defines objects for a CHIP IM Invoke Command Sender - * - */ - #include "CommandSender.h" -#include "InteractionModelEngine.h" #include "StatusResponse.h" +#include #include #include #include From 091ee228cc453c7f2f45ee1f1eb4a10933b35d94 Mon Sep 17 00:00:00 2001 From: Kai Liao <140431279+kliao-csa@users.noreply.github.com> Date: Thu, 22 Feb 2024 10:47:31 -0800 Subject: [PATCH 19/29] Update spell.yml (#32132) * Update spell.yml Update the spell checker used * Update .wordlist.txt Remove defaultValue, an example of the camelcase we are working around, to trigger test on PR * Update .spellcheck.yml camelcase true * Update spell.yml * Wordlist camelcase removal * Update .wordlist.txt --- .github/.wordlist.txt | 32 +------------------------------- .github/workflows/spell.yml | 21 +++++++++++---------- .spellcheck.yml | 1 + 3 files changed, 13 insertions(+), 41 deletions(-) diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index 155e909a43f526..d92158e3277bc1 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -14,29 +14,19 @@ abfb ABI ABIs ables -AccessControl -AccessControlEntry +accesscontrol accessor Accessors -AccountLogin acdbc ack ACKed ACL ACLs actdiag -AdapterAddress -AdapterName adb AddNOC -AddOrUpdateThreadNetwork -AddOrUpdateWiFiNetwork addr -AddResponse -AddThreadNetwork -AddStatus adk -AdministratorCommissioning adoc adr AdvAutonomous @@ -48,7 +38,6 @@ AE aef AES AIDL -AlarmCode algs alloc Ameba @@ -61,15 +50,12 @@ AnnounceOTAProvider AnnounceOTAProviderRequest APIs apk -AppConfig AppImpl AppleTV appliable -ApplianceControl applianceeventsandalert ApplianceIdentification appliancestatistics -ApplicationBasic ApplicationId ApplicationIdentifier ApplicationLauncher @@ -171,7 +157,6 @@ BRD breakpoint bredr BridgedDeviceBasicInformation -bridgedLightEndpoint bringup BroadcastReceiver BromateConcentrationMeasurement @@ -259,9 +244,6 @@ CLIs cloudbuild CLRF clusterAttrs -clusterId -clusterList -clusterListName ClusterName ClusterObjectTests ClusterRevision @@ -315,7 +297,6 @@ ContentApp's ContentAppPlatform ContentLaunch ContentLauncher -continuousHinting contrib controllee conv @@ -382,7 +363,6 @@ DefaultOTARequestor DefaultOTARequestorDriver DefaultOTARequestorStorage DefaultSuccess -defaultValue definedValue DehumidificationControl DelayedActionTime @@ -415,9 +395,7 @@ DeviceLayer DeviceNetworkProvisioningDelegate DeviceNetworkProvisioningDelegateImpl DevicePairingDelegate -deviceSoftwareVersionModel DeviceTemperatureConfiguration -deviceType DevKitC DevKitM devtype @@ -511,8 +489,6 @@ EnableNetwork EnableWiFiNetwork endian EndpointId -endpointName -endsWith eno entrypoint enum @@ -580,7 +556,6 @@ FlowMeasurement FluorideConcentrationMeasurement focusable forkpty -formatOnSave FOTA FreeRTOS FreeRTOSConfig @@ -614,7 +589,6 @@ GetIP getManualTests GetSafeAttributePersistenceProvider getstarted -getTests GH ghcr ghp @@ -639,8 +613,6 @@ graphviz Groupcast GroupId GroupKeyManagement -groupKeySecurityPolicy -groupKeySetID groupsettings gsdk gtk @@ -694,8 +666,6 @@ ifconfig ifdef ifdefs IGMP -ignoreApplyUpdate -ignoreQueryImage ihex IlluminanceMeasurement IM diff --git a/.github/workflows/spell.yml b/.github/workflows/spell.yml index 57593372543079..1e8194a9a2075f 100644 --- a/.github/workflows/spell.yml +++ b/.github/workflows/spell.yml @@ -25,19 +25,20 @@ on: - ".github/.wordlist.txt" jobs: - check-reviewdog: - name: Check Spelling - reviewdog - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - uses: reviewdog/action-misspell@v1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} +# Seems redundant; removed as pyspelling is customized while this is not +# check-reviewdog: +# name: Check Spelling - reviewdog +# runs-on: ubuntu-latest +# steps: +# - name: Checkout +# uses: actions/checkout@v4 +# - uses: reviewdog/action-misspell@v1 +# with: +# github_token: ${{ secrets.GITHUB_TOKEN }} check-spellcheck: name: Check Spelling - pyspelling runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - - uses: igsekor/pyspelling-any@v1.0.4 + - uses: rojopolis/spellcheck-github-actions@0.36.0 diff --git a/.spellcheck.yml b/.spellcheck.yml index c04880827addba..27a48c7de8e174 100644 --- a/.spellcheck.yml +++ b/.spellcheck.yml @@ -68,3 +68,4 @@ matrix: - '**/*.md|!third_party/**|!examples/common/**/repo/**|!docs/ERROR_CODES.md|!docs/clusters.md|!docs/testing/yaml_schema.md|!docs/testing/yaml_pseudocluster.md' aspell: ignore-case: true + camel-case: true From 3edfb9c77181822f6c92b92bf47ca8684f88984d Mon Sep 17 00:00:00 2001 From: Curtis Rahman <111998767+CuRahman@users.noreply.github.com> Date: Thu, 22 Feb 2024 14:44:43 -0500 Subject: [PATCH 20/29] Changed #if statement to #ifdef for SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT (#32268) --- examples/platform/silabs/FreeRTOSConfig.h | 2 +- src/platform/silabs/platformAbstraction/GsdkSpam.cpp | 4 ++-- third_party/silabs/efr32_sdk.gni | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/platform/silabs/FreeRTOSConfig.h b/examples/platform/silabs/FreeRTOSConfig.h index 93c7ee36444715..478dfa10be547f 100644 --- a/examples/platform/silabs/FreeRTOSConfig.h +++ b/examples/platform/silabs/FreeRTOSConfig.h @@ -122,7 +122,7 @@ extern uint32_t SystemCoreClock; #include "sl_component_catalog.h" #endif -#if SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT +#ifdef SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT #include "SEGGER_SYSVIEW_FreeRTOS.h" #endif diff --git a/src/platform/silabs/platformAbstraction/GsdkSpam.cpp b/src/platform/silabs/platformAbstraction/GsdkSpam.cpp index dda1b7e0e19dac..5527fbfe90d73d 100644 --- a/src/platform/silabs/platformAbstraction/GsdkSpam.cpp +++ b/src/platform/silabs/platformAbstraction/GsdkSpam.cpp @@ -49,7 +49,7 @@ extern "C" { #include "uart.h" #endif -#if SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT +#ifdef SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT #include "SEGGER_SYSVIEW.h" #endif } @@ -78,7 +78,7 @@ CHIP_ERROR SilabsPlatform::Init(void) sl_ot_sys_init(); #endif -#if SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT +#ifdef SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT SEGGER_SYSVIEW_Conf(); SEGGER_SYSVIEW_Start(); #endif diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index 9868b47efb8a8d..8510295bf7c2e0 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -401,7 +401,7 @@ template("efr32_sdk") { "${efr32_sdk_root}/util/third_party/segger/systemview/profiles/freertos_v10/", ] - defines += [ "SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT=1" ] + defines += [ "SL_CATALOG_SYSTEMVIEW_TRACE_PRESENT" ] } defines += board_defines From f2bdd1fc34b6b09ac9fe1d8a18e6c6b6b5001a31 Mon Sep 17 00:00:00 2001 From: Robert Szewczyk Date: Thu, 22 Feb 2024 20:58:26 +0000 Subject: [PATCH 21/29] EnergyPreference: Simplify logic around interaction with delegate (#32271) `Optional` is directly constructible from `Optional` --- .../energy-preference-server/energy-preference-server.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/app/clusters/energy-preference-server/energy-preference-server.cpp b/src/app/clusters/energy-preference-server/energy-preference-server.cpp index 7cb377a7221ba1..c3c645f3108982 100644 --- a/src/app/clusters/energy-preference-server/energy-preference-server.cpp +++ b/src/app/clusters/energy-preference-server/energy-preference-server.cpp @@ -78,9 +78,7 @@ CHIP_ERROR EnergyPrefAttrAccess::Read(const ConcreteReadAttributePath & aPath, A Optional label{ MutableCharSpan(buffer) }; if ((err = gsDelegate->GetEnergyBalanceAtIndex(endpoint, index, step, label)) == CHIP_NO_ERROR) { - BalanceStruct::Type balance = { step, - label.HasValue() ? Optional(label.Value()) - : Optional() }; + BalanceStruct::Type balance = { step, Optional(label) }; ReturnErrorOnFailure(encoder.Encode(balance)); index++; } @@ -137,9 +135,7 @@ CHIP_ERROR EnergyPrefAttrAccess::Read(const ConcreteReadAttributePath & aPath, A Optional label{ MutableCharSpan(buffer) }; if ((err = gsDelegate->GetLowPowerModeSensitivityAtIndex(endpoint, index, step, label)) == CHIP_NO_ERROR) { - BalanceStruct::Type balance = { step, - label.HasValue() ? Optional(label.Value()) - : Optional() }; + BalanceStruct::Type balance = { step, Optional(label) }; ReturnErrorOnFailure(encoder.Encode(balance)); index++; } From 7e3774e7c7bbb2cb949437b960a95a4589c8d1dc Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 22 Feb 2024 16:38:21 -0500 Subject: [PATCH 22/29] zap pregenerated dir does not exist anymore at all. zzz_generated is mostly empty (#32272) Co-authored-by: Andrei Litvin --- .../air-purifier-common/BUILD.gn | 3 -- .../air-quality-sensor-common/BUILD.gn | 3 -- .../all-clusters-common/BUILD.gn | 3 -- .../all-clusters-common/BUILD.gn | 3 -- examples/bridge-app/bridge-common/BUILD.gn | 1 - examples/chef/linux/BUILD.gn | 2 -- examples/chef/silabs/BUILD.gn | 2 -- .../contact-sensor-common/BUILD.gn | 3 -- .../contact-sensor-app/nxp/zap-lit/BUILD.gn | 3 -- .../contact-sensor-app/nxp/zap-sit/BUILD.gn | 3 -- .../dishwasher-app/dishwasher-common/BUILD.gn | 3 -- .../energy-management-common/BUILD.gn | 3 -- .../light-switch-common/BUILD.gn | 4 --- examples/light-switch-app/qpg/zap/BUILD.gn | 3 -- .../lighting-app/bouffalolab/bl602/BUILD.gn | 2 -- .../lighting-app/bouffalolab/bl702/BUILD.gn | 2 -- .../lighting-app/bouffalolab/bl702l/BUILD.gn | 2 -- .../lighting-app/lighting-common/BUILD.gn | 2 -- examples/lighting-app/nxp/zap/BUILD.gn | 3 -- examples/lighting-app/qpg/zap/BUILD.gn | 3 -- .../lighting-app/silabs/data_model/BUILD.gn | 2 -- examples/lit-icd-app/lit-icd-common/BUILD.gn | 3 -- examples/lock-app/lock-common/BUILD.gn | 2 -- examples/lock-app/nxp/zap/BUILD.gn | 2 -- examples/lock-app/qpg/zap/BUILD.gn | 2 -- .../log-source-app/log-source-common/BUILD.gn | 3 -- .../microwave-oven-common/BUILD.gn | 3 -- .../network-manager-common/BUILD.gn | 3 -- .../ota-provider-common/BUILD.gn | 3 -- .../ota-requestor-common/BUILD.gn | 3 -- examples/placeholder/linux/apps/app1/BUILD.gn | 3 -- examples/placeholder/linux/apps/app2/BUILD.gn | 3 -- examples/pump-app/pump-common/BUILD.gn | 2 -- examples/pump-app/silabs/data_model/BUILD.gn | 2 -- .../pump-controller-common/BUILD.gn | 3 -- .../refrigerator-common/BUILD.gn | 3 -- examples/rvc-app/rvc-common/BUILD.gn | 2 -- .../smoke-co-alarm-common/BUILD.gn | 3 -- .../temperature-measurement-common/BUILD.gn | 3 -- examples/thermostat/nxp/zap/BUILD.gn | 2 -- examples/thermostat/qpg/zap/BUILD.gn | 3 -- .../thermostat/thermostat-common/BUILD.gn | 2 -- examples/tv-app/tv-common/BUILD.gn | 2 -- .../tv-casting-app/tv-casting-common/BUILD.gn | 3 -- .../virtual-device-common/BUILD.gn | 3 -- examples/window-app/common/BUILD.gn | 2 -- src/app/chip_data_model.gni | 35 +------------------ src/controller/data_model/BUILD.gn | 4 --- 48 files changed, 1 insertion(+), 158 deletions(-) diff --git a/examples/air-purifier-app/air-purifier-common/BUILD.gn b/examples/air-purifier-app/air-purifier-common/BUILD.gn index 9715f88e65f2b3..aaf01bf29b7ba0 100755 --- a/examples/air-purifier-app/air-purifier-common/BUILD.gn +++ b/examples/air-purifier-app/air-purifier-common/BUILD.gn @@ -17,8 +17,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("air-purifier-common") { zap_file = "air-purifier-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/air-purifier-app/zap-generated" is_server = true } diff --git a/examples/air-quality-sensor-app/air-quality-sensor-common/BUILD.gn b/examples/air-quality-sensor-app/air-quality-sensor-common/BUILD.gn index 6ca5be5ba634db..5cdba00ee78fc0 100755 --- a/examples/air-quality-sensor-app/air-quality-sensor-common/BUILD.gn +++ b/examples/air-quality-sensor-app/air-quality-sensor-common/BUILD.gn @@ -17,8 +17,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("air-quality-sensor-common") { zap_file = "air-quality-sensor-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/air-quality-sensor-app/zap-generated" is_server = true } diff --git a/examples/all-clusters-app/all-clusters-common/BUILD.gn b/examples/all-clusters-app/all-clusters-common/BUILD.gn index 0210fcedb2c646..1b29a9c2775353 100644 --- a/examples/all-clusters-app/all-clusters-common/BUILD.gn +++ b/examples/all-clusters-app/all-clusters-common/BUILD.gn @@ -18,8 +18,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("all-clusters-common") { zap_file = "all-clusters-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/all-clusters-app/zap-generated" is_server = true } diff --git a/examples/all-clusters-minimal-app/all-clusters-common/BUILD.gn b/examples/all-clusters-minimal-app/all-clusters-common/BUILD.gn index 9991df1e8274ea..cd518cb42fe388 100644 --- a/examples/all-clusters-minimal-app/all-clusters-common/BUILD.gn +++ b/examples/all-clusters-minimal-app/all-clusters-common/BUILD.gn @@ -18,8 +18,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("all-clusters-common") { zap_file = "all-clusters-minimal-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/all-clusters-minimal-app/zap-generated" is_server = true } diff --git a/examples/bridge-app/bridge-common/BUILD.gn b/examples/bridge-app/bridge-common/BUILD.gn index ac3aa414ae3791..e833d33429567e 100644 --- a/examples/bridge-app/bridge-common/BUILD.gn +++ b/examples/bridge-app/bridge-common/BUILD.gn @@ -19,7 +19,6 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("bridge-common") { zap_file = "bridge-app.zap" - zap_pregenerated_dir = "${chip_root}/zzz_generated/bridge-app/zap-generated" is_server = true # TODO: the definition of DYNAMIC_ENDPOINT_COUNT needs find a common home! diff --git a/examples/chef/linux/BUILD.gn b/examples/chef/linux/BUILD.gn index a119f832e051db..02fa77dac864e5 100644 --- a/examples/chef/linux/BUILD.gn +++ b/examples/chef/linux/BUILD.gn @@ -35,8 +35,6 @@ project_dir = "./.." chip_data_model("chef-data-model") { zap_file = "${project_dir}/devices/${sample_zap_file}" - zap_pregenerated_dir = - "${chip_root}/examples/chef/out/${sample_name}/zap-generated/" is_server = true } diff --git a/examples/chef/silabs/BUILD.gn b/examples/chef/silabs/BUILD.gn index 3f74106f9f54c2..528fe2f2cfc50a 100644 --- a/examples/chef/silabs/BUILD.gn +++ b/examples/chef/silabs/BUILD.gn @@ -48,8 +48,6 @@ declare_args() { chip_data_model("chef-common") { zap_file = "${chef_project_dir}/devices/${sample_name}.zap" - - zap_pregenerated_dir = "${chef_project_dir}/out/${sample_name}/zap-generated/" is_server = true } diff --git a/examples/contact-sensor-app/contact-sensor-common/BUILD.gn b/examples/contact-sensor-app/contact-sensor-common/BUILD.gn index d95af40a21a3ff..b95b549f746cb6 100755 --- a/examples/contact-sensor-app/contact-sensor-common/BUILD.gn +++ b/examples/contact-sensor-app/contact-sensor-common/BUILD.gn @@ -17,8 +17,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("contact-sensor-common") { zap_file = "contact-sensor-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/contact-sensor-app/zap-generated" is_server = true } diff --git a/examples/contact-sensor-app/nxp/zap-lit/BUILD.gn b/examples/contact-sensor-app/nxp/zap-lit/BUILD.gn index 7adfcbb7790a35..3baf5c4f59f105 100644 --- a/examples/contact-sensor-app/nxp/zap-lit/BUILD.gn +++ b/examples/contact-sensor-app/nxp/zap-lit/BUILD.gn @@ -18,8 +18,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("zap-lit") { zap_file = "contact-sensor-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/contact-sensor-app/nxp/zap-generated" is_server = true } diff --git a/examples/contact-sensor-app/nxp/zap-sit/BUILD.gn b/examples/contact-sensor-app/nxp/zap-sit/BUILD.gn index e9a20db41208d3..55fed097d333c8 100644 --- a/examples/contact-sensor-app/nxp/zap-sit/BUILD.gn +++ b/examples/contact-sensor-app/nxp/zap-sit/BUILD.gn @@ -18,8 +18,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("zap-sit") { zap_file = "contact-sensor-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/contact-sensor-app/nxp/zap-generated" is_server = true } diff --git a/examples/dishwasher-app/dishwasher-common/BUILD.gn b/examples/dishwasher-app/dishwasher-common/BUILD.gn index 01b634362098cd..73debf8ce3cbe1 100644 --- a/examples/dishwasher-app/dishwasher-common/BUILD.gn +++ b/examples/dishwasher-app/dishwasher-common/BUILD.gn @@ -21,8 +21,5 @@ config("config") { chip_data_model("dishwasher-common") { zap_file = "dishwasher-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/dishwasher-app/zap-generated" is_server = true } diff --git a/examples/energy-management-app/energy-management-common/BUILD.gn b/examples/energy-management-app/energy-management-common/BUILD.gn index 7c2040c1a4dc37..937aca9f1746d0 100644 --- a/examples/energy-management-app/energy-management-common/BUILD.gn +++ b/examples/energy-management-app/energy-management-common/BUILD.gn @@ -22,8 +22,5 @@ config("config") { chip_data_model("energy-management-common") { zap_file = "energy-management-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/energy-management-app/zap-generated" is_server = true } diff --git a/examples/light-switch-app/light-switch-common/BUILD.gn b/examples/light-switch-app/light-switch-common/BUILD.gn index 163e841678101a..8ec49aac0fa870 100644 --- a/examples/light-switch-app/light-switch-common/BUILD.gn +++ b/examples/light-switch-app/light-switch-common/BUILD.gn @@ -17,9 +17,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("light-switch-common") { zap_file = "light-switch-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/light-switch-app/zap-generated" - is_server = true } diff --git a/examples/light-switch-app/qpg/zap/BUILD.gn b/examples/light-switch-app/qpg/zap/BUILD.gn index 35ac7ff5f28346..87282159a25ab3 100644 --- a/examples/light-switch-app/qpg/zap/BUILD.gn +++ b/examples/light-switch-app/qpg/zap/BUILD.gn @@ -17,8 +17,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("zap") { zap_file = "switch.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/light-switch-app/qpg/zap-generated" is_server = true } diff --git a/examples/lighting-app/bouffalolab/bl602/BUILD.gn b/examples/lighting-app/bouffalolab/bl602/BUILD.gn index ab89ae3f3bdb63..7a4d4545e5ef28 100644 --- a/examples/lighting-app/bouffalolab/bl602/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl602/BUILD.gn @@ -90,8 +90,6 @@ bl_iot_sdk("sdk") { chip_data_model("bouffalolab-lighting") { zap_file = "${example_dir}/data_model/lighting-app-wifi.zap" - - zap_pregenerated_dir = "${chip_root}/zzz_generated/lighting-app/zap-generated" is_server = true } diff --git a/examples/lighting-app/bouffalolab/bl702/BUILD.gn b/examples/lighting-app/bouffalolab/bl702/BUILD.gn index f923e3bad6ffe9..05526ff9563e58 100644 --- a/examples/lighting-app/bouffalolab/bl702/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl702/BUILD.gn @@ -122,8 +122,6 @@ chip_data_model("bouffalolab-lighting") { } else { zap_file = "${example_dir}/data_model/lighting-app-ethernet.zap" } - - zap_pregenerated_dir = "${chip_root}/zzz_generated/lighting-app/zap-generated" is_server = true } diff --git a/examples/lighting-app/bouffalolab/bl702l/BUILD.gn b/examples/lighting-app/bouffalolab/bl702l/BUILD.gn index 24fad9ffa1897d..ea06cfa41ac001 100644 --- a/examples/lighting-app/bouffalolab/bl702l/BUILD.gn +++ b/examples/lighting-app/bouffalolab/bl702l/BUILD.gn @@ -99,8 +99,6 @@ bl_iot_sdk("sdk") { chip_data_model("bouffalolab-lighting") { zap_file = "${example_dir}/data_model/lighting-app-thread.zap" - - zap_pregenerated_dir = "${chip_root}/zzz_generated/lighting-app/zap-generated" is_server = true } diff --git a/examples/lighting-app/lighting-common/BUILD.gn b/examples/lighting-app/lighting-common/BUILD.gn index e983b3e0e0f11c..eb24b69dd214e1 100644 --- a/examples/lighting-app/lighting-common/BUILD.gn +++ b/examples/lighting-app/lighting-common/BUILD.gn @@ -21,8 +21,6 @@ config("config") { chip_data_model("lighting-common") { zap_file = "lighting-app.zap" - - zap_pregenerated_dir = "${chip_root}/zzz_generated/lighting-app/zap-generated" is_server = true } diff --git a/examples/lighting-app/nxp/zap/BUILD.gn b/examples/lighting-app/nxp/zap/BUILD.gn index fd4026e2b9dbf7..4280629a03cc3a 100644 --- a/examples/lighting-app/nxp/zap/BUILD.gn +++ b/examples/lighting-app/nxp/zap/BUILD.gn @@ -18,8 +18,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("zap") { zap_file = "lighting-on-off.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/lighting-app/nxp/zap-generated" is_server = true } diff --git a/examples/lighting-app/qpg/zap/BUILD.gn b/examples/lighting-app/qpg/zap/BUILD.gn index ec69db0b412a8c..c9de674a2bf8c8 100644 --- a/examples/lighting-app/qpg/zap/BUILD.gn +++ b/examples/lighting-app/qpg/zap/BUILD.gn @@ -17,8 +17,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("zap") { zap_file = "light.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/lighting-app/qpg/zap-generated" is_server = true } diff --git a/examples/lighting-app/silabs/data_model/BUILD.gn b/examples/lighting-app/silabs/data_model/BUILD.gn index 9f1ee0d2aee78e..45062169315f03 100644 --- a/examples/lighting-app/silabs/data_model/BUILD.gn +++ b/examples/lighting-app/silabs/data_model/BUILD.gn @@ -22,7 +22,5 @@ chip_data_model("silabs-lighting") { } else { zap_file = "lighting-thread-app.zap" } - - zap_pregenerated_dir = "${chip_root}/zzz_generated/lighting-app/zap-generated" is_server = true } diff --git a/examples/lit-icd-app/lit-icd-common/BUILD.gn b/examples/lit-icd-app/lit-icd-common/BUILD.gn index a20d519c1cd7fa..28aa29a3981a69 100644 --- a/examples/lit-icd-app/lit-icd-common/BUILD.gn +++ b/examples/lit-icd-app/lit-icd-common/BUILD.gn @@ -17,8 +17,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("lit-icd-common") { zap_file = "lit-icd-server-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/lit-icd-server-app/zap-generated" is_server = true } diff --git a/examples/lock-app/lock-common/BUILD.gn b/examples/lock-app/lock-common/BUILD.gn index bb01a5185f80f7..1312ec49bd134f 100644 --- a/examples/lock-app/lock-common/BUILD.gn +++ b/examples/lock-app/lock-common/BUILD.gn @@ -17,8 +17,6 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("lock-common") { zap_file = "lock-app.zap" - - zap_pregenerated_dir = "${chip_root}/zzz_generated/lock-app/zap-generated" is_server = true } diff --git a/examples/lock-app/nxp/zap/BUILD.gn b/examples/lock-app/nxp/zap/BUILD.gn index cc5fe9361c32a3..a21a2d57a57212 100644 --- a/examples/lock-app/nxp/zap/BUILD.gn +++ b/examples/lock-app/nxp/zap/BUILD.gn @@ -17,7 +17,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("zap") { zap_file = "lock-app.zap" - - zap_pregenerated_dir = "${chip_root}/zzz_generated/lock-app/nxp/zap-generated" is_server = true } diff --git a/examples/lock-app/qpg/zap/BUILD.gn b/examples/lock-app/qpg/zap/BUILD.gn index 67e29db5f3f249..8560b5249ca5c9 100644 --- a/examples/lock-app/qpg/zap/BUILD.gn +++ b/examples/lock-app/qpg/zap/BUILD.gn @@ -17,7 +17,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("zap") { zap_file = "lock.zap" - - zap_pregenerated_dir = "${chip_root}/zzz_generated/lock-app/qpg/zap-generated" is_server = true } diff --git a/examples/log-source-app/log-source-common/BUILD.gn b/examples/log-source-app/log-source-common/BUILD.gn index 1c434c209fb057..9aa178c078ed82 100644 --- a/examples/log-source-app/log-source-common/BUILD.gn +++ b/examples/log-source-app/log-source-common/BUILD.gn @@ -23,9 +23,6 @@ config("config") { chip_data_model("log-source-common") { zap_file = "log-source-app.zap" - zap_pregenerated_dir = - "${chip_root}/zzz_generated/log-source-app/zap-generated" - deps = [ "${chip_root}/src/protocols/bdx" ] is_server = true diff --git a/examples/microwave-oven-app/microwave-oven-common/BUILD.gn b/examples/microwave-oven-app/microwave-oven-common/BUILD.gn index 121f067a6a7d75..dd91ce23a30eed 100644 --- a/examples/microwave-oven-app/microwave-oven-common/BUILD.gn +++ b/examples/microwave-oven-app/microwave-oven-common/BUILD.gn @@ -21,8 +21,5 @@ config("config") { chip_data_model("microwave-oven-common") { zap_file = "microwave-oven-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/microwave-oven-app/zap-generated" is_server = true } diff --git a/examples/network-manager-app/network-manager-common/BUILD.gn b/examples/network-manager-app/network-manager-common/BUILD.gn index eced7ddbbbff7a..e220377a7963cb 100644 --- a/examples/network-manager-app/network-manager-common/BUILD.gn +++ b/examples/network-manager-app/network-manager-common/BUILD.gn @@ -17,8 +17,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("network-manager-common") { zap_file = "network-manager-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/network-manager-app/zap-generated" is_server = true } diff --git a/examples/ota-provider-app/ota-provider-common/BUILD.gn b/examples/ota-provider-app/ota-provider-common/BUILD.gn index 63c5f2d1de5083..c13b1e1e73254c 100644 --- a/examples/ota-provider-app/ota-provider-common/BUILD.gn +++ b/examples/ota-provider-app/ota-provider-common/BUILD.gn @@ -23,9 +23,6 @@ config("config") { chip_data_model("ota-provider-common") { zap_file = "ota-provider-app.zap" - zap_pregenerated_dir = - "${chip_root}/zzz_generated/ota-provider-app/zap-generated" - sources = [ "BdxOtaSender.cpp", "BdxOtaSender.h", diff --git a/examples/ota-requestor-app/ota-requestor-common/BUILD.gn b/examples/ota-requestor-app/ota-requestor-common/BUILD.gn index edce1324ea7e1f..550d4c09aeb968 100644 --- a/examples/ota-requestor-app/ota-requestor-common/BUILD.gn +++ b/examples/ota-requestor-app/ota-requestor-common/BUILD.gn @@ -23,9 +23,6 @@ config("config") { chip_data_model("ota-requestor-common") { zap_file = "ota-requestor-app.zap" - zap_pregenerated_dir = - "${chip_root}/zzz_generated/ota-requestor-app/zap-generated" - deps = [ "${chip_root}/src/lib" ] public_configs = [ ":config" ] diff --git a/examples/placeholder/linux/apps/app1/BUILD.gn b/examples/placeholder/linux/apps/app1/BUILD.gn index ef7c277ec7f663..f16b9301ce3a90 100644 --- a/examples/placeholder/linux/apps/app1/BUILD.gn +++ b/examples/placeholder/linux/apps/app1/BUILD.gn @@ -17,9 +17,6 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("configuration") { zap_file = "config.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/placeholder/app1/zap-generated" is_server = true } diff --git a/examples/placeholder/linux/apps/app2/BUILD.gn b/examples/placeholder/linux/apps/app2/BUILD.gn index 5c18b7d2dc0914..2bea36611ffb37 100644 --- a/examples/placeholder/linux/apps/app2/BUILD.gn +++ b/examples/placeholder/linux/apps/app2/BUILD.gn @@ -17,9 +17,6 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("configuration") { zap_file = "config.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/placeholder/app2/zap-generated" is_server = true } diff --git a/examples/pump-app/pump-common/BUILD.gn b/examples/pump-app/pump-common/BUILD.gn index 58508f60af8adb..1e7280f5190079 100644 --- a/examples/pump-app/pump-common/BUILD.gn +++ b/examples/pump-app/pump-common/BUILD.gn @@ -18,7 +18,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("pump-common") { zap_file = "pump-app.zap" - - zap_pregenerated_dir = "${chip_root}/zzz_generated/pump-app/zap-generated" is_server = true } diff --git a/examples/pump-app/silabs/data_model/BUILD.gn b/examples/pump-app/silabs/data_model/BUILD.gn index 35d878aedcb90f..230ba5406364e3 100644 --- a/examples/pump-app/silabs/data_model/BUILD.gn +++ b/examples/pump-app/silabs/data_model/BUILD.gn @@ -22,7 +22,5 @@ chip_data_model("silabs-pump") { } else { zap_file = "pump-thread-app.zap" } - - zap_pregenerated_dir = "${chip_root}/zzz_generated/pump-app/zap-generated" is_server = true } diff --git a/examples/pump-controller-app/pump-controller-common/BUILD.gn b/examples/pump-controller-app/pump-controller-common/BUILD.gn index e62de422b08097..82e222e43ff4e1 100644 --- a/examples/pump-controller-app/pump-controller-common/BUILD.gn +++ b/examples/pump-controller-app/pump-controller-common/BUILD.gn @@ -18,8 +18,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("pump-controller-common") { zap_file = "pump-controller-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/pump-controller-app/zap-generated" is_server = true } diff --git a/examples/refrigerator-app/refrigerator-common/BUILD.gn b/examples/refrigerator-app/refrigerator-common/BUILD.gn index c747755e86c598..4e8e72bb343ff3 100644 --- a/examples/refrigerator-app/refrigerator-common/BUILD.gn +++ b/examples/refrigerator-app/refrigerator-common/BUILD.gn @@ -21,8 +21,5 @@ config("config") { chip_data_model("refrigerator-common") { zap_file = "refrigerator-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/refrigerator-app/zap-generated" is_server = true } diff --git a/examples/rvc-app/rvc-common/BUILD.gn b/examples/rvc-app/rvc-common/BUILD.gn index d567043f3ee346..2491f97d9b9809 100644 --- a/examples/rvc-app/rvc-common/BUILD.gn +++ b/examples/rvc-app/rvc-common/BUILD.gn @@ -21,7 +21,5 @@ config("config") { chip_data_model("rvc-common") { zap_file = "rvc-app.zap" - - zap_pregenerated_dir = "${chip_root}/zzz_generated/rvc-app/zap-generated" is_server = true } diff --git a/examples/smoke-co-alarm-app/smoke-co-alarm-common/BUILD.gn b/examples/smoke-co-alarm-app/smoke-co-alarm-common/BUILD.gn index 16e5328c1ba01c..6e78dcbf5c4f92 100644 --- a/examples/smoke-co-alarm-app/smoke-co-alarm-common/BUILD.gn +++ b/examples/smoke-co-alarm-app/smoke-co-alarm-common/BUILD.gn @@ -17,8 +17,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("smoke-co-alarm-common") { zap_file = "smoke-co-alarm-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/smoke-co-alarm-app/zap-generated" is_server = true } diff --git a/examples/temperature-measurement-app/temperature-measurement-common/BUILD.gn b/examples/temperature-measurement-app/temperature-measurement-common/BUILD.gn index 0430c288a90354..1f0f2daea65c76 100644 --- a/examples/temperature-measurement-app/temperature-measurement-common/BUILD.gn +++ b/examples/temperature-measurement-app/temperature-measurement-common/BUILD.gn @@ -18,8 +18,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("temperature-measurement-common") { zap_file = "temperature-measurement.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/temperature-measurement/zap-generated" is_server = true } diff --git a/examples/thermostat/nxp/zap/BUILD.gn b/examples/thermostat/nxp/zap/BUILD.gn index 976cd78f2e1a79..c3a3df7bd6729e 100644 --- a/examples/thermostat/nxp/zap/BUILD.gn +++ b/examples/thermostat/nxp/zap/BUILD.gn @@ -28,7 +28,5 @@ chip_data_model("zap") { zap_file = "thermostat_matter_thread.zap" } - # Defining zap_pregenerated_dir is required by chip_data_model.gni in order to build IMClusterCommandHandler.cpp - zap_pregenerated_dir = "" is_server = true } diff --git a/examples/thermostat/qpg/zap/BUILD.gn b/examples/thermostat/qpg/zap/BUILD.gn index 38074c904f32eb..3ea8a750459afc 100644 --- a/examples/thermostat/qpg/zap/BUILD.gn +++ b/examples/thermostat/qpg/zap/BUILD.gn @@ -17,8 +17,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("zap") { zap_file = "thermostaticRadiatorValve.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/thermostat/qpg/zap-generated" is_server = true } diff --git a/examples/thermostat/thermostat-common/BUILD.gn b/examples/thermostat/thermostat-common/BUILD.gn index 7f35acfdf371ad..93a0c7540fb93a 100644 --- a/examples/thermostat/thermostat-common/BUILD.gn +++ b/examples/thermostat/thermostat-common/BUILD.gn @@ -18,7 +18,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("thermostat-common") { zap_file = "thermostat.zap" - - zap_pregenerated_dir = "${chip_root}/zzz_generated/thermostat/zap-generated" is_server = true } diff --git a/examples/tv-app/tv-common/BUILD.gn b/examples/tv-app/tv-common/BUILD.gn index 699a13a20ec6e0..c253459d177caa 100644 --- a/examples/tv-app/tv-common/BUILD.gn +++ b/examples/tv-app/tv-common/BUILD.gn @@ -19,8 +19,6 @@ import("${chip_root}/src/lib/lib.gni") chip_data_model("tv-common") { zap_file = "tv-app.zap" - - zap_pregenerated_dir = "${chip_root}/zzz_generated/tv-app/zap-generated" is_server = true } diff --git a/examples/tv-casting-app/tv-casting-common/BUILD.gn b/examples/tv-casting-app/tv-casting-common/BUILD.gn index 38b983485c1800..ea6607a724b5cb 100644 --- a/examples/tv-casting-app/tv-casting-common/BUILD.gn +++ b/examples/tv-casting-app/tv-casting-common/BUILD.gn @@ -34,9 +34,6 @@ config("config") { chip_data_model("tv-casting-common") { zap_file = "tv-casting-app.zap" - zap_pregenerated_dir = - "${chip_root}/zzz_generated/tv-casting-app/zap-generated" - sources = [ "${chip_root}/examples/chip-tool/commands/clusters/ModelCommand.h", "${chip_root}/examples/chip-tool/commands/common/BDXDiagnosticLogsServerDelegate.cpp", diff --git a/examples/virtual-device-app/virtual-device-common/BUILD.gn b/examples/virtual-device-app/virtual-device-common/BUILD.gn index 73be6ac9628be1..82eaf78d8f63e6 100644 --- a/examples/virtual-device-app/virtual-device-common/BUILD.gn +++ b/examples/virtual-device-app/virtual-device-common/BUILD.gn @@ -19,8 +19,5 @@ import("${chip_root}/src/lib/lib.gni") chip_data_model("virtual-device-common") { zap_file = "virtual-device-app.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/virtual-device-app/zap-generated" is_server = true } diff --git a/examples/window-app/common/BUILD.gn b/examples/window-app/common/BUILD.gn index 42941ee10d38d5..62fbc3aa3da4cf 100644 --- a/examples/window-app/common/BUILD.gn +++ b/examples/window-app/common/BUILD.gn @@ -18,7 +18,5 @@ import("${chip_root}/src/app/chip_data_model.gni") chip_data_model("window-common") { zap_file = "window-app.zap" - - zap_pregenerated_dir = "${chip_root}/zzz_generated/window-app/zap-generated" is_server = true } diff --git a/src/app/chip_data_model.gni b/src/app/chip_data_model.gni index 85f5224ada7d37..3763243e404407 100644 --- a/src/app/chip_data_model.gni +++ b/src/app/chip_data_model.gni @@ -23,9 +23,6 @@ _app_root = get_path_info(".", "abspath") # Defines a source_set for CHIP data model. # # Arguments: -# zap_pregenerated_dir -# Path to the ZAP "gen" dir. -# # zap_file # Path to the ZAP input file. # @@ -54,14 +51,6 @@ template("chip_data_model") { _idl = string_replace(invoker.zap_file, ".zap", ".matter") } - config("${_data_model_name}_config") { - include_dirs = [] - - if (defined(invoker.zap_pregenerated_dir)) { - include_dirs += [ "${invoker.zap_pregenerated_dir}/.." ] - } - } - chip_zapgen("${_data_model_name}_zapgen") { input = rebase_path(invoker.zap_file) generator = "app-templates" @@ -82,18 +71,7 @@ template("chip_data_model") { prune_outputs = [] } - # TODO: It is unclear here why `zap_pregenerated_dir` has any relevance - # in including IMClusterCommandHandler or not. - # - # This logic has been carried over from previous code during compile - # time codegen addition, however the rationale of why pregenerated - # dir controls IMClusterCommandHandler needs to be explained and - # potentially controlled by a clearer variable (is this for controllers? - # is this during app compile but not others? I am unclear what - # zap_pregenerated_dir is supposed to convey. Existence of a directory - # does not obviously map to "need command handler cpp compiled in"). - if (defined(invoker.zap_pregenerated_dir) && - !chip_build_controller_dynamic_server) { + if (!chip_build_controller_dynamic_server) { outputs += [ "zap-generated/IMClusterCommandHandler.cpp" ] } else { if (defined(prune_outputs)) { @@ -101,8 +79,6 @@ template("chip_data_model") { } } - public_configs = [ ":${_data_model_name}_config" ] - if (!defined(deps)) { deps = [] } @@ -120,8 +96,6 @@ template("chip_data_model") { "app/cluster-init-callback.cpp", ] - public_configs = [ ":${_data_model_name}_config" ] - if (!defined(deps)) { deps = [] } @@ -136,7 +110,6 @@ template("chip_data_model") { forward_variables_from(invoker, "*", [ - "zap_pregenerated_dir", "zap_file", "is_server", "external_clusters", @@ -390,11 +363,5 @@ template("chip_data_model") { if (non_spec_compliant_ota_action_delay_floor >= 0) { cflags += [ "-DNON_SPEC_COMPLIANT_OTA_ACTION_DELAY_FLOOR=${non_spec_compliant_ota_action_delay_floor}" ] } - - if (!defined(public_configs)) { - public_configs = [] - } - - public_configs += [ ":${_data_model_name}_config" ] } } diff --git a/src/controller/data_model/BUILD.gn b/src/controller/data_model/BUILD.gn index 3b66d026699908..a0b57e7b91fc1e 100644 --- a/src/controller/data_model/BUILD.gn +++ b/src/controller/data_model/BUILD.gn @@ -42,9 +42,5 @@ chip_codegen("cluster-tlv-metadata") { chip_data_model("data_model") { zap_file = "controller-clusters.zap" - - zap_pregenerated_dir = - "${chip_root}/zzz_generated/controller-clusters/zap-generated" - allow_circular_includes_from = [ "${chip_root}/src/controller" ] } From 1cac17326c5c8e01fcdaa5b1808fa441ebea312c Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 22 Feb 2024 17:15:02 -0500 Subject: [PATCH 23/29] Bump pigweed to latest version (#32264) * Bump pigweed * Remove EnumCastOutOfRange check - todo to enable it later * zap-regen: apparently clang-format version changed * Minor updates based on clang-tidy feedback * Update size_t for RecordWriter.cpp * Restore pigweed update --------- Co-authored-by: Andrei Litvin --- .clang-tidy | 1 + .../app-templates/endpoint_config.h | 34 +++++++++---------- .../dnssd/minimal_mdns/core/RecordWriter.cpp | 2 +- src/lib/shell/commands/Dns.cpp | 2 +- src/lib/support/tests/TestIniEscaping.cpp | 1 - third_party/pigweed/repo | 2 +- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index b494558e513460..fcb62d5d505d32 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -35,6 +35,7 @@ Checks: > -clang-analyzer-cplusplus.Move, -clang-analyzer-deadcode.DeadStores, -clang-analyzer-nullability.NullablePassedToNonnull, + -clang-analyzer-optin.core.EnumCastOutOfRange, -clang-analyzer-optin.cplusplus.UninitializedObject, -clang-analyzer-optin.cplusplus.VirtualCall, -clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker, diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h index 6985b44ac27da5..38f04fbfea5857 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h @@ -302,15 +302,15 @@ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x7 }, /* ControlMode */ \ \ /* Endpoint: 1, Cluster: Thermostat (server) */ \ - { (uint16_t) 0xA28, (uint16_t) -0x6AB3, (uint16_t) 0x7FFF }, /* OccupiedCoolingSetpoint */ \ - { (uint16_t) 0x7D0, (uint16_t) -0x6AB3, (uint16_t) 0x7FFF }, /* OccupiedHeatingSetpoint */ \ - { (uint16_t) 0x2BC, (uint16_t) -0x6AB3, (uint16_t) 0x7FFF }, /* MinHeatSetpointLimit */ \ - { (uint16_t) 0xBB8, (uint16_t) -0x6AB3, (uint16_t) 0x7FFF }, /* MaxHeatSetpointLimit */ \ - { (uint16_t) 0x640, (uint16_t) -0x6AB3, (uint16_t) 0x7FFF }, /* MinCoolSetpointLimit */ \ - { (uint16_t) 0xC80, (uint16_t) -0x6AB3, (uint16_t) 0x7FFF }, /* MaxCoolSetpointLimit */ \ - { (uint16_t) 0x19, (uint16_t) 0x0, (uint16_t) 0x19 }, /* MinSetpointDeadBand */ \ - { (uint16_t) 0x4, (uint16_t) 0x0, (uint16_t) 0x5 }, /* ControlSequenceOfOperation */ \ - { (uint16_t) 0x1, (uint16_t) 0x0, (uint16_t) 0x9 }, /* SystemMode */ \ + { (uint16_t) 0xA28, (uint16_t) - 0x6AB3, (uint16_t) 0x7FFF }, /* OccupiedCoolingSetpoint */ \ + { (uint16_t) 0x7D0, (uint16_t) - 0x6AB3, (uint16_t) 0x7FFF }, /* OccupiedHeatingSetpoint */ \ + { (uint16_t) 0x2BC, (uint16_t) - 0x6AB3, (uint16_t) 0x7FFF }, /* MinHeatSetpointLimit */ \ + { (uint16_t) 0xBB8, (uint16_t) - 0x6AB3, (uint16_t) 0x7FFF }, /* MaxHeatSetpointLimit */ \ + { (uint16_t) 0x640, (uint16_t) - 0x6AB3, (uint16_t) 0x7FFF }, /* MinCoolSetpointLimit */ \ + { (uint16_t) 0xC80, (uint16_t) - 0x6AB3, (uint16_t) 0x7FFF }, /* MaxCoolSetpointLimit */ \ + { (uint16_t) 0x19, (uint16_t) 0x0, (uint16_t) 0x19 }, /* MinSetpointDeadBand */ \ + { (uint16_t) 0x4, (uint16_t) 0x0, (uint16_t) 0x5 }, /* ControlSequenceOfOperation */ \ + { (uint16_t) 0x1, (uint16_t) 0x0, (uint16_t) 0x9 }, /* SystemMode */ \ \ /* Endpoint: 1, Cluster: Fan Control (server) */ \ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x6 }, /* FanMode */ \ @@ -334,14 +334,14 @@ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0xFEFF }, /* StartUpColorTemperatureMireds */ \ \ /* Endpoint: 1, Cluster: Unit Testing (server) */ \ - { (uint16_t) 0x46, (uint16_t) 0x14, (uint16_t) 0x64 }, /* range_restricted_int8u */ \ - { (uint16_t) -0x14, (uint16_t) -0x28, (uint16_t) 0x32 }, /* range_restricted_int8s */ \ - { (uint16_t) 0xC8, (uint16_t) 0x64, (uint16_t) 0x3E8 }, /* range_restricted_int16u */ \ - { (uint16_t) -0x64, (uint16_t) -0x96, (uint16_t) 0xC8 }, /* range_restricted_int16s */ \ - { (uint16_t) 0x46, (uint16_t) 0x14, (uint16_t) 0x64 }, /* nullable_range_restricted_int8u */ \ - { (uint16_t) -0x14, (uint16_t) -0x28, (uint16_t) 0x32 }, /* nullable_range_restricted_int8s */ \ - { (uint16_t) 0xC8, (uint16_t) 0x64, (uint16_t) 0x3E8 }, /* nullable_range_restricted_int16u */ \ - { (uint16_t) -0x64, (uint16_t) -0x96, (uint16_t) 0xC8 }, /* nullable_range_restricted_int16s */ \ + { (uint16_t) 0x46, (uint16_t) 0x14, (uint16_t) 0x64 }, /* range_restricted_int8u */ \ + { (uint16_t) - 0x14, (uint16_t) - 0x28, (uint16_t) 0x32 }, /* range_restricted_int8s */ \ + { (uint16_t) 0xC8, (uint16_t) 0x64, (uint16_t) 0x3E8 }, /* range_restricted_int16u */ \ + { (uint16_t) - 0x64, (uint16_t) - 0x96, (uint16_t) 0xC8 }, /* range_restricted_int16s */ \ + { (uint16_t) 0x46, (uint16_t) 0x14, (uint16_t) 0x64 }, /* nullable_range_restricted_int8u */ \ + { (uint16_t) - 0x14, (uint16_t) - 0x28, (uint16_t) 0x32 }, /* nullable_range_restricted_int8s */ \ + { (uint16_t) 0xC8, (uint16_t) 0x64, (uint16_t) 0x3E8 }, /* nullable_range_restricted_int16u */ \ + { (uint16_t) - 0x64, (uint16_t) - 0x96, (uint16_t) 0xC8 }, /* nullable_range_restricted_int16s */ \ \ /* Endpoint: 2, Cluster: On/Off (server) */ \ { \ diff --git a/src/lib/dnssd/minimal_mdns/core/RecordWriter.cpp b/src/lib/dnssd/minimal_mdns/core/RecordWriter.cpp index 0249d80d6e35ff..41e9985687ad81 100644 --- a/src/lib/dnssd/minimal_mdns/core/RecordWriter.cpp +++ b/src/lib/dnssd/minimal_mdns/core/RecordWriter.cpp @@ -41,7 +41,7 @@ RecordWriter & RecordWriter::WriteQName(const FullQName & qname) size_t qNameWriteStart = mOutput->WritePos(); bool isFullyCompressed = true; - for (uint16_t i = 0; i < qname.nameCount; i++) + for (size_t i = 0; i < qname.nameCount; i++) { // find out if the record part remaining already is located somewhere diff --git a/src/lib/shell/commands/Dns.cpp b/src/lib/shell/commands/Dns.cpp index badd6681fceec3..6abb2dc0393fec 100644 --- a/src/lib/shell/commands/Dns.cpp +++ b/src/lib/shell/commands/Dns.cpp @@ -131,7 +131,7 @@ class DnsShellResolverDelegate : public Dnssd::CommissioningResolveDelegate, pub nodeData.resolutionData.isICDOperatingAsLIT.Value() ? "LIT" : "SIT"); } streamer_printf(streamer_get(), " IP addresses:\r\n"); - for (uint8_t i = 0; i < nodeData.resolutionData.numIPs; i++) + for (size_t i = 0; i < nodeData.resolutionData.numIPs; i++) { streamer_printf(streamer_get(), " %s\r\n", nodeData.resolutionData.ipAddress[i].ToString(ipAddressBuf)); } diff --git a/src/lib/support/tests/TestIniEscaping.cpp b/src/lib/support/tests/TestIniEscaping.cpp index 44f8b37058b3cb..784a8fffdcb156 100644 --- a/src/lib/support/tests/TestIniEscaping.cpp +++ b/src/lib/support/tests/TestIniEscaping.cpp @@ -45,7 +45,6 @@ void TestUnescaping(nlTestSuite * inSuite, void * inContext) // Test valid cases NL_TEST_ASSERT(inSuite, UnescapeKey("") == ""); NL_TEST_ASSERT(inSuite, UnescapeKey("abcd1234,!") == "abcd1234,!"); - std::string out = UnescapeKey("abcd1234,!"); NL_TEST_ASSERT(inSuite, UnescapeKey("ab\\x0acd\\x20\\x3d12\\x5c34\\x7f") == "ab\ncd =12\\34\x7f"); NL_TEST_ASSERT(inSuite, UnescapeKey("\\x20") == " "); NL_TEST_ASSERT(inSuite, UnescapeKey("\\x3d\\x3d\\x3d") == "==="); diff --git a/third_party/pigweed/repo b/third_party/pigweed/repo index 0380161bd68c21..5165b9c17a9933 160000 --- a/third_party/pigweed/repo +++ b/third_party/pigweed/repo @@ -1 +1 @@ -Subproject commit 0380161bd68c216a590230f0cc49d26add7eef8a +Subproject commit 5165b9c17a9933b8d0714ef701421bf065d5d66a From 6af0d149bfd850ce5a89d1f73a5a92b17f385097 Mon Sep 17 00:00:00 2001 From: Tennessee Carmel-Veilleux Date: Thu, 22 Feb 2024 17:44:52 -0500 Subject: [PATCH 24/29] Set extended default advertising to be 1285ms (#32277) * Set extended default advertising to be 1285ms - 1285ms is more reliable than 1200ms in general (https://github.com/CHIP-Specifications/connectedhomeip-spec/pull/8965) - Update TC-DD-2.1 script to match (https://github.com/CHIP-Specifications/chip-test-plans/pull/4020) - Update EFR32 platform to be tolerant of min==max for advertising rate Issue #32274 Fixes #32275 Testing done: - Linux builds, still discoverable, extended rate 1285ms - Tested with nRFConnect - EFR32 builds, still discoverable, extended rate 1285ms +/- 2ms - Tested with nRFConnect and xG24 Explorer kit * Restyled by clang-format --------- Co-authored-by: Restyled.io --- .../suites/certification/Test_TC_DD_2_1.yaml | 5 +++-- src/include/platform/CHIPDeviceConfig.h | 18 ++++++++---------- src/platform/silabs/efr32/BLEManagerImpl.cpp | 7 +++++++ 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/app/tests/suites/certification/Test_TC_DD_2_1.yaml b/src/app/tests/suites/certification/Test_TC_DD_2_1.yaml index 07533321325728..94888631f6a143 100644 --- a/src/app/tests/suites/certification/Test_TC_DD_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_DD_2_1.yaml @@ -123,8 +123,9 @@ tests: Try NRF Connect app (https://www.nordicsemi.com/Products/Development-tools/nrf-connect-for-desktop) OR HCIDump (https://ubuntu.com/core/docs/bluez/reference/commands) - ->For T0 and 30s we have to get advertisement range between 20ms to 60ms - ->For 30s and 15mins we have to get advertisement range between 150ms to 1200ms + ->Between [0 .. 30s[ expect advertisement range between 20ms to 60ms. + ->Between [30s .. 900s[ expect advertisement range between 150ms to 1285ms. Allow +/- 10ms margin on the measured value. + ->Starting at 900s expect advertisement range larger or equal to 1200ms. disabled: true - label: "Step 6: TH does not respond to DUT. User power cycles the DUT" diff --git a/src/include/platform/CHIPDeviceConfig.h b/src/include/platform/CHIPDeviceConfig.h index 6ee7d9c9634999..88ef78d1005314 100644 --- a/src/include/platform/CHIPDeviceConfig.h +++ b/src/include/platform/CHIPDeviceConfig.h @@ -647,28 +647,26 @@ * CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING_INTERVAL_MIN * * The minimum interval (in units of 0.625ms) at which the device will send BLE advertisements while - * in the extended advertising mode. The minimum interval shall not be smaller than the default value - * and should not be equal to the CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING_INTERVAL_MAX. + * in the extended advertising mode. The minimum interval shall not be smaller than the default value. * - * Defaults to 1920 (1200 ms). + * Defaults to 2056 (1285 ms). */ -#define CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING_INTERVAL_MIN 1920 +#define CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING_INTERVAL_MIN 2056 /** * CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING_INTERVAL_MAX * * The maximum interval (in units of 0.625ms) at which the device will send BLE advertisements while - * in the extended advertising mode. The maximum interval should be greater and not equal to the - * CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING_INTERVAL_MIN. + * in the extended advertising mode. The maximum interval should be greater. * - * Defaults to 1936 (1210 ms). + * Defaults to 2056 (1285 ms). */ #ifndef CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING_INTERVAL_MAX -#define CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING_INTERVAL_MAX 1936 +#define CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING_INTERVAL_MAX 2056 #endif -static_assert(CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING_INTERVAL_MIN < CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING_INTERVAL_MAX, - "Max Extended Advertising Interval cannot be smaller or equal to the Min Extended Advertising Interval"); +static_assert(CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING_INTERVAL_MIN <= CHIP_DEVICE_CONFIG_BLE_EXT_ADVERTISING_INTERVAL_MAX, + "Max Extended Advertising Interval cannot be larger to the Min Extended Advertising Interval"); #endif diff --git a/src/platform/silabs/efr32/BLEManagerImpl.cpp b/src/platform/silabs/efr32/BLEManagerImpl.cpp index bd4aee39cf8160..4df91ad23368bb 100644 --- a/src/platform/silabs/efr32/BLEManagerImpl.cpp +++ b/src/platform/silabs/efr32/BLEManagerImpl.cpp @@ -582,6 +582,13 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void) #endif } + // TODO(#32274): Explain why we cannot have interval_min == interval_max. + if (interval_min == interval_max) + { + ++interval_max; + } + ChipLogProgress(DeviceLayer, "Starting advertising with interval_min=%u, intverval_max=%u (units of 625us)", + static_cast(interval_min), static_cast(interval_max)); ret = sl_bt_advertiser_set_timing(advertising_set_handle, interval_min, interval_max, 0, 0); err = MapBLEError(ret); SuccessOrExit(err); From 524b8a8734b0a4cf9997a4c2988047e2c2d75342 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Thu, 22 Feb 2024 20:16:00 -0500 Subject: [PATCH 25/29] comment removed (#32261) --- src/app/CommandSender.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/app/CommandSender.cpp b/src/app/CommandSender.cpp index 18f4e755835076..7a03985b61b365 100644 --- a/src/app/CommandSender.cpp +++ b/src/app/CommandSender.cpp @@ -325,10 +325,7 @@ void CommandSender::OnResponseTimeout(Messaging::ExchangeContext * apExchangeCon ChipLogProgress(DataManagement, "Time out! failed to receive invoke command response from Exchange: " ChipLogFormatExchange, ChipLogValueExchange(apExchangeContext)); - // TODO(#30453) When timeout occurs for batch commands what should be done? Should all individual - // commands have a path specific error of timeout, or do we give or NoCommandResponse. OnErrorCallback(CHIP_ERROR_TIMEOUT); - Close(); } From 7f8c40bdaf984f8f11fe6aedc91c165e7e524eeb Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Fri, 23 Feb 2024 13:34:42 +0900 Subject: [PATCH 26/29] Fix crash in Wi-Fi Connect Network (#32253) * Fix crash in Wi-Fi Connect Network * Update from comment * Restyled by clang-format --------- Co-authored-by: Restyled.io --- src/controller/CHIPDeviceController.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index 57c75cd0d813ae..69e95244dcce01 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -3040,8 +3040,10 @@ void DeviceCommissioner::PerformCommissioningStep(DeviceProxy * proxy, Commissio request.breadcrumb.Emplace(breadcrumb); CHIP_ERROR err = CHIP_NO_ERROR; - ChipLogProgress(Controller, "SendCommand kWiFiNetworkEnable, supportsConcurrentConnection=%d", - params.GetSupportsConcurrentConnection().Value()); + ChipLogProgress(Controller, "SendCommand kWiFiNetworkEnable, supportsConcurrentConnection=%s", + params.GetSupportsConcurrentConnection().HasValue() + ? (params.GetSupportsConcurrentConnection().Value() ? "true" : "false") + : "missing"); err = SendCommand(proxy, request, OnConnectNetworkResponse, OnBasicFailure, endpoint, timeout); if (err != CHIP_NO_ERROR) From 233c1777a12416be68b8c27b2fb7464dbfc94dac Mon Sep 17 00:00:00 2001 From: Karsten Sperling <113487422+ksperling-apple@users.noreply.github.com> Date: Fri, 23 Feb 2024 19:49:06 +1300 Subject: [PATCH 27/29] Darwin: Propagate sanitizer flags from Xcode into GN build (#32278) * Darwin: Propagate sanitizer flags from Xcode into GN build When ASAN, TSAN, or UBSAN are enabled from Xcode, turn on the corresponding setting in the GN build. * Set _LIBCPP_HAS_NO_ASAN for ASAN builds to match Xcodebuild --- .github/workflows/darwin.yaml | 18 +++++++----------- build/config/compiler/BUILD.gn | 5 +++++ .../Framework/chip_xcode_build_connector.sh | 6 +++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/darwin.yaml b/.github/workflows/darwin.yaml index 2d7443f9e9758c..a58617131a035d 100644 --- a/.github/workflows/darwin.yaml +++ b/.github/workflows/darwin.yaml @@ -105,19 +105,15 @@ jobs: mkdir -p /tmp/darwin/framework-tests ../../../out/debug/chip-all-clusters-app --interface-id -1 > >(tee /tmp/darwin/framework-tests/all-cluster-app.log) 2> >(tee /tmp/darwin/framework-tests/all-cluster-app-err.log >&2) & ../../../out/debug/chip-all-clusters-app --interface-id -1 --dac_provider ../../../credentials/development/commissioner_dut/struct_cd_origin_pid_vid_correct/test_case_vector.json --product-id 32768 --discriminator 3839 --secured-device-port 5539 --KVS /tmp/chip-all-clusters-app-kvs2 > >(tee /tmp/darwin/framework-tests/all-cluster-app-origin-vid.log) 2> >(tee /tmp/darwin/framework-tests/all-cluster-app-origin-vid-err.log >&2) & - # Disable BLE because the app does not have the permission to use - # it and that may crash the CI. - # - # -enableUndefinedBehaviorSanitizer instruments the code in Matter.framework, - # but to instrument the code in the underlying libCHIP we need to pass CHIP_IS_UBSAN=YES - TEST_RUNNER_ASAN_OPTIONS=__CURRENT_VALUE__:detect_stack_use_after_return=1 xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx -enableAddressSanitizer YES -enableUndefinedBehaviorSanitizer YES OTHER_CFLAGS='${inherited} -Werror -Wconversion' CHIP_IS_UBSAN=YES CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'> >(tee /tmp/darwin/framework-tests/darwin-tests-asan.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-asan-err.log >&2) + # Disable BLE (CHIP_IS_BLE=NO) because the app does not have the permission to use it and that may crash the CI. + + TEST_RUNNER_ASAN_OPTIONS=__CURRENT_VALUE__:detect_stack_use_after_return=1 xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx -enableAddressSanitizer YES -enableUndefinedBehaviorSanitizer YES OTHER_CFLAGS='${inherited} -Werror -Wconversion' CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1'> >(tee /tmp/darwin/framework-tests/darwin-tests-asan.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-asan-err.log >&2) # And the same thing, but with MTR_PER_CONTROLLER_STORAGE_ENABLED turned off, so we test that it does not break for now. - TEST_RUNNER_ASAN_OPTIONS=__CURRENT_VALUE__:detect_stack_use_after_return=1 xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx -enableAddressSanitizer YES -enableUndefinedBehaviorSanitizer YES OTHER_CFLAGS='${inherited} -Werror -Wconversion' CHIP_IS_UBSAN=YES CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1 MTR_PER_CONTROLLER_STORAGE_ENABLED=0' > >(tee /tmp/darwin/framework-tests/darwin-tests-asan-controller-storage.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-asan-controller-storage-err.log >&2) + TEST_RUNNER_ASAN_OPTIONS=__CURRENT_VALUE__:detect_stack_use_after_return=1 xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx -enableAddressSanitizer YES -enableUndefinedBehaviorSanitizer YES OTHER_CFLAGS='${inherited} -Werror -Wconversion' CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1 MTR_PER_CONTROLLER_STORAGE_ENABLED=0' > >(tee /tmp/darwin/framework-tests/darwin-tests-asan-controller-storage.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-asan-controller-storage-err.log >&2) # And the same thing, but with MTR_NO_AVAILABILITY not turned on. This requires -Wno-unguarded-availability-new to avoid availability errors. - TEST_RUNNER_ASAN_OPTIONS=__CURRENT_VALUE__:detect_stack_use_after_return=1 xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx -enableAddressSanitizer YES -enableUndefinedBehaviorSanitizer YES OTHER_CFLAGS='${inherited} -Werror -Wconversion -Wno-unguarded-availability-new' CHIP_IS_UBSAN=YES CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited}' > >(tee /tmp/darwin/framework-tests/darwin-tests-asan-with-availability-annotations.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-asan-with-availability-annotations-err.log >&2) - # -enableThreadSanitizer instruments the code in Matter.framework, - # but to instrument the code in the underlying libCHIP we need to pass CHIP_IS_TSAN=YES - xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx -enableThreadSanitizer YES OTHER_CFLAGS='${inherited} -Werror -Wconversion' CHIP_IS_TSAN=YES CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1' > >(tee /tmp/darwin/framework-tests/darwin-tests-tsan.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-tsan-err.log >&2) + TEST_RUNNER_ASAN_OPTIONS=__CURRENT_VALUE__:detect_stack_use_after_return=1 xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx -enableAddressSanitizer YES -enableUndefinedBehaviorSanitizer YES OTHER_CFLAGS='${inherited} -Werror -Wconversion -Wno-unguarded-availability-new' CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited}' > >(tee /tmp/darwin/framework-tests/darwin-tests-asan-with-availability-annotations.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-asan-with-availability-annotations-err.log >&2) + + xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx -enableThreadSanitizer YES OTHER_CFLAGS='${inherited} -Werror -Wconversion' CHIP_IS_BLE=NO GCC_PREPROCESSOR_DEFINITIONS='${inherited} MTR_NO_AVAILABILITY=1' > >(tee /tmp/darwin/framework-tests/darwin-tests-tsan.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-tsan-err.log >&2) working-directory: src/darwin/Framework - name: Build Matter TV Casting Bridge run: | diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index b6ad67a64944fd..7ada1348f797b4 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -395,11 +395,16 @@ declare_args() { } config("sanitize_address") { + defines = [] cflags = [ "-fsanitize=address", "-fno-omit-frame-pointer", ] ldflags = cflags + + if (target_os == "mac" || target_os == "ios") { + defines += [ "_LIBCPP_HAS_NO_ASAN" ] + } } config("sanitize_thread") { diff --git a/src/darwin/Framework/chip_xcode_build_connector.sh b/src/darwin/Framework/chip_xcode_build_connector.sh index 3ab0464bb79482..e802e99cd0cfcd 100755 --- a/src/darwin/Framework/chip_xcode_build_connector.sh +++ b/src/darwin/Framework/chip_xcode_build_connector.sh @@ -132,19 +132,19 @@ esac ) } -[[ $CHIP_IS_ASAN == YES ]] && { +[[ $CHIP_IS_ASAN == YES || $ENABLE_ADDRESS_SANITIZER == YES ]] && { args+=( 'is_asan=true' ) } -[[ $CHIP_IS_UBSAN == YES ]] && { +[[ $CHIP_IS_UBSAN == YES || $ENABLE_UNDEFINED_BEHAVIOR_SANITIZER == YES ]] && { args+=( 'is_ubsan=true' ) } -[[ $CHIP_IS_TSAN == YES ]] && { +[[ $CHIP_IS_TSAN == YES || $ENABLE_THREAD_SANITIZER == YES ]] && { args+=( 'is_tsan=true' # The system stats stuff races on the stats in various ways, From 003c478222211e877755ae2e0f58a4779a06bc8c Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Fri, 23 Feb 2024 10:54:21 +0100 Subject: [PATCH 28/29] [Linux] Fix memory leaks when handling BluezAdapter1 objects (#32263) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Convert glib object to GAutoPtr<> in Bluez * Do not keep a copy of BluezAdapter1 properties * Use GAutoPtr to manage BluezAdapter1 life cycle * Simplify adapter retrieval from BlueZ object * Properly release objects obtained with bluez_object_get_*() * Use reinterpret_cast when using g_object_ref() * Use on-the-stack strings to simplify memory management * Manage BluezLEAdvertisement1 with GAutoPtr * Do not leak GDBusObjectManagerServer in case of re-initialization * Fix life cycle of exported advertisement D-Bus object * Restart BLE advertisement in case of premature release --------- Co-authored-by: Damian Michalak-SzmaciƄski --- src/platform/GLibTypeDeleter.h | 6 + src/platform/Linux/BLEManagerImpl.cpp | 30 +++-- src/platform/Linux/BLEManagerImpl.h | 7 +- src/platform/Linux/CHIPDevicePlatformEvent.h | 11 +- src/platform/Linux/bluez/AdapterIterator.cpp | 47 +++---- src/platform/Linux/bluez/AdapterIterator.h | 28 ++-- .../Linux/bluez/BluezAdvertisement.cpp | 123 +++++++----------- src/platform/Linux/bluez/BluezAdvertisement.h | 14 +- src/platform/Linux/bluez/BluezConnection.cpp | 16 +-- src/platform/Linux/bluez/BluezEndpoint.cpp | 70 +++++----- src/platform/Linux/bluez/BluezEndpoint.h | 4 +- .../Linux/bluez/ChipDeviceScanner.cpp | 18 +-- src/platform/Linux/bluez/ChipDeviceScanner.h | 6 +- src/platform/Linux/bluez/Types.h | 24 ++++ 14 files changed, 194 insertions(+), 210 deletions(-) diff --git a/src/platform/GLibTypeDeleter.h b/src/platform/GLibTypeDeleter.h index f217d559e9cc66..f083a6c5e460d5 100644 --- a/src/platform/GLibTypeDeleter.h +++ b/src/platform/GLibTypeDeleter.h @@ -120,6 +120,12 @@ struct GAutoPtrDeleter using deleter = GObjectDeleter; }; +template <> +struct GAutoPtrDeleter +{ + using deleter = GObjectDeleter; +}; + template <> struct GAutoPtrDeleter { diff --git a/src/platform/Linux/BLEManagerImpl.cpp b/src/platform/Linux/BLEManagerImpl.cpp index d5129a983f092d..dbf3791c905ac1 100644 --- a/src/platform/Linux/BLEManagerImpl.cpp +++ b/src/platform/Linux/BLEManagerImpl.cpp @@ -289,8 +289,13 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv case DeviceEventType::kPlatformLinuxBLEPeripheralAdvStartComplete: VerifyOrExit(apEvent->Platform.BLEPeripheralAdvStartComplete.mIsSuccess, err = CHIP_ERROR_INCORRECT_STATE); sInstance.mFlags.Clear(Flags::kControlOpInProgress).Clear(Flags::kAdvertisingRefreshNeeded); - // Start a timer to make sure that the fast advertising is stopped after specified timeout. - SuccessOrExit(err = DeviceLayer::SystemLayer().StartTimer(kFastAdvertiseTimeout, HandleAdvertisingTimer, this)); + // Do not restart the timer if it is still active. This is to avoid the timer from being restarted + // if the advertising is stopped due to a premature release. + if (!DeviceLayer::SystemLayer().IsTimerActive(HandleAdvertisingTimer, this)) + { + // Start a timer to make sure that the fast advertising is stopped after specified timeout. + SuccessOrExit(err = DeviceLayer::SystemLayer().StartTimer(kFastAdvertiseTimeout, HandleAdvertisingTimer, this)); + } sInstance.mFlags.Set(Flags::kAdvertising); break; case DeviceEventType::kPlatformLinuxBLEPeripheralAdvStopComplete: @@ -305,6 +310,11 @@ void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEv ChipLogProgress(DeviceLayer, "CHIPoBLE advertising stopped"); } break; + case DeviceEventType::kPlatformLinuxBLEPeripheralAdvReleased: + // If the advertising was stopped due to a premature release, check if it needs to be restarted. + sInstance.mFlags.Clear(Flags::kAdvertising); + DriveBLEState(); + break; case DeviceEventType::kPlatformLinuxBLEPeripheralRegisterAppComplete: VerifyOrExit(apEvent->Platform.BLEPeripheralRegisterAppComplete.mIsSuccess, err = CHIP_ERROR_INCORRECT_STATE); mFlags.Set(Flags::kAppRegistered); @@ -780,30 +790,34 @@ CHIP_ERROR BLEManagerImpl::CancelConnection() return CHIP_NO_ERROR; } -void BLEManagerImpl::NotifyBLEPeripheralRegisterAppComplete(bool aIsSuccess, void * apAppstate) +void BLEManagerImpl::NotifyBLEPeripheralRegisterAppComplete(bool aIsSuccess) { ChipDeviceEvent event; event.Type = DeviceEventType::kPlatformLinuxBLEPeripheralRegisterAppComplete; event.Platform.BLEPeripheralRegisterAppComplete.mIsSuccess = aIsSuccess; - event.Platform.BLEPeripheralRegisterAppComplete.mpAppstate = apAppstate; PlatformMgr().PostEventOrDie(&event); } -void BLEManagerImpl::NotifyBLEPeripheralAdvStartComplete(bool aIsSuccess, void * apAppstate) +void BLEManagerImpl::NotifyBLEPeripheralAdvStartComplete(bool aIsSuccess) { ChipDeviceEvent event; event.Type = DeviceEventType::kPlatformLinuxBLEPeripheralAdvStartComplete; event.Platform.BLEPeripheralAdvStartComplete.mIsSuccess = aIsSuccess; - event.Platform.BLEPeripheralAdvStartComplete.mpAppstate = apAppstate; PlatformMgr().PostEventOrDie(&event); } -void BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(bool aIsSuccess, void * apAppstate) +void BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(bool aIsSuccess) { ChipDeviceEvent event; event.Type = DeviceEventType::kPlatformLinuxBLEPeripheralAdvStopComplete; event.Platform.BLEPeripheralAdvStopComplete.mIsSuccess = aIsSuccess; - event.Platform.BLEPeripheralAdvStopComplete.mpAppstate = apAppstate; + PlatformMgr().PostEventOrDie(&event); +} + +void BLEManagerImpl::NotifyBLEPeripheralAdvReleased() +{ + ChipDeviceEvent event; + event.Type = DeviceEventType::kPlatformLinuxBLEPeripheralAdvReleased; PlatformMgr().PostEventOrDie(&event); } diff --git a/src/platform/Linux/BLEManagerImpl.h b/src/platform/Linux/BLEManagerImpl.h index 61d2dff02757c7..6e3c1a687a5594 100644 --- a/src/platform/Linux/BLEManagerImpl.h +++ b/src/platform/Linux/BLEManagerImpl.h @@ -92,9 +92,10 @@ class BLEManagerImpl final : public BLEManager, static void HandleTXCharCCCDWrite(BLE_CONNECTION_OBJECT user_data); static void HandleTXComplete(BLE_CONNECTION_OBJECT user_data); - static void NotifyBLEPeripheralRegisterAppComplete(bool aIsSuccess, void * apAppstate); - static void NotifyBLEPeripheralAdvStartComplete(bool aIsSuccess, void * apAppstate); - static void NotifyBLEPeripheralAdvStopComplete(bool aIsSuccess, void * apAppstate); + static void NotifyBLEPeripheralRegisterAppComplete(bool aIsSuccess); + static void NotifyBLEPeripheralAdvStartComplete(bool aIsSuccess); + static void NotifyBLEPeripheralAdvStopComplete(bool aIsSuccess); + static void NotifyBLEPeripheralAdvReleased(); private: // ===== Members that implement the BLEManager internal interface. diff --git a/src/platform/Linux/CHIPDevicePlatformEvent.h b/src/platform/Linux/CHIPDevicePlatformEvent.h index 8618b9ebeaa0a8..b6e0b55cafdbb2 100644 --- a/src/platform/Linux/CHIPDevicePlatformEvent.h +++ b/src/platform/Linux/CHIPDevicePlatformEvent.h @@ -54,7 +54,8 @@ enum InternalPlatformSpecificEventTypes kPlatformLinuxBLEOutOfBuffersEvent, kPlatformLinuxBLEPeripheralRegisterAppComplete, kPlatformLinuxBLEPeripheralAdvStartComplete, - kPlatformLinuxBLEPeripheralAdvStopComplete + kPlatformLinuxBLEPeripheralAdvStopComplete, + kPlatformLinuxBLEPeripheralAdvReleased, }; } // namespace DeviceEventType @@ -91,22 +92,14 @@ struct ChipDevicePlatformEvent struct { bool mIsSuccess; - void * mpAppstate; } BLEPeripheralRegisterAppComplete; struct { bool mIsSuccess; - void * mpAppstate; - } BLEPeripheralAdvConfiguredComplete; - struct - { - bool mIsSuccess; - void * mpAppstate; } BLEPeripheralAdvStartComplete; struct { bool mIsSuccess; - void * mpAppstate; } BLEPeripheralAdvStopComplete; }; }; diff --git a/src/platform/Linux/bluez/AdapterIterator.cpp b/src/platform/Linux/bluez/AdapterIterator.cpp index e69c473f52bbfe..5510ceae996ce2 100644 --- a/src/platform/Linux/bluez/AdapterIterator.cpp +++ b/src/platform/Linux/bluez/AdapterIterator.cpp @@ -37,12 +37,6 @@ AdapterIterator::~AdapterIterator() { g_list_free_full(mObjectList, g_object_unref); } - - if (mCurrent.adapter != nullptr) - { - g_object_unref(mCurrent.adapter); - mCurrent.adapter = nullptr; - } } CHIP_ERROR AdapterIterator::Initialize(AdapterIterator * self) @@ -90,30 +84,7 @@ bool AdapterIterator::Advance() continue; } - // PATH is of the for BLUEZ_PATH / hci, i.e. like - // '/org/bluez/hci0' - // Index represents the number after hci - const char * path = g_dbus_proxy_get_object_path(G_DBUS_PROXY(adapter)); - unsigned index = 0; - - if (sscanf(path, BLUEZ_PATH "/hci%u", &index) != 1) - { - ChipLogError(DeviceLayer, "Failed to extract HCI index from '%s'", StringOrNullMarker(path)); - index = 0; - } - - if (mCurrent.adapter != nullptr) - { - g_object_unref(mCurrent.adapter); - mCurrent.adapter = nullptr; - } - - mCurrent.index = index; - mCurrent.address = bluez_adapter1_get_address(adapter); - mCurrent.alias = bluez_adapter1_get_alias(adapter); - mCurrent.name = bluez_adapter1_get_name(adapter); - mCurrent.powered = bluez_adapter1_get_powered(adapter); - mCurrent.adapter = adapter; + mCurrentAdapter.reset(adapter); mCurrentListItem = mCurrentListItem->next; @@ -123,6 +94,22 @@ bool AdapterIterator::Advance() return false; } +uint32_t AdapterIterator::GetIndex() const +{ + // PATH is of the for BLUEZ_PATH / hci, i.e. like '/org/bluez/hci0' + // Index represents the number after hci + const char * path = g_dbus_proxy_get_object_path(G_DBUS_PROXY(mCurrentAdapter.get())); + unsigned index = 0; + + if (sscanf(path, BLUEZ_PATH "/hci%u", &index) != 1) + { + ChipLogError(DeviceLayer, "Failed to extract HCI index from '%s'", StringOrNullMarker(path)); + index = 0; + } + + return index; +} + bool AdapterIterator::Next() { if (mManager == nullptr) diff --git a/src/platform/Linux/bluez/AdapterIterator.h b/src/platform/Linux/bluez/AdapterIterator.h index 85697b5d544c9a..0d44074889773b 100644 --- a/src/platform/Linux/bluez/AdapterIterator.h +++ b/src/platform/Linux/bluez/AdapterIterator.h @@ -56,12 +56,12 @@ class AdapterIterator // Information about the current value. Safe to call only after // "Next" has returned true. - uint32_t GetIndex() const { return mCurrent.index; } - const char * GetAddress() const { return mCurrent.address.c_str(); } - const char * GetAlias() const { return mCurrent.alias.c_str(); } - const char * GetName() const { return mCurrent.name.c_str(); } - bool IsPowered() const { return mCurrent.powered; } - BluezAdapter1 * GetAdapter() const { return mCurrent.adapter; } + uint32_t GetIndex() const; + const char * GetAddress() const { return bluez_adapter1_get_address(mCurrentAdapter.get()); } + const char * GetAlias() const { return bluez_adapter1_get_alias(mCurrentAdapter.get()); } + const char * GetName() const { return bluez_adapter1_get_name(mCurrentAdapter.get()); } + bool IsPowered() const { return bluez_adapter1_get_powered(mCurrentAdapter.get()); } + BluezAdapter1 * GetAdapter() const { return mCurrentAdapter.get(); } private: /// Sets up the DBUS manager and loads the list @@ -73,23 +73,11 @@ class AdapterIterator /// iterate through. bool Advance(); - static constexpr size_t kMaxAddressLength = 19; // xx:xx:xx:xx:xx:xx - static constexpr size_t kMaxNameLength = 64; - GDBusObjectManager * mManager = nullptr; // DBus connection GList * mObjectList = nullptr; // listing of objects on the bus GList * mCurrentListItem = nullptr; // current item viewed in the list - - // data valid only if Next() returns true - struct - { - uint32_t index; - std::string address; - std::string alias; - std::string name; - bool powered; - BluezAdapter1 * adapter; - } mCurrent = { 0 }; + // Data valid only if Next() returns true + GAutoPtr mCurrentAdapter; }; } // namespace Internal diff --git a/src/platform/Linux/bluez/BluezAdvertisement.cpp b/src/platform/Linux/bluez/BluezAdvertisement.cpp index 196529816b59ab..06f831bff8b58f 100644 --- a/src/platform/Linux/bluez/BluezAdvertisement.cpp +++ b/src/platform/Linux/bluez/BluezAdvertisement.cpp @@ -45,13 +45,13 @@ BluezLEAdvertisement1 * BluezAdvertisement::CreateLEAdvertisement() GVariant * serviceUUID; GVariantBuilder serviceUUIDsBuilder; - ChipLogDetail(DeviceLayer, "Create BLE adv object at %s", mpAdvPath); - object = bluez_object_skeleton_new(mpAdvPath); + ChipLogDetail(DeviceLayer, "Create BLE adv object at %s", mAdvPath); + object = bluez_object_skeleton_new(mAdvPath); adv = bluez_leadvertisement1_skeleton_new(); g_variant_builder_init(&serviceUUIDsBuilder, G_VARIANT_TYPE("as")); - g_variant_builder_add(&serviceUUIDsBuilder, "s", mpAdvUUID); + g_variant_builder_add(&serviceUUIDsBuilder, "s", mAdvUUID); serviceUUID = g_variant_builder_end(&serviceUUIDsBuilder); @@ -81,7 +81,7 @@ BluezLEAdvertisement1 * BluezAdvertisement::CreateLEAdvertisement() }), this); - g_dbus_object_manager_server_export(mpRoot, G_DBUS_OBJECT_SKELETON(object)); + g_dbus_object_manager_server_export(mRoot.get(), G_DBUS_OBJECT_SKELETON(object)); g_object_unref(object); return adv; @@ -89,11 +89,11 @@ BluezLEAdvertisement1 * BluezAdvertisement::CreateLEAdvertisement() gboolean BluezAdvertisement::BluezLEAdvertisement1Release(BluezLEAdvertisement1 * aAdv, GDBusMethodInvocation * aInvocation) { - ChipLogDetail(DeviceLayer, "Release BLE adv object in %s", __func__); - g_dbus_object_manager_server_unexport(mpRoot, mpAdvPath); - g_object_unref(mpAdv); - mpAdv = nullptr; + // This method is called when the advertisement is stopped (released) by BlueZ. + // We can use it to update the state of the advertisement in the CHIP layer. + ChipLogDetail(DeviceLayer, "BLE advertisement stopped by BlueZ"); mIsAdvertising = false; + BLEManagerImpl::NotifyBLEPeripheralAdvReleased(); return TRUE; } @@ -103,7 +103,7 @@ CHIP_ERROR BluezAdvertisement::InitImpl() // all D-Bus signals will be delivered to the GLib global default main context. VerifyOrDie(g_main_context_get_thread_default() != nullptr); - mpAdv = CreateLEAdvertisement(); + mAdv.reset(CreateLEAdvertisement()); return CHIP_NO_ERROR; } @@ -112,19 +112,19 @@ CHIP_ERROR BluezAdvertisement::Init(const BluezEndpoint & aEndpoint, const char GAutoPtr rootPath; CHIP_ERROR err; - VerifyOrExit(mpAdv == nullptr, err = CHIP_ERROR_INCORRECT_STATE; + VerifyOrExit(!mAdv, err = CHIP_ERROR_INCORRECT_STATE; ChipLogError(DeviceLayer, "FAIL: BLE advertisement already initialized in %s", __func__)); - mpRoot = reinterpret_cast(g_object_ref(aEndpoint.GetGattApplicationObjectManager())); - mpAdapter = reinterpret_cast(g_object_ref(aEndpoint.GetAdapter())); + mRoot.reset(reinterpret_cast(g_object_ref(aEndpoint.GetGattApplicationObjectManager()))); + mAdapter.reset(reinterpret_cast(g_object_ref(aEndpoint.GetAdapter()))); - g_object_get(G_OBJECT(mpRoot), "object-path", &rootPath.GetReceiver(), nullptr); - mpAdvPath = g_strdup_printf("%s/advertising", rootPath.get()); - mpAdvUUID = g_strdup(aAdvUUID); + g_object_get(G_OBJECT(mRoot.get()), "object-path", &rootPath.GetReceiver(), nullptr); + g_snprintf(mAdvPath, sizeof(mAdvPath), "%s/advertising", rootPath.get()); + g_strlcpy(mAdvUUID, aAdvUUID, sizeof(mAdvUUID)); if (aAdvName != nullptr) { - g_snprintf(mAdvName, sizeof(mAdvName), "%s", aAdvName); + g_strlcpy(mAdvName, aAdvName, sizeof(mAdvName)); } else { @@ -145,17 +145,17 @@ CHIP_ERROR BluezAdvertisement::Init(const BluezEndpoint & aEndpoint, const char CHIP_ERROR BluezAdvertisement::SetIntervals(AdvertisingIntervals aAdvIntervals) { - VerifyOrReturnError(mpAdv != nullptr, CHIP_ERROR_UNINITIALIZED); + VerifyOrReturnError(mAdv, CHIP_ERROR_UNINITIALIZED); // If the advertisement is already running, BlueZ will update the intervals // automatically. There is no need to stop and restart the advertisement. - bluez_leadvertisement1_set_min_interval(mpAdv, aAdvIntervals.first * 0.625); - bluez_leadvertisement1_set_max_interval(mpAdv, aAdvIntervals.second * 0.625); + bluez_leadvertisement1_set_min_interval(mAdv.get(), aAdvIntervals.first * 0.625); + bluez_leadvertisement1_set_max_interval(mAdv.get(), aAdvIntervals.second * 0.625); return CHIP_NO_ERROR; } CHIP_ERROR BluezAdvertisement::SetupServiceData(ServiceDataFlags aFlags) { - VerifyOrReturnError(mpAdv != nullptr, CHIP_ERROR_UNINITIALIZED); + VerifyOrReturnError(mAdv, CHIP_ERROR_UNINITIALIZED); Ble::ChipBLEDeviceIdentificationInfo deviceInfo; ReturnErrorOnFailure(ConfigurationMgr().GetBLEDeviceIdentificationInfo(deviceInfo)); @@ -177,7 +177,7 @@ CHIP_ERROR BluezAdvertisement::SetupServiceData(ServiceDataFlags aFlags) GVariantBuilder serviceDataBuilder; g_variant_builder_init(&serviceDataBuilder, G_VARIANT_TYPE("a{sv}")); - g_variant_builder_add(&serviceDataBuilder, "{sv}", mpAdvUUID, + g_variant_builder_add(&serviceDataBuilder, "{sv}", mAdvUUID, g_variant_new_fixed_array(G_VARIANT_TYPE_BYTE, &deviceInfo, sizeof(deviceInfo), sizeof(uint8_t))); GVariant * serviceData = g_variant_builder_end(&serviceDataBuilder); @@ -185,7 +185,7 @@ CHIP_ERROR BluezAdvertisement::SetupServiceData(ServiceDataFlags aFlags) GAutoPtr debugStr(g_variant_print(serviceData, TRUE)); ChipLogDetail(DeviceLayer, "SET service data to %s", StringOrNullMarker(debugStr.get())); - bluez_leadvertisement1_set_service_data(mpAdv, serviceData); + bluez_leadvertisement1_set_service_data(mAdv.get(), serviceData); return CHIP_NO_ERROR; } @@ -208,30 +208,17 @@ void BluezAdvertisement::Shutdown() // attached to the advertising object that may run on the glib thread. PlatformMgrImpl().GLibMatterContextInvokeSync( +[](BluezAdvertisement * self) { - if (self->mpRoot != nullptr) - { - g_object_unref(self->mpRoot); - self->mpRoot = nullptr; - } - if (self->mpAdapter != nullptr) - { - g_object_unref(self->mpAdapter); - self->mpAdapter = nullptr; - } - if (self->mpAdv != nullptr) - { - g_object_unref(self->mpAdv); - self->mpAdv = nullptr; - } + // The object manager server (mRoot) might not be released right away (it may be held + // by other BLE layer objects). We need to unexport the advertisement object in the + // explicit way to make sure that we can export it again in the Init() method. + g_dbus_object_manager_server_unexport(self->mRoot.get(), self->mAdvPath); + self->mRoot.reset(); + self->mAdapter.reset(); + self->mAdv.reset(); return CHIP_NO_ERROR; }, this); - g_free(mpAdvPath); - mpAdvPath = nullptr; - g_free(mpAdvUUID); - mpAdvUUID = nullptr; - mIsInitialized = false; } @@ -242,10 +229,6 @@ void BluezAdvertisement::StartDone(GObject * aObject, GAsyncResult * aResult) gboolean success = FALSE; success = bluez_leadvertising_manager1_call_register_advertisement_finish(advMgr, aResult, &error.GetReceiver()); - if (success == FALSE) - { - g_dbus_object_manager_server_unexport(mpRoot, mpAdvPath); - } VerifyOrExit(success == TRUE, ChipLogError(DeviceLayer, "FAIL: RegisterAdvertisement : %s", error->message)); mIsAdvertising = true; @@ -253,30 +236,30 @@ void BluezAdvertisement::StartDone(GObject * aObject, GAsyncResult * aResult) ChipLogDetail(DeviceLayer, "RegisterAdvertisement complete"); exit: - BLEManagerImpl::NotifyBLEPeripheralAdvStartComplete(success == TRUE, nullptr); + BLEManagerImpl::NotifyBLEPeripheralAdvStartComplete(success == TRUE); } CHIP_ERROR BluezAdvertisement::StartImpl() { - GDBusObject * adapter; - BluezLEAdvertisingManager1 * advMgr = nullptr; + GDBusObject * adapterObject; + GAutoPtr advMgr; GVariantBuilder optionsBuilder; GVariant * options; VerifyOrExit(!mIsAdvertising, ChipLogError(DeviceLayer, "FAIL: Advertising has already been enabled in %s", __func__)); - VerifyOrExit(mpAdapter != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL mpAdapter in %s", __func__)); + VerifyOrExit(mAdapter.get() != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL mAdapter in %s", __func__)); - adapter = g_dbus_interface_get_object(G_DBUS_INTERFACE(mpAdapter)); - VerifyOrExit(adapter != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL adapter in %s", __func__)); + adapterObject = g_dbus_interface_get_object(G_DBUS_INTERFACE(mAdapter.get())); + VerifyOrExit(adapterObject != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL adapterObject in %s", __func__)); - advMgr = bluez_object_get_leadvertising_manager1(BLUEZ_OBJECT(adapter)); - VerifyOrExit(advMgr != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL advMgr in %s", __func__)); + advMgr.reset(bluez_object_get_leadvertising_manager1(BLUEZ_OBJECT(adapterObject))); + VerifyOrExit(advMgr.get() != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL advMgr in %s", __func__)); g_variant_builder_init(&optionsBuilder, G_VARIANT_TYPE("a{sv}")); options = g_variant_builder_end(&optionsBuilder); bluez_leadvertising_manager1_call_register_advertisement( - advMgr, mpAdvPath, options, nullptr, + advMgr.get(), mAdvPath, options, nullptr, [](GObject * aObject, GAsyncResult * aResult, void * aData) { reinterpret_cast(aData)->StartDone(aObject, aResult); }, @@ -304,40 +287,32 @@ void BluezAdvertisement::StopDone(GObject * aObject, GAsyncResult * aResult) gboolean success = FALSE; success = bluez_leadvertising_manager1_call_unregister_advertisement_finish(advMgr, aResult, &error.GetReceiver()); + VerifyOrExit(success == TRUE, ChipLogError(DeviceLayer, "FAIL: UnregisterAdvertisement: %s", error->message)); - if (success == FALSE) - { - g_dbus_object_manager_server_unexport(mpRoot, mpAdvPath); - } - else - { - mIsAdvertising = false; - } - - VerifyOrExit(success == TRUE, ChipLogError(DeviceLayer, "FAIL: UnregisterAdvertisement : %s", error->message)); + mIsAdvertising = false; ChipLogDetail(DeviceLayer, "UnregisterAdvertisement complete"); exit: - BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(success == TRUE, nullptr); + BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(success == TRUE); } CHIP_ERROR BluezAdvertisement::StopImpl() { - GDBusObject * adapter; - BluezLEAdvertisingManager1 * advMgr = nullptr; + GDBusObject * adapterObject; + GAutoPtr advMgr; VerifyOrExit(mIsAdvertising, ChipLogError(DeviceLayer, "FAIL: Advertising has already been disabled in %s", __func__)); - VerifyOrExit(mpAdapter != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL mpAdapter in %s", __func__)); + VerifyOrExit(mAdapter.get() != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL mAdapter in %s", __func__)); - adapter = g_dbus_interface_get_object(G_DBUS_INTERFACE(mpAdapter)); - VerifyOrExit(adapter != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL adapter in %s", __func__)); + adapterObject = g_dbus_interface_get_object(G_DBUS_INTERFACE(mAdapter.get())); + VerifyOrExit(adapterObject != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL adapterObject in %s", __func__)); - advMgr = bluez_object_get_leadvertising_manager1(BLUEZ_OBJECT(adapter)); - VerifyOrExit(advMgr != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL advMgr in %s", __func__)); + advMgr.reset(bluez_object_get_leadvertising_manager1(BLUEZ_OBJECT(adapterObject))); + VerifyOrExit(advMgr.get() != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL advMgr in %s", __func__)); bluez_leadvertising_manager1_call_unregister_advertisement( - advMgr, mpAdvPath, nullptr, + advMgr.get(), mAdvPath, nullptr, [](GObject * aObject, GAsyncResult * aResult, void * aData) { reinterpret_cast(aData)->StopDone(aObject, aResult); }, diff --git a/src/platform/Linux/bluez/BluezAdvertisement.h b/src/platform/Linux/bluez/BluezAdvertisement.h index 11fe51c8e7cdb9..f41d591410b8e3 100644 --- a/src/platform/Linux/bluez/BluezAdvertisement.h +++ b/src/platform/Linux/bluez/BluezAdvertisement.h @@ -26,6 +26,7 @@ #include #include +#include #include #include "Types.h" @@ -64,6 +65,9 @@ class BluezAdvertisement /// /// BLE advertising is stopped asynchronously. Application will be notified of /// completion via a call to BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(). + /// + /// It is also possible that the advertising is released by BlueZ. In that case, + /// the application will be notified by BLEManagerImpl::NotifyBLEPeripheralAdvReleased(). CHIP_ERROR Stop(); private: @@ -79,15 +83,15 @@ class BluezAdvertisement CHIP_ERROR StopImpl(); // Objects (interfaces) used by LE advertisement - GDBusObjectManagerServer * mpRoot = nullptr; - BluezAdapter1 * mpAdapter = nullptr; - BluezLEAdvertisement1 * mpAdv = nullptr; + GAutoPtr mRoot; + GAutoPtr mAdapter; + GAutoPtr mAdv; bool mIsInitialized = false; bool mIsAdvertising = false; - char * mpAdvPath = nullptr; - char * mpAdvUUID = nullptr; + char mAdvPath[64] = ""; // D-Bus path of the advertisement object + char mAdvUUID[64] = ""; // UUID of the service to be advertised char mAdvName[32] = ""; }; diff --git a/src/platform/Linux/bluez/BluezConnection.cpp b/src/platform/Linux/bluez/BluezConnection.cpp index d2d5745a4c37c2..d2db5edc005eba 100644 --- a/src/platform/Linux/bluez/BluezConnection.cpp +++ b/src/platform/Linux/bluez/BluezConnection.cpp @@ -60,7 +60,7 @@ gboolean BluezIsCharOnService(BluezGattCharacteristic1 * aChar, BluezGattService } // namespace BluezConnection::BluezConnection(const BluezEndpoint & aEndpoint, BluezDevice1 * apDevice) : - mpDevice(BLUEZ_DEVICE1(g_object_ref(apDevice))) + mpDevice(reinterpret_cast(g_object_ref(apDevice))) { Init(aEndpoint); } @@ -101,9 +101,9 @@ CHIP_ERROR BluezConnection::Init(const BluezEndpoint & aEndpoint) if (!aEndpoint.mIsCentral) { - mpService = BLUEZ_GATT_SERVICE1(g_object_ref(aEndpoint.mpService)); - mpC1 = BLUEZ_GATT_CHARACTERISTIC1(g_object_ref(aEndpoint.mpC1)); - mpC2 = BLUEZ_GATT_CHARACTERISTIC1(g_object_ref(aEndpoint.mpC2)); + mpService = reinterpret_cast(g_object_ref(aEndpoint.mpService)); + mpC1 = reinterpret_cast(g_object_ref(aEndpoint.mpC1)); + mpC2 = reinterpret_cast(g_object_ref(aEndpoint.mpC2)); } else { @@ -111,9 +111,7 @@ CHIP_ERROR BluezConnection::Init(const BluezEndpoint & aEndpoint) for (l = objects; l != nullptr; l = l->next) { - BluezObject * object = BLUEZ_OBJECT(l->data); - BluezGattService1 * service = bluez_object_get_gatt_service1(object); - + BluezGattService1 * service = bluez_object_get_gatt_service1(BLUEZ_OBJECT(l->data)); if (service != nullptr) { if ((BluezIsServiceOnDevice(service, mpDevice)) == TRUE && @@ -130,9 +128,7 @@ CHIP_ERROR BluezConnection::Init(const BluezEndpoint & aEndpoint) for (l = objects; l != nullptr; l = l->next) { - BluezObject * object = BLUEZ_OBJECT(l->data); - BluezGattCharacteristic1 * char1 = bluez_object_get_gatt_characteristic1(object); - + BluezGattCharacteristic1 * char1 = bluez_object_get_gatt_characteristic1(BLUEZ_OBJECT(l->data)); if (char1 != nullptr) { if ((BluezIsCharOnService(char1, mpService) == TRUE) && diff --git a/src/platform/Linux/bluez/BluezEndpoint.cpp b/src/platform/Linux/bluez/BluezEndpoint.cpp index e68b28b8f421a8..2fdd1e1788af6b 100644 --- a/src/platform/Linux/bluez/BluezEndpoint.cpp +++ b/src/platform/Linux/bluez/BluezEndpoint.cpp @@ -268,33 +268,33 @@ void BluezEndpoint::RegisterGattApplicationDone(GObject * aObject, GAsyncResult VerifyOrReturn(success == TRUE, { ChipLogError(DeviceLayer, "FAIL: RegisterApplication : %s", error->message); - BLEManagerImpl::NotifyBLEPeripheralRegisterAppComplete(false, nullptr); + BLEManagerImpl::NotifyBLEPeripheralRegisterAppComplete(false); }); - BLEManagerImpl::NotifyBLEPeripheralRegisterAppComplete(true, nullptr); + BLEManagerImpl::NotifyBLEPeripheralRegisterAppComplete(true); ChipLogDetail(DeviceLayer, "BluezPeripheralRegisterAppDone done"); } CHIP_ERROR BluezEndpoint::RegisterGattApplicationImpl() { - GDBusObject * adapter; - BluezGattManager1 * gattMgr; + GDBusObject * adapterObject; + GAutoPtr gattMgr; GVariantBuilder optionsBuilder; GVariant * options; - VerifyOrExit(mpAdapter != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL mpAdapter in %s", __func__)); + VerifyOrExit(mAdapter.get() != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL mAdapter in %s", __func__)); - adapter = g_dbus_interface_get_object(G_DBUS_INTERFACE(mpAdapter)); - VerifyOrExit(adapter != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL adapter in %s", __func__)); + adapterObject = g_dbus_interface_get_object(G_DBUS_INTERFACE(mAdapter.get())); + VerifyOrExit(adapterObject != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL adapterObject in %s", __func__)); - gattMgr = bluez_object_get_gatt_manager1(BLUEZ_OBJECT(adapter)); - VerifyOrExit(gattMgr != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL gattMgr in %s", __func__)); + gattMgr.reset(bluez_object_get_gatt_manager1(BLUEZ_OBJECT(adapterObject))); + VerifyOrExit(gattMgr.get() != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL gattMgr in %s", __func__)); g_variant_builder_init(&optionsBuilder, G_VARIANT_TYPE("a{sv}")); options = g_variant_builder_end(&optionsBuilder); bluez_gatt_manager1_call_register_application( - gattMgr, mpRootPath, options, nullptr, + gattMgr.get(), mpRootPath, options, nullptr, +[](GObject * aObj, GAsyncResult * aResult, void * self) { reinterpret_cast(self)->RegisterGattApplicationDone(aObj, aResult); }, @@ -344,11 +344,11 @@ void BluezEndpoint::BluezSignalInterfacePropertiesChanged(GDBusObjectManagerClie GDBusProxy * aInterface, GVariant * aChangedProperties, const char * const * aInvalidatedProps) { - VerifyOrReturn(mpAdapter != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL mpAdapter in %s", __func__)); + VerifyOrReturn(mAdapter.get() != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL mAdapter in %s", __func__)); VerifyOrReturn(strcmp(g_dbus_proxy_get_interface_name(aInterface), DEVICE_INTERFACE) == 0, ); BluezDevice1 * device = BLUEZ_DEVICE1(aInterface); - VerifyOrReturn(BluezIsDeviceOnAdapter(device, mpAdapter)); + VerifyOrReturn(BluezIsDeviceOnAdapter(device, mAdapter.get())); UpdateConnectionTable(device); } @@ -386,7 +386,7 @@ void BluezEndpoint::BluezSignalOnObjectAdded(GDBusObjectManager * aManager, GDBu GAutoPtr device(bluez_object_get_device1(BLUEZ_OBJECT(aObject))); VerifyOrReturn(device.get() != nullptr); - if (BluezIsDeviceOnAdapter(device.get(), mpAdapter) == TRUE) + if (BluezIsDeviceOnAdapter(device.get(), mAdapter.get()) == TRUE) { HandleNewDevice(device.get()); } @@ -395,7 +395,7 @@ void BluezEndpoint::BluezSignalOnObjectAdded(GDBusObjectManager * aManager, GDBu void BluezEndpoint::BluezSignalOnObjectRemoved(GDBusObjectManager * aManager, GDBusObject * aObject) { // TODO: for Device1, lookup connection, and call otPlatTobleHandleDisconnected - // for Adapter1: unclear, crash if this pertains to our adapter? at least null out the self->mpAdapter. + // for Adapter1: unclear, crash if this pertains to our adapter? at least null out the self->mAdapter. // for Characteristic1, or GattService -- handle here via calling otPlatTobleHandleDisconnected, or ignore. } @@ -427,43 +427,38 @@ void BluezEndpoint::SetupAdapter() snprintf(expectedPath, sizeof(expectedPath), BLUEZ_PATH "/hci%u", mAdapterId); GList * objects = g_dbus_object_manager_get_objects(mpObjMgr); - for (auto l = objects; l != nullptr && mpAdapter == nullptr; l = l->next) + for (auto l = objects; l != nullptr && mAdapter.get() == nullptr; l = l->next) { - BluezObject * object = BLUEZ_OBJECT(l->data); - - GList * interfaces = g_dbus_object_get_interfaces(G_DBUS_OBJECT(object)); - for (auto ll = interfaces; ll != nullptr; ll = ll->next) + GAutoPtr adapter(bluez_object_get_adapter1(BLUEZ_OBJECT(l->data))); + if (adapter.get() != nullptr) { - if (BLUEZ_IS_ADAPTER1(ll->data)) - { // we found the adapter - BluezAdapter1 * adapter = BLUEZ_ADAPTER1(ll->data); - if (mpAdapterAddr == nullptr) // no adapter address provided, bind to the hci indicated by nodeid + if (mpAdapterAddr == nullptr) // no adapter address provided, bind to the hci indicated by nodeid + { + if (strcmp(g_dbus_proxy_get_object_path(G_DBUS_PROXY(adapter.get())), expectedPath) == 0) { - if (strcmp(g_dbus_proxy_get_object_path(G_DBUS_PROXY(adapter)), expectedPath) == 0) - { - mpAdapter = static_cast(g_object_ref(adapter)); - } + mAdapter.reset(static_cast(g_object_ref(adapter.get()))); + break; } - else + } + else + { + if (strcmp(bluez_adapter1_get_address(adapter.get()), mpAdapterAddr) == 0) { - if (strcmp(bluez_adapter1_get_address(adapter), mpAdapterAddr) == 0) - { - mpAdapter = static_cast(g_object_ref(adapter)); - } + mAdapter.reset(static_cast(g_object_ref(adapter.get()))); + break; } } } - g_list_free_full(interfaces, g_object_unref); } - VerifyOrExit(mpAdapter != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL mpAdapter in %s", __func__)); + VerifyOrExit(mAdapter.get() != nullptr, ChipLogError(DeviceLayer, "FAIL: NULL mAdapter in %s", __func__)); - bluez_adapter1_set_powered(mpAdapter, TRUE); + bluez_adapter1_set_powered(mAdapter.get(), TRUE); // Setting "Discoverable" to False on the adapter and to True on the advertisement convinces // Bluez to set "BR/EDR Not Supported" flag. Bluez doesn't provide API to do that explicitly // and the flag is necessary to force using LE transport. - bluez_adapter1_set_discoverable(mpAdapter, FALSE); + bluez_adapter1_set_discoverable(mAdapter.get(), FALSE); exit: g_list_free_full(objects, g_object_unref); @@ -692,8 +687,7 @@ void BluezEndpoint::Shutdown() +[](BluezEndpoint * self) { if (self->mpObjMgr != nullptr) g_object_unref(self->mpObjMgr); - if (self->mpAdapter != nullptr) - g_object_unref(self->mpAdapter); + self->mAdapter.reset(); if (self->mpRoot != nullptr) g_object_unref(self->mpRoot); if (self->mpService != nullptr) diff --git a/src/platform/Linux/bluez/BluezEndpoint.h b/src/platform/Linux/bluez/BluezEndpoint.h index 115731d665d4ba..d35cebdf6a6cfe 100644 --- a/src/platform/Linux/bluez/BluezEndpoint.h +++ b/src/platform/Linux/bluez/BluezEndpoint.h @@ -74,7 +74,7 @@ class BluezEndpoint CHIP_ERROR Init(bool aIsCentral, const char * apBleAddr); void Shutdown(); - BluezAdapter1 * GetAdapter() const { return mpAdapter; } + BluezAdapter1 * GetAdapter() const { return mAdapter.get(); } CHIP_ERROR RegisterGattApplication(); GDBusObjectManagerServer * GetGattApplicationObjectManager() const { return mpRoot; } @@ -127,7 +127,7 @@ class BluezEndpoint // Objects (interfaces) subscribed to by this service GDBusObjectManager * mpObjMgr = nullptr; - BluezAdapter1 * mpAdapter = nullptr; + GAutoPtr mAdapter; // Objects (interfaces) published by this service GDBusObjectManagerServer * mpRoot = nullptr; diff --git a/src/platform/Linux/bluez/ChipDeviceScanner.cpp b/src/platform/Linux/bluez/ChipDeviceScanner.cpp index 03b26aa08e3dc7..0d248058c3d1a0 100644 --- a/src/platform/Linux/bluez/ChipDeviceScanner.cpp +++ b/src/platform/Linux/bluez/ChipDeviceScanner.cpp @@ -58,7 +58,7 @@ CHIP_ERROR ChipDeviceScanner::Init(BluezAdapter1 * adapter, ChipDeviceScannerDel // Make this function idempotent by shutting down previously initialized state if any. Shutdown(); - mAdapter = BLUEZ_ADAPTER1(g_object_ref(adapter)); + mAdapter.reset(reinterpret_cast(g_object_ref(adapter))); mDelegate = delegate; // Create the D-Bus object manager client object on the glib thread, so that all D-Bus signals @@ -97,8 +97,7 @@ void ChipDeviceScanner::Shutdown() +[](ChipDeviceScanner * self) { if (self->mManager != nullptr) g_object_unref(self->mManager); - if (self->mAdapter != nullptr) - g_object_unref(self->mAdapter); + self->mAdapter.reset(); return CHIP_NO_ERROR; }, this); @@ -205,7 +204,7 @@ CHIP_ERROR ChipDeviceScanner::MainLoopStopScan(ChipDeviceScanner * self) self->mInterfaceChangedSignal = 0; } - if (!bluez_adapter1_call_stop_discovery_sync(self->mAdapter, nullptr /* not cancellable */, &error.GetReceiver())) + if (!bluez_adapter1_call_stop_discovery_sync(self->mAdapter.get(), nullptr /* not cancellable */, &error.GetReceiver())) { ChipLogError(Ble, "Failed to stop discovery %s", error->message); return CHIP_ERROR_INTERNAL; @@ -234,7 +233,7 @@ void ChipDeviceScanner::SignalInterfaceChanged(GDBusObjectManagerClient * manage void ChipDeviceScanner::ReportDevice(BluezDevice1 & device) { - if (strcmp(bluez_device1_get_adapter(&device), g_dbus_proxy_get_object_path(G_DBUS_PROXY(mAdapter))) != 0) + if (strcmp(bluez_device1_get_adapter(&device), g_dbus_proxy_get_object_path(G_DBUS_PROXY(mAdapter.get()))) != 0) { return; } @@ -252,7 +251,7 @@ void ChipDeviceScanner::ReportDevice(BluezDevice1 & device) void ChipDeviceScanner::RemoveDevice(BluezDevice1 & device) { - if (strcmp(bluez_device1_get_adapter(&device), g_dbus_proxy_get_object_path(G_DBUS_PROXY(mAdapter))) != 0) + if (strcmp(bluez_device1_get_adapter(&device), g_dbus_proxy_get_object_path(G_DBUS_PROXY(mAdapter.get()))) != 0) { return; } @@ -267,7 +266,7 @@ void ChipDeviceScanner::RemoveDevice(BluezDevice1 & device) const auto devicePath = g_dbus_proxy_get_object_path(G_DBUS_PROXY(&device)); GAutoPtr error; - if (!bluez_adapter1_call_remove_device_sync(mAdapter, devicePath, nullptr, &error.GetReceiver())) + if (!bluez_adapter1_call_remove_device_sync(mAdapter.get(), devicePath, nullptr, &error.GetReceiver())) { ChipLogDetail(Ble, "Failed to remove device %s: %s", StringOrNullMarker(devicePath), error->message); } @@ -302,7 +301,8 @@ CHIP_ERROR ChipDeviceScanner::MainLoopStartScan(ChipDeviceScanner * self) g_variant_builder_add(&filterBuilder, "{sv}", "Transport", g_variant_new_string("le")); GVariant * filter = g_variant_builder_end(&filterBuilder); - if (!bluez_adapter1_call_set_discovery_filter_sync(self->mAdapter, filter, self->mCancellable.get(), &error.GetReceiver())) + if (!bluez_adapter1_call_set_discovery_filter_sync(self->mAdapter.get(), filter, self->mCancellable.get(), + &error.GetReceiver())) { // Not critical: ignore if fails ChipLogError(Ble, "Failed to set discovery filters: %s", error->message); @@ -310,7 +310,7 @@ CHIP_ERROR ChipDeviceScanner::MainLoopStartScan(ChipDeviceScanner * self) } ChipLogProgress(Ble, "BLE initiating scan."); - if (!bluez_adapter1_call_start_discovery_sync(self->mAdapter, self->mCancellable.get(), &error.GetReceiver())) + if (!bluez_adapter1_call_start_discovery_sync(self->mAdapter.get(), self->mCancellable.get(), &error.GetReceiver())) { ChipLogError(Ble, "Failed to start discovery: %s", error->message); return CHIP_ERROR_INTERNAL; diff --git a/src/platform/Linux/bluez/ChipDeviceScanner.h b/src/platform/Linux/bluez/ChipDeviceScanner.h index 1271ec39cb241a..276499d73ef82a 100644 --- a/src/platform/Linux/bluez/ChipDeviceScanner.h +++ b/src/platform/Linux/bluez/ChipDeviceScanner.h @@ -27,6 +27,8 @@ #include #include +#include "Types.h" + namespace chip { namespace DeviceLayer { namespace Internal { @@ -105,8 +107,8 @@ class ChipDeviceScanner /// so that it can be re-discovered if it's still advertising. void RemoveDevice(BluezDevice1 & device); - GDBusObjectManager * mManager = nullptr; - BluezAdapter1 * mAdapter = nullptr; + GDBusObjectManager * mManager = nullptr; + GAutoPtr mAdapter; ChipDeviceScannerDelegate * mDelegate = nullptr; gulong mObjectAddedSignal = 0; gulong mInterfaceChangedSignal = 0; diff --git a/src/platform/Linux/bluez/Types.h b/src/platform/Linux/bluez/Types.h index f7be4d858d079a..729f3b445224af 100644 --- a/src/platform/Linux/bluez/Types.h +++ b/src/platform/Linux/bluez/Types.h @@ -54,12 +54,36 @@ namespace chip { +template <> +struct GAutoPtrDeleter +{ + using deleter = GObjectDeleter; +}; + template <> struct GAutoPtrDeleter { using deleter = GObjectDeleter; }; +template <> +struct GAutoPtrDeleter +{ + using deleter = GObjectDeleter; +}; + +template <> +struct GAutoPtrDeleter +{ + using deleter = GObjectDeleter; +}; + +template <> +struct GAutoPtrDeleter +{ + using deleter = GObjectDeleter; +}; + namespace DeviceLayer { namespace Internal { From ef8ee3239de27f1ca9290b51738ae407922d4c16 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Fri, 23 Feb 2024 11:19:12 +0100 Subject: [PATCH 29/29] [DiagnosticLogs] Allow TransferFileDesignator or size 0 (#32267) --- .../common/BDXDiagnosticLogsServerDelegate.cpp | 13 ++++++++++--- .../diagnostic-logs-server.cpp | 2 -- src/protocols/bdx/BdxTransferProxyDiagnosticLog.cpp | 1 - src/protocols/bdx/StatusCode.cpp | 8 ++++++++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/examples/chip-tool/commands/common/BDXDiagnosticLogsServerDelegate.cpp b/examples/chip-tool/commands/common/BDXDiagnosticLogsServerDelegate.cpp index 27260a54f57887..2a5b2d5d7c97a1 100644 --- a/examples/chip-tool/commands/common/BDXDiagnosticLogsServerDelegate.cpp +++ b/examples/chip-tool/commands/common/BDXDiagnosticLogsServerDelegate.cpp @@ -25,9 +25,10 @@ constexpr uint8_t kMaxFileDesignatorLen = 32; constexpr uint16_t kMaxFilePathLen = kMaxFileDesignatorLen + sizeof(kTmpDir) + 1; // For testing a few file names trigger an error depending on the current 'phase'. -constexpr char kErrorOnTransferBegin[] = "Error:OnTransferBegin"; -constexpr char kErrorOnTransferData[] = "Error:OnTransferData"; -constexpr char kErrorOnTransferEnd[] = "Error:OnTransferEnd"; +constexpr char kErrorOnTransferBegin[] = "Error:OnTransferBegin"; +constexpr char kErrorOnTransferData[] = "Error:OnTransferData"; +constexpr char kErrorOnTransferEnd[] = "Error:OnTransferEnd"; +constexpr char kErrorTransferMethodNotSupported[] = "TransferMethodNotSupported.txt"; BDXDiagnosticLogsServerDelegate BDXDiagnosticLogsServerDelegate::sInstance; @@ -136,8 +137,14 @@ CHIP_ERROR BDXDiagnosticLogsServerDelegate::OnTransferBegin(chip::bdx::BDXTransf auto fileDesignator = transfer->GetFileDesignator(); LogFileDesignator("OnTransferBegin", fileDesignator); + VerifyOrReturnError(fileDesignator.size() != 0, CHIP_ERROR_UNKNOWN_RESOURCE_ID); + chip::CharSpan phaseErrorTarget(kErrorOnTransferBegin, sizeof(kErrorOnTransferBegin) - 1); ReturnErrorOnFailure(CheckForErrorRequested(phaseErrorTarget, fileDesignator)); + + chip::CharSpan transferErrorTarget(kErrorTransferMethodNotSupported, sizeof(kErrorTransferMethodNotSupported) - 1); + VerifyOrReturnError(!transferErrorTarget.data_equal(fileDesignator), CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE); + ReturnErrorOnFailure(CheckFileDesignatorAllowed(mFileDesignators, fileDesignator)); char outputFilePath[kMaxFilePathLen] = { 0 }; diff --git a/src/app/clusters/diagnostic-logs-server/diagnostic-logs-server.cpp b/src/app/clusters/diagnostic-logs-server/diagnostic-logs-server.cpp index 7b1b036ee4857b..83beb46484bb71 100644 --- a/src/app/clusters/diagnostic-logs-server/diagnostic-logs-server.cpp +++ b/src/app/clusters/diagnostic-logs-server/diagnostic-logs-server.cpp @@ -132,8 +132,6 @@ void DiagnosticLogsServer::HandleLogRequestForBdx(CommandHandler * commandObj, c // INVALID_COMMAND. VerifyOrReturn(transferFileDesignator.HasValue(), commandObj->AddStatus(path, Status::InvalidCommand)); - VerifyOrReturn(transferFileDesignator.Value().size() > 0, commandObj->AddStatus(path, Status::ConstraintError)); - VerifyOrReturn(transferFileDesignator.Value().size() <= kMaxFileDesignatorLen, commandObj->AddStatus(path, Status::ConstraintError)); diff --git a/src/protocols/bdx/BdxTransferProxyDiagnosticLog.cpp b/src/protocols/bdx/BdxTransferProxyDiagnosticLog.cpp index 3f8915462941fb..ba1a41376afbbe 100644 --- a/src/protocols/bdx/BdxTransferProxyDiagnosticLog.cpp +++ b/src/protocols/bdx/BdxTransferProxyDiagnosticLog.cpp @@ -33,7 +33,6 @@ CHIP_ERROR BDXTransferProxyDiagnosticLog::Init(TransferSession * transferSession uint16_t fileDesignatorLength = 0; auto fileDesignator = transferSession->GetFileDesignator(fileDesignatorLength); - VerifyOrReturnError(fileDesignatorLength > 0, CHIP_ERROR_INVALID_STRING_LENGTH); VerifyOrReturnError(fileDesignatorLength <= ArraySize(mFileDesignator), CHIP_ERROR_INVALID_STRING_LENGTH); mTransfer = transferSession; diff --git a/src/protocols/bdx/StatusCode.cpp b/src/protocols/bdx/StatusCode.cpp index 2f739b5e831de2..9ab6f8d9b442be 100644 --- a/src/protocols/bdx/StatusCode.cpp +++ b/src/protocols/bdx/StatusCode.cpp @@ -33,6 +33,14 @@ StatusCode GetBdxStatusCodeFromChipError(CHIP_ERROR error) { status = StatusCode::kBadMessageContents; } + else if (error == CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE) + { + status = StatusCode::kTransferMethodNotSupported; + } + else if (error == CHIP_ERROR_UNKNOWN_RESOURCE_ID) + { + status = StatusCode::kFileDesignatorUnknown; + } return status; }