From 8eccf68b82022881dfeded94259156433e072183 Mon Sep 17 00:00:00 2001 From: Karsten Sperling <113487422+ksperling-apple@users.noreply.github.com> Date: Tue, 13 Aug 2024 23:20:47 +1200 Subject: [PATCH 01/59] Syslog and logging tweaks (#34941) * Make syslog ident and facility overridable and tweak options * Linux: Be a little less verbose when writing settings --- src/platform/Linux/CHIPLinuxStorageIni.cpp | 6 +----- src/platform/logging/impl/Syslog.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/platform/Linux/CHIPLinuxStorageIni.cpp b/src/platform/Linux/CHIPLinuxStorageIni.cpp index 1a968876282e1a..7186fe3d477fbf 100644 --- a/src/platform/Linux/CHIPLinuxStorageIni.cpp +++ b/src/platform/Linux/CHIPLinuxStorageIni.cpp @@ -98,17 +98,13 @@ CHIP_ERROR ChipLinuxStorageIni::CommitConfig(const std::string & configFile) if (fd != -1) { std::ofstream ofs; - - ChipLogProgress(DeviceLayer, "writing settings to file (%s)", tmpPath.c_str()); - ofs.open(tmpPath, std::ofstream::out | std::ofstream::trunc); mConfigStore.generate(ofs); - close(fd); if (rename(tmpPath.c_str(), configFile.c_str()) == 0) { - ChipLogProgress(DeviceLayer, "renamed tmp file to file (%s)", configFile.c_str()); + ChipLogDetail(DeviceLayer, "wrote settings to %s", configFile.c_str()); } else { diff --git a/src/platform/logging/impl/Syslog.cpp b/src/platform/logging/impl/Syslog.cpp index 163e6d7398aefe..638cffeb94215e 100644 --- a/src/platform/logging/impl/Syslog.cpp +++ b/src/platform/logging/impl/Syslog.cpp @@ -23,6 +23,14 @@ #include #include +#ifndef CHIP_SYSLOG_IDENT +#define CHIP_SYSLOG_IDENT nullptr +#endif + +#ifndef CHIP_SYSLOG_FACILITY +#define CHIP_SYSLOG_FACILITY LOG_DAEMON +#endif + namespace chip { namespace Logging { namespace Platform { @@ -51,7 +59,7 @@ void LogV(const char * module, uint8_t category, const char * msg, va_list v) if (!sInitialized) { - openlog(nullptr, 0, LOG_DAEMON); + openlog(CHIP_SYSLOG_IDENT, LOG_CONS | LOG_PID, CHIP_SYSLOG_FACILITY); sInitialized = true; } From ddf44dc121b1e3973e4d7f8d53fd78a3680c0022 Mon Sep 17 00:00:00 2001 From: William Date: Tue, 13 Aug 2024 12:22:19 +0100 Subject: [PATCH 02/59] Add out-of-band msgs to add and remove Supported Areas and Maps (#34930) * update the status field of progress elements at the end of a clean. * Added some style suggestions from the review of PR 34887. * update the readme. * Added a simple message to add a map. * Added an out-of-band message to add a supported area. * Added out-of-band messages to remove supported maps and supported areas. * Updated the rvc-app PICS values. Updated TC-SEAR-1.2 to include the necessary out-of-band messages to run the test in CI. * refactored to improve readability. * Restyled by clang-format * Restyled by prettier-markdown * Removed oddly duplicated method. * Fixed the json value conversion types. --------- Co-authored-by: Restyled.io --- examples/rvc-app/README.md | 37 ++++- .../rvc-app/linux/RvcAppCommandDelegate.cpp | 88 ++++++++++++ .../rvc-app/linux/RvcAppCommandDelegate.h | 8 ++ .../rvc-app/rvc-common/include/rvc-device.h | 8 ++ .../include/rvc-service-area-delegate.h | 16 ++- .../rvc-common/pics/rvc-app-pics-values | 8 +- .../rvc-app/rvc-common/src/rvc-device.cpp | 22 +++ .../src/rvc-service-area-delegate.cpp | 126 +++++++++++++++++- src/python_testing/TC_SEAR_1_2.py | 16 ++- 9 files changed, 317 insertions(+), 12 deletions(-) diff --git a/examples/rvc-app/README.md b/examples/rvc-app/README.md index 8cc6e7308b8382..da9317f508fe39 100644 --- a/examples/rvc-app/README.md +++ b/examples/rvc-app/README.md @@ -20,7 +20,42 @@ must have a `"Name"` key that contains the command name. This name is shown in the state machine diagram above. Example `echo '{"Name": "Charged"}' > /tmp/chip_rvc_fifo_42`. -### `AreaComplete` message +### ServiceArea related messages + +#### `AddMap` message + +This message adds a map to the SupportedMaps attribute of the Service Area +cluster. This message requires the following extra keys. + +- `MapId` This is an `int` setting the ID of the new map. +- `MapName` This is a `string` setting the name of the new map. + +#### `AddArea` message + +This message adds a new area to the SupportedAreas attribute of the Service Area +cluster. This message requires the following extra keys, most of which are +optional. Consult the `SupportedAreas` attribute spec for more information on +what are valid areas. + +- `AreaId` This is an `int` setting the ID of the area. +- `MapId` This is an `int` sitting the map ID the area is associated with. +- `LocationName` This is a `string` setting the location's name. +- `FloorNumber` This is an `int` setting the floor number of the area. +- `AreaType` This is an `int` setting the area type tag. +- `LandmarkTag` This is an `int` setting the landmark tag. +- `PositianTag` This is an `int` setting the position tag. + +#### `RemoveMap` message + +This message removes a map with the given map ID. This message requires the +`int` key `MapId`. + +#### `RemoveArea` message + +This message removes an area with the given area ID. This message requires the +`int` key `AreaId`. + +#### `AreaComplete` message This indicates that the area currently being serviced as indicated by the service area cluster is now complete. diff --git a/examples/rvc-app/linux/RvcAppCommandDelegate.cpp b/examples/rvc-app/linux/RvcAppCommandDelegate.cpp index 5a08dc6c9ffc8b..791df4d482cfe8 100644 --- a/examples/rvc-app/linux/RvcAppCommandDelegate.cpp +++ b/examples/rvc-app/linux/RvcAppCommandDelegate.cpp @@ -17,6 +17,7 @@ */ #include "RvcAppCommandDelegate.h" +#include #include #include "rvc-device.h" @@ -24,6 +25,7 @@ #include using namespace chip; +using namespace chip::app; using namespace chip::app::Clusters; RvcAppCommandHandler * RvcAppCommandHandler::FromJSON(const char * json) @@ -87,6 +89,25 @@ void RvcAppCommandHandler::HandleCommand(intptr_t context) { self->OnAreaCompleteHandler(); } + else if (name == "AddMap") + { + self->OnAddServiceAreaMap(self->mJsonValue); + } + else if (name == "AddArea") + { + VerifyOrExit(self->mJsonValue.isMember("AreaId"), ChipLogError(NotSpecified, "RVC App: AreaId key is missing")); + self->OnAddServiceAreaArea(self->mJsonValue); + } + else if (name == "RemoveMap") + { + VerifyOrExit(self->mJsonValue.isMember("MapId"), ChipLogError(NotSpecified, "RVC App: MapId key is missing")); + self->OnRemoveServiceAreaMap(self->mJsonValue["MapId"].asUInt()); + } + else if (name == "RemoveArea") + { + VerifyOrExit(self->mJsonValue.isMember("AreaId"), ChipLogError(NotSpecified, "RVC App: AreaId key is missing")); + self->OnRemoveServiceAreaArea(self->mJsonValue["AreaId"].asUInt()); + } else if (name == "ErrorEvent") { std::string error = self->mJsonValue["Error"].asString(); @@ -149,6 +170,73 @@ void RvcAppCommandHandler::OnAreaCompleteHandler() mRvcDevice->HandleAreaCompletedEvent(); } +void RvcAppCommandHandler::OnAddServiceAreaMap(Json::Value jsonValue) +{ + // Find if self->mJsonValue has the MapId and MapName Keys + if (jsonValue.isMember("MapId") && jsonValue.isMember("MapName")) + { + uint32_t mapId = jsonValue["MapId"].asUInt(); + std::string mapName = jsonValue["MapName"].asString(); + mRvcDevice->HandleAddServiceAreaMap(mapId, CharSpan(mapName.data(), mapName.size())); + } + else + { + ChipLogError(NotSpecified, "RVC App: MapId and MapName keys are missing"); + } +} + +void RvcAppCommandHandler::OnAddServiceAreaArea(Json::Value jsonValue) +{ + ServiceArea::AreaStructureWrapper area; + area.SetAreaId(jsonValue["AreaId"].asUInt()); + if (jsonValue.isMember("MapId")) + { + area.SetMapId(jsonValue["MapId"].asUInt()); + } + + // Set the location info + if (jsonValue.isMember("LocationName") || jsonValue.isMember("FloorNumber") || jsonValue.isMember("AreaType")) + { + DataModel::Nullable floorNumber = DataModel::NullNullable; + if (jsonValue.isMember("FloorNumber")) + { + floorNumber = jsonValue["FloorNumber"].asInt(); + } + DataModel::Nullable areaType = DataModel::NullNullable; + if (jsonValue.isMember("AreaType")) + { + areaType = Globals::AreaTypeTag(jsonValue["AreaType"].asUInt()); + } + auto locationName = jsonValue["LocationName"].asString(); + + area.SetLocationInfo(CharSpan(locationName.data(), locationName.size()), floorNumber, areaType); + } + + // Set landmark info + if (jsonValue.isMember("LandmarkTag")) + { + DataModel::Nullable relativePositionTag = DataModel::NullNullable; + if (jsonValue.isMember("PositionTag")) + { + relativePositionTag = Globals::RelativePositionTag(jsonValue["PositionTag"].asUInt()); + } + + area.SetLandmarkInfo(Globals::LandmarkTag(jsonValue["LandmarkTag"].asUInt()), relativePositionTag); + } + + mRvcDevice->HandleAddServiceAreaArea(area); +} + +void RvcAppCommandHandler::OnRemoveServiceAreaMap(uint32_t mapId) +{ + mRvcDevice->HandleRemoveServiceAreaMap(mapId); +} + +void RvcAppCommandHandler::OnRemoveServiceAreaArea(uint32_t areaId) +{ + mRvcDevice->HandleRemoveServiceAreaArea(areaId); +} + void RvcAppCommandHandler::OnErrorEventHandler(const std::string & error) { mRvcDevice->HandleErrorEvent(error); diff --git a/examples/rvc-app/linux/RvcAppCommandDelegate.h b/examples/rvc-app/linux/RvcAppCommandDelegate.h index e8dc404de2eb1c..6f896641dab1c7 100644 --- a/examples/rvc-app/linux/RvcAppCommandDelegate.h +++ b/examples/rvc-app/linux/RvcAppCommandDelegate.h @@ -57,6 +57,14 @@ class RvcAppCommandHandler void OnAreaCompleteHandler(); + void OnAddServiceAreaMap(Json::Value jsonValue); + + void OnAddServiceAreaArea(Json::Value jsonValue); + + void OnRemoveServiceAreaMap(uint32_t mapId); + + void OnRemoveServiceAreaArea(uint32_t areaId); + void OnErrorEventHandler(const std::string & error); void OnClearErrorHandler(); diff --git a/examples/rvc-app/rvc-common/include/rvc-device.h b/examples/rvc-app/rvc-common/include/rvc-device.h index 40a52329662482..b66ce3251feba6 100644 --- a/examples/rvc-app/rvc-common/include/rvc-device.h +++ b/examples/rvc-app/rvc-common/include/rvc-device.h @@ -127,6 +127,14 @@ class RvcDevice void HandleAreaCompletedEvent(); + void HandleAddServiceAreaMap(uint32_t mapId, const CharSpan & mapName); + + void HandleAddServiceAreaArea(ServiceArea::AreaStructureWrapper & area); + + void HandleRemoveServiceAreaMap(uint32_t mapId); + + void HandleRemoveServiceAreaArea(uint32_t areaId); + /** * Sets the device to an error state with the error state ID matching the error name given. * @param error The error name. Could be one of UnableToStartOrResume, UnableToCompleteOperation, CommandInvalidInState, diff --git a/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h b/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h index 4d065782dca113..4c13fcd493d7eb 100644 --- a/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h +++ b/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h @@ -63,6 +63,7 @@ class RvcServiceAreaDelegate : public Delegate const uint32_t supportedAreaID_C = 10050; const uint32_t supportedAreaID_D = 0x88888888; +public: /** * Set the SupportedMaps and SupportedAreas where the SupportedMaps is not null. */ @@ -73,7 +74,6 @@ class RvcServiceAreaDelegate : public Delegate */ void SetNoMapTopology(); -public: CHIP_ERROR Init() override; // command support @@ -101,6 +101,18 @@ class RvcServiceAreaDelegate : public Delegate bool ClearSupportedAreas() override; + /** + * This is a more sophisticated way of ensuring that we all attributes are still valid when a supported area is removed. + * Rather than clearing all the attributes that depend on the supported aeras, we only remove the elements that point to + * the removed supported areas. + */ + void HandleSupportedAreasUpdated() override; + + /** + * Note: Call the HandleSupportedAreasUpdated() method when finished removing supported areas. + */ + bool RemoveSupportedArea(uint32_t areaId); + //************************************************************************* // Supported Maps accessors @@ -118,6 +130,8 @@ class RvcServiceAreaDelegate : public Delegate bool ClearSupportedMaps() override; + bool RemoveSupportedMap(uint32_t mapId); + //************************************************************************* // Selected Areas accessors diff --git a/examples/rvc-app/rvc-common/pics/rvc-app-pics-values b/examples/rvc-app/rvc-common/pics/rvc-app-pics-values index 24558915f6fed0..c38f0c1b7e00a0 100644 --- a/examples/rvc-app/rvc-common/pics/rvc-app-pics-values +++ b/examples/rvc-app/rvc-common/pics/rvc-app-pics-values @@ -65,10 +65,10 @@ SEAR.S.C00.Rsp=1 SEAR.S.C02.Rsp=1 SEAR.S.C01.Tx=1 SEAR.S.C03.Tx=1 -SEAR.S.M.REMOVE_AREA=0 -SEAR.S.M.ADD_AREA=0 -SEAR.S.M.REMOVE_MAP=0 -SEAR.S.M.ADD_MAP=0 +SEAR.S.M.REMOVE_AREA=1 +SEAR.S.M.ADD_AREA=1 +SEAR.S.M.REMOVE_MAP=1 +SEAR.S.M.ADD_MAP=1 SEAR.S.M.INVALID_STATE_FOR_SELECT_AREAS=1 SEAR.S.M.VALID_STATE_FOR_SELECT_AREAS=0 SEAR.S.M.SELECT_AREAS_WHILE_NON_IDLE=1 diff --git a/examples/rvc-app/rvc-common/src/rvc-device.cpp b/examples/rvc-app/rvc-common/src/rvc-device.cpp index 8619d28ff498d5..623c95963f8834 100644 --- a/examples/rvc-app/rvc-common/src/rvc-device.cpp +++ b/examples/rvc-app/rvc-common/src/rvc-device.cpp @@ -327,6 +327,26 @@ void RvcDevice::HandleAreaCompletedEvent() } } +void RvcDevice::HandleAddServiceAreaMap(uint32_t mapId, const CharSpan & mapName) +{ + mServiceAreaInstance.AddSupportedMap(mapId, mapName); +} + +void RvcDevice::HandleAddServiceAreaArea(ServiceArea::AreaStructureWrapper & area) +{ + mServiceAreaInstance.AddSupportedArea(area); +} + +void RvcDevice::HandleRemoveServiceAreaMap(uint32_t mapId) +{ + mServiceAreaDelegate.RemoveSupportedMap(mapId); +} + +void RvcDevice::HandleRemoveServiceAreaArea(uint32_t areaId) +{ + mServiceAreaDelegate.RemoveSupportedArea(areaId); +} + void RvcDevice::HandleErrorEvent(const std::string & error) { detail::Structs::ErrorStateStruct::Type err; @@ -406,6 +426,8 @@ void RvcDevice::HandleResetMessage() mServiceAreaInstance.ClearProgress(); mServiceAreaInstance.SetCurrentArea(DataModel::NullNullable); mServiceAreaInstance.SetEstimatedEndTime(DataModel::NullNullable); + + mServiceAreaDelegate.SetMapTopology(); } void RvcDevice::UpdateServiceAreaProgressOnExit() diff --git a/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp b/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp index f7e17aa49aa255..984472977a0356 100644 --- a/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp +++ b/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp @@ -25,7 +25,7 @@ using namespace chip::app::Clusters::ServiceArea; void RvcServiceAreaDelegate::SetMapTopology() { - ClearSupportedMaps(); + GetInstance()->ClearSupportedMaps(); GetInstance()->AddSupportedMap(supportedMapId_XX, "My Map XX"_span); GetInstance()->AddSupportedMap(supportedMapId_YY, "My Map YY"_span); @@ -65,7 +65,7 @@ void RvcServiceAreaDelegate::SetMapTopology() void RvcServiceAreaDelegate::SetNoMapTopology() { - ClearSupportedMaps(); + GetInstance()->ClearSupportedMaps(); // Area A has name, floor number. auto areaA = @@ -279,6 +279,20 @@ bool RvcServiceAreaDelegate::ClearSupportedAreas() return false; } +bool RvcServiceAreaDelegate::RemoveSupportedArea(uint32_t areaId) +{ + for (auto it = mSupportedAreas.begin(); it != mSupportedAreas.end(); ++it) + { + if (it->areaID == areaId) + { + mSupportedAreas.erase(it); + return true; + } + } + + return false; +} + //************************************************************************* // Supported Maps accessors @@ -372,6 +386,114 @@ bool RvcServiceAreaDelegate::ClearSupportedMaps() return false; } +void RvcServiceAreaDelegate::HandleSupportedAreasUpdated() +{ + // Get a list of supported area IDs as `supportedAreaIDs` + std::vector supportedAreaIDs; + for (const auto & supportedArea : mSupportedAreas) + { + supportedAreaIDs.push_back(supportedArea.areaID); + } + + if (supportedAreaIDs.empty()) + { + // Clear all selected areas, current area, and progress if there are no supported areas. + GetInstance()->ClearSelectedAreas(); + GetInstance()->SetCurrentArea(DataModel::NullNullable); + GetInstance()->ClearProgress(); + return; + } + + // Remove mSelectedArea elements that do not exist is `supportedAreaIDs` + { + for (auto it = mSelectedAreas.begin(); it != mSelectedAreas.end();) + { + if (std::find(supportedAreaIDs.begin(), supportedAreaIDs.end(), *it) == supportedAreaIDs.end()) + { + it = mSelectedAreas.erase(it); + } + else + { + ++it; + } + } + } + + // Set current Area to null if current area is not in `supportedAreaIDs` + { + auto currentAreaId = GetInstance()->GetCurrentArea(); + if (!currentAreaId.IsNull() && + std::find(supportedAreaIDs.begin(), supportedAreaIDs.end(), currentAreaId.Value()) == supportedAreaIDs.end()) + { + GetInstance()->SetCurrentArea(DataModel::NullNullable); + } + } + + // Remove mProgress elements that do not exist is `supportedAreaIDs` + { + for (auto it = mProgressList.begin(); it != mProgressList.end();) + { + if (std::find(supportedAreaIDs.begin(), supportedAreaIDs.end(), it->areaID) == supportedAreaIDs.end()) + { + it = mProgressList.erase(it); + } + else + { + ++it; + } + } + } +} + +bool RvcServiceAreaDelegate::RemoveSupportedMap(uint32_t mapId) +{ + bool removedEntry = false; + for (auto it = mSupportedMaps.begin(); it != mSupportedMaps.end(); ++it) + { + if (it->mapID == mapId) + { + mSupportedMaps.erase(it); + removedEntry = true; + } + } + + if (!removedEntry) + { + return false; + } + + // If there are no supported maps left, none of the supported areas are vaild and their MapID needs to be null. + if (GetNumberOfSupportedMaps() == 0) + { + ClearSupportedAreas(); + return true; + } + + // Get the supported area IDs where the map ID matches the removed map ID + std::vector supportedAreaIds; + { + for (const auto & supportedArea : mSupportedAreas) + { + if (supportedArea.mapID == mapId) + { + supportedAreaIds.push_back(supportedArea.areaID); + } + } + } + + // Remove the supported areas with the matching map ID + if (!supportedAreaIds.empty()) + { + for (const auto & supportedAreaId : supportedAreaIds) + { + RemoveSupportedArea(supportedAreaId); + } + HandleSupportedAreasUpdated(); + } + + return true; +} + //************************************************************************* // Selected areas accessors diff --git a/src/python_testing/TC_SEAR_1_2.py b/src/python_testing/TC_SEAR_1_2.py index 939f4be638df5b..083533277a5e6d 100644 --- a/src/python_testing/TC_SEAR_1_2.py +++ b/src/python_testing/TC_SEAR_1_2.py @@ -245,7 +245,9 @@ async def test_TC_SEAR_1_2(self): test_step = "Manually intervene to remove one or more entries in the SupportedMaps list" self.print_step("10", test_step) - if not self.is_ci: + if self.is_ci: + self.write_to_app_pipe('{"Name": "RemoveMap", "MapId": 3}') + else: self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") await self.read_and_validate_supported_maps(step=11) @@ -278,7 +280,9 @@ async def test_TC_SEAR_1_2(self): test_step = "Manually intervene to add one or more entries to the SupportedMaps list" self.print_step("14", test_step) - if not self.is_ci: + if self.is_ci: + self.write_to_app_pipe('{"Name": "AddMap", "MapId": 1, "MapName": "NewTestMap1"}') + else: self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") await self.read_and_validate_supported_maps(step=15) @@ -311,7 +315,9 @@ async def test_TC_SEAR_1_2(self): test_step = "Manually intervene to remove one or more entries from the SupportedAreas list" self.print_step("18", test_step) - if not self.is_ci: + if self.is_ci: + self.write_to_app_pipe('{"Name": "RemoveArea", "AreaId": 10050}') + else: self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") await self.read_and_validate_supported_areas(step=19) @@ -343,7 +349,9 @@ async def test_TC_SEAR_1_2(self): test_step = "Manually intervene to add one or more entries to the SupportedAreas list" self.print_step("22", test_step) - if not self.is_ci: + if self.is_ci: + self.write_to_app_pipe('{"Name": "AddArea", "AreaId": 42, "MapId": 1, "LocationName": "NewTestArea1"}') + else: self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n") await self.read_and_validate_supported_areas(step=23) From 13c45d5b48418835ad66d65bb71f6a8b0e48e6ab Mon Sep 17 00:00:00 2001 From: jamesharrow <93921463+jamesharrow@users.noreply.github.com> Date: Tue, 13 Aug 2024 15:01:02 +0100 Subject: [PATCH 03/59] Restructured folders in chip-energy-management-app - no code change (#34879) * Refactored file location for chip-energy-management-app. Updated esp32 and linux build files. * Updated some all-clusters-app build and CMakeLists (linux, esp32, psoc6) * Updated remaining build and CMakefiles with new folders. * Fixed unit tests BUILD.gn * Restyled by gn * Missed Ameba .cmake * Missed all-clusters-minimal-app/esp32/main/CMakeLists.txt --------- Co-authored-by: Restyled.io --- .../all-clusters-app/ameba/chip_main.cmake | 23 +++++----- examples/all-clusters-app/asr/BUILD.gn | 23 +++++----- .../all-clusters-app/cc13x4_26x4/BUILD.gn | 23 +++++----- .../esp32/main/CMakeLists.txt | 10 ++++- .../all-clusters-app/infineon/psoc6/BUILD.gn | 24 +++++----- examples/all-clusters-app/linux/BUILD.gn | 27 ++++++----- examples/all-clusters-app/mbed/CMakeLists.txt | 23 +++++----- .../nrfconnect/CMakeLists.txt | 23 +++++----- examples/all-clusters-app/nxp/mw320/BUILD.gn | 24 +++++----- .../openiotsdk/CMakeLists.txt | 23 +++++----- .../all-clusters-app/telink/CMakeLists.txt | 23 +++++----- examples/all-clusters-app/tizen/BUILD.gn | 24 +++++----- .../esp32/main/CMakeLists.txt | 5 ++- .../EnergyManagementAppCmdLineOptions.h | 0 .../{ => common}/src/EnergyTimeUtils.cpp | 0 .../include/DEMManufacturerDelegate.h | 0 .../DeviceEnergyManagementDelegateImpl.h | 0 .../include/DeviceEnergyManagementManager.h | 0 .../include/device-energy-management-modes.h | 0 .../src/DEMTestEventTriggers.cpp | 0 .../DeviceEnergyManagementDelegateImpl.cpp | 0 .../src/DeviceEnergyManagementManager.cpp | 0 .../src/device-energy-management-mode.cpp | 0 .../include/ChargingTargetsMemMgr.h | 0 .../{ => energy-evse}/include/EVSECallbacks.h | 0 .../include/EVSEManufacturerImpl.h | 0 .../include/EnergyEvseDelegateImpl.h | 0 .../include/EnergyEvseMain.h | 0 .../include/EnergyEvseManager.h | 0 .../include/EnergyEvseTargetsStore.h | 0 .../include/EnergyTimeUtils.h | 0 .../include/energy-evse-modes.h | 0 .../src/ChargingTargetsMemMgr.cpp | 0 .../src/EVSEManufacturerImpl.cpp | 0 .../src/EnergyEvseDelegateImpl.cpp | 0 .../src/EnergyEvseEventTriggers.cpp | 0 .../{ => energy-evse}/src/EnergyEvseMain.cpp | 0 .../src/EnergyEvseManager.cpp | 0 .../src/EnergyEvseTargetsStore.cpp | 0 .../src/energy-evse-mode.cpp | 0 .../ElectricalPowerMeasurementDelegate.h | 0 .../include/FakeReadings.h | 0 .../include/PowerTopologyDelegate.h | 0 .../ElectricalPowerMeasurementDelegate.cpp | 0 .../src/EnergyReportingEventTriggers.cpp | 0 .../src/FakeReadings.cpp | 0 .../src/PowerTopologyDelegate.cpp | 0 .../energy-management-common/tests/BUILD.gn | 2 +- .../esp32/main/CMakeLists.txt | 10 ++++- examples/energy-management-app/linux/BUILD.gn | 45 ++++++++++--------- examples/shell/shell_common/BUILD.gn | 24 +++++----- 51 files changed, 207 insertions(+), 149 deletions(-) rename examples/energy-management-app/energy-management-common/{ => common}/include/EnergyManagementAppCmdLineOptions.h (100%) rename examples/energy-management-app/energy-management-common/{ => common}/src/EnergyTimeUtils.cpp (100%) rename examples/energy-management-app/energy-management-common/{ => device-energy-management}/include/DEMManufacturerDelegate.h (100%) rename examples/energy-management-app/energy-management-common/{ => device-energy-management}/include/DeviceEnergyManagementDelegateImpl.h (100%) rename examples/energy-management-app/energy-management-common/{ => device-energy-management}/include/DeviceEnergyManagementManager.h (100%) rename examples/energy-management-app/energy-management-common/{ => device-energy-management}/include/device-energy-management-modes.h (100%) rename examples/energy-management-app/energy-management-common/{ => device-energy-management}/src/DEMTestEventTriggers.cpp (100%) rename examples/energy-management-app/energy-management-common/{ => device-energy-management}/src/DeviceEnergyManagementDelegateImpl.cpp (100%) rename examples/energy-management-app/energy-management-common/{ => device-energy-management}/src/DeviceEnergyManagementManager.cpp (100%) rename examples/energy-management-app/energy-management-common/{ => device-energy-management}/src/device-energy-management-mode.cpp (100%) rename examples/energy-management-app/energy-management-common/{ => energy-evse}/include/ChargingTargetsMemMgr.h (100%) rename examples/energy-management-app/energy-management-common/{ => energy-evse}/include/EVSECallbacks.h (100%) rename examples/energy-management-app/energy-management-common/{ => energy-evse}/include/EVSEManufacturerImpl.h (100%) rename examples/energy-management-app/energy-management-common/{ => energy-evse}/include/EnergyEvseDelegateImpl.h (100%) rename examples/energy-management-app/energy-management-common/{ => energy-evse}/include/EnergyEvseMain.h (100%) rename examples/energy-management-app/energy-management-common/{ => energy-evse}/include/EnergyEvseManager.h (100%) rename examples/energy-management-app/energy-management-common/{ => energy-evse}/include/EnergyEvseTargetsStore.h (100%) rename examples/energy-management-app/energy-management-common/{ => energy-evse}/include/EnergyTimeUtils.h (100%) rename examples/energy-management-app/energy-management-common/{ => energy-evse}/include/energy-evse-modes.h (100%) rename examples/energy-management-app/energy-management-common/{ => energy-evse}/src/ChargingTargetsMemMgr.cpp (100%) rename examples/energy-management-app/energy-management-common/{ => energy-evse}/src/EVSEManufacturerImpl.cpp (100%) rename examples/energy-management-app/energy-management-common/{ => energy-evse}/src/EnergyEvseDelegateImpl.cpp (100%) rename examples/energy-management-app/energy-management-common/{ => energy-evse}/src/EnergyEvseEventTriggers.cpp (100%) rename examples/energy-management-app/energy-management-common/{ => energy-evse}/src/EnergyEvseMain.cpp (100%) rename examples/energy-management-app/energy-management-common/{ => energy-evse}/src/EnergyEvseManager.cpp (100%) rename examples/energy-management-app/energy-management-common/{ => energy-evse}/src/EnergyEvseTargetsStore.cpp (100%) rename examples/energy-management-app/energy-management-common/{ => energy-evse}/src/energy-evse-mode.cpp (100%) rename examples/energy-management-app/energy-management-common/{ => energy-reporting}/include/ElectricalPowerMeasurementDelegate.h (100%) rename examples/energy-management-app/energy-management-common/{ => energy-reporting}/include/FakeReadings.h (100%) rename examples/energy-management-app/energy-management-common/{ => energy-reporting}/include/PowerTopologyDelegate.h (100%) rename examples/energy-management-app/energy-management-common/{ => energy-reporting}/src/ElectricalPowerMeasurementDelegate.cpp (100%) rename examples/energy-management-app/energy-management-common/{ => energy-reporting}/src/EnergyReportingEventTriggers.cpp (100%) rename examples/energy-management-app/energy-management-common/{ => energy-reporting}/src/FakeReadings.cpp (100%) rename examples/energy-management-app/energy-management-common/{ => energy-reporting}/src/PowerTopologyDelegate.cpp (100%) diff --git a/examples/all-clusters-app/ameba/chip_main.cmake b/examples/all-clusters-app/ameba/chip_main.cmake index e6e9ee19a87394..363b01e05ac2de 100644 --- a/examples/all-clusters-app/ameba/chip_main.cmake +++ b/examples/all-clusters-app/ameba/chip_main.cmake @@ -187,15 +187,15 @@ list( ${chip_dir}/examples/microwave-oven-app/microwave-oven-common/src/microwave-oven-device.cpp - ${chip_dir}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp - ${chip_dir}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp - ${chip_dir}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp - ${chip_dir}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp - ${chip_dir}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp - ${chip_dir}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp - ${chip_dir}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp - ${chip_dir}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp - ${chip_dir}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp + ${chip_dir}/examples/energy-management-app/energy-management-common/common/src/EnergyTimeUtils.cpp + ${chip_dir}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementDelegateImpl.cpp + ${chip_dir}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementManager.cpp + ${chip_dir}/examples/energy-management-app/energy-management-common/energy-evse/src/ChargingTargetsMemMgr.cpp + ${chip_dir}/examples/energy-management-app/energy-management-common/energy-evse/src/EVSEManufacturerImpl.cpp + ${chip_dir}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseDelegateImpl.cpp + ${chip_dir}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseManager.cpp + ${chip_dir}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseTargetsStore.cpp + ${chip_dir}/examples/energy-management-app/energy-management-common/energy-reporting/src/ElectricalPowerMeasurementDelegate.cpp ${chip_dir}/examples/platform/ameba/route_hook/ameba_route_hook.c ${chip_dir}/examples/platform/ameba/route_hook/ameba_route_table.c @@ -243,7 +243,10 @@ target_include_directories( ${chip_dir}/examples/all-clusters-app/all-clusters-common/include ${chip_dir}/examples/microwave-oven-app/microwave-oven-common ${chip_dir}/examples/microwave-oven-app/microwave-oven-common/include - ${chip_dir}/examples/energy-management-app/energy-management-common/include + ${chip_dir}/examples/energy-management-app/energy-management-common/common/include + ${chip_dir}/examples/energy-management-app/energy-management-common/device-energy-management/include + ${chip_dir}/examples/energy-management-app/energy-management-common/energy-evse/include + ${chip_dir}/examples/energy-management-app/energy-management-common/energy-reporting/include ${chip_dir}/examples/all-clusters-app/ameba/main/include ${chip_dir}/examples/platform/ameba ${chip_dir}/examples/platform/ameba/route_hook diff --git a/examples/all-clusters-app/asr/BUILD.gn b/examples/all-clusters-app/asr/BUILD.gn index fc7ad9037b99de..e27884810cbd8f 100644 --- a/examples/all-clusters-app/asr/BUILD.gn +++ b/examples/all-clusters-app/asr/BUILD.gn @@ -82,15 +82,15 @@ asr_executable("clusters_app") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/common/src/EnergyTimeUtils.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/ChargingTargetsMemMgr.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EVSEManufacturerImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseTargetsStore.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/src/ElectricalPowerMeasurementDelegate.cpp", "${examples_plat_dir}/ButtonHandler.cpp", "${examples_plat_dir}/CHIPDeviceManager.cpp", "${examples_plat_dir}/LEDWidget.cpp", @@ -121,7 +121,10 @@ asr_executable("clusters_app") { "${examples_plat_dir}", "${asr_project_dir}/include", "${chip_root}/examples/all-clusters-app/all-clusters-common/include", - "${chip_root}/examples/energy-management-app/energy-management-common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/include", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/include", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/include", "${chip_root}/src", "${chip_root}/src/lib", "${chip_root}/src/lib/support", diff --git a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn index c1cb81a9722f7d..bda63caa38dff5 100644 --- a/examples/all-clusters-app/cc13x4_26x4/BUILD.gn +++ b/examples/all-clusters-app/cc13x4_26x4/BUILD.gn @@ -72,15 +72,15 @@ ti_simplelink_executable("all-clusters-app") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/common/src/EnergyTimeUtils.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/ChargingTargetsMemMgr.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EVSEManufacturerImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseTargetsStore.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/src/ElectricalPowerMeasurementDelegate.cpp", "${chip_root}/examples/providers/DeviceInfoProviderImpl.cpp", "${chip_root}/src/app/clusters/general-diagnostics-server/GenericFaultTestEventTriggerHandler.cpp", "${project_dir}/main/AppTask.cpp", @@ -116,7 +116,10 @@ ti_simplelink_executable("all-clusters-app") { "${project_dir}", "${project_dir}/main", "${chip_root}/examples/all-clusters-app/all-clusters-common/include", - "${chip_root}/examples/energy-management-app/energy-management-common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/include", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/include", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/include", "${chip_root}/examples/providers/", ] diff --git a/examples/all-clusters-app/esp32/main/CMakeLists.txt b/examples/all-clusters-app/esp32/main/CMakeLists.txt index 7fd1d548609257..3e80b995c55b5f 100644 --- a/examples/all-clusters-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-app/esp32/main/CMakeLists.txt @@ -18,7 +18,10 @@ # The list of src and include dirs must be in sync with that in all-clusters-app/esp32/main/component.mk set(PRIV_INCLUDE_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/include" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/include" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/common/include" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/device-energy-management/include" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/energy-evse/include" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/energy-reporting/include" "${CMAKE_CURRENT_LIST_DIR}/include" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32" @@ -29,7 +32,10 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated/attributes" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/src" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/src" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/common/src" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/device-energy-management/src" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/energy-evse/src" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/energy-reporting/src" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/ota" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/common" diff --git a/examples/all-clusters-app/infineon/psoc6/BUILD.gn b/examples/all-clusters-app/infineon/psoc6/BUILD.gn index 9be06891342d7c..aeb1fa0b6feb4d 100644 --- a/examples/all-clusters-app/infineon/psoc6/BUILD.gn +++ b/examples/all-clusters-app/infineon/psoc6/BUILD.gn @@ -124,15 +124,16 @@ psoc6_executable("clusters_app") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/common/src/EnergyTimeUtils.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/ChargingTargetsMemMgr.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EVSEManufacturerImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseTargetsStore.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/energy-evse-mode.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/src/ElectricalPowerMeasurementDelegate.cpp", "${examples_plat_dir}/LEDWidget.cpp", "${examples_plat_dir}/init_psoc6Platform.cpp", "src/AppTask.cpp", @@ -157,7 +158,10 @@ psoc6_executable("clusters_app") { "${examples_plat_dir}", "${psoc6_project_dir}/include", "${chip_root}/examples/all-clusters-app/all-clusters-common/include", - "${chip_root}/examples/energy-management-app/energy-management-common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/include", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/include", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/include", ] defines = [] diff --git a/examples/all-clusters-app/linux/BUILD.gn b/examples/all-clusters-app/linux/BUILD.gn index c7c5fb0f14ecd3..ed228b51b2cb32 100644 --- a/examples/all-clusters-app/linux/BUILD.gn +++ b/examples/all-clusters-app/linux/BUILD.gn @@ -64,17 +64,17 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/tcc-mode.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/water-heater-mode.cpp", "${chip_root}/examples/all-clusters-app/linux/diagnostic-logs-provider-delegate-impl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/device-energy-management-mode.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/energy-evse-mode.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/common/src/EnergyTimeUtils.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/device-energy-management-mode.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/ChargingTargetsMemMgr.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EVSEManufacturerImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseTargetsStore.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/energy-evse-mode.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/src/ElectricalPowerMeasurementDelegate.cpp", "${chip_root}/examples/thermostat/linux/thermostat-delegate-impl.cpp", "AllClustersCommandDelegate.cpp", "AllClustersCommandDelegate.h", @@ -98,7 +98,10 @@ source_set("chip-all-clusters-common") { include_dirs = [ "${chip_root}/examples/all-clusters-app/all-clusters-common/include", - "${chip_root}/examples/energy-management-app/energy-management-common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/include", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/include", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/include", "${chip_root}/examples/thermostat/linux/include", ] diff --git a/examples/all-clusters-app/mbed/CMakeLists.txt b/examples/all-clusters-app/mbed/CMakeLists.txt index 427517aff9f8e1..b2e54ed28a78d6 100644 --- a/examples/all-clusters-app/mbed/CMakeLists.txt +++ b/examples/all-clusters-app/mbed/CMakeLists.txt @@ -50,7 +50,10 @@ target_include_directories(${APP_TARGET} PRIVATE main/include/ ${MBED_COMMON}/util/include ${ALL_CLUSTERS_COMMON}/include - ${ENERGY_MANAGEMENT_COMMON}/include + ${ENERGY_MANAGEMENT_COMMON}/common/include + ${ENERGY_MANAGEMENT_COMMON}/device-energy-management/include + ${ENERGY_MANAGEMENT_COMMON}/energy-evse/include + ${ENERGY_MANAGEMENT_COMMON}/energy-reporting/include ${GEN_DIR}/app-common ${GEN_DIR}/all-clusters-app ${NLIO_ROOT} @@ -72,15 +75,15 @@ target_sources(${APP_TARGET} PRIVATE ${ALL_CLUSTERS_COMMON}/src/smco-stub.cpp ${ALL_CLUSTERS_COMMON}/src/static-supported-modes-manager.cpp ${ALL_CLUSTERS_COMMON}/src/static-supported-temperature-levels.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/ChargingTargetsMemMgr.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementDelegateImpl.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementManager.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/EVSEManufacturerImpl.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/ElectricalPowerMeasurementDelegate.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseDelegateImpl.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseManager.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseTargetsStore.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/EnergyTimeUtils.cpp + ${ENERGY_MANAGEMENT_COMMON}/common/src/EnergyTimeUtils.cpp + ${ENERGY_MANAGEMENT_COMMON}/device-energy-management/src/DeviceEnergyManagementDelegateImpl.cpp + ${ENERGY_MANAGEMENT_COMMON}/device-energy-management/src/DeviceEnergyManagementManager.cpp + ${ENERGY_MANAGEMENT_COMMON}/energy-evse/src/ChargingTargetsMemMgr.cpp + ${ENERGY_MANAGEMENT_COMMON}/energy-evse/src/EVSEManufacturerImpl.cpp + ${ENERGY_MANAGEMENT_COMMON}/energy-evse/src/EnergyEvseDelegateImpl.cpp + ${ENERGY_MANAGEMENT_COMMON}/energy-evse/src/EnergyEvseManager.cpp + ${ENERGY_MANAGEMENT_COMMON}/energy-evse/src/EnergyEvseTargetsStore.cpp + ${ENERGY_MANAGEMENT_COMMON}/energy-reporting/src/ElectricalPowerMeasurementDelegate.cpp ) chip_configure_data_model(${APP_TARGET} diff --git a/examples/all-clusters-app/nrfconnect/CMakeLists.txt b/examples/all-clusters-app/nrfconnect/CMakeLists.txt index e11dcbd14356fc..bed8169e40bd92 100644 --- a/examples/all-clusters-app/nrfconnect/CMakeLists.txt +++ b/examples/all-clusters-app/nrfconnect/CMakeLists.txt @@ -42,7 +42,10 @@ include(${CHIP_ROOT}/src/app/chip_data_model.cmake) target_include_directories(app PRIVATE main/include ${ALL_CLUSTERS_COMMON_DIR}/include - ${ENERGY_MANAGEMENT_COMMON_DIR}/include + ${ENERGY_MANAGEMENT_COMMON_DIR}/common/include + ${ENERGY_MANAGEMENT_COMMON_DIR}/device-energy-management/include + ${ENERGY_MANAGEMENT_COMMON_DIR}/energy-evse/include + ${ENERGY_MANAGEMENT_COMMON_DIR}/energy-reporting/include ${GEN_DIR}/app-common ${GEN_DIR}/all-clusters-app ${NRFCONNECT_COMMON}/util/include) @@ -62,15 +65,15 @@ target_sources(app PRIVATE ${ALL_CLUSTERS_COMMON_DIR}/src/air-quality-instance.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/concentration-measurement-instances.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/resource-monitoring-delegates.cpp - ${ENERGY_MANAGEMENT_COMMON_DIR}/src/ChargingTargetsMemMgr.cpp - ${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementDelegateImpl.cpp - ${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementManager.cpp - ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EVSEManufacturerImpl.cpp - ${ENERGY_MANAGEMENT_COMMON_DIR}/src/ElectricalPowerMeasurementDelegate.cpp - ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseDelegateImpl.cpp - ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseManager.cpp - ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseTargetsStore.cpp - ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyTimeUtils.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/common/src/EnergyTimeUtils.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/device-energy-management/src/DeviceEnergyManagementDelegateImpl.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/device-energy-management/src/DeviceEnergyManagementManager.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/energy-evse/src/ChargingTargetsMemMgr.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/energy-evse/src/EVSEManufacturerImpl.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/energy-evse/src/EnergyEvseDelegateImpl.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/energy-evse/src/EnergyEvseManager.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/energy-evse/src/EnergyEvseTargetsStore.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/energy-reporting/src/ElectricalPowerMeasurementDelegate.cpp ${NRFCONNECT_COMMON}/util/LEDWidget.cpp) chip_configure_data_model(app diff --git a/examples/all-clusters-app/nxp/mw320/BUILD.gn b/examples/all-clusters-app/nxp/mw320/BUILD.gn index e5e3671143ee99..89ba7f249719cc 100644 --- a/examples/all-clusters-app/nxp/mw320/BUILD.gn +++ b/examples/all-clusters-app/nxp/mw320/BUILD.gn @@ -74,7 +74,10 @@ mw320_executable("shell_mw320") { "${chip_root}/src", "${chip_root}/src/app/util", "${chip_root}/examples/all-clusters-app/all-clusters-common/include", - "${chip_root}/examples/energy-management-app/energy-management-common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/include", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/include", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/include", "${chip_root}/examples/all-clusters-app/nxp/mw320/include", ] sources = [ @@ -89,15 +92,16 @@ mw320_executable("shell_mw320") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/common/src/EnergyTimeUtils.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/ChargingTargetsMemMgr.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EVSEManufacturerImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseTargetsStore.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/energy-evse-mode.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/src/ElectricalPowerMeasurementDelegate.cpp", "${chip_root}/src/lib/shell/streamer_mw320.cpp", "binding-handler.cpp", "include/CHIPProjectConfig.h", diff --git a/examples/all-clusters-app/openiotsdk/CMakeLists.txt b/examples/all-clusters-app/openiotsdk/CMakeLists.txt index 9db62a3df783a1..c568ec2b19e66d 100644 --- a/examples/all-clusters-app/openiotsdk/CMakeLists.txt +++ b/examples/all-clusters-app/openiotsdk/CMakeLists.txt @@ -48,7 +48,10 @@ target_include_directories(${APP_TARGET} PRIVATE main/include ${ALL_CLUSTERS_COMMON}/include - ${ENERGY_MANAGEMENT_COMMON}/include + ${ENERGY_MANAGEMENT_COMMON}/common/include + ${ENERGY_MANAGEMENT_COMMON}/device-energy-management/include + ${ENERGY_MANAGEMENT_COMMON}/energy-evse/include + ${ENERGY_MANAGEMENT_COMMON}/energy-reporting/include ) target_sources(${APP_TARGET} @@ -65,15 +68,15 @@ target_sources(${APP_TARGET} ${ALL_CLUSTERS_COMMON}/src/resource-monitoring-delegates.cpp ${ALL_CLUSTERS_COMMON}/src/static-supported-modes-manager.cpp ${ALL_CLUSTERS_COMMON}/src/binding-handler.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/ChargingTargetsMemMgr.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementDelegateImpl.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/DeviceEnergyManagementManager.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/EVSEManufacturerImpl.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/ElectricalPowerMeasurementDelegate.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseDelegateImpl.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseManager.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/EnergyEvseTargetsStore.cpp - ${ENERGY_MANAGEMENT_COMMON}/src/EnergyTimeUtils.cpp + ${ENERGY_MANAGEMENT_COMMON}/common/src/EnergyTimeUtils.cpp + ${ENERGY_MANAGEMENT_COMMON}/device-energy-management/src/DeviceEnergyManagementDelegateImpl.cpp + ${ENERGY_MANAGEMENT_COMMON}/device-energy-management/src/DeviceEnergyManagementManager.cpp + ${ENERGY_MANAGEMENT_COMMON}/energy-evse/src/ChargingTargetsMemMgr.cpp + ${ENERGY_MANAGEMENT_COMMON}/energy-evse/src/EVSEManufacturerImpl.cpp + ${ENERGY_MANAGEMENT_COMMON}/energy-evse/src/EnergyEvseDelegateImpl.cpp + ${ENERGY_MANAGEMENT_COMMON}/energy-evse/src/EnergyEvseManager.cpp + ${ENERGY_MANAGEMENT_COMMON}/energy-evse/src/EnergyEvseTargetsStore.cpp + ${ENERGY_MANAGEMENT_COMMON}/energy-reporting/src/ElectricalPowerMeasurementDelegate.cpp ) target_link_libraries(${APP_TARGET} diff --git a/examples/all-clusters-app/telink/CMakeLists.txt b/examples/all-clusters-app/telink/CMakeLists.txt index 675ea4d9eb7e74..1eba5072690a6d 100644 --- a/examples/all-clusters-app/telink/CMakeLists.txt +++ b/examples/all-clusters-app/telink/CMakeLists.txt @@ -31,7 +31,10 @@ project(chip-telink-all-clusters-app-example) target_include_directories(app PRIVATE include ${ALL_CLUSTERS_COMMON_DIR}/include - ${ENERGY_MANAGEMENT_COMMON_DIR}/include + ${ENERGY_MANAGEMENT_COMMON_DIR}/common/include + ${ENERGY_MANAGEMENT_COMMON_DIR}/device-energy-management/include + ${ENERGY_MANAGEMENT_COMMON_DIR}/energy-evse/include + ${ENERGY_MANAGEMENT_COMMON_DIR}/energy-reporting/include ${GEN_DIR}/app-common ${GEN_DIR}/all-clusters-app ${TELINK_COMMON}/common/include @@ -51,15 +54,15 @@ target_sources(app PRIVATE ${ALL_CLUSTERS_COMMON_DIR}/src/device-energy-management-stub.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/energy-evse-stub.cpp ${ALL_CLUSTERS_COMMON_DIR}/src/resource-monitoring-delegates.cpp - ${ENERGY_MANAGEMENT_COMMON_DIR}/src/ChargingTargetsMemMgr.cpp - ${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementDelegateImpl.cpp - ${ENERGY_MANAGEMENT_COMMON_DIR}/src/DeviceEnergyManagementManager.cpp - ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EVSEManufacturerImpl.cpp - ${ENERGY_MANAGEMENT_COMMON_DIR}/src/ElectricalPowerMeasurementDelegate.cpp - ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseDelegateImpl.cpp - ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseManager.cpp - ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyEvseTargetsStore.cpp - ${ENERGY_MANAGEMENT_COMMON_DIR}/src/EnergyTimeUtils.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/common/src/EnergyTimeUtils.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/device-energy-management/src/DeviceEnergyManagementDelegateImpl.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/device-energy-management/src/DeviceEnergyManagementManager.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/energy-evse/src/ChargingTargetsMemMgr.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/energy-evse/src/EVSEManufacturerImpl.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/energy-evse/src/EnergyEvseDelegateImpl.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/energy-evse/src/EnergyEvseManager.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/energy-evse/src/EnergyEvseTargetsStore.cpp + ${ENERGY_MANAGEMENT_COMMON_DIR}/energy-reporting/src/ElectricalPowerMeasurementDelegate.cpp ${TELINK_COMMON}/common/src/mainCommon.cpp ${TELINK_COMMON}/common/src/AppTaskCommon.cpp ${TELINK_COMMON}/util/src/LEDManager.cpp diff --git a/examples/all-clusters-app/tizen/BUILD.gn b/examples/all-clusters-app/tizen/BUILD.gn index 855416c0446923..332b03cbebaf00 100644 --- a/examples/all-clusters-app/tizen/BUILD.gn +++ b/examples/all-clusters-app/tizen/BUILD.gn @@ -38,15 +38,16 @@ source_set("chip-all-clusters-common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/common/src/EnergyTimeUtils.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/ChargingTargetsMemMgr.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EVSEManufacturerImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseTargetsStore.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/energy-evse-mode.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/src/ElectricalPowerMeasurementDelegate.cpp", ] deps = [ @@ -57,7 +58,10 @@ source_set("chip-all-clusters-common") { include_dirs = [ "${chip_root}/examples/all-clusters-app/all-clusters-common/include", - "${chip_root}/examples/energy-management-app/energy-management-common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/include", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/include", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/include", ] } diff --git a/examples/all-clusters-minimal-app/esp32/main/CMakeLists.txt b/examples/all-clusters-minimal-app/esp32/main/CMakeLists.txt index 7178945c7eb21c..06916c32c6670d 100644 --- a/examples/all-clusters-minimal-app/esp32/main/CMakeLists.txt +++ b/examples/all-clusters-minimal-app/esp32/main/CMakeLists.txt @@ -19,7 +19,10 @@ # The list of src and include dirs must be in sync with that in all-clusters-minimal-app/esp32/main/component.mk set(PRIV_INCLUDE_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/include" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/include" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/common/include" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/device-energy-management/include" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/energy-evse/include" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/energy-reporting/include" "${CMAKE_CURRENT_LIST_DIR}/include" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32" diff --git a/examples/energy-management-app/energy-management-common/include/EnergyManagementAppCmdLineOptions.h b/examples/energy-management-app/energy-management-common/common/include/EnergyManagementAppCmdLineOptions.h similarity index 100% rename from examples/energy-management-app/energy-management-common/include/EnergyManagementAppCmdLineOptions.h rename to examples/energy-management-app/energy-management-common/common/include/EnergyManagementAppCmdLineOptions.h diff --git a/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp b/examples/energy-management-app/energy-management-common/common/src/EnergyTimeUtils.cpp similarity index 100% rename from examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp rename to examples/energy-management-app/energy-management-common/common/src/EnergyTimeUtils.cpp diff --git a/examples/energy-management-app/energy-management-common/include/DEMManufacturerDelegate.h b/examples/energy-management-app/energy-management-common/device-energy-management/include/DEMManufacturerDelegate.h similarity index 100% rename from examples/energy-management-app/energy-management-common/include/DEMManufacturerDelegate.h rename to examples/energy-management-app/energy-management-common/device-energy-management/include/DEMManufacturerDelegate.h diff --git a/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h b/examples/energy-management-app/energy-management-common/device-energy-management/include/DeviceEnergyManagementDelegateImpl.h similarity index 100% rename from examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementDelegateImpl.h rename to examples/energy-management-app/energy-management-common/device-energy-management/include/DeviceEnergyManagementDelegateImpl.h diff --git a/examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementManager.h b/examples/energy-management-app/energy-management-common/device-energy-management/include/DeviceEnergyManagementManager.h similarity index 100% rename from examples/energy-management-app/energy-management-common/include/DeviceEnergyManagementManager.h rename to examples/energy-management-app/energy-management-common/device-energy-management/include/DeviceEnergyManagementManager.h diff --git a/examples/energy-management-app/energy-management-common/include/device-energy-management-modes.h b/examples/energy-management-app/energy-management-common/device-energy-management/include/device-energy-management-modes.h similarity index 100% rename from examples/energy-management-app/energy-management-common/include/device-energy-management-modes.h rename to examples/energy-management-app/energy-management-common/device-energy-management/include/device-energy-management-modes.h diff --git a/examples/energy-management-app/energy-management-common/src/DEMTestEventTriggers.cpp b/examples/energy-management-app/energy-management-common/device-energy-management/src/DEMTestEventTriggers.cpp similarity index 100% rename from examples/energy-management-app/energy-management-common/src/DEMTestEventTriggers.cpp rename to examples/energy-management-app/energy-management-common/device-energy-management/src/DEMTestEventTriggers.cpp diff --git a/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementDelegateImpl.cpp similarity index 100% rename from examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp rename to examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementDelegateImpl.cpp diff --git a/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp b/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementManager.cpp similarity index 100% rename from examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp rename to examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementManager.cpp diff --git a/examples/energy-management-app/energy-management-common/src/device-energy-management-mode.cpp b/examples/energy-management-app/energy-management-common/device-energy-management/src/device-energy-management-mode.cpp similarity index 100% rename from examples/energy-management-app/energy-management-common/src/device-energy-management-mode.cpp rename to examples/energy-management-app/energy-management-common/device-energy-management/src/device-energy-management-mode.cpp diff --git a/examples/energy-management-app/energy-management-common/include/ChargingTargetsMemMgr.h b/examples/energy-management-app/energy-management-common/energy-evse/include/ChargingTargetsMemMgr.h similarity index 100% rename from examples/energy-management-app/energy-management-common/include/ChargingTargetsMemMgr.h rename to examples/energy-management-app/energy-management-common/energy-evse/include/ChargingTargetsMemMgr.h diff --git a/examples/energy-management-app/energy-management-common/include/EVSECallbacks.h b/examples/energy-management-app/energy-management-common/energy-evse/include/EVSECallbacks.h similarity index 100% rename from examples/energy-management-app/energy-management-common/include/EVSECallbacks.h rename to examples/energy-management-app/energy-management-common/energy-evse/include/EVSECallbacks.h diff --git a/examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h b/examples/energy-management-app/energy-management-common/energy-evse/include/EVSEManufacturerImpl.h similarity index 100% rename from examples/energy-management-app/energy-management-common/include/EVSEManufacturerImpl.h rename to examples/energy-management-app/energy-management-common/energy-evse/include/EVSEManufacturerImpl.h diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h b/examples/energy-management-app/energy-management-common/energy-evse/include/EnergyEvseDelegateImpl.h similarity index 100% rename from examples/energy-management-app/energy-management-common/include/EnergyEvseDelegateImpl.h rename to examples/energy-management-app/energy-management-common/energy-evse/include/EnergyEvseDelegateImpl.h diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseMain.h b/examples/energy-management-app/energy-management-common/energy-evse/include/EnergyEvseMain.h similarity index 100% rename from examples/energy-management-app/energy-management-common/include/EnergyEvseMain.h rename to examples/energy-management-app/energy-management-common/energy-evse/include/EnergyEvseMain.h diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h b/examples/energy-management-app/energy-management-common/energy-evse/include/EnergyEvseManager.h similarity index 100% rename from examples/energy-management-app/energy-management-common/include/EnergyEvseManager.h rename to examples/energy-management-app/energy-management-common/energy-evse/include/EnergyEvseManager.h diff --git a/examples/energy-management-app/energy-management-common/include/EnergyEvseTargetsStore.h b/examples/energy-management-app/energy-management-common/energy-evse/include/EnergyEvseTargetsStore.h similarity index 100% rename from examples/energy-management-app/energy-management-common/include/EnergyEvseTargetsStore.h rename to examples/energy-management-app/energy-management-common/energy-evse/include/EnergyEvseTargetsStore.h diff --git a/examples/energy-management-app/energy-management-common/include/EnergyTimeUtils.h b/examples/energy-management-app/energy-management-common/energy-evse/include/EnergyTimeUtils.h similarity index 100% rename from examples/energy-management-app/energy-management-common/include/EnergyTimeUtils.h rename to examples/energy-management-app/energy-management-common/energy-evse/include/EnergyTimeUtils.h diff --git a/examples/energy-management-app/energy-management-common/include/energy-evse-modes.h b/examples/energy-management-app/energy-management-common/energy-evse/include/energy-evse-modes.h similarity index 100% rename from examples/energy-management-app/energy-management-common/include/energy-evse-modes.h rename to examples/energy-management-app/energy-management-common/energy-evse/include/energy-evse-modes.h diff --git a/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp b/examples/energy-management-app/energy-management-common/energy-evse/src/ChargingTargetsMemMgr.cpp similarity index 100% rename from examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp rename to examples/energy-management-app/energy-management-common/energy-evse/src/ChargingTargetsMemMgr.cpp diff --git a/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp b/examples/energy-management-app/energy-management-common/energy-evse/src/EVSEManufacturerImpl.cpp similarity index 100% rename from examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp rename to examples/energy-management-app/energy-management-common/energy-evse/src/EVSEManufacturerImpl.cpp diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp b/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseDelegateImpl.cpp similarity index 100% rename from examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp rename to examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseDelegateImpl.cpp diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseEventTriggers.cpp b/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseEventTriggers.cpp similarity index 100% rename from examples/energy-management-app/energy-management-common/src/EnergyEvseEventTriggers.cpp rename to examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseEventTriggers.cpp diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseMain.cpp b/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseMain.cpp similarity index 100% rename from examples/energy-management-app/energy-management-common/src/EnergyEvseMain.cpp rename to examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseMain.cpp diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp b/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseManager.cpp similarity index 100% rename from examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp rename to examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseManager.cpp diff --git a/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp b/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseTargetsStore.cpp similarity index 100% rename from examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp rename to examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseTargetsStore.cpp diff --git a/examples/energy-management-app/energy-management-common/src/energy-evse-mode.cpp b/examples/energy-management-app/energy-management-common/energy-evse/src/energy-evse-mode.cpp similarity index 100% rename from examples/energy-management-app/energy-management-common/src/energy-evse-mode.cpp rename to examples/energy-management-app/energy-management-common/energy-evse/src/energy-evse-mode.cpp diff --git a/examples/energy-management-app/energy-management-common/include/ElectricalPowerMeasurementDelegate.h b/examples/energy-management-app/energy-management-common/energy-reporting/include/ElectricalPowerMeasurementDelegate.h similarity index 100% rename from examples/energy-management-app/energy-management-common/include/ElectricalPowerMeasurementDelegate.h rename to examples/energy-management-app/energy-management-common/energy-reporting/include/ElectricalPowerMeasurementDelegate.h diff --git a/examples/energy-management-app/energy-management-common/include/FakeReadings.h b/examples/energy-management-app/energy-management-common/energy-reporting/include/FakeReadings.h similarity index 100% rename from examples/energy-management-app/energy-management-common/include/FakeReadings.h rename to examples/energy-management-app/energy-management-common/energy-reporting/include/FakeReadings.h diff --git a/examples/energy-management-app/energy-management-common/include/PowerTopologyDelegate.h b/examples/energy-management-app/energy-management-common/energy-reporting/include/PowerTopologyDelegate.h similarity index 100% rename from examples/energy-management-app/energy-management-common/include/PowerTopologyDelegate.h rename to examples/energy-management-app/energy-management-common/energy-reporting/include/PowerTopologyDelegate.h diff --git a/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp b/examples/energy-management-app/energy-management-common/energy-reporting/src/ElectricalPowerMeasurementDelegate.cpp similarity index 100% rename from examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp rename to examples/energy-management-app/energy-management-common/energy-reporting/src/ElectricalPowerMeasurementDelegate.cpp diff --git a/examples/energy-management-app/energy-management-common/src/EnergyReportingEventTriggers.cpp b/examples/energy-management-app/energy-management-common/energy-reporting/src/EnergyReportingEventTriggers.cpp similarity index 100% rename from examples/energy-management-app/energy-management-common/src/EnergyReportingEventTriggers.cpp rename to examples/energy-management-app/energy-management-common/energy-reporting/src/EnergyReportingEventTriggers.cpp diff --git a/examples/energy-management-app/energy-management-common/src/FakeReadings.cpp b/examples/energy-management-app/energy-management-common/energy-reporting/src/FakeReadings.cpp similarity index 100% rename from examples/energy-management-app/energy-management-common/src/FakeReadings.cpp rename to examples/energy-management-app/energy-management-common/energy-reporting/src/FakeReadings.cpp diff --git a/examples/energy-management-app/energy-management-common/src/PowerTopologyDelegate.cpp b/examples/energy-management-app/energy-management-common/energy-reporting/src/PowerTopologyDelegate.cpp similarity index 100% rename from examples/energy-management-app/energy-management-common/src/PowerTopologyDelegate.cpp rename to examples/energy-management-app/energy-management-common/energy-reporting/src/PowerTopologyDelegate.cpp diff --git a/examples/energy-management-app/energy-management-common/tests/BUILD.gn b/examples/energy-management-app/energy-management-common/tests/BUILD.gn index b55340a527233d..c11d783194229a 100644 --- a/examples/energy-management-app/energy-management-common/tests/BUILD.gn +++ b/examples/energy-management-app/energy-management-common/tests/BUILD.gn @@ -18,7 +18,7 @@ import("//build_overrides/chip.gni") import("${chip_root}/build/chip/chip_test_suite.gni") config("tests_config") { - include_dirs = [ "${chip_root}/examples/energy-management-app/energy-management-common/include" ] + include_dirs = [ "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/include" ] } chip_test_suite("tests") { diff --git a/examples/energy-management-app/esp32/main/CMakeLists.txt b/examples/energy-management-app/esp32/main/CMakeLists.txt index cce09303b58d72..03b823462594c9 100644 --- a/examples/energy-management-app/esp32/main/CMakeLists.txt +++ b/examples/energy-management-app/esp32/main/CMakeLists.txt @@ -19,7 +19,10 @@ set(PRIV_INCLUDE_DIRS_LIST "${APP_GEN_DIR}" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/include" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/common/include" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/device-energy-management/include" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/energy-evse/include" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/energy-reporting/include" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/esp32/main/include" "${CMAKE_CURRENT_LIST_DIR}/include" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32" @@ -29,7 +32,10 @@ set(SRC_DIRS_LIST "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated/attributes" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/app-common/app-common/zap-generated" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/providers" - "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/src" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/common/src" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/device-energy-management/src" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/energy-evse/src" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/energy-management-app/energy-management-common/energy-reporting/src" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/ota" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/common" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/platform/esp32/time" diff --git a/examples/energy-management-app/linux/BUILD.gn b/examples/energy-management-app/linux/BUILD.gn index 1a6e2d287fed2e..d2633c67c82b2a 100644 --- a/examples/energy-management-app/linux/BUILD.gn +++ b/examples/energy-management-app/linux/BUILD.gn @@ -34,23 +34,23 @@ config("includes") { executable("chip-energy-management-app") { sources = [ - "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DEMTestEventTriggers.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseEventTriggers.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseMain.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyReportingEventTriggers.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/FakeReadings.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/PowerTopologyDelegate.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/device-energy-management-mode.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/energy-evse-mode.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/common/src/EnergyTimeUtils.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DEMTestEventTriggers.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/device-energy-management-mode.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/ChargingTargetsMemMgr.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EVSEManufacturerImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseEventTriggers.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseMain.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseTargetsStore.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/energy-evse-mode.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/src/ElectricalPowerMeasurementDelegate.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/src/EnergyReportingEventTriggers.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/src/FakeReadings.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/src/PowerTopologyDelegate.cpp", "include/CHIPProjectAppConfig.h", "main.cpp", ] @@ -71,7 +71,10 @@ executable("chip-energy-management-app") { include_dirs = [ "include", - "${chip_root}/examples/energy-management-app/energy-management-common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/include", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/include", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/include", ] if (chip_enable_pw_rpc) { @@ -129,13 +132,13 @@ executable("chip-energy-management-app") { source_set("test-evse-targets-store") { sources = [ - "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/ChargingTargetsMemMgr.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseTargetsStore.cpp", ] include_dirs = [ "include", - "${chip_root}/examples/energy-management-app/energy-management-common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/include", ] deps = [ diff --git a/examples/shell/shell_common/BUILD.gn b/examples/shell/shell_common/BUILD.gn index 470f81b5d2459a..e4aa2973f8cc04 100644 --- a/examples/shell/shell_common/BUILD.gn +++ b/examples/shell/shell_common/BUILD.gn @@ -70,20 +70,24 @@ static_library("shell_common") { "${chip_root}/examples/all-clusters-app/all-clusters-common/src/smco-stub.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp", "${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-temperature-levels.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/ChargingTargetsMemMgr.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/DeviceEnergyManagementManager.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EVSEManufacturerImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/ElectricalPowerMeasurementDelegate.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseDelegateImpl.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseManager.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyEvseTargetsStore.cpp", - "${chip_root}/examples/energy-management-app/energy-management-common/src/EnergyTimeUtils.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/common/src/EnergyTimeUtils.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/src/DeviceEnergyManagementManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/ChargingTargetsMemMgr.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EVSEManufacturerImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseDelegateImpl.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseManager.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/EnergyEvseTargetsStore.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/src/energy-evse-mode.cpp", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/src/ElectricalPowerMeasurementDelegate.cpp", ] include_dirs = [ "${chip_root}/examples/all-clusters-app/all-clusters-common/include", - "${chip_root}/examples/energy-management-app/energy-management-common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/common/include", + "${chip_root}/examples/energy-management-app/energy-management-common/device-energy-management/include", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-evse/include", + "${chip_root}/examples/energy-management-app/energy-management-common/energy-reporting/include", "${chip_root}/src/app/clusters/device-energy-management-server", ] From 62139bf0ab19c4c5d0b8a4d2282a6b8cf3405aac Mon Sep 17 00:00:00 2001 From: dinabenamar <108664279+dinabenamar@users.noreply.github.com> Date: Tue, 13 Aug 2024 16:01:50 +0200 Subject: [PATCH 04/59] [NXP][config] Adding CMake support to build CHIP libs for NXP FreeRTOS platforms (#34901) * [NXP][config][freertos] Adding support to build Matter lib and port files with cmake on NXP freertos platforms Signed-off-by: Dina Benamar * [NXP][config][common] Create common .cmake file to include common configs between freertos & zephyr Signed-off-by: Dina Benamar * [NXP][config][zephyr] Include common.cmake which adds common options to zephyr & freertos Signed-off-by: Dina Benamar * [NXP][config][freertos] Updates to align with new flag introduction "chip_enable_secure_whole_factory_data" Signed-off-by: Dina Benamar * [NXP][config][freertos] Set build_matter_standalone_lib to true to support building CHIP libs with CMake in matter-over-thread configuration Signed-off-by: Dina Benamar --------- Signed-off-by: Dina Benamar --- config/nxp/chip-cmake-freertos/CMakeLists.txt | 62 +++++++++++++++++ config/nxp/chip-gn-freertos/.gn | 29 ++++++++ config/nxp/chip-gn-freertos/BUILD.gn | 42 +++++++++++ config/nxp/chip-gn-freertos/args.gni | 31 +++++++++ config/nxp/chip-module/CMakeLists.txt | 42 +---------- config/nxp/cmake/common.cmake | 69 +++++++++++++++++++ 6 files changed, 234 insertions(+), 41 deletions(-) create mode 100644 config/nxp/chip-cmake-freertos/CMakeLists.txt create mode 100644 config/nxp/chip-gn-freertos/.gn create mode 100644 config/nxp/chip-gn-freertos/BUILD.gn create mode 100644 config/nxp/chip-gn-freertos/args.gni create mode 100644 config/nxp/cmake/common.cmake diff --git a/config/nxp/chip-cmake-freertos/CMakeLists.txt b/config/nxp/chip-cmake-freertos/CMakeLists.txt new file mode 100644 index 00000000000000..b639e23ff65034 --- /dev/null +++ b/config/nxp/chip-cmake-freertos/CMakeLists.txt @@ -0,0 +1,62 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +include(ExternalProject) + +if(NOT CHIP_ROOT) + get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../.. REALPATH) +endif() + +get_filename_component(GN_ROOT_TARGET ${CHIP_ROOT}/config/nxp/chip-gn-freertos REALPATH) + +include(${CHIP_ROOT}/config/nxp/cmake/common.cmake) +include(${CHIP_ROOT}/src/app/chip_data_model.cmake) + +# Prepare compiler flags +matter_add_cflags(${CMAKE_C_FLAGS}) +matter_add_cxxflags(${CMAKE_CXX_FLAGS}) + +matter_get_compiler_flags_from_targets("${CONFIG_CHIP_EXTERNAL_TARGETS}") + +# ============================================================================== +# Generate configuration for CHIP GN build system +# ============================================================================== +matter_add_gn_arg_string("nxp_nvm_component" ${CONFIG_CHIP_NVM_COMPONENT}) +matter_add_gn_arg_string("nxp_platform" ${CONFIG_CHIP_NXP_PLATFORM}) +matter_add_gn_arg("chip_with_factory_data" ${CONFIG_CHIP_FACTORY_DATA}) +matter_add_gn_arg("chip_enable_secure_dac_private_key_storage" ${CONFIG_CHIP_SECURE_DAC_PRIVATE_KEY_STORAGE}) +matter_add_gn_arg("chip_enable_secure_whole_factory_data" ${CONFIG_CHIP_ENABLE_SECURE_WHOLE_FACTORY_DATA}) + +matter_common_gn_args( + DEBUG CONFIG_DEBUG + LIB_SHELL CONFIG_CHIP_LIB_SHELL + LIB_TESTS CONFIG_CHIP_BUILD_TESTS + PROJECT_CONFIG ${CONFIG_CHIP_PROJECT_CONFIG} + PROJECT_CONFIG_INC_DIR ${CONFIG_CHIP_PROJECT_CONFIG_INCLUDE_DIRS} + DEVICE_INFO_EXAMPLE_PROVIDER CONFIG_CHIP_EXAMPLE_DEVICE_INFO_PROVIDER +) + +matter_generate_args_tmp_file() + +# ============================================================================== +# Build chip library +# ============================================================================== +matter_build(chip + LIB_SHELL ${CONFIG_CHIP_LIB_SHELL} + LIB_TESTS ${CONFIG_CHIP_BUILD_TESTS} + DEVICE_INFO_EXAMPLE_PROVIDER ${CONFIG_CHIP_EXAMPLE_DEVICE_INFO_PROVIDER} + GN_DEPENDENCIES ${CONFIG_GN_DEPENDENCIES} +) diff --git a/config/nxp/chip-gn-freertos/.gn b/config/nxp/chip-gn-freertos/.gn new file mode 100644 index 00000000000000..15dde062d89de3 --- /dev/null +++ b/config/nxp/chip-gn-freertos/.gn @@ -0,0 +1,29 @@ +# Copyright (c) 2024 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/build.gni") +import("//build_overrides/chip.gni") + +# The location of the build configuration file. +buildconfig = "//build/config/BUILDCONFIG.gn" + +# CHIP uses angle bracket includes. +check_system_includes = true + +default_args = { + target_cpu = "arm" + target_os = "freertos" + + import("${chip_root}/config/nxp/chip-gn-freertos/args.gni") +} diff --git a/config/nxp/chip-gn-freertos/BUILD.gn b/config/nxp/chip-gn-freertos/BUILD.gn new file mode 100644 index 00000000000000..3c508666c833d1 --- /dev/null +++ b/config/nxp/chip-gn-freertos/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2024 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/build.gni") +import("//build_overrides/chip.gni") + +import("${chip_root}/build/chip/tests.gni") + +assert(current_os == "freertos") + +declare_args() { + chip_build_example_providers = false + chip_enable_ethernet = false + chip_malloc_sys_heap = false +} + +group("nxp_freertos") { + deps = [ "${chip_root}/src/lib" ] + + if (chip_build_tests) { + deps += [ "${chip_root}/src:tests" ] + } + + if (chip_build_example_providers) { + deps += [ "${chip_root}/examples/providers:device_info_provider" ] + } +} + +group("default") { + deps = [ ":nxp_freertos" ] +} diff --git a/config/nxp/chip-gn-freertos/args.gni b/config/nxp/chip-gn-freertos/args.gni new file mode 100644 index 00000000000000..be31f22fcbdcf1 --- /dev/null +++ b/config/nxp/chip-gn-freertos/args.gni @@ -0,0 +1,31 @@ +# Copyright (c) 2024 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("//build_overrides/nxp_sdk.gni") + +nxp_external_sdk = true +nxp_build_matter_standalone_lib = true +chip_device_platform = "nxp" +lwip_platform = "nxp" + +# project config files +chip_device_project_config_include = "" +chip_project_config_include = "" +chip_inet_project_config_include = "" +chip_system_project_config_include = "" +chip_ble_project_config_include = "" + +# mbedtls is built as part of the NXP SDK build process +mbedtls_target = "${nxp_sdk_build_root}:nxp_mbedtls" diff --git a/config/nxp/chip-module/CMakeLists.txt b/config/nxp/chip-module/CMakeLists.txt index 6b8266970dc883..32a85a606c71e0 100644 --- a/config/nxp/chip-module/CMakeLists.txt +++ b/config/nxp/chip-module/CMakeLists.txt @@ -42,12 +42,8 @@ if (NOT CHIP_ROOT) get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../.. REALPATH) endif() get_filename_component(GN_ROOT_TARGET ${CHIP_ROOT}/config/nxp/chip-gn REALPATH) -get_filename_component(COMMON_CMAKE_SOURCE_DIR ${CHIP_ROOT}/config/common/cmake REALPATH) -# Get common Cmake sources - -include(${COMMON_CMAKE_SOURCE_DIR}/chip_gn_args.cmake) -include(${COMMON_CMAKE_SOURCE_DIR}/chip_gn.cmake) +include(${CHIP_ROOT}/config/nxp/cmake/common.cmake) # Prepare compiler flags if (CHIP_CFLAGS) @@ -109,30 +105,6 @@ matter_common_gn_args( matter_add_gn_arg_string("zephyr_ar" ${CMAKE_AR}) matter_add_gn_arg_string("zephyr_cc" ${CMAKE_C_COMPILER}) matter_add_gn_arg_string("zephyr_cxx" ${CMAKE_CXX_COMPILER}) -matter_add_gn_arg_bool ("chip_logging" CONFIG_LOG) -matter_add_gn_arg_bool ("chip_enable_openthread" CONFIG_NET_L2_OPENTHREAD) -matter_add_gn_arg_bool ("chip_openthread_ftd" CONFIG_OPENTHREAD_FTD) -matter_add_gn_arg_bool ("chip_config_network_layer_ble" CONFIG_BT) -matter_add_gn_arg_bool ("chip_inet_config_enable_ipv4" CONFIG_CHIP_IPV4) -matter_add_gn_arg_bool ("chip_persist_subscriptions" CONFIG_CHIP_PERSISTENT_SUBSCRIPTIONS) -matter_add_gn_arg_bool ("chip_monolithic_tests" CONFIG_CHIP_BUILD_TESTS) -matter_add_gn_arg_bool ("chip_inet_config_enable_tcp_endpoint" CONFIG_CHIP_BUILD_TESTS) -matter_add_gn_arg_bool ("chip_error_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 1) -matter_add_gn_arg_bool ("chip_progress_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 3) -matter_add_gn_arg_bool ("chip_detail_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 4) -matter_add_gn_arg_bool ("chip_automation_logging" FALSE) -matter_add_gn_arg_bool ("chip_malloc_sys_heap" CONFIG_CHIP_MALLOC_SYS_HEAP) -matter_add_gn_arg_bool ("chip_enable_wifi" CONFIG_CHIP_WIFI) -matter_add_gn_arg_bool ("chip_system_config_provide_statistics" CONFIG_CHIP_STATISTICS) -matter_add_gn_arg_bool ("chip_enable_icd_server" CONFIG_CHIP_ENABLE_ICD_SUPPORT) -matter_add_gn_arg_bool ("enable_eventlist_attribute" TRUE) -matter_add_gn_arg_bool ("chip_enable_ota_requestor" CONFIG_CHIP_OTA_REQUESTOR) - -if(CONFIG_DEBUG) - matter_add_gn_arg_bool("optimize_debug" true) - matter_add_gn_arg_string("optimize_debug_level" "0") - matter_add_gn_arg_string("symbol_level" "2") -endif() if (CONFIG_CHIP_FACTORY_DATA) matter_add_gn_arg_bool("chip_use_transitional_commissionable_data_provider" FALSE) @@ -141,11 +113,6 @@ elseif (CONFIG_CHIP_FACTORY_DATA_CUSTOM_BACKEND) matter_add_gn_arg_bool("chip_use_transitional_commissionable_data_provider" FALSE) endif() -if (CONFIG_CHIP_ROTATING_DEVICE_ID) - matter_add_gn_arg_bool("chip_enable_rotating_device_id" TRUE) - matter_add_gn_arg_bool("chip_enable_additional_data_advertising" TRUE) -endif() - if (CONFIG_NET_L2_OPENTHREAD) matter_add_gn_arg_string("chip_mdns" "platform") elseif(CONFIG_WIFI_NXP) @@ -154,9 +121,6 @@ else() matter_add_gn_arg_string("chip_mdns" "none") endif() -if (CONFIG_CHIP_CRYPTO_PSA) - matter_add_gn_arg_string("chip_crypto" "psa") -endif() # if (BOARD STREQUAL "native_posix") # matter_add_gn_arg_string("target_cpu" "x86") @@ -164,10 +128,6 @@ endif() # matter_add_gn_arg_string("target_cpu" "x64") # endif() -if (NOT CONFIG_CHIP_DEBUG_SYMBOLS) - matter_add_gn_arg_string("symbol_level" "0") -endif() - # if (CHIP_COMPILER_LAUNCHER) # matter_add_gn_arg_string("pw_command_launcher" ${CHIP_COMPILER_LAUNCHER}) # endif() diff --git a/config/nxp/cmake/common.cmake b/config/nxp/cmake/common.cmake new file mode 100644 index 00000000000000..8b0f379f502d09 --- /dev/null +++ b/config/nxp/cmake/common.cmake @@ -0,0 +1,69 @@ +# +# Copyright (c) 2024 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. +# + +# +# @file +# CMake for CHIP library configuration common to NXP platforms +# + +include(${CHIP_ROOT}/config/nxp/chip-module/generate_factory_data.cmake) + +get_filename_component(COMMON_CMAKE_SOURCE_DIR ${CHIP_ROOT}/config/common/cmake REALPATH) + +# Get common Cmake sources +include(${COMMON_CMAKE_SOURCE_DIR}/chip_gn_args.cmake) +include(${COMMON_CMAKE_SOURCE_DIR}/chip_gn.cmake) + +# ============================================================================== +# Generate configuration for CHIP GN build system +# ============================================================================== +matter_add_gn_arg_bool ("chip_logging" CONFIG_LOG) +matter_add_gn_arg_bool ("chip_enable_openthread" CONFIG_NET_L2_OPENTHREAD) +matter_add_gn_arg_bool ("chip_openthread_ftd" CONFIG_OPENTHREAD_FTD) +matter_add_gn_arg_bool ("chip_config_network_layer_ble" CONFIG_BT) +matter_add_gn_arg_bool ("chip_inet_config_enable_ipv4" CONFIG_CHIP_IPV4) +matter_add_gn_arg_bool ("chip_persist_subscriptions" CONFIG_CHIP_PERSISTENT_SUBSCRIPTIONS) +matter_add_gn_arg_bool ("chip_monolithic_tests" CONFIG_CHIP_BUILD_TESTS) +matter_add_gn_arg_bool ("chip_inet_config_enable_tcp_endpoint" CONFIG_CHIP_BUILD_TESTS) +matter_add_gn_arg_bool ("chip_error_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 1) +matter_add_gn_arg_bool ("chip_progress_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 3) +matter_add_gn_arg_bool ("chip_detail_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 4) +matter_add_gn_arg_bool ("chip_automation_logging" FALSE) +matter_add_gn_arg_bool ("chip_malloc_sys_heap" CONFIG_CHIP_MALLOC_SYS_HEAP) +matter_add_gn_arg_bool ("chip_enable_wifi" CONFIG_CHIP_WIFI) +matter_add_gn_arg_bool ("chip_system_config_provide_statistics" CONFIG_CHIP_STATISTICS) +matter_add_gn_arg_bool ("chip_enable_icd_server" CONFIG_CHIP_ENABLE_ICD_SUPPORT) +matter_add_gn_arg_bool ("enable_eventlist_attribute" TRUE) +matter_add_gn_arg_bool ("chip_enable_ota_requestor" CONFIG_CHIP_OTA_REQUESTOR) + +if(CONFIG_DEBUG) + matter_add_gn_arg_bool("optimize_debug" true) + matter_add_gn_arg_string("optimize_debug_level" "0") + matter_add_gn_arg_string("symbol_level" "2") +endif() + +if (CONFIG_CHIP_ROTATING_DEVICE_ID) + matter_add_gn_arg_bool("chip_enable_rotating_device_id" TRUE) + matter_add_gn_arg_bool("chip_enable_additional_data_advertising" TRUE) +endif() + +if (CONFIG_CHIP_CRYPTO_PSA) + matter_add_gn_arg_string("chip_crypto" "psa") +endif() + +if (NOT CONFIG_CHIP_DEBUG_SYMBOLS) + matter_add_gn_arg_string("symbol_level" "0") +endif() From f485e4acb75e048b78aeda92b556927abb5a9ef1 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Tue, 13 Aug 2024 09:03:41 -0700 Subject: [PATCH 05/59] [chip-tool] Adjust the maximum value of 'discriminator' to align with spec (#34940) --- .../chip-tool/commands/pairing/OpenCommissioningWindowCommand.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.h b/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.h index 3a199745601c93..9da6e937ee5e2b 100644 --- a/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.h +++ b/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.h @@ -38,7 +38,7 @@ class OpenCommissioningWindowCommand : public CHIPCommand "Time, in seconds, before the commissioning window closes."); AddArgument("iteration", chip::Crypto::kSpake2p_Min_PBKDF_Iterations, chip::Crypto::kSpake2p_Max_PBKDF_Iterations, &mIteration, "Number of PBKDF iterations to use to derive the verifier. Ignored if 'option' is 0."); - AddArgument("discriminator", 0, 4096, &mDiscriminator, "Discriminator to use for advertising. Ignored if 'option' is 0."); + AddArgument("discriminator", 0, 4095, &mDiscriminator, "Discriminator to use for advertising. Ignored if 'option' is 0."); AddArgument("timeout", 0, UINT16_MAX, &mTimeout, "Time, in seconds, before this command is considered to have timed out."); } From b1e41b9db649537f09238ee61497953e488c18b7 Mon Sep 17 00:00:00 2001 From: andrei-menzopol <96489227+andrei-menzopol@users.noreply.github.com> Date: Tue, 13 Aug 2024 21:49:24 +0300 Subject: [PATCH 06/59] [examples][lock-common] Remove iostream include (#34952) * iostream adds a lot of unnecessary functions when lock-app is compiled for non-linux platforms, increasing ram and flash consumption. * linux lock-app compiles without it Signed-off-by: Andrei Menzopol --- examples/lock-app/lock-common/src/LockManager.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/lock-app/lock-common/src/LockManager.cpp b/examples/lock-app/lock-common/src/LockManager.cpp index 8af66051883aa4..cb7011899c9487 100644 --- a/examples/lock-app/lock-common/src/LockManager.cpp +++ b/examples/lock-app/lock-common/src/LockManager.cpp @@ -18,7 +18,6 @@ #include "LockManager.h" -#include #include #include From 4e30ae817e3f92e4dcaf6a9cf1a94b9d52198c99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Tomkiel?= Date: Tue, 13 Aug 2024 20:52:22 +0200 Subject: [PATCH 07/59] Fixed devcontainer creation for huge user ids (#34948) --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 4c8a11fd42f7f1..da4e2c4171171e 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -43,7 +43,7 @@ RUN apt-get update \ && : RUN groupadd -g $USER_GID $USERNAME \ - && useradd -s /bin/bash -u $USER_UID -g $USER_GID -G docker,sudo -m $USERNAME \ + && useradd --no-log-init -s /bin/bash -u $USER_UID -g $USER_GID -G docker,sudo -m $USERNAME \ && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ && chmod 0440 /etc/sudoers.d/$USERNAME \ && : From 1d2ddd4131f3b6a10092d93a74ea58f0fe09510b Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Tue, 13 Aug 2024 11:58:06 -0700 Subject: [PATCH 08/59] Enabling this for macOS Catalyst apps (#34956) --- src/darwin/Framework/Matter.xcodeproj/project.pbxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index 10884a64f4ffe4..bb5a8ce1801631 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -2319,6 +2319,7 @@ INSTALLHDRS_SCRIPT_PHASE = YES; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IS_ZIPPERED = YES; LIBRARY_SEARCH_PATHS = "$(TEMP_DIR)/out/lib"; OTHER_CFLAGS = "-fmacro-prefix-map=$(SRCROOT)/CHIP/="; OTHER_CPLUSPLUSFLAGS = ( @@ -2488,6 +2489,7 @@ INSTALLHDRS_SCRIPT_PHASE = YES; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 14.0; + IS_ZIPPERED = YES; LIBRARY_SEARCH_PATHS = "$(TEMP_DIR)/out/lib"; OTHER_CFLAGS = "-fmacro-prefix-map=$(SRCROOT)/CHIP/="; OTHER_CPLUSPLUSFLAGS = ( From 3884820327714eb16396da7e837b66a162375646 Mon Sep 17 00:00:00 2001 From: Martin Girardot <165289184+Martin-NXP@users.noreply.github.com> Date: Tue, 13 Aug 2024 21:21:14 +0200 Subject: [PATCH 09/59] Add new common NXP dockerfile (#34947) * [NXP][docker image] Add new common NXP docker image for next SDK version Signed-off-by: Martin Girardot * [NXP][docker image] remove k32w1 SDK clone as it will use common NXP SDK Signed-off-by: Martin Girardot --------- Signed-off-by: Martin Girardot --- .../docker/images/base/chip-build/version | 2 +- .../images/stage-2/chip-build-k32w/Dockerfile | 9 -------- .../images/stage-2/chip-build-nxp/Dockerfile | 23 +++++++++++++++++++ .../images/stage-2/chip-build-nxp/build.sh | 1 + .../images/stage-2/chip-build-nxp/run.sh | 1 + .../images/stage-2/chip-build-nxp/version | 1 + .../vscode/chip-build-vscode/Dockerfile | 4 ++++ 7 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 integrations/docker/images/stage-2/chip-build-nxp/Dockerfile create mode 120000 integrations/docker/images/stage-2/chip-build-nxp/build.sh create mode 120000 integrations/docker/images/stage-2/chip-build-nxp/run.sh create mode 120000 integrations/docker/images/stage-2/chip-build-nxp/version diff --git a/integrations/docker/images/base/chip-build/version b/integrations/docker/images/base/chip-build/version index 0d78b8e5f73090..5b9870bc97994b 100644 --- a/integrations/docker/images/base/chip-build/version +++ b/integrations/docker/images/base/chip-build/version @@ -1 +1 @@ -70 : [NXP] Update k32w1 SDK +71 : [NXP] Update k32w1 SDK as it will use common NXP SDK diff --git a/integrations/docker/images/stage-2/chip-build-k32w/Dockerfile b/integrations/docker/images/stage-2/chip-build-k32w/Dockerfile index 9b222355fb51e0..c4cf71927d59fe 100644 --- a/integrations/docker/images/stage-2/chip-build-k32w/Dockerfile +++ b/integrations/docker/images/stage-2/chip-build-k32w/Dockerfile @@ -26,17 +26,8 @@ RUN set -x \ && cp -R examples/* core/boards && rm -rf examples \ && : # last line -WORKDIR /opt/k32w1_sdk - -RUN set -x \ - && west init -m https://github.com/nxp-mcuxpresso/mcux-sdk --mr "MCUX_2.16.000" \ - && west update -o=--depth=1 -n -f smart \ - && : # last line - FROM ghcr.io/project-chip/chip-build:${VERSION} COPY --from=build /opt/sdk/ /opt/sdk/ -COPY --from=build /opt/k32w1_sdk/ /opt/k32w1_sdk/ ENV NXP_K32W0_SDK_ROOT=/opt/sdk/core -ENV NXP_SDK_ROOT=/opt/k32w1_sdk diff --git a/integrations/docker/images/stage-2/chip-build-nxp/Dockerfile b/integrations/docker/images/stage-2/chip-build-nxp/Dockerfile new file mode 100644 index 00000000000000..537919fb77bc21 --- /dev/null +++ b/integrations/docker/images/stage-2/chip-build-nxp/Dockerfile @@ -0,0 +1,23 @@ +ARG VERSION=1 +FROM ghcr.io/project-chip/chip-build:${VERSION} AS build +LABEL org.opencontainers.image.source=https://github.com/project-chip/connectedhomeip + +RUN set -x \ + && apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -fy --no-install-recommends \ + xz-utils \ + && : # last line + +WORKDIR /opt/nxp/ + +RUN set -x \ + && git clone --branch v1.4.0-pvw1 https://github.com/NXP/nxp_matter_support.git \ + && pip3 install --break-system-packages -U --no-cache-dir west \ + && ./nxp_matter_support/scripts/update_nxp_sdk.py --platform common \ + && : # last line + +FROM ghcr.io/project-chip/chip-build:${VERSION} + +COPY --from=build /opt/nxp/ /opt/nxp/ + +ENV NXP_UPDATE_SDK_SCRIPT_DOCKER=/opt/nxp/nxp_matter_support/scripts/update_nxp_sdk.py diff --git a/integrations/docker/images/stage-2/chip-build-nxp/build.sh b/integrations/docker/images/stage-2/chip-build-nxp/build.sh new file mode 120000 index 00000000000000..46b20313461454 --- /dev/null +++ b/integrations/docker/images/stage-2/chip-build-nxp/build.sh @@ -0,0 +1 @@ +../../../build.sh \ No newline at end of file diff --git a/integrations/docker/images/stage-2/chip-build-nxp/run.sh b/integrations/docker/images/stage-2/chip-build-nxp/run.sh new file mode 120000 index 00000000000000..9bbfad86d46e50 --- /dev/null +++ b/integrations/docker/images/stage-2/chip-build-nxp/run.sh @@ -0,0 +1 @@ +../../../run.sh \ No newline at end of file diff --git a/integrations/docker/images/stage-2/chip-build-nxp/version b/integrations/docker/images/stage-2/chip-build-nxp/version new file mode 120000 index 00000000000000..a40ba48b0188a8 --- /dev/null +++ b/integrations/docker/images/stage-2/chip-build-nxp/version @@ -0,0 +1 @@ +../../base/chip-build/version \ No newline at end of file diff --git a/integrations/docker/images/vscode/chip-build-vscode/Dockerfile b/integrations/docker/images/vscode/chip-build-vscode/Dockerfile index 4dda050b9c496a..9d6e24b1d259ea 100644 --- a/integrations/docker/images/vscode/chip-build-vscode/Dockerfile +++ b/integrations/docker/images/vscode/chip-build-vscode/Dockerfile @@ -11,6 +11,7 @@ FROM ghcr.io/project-chip/chip-build-crosscompile:${VERSION} AS crosscompile FROM ghcr.io/project-chip/chip-build-ameba:${VERSION} AS ameba FROM ghcr.io/project-chip/chip-build-k32w:${VERSION} AS k32w FROM ghcr.io/project-chip/chip-build-rw61x:${VERSION} AS rw61x +FROM ghcr.io/project-chip/chip-build-nxp:${VERSION} AS nxp FROM ghcr.io/project-chip/chip-build-nxp-zephyr:${VERSION} AS nxpzephyr FROM ghcr.io/project-chip/chip-build-imx:${VERSION} AS imx FROM ghcr.io/project-chip/chip-build-ti:${VERSION} AS ti @@ -51,6 +52,8 @@ COPY --from=k32w /opt/sdk /opt/k32w COPY --from=rw61x /opt/sdk /opt/nxp-sdk +COPY --from=nxp /opt/nxp /opt/nxp + COPY --from=nxpzephyr /opt/nxp-zephyr/zephyr-sdk-0.16.5/ /opt/nxp-zephyr/zephyr-sdk-0.16.5/ COPY --from=nxpzephyr /opt/nxp-zephyr/zephyrproject/ /opt/nxp-zephyr/zephyrproject/ @@ -139,6 +142,7 @@ ENV ZEPHYR_SDK_INSTALL_DIR=/opt/NordicSemiconductor/nRF5_tools/zephyr-sdk-0.16.5 ENV ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb ENV ZEPHYR_NXP_BASE=/opt/nxp-zephyr/zephyrproject/zephyr ENV ZEPHYR_NXP_SDK_INSTALL_DIR=/opt/nxp-zephyr/zephyr-sdk-0.16.5 +ENV NXP_UPDATE_SDK_SCRIPT_DOCKER=/opt/nxp/nxp_matter_support/scripts/update_nxp_sdk.py ENV TIZEN_VERSION 7.0 ENV TIZEN_SDK_ROOT /opt/tizen-sdk From 74b8ce19ade75de7f6562d70f375a47024b40e0e Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 13 Aug 2024 15:22:57 -0400 Subject: [PATCH 10/59] Use timedInteraction for RevokeCommissioning in CCTRL_2_2 (#34957) Co-authored-by: Andrei Litvin --- src/python_testing/TC_CCTRL_2_2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_testing/TC_CCTRL_2_2.py b/src/python_testing/TC_CCTRL_2_2.py index 8e1c8c5adb43a8..18416d4c291ec1 100644 --- a/src/python_testing/TC_CCTRL_2_2.py +++ b/src/python_testing/TC_CCTRL_2_2.py @@ -161,7 +161,7 @@ async def test_TC_CCTRL_2_2(self): self.step(9) cmd = Clusters.AdministratorCommissioning.Commands.RevokeCommissioning() # If no exception is raised, this is success - await self.send_single_cmd(cmd) + await self.send_single_cmd(cmd, timedRequestTimeoutMs=5000) self.step(10) if not events: From 128c37afaa94643ba7c7d992d7d48dd350902a65 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Tue, 13 Aug 2024 12:34:30 -0700 Subject: [PATCH 11/59] [Fabric-Admin] Fix 'fabricsync sync-device' command always fails (#34938) * [Fabric-Admin] Fix 'fabricsync sync-device' command always fails * Use default random salt * Update examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.h Co-authored-by: Abdul Samad * Address review comments --------- Co-authored-by: Abdul Samad --- examples/fabric-admin/commands/common/CHIPCommand.h | 2 +- .../commands/fabric-sync/FabricSyncCommand.cpp | 2 ++ .../pairing/OpenCommissioningWindowCommand.cpp | 1 + .../pairing/OpenCommissioningWindowCommand.h | 4 +++- .../fabric-admin/device_manager/DeviceManager.cpp | 13 +++++++++---- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/examples/fabric-admin/commands/common/CHIPCommand.h b/examples/fabric-admin/commands/common/CHIPCommand.h index a02adbfbb594e5..6711b3e4f9aa3d 100644 --- a/examples/fabric-admin/commands/common/CHIPCommand.h +++ b/examples/fabric-admin/commands/common/CHIPCommand.h @@ -51,7 +51,7 @@ inline constexpr char kIdentityGamma[] = "gamma"; // (CASE) communcation. inline constexpr char kIdentityNull[] = "null-fabric-commissioner"; -constexpr uint16_t kMaxCommandSize = 128; +constexpr uint16_t kMaxCommandSize = 384; class CHIPCommand : public Command { diff --git a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp index efb7cfd222827c..dade5932fba758 100644 --- a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp +++ b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp @@ -163,6 +163,8 @@ CHIP_ERROR FabricSyncRemoveBridgeCommand::RunCommand() void FabricSyncDeviceCommand::OnCommissioningWindowOpened(NodeId deviceId, CHIP_ERROR err, chip::SetupPayload payload) { + ChipLogProgress(NotSpecified, "FabricSyncDeviceCommand::OnCommissioningWindowOpened"); + if (err == CHIP_NO_ERROR) { char payloadBuffer[kMaxManaulCodeLength + 1]; diff --git a/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.cpp b/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.cpp index b2d811fdc8b114..53073160108036 100644 --- a/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.cpp +++ b/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.cpp @@ -55,6 +55,7 @@ CHIP_ERROR OpenCommissioningWindowCommand::RunCommand() .SetTimeout(mCommissioningWindowTimeout) .SetIteration(mIteration) .SetDiscriminator(mDiscriminator) + .SetSetupPIN(mSetupPIN) .SetSalt(mSalt) .SetReadVIDPIDAttributes(true) .SetCallback(&mOnOpenCommissioningWindowCallback), diff --git a/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.h b/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.h index 09788507210aaf..7edcdba7115665 100644 --- a/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.h +++ b/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.h @@ -46,8 +46,9 @@ class OpenCommissioningWindowCommand : public CHIPCommand "Time, in seconds, before the commissioning window closes."); AddArgument("iteration", chip::Crypto::kSpake2p_Min_PBKDF_Iterations, chip::Crypto::kSpake2p_Max_PBKDF_Iterations, &mIteration, "Number of PBKDF iterations to use to derive the verifier. Ignored if 'option' is 0."); - AddArgument("discriminator", 0, 4096, &mDiscriminator, "Discriminator to use for advertising. Ignored if 'option' is 0."); + AddArgument("discriminator", 0, 4095, &mDiscriminator, "Discriminator to use for advertising. Ignored if 'option' is 0."); AddArgument("timeout", 0, UINT16_MAX, &mTimeout, "Time, in seconds, before this command is considered to have timed out."); + AddArgument("setup-pin", 1, chip::kSetupPINCodeMaximumValue, &mSetupPIN, "The setup PIN (Passcode) to use."); AddArgument("salt", &mSalt, "Salt payload encoded in hexadecimal. Random salt will be generated if absent. " "This needs to be present if verifier is provided, corresponding to salt used for generating verifier"); @@ -76,6 +77,7 @@ class OpenCommissioningWindowCommand : public CHIPCommand uint16_t mDiscriminator; chip::Optional mTimeout; + chip::Optional mSetupPIN; chip::Optional mSalt; chip::Optional mVerifier; diff --git a/examples/fabric-admin/device_manager/DeviceManager.cpp b/examples/fabric-admin/device_manager/DeviceManager.cpp index aea9722bc8fa27..4207378670f44e 100644 --- a/examples/fabric-admin/device_manager/DeviceManager.cpp +++ b/examples/fabric-admin/device_manager/DeviceManager.cpp @@ -33,12 +33,12 @@ namespace { // Constants constexpr uint32_t kSetupPinCode = 20202021; constexpr uint16_t kRemoteBridgePort = 5540; -constexpr uint16_t kDiscriminator = 3840; constexpr uint16_t kWindowTimeout = 300; constexpr uint16_t kIteration = 1000; constexpr uint16_t kSubscribeMinInterval = 0; constexpr uint16_t kSubscribeMaxInterval = 60; constexpr uint16_t kAggragatorEndpointId = 1; +constexpr uint16_t kMaxDiscriminatorLength = 4095; constexpr uint8_t kEnhancedCommissioningMethod = 1; } // namespace @@ -118,7 +118,7 @@ void DeviceManager::OpenDeviceCommissioningWindow(NodeId nodeId, uint32_t commis uint32_t discriminator, const char * saltHex, const char * verifierHex) { // Open the commissioning window of a device within its own fabric. - StringBuilder<512> commandBuilder; + StringBuilder commandBuilder; commandBuilder.Add("pairing open-commissioning-window "); commandBuilder.AddFormat("%lu %d %d %d %d %d --salt hex:%s --verifier hex:%s", nodeId, kRootEndpointId, @@ -132,11 +132,16 @@ void DeviceManager::OpenRemoteDeviceCommissioningWindow(EndpointId remoteEndpoin // Open the commissioning window of a device from another fabric via its fabric bridge. // This method constructs and sends a command to open the commissioning window for a device // that is part of a different fabric, accessed through a fabric bridge. - StringBuilder commandBuilder; + StringBuilder<512> commandBuilder; + + // Use random discriminator to have less chance of collission. + uint16_t discriminator = + Crypto::GetRandU16() % (kMaxDiscriminatorLength + 1); // Include the upper limit kMaxDiscriminatorLength commandBuilder.Add("pairing open-commissioning-window "); commandBuilder.AddFormat("%lu %d %d %d %d %d", mRemoteBridgeNodeId, remoteEndpointId, kEnhancedCommissioningMethod, - kWindowTimeout, kIteration, kDiscriminator); + kWindowTimeout, kIteration, discriminator); + commandBuilder.Add(" --setup-pin 20202021"); PushCommand(commandBuilder.c_str()); } From 6165b62d5b103bf84dcd46baf4eb5130e3d16f03 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 14 Aug 2024 00:51:38 -0400 Subject: [PATCH 12/59] Fix user_params usage (#34964) --- src/python_testing/TC_MCORE_FS_1_1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_testing/TC_MCORE_FS_1_1.py b/src/python_testing/TC_MCORE_FS_1_1.py index 629dae67fc6d3e..b72039834cc260 100755 --- a/src/python_testing/TC_MCORE_FS_1_1.py +++ b/src/python_testing/TC_MCORE_FS_1_1.py @@ -37,7 +37,7 @@ class TC_MCORE_FS_1_1(MatterBaseTest): async def setup_class(self): super().setup_class() # TODO: confirm whether we can open processes like this on the TH - app = self.matter_test_config.user_params.get("th_server_app_path", None) + app = self.user_params.get("th_server_app_path", None) if not app: asserts.fail('This test requires a TH_SERVER app. Specify app path with --string-arg th_server_app_path:') From 5e8a9ec562c986edd9b71062707c1cc2a89ea3ec Mon Sep 17 00:00:00 2001 From: shripad621git <79364691+shripad621git@users.noreply.github.com> Date: Wed, 14 Aug 2024 11:07:14 +0530 Subject: [PATCH 13/59] Fixed the discovery mode in esp32 factory script to a bitmap value instead of enum (#34900) --- scripts/tools/generate_esp32_chip_factory_bin.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/tools/generate_esp32_chip_factory_bin.py b/scripts/tools/generate_esp32_chip_factory_bin.py index b19748ca31b197..892f0609927cd2 100755 --- a/scripts/tools/generate_esp32_chip_factory_bin.py +++ b/scripts/tools/generate_esp32_chip_factory_bin.py @@ -276,6 +276,7 @@ def validate_args(args): check_int_range(args.product_id, 0x0000, 0xFFFF, 'Product id') check_int_range(args.vendor_id, 0x0000, 0xFFFF, 'Vendor id') check_int_range(args.hw_ver, 0x0000, 0xFFFF, 'Hardware version') + check_int_range(args.discovery_mode, 0b000, 0b111, 'Discovery-Mode') check_str_range(args.serial_num, 1, 32, 'Serial number') check_str_range(args.vendor_name, 1, 32, 'Vendor name') @@ -566,9 +567,10 @@ def any_base_int(s): return int(s, 0) parser.add_argument('-cf', '--commissioning-flow', type=any_base_int, default=0, help='Device commissioning flow, 0:Standard, 1:User-Intent, 2:Custom. \ Default is 0.', choices=[0, 1, 2]) - parser.add_argument('-dm', '--discovery-mode', type=any_base_int, default=1, - help='Commissionable device discovery networking technology. \ - 0:WiFi-SoftAP, 1:BLE, 2:On-network. Default is BLE.', choices=[0, 1, 2]) + parser.add_argument('-dm', '--discovery-mode', type=any_base_int, default=2, + help='3-bit bitmap representing discovery modes for commissionable device discovery \ + Bit 0:WiFi-SoftAP, Bit 1:BLE, Bit 2:On-network. Default is BLE. Specify values between 0-7') + parser.set_defaults(generate_bin=True) return parser.parse_args() From 0ea43c9bcd2d662245b46b7d662d15261fdfa4ca Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 14 Aug 2024 02:39:34 -0400 Subject: [PATCH 14/59] Fix typo in wait_for_user_input (#34965) --- src/python_testing/TC_CCTRL_2_2.py | 4 ++-- src/python_testing/TC_MCORE_FS_1_1.py | 2 +- src/python_testing/TC_MCORE_FS_1_2.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/python_testing/TC_CCTRL_2_2.py b/src/python_testing/TC_CCTRL_2_2.py index 18416d4c291ec1..a2d209f0545400 100644 --- a/src/python_testing/TC_CCTRL_2_2.py +++ b/src/python_testing/TC_CCTRL_2_2.py @@ -182,7 +182,7 @@ async def test_TC_CCTRL_2_2(self): self.step(12) if not self.is_ci: - self.wait_for_use_input("Approve Commissioning approval request using manufacturer specified mechanism") + self.wait_for_user_input("Approve Commissioning approval request using manufacturer specified mechanism") self.step(13) if not events: @@ -257,7 +257,7 @@ async def test_TC_CCTRL_2_2(self): self.step(23) if not self.is_ci: - self.wait_for_use_input("Approve Commissioning approval request using manufacturer specified mechanism") + self.wait_for_user_input("Approve Commissioning approval request using manufacturer specified mechanism") self.step(24) events = new_event diff --git a/src/python_testing/TC_MCORE_FS_1_1.py b/src/python_testing/TC_MCORE_FS_1_1.py index b72039834cc260..50f4dc55c7399b 100755 --- a/src/python_testing/TC_MCORE_FS_1_1.py +++ b/src/python_testing/TC_MCORE_FS_1_1.py @@ -102,7 +102,7 @@ async def test_TC_MCORE_FS_1_1(self): await self.send_single_cmd(cmd, endpoint=dut_commissioning_control_endpoint) if not self.is_ci: - self.wait_for_use_input("Approve Commissioning approval request on DUT using manufacturer specified mechanism") + self.wait_for_user_input("Approve Commissioning approval request on DUT using manufacturer specified mechanism") if not events: new_event = await self.default_controller.ReadEvent(nodeid=self.dut_node_id, events=event_path) diff --git a/src/python_testing/TC_MCORE_FS_1_2.py b/src/python_testing/TC_MCORE_FS_1_2.py index 0af8cbedb30345..1085b0fac0a07c 100644 --- a/src/python_testing/TC_MCORE_FS_1_2.py +++ b/src/python_testing/TC_MCORE_FS_1_2.py @@ -118,7 +118,7 @@ async def test_TC_MCORE_FS_1_2(self): self.step(4) if not self.is_ci: - self.wait_for_use_input( + self.wait_for_user_input( "Commission TH_SED_DUT onto DUT_FSA’s fabric using the manufacturer specified mechanism. (ensure Synchronization is enabled.)") else: logging.info("Stopping after step 3 while running in CI to avoid manual steps.") From 927f99a2a2629078187d6d4f1500f664293feae0 Mon Sep 17 00:00:00 2001 From: Stefan Bauer-Schwan <62264998+bauerschwan@users.noreply.github.com> Date: Wed, 14 Aug 2024 13:36:44 +0200 Subject: [PATCH 15/59] Remove wrong dependency to attribute id 82 (#34975) This was a left-over attribute id before a spec change where attributes got removed. After that the attribute id 82dec is SetpointHoldExpiryTimestamp which has nothing to do with Presets --- src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml b/src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml index 789f477667010b..194babe282315b 100644 --- a/src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml @@ -575,7 +575,7 @@ tests: response: constraints: type: list - contains: [72, 74, 78, 80, 82] + contains: [72, 74, 78, 80] - label: "Step 5: TH reads EventList attribute from the DUT." PICS: PICS_EVENT_LIST_ENABLED From 6ed81117bce8f4563242f635413e8ab5c7a4e291 Mon Sep 17 00:00:00 2001 From: Amine Alami <43780877+Alami-Amine@users.noreply.github.com> Date: Wed, 14 Aug 2024 16:10:02 +0200 Subject: [PATCH 16/59] replacing "stringcase" python package with internal implementation + generated java and kotlin code (#34949) * changing matter_idl functions * changing yaml runner functions * removing stringcase from config and requirement files * restyle * improve string handling * fixing generated java and kotlin code * regenerate idl golden image for test_generators.py * adding unit test * restyle * adding unit test to build.GN --- .../stage-2/chip-build-efr32/requirements.txt | 1 - scripts/py_matter_idl/BUILD.gn | 1 + .../matter_idl/generators/filters.py | 83 +- .../matter_idl/generators/java/__init__.py | 14 +- .../matter_idl/generators/kotlin/__init__.py | 14 +- .../matter_idl/test_case_conversion.py | 61 ++ .../several_clusters/java/ChipStructs.java | 18 +- .../SecondClusterFabricDescriptorStruct.kt | 18 +- scripts/py_matter_idl/setup.cfg | 1 - scripts/setup/constraints.txt | 2 - scripts/setup/requirements.build.txt | 1 - .../chip/devicecontroller/ChipClusters.java | 798 +++++++++--------- .../devicecontroller/ChipEventStructs.java | 126 +-- .../chip/devicecontroller/ChipStructs.java | 270 +++--- ...olClusterAccessControlEntryChangedEvent.kt | 20 +- ...usterAccessControlExtensionChangedEvent.kt | 20 +- ...usterFabricRestrictionReviewUpdateEvent.kt | 10 +- .../ActionsClusterActionFailedEvent.kt | 12 +- .../ActionsClusterStateChangedEvent.kt | 12 +- ...lusterLoadControlEventStatusChangeEvent.kt | 6 +- .../EnergyEvseClusterEVConnectedEvent.kt | 6 +- .../EnergyEvseClusterEVNotDetectedEvent.kt | 6 +- ...gyEvseClusterEnergyTransferStartedEvent.kt | 6 +- ...gyEvseClusterEnergyTransferStoppedEvent.kt | 6 +- .../EnergyEvseClusterFaultEvent.kt | 10 +- .../MessagesClusterMessageCompleteEvent.kt | 18 +- .../MessagesClusterMessagePresentedEvent.kt | 6 +- .../MessagesClusterMessageQueuedEvent.kt | 6 +- ...dateRequestorClusterVersionAppliedEvent.kt | 6 +- ...imeSynchronizationClusterDSTStatusEvent.kt | 6 +- .../structs/ActionsClusterActionStruct.kt | 12 +- .../ActionsClusterEndpointListStruct.kt | 6 +- ...pplicationBasicClusterApplicationStruct.kt | 12 +- ...icationLauncherClusterApplicationStruct.kt | 12 +- .../structs/ChannelClusterProgramStruct.kt | 8 +- .../ContentLauncherClusterParameterStruct.kt | 8 +- ...ntLauncherClusterStyleInformationStruct.kt | 8 +- ...oadControlClusterLoadControlEventStruct.kt | 16 +- ...dControlClusterLoadControlProgramStruct.kt | 6 +- .../DescriptorClusterSemanticTagStruct.kt | 6 +- ...ceEnergyManagementClusterForecastStruct.kt | 6 +- ...DeviceEnergyManagementClusterSlotStruct.kt | 8 +- ...formationClusterEcosystemLocationStruct.kt | 6 +- ...upKeyManagementClusterGroupKeyMapStruct.kt | 6 +- ...upKeyManagementClusterGroupKeySetStruct.kt | 6 +- ...mentClusterMonitoringRegistrationStruct.kt | 6 +- ...sagesClusterMessageResponseOptionStruct.kt | 8 +- .../structs/MessagesClusterMessageStruct.kt | 6 +- ...rkCommissioningClusterNetworkInfoStruct.kt | 6 +- ...redentialsClusterFabricDescriptorStruct.kt | 18 +- ...OperationalStateClusterErrorStateStruct.kt | 6 +- ...ionalStateClusterOperationalStateStruct.kt | 6 +- ...eUpdateRequestorClusterProviderLocation.kt | 6 +- ...OperationalStateClusterErrorStateStruct.kt | 6 +- ...ionalStateClusterOperationalStateStruct.kt | 6 +- ...OperationalStateClusterErrorStateStruct.kt | 6 +- ...ionalStateClusterOperationalStateStruct.kt | 6 +- ...nagementClusterAttributeValuePairStruct.kt | 6 +- ...cenesManagementClusterExtensionFieldSet.kt | 6 +- .../structs/ServiceAreaClusterAreaStruct.kt | 16 +- .../structs/ServiceAreaClusterMapStruct.kt | 6 +- .../ServiceAreaClusterProgressStruct.kt | 6 +- ...ostatClusterAtomicAttributeStatusStruct.kt | 6 +- ...tworkDiagnosticsClusterRouteTableStruct.kt | 12 +- ...workDirectoryClusterThreadNetworkStruct.kt | 6 +- ...sterFabricScopedTrustedTimeSourceStruct.kt | 6 +- ...onizationClusterTrustedTimeSourceStruct.kt | 6 +- .../cluster/clusters/AccountLoginCluster.kt | 8 +- .../cluster/clusters/ActionsCluster.kt | 96 +-- .../AdministratorCommissioningCluster.kt | 4 +- .../cluster/clusters/ChannelCluster.kt | 12 +- .../clusters/CommissionerControlCluster.kt | 4 +- .../cluster/clusters/ContentControlCluster.kt | 16 +- .../clusters/ContentLauncherCluster.kt | 4 +- .../DemandResponseLoadControlCluster.kt | 8 +- .../clusters/DeviceEnergyManagementCluster.kt | 4 +- .../cluster/clusters/DiagnosticLogsCluster.kt | 4 +- .../cluster/clusters/DoorLockCluster.kt | 24 +- .../clusters/GeneralCommissioningCluster.kt | 8 +- .../clusters/GroupKeyManagementCluster.kt | 8 +- .../cluster/clusters/GroupsCluster.kt | 28 +- .../cluster/clusters/IcdManagementCluster.kt | 12 +- .../cluster/clusters/MediaPlaybackCluster.kt | 8 +- .../cluster/clusters/MessagesCluster.kt | 4 +- .../clusters/NetworkCommissioningCluster.kt | 12 +- .../clusters/OperationalCredentialsCluster.kt | 36 +- .../OtaSoftwareUpdateProviderCluster.kt | 12 +- .../OtaSoftwareUpdateRequestorCluster.kt | 8 +- .../clusters/ScenesManagementCluster.kt | 88 +- .../clusters/ThreadNetworkDirectoryCluster.kt | 8 +- .../clusters/TimeSynchronizationCluster.kt | 16 +- ...olClusterAccessControlEntryChangedEvent.kt | 20 +- ...usterAccessControlExtensionChangedEvent.kt | 20 +- ...usterFabricRestrictionReviewUpdateEvent.kt | 10 +- .../ActionsClusterActionFailedEvent.kt | 12 +- .../ActionsClusterStateChangedEvent.kt | 12 +- ...lusterLoadControlEventStatusChangeEvent.kt | 6 +- .../EnergyEvseClusterEVConnectedEvent.kt | 6 +- .../EnergyEvseClusterEVNotDetectedEvent.kt | 6 +- ...gyEvseClusterEnergyTransferStartedEvent.kt | 6 +- ...gyEvseClusterEnergyTransferStoppedEvent.kt | 6 +- .../EnergyEvseClusterFaultEvent.kt | 10 +- .../MessagesClusterMessageCompleteEvent.kt | 18 +- .../MessagesClusterMessagePresentedEvent.kt | 6 +- .../MessagesClusterMessageQueuedEvent.kt | 6 +- ...dateRequestorClusterVersionAppliedEvent.kt | 6 +- ...imeSynchronizationClusterDSTStatusEvent.kt | 6 +- .../structs/ActionsClusterActionStruct.kt | 12 +- .../ActionsClusterEndpointListStruct.kt | 6 +- ...pplicationBasicClusterApplicationStruct.kt | 12 +- ...icationLauncherClusterApplicationStruct.kt | 12 +- .../structs/ChannelClusterProgramStruct.kt | 8 +- .../ContentLauncherClusterParameterStruct.kt | 8 +- ...ntLauncherClusterStyleInformationStruct.kt | 8 +- ...oadControlClusterLoadControlEventStruct.kt | 16 +- ...dControlClusterLoadControlProgramStruct.kt | 6 +- .../DescriptorClusterSemanticTagStruct.kt | 6 +- ...ceEnergyManagementClusterForecastStruct.kt | 6 +- ...DeviceEnergyManagementClusterSlotStruct.kt | 8 +- ...formationClusterEcosystemLocationStruct.kt | 6 +- ...upKeyManagementClusterGroupKeyMapStruct.kt | 6 +- ...upKeyManagementClusterGroupKeySetStruct.kt | 6 +- ...mentClusterMonitoringRegistrationStruct.kt | 6 +- ...sagesClusterMessageResponseOptionStruct.kt | 8 +- .../structs/MessagesClusterMessageStruct.kt | 6 +- ...rkCommissioningClusterNetworkInfoStruct.kt | 6 +- ...redentialsClusterFabricDescriptorStruct.kt | 18 +- ...OperationalStateClusterErrorStateStruct.kt | 6 +- ...ionalStateClusterOperationalStateStruct.kt | 6 +- ...eUpdateRequestorClusterProviderLocation.kt | 6 +- ...OperationalStateClusterErrorStateStruct.kt | 6 +- ...ionalStateClusterOperationalStateStruct.kt | 6 +- ...OperationalStateClusterErrorStateStruct.kt | 6 +- ...ionalStateClusterOperationalStateStruct.kt | 6 +- ...nagementClusterAttributeValuePairStruct.kt | 6 +- ...cenesManagementClusterExtensionFieldSet.kt | 6 +- .../structs/ServiceAreaClusterAreaStruct.kt | 16 +- .../structs/ServiceAreaClusterMapStruct.kt | 6 +- .../ServiceAreaClusterProgressStruct.kt | 6 +- ...ostatClusterAtomicAttributeStatusStruct.kt | 6 +- ...tworkDiagnosticsClusterRouteTableStruct.kt | 12 +- ...workDirectoryClusterThreadNetworkStruct.kt | 6 +- ...sterFabricScopedTrustedTimeSourceStruct.kt | 6 +- ...onizationClusterTrustedTimeSourceStruct.kt | 6 +- src/controller/python/chip/yaml/runner.py | 20 +- 145 files changed, 1437 insertions(+), 1311 deletions(-) create mode 100644 scripts/py_matter_idl/matter_idl/test_case_conversion.py diff --git a/integrations/docker/images/stage-2/chip-build-efr32/requirements.txt b/integrations/docker/images/stage-2/chip-build-efr32/requirements.txt index dc05bcd6459526..5c9ae9889f5ef3 100644 --- a/integrations/docker/images/stage-2/chip-build-efr32/requirements.txt +++ b/integrations/docker/images/stage-2/chip-build-efr32/requirements.txt @@ -1,7 +1,6 @@ # codegen.py build requirements Jinja2==3.1.3 lark==1.1.7 -stringcase==1.2.0 # Sphinx dependencies (for slc-cli) linkify-it-py==2.0.2 myst-parser==2.0.0 diff --git a/scripts/py_matter_idl/BUILD.gn b/scripts/py_matter_idl/BUILD.gn index 29e6becb4eba77..c0493e8fb763c3 100644 --- a/scripts/py_matter_idl/BUILD.gn +++ b/scripts/py_matter_idl/BUILD.gn @@ -53,6 +53,7 @@ pw_python_package("matter_idl") { tests = [ "matter_idl/test_backwards_compatibility.py", + "matter_idl/test_case_conversion.py", "matter_idl/test_data_model_xml.py", "matter_idl/test_matter_idl_parser.py", "matter_idl/test_generators.py", diff --git a/scripts/py_matter_idl/matter_idl/generators/filters.py b/scripts/py_matter_idl/matter_idl/generators/filters.py index b1ea94a7cd36c6..8f81c2013c2226 100644 --- a/scripts/py_matter_idl/matter_idl/generators/filters.py +++ b/scripts/py_matter_idl/matter_idl/generators/filters.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import stringcase +import re def normalize_acronyms(s: str) -> str: @@ -49,6 +49,75 @@ def lowfirst_except_acronym(s: str) -> str: return lowfirst(s) +def to_snake_case(s: str) -> str: + """convert to snake case; all words are seperated by underscore and are lower case + examples: + FooBarBaz --> foo_bar_baz + foo BarBaz --> foo_bar_baz + FOOBarBaz --> foo_bar_baz + _fooBar_Baz_ --> foo_bar_baz + """ + s = "" if s is None else str(s) + + s = re.sub(r'([A-Z]+)([A-Z][a-z])', r'\1_\2', s) + s = re.sub(r'([a-z\d])([A-Z])', r'\1_\2', s) + s = re.sub(r'[\s\-]+', '_', s) + + snake_case = s.lower() + return snake_case.strip('_') + + +def to_constant_case(s: str) -> str: + """convert to constant case; all words are seperated by underscore and are upper case + similar to a snake case but with upper case + examples: + FooBarBaz --> FOO_BAR_BAZ + foo BarBaz --> FOO_BAR_BAZ + FOOBarBaz --> FOO_BAR_BAZ + """ + snake_case = to_snake_case(s) + constant_case = snake_case.upper() + return constant_case + + +def to_spinal_case(s: str) -> str: + """convert to spinal case; all words sperated by hypen and are lower case + similar to a snake case but with hyphen seperator instead of underscore + examples: + FooBarBaz --> foo-bar-baz + foo BarBaz --> foo-bar-baz + FOOBarBaz --> foo-bar-baz + """ + snake_case = to_snake_case(s) + return snake_case.replace('_', '-') + + +def to_pascal_case(s: str) -> str: + """convert to pascal case; with no spaces or underscore between words, first letter of all words is uppercase + examples: + fooBarBaz --> FooBarBaz + foo BarBaz --> FooBarBaz + FOOBar_Baz --> FooBarBaz + """ + + snake_case = to_snake_case(s) + snake_case_split = snake_case.split('_') + pascal_case = ''.join(word.capitalize() for word in snake_case_split) + + return pascal_case + + +def to_camel_case(s) -> str: + """convert to camel case; with no spaces or underscore between words, first word all lowercase and following words are uppercase + same as pascal case but first letter is lower case + examples: + FooBarBaz --> fooBarBaz + foo BarBaz --> fooBarBaz + FOOBarBaz --> fooBarBaz + """ + return lowfirst(to_pascal_case(s)) + + def RegisterCommonFilters(filtermap): """ Register filters that are NOT considered platform-generator specific. @@ -59,12 +128,12 @@ def RegisterCommonFilters(filtermap): """ # General casing for output naming - filtermap['camelcase'] = stringcase.camelcase - filtermap['capitalcase'] = stringcase.capitalcase - filtermap['constcase'] = stringcase.constcase - filtermap['pascalcase'] = stringcase.pascalcase - filtermap['snakecase'] = stringcase.snakecase - filtermap['spinalcase'] = stringcase.spinalcase + filtermap['camelcase'] = to_camel_case + filtermap['capitalcase'] = upfirst + filtermap['constcase'] = to_constant_case + filtermap['pascalcase'] = to_pascal_case + filtermap['snakecase'] = to_snake_case + filtermap['spinalcase'] = to_spinal_case filtermap['normalize_acronyms'] = normalize_acronyms filtermap['lowfirst'] = lowfirst diff --git a/scripts/py_matter_idl/matter_idl/generators/java/__init__.py b/scripts/py_matter_idl/matter_idl/generators/java/__init__.py index 96fa37c1a26445..d21107653dfb46 100644 --- a/scripts/py_matter_idl/matter_idl/generators/java/__init__.py +++ b/scripts/py_matter_idl/matter_idl/generators/java/__init__.py @@ -20,11 +20,11 @@ from typing import List, Optional, Set from matter_idl.generators import CodeGenerator, GeneratorStorage +from matter_idl.generators.filters import upfirst from matter_idl.generators.type_definitions import (BasicInteger, BasicString, FundamentalType, IdlBitmapType, IdlEnumType, IdlType, ParseDataType, TypeLookupContext) from matter_idl.matter_idl_types import (Attribute, Cluster, Command, DataType, Field, FieldQuality, Idl, Struct, StructQuality, StructTag) -from stringcase import capitalcase @dataclasses.dataclass @@ -199,7 +199,7 @@ def DelegatedCallbackName(attr: Attribute, context: TypeLookupContext) -> str: if global_name: return 'Delegated{}AttributeCallback'.format(GlobalNameToJavaName(global_name)) - return 'Delegated{}Cluster{}AttributeCallback'.format(context.cluster.name, capitalcase(attr.definition.name)) + return 'Delegated{}Cluster{}AttributeCallback'.format(context.cluster.name, upfirst(attr.definition.name)) def ChipClustersCallbackName(attr: Attribute, context: TypeLookupContext) -> str: @@ -212,7 +212,7 @@ def ChipClustersCallbackName(attr: Attribute, context: TypeLookupContext) -> str if global_name: return 'ChipClusters.{}AttributeCallback'.format(GlobalNameToJavaName(global_name)) - return 'ChipClusters.{}Cluster.{}AttributeCallback'.format(context.cluster.name, capitalcase(attr.definition.name)) + return 'ChipClusters.{}Cluster.{}AttributeCallback'.format(context.cluster.name, upfirst(attr.definition.name)) def CallbackName(attr: Attribute, context: TypeLookupContext) -> str: @@ -228,11 +228,11 @@ def CallbackName(attr: Attribute, context: TypeLookupContext) -> str: global_name = FieldToGlobalName(attr.definition, context) if global_name: - return 'CHIP{}AttributeCallback'.format(capitalcase(global_name)) + return 'CHIP{}AttributeCallback'.format(upfirst(global_name)) return 'CHIP{}{}AttributeCallback'.format( - capitalcase(context.cluster.name), - capitalcase(attr.definition.name) + upfirst(context.cluster.name), + upfirst(attr.definition.name) ) @@ -262,7 +262,7 @@ def JavaAttributeCallbackName(attr: Attribute, context: TypeLookupContext) -> st if global_name: return '{}AttributeCallback'.format(GlobalNameToJavaName(global_name)) - return '{}AttributeCallback'.format(capitalcase(attr.definition.name)) + return '{}AttributeCallback'.format(upfirst(attr.definition.name)) def IsFieldGlobalName(field: Field, context: TypeLookupContext) -> bool: diff --git a/scripts/py_matter_idl/matter_idl/generators/kotlin/__init__.py b/scripts/py_matter_idl/matter_idl/generators/kotlin/__init__.py index 17e5136e169b6a..405f505a0980d3 100644 --- a/scripts/py_matter_idl/matter_idl/generators/kotlin/__init__.py +++ b/scripts/py_matter_idl/matter_idl/generators/kotlin/__init__.py @@ -20,11 +20,11 @@ from typing import List, Optional, Set from matter_idl.generators import CodeGenerator, GeneratorStorage +from matter_idl.generators.filters import upfirst from matter_idl.generators.type_definitions import (BasicInteger, BasicString, FundamentalType, IdlBitmapType, IdlEnumType, IdlType, ParseDataType, TypeLookupContext) from matter_idl.matter_idl_types import (Attribute, Cluster, Command, DataType, Field, FieldQuality, Idl, Struct, StructQuality, StructTag) -from stringcase import capitalcase @dataclasses.dataclass @@ -160,7 +160,7 @@ def DelegatedCallbackName(attr: Attribute, context: TypeLookupContext) -> str: if global_name: return 'Delegated{}AttributeCallback'.format(GlobalNameToJavaName(global_name)) - return 'Delegated{}Cluster{}AttributeCallback'.format(context.cluster.name, capitalcase(attr.definition.name)) + return 'Delegated{}Cluster{}AttributeCallback'.format(context.cluster.name, upfirst(attr.definition.name)) def ChipClustersCallbackName(attr: Attribute, context: TypeLookupContext) -> str: @@ -173,7 +173,7 @@ def ChipClustersCallbackName(attr: Attribute, context: TypeLookupContext) -> str if global_name: return 'ChipClusters.{}AttributeCallback'.format(GlobalNameToJavaName(global_name)) - return 'ChipClusters.{}Cluster.{}AttributeCallback'.format(context.cluster.name, capitalcase(attr.definition.name)) + return 'ChipClusters.{}Cluster.{}AttributeCallback'.format(context.cluster.name, upfirst(attr.definition.name)) def CallbackName(attr: Attribute, context: TypeLookupContext) -> str: @@ -189,11 +189,11 @@ def CallbackName(attr: Attribute, context: TypeLookupContext) -> str: global_name = FieldToGlobalName(attr.definition, context) if global_name: - return 'CHIP{}AttributeCallback'.format(capitalcase(global_name)) + return 'CHIP{}AttributeCallback'.format(upfirst(global_name)) return 'CHIP{}{}AttributeCallback'.format( - capitalcase(context.cluster.name), - capitalcase(attr.definition.name) + upfirst(context.cluster.name), + upfirst(attr.definition.name) ) @@ -223,7 +223,7 @@ def JavaAttributeCallbackName(attr: Attribute, context: TypeLookupContext) -> st if global_name: return '{}'.format(GlobalNameToJavaName(global_name)) - return '{}Attribute'.format(capitalcase(attr.definition.name)) + return '{}Attribute'.format(upfirst(attr.definition.name)) def IsFieldGlobalName(field: Field, context: TypeLookupContext) -> bool: diff --git a/scripts/py_matter_idl/matter_idl/test_case_conversion.py b/scripts/py_matter_idl/matter_idl/test_case_conversion.py new file mode 100644 index 00000000000000..7d8381530a1815 --- /dev/null +++ b/scripts/py_matter_idl/matter_idl/test_case_conversion.py @@ -0,0 +1,61 @@ + +import unittest + +import matter_idl.generators.filters as case_convert + +''' +This file contains tests for checking five of the case conversion functions, notably: snake_case, CONSTANT_CASE, spinal-case, PascalCase and camelCase. + + +''' +inputs = [ + "FooBarBaz", + "FOOBarBaz", + "FOOBarBAZ", + "fooBARBaz", + "fooBarBAZ", + "foo BarBaz", + " FooBarBaz ", + "foo_bar_baz", + "FOO-bar-baz", + "FOO_BAR_BAZ", + "__FooBarBaz__", + "_fooBar_Baz_", + "foo_Bar Baz" +] + + +class TestSnakeCase(unittest.TestCase): + def test_snake_case(self): + expected = "foo_bar_baz" + for input in inputs: + converted = case_convert.to_snake_case(input) + self.assertEqual(converted, expected, "they are not equal") + + def test_constant_case(self): + expected = "FOO_BAR_BAZ" + for input in inputs: + converted = case_convert.to_constant_case(input) + self.assertEqual(converted, expected, "they are not equal") + + def test_spinal_case(self): + expected = "foo-bar-baz" + for input in inputs: + converted = case_convert.to_spinal_case(input) + self.assertEqual(converted, expected, "they are not equal") + + def test_pascal_case(self): + expected = "FooBarBaz" + for input in inputs: + converted = case_convert.to_pascal_case(input) + self.assertEqual(converted, expected, "they are not equal") + + def test_camel_case(self): + expected = "fooBarBaz" + for input in inputs: + converted = case_convert.to_camel_case(input) + self.assertEqual(converted, expected, "they are not equal") + + +if __name__ == '__main__': + unittest.main() diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/ChipStructs.java b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/ChipStructs.java index d3cf1f0c7dae79..70c8bf0e646eee 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/ChipStructs.java +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/ChipStructs.java @@ -32,9 +32,9 @@ public static class SecondClusterFabricDescriptorStruct { public String label; public Integer fabricIndex; private static final long ROOT_PUBLIC_KEY_ID = 1L; - private static final long VENDOR_I_D_ID = 2L; - private static final long FABRIC_I_D_ID = 3L; - private static final long NODE_I_D_ID = 4L; + private static final long VENDOR_ID_ID = 2L; + private static final long FABRIC_ID_ID = 3L; + private static final long NODE_ID_ID = 4L; private static final long LABEL_ID = 5L; private static final long FABRIC_INDEX_ID = 254L; @@ -57,9 +57,9 @@ public SecondClusterFabricDescriptorStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); values.add(new StructElement(ROOT_PUBLIC_KEY_ID, new ByteArrayType(rootPublicKey))); - values.add(new StructElement(VENDOR_I_D_ID, new UIntType(vendorID))); - values.add(new StructElement(FABRIC_I_D_ID, new UIntType(fabricID))); - values.add(new StructElement(NODE_I_D_ID, new UIntType(nodeID))); + values.add(new StructElement(VENDOR_ID_ID, new UIntType(vendorID))); + values.add(new StructElement(FABRIC_ID_ID, new UIntType(fabricID))); + values.add(new StructElement(NODE_ID_ID, new UIntType(nodeID))); values.add(new StructElement(LABEL_ID, new StringType(label))); values.add(new StructElement(FABRIC_INDEX_ID, new UIntType(fabricIndex))); @@ -82,17 +82,17 @@ public static SecondClusterFabricDescriptorStruct decodeTlv(BaseTLVType tlvValue ByteArrayType castingValue = element.value(ByteArrayType.class); rootPublicKey = castingValue.value(byte[].class); } - } else if (element.contextTagNum() == VENDOR_I_D_ID) { + } else if (element.contextTagNum() == VENDOR_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); vendorID = castingValue.value(Integer.class); } - } else if (element.contextTagNum() == FABRIC_I_D_ID) { + } else if (element.contextTagNum() == FABRIC_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); fabricID = castingValue.value(Long.class); } - } else if (element.contextTagNum() == NODE_I_D_ID) { + } else if (element.contextTagNum() == NODE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); nodeID = castingValue.value(Long.class); diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/SecondClusterFabricDescriptorStruct.kt b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/SecondClusterFabricDescriptorStruct.kt index 52c46471ae8dc0..cb225d96fdeabf 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/SecondClusterFabricDescriptorStruct.kt +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/SecondClusterFabricDescriptorStruct.kt @@ -48,9 +48,9 @@ class SecondClusterFabricDescriptorStruct ( tlvWriter.apply { startStructure(tlvTag) put(ContextSpecificTag(TAG_ROOT_PUBLIC_KEY), rootPublicKey) - put(ContextSpecificTag(TAG_VENDOR_I_D), vendorID) - put(ContextSpecificTag(TAG_FABRIC_I_D), fabricID) - put(ContextSpecificTag(TAG_NODE_I_D), nodeID) + put(ContextSpecificTag(TAG_VENDOR_ID), vendorID) + put(ContextSpecificTag(TAG_FABRIC_ID), fabricID) + put(ContextSpecificTag(TAG_NODE_ID), nodeID) put(ContextSpecificTag(TAG_LABEL), label) put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) endStructure() @@ -59,18 +59,18 @@ class SecondClusterFabricDescriptorStruct ( companion object { private const val TAG_ROOT_PUBLIC_KEY = 1 - private const val TAG_VENDOR_I_D = 2 - private const val TAG_FABRIC_I_D = 3 - private const val TAG_NODE_I_D = 4 + private const val TAG_VENDOR_ID = 2 + private const val TAG_FABRIC_ID = 3 + private const val TAG_NODE_ID = 4 private const val TAG_LABEL = 5 private const val TAG_FABRIC_INDEX = 254 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader) : SecondClusterFabricDescriptorStruct { tlvReader.enterStructure(tlvTag) val rootPublicKey = tlvReader.getByteArray(ContextSpecificTag(TAG_ROOT_PUBLIC_KEY)) - val vendorID = tlvReader.getUInt(ContextSpecificTag(TAG_VENDOR_I_D)) - val fabricID = tlvReader.getULong(ContextSpecificTag(TAG_FABRIC_I_D)) - val nodeID = tlvReader.getULong(ContextSpecificTag(TAG_NODE_I_D)) + val vendorID = tlvReader.getUInt(ContextSpecificTag(TAG_VENDOR_ID)) + val fabricID = tlvReader.getULong(ContextSpecificTag(TAG_FABRIC_ID)) + val nodeID = tlvReader.getULong(ContextSpecificTag(TAG_NODE_ID)) val label = tlvReader.getString(ContextSpecificTag(TAG_LABEL)) val fabricIndex = tlvReader.getUInt(ContextSpecificTag(TAG_FABRIC_INDEX)) diff --git a/scripts/py_matter_idl/setup.cfg b/scripts/py_matter_idl/setup.cfg index 6fed9ed20f6523..25f7f6d3bff389 100644 --- a/scripts/py_matter_idl/setup.cfg +++ b/scripts/py_matter_idl/setup.cfg @@ -24,7 +24,6 @@ zip_safe = False install_requires= lark jinja2 - stringcase [options.package_data] matter_idl = diff --git a/scripts/setup/constraints.txt b/scripts/setup/constraints.txt index 3f396a83c7ac68..1b5244314196d6 100644 --- a/scripts/setup/constraints.txt +++ b/scripts/setup/constraints.txt @@ -245,8 +245,6 @@ six==1.16.0 # requests-file stack-data==0.6.2 # via ipython -stringcase==1.2.0 - # via -r requirements.build.txt tabulate==0.9.0 # via -r requirements.memory.txt tornado==6.2 diff --git a/scripts/setup/requirements.build.txt b/scripts/setup/requirements.build.txt index c9e8bad323bd85..e95c4587b9eea1 100644 --- a/scripts/setup/requirements.build.txt +++ b/scripts/setup/requirements.build.txt @@ -11,4 +11,3 @@ click # scripts/py_matter_idl/matter_idl jinja2 lark -stringcase diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index 8b112f53c6f36d..6f3e6f62d340e7 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -3963,7 +3963,7 @@ public static class AccessControlCluster extends BaseChipCluster { private static final long SUBJECTS_PER_ACCESS_CONTROL_ENTRY_ATTRIBUTE_ID = 2L; private static final long TARGETS_PER_ACCESS_CONTROL_ENTRY_ATTRIBUTE_ID = 3L; private static final long ACCESS_CONTROL_ENTRIES_PER_FABRIC_ATTRIBUTE_ID = 4L; - private static final long COMMISSIONING_A_R_L_ATTRIBUTE_ID = 5L; + private static final long COMMISSIONING_ARL_ATTRIBUTE_ID = 5L; private static final long ARL_ATTRIBUTE_ID = 6L; private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; @@ -4194,7 +4194,7 @@ public void onSuccess(byte[] tlv) { public void readCommissioningARLAttribute( CommissioningARLAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COMMISSIONING_A_R_L_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COMMISSIONING_ARL_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -4202,12 +4202,12 @@ public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, COMMISSIONING_A_R_L_ATTRIBUTE_ID, true); + }, COMMISSIONING_ARL_ATTRIBUTE_ID, true); } public void subscribeCommissioningARLAttribute( CommissioningARLAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COMMISSIONING_A_R_L_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COMMISSIONING_ARL_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -4215,7 +4215,7 @@ public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, COMMISSIONING_A_R_L_ATTRIBUTE_ID, minInterval, maxInterval); + }, COMMISSIONING_ARL_ATTRIBUTE_ID, minInterval, maxInterval); } public void readArlAttribute( @@ -4411,7 +4411,7 @@ public static class ActionsCluster extends BaseChipCluster { private static final long ACTION_LIST_ATTRIBUTE_ID = 0L; private static final long ENDPOINT_LISTS_ATTRIBUTE_ID = 1L; - private static final long SETUP_U_R_L_ATTRIBUTE_ID = 2L; + private static final long SETUP_URL_ATTRIBUTE_ID = 2L; private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L; @@ -4815,7 +4815,7 @@ public void onSuccess(byte[] tlv) { public void readSetupURLAttribute( CharStringAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SETUP_U_R_L_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SETUP_URL_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -4823,12 +4823,12 @@ public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, SETUP_U_R_L_ATTRIBUTE_ID, true); + }, SETUP_URL_ATTRIBUTE_ID, true); } public void subscribeSetupURLAttribute( CharStringAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SETUP_U_R_L_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SETUP_URL_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -4836,7 +4836,7 @@ public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, SETUP_U_R_L_ATTRIBUTE_ID, minInterval, maxInterval); + }, SETUP_URL_ATTRIBUTE_ID, minInterval, maxInterval); } public void readGeneratedCommandListAttribute( @@ -5001,9 +5001,9 @@ public static class BasicInformationCluster extends BaseChipCluster { private static final long DATA_MODEL_REVISION_ATTRIBUTE_ID = 0L; private static final long VENDOR_NAME_ATTRIBUTE_ID = 1L; - private static final long VENDOR_I_D_ATTRIBUTE_ID = 2L; + private static final long VENDOR_ID_ATTRIBUTE_ID = 2L; private static final long PRODUCT_NAME_ATTRIBUTE_ID = 3L; - private static final long PRODUCT_I_D_ATTRIBUTE_ID = 4L; + private static final long PRODUCT_ID_ATTRIBUTE_ID = 4L; private static final long NODE_LABEL_ATTRIBUTE_ID = 5L; private static final long LOCATION_ATTRIBUTE_ID = 6L; private static final long HARDWARE_VERSION_ATTRIBUTE_ID = 7L; @@ -5012,12 +5012,12 @@ public static class BasicInformationCluster extends BaseChipCluster { private static final long SOFTWARE_VERSION_STRING_ATTRIBUTE_ID = 10L; private static final long MANUFACTURING_DATE_ATTRIBUTE_ID = 11L; private static final long PART_NUMBER_ATTRIBUTE_ID = 12L; - private static final long PRODUCT_U_R_L_ATTRIBUTE_ID = 13L; + private static final long PRODUCT_URL_ATTRIBUTE_ID = 13L; private static final long PRODUCT_LABEL_ATTRIBUTE_ID = 14L; private static final long SERIAL_NUMBER_ATTRIBUTE_ID = 15L; private static final long LOCAL_CONFIG_DISABLED_ATTRIBUTE_ID = 16L; private static final long REACHABLE_ATTRIBUTE_ID = 17L; - private static final long UNIQUE_I_D_ATTRIBUTE_ID = 18L; + private static final long UNIQUE_ID_ATTRIBUTE_ID = 18L; private static final long CAPABILITY_MINIMA_ATTRIBUTE_ID = 19L; private static final long PRODUCT_APPEARANCE_ATTRIBUTE_ID = 20L; private static final long SPECIFICATION_VERSION_ATTRIBUTE_ID = 21L; @@ -5133,7 +5133,7 @@ public void onSuccess(byte[] tlv) { public void readVendorIDAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VENDOR_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VENDOR_ID_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -5141,12 +5141,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, VENDOR_I_D_ATTRIBUTE_ID, true); + }, VENDOR_ID_ATTRIBUTE_ID, true); } public void subscribeVendorIDAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VENDOR_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VENDOR_ID_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -5154,7 +5154,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, VENDOR_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + }, VENDOR_ID_ATTRIBUTE_ID, minInterval, maxInterval); } public void readProductNameAttribute( @@ -5185,7 +5185,7 @@ public void onSuccess(byte[] tlv) { public void readProductIDAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_ID_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -5193,12 +5193,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, PRODUCT_I_D_ATTRIBUTE_ID, true); + }, PRODUCT_ID_ATTRIBUTE_ID, true); } public void subscribeProductIDAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_ID_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -5206,7 +5206,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, PRODUCT_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + }, PRODUCT_ID_ATTRIBUTE_ID, minInterval, maxInterval); } public void readNodeLabelAttribute( @@ -5437,7 +5437,7 @@ public void onSuccess(byte[] tlv) { public void readProductURLAttribute( CharStringAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_U_R_L_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_URL_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -5445,12 +5445,12 @@ public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, PRODUCT_U_R_L_ATTRIBUTE_ID, true); + }, PRODUCT_URL_ATTRIBUTE_ID, true); } public void subscribeProductURLAttribute( CharStringAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_U_R_L_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_URL_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -5458,7 +5458,7 @@ public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, PRODUCT_U_R_L_ATTRIBUTE_ID, minInterval, maxInterval); + }, PRODUCT_URL_ATTRIBUTE_ID, minInterval, maxInterval); } public void readProductLabelAttribute( @@ -5576,7 +5576,7 @@ public void onSuccess(byte[] tlv) { public void readUniqueIDAttribute( CharStringAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, UNIQUE_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, UNIQUE_ID_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -5584,12 +5584,12 @@ public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, UNIQUE_I_D_ATTRIBUTE_ID, true); + }, UNIQUE_ID_ATTRIBUTE_ID, true); } public void subscribeUniqueIDAttribute( CharStringAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, UNIQUE_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, UNIQUE_ID_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -5597,7 +5597,7 @@ public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, UNIQUE_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + }, UNIQUE_ID_ATTRIBUTE_ID, minInterval, maxInterval); } public void readCapabilityMinimaAttribute( @@ -6237,7 +6237,7 @@ public void onSuccess(byte[] tlv) { public static class OtaSoftwareUpdateRequestorCluster extends BaseChipCluster { public static final long CLUSTER_ID = 42L; - private static final long DEFAULT_O_T_A_PROVIDERS_ATTRIBUTE_ID = 0L; + private static final long DEFAULT_OTA_PROVIDERS_ATTRIBUTE_ID = 0L; private static final long UPDATE_POSSIBLE_ATTRIBUTE_ID = 1L; private static final long UPDATE_STATE_ATTRIBUTE_ID = 2L; private static final long UPDATE_STATE_PROGRESS_ATTRIBUTE_ID = 3L; @@ -6325,7 +6325,7 @@ public void readDefaultOTAProvidersAttribute( public void readDefaultOTAProvidersAttributeWithFabricFilter( DefaultOTAProvidersAttributeCallback callback, boolean isFabricFiltered) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_O_T_A_PROVIDERS_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_OTA_PROVIDERS_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -6333,7 +6333,7 @@ public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, DEFAULT_O_T_A_PROVIDERS_ATTRIBUTE_ID, isFabricFiltered); + }, DEFAULT_OTA_PROVIDERS_ATTRIBUTE_ID, isFabricFiltered); } public void writeDefaultOTAProvidersAttribute(DefaultClusterCallback callback, ArrayList value) { @@ -6342,12 +6342,12 @@ public void writeDefaultOTAProvidersAttribute(DefaultClusterCallback callback, A public void writeDefaultOTAProvidersAttribute(DefaultClusterCallback callback, ArrayList value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = ArrayType.generateArrayType(value, (elementvalue) -> elementvalue.encodeTlv()); - writeAttribute(new WriteAttributesCallbackImpl(callback), DEFAULT_O_T_A_PROVIDERS_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), DEFAULT_OTA_PROVIDERS_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribeDefaultOTAProvidersAttribute( DefaultOTAProvidersAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_O_T_A_PROVIDERS_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_OTA_PROVIDERS_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -6355,7 +6355,7 @@ public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, DEFAULT_O_T_A_PROVIDERS_ATTRIBUTE_ID, minInterval, maxInterval); + }, DEFAULT_OTA_PROVIDERS_ATTRIBUTE_ID, minInterval, maxInterval); } public void readUpdatePossibleAttribute( @@ -7626,8 +7626,8 @@ public static class PowerSourceCluster extends BaseChipCluster { private static final long ACTIVE_BAT_FAULTS_ATTRIBUTE_ID = 18L; private static final long BAT_REPLACEMENT_DESCRIPTION_ATTRIBUTE_ID = 19L; private static final long BAT_COMMON_DESIGNATION_ATTRIBUTE_ID = 20L; - private static final long BAT_A_N_S_I_DESIGNATION_ATTRIBUTE_ID = 21L; - private static final long BAT_I_E_C_DESIGNATION_ATTRIBUTE_ID = 22L; + private static final long BAT_ANSI_DESIGNATION_ATTRIBUTE_ID = 21L; + private static final long BAT_IEC_DESIGNATION_ATTRIBUTE_ID = 22L; private static final long BAT_APPROVED_CHEMISTRY_ATTRIBUTE_ID = 23L; private static final long BAT_CAPACITY_ATTRIBUTE_ID = 24L; private static final long BAT_QUANTITY_ATTRIBUTE_ID = 25L; @@ -8266,7 +8266,7 @@ public void onSuccess(byte[] tlv) { public void readBatANSIDesignationAttribute( CharStringAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BAT_A_N_S_I_DESIGNATION_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BAT_ANSI_DESIGNATION_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -8274,12 +8274,12 @@ public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, BAT_A_N_S_I_DESIGNATION_ATTRIBUTE_ID, true); + }, BAT_ANSI_DESIGNATION_ATTRIBUTE_ID, true); } public void subscribeBatANSIDesignationAttribute( CharStringAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BAT_A_N_S_I_DESIGNATION_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BAT_ANSI_DESIGNATION_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -8287,12 +8287,12 @@ public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, BAT_A_N_S_I_DESIGNATION_ATTRIBUTE_ID, minInterval, maxInterval); + }, BAT_ANSI_DESIGNATION_ATTRIBUTE_ID, minInterval, maxInterval); } public void readBatIECDesignationAttribute( CharStringAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BAT_I_E_C_DESIGNATION_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BAT_IEC_DESIGNATION_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -8300,12 +8300,12 @@ public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, BAT_I_E_C_DESIGNATION_ATTRIBUTE_ID, true); + }, BAT_IEC_DESIGNATION_ATTRIBUTE_ID, true); } public void subscribeBatIECDesignationAttribute( CharStringAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BAT_I_E_C_DESIGNATION_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BAT_IEC_DESIGNATION_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -8313,7 +8313,7 @@ public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, BAT_I_E_C_DESIGNATION_ATTRIBUTE_ID, minInterval, maxInterval); + }, BAT_IEC_DESIGNATION_ATTRIBUTE_ID, minInterval, maxInterval); } public void readBatApprovedChemistryAttribute( @@ -8715,10 +8715,10 @@ public static class GeneralCommissioningCluster extends BaseChipCluster { private static final long REGULATORY_CONFIG_ATTRIBUTE_ID = 2L; private static final long LOCATION_CAPABILITY_ATTRIBUTE_ID = 3L; private static final long SUPPORTS_CONCURRENT_CONNECTION_ATTRIBUTE_ID = 4L; - private static final long T_C_ACCEPTED_VERSION_ATTRIBUTE_ID = 5L; - private static final long T_C_MIN_REQUIRED_VERSION_ATTRIBUTE_ID = 6L; - private static final long T_C_ACKNOWLEDGEMENTS_ATTRIBUTE_ID = 7L; - private static final long T_C_ACKNOWLEDGEMENTS_REQUIRED_ATTRIBUTE_ID = 8L; + private static final long TC_ACCEPTED_VERSION_ATTRIBUTE_ID = 5L; + private static final long TC_MIN_REQUIRED_VERSION_ATTRIBUTE_ID = 6L; + private static final long TC_ACKNOWLEDGEMENTS_ATTRIBUTE_ID = 7L; + private static final long TC_ACKNOWLEDGEMENTS_REQUIRED_ATTRIBUTE_ID = 8L; private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L; @@ -9066,7 +9066,7 @@ public void onSuccess(byte[] tlv) { public void readTCAcceptedVersionAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, T_C_ACCEPTED_VERSION_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TC_ACCEPTED_VERSION_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -9074,12 +9074,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, T_C_ACCEPTED_VERSION_ATTRIBUTE_ID, true); + }, TC_ACCEPTED_VERSION_ATTRIBUTE_ID, true); } public void subscribeTCAcceptedVersionAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, T_C_ACCEPTED_VERSION_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TC_ACCEPTED_VERSION_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -9087,12 +9087,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, T_C_ACCEPTED_VERSION_ATTRIBUTE_ID, minInterval, maxInterval); + }, TC_ACCEPTED_VERSION_ATTRIBUTE_ID, minInterval, maxInterval); } public void readTCMinRequiredVersionAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, T_C_MIN_REQUIRED_VERSION_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TC_MIN_REQUIRED_VERSION_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -9100,12 +9100,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, T_C_MIN_REQUIRED_VERSION_ATTRIBUTE_ID, true); + }, TC_MIN_REQUIRED_VERSION_ATTRIBUTE_ID, true); } public void subscribeTCMinRequiredVersionAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, T_C_MIN_REQUIRED_VERSION_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TC_MIN_REQUIRED_VERSION_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -9113,12 +9113,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, T_C_MIN_REQUIRED_VERSION_ATTRIBUTE_ID, minInterval, maxInterval); + }, TC_MIN_REQUIRED_VERSION_ATTRIBUTE_ID, minInterval, maxInterval); } public void readTCAcknowledgementsAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, T_C_ACKNOWLEDGEMENTS_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TC_ACKNOWLEDGEMENTS_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -9126,12 +9126,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, T_C_ACKNOWLEDGEMENTS_ATTRIBUTE_ID, true); + }, TC_ACKNOWLEDGEMENTS_ATTRIBUTE_ID, true); } public void subscribeTCAcknowledgementsAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, T_C_ACKNOWLEDGEMENTS_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TC_ACKNOWLEDGEMENTS_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -9139,12 +9139,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, T_C_ACKNOWLEDGEMENTS_ATTRIBUTE_ID, minInterval, maxInterval); + }, TC_ACKNOWLEDGEMENTS_ATTRIBUTE_ID, minInterval, maxInterval); } public void readTCAcknowledgementsRequiredAttribute( BooleanAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, T_C_ACKNOWLEDGEMENTS_REQUIRED_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TC_ACKNOWLEDGEMENTS_REQUIRED_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -9152,12 +9152,12 @@ public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, T_C_ACKNOWLEDGEMENTS_REQUIRED_ATTRIBUTE_ID, true); + }, TC_ACKNOWLEDGEMENTS_REQUIRED_ATTRIBUTE_ID, true); } public void subscribeTCAcknowledgementsRequiredAttribute( BooleanAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, T_C_ACKNOWLEDGEMENTS_REQUIRED_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TC_ACKNOWLEDGEMENTS_REQUIRED_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -9165,7 +9165,7 @@ public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, T_C_ACKNOWLEDGEMENTS_REQUIRED_ATTRIBUTE_ID, minInterval, maxInterval); + }, TC_ACKNOWLEDGEMENTS_REQUIRED_ATTRIBUTE_ID, minInterval, maxInterval); } public void readGeneratedCommandListAttribute( @@ -9334,7 +9334,7 @@ public static class NetworkCommissioningCluster extends BaseChipCluster { private static final long CONNECT_MAX_TIME_SECONDS_ATTRIBUTE_ID = 3L; private static final long INTERFACE_ENABLED_ATTRIBUTE_ID = 4L; private static final long LAST_NETWORKING_STATUS_ATTRIBUTE_ID = 5L; - private static final long LAST_NETWORK_I_D_ATTRIBUTE_ID = 6L; + private static final long LAST_NETWORK_ID_ATTRIBUTE_ID = 6L; private static final long LAST_CONNECT_ERROR_VALUE_ATTRIBUTE_ID = 7L; private static final long SUPPORTED_WI_FI_BANDS_ATTRIBUTE_ID = 8L; private static final long SUPPORTED_THREAD_FEATURES_ATTRIBUTE_ID = 9L; @@ -9987,7 +9987,7 @@ public void onSuccess(byte[] tlv) { public void readLastNetworkIDAttribute( LastNetworkIDAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, LAST_NETWORK_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, LAST_NETWORK_ID_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -9995,12 +9995,12 @@ public void onSuccess(byte[] tlv) { @Nullable byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, LAST_NETWORK_I_D_ATTRIBUTE_ID, true); + }, LAST_NETWORK_ID_ATTRIBUTE_ID, true); } public void subscribeLastNetworkIDAttribute( LastNetworkIDAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, LAST_NETWORK_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, LAST_NETWORK_ID_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -10008,7 +10008,7 @@ public void onSuccess(byte[] tlv) { @Nullable byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, LAST_NETWORK_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + }, LAST_NETWORK_ID_ATTRIBUTE_ID, minInterval, maxInterval); } public void readLastConnectErrorValueAttribute( @@ -14009,7 +14009,7 @@ public void onSuccess(byte[] tlv) { public static class EthernetNetworkDiagnosticsCluster extends BaseChipCluster { public static final long CLUSTER_ID = 55L; - private static final long P_H_Y_RATE_ATTRIBUTE_ID = 0L; + private static final long PHY_RATE_ATTRIBUTE_ID = 0L; private static final long FULL_DUPLEX_ATTRIBUTE_ID = 1L; private static final long PACKET_RX_COUNT_ATTRIBUTE_ID = 2L; private static final long PACKET_TX_COUNT_ATTRIBUTE_ID = 3L; @@ -14081,7 +14081,7 @@ public interface AttributeListAttributeCallback extends BaseAttributeCallback { public void readPHYRateAttribute( PHYRateAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, P_H_Y_RATE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PHY_RATE_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -14089,12 +14089,12 @@ public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, P_H_Y_RATE_ATTRIBUTE_ID, true); + }, PHY_RATE_ATTRIBUTE_ID, true); } public void subscribePHYRateAttribute( PHYRateAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, P_H_Y_RATE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PHY_RATE_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -14102,7 +14102,7 @@ public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, P_H_Y_RATE_ATTRIBUTE_ID, minInterval, maxInterval); + }, PHY_RATE_ATTRIBUTE_ID, minInterval, maxInterval); } public void readFullDuplexAttribute( @@ -14473,19 +14473,19 @@ public void onSuccess(byte[] tlv) { public static class TimeSynchronizationCluster extends BaseChipCluster { public static final long CLUSTER_ID = 56L; - private static final long U_T_C_TIME_ATTRIBUTE_ID = 0L; + private static final long UTC_TIME_ATTRIBUTE_ID = 0L; private static final long GRANULARITY_ATTRIBUTE_ID = 1L; private static final long TIME_SOURCE_ATTRIBUTE_ID = 2L; private static final long TRUSTED_TIME_SOURCE_ATTRIBUTE_ID = 3L; - private static final long DEFAULT_N_T_P_ATTRIBUTE_ID = 4L; + private static final long DEFAULT_NTP_ATTRIBUTE_ID = 4L; private static final long TIME_ZONE_ATTRIBUTE_ID = 5L; - private static final long D_S_T_OFFSET_ATTRIBUTE_ID = 6L; + private static final long DST_OFFSET_ATTRIBUTE_ID = 6L; private static final long LOCAL_TIME_ATTRIBUTE_ID = 7L; private static final long TIME_ZONE_DATABASE_ATTRIBUTE_ID = 8L; - private static final long N_T_P_SERVER_AVAILABLE_ATTRIBUTE_ID = 9L; + private static final long NTP_SERVER_AVAILABLE_ATTRIBUTE_ID = 9L; private static final long TIME_ZONE_LIST_MAX_SIZE_ATTRIBUTE_ID = 10L; - private static final long D_S_T_OFFSET_LIST_MAX_SIZE_ATTRIBUTE_ID = 11L; - private static final long SUPPORTS_D_N_S_RESOLVE_ATTRIBUTE_ID = 12L; + private static final long DST_OFFSET_LIST_MAX_SIZE_ATTRIBUTE_ID = 11L; + private static final long SUPPORTS_DNS_RESOLVE_ATTRIBUTE_ID = 12L; private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; private static final long EVENT_LIST_ATTRIBUTE_ID = 65530L; @@ -14667,7 +14667,7 @@ public interface AttributeListAttributeCallback extends BaseAttributeCallback { public void readUTCTimeAttribute( UTCTimeAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, U_T_C_TIME_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, UTC_TIME_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -14675,12 +14675,12 @@ public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, U_T_C_TIME_ATTRIBUTE_ID, true); + }, UTC_TIME_ATTRIBUTE_ID, true); } public void subscribeUTCTimeAttribute( UTCTimeAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, U_T_C_TIME_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, UTC_TIME_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -14688,7 +14688,7 @@ public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, U_T_C_TIME_ATTRIBUTE_ID, minInterval, maxInterval); + }, UTC_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } public void readGranularityAttribute( @@ -14771,7 +14771,7 @@ public void onSuccess(byte[] tlv) { public void readDefaultNTPAttribute( DefaultNTPAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_N_T_P_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_NTP_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -14779,12 +14779,12 @@ public void onSuccess(byte[] tlv) { @Nullable String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, DEFAULT_N_T_P_ATTRIBUTE_ID, true); + }, DEFAULT_NTP_ATTRIBUTE_ID, true); } public void subscribeDefaultNTPAttribute( DefaultNTPAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_N_T_P_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DEFAULT_NTP_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -14792,7 +14792,7 @@ public void onSuccess(byte[] tlv) { @Nullable String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, DEFAULT_N_T_P_ATTRIBUTE_ID, minInterval, maxInterval); + }, DEFAULT_NTP_ATTRIBUTE_ID, minInterval, maxInterval); } public void readTimeZoneAttribute( @@ -14823,7 +14823,7 @@ public void onSuccess(byte[] tlv) { public void readDSTOffsetAttribute( DSTOffsetAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, D_S_T_OFFSET_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DST_OFFSET_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -14831,12 +14831,12 @@ public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, D_S_T_OFFSET_ATTRIBUTE_ID, true); + }, DST_OFFSET_ATTRIBUTE_ID, true); } public void subscribeDSTOffsetAttribute( DSTOffsetAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, D_S_T_OFFSET_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DST_OFFSET_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -14844,7 +14844,7 @@ public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, D_S_T_OFFSET_ATTRIBUTE_ID, minInterval, maxInterval); + }, DST_OFFSET_ATTRIBUTE_ID, minInterval, maxInterval); } public void readLocalTimeAttribute( @@ -14901,7 +14901,7 @@ public void onSuccess(byte[] tlv) { public void readNTPServerAvailableAttribute( BooleanAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, N_T_P_SERVER_AVAILABLE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NTP_SERVER_AVAILABLE_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -14909,12 +14909,12 @@ public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, N_T_P_SERVER_AVAILABLE_ATTRIBUTE_ID, true); + }, NTP_SERVER_AVAILABLE_ATTRIBUTE_ID, true); } public void subscribeNTPServerAvailableAttribute( BooleanAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, N_T_P_SERVER_AVAILABLE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NTP_SERVER_AVAILABLE_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -14922,7 +14922,7 @@ public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, N_T_P_SERVER_AVAILABLE_ATTRIBUTE_ID, minInterval, maxInterval); + }, NTP_SERVER_AVAILABLE_ATTRIBUTE_ID, minInterval, maxInterval); } public void readTimeZoneListMaxSizeAttribute( @@ -14953,7 +14953,7 @@ public void onSuccess(byte[] tlv) { public void readDSTOffsetListMaxSizeAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, D_S_T_OFFSET_LIST_MAX_SIZE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DST_OFFSET_LIST_MAX_SIZE_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -14961,12 +14961,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, D_S_T_OFFSET_LIST_MAX_SIZE_ATTRIBUTE_ID, true); + }, DST_OFFSET_LIST_MAX_SIZE_ATTRIBUTE_ID, true); } public void subscribeDSTOffsetListMaxSizeAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, D_S_T_OFFSET_LIST_MAX_SIZE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, DST_OFFSET_LIST_MAX_SIZE_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -14974,12 +14974,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, D_S_T_OFFSET_LIST_MAX_SIZE_ATTRIBUTE_ID, minInterval, maxInterval); + }, DST_OFFSET_LIST_MAX_SIZE_ATTRIBUTE_ID, minInterval, maxInterval); } public void readSupportsDNSResolveAttribute( BooleanAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTS_D_N_S_RESOLVE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTS_DNS_RESOLVE_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -14987,12 +14987,12 @@ public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, SUPPORTS_D_N_S_RESOLVE_ATTRIBUTE_ID, true); + }, SUPPORTS_DNS_RESOLVE_ATTRIBUTE_ID, true); } public void subscribeSupportsDNSResolveAttribute( BooleanAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTS_D_N_S_RESOLVE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTS_DNS_RESOLVE_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -15000,7 +15000,7 @@ public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, SUPPORTS_D_N_S_RESOLVE_ATTRIBUTE_ID, minInterval, maxInterval); + }, SUPPORTS_DNS_RESOLVE_ATTRIBUTE_ID, minInterval, maxInterval); } public void readGeneratedCommandListAttribute( @@ -15164,9 +15164,9 @@ public static class BridgedDeviceBasicInformationCluster extends BaseChipCluster public static final long CLUSTER_ID = 57L; private static final long VENDOR_NAME_ATTRIBUTE_ID = 1L; - private static final long VENDOR_I_D_ATTRIBUTE_ID = 2L; + private static final long VENDOR_ID_ATTRIBUTE_ID = 2L; private static final long PRODUCT_NAME_ATTRIBUTE_ID = 3L; - private static final long PRODUCT_I_D_ATTRIBUTE_ID = 4L; + private static final long PRODUCT_ID_ATTRIBUTE_ID = 4L; private static final long NODE_LABEL_ATTRIBUTE_ID = 5L; private static final long HARDWARE_VERSION_ATTRIBUTE_ID = 7L; private static final long HARDWARE_VERSION_STRING_ATTRIBUTE_ID = 8L; @@ -15174,11 +15174,11 @@ public static class BridgedDeviceBasicInformationCluster extends BaseChipCluster private static final long SOFTWARE_VERSION_STRING_ATTRIBUTE_ID = 10L; private static final long MANUFACTURING_DATE_ATTRIBUTE_ID = 11L; private static final long PART_NUMBER_ATTRIBUTE_ID = 12L; - private static final long PRODUCT_U_R_L_ATTRIBUTE_ID = 13L; + private static final long PRODUCT_URL_ATTRIBUTE_ID = 13L; private static final long PRODUCT_LABEL_ATTRIBUTE_ID = 14L; private static final long SERIAL_NUMBER_ATTRIBUTE_ID = 15L; private static final long REACHABLE_ATTRIBUTE_ID = 17L; - private static final long UNIQUE_I_D_ATTRIBUTE_ID = 18L; + private static final long UNIQUE_ID_ATTRIBUTE_ID = 18L; private static final long PRODUCT_APPEARANCE_ATTRIBUTE_ID = 20L; private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; @@ -15265,7 +15265,7 @@ public void onSuccess(byte[] tlv) { public void readVendorIDAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VENDOR_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VENDOR_ID_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -15273,12 +15273,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, VENDOR_I_D_ATTRIBUTE_ID, true); + }, VENDOR_ID_ATTRIBUTE_ID, true); } public void subscribeVendorIDAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VENDOR_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VENDOR_ID_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -15286,7 +15286,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, VENDOR_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + }, VENDOR_ID_ATTRIBUTE_ID, minInterval, maxInterval); } public void readProductNameAttribute( @@ -15317,7 +15317,7 @@ public void onSuccess(byte[] tlv) { public void readProductIDAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_ID_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -15325,12 +15325,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, PRODUCT_I_D_ATTRIBUTE_ID, true); + }, PRODUCT_ID_ATTRIBUTE_ID, true); } public void subscribeProductIDAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_ID_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -15338,7 +15338,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, PRODUCT_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + }, PRODUCT_ID_ATTRIBUTE_ID, minInterval, maxInterval); } public void readNodeLabelAttribute( @@ -15534,7 +15534,7 @@ public void onSuccess(byte[] tlv) { public void readProductURLAttribute( CharStringAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_U_R_L_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_URL_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -15542,12 +15542,12 @@ public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, PRODUCT_U_R_L_ATTRIBUTE_ID, true); + }, PRODUCT_URL_ATTRIBUTE_ID, true); } public void subscribeProductURLAttribute( CharStringAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_U_R_L_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_URL_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -15555,7 +15555,7 @@ public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, PRODUCT_U_R_L_ATTRIBUTE_ID, minInterval, maxInterval); + }, PRODUCT_URL_ATTRIBUTE_ID, minInterval, maxInterval); } public void readProductLabelAttribute( @@ -15638,7 +15638,7 @@ public void onSuccess(byte[] tlv) { public void readUniqueIDAttribute( CharStringAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, UNIQUE_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, UNIQUE_ID_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -15646,12 +15646,12 @@ public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, UNIQUE_I_D_ATTRIBUTE_ID, true); + }, UNIQUE_ID_ATTRIBUTE_ID, true); } public void subscribeUniqueIDAttribute( CharStringAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, UNIQUE_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, UNIQUE_ID_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -15659,7 +15659,7 @@ public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, UNIQUE_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + }, UNIQUE_ID_ATTRIBUTE_ID, minInterval, maxInterval); } public void readProductAppearanceAttribute( @@ -16467,7 +16467,7 @@ public void onSuccess(byte[] tlv) { public static class OperationalCredentialsCluster extends BaseChipCluster { public static final long CLUSTER_ID = 62L; - private static final long N_O_CS_ATTRIBUTE_ID = 0L; + private static final long NO_CS_ATTRIBUTE_ID = 0L; private static final long FABRICS_ATTRIBUTE_ID = 1L; private static final long SUPPORTED_FABRICS_ATTRIBUTE_ID = 2L; private static final long COMMISSIONED_FABRICS_ATTRIBUTE_ID = 3L; @@ -16865,7 +16865,7 @@ public void readNOCsAttribute( public void readNOCsAttributeWithFabricFilter( NOCsAttributeCallback callback, boolean isFabricFiltered) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, N_O_CS_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NO_CS_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -16873,12 +16873,12 @@ public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, N_O_CS_ATTRIBUTE_ID, isFabricFiltered); + }, NO_CS_ATTRIBUTE_ID, isFabricFiltered); } public void subscribeNOCsAttribute( NOCsAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, N_O_CS_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NO_CS_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -16886,7 +16886,7 @@ public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, N_O_CS_ATTRIBUTE_ID, minInterval, maxInterval); + }, NO_CS_ATTRIBUTE_ID, minInterval, maxInterval); } public void readFabricsAttribute( @@ -18876,7 +18876,7 @@ public static class IcdManagementCluster extends BaseChipCluster { private static final long ACTIVE_MODE_DURATION_ATTRIBUTE_ID = 1L; private static final long ACTIVE_MODE_THRESHOLD_ATTRIBUTE_ID = 2L; private static final long REGISTERED_CLIENTS_ATTRIBUTE_ID = 3L; - private static final long I_C_D_COUNTER_ATTRIBUTE_ID = 4L; + private static final long ICD_COUNTER_ATTRIBUTE_ID = 4L; private static final long CLIENTS_SUPPORTED_PER_FABRIC_ATTRIBUTE_ID = 5L; private static final long USER_ACTIVE_MODE_TRIGGER_HINT_ATTRIBUTE_ID = 6L; private static final long USER_ACTIVE_MODE_TRIGGER_INSTRUCTION_ATTRIBUTE_ID = 7L; @@ -19138,7 +19138,7 @@ public void onSuccess(byte[] tlv) { public void readICDCounterAttribute( LongAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, I_C_D_COUNTER_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ICD_COUNTER_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -19146,12 +19146,12 @@ public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, I_C_D_COUNTER_ATTRIBUTE_ID, true); + }, ICD_COUNTER_ATTRIBUTE_ID, true); } public void subscribeICDCounterAttribute( LongAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, I_C_D_COUNTER_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ICD_COUNTER_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -19159,7 +19159,7 @@ public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, I_C_D_COUNTER_ATTRIBUTE_ID, minInterval, maxInterval); + }, ICD_COUNTER_ATTRIBUTE_ID, minInterval, maxInterval); } public void readClientsSupportedPerFabricAttribute( @@ -24240,14 +24240,14 @@ public static class SmokeCoAlarmCluster extends BaseChipCluster { private static final long EXPRESSED_STATE_ATTRIBUTE_ID = 0L; private static final long SMOKE_STATE_ATTRIBUTE_ID = 1L; - private static final long C_O_STATE_ATTRIBUTE_ID = 2L; + private static final long CO_STATE_ATTRIBUTE_ID = 2L; private static final long BATTERY_ALERT_ATTRIBUTE_ID = 3L; private static final long DEVICE_MUTED_ATTRIBUTE_ID = 4L; private static final long TEST_IN_PROGRESS_ATTRIBUTE_ID = 5L; private static final long HARDWARE_FAULT_ALERT_ATTRIBUTE_ID = 6L; private static final long END_OF_SERVICE_ALERT_ATTRIBUTE_ID = 7L; private static final long INTERCONNECT_SMOKE_ALARM_ATTRIBUTE_ID = 8L; - private static final long INTERCONNECT_C_O_ALARM_ATTRIBUTE_ID = 9L; + private static final long INTERCONNECT_CO_ALARM_ATTRIBUTE_ID = 9L; private static final long CONTAMINATION_STATE_ATTRIBUTE_ID = 10L; private static final long SMOKE_SENSITIVITY_LEVEL_ATTRIBUTE_ID = 11L; private static final long EXPIRY_DATE_ATTRIBUTE_ID = 12L; @@ -24354,7 +24354,7 @@ public void onSuccess(byte[] tlv) { public void readCOStateAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, C_O_STATE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CO_STATE_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -24362,12 +24362,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, C_O_STATE_ATTRIBUTE_ID, true); + }, CO_STATE_ATTRIBUTE_ID, true); } public void subscribeCOStateAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, C_O_STATE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CO_STATE_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -24375,7 +24375,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, C_O_STATE_ATTRIBUTE_ID, minInterval, maxInterval); + }, CO_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } public void readBatteryAlertAttribute( @@ -24536,7 +24536,7 @@ public void onSuccess(byte[] tlv) { public void readInterconnectCOAlarmAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, INTERCONNECT_C_O_ALARM_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, INTERCONNECT_CO_ALARM_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -24544,12 +24544,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, INTERCONNECT_C_O_ALARM_ATTRIBUTE_ID, true); + }, INTERCONNECT_CO_ALARM_ATTRIBUTE_ID, true); } public void subscribeInterconnectCOAlarmAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, INTERCONNECT_C_O_ALARM_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, INTERCONNECT_CO_ALARM_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -24557,7 +24557,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, INTERCONNECT_C_O_ALARM_ATTRIBUTE_ID, minInterval, maxInterval); + }, INTERCONNECT_CO_ALARM_ATTRIBUTE_ID, minInterval, maxInterval); } public void readContaminationStateAttribute( @@ -29376,9 +29376,9 @@ public static class ElectricalPowerMeasurementCluster extends BaseChipCluster { private static final long ACTIVE_POWER_ATTRIBUTE_ID = 8L; private static final long REACTIVE_POWER_ATTRIBUTE_ID = 9L; private static final long APPARENT_POWER_ATTRIBUTE_ID = 10L; - private static final long R_M_S_VOLTAGE_ATTRIBUTE_ID = 11L; - private static final long R_M_S_CURRENT_ATTRIBUTE_ID = 12L; - private static final long R_M_S_POWER_ATTRIBUTE_ID = 13L; + private static final long RMS_VOLTAGE_ATTRIBUTE_ID = 11L; + private static final long RMS_CURRENT_ATTRIBUTE_ID = 12L; + private static final long RMS_POWER_ATTRIBUTE_ID = 13L; private static final long FREQUENCY_ATTRIBUTE_ID = 14L; private static final long HARMONIC_CURRENTS_ATTRIBUTE_ID = 15L; private static final long HARMONIC_PHASES_ATTRIBUTE_ID = 16L; @@ -29773,7 +29773,7 @@ public void onSuccess(byte[] tlv) { public void readRMSVoltageAttribute( RMSVoltageAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, R_M_S_VOLTAGE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, RMS_VOLTAGE_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -29781,12 +29781,12 @@ public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, R_M_S_VOLTAGE_ATTRIBUTE_ID, true); + }, RMS_VOLTAGE_ATTRIBUTE_ID, true); } public void subscribeRMSVoltageAttribute( RMSVoltageAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, R_M_S_VOLTAGE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, RMS_VOLTAGE_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -29794,12 +29794,12 @@ public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, R_M_S_VOLTAGE_ATTRIBUTE_ID, minInterval, maxInterval); + }, RMS_VOLTAGE_ATTRIBUTE_ID, minInterval, maxInterval); } public void readRMSCurrentAttribute( RMSCurrentAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, R_M_S_CURRENT_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, RMS_CURRENT_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -29807,12 +29807,12 @@ public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, R_M_S_CURRENT_ATTRIBUTE_ID, true); + }, RMS_CURRENT_ATTRIBUTE_ID, true); } public void subscribeRMSCurrentAttribute( RMSCurrentAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, R_M_S_CURRENT_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, RMS_CURRENT_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -29820,12 +29820,12 @@ public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, R_M_S_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); + }, RMS_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } public void readRMSPowerAttribute( RMSPowerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, R_M_S_POWER_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, RMS_POWER_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -29833,12 +29833,12 @@ public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, R_M_S_POWER_ATTRIBUTE_ID, true); + }, RMS_POWER_ATTRIBUTE_ID, true); } public void subscribeRMSPowerAttribute( RMSPowerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, R_M_S_POWER_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, RMS_POWER_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -29846,7 +29846,7 @@ public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, R_M_S_POWER_ATTRIBUTE_ID, minInterval, maxInterval); + }, RMS_POWER_ATTRIBUTE_ID, minInterval, maxInterval); } public void readFrequencyAttribute( @@ -31767,9 +31767,9 @@ public void onSuccess(byte[] tlv) { public static class DeviceEnergyManagementCluster extends BaseChipCluster { public static final long CLUSTER_ID = 152L; - private static final long E_S_A_TYPE_ATTRIBUTE_ID = 0L; - private static final long E_S_A_CAN_GENERATE_ATTRIBUTE_ID = 1L; - private static final long E_S_A_STATE_ATTRIBUTE_ID = 2L; + private static final long ESA_TYPE_ATTRIBUTE_ID = 0L; + private static final long ESA_CAN_GENERATE_ATTRIBUTE_ID = 1L; + private static final long ESA_STATE_ATTRIBUTE_ID = 2L; private static final long ABS_MIN_POWER_ATTRIBUTE_ID = 3L; private static final long ABS_MAX_POWER_ATTRIBUTE_ID = 4L; private static final long POWER_ADJUSTMENT_CAPABILITY_ATTRIBUTE_ID = 5L; @@ -31994,7 +31994,7 @@ public interface AttributeListAttributeCallback extends BaseAttributeCallback { public void readESATypeAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, E_S_A_TYPE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ESA_TYPE_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -32002,12 +32002,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, E_S_A_TYPE_ATTRIBUTE_ID, true); + }, ESA_TYPE_ATTRIBUTE_ID, true); } public void subscribeESATypeAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, E_S_A_TYPE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ESA_TYPE_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -32015,12 +32015,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, E_S_A_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); + }, ESA_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } public void readESACanGenerateAttribute( BooleanAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, E_S_A_CAN_GENERATE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ESA_CAN_GENERATE_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -32028,12 +32028,12 @@ public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, E_S_A_CAN_GENERATE_ATTRIBUTE_ID, true); + }, ESA_CAN_GENERATE_ATTRIBUTE_ID, true); } public void subscribeESACanGenerateAttribute( BooleanAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, E_S_A_CAN_GENERATE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ESA_CAN_GENERATE_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -32041,12 +32041,12 @@ public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, E_S_A_CAN_GENERATE_ATTRIBUTE_ID, minInterval, maxInterval); + }, ESA_CAN_GENERATE_ATTRIBUTE_ID, minInterval, maxInterval); } public void readESAStateAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, E_S_A_STATE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ESA_STATE_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -32054,12 +32054,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, E_S_A_STATE_ATTRIBUTE_ID, true); + }, ESA_STATE_ATTRIBUTE_ID, true); } public void subscribeESAStateAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, E_S_A_STATE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ESA_STATE_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -32067,7 +32067,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, E_S_A_STATE_ATTRIBUTE_ID, minInterval, maxInterval); + }, ESA_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } public void readAbsMinPowerAttribute( @@ -32375,11 +32375,11 @@ public static class EnergyEvseCluster extends BaseChipCluster { private static final long NEXT_CHARGE_TARGET_TIME_ATTRIBUTE_ID = 36L; private static final long NEXT_CHARGE_REQUIRED_ENERGY_ATTRIBUTE_ID = 37L; private static final long NEXT_CHARGE_TARGET_SO_C_ATTRIBUTE_ID = 38L; - private static final long APPROXIMATE_E_V_EFFICIENCY_ATTRIBUTE_ID = 39L; + private static final long APPROXIMATE_EV_EFFICIENCY_ATTRIBUTE_ID = 39L; private static final long STATE_OF_CHARGE_ATTRIBUTE_ID = 48L; private static final long BATTERY_CAPACITY_ATTRIBUTE_ID = 49L; - private static final long VEHICLE_I_D_ATTRIBUTE_ID = 50L; - private static final long SESSION_I_D_ATTRIBUTE_ID = 64L; + private static final long VEHICLE_ID_ATTRIBUTE_ID = 50L; + private static final long SESSION_ID_ATTRIBUTE_ID = 64L; private static final long SESSION_DURATION_ATTRIBUTE_ID = 65L; private static final long SESSION_ENERGY_CHARGED_ATTRIBUTE_ID = 66L; private static final long SESSION_ENERGY_DISCHARGED_ATTRIBUTE_ID = 67L; @@ -33015,7 +33015,7 @@ public void onSuccess(byte[] tlv) { public void readApproximateEVEfficiencyAttribute( ApproximateEVEfficiencyAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, APPROXIMATE_E_V_EFFICIENCY_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, APPROXIMATE_EV_EFFICIENCY_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -33023,7 +33023,7 @@ public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, APPROXIMATE_E_V_EFFICIENCY_ATTRIBUTE_ID, true); + }, APPROXIMATE_EV_EFFICIENCY_ATTRIBUTE_ID, true); } public void writeApproximateEVEfficiencyAttribute(DefaultClusterCallback callback, Integer value) { @@ -33032,12 +33032,12 @@ public void writeApproximateEVEfficiencyAttribute(DefaultClusterCallback callbac public void writeApproximateEVEfficiencyAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = value != null ? new UIntType(value) : new NullType(); - writeAttribute(new WriteAttributesCallbackImpl(callback), APPROXIMATE_E_V_EFFICIENCY_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), APPROXIMATE_EV_EFFICIENCY_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribeApproximateEVEfficiencyAttribute( ApproximateEVEfficiencyAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, APPROXIMATE_E_V_EFFICIENCY_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, APPROXIMATE_EV_EFFICIENCY_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -33045,7 +33045,7 @@ public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, APPROXIMATE_E_V_EFFICIENCY_ATTRIBUTE_ID, minInterval, maxInterval); + }, APPROXIMATE_EV_EFFICIENCY_ATTRIBUTE_ID, minInterval, maxInterval); } public void readStateOfChargeAttribute( @@ -33102,7 +33102,7 @@ public void onSuccess(byte[] tlv) { public void readVehicleIDAttribute( VehicleIDAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VEHICLE_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VEHICLE_ID_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -33110,12 +33110,12 @@ public void onSuccess(byte[] tlv) { @Nullable String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, VEHICLE_I_D_ATTRIBUTE_ID, true); + }, VEHICLE_ID_ATTRIBUTE_ID, true); } public void subscribeVehicleIDAttribute( VehicleIDAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VEHICLE_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VEHICLE_ID_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -33123,12 +33123,12 @@ public void onSuccess(byte[] tlv) { @Nullable String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, VEHICLE_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + }, VEHICLE_ID_ATTRIBUTE_ID, minInterval, maxInterval); } public void readSessionIDAttribute( SessionIDAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_ID_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -33136,12 +33136,12 @@ public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, SESSION_I_D_ATTRIBUTE_ID, true); + }, SESSION_ID_ATTRIBUTE_ID, true); } public void subscribeSessionIDAttribute( SessionIDAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SESSION_ID_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -33149,7 +33149,7 @@ public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, SESSION_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + }, SESSION_ID_ATTRIBUTE_ID, minInterval, maxInterval); } public void readSessionDurationAttribute( @@ -35127,19 +35127,19 @@ public static class DoorLockCluster extends BaseChipCluster { private static final long DOOR_CLOSED_EVENTS_ATTRIBUTE_ID = 5L; private static final long OPEN_PERIOD_ATTRIBUTE_ID = 6L; private static final long NUMBER_OF_TOTAL_USERS_SUPPORTED_ATTRIBUTE_ID = 17L; - private static final long NUMBER_OF_P_I_N_USERS_SUPPORTED_ATTRIBUTE_ID = 18L; - private static final long NUMBER_OF_R_F_I_D_USERS_SUPPORTED_ATTRIBUTE_ID = 19L; + private static final long NUMBER_OF_PIN_USERS_SUPPORTED_ATTRIBUTE_ID = 18L; + private static final long NUMBER_OF_RFID_USERS_SUPPORTED_ATTRIBUTE_ID = 19L; private static final long NUMBER_OF_WEEK_DAY_SCHEDULES_SUPPORTED_PER_USER_ATTRIBUTE_ID = 20L; private static final long NUMBER_OF_YEAR_DAY_SCHEDULES_SUPPORTED_PER_USER_ATTRIBUTE_ID = 21L; private static final long NUMBER_OF_HOLIDAY_SCHEDULES_SUPPORTED_ATTRIBUTE_ID = 22L; - private static final long MAX_P_I_N_CODE_LENGTH_ATTRIBUTE_ID = 23L; - private static final long MIN_P_I_N_CODE_LENGTH_ATTRIBUTE_ID = 24L; - private static final long MAX_R_F_I_D_CODE_LENGTH_ATTRIBUTE_ID = 25L; - private static final long MIN_R_F_I_D_CODE_LENGTH_ATTRIBUTE_ID = 26L; + private static final long MAX_PIN_CODE_LENGTH_ATTRIBUTE_ID = 23L; + private static final long MIN_PIN_CODE_LENGTH_ATTRIBUTE_ID = 24L; + private static final long MAX_RFID_CODE_LENGTH_ATTRIBUTE_ID = 25L; + private static final long MIN_RFID_CODE_LENGTH_ATTRIBUTE_ID = 26L; private static final long CREDENTIAL_RULES_SUPPORT_ATTRIBUTE_ID = 27L; private static final long NUMBER_OF_CREDENTIALS_SUPPORTED_PER_USER_ATTRIBUTE_ID = 28L; private static final long LANGUAGE_ATTRIBUTE_ID = 33L; - private static final long L_E_D_SETTINGS_ATTRIBUTE_ID = 34L; + private static final long LED_SETTINGS_ATTRIBUTE_ID = 34L; private static final long AUTO_RELOCK_TIME_ATTRIBUTE_ID = 35L; private static final long SOUND_VOLUME_ATTRIBUTE_ID = 36L; private static final long OPERATING_MODE_ATTRIBUTE_ID = 37L; @@ -35147,21 +35147,21 @@ public static class DoorLockCluster extends BaseChipCluster { private static final long DEFAULT_CONFIGURATION_REGISTER_ATTRIBUTE_ID = 39L; private static final long ENABLE_LOCAL_PROGRAMMING_ATTRIBUTE_ID = 40L; private static final long ENABLE_ONE_TOUCH_LOCKING_ATTRIBUTE_ID = 41L; - private static final long ENABLE_INSIDE_STATUS_L_E_D_ATTRIBUTE_ID = 42L; + private static final long ENABLE_INSIDE_STATUS_LED_ATTRIBUTE_ID = 42L; private static final long ENABLE_PRIVACY_MODE_BUTTON_ATTRIBUTE_ID = 43L; private static final long LOCAL_PROGRAMMING_FEATURES_ATTRIBUTE_ID = 44L; private static final long WRONG_CODE_ENTRY_LIMIT_ATTRIBUTE_ID = 48L; private static final long USER_CODE_TEMPORARY_DISABLE_TIME_ATTRIBUTE_ID = 49L; - private static final long SEND_P_I_N_OVER_THE_AIR_ATTRIBUTE_ID = 50L; - private static final long REQUIRE_P_I_NFOR_REMOTE_OPERATION_ATTRIBUTE_ID = 51L; + private static final long SEND_PIN_OVER_THE_AIR_ATTRIBUTE_ID = 50L; + private static final long REQUIRE_PI_NFOR_REMOTE_OPERATION_ATTRIBUTE_ID = 51L; private static final long EXPIRING_USER_TIMEOUT_ATTRIBUTE_ID = 53L; private static final long ALIRO_READER_VERIFICATION_KEY_ATTRIBUTE_ID = 128L; private static final long ALIRO_READER_GROUP_IDENTIFIER_ATTRIBUTE_ID = 129L; private static final long ALIRO_READER_GROUP_SUB_IDENTIFIER_ATTRIBUTE_ID = 130L; private static final long ALIRO_EXPEDITED_TRANSACTION_SUPPORTED_PROTOCOL_VERSIONS_ATTRIBUTE_ID = 131L; private static final long ALIRO_GROUP_RESOLVING_KEY_ATTRIBUTE_ID = 132L; - private static final long ALIRO_SUPPORTED_B_L_E_U_W_B_PROTOCOL_VERSIONS_ATTRIBUTE_ID = 133L; - private static final long ALIRO_B_L_E_ADVERTISING_VERSION_ATTRIBUTE_ID = 134L; + private static final long ALIRO_SUPPORTED_BLEUWB_PROTOCOL_VERSIONS_ATTRIBUTE_ID = 133L; + private static final long ALIRO_BLE_ADVERTISING_VERSION_ATTRIBUTE_ID = 134L; private static final long NUMBER_OF_ALIRO_CREDENTIAL_ISSUER_KEYS_SUPPORTED_ATTRIBUTE_ID = 135L; private static final long NUMBER_OF_ALIRO_ENDPOINT_KEYS_SUPPORTED_ATTRIBUTE_ID = 136L; private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; @@ -36266,7 +36266,7 @@ public void onSuccess(byte[] tlv) { public void readNumberOfPINUsersSupportedAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_P_I_N_USERS_SUPPORTED_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_PIN_USERS_SUPPORTED_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -36274,12 +36274,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, NUMBER_OF_P_I_N_USERS_SUPPORTED_ATTRIBUTE_ID, true); + }, NUMBER_OF_PIN_USERS_SUPPORTED_ATTRIBUTE_ID, true); } public void subscribeNumberOfPINUsersSupportedAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_P_I_N_USERS_SUPPORTED_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_PIN_USERS_SUPPORTED_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -36287,12 +36287,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, NUMBER_OF_P_I_N_USERS_SUPPORTED_ATTRIBUTE_ID, minInterval, maxInterval); + }, NUMBER_OF_PIN_USERS_SUPPORTED_ATTRIBUTE_ID, minInterval, maxInterval); } public void readNumberOfRFIDUsersSupportedAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_R_F_I_D_USERS_SUPPORTED_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_RFID_USERS_SUPPORTED_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -36300,12 +36300,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, NUMBER_OF_R_F_I_D_USERS_SUPPORTED_ATTRIBUTE_ID, true); + }, NUMBER_OF_RFID_USERS_SUPPORTED_ATTRIBUTE_ID, true); } public void subscribeNumberOfRFIDUsersSupportedAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_R_F_I_D_USERS_SUPPORTED_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, NUMBER_OF_RFID_USERS_SUPPORTED_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -36313,7 +36313,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, NUMBER_OF_R_F_I_D_USERS_SUPPORTED_ATTRIBUTE_ID, minInterval, maxInterval); + }, NUMBER_OF_RFID_USERS_SUPPORTED_ATTRIBUTE_ID, minInterval, maxInterval); } public void readNumberOfWeekDaySchedulesSupportedPerUserAttribute( @@ -36396,7 +36396,7 @@ public void onSuccess(byte[] tlv) { public void readMaxPINCodeLengthAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MAX_P_I_N_CODE_LENGTH_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MAX_PIN_CODE_LENGTH_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -36404,12 +36404,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, MAX_P_I_N_CODE_LENGTH_ATTRIBUTE_ID, true); + }, MAX_PIN_CODE_LENGTH_ATTRIBUTE_ID, true); } public void subscribeMaxPINCodeLengthAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MAX_P_I_N_CODE_LENGTH_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MAX_PIN_CODE_LENGTH_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -36417,12 +36417,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, MAX_P_I_N_CODE_LENGTH_ATTRIBUTE_ID, minInterval, maxInterval); + }, MAX_PIN_CODE_LENGTH_ATTRIBUTE_ID, minInterval, maxInterval); } public void readMinPINCodeLengthAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MIN_P_I_N_CODE_LENGTH_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MIN_PIN_CODE_LENGTH_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -36430,12 +36430,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, MIN_P_I_N_CODE_LENGTH_ATTRIBUTE_ID, true); + }, MIN_PIN_CODE_LENGTH_ATTRIBUTE_ID, true); } public void subscribeMinPINCodeLengthAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MIN_P_I_N_CODE_LENGTH_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MIN_PIN_CODE_LENGTH_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -36443,12 +36443,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, MIN_P_I_N_CODE_LENGTH_ATTRIBUTE_ID, minInterval, maxInterval); + }, MIN_PIN_CODE_LENGTH_ATTRIBUTE_ID, minInterval, maxInterval); } public void readMaxRFIDCodeLengthAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MAX_R_F_I_D_CODE_LENGTH_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MAX_RFID_CODE_LENGTH_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -36456,12 +36456,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, MAX_R_F_I_D_CODE_LENGTH_ATTRIBUTE_ID, true); + }, MAX_RFID_CODE_LENGTH_ATTRIBUTE_ID, true); } public void subscribeMaxRFIDCodeLengthAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MAX_R_F_I_D_CODE_LENGTH_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MAX_RFID_CODE_LENGTH_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -36469,12 +36469,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, MAX_R_F_I_D_CODE_LENGTH_ATTRIBUTE_ID, minInterval, maxInterval); + }, MAX_RFID_CODE_LENGTH_ATTRIBUTE_ID, minInterval, maxInterval); } public void readMinRFIDCodeLengthAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MIN_R_F_I_D_CODE_LENGTH_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MIN_RFID_CODE_LENGTH_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -36482,12 +36482,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, MIN_R_F_I_D_CODE_LENGTH_ATTRIBUTE_ID, true); + }, MIN_RFID_CODE_LENGTH_ATTRIBUTE_ID, true); } public void subscribeMinRFIDCodeLengthAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MIN_R_F_I_D_CODE_LENGTH_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MIN_RFID_CODE_LENGTH_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -36495,7 +36495,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, MIN_R_F_I_D_CODE_LENGTH_ATTRIBUTE_ID, minInterval, maxInterval); + }, MIN_RFID_CODE_LENGTH_ATTRIBUTE_ID, minInterval, maxInterval); } public void readCredentialRulesSupportAttribute( @@ -36587,7 +36587,7 @@ public void onSuccess(byte[] tlv) { public void readLEDSettingsAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, L_E_D_SETTINGS_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, LED_SETTINGS_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -36595,7 +36595,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, L_E_D_SETTINGS_ATTRIBUTE_ID, true); + }, LED_SETTINGS_ATTRIBUTE_ID, true); } public void writeLEDSettingsAttribute(DefaultClusterCallback callback, Integer value) { @@ -36604,12 +36604,12 @@ public void writeLEDSettingsAttribute(DefaultClusterCallback callback, Integer v public void writeLEDSettingsAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), L_E_D_SETTINGS_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), LED_SETTINGS_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribeLEDSettingsAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, L_E_D_SETTINGS_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, LED_SETTINGS_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -36617,7 +36617,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, L_E_D_SETTINGS_ATTRIBUTE_ID, minInterval, maxInterval); + }, LED_SETTINGS_ATTRIBUTE_ID, minInterval, maxInterval); } public void readAutoRelockTimeAttribute( @@ -36849,7 +36849,7 @@ public void onSuccess(byte[] tlv) { public void readEnableInsideStatusLEDAttribute( BooleanAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ENABLE_INSIDE_STATUS_L_E_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ENABLE_INSIDE_STATUS_LED_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -36857,7 +36857,7 @@ public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, ENABLE_INSIDE_STATUS_L_E_D_ATTRIBUTE_ID, true); + }, ENABLE_INSIDE_STATUS_LED_ATTRIBUTE_ID, true); } public void writeEnableInsideStatusLEDAttribute(DefaultClusterCallback callback, Boolean value) { @@ -36866,12 +36866,12 @@ public void writeEnableInsideStatusLEDAttribute(DefaultClusterCallback callback, public void writeEnableInsideStatusLEDAttribute(DefaultClusterCallback callback, Boolean value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new BooleanType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), ENABLE_INSIDE_STATUS_L_E_D_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), ENABLE_INSIDE_STATUS_LED_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribeEnableInsideStatusLEDAttribute( BooleanAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ENABLE_INSIDE_STATUS_L_E_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ENABLE_INSIDE_STATUS_LED_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -36879,7 +36879,7 @@ public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, ENABLE_INSIDE_STATUS_L_E_D_ATTRIBUTE_ID, minInterval, maxInterval); + }, ENABLE_INSIDE_STATUS_LED_ATTRIBUTE_ID, minInterval, maxInterval); } public void readEnablePrivacyModeButtonAttribute( @@ -37024,7 +37024,7 @@ public void onSuccess(byte[] tlv) { public void readSendPINOverTheAirAttribute( BooleanAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SEND_P_I_N_OVER_THE_AIR_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SEND_PIN_OVER_THE_AIR_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -37032,7 +37032,7 @@ public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, SEND_P_I_N_OVER_THE_AIR_ATTRIBUTE_ID, true); + }, SEND_PIN_OVER_THE_AIR_ATTRIBUTE_ID, true); } public void writeSendPINOverTheAirAttribute(DefaultClusterCallback callback, Boolean value) { @@ -37041,12 +37041,12 @@ public void writeSendPINOverTheAirAttribute(DefaultClusterCallback callback, Boo public void writeSendPINOverTheAirAttribute(DefaultClusterCallback callback, Boolean value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new BooleanType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), SEND_P_I_N_OVER_THE_AIR_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), SEND_PIN_OVER_THE_AIR_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribeSendPINOverTheAirAttribute( BooleanAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SEND_P_I_N_OVER_THE_AIR_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SEND_PIN_OVER_THE_AIR_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -37054,12 +37054,12 @@ public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, SEND_P_I_N_OVER_THE_AIR_ATTRIBUTE_ID, minInterval, maxInterval); + }, SEND_PIN_OVER_THE_AIR_ATTRIBUTE_ID, minInterval, maxInterval); } public void readRequirePINforRemoteOperationAttribute( BooleanAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, REQUIRE_P_I_NFOR_REMOTE_OPERATION_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, REQUIRE_PI_NFOR_REMOTE_OPERATION_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -37067,7 +37067,7 @@ public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, REQUIRE_P_I_NFOR_REMOTE_OPERATION_ATTRIBUTE_ID, true); + }, REQUIRE_PI_NFOR_REMOTE_OPERATION_ATTRIBUTE_ID, true); } public void writeRequirePINforRemoteOperationAttribute(DefaultClusterCallback callback, Boolean value) { @@ -37076,12 +37076,12 @@ public void writeRequirePINforRemoteOperationAttribute(DefaultClusterCallback ca public void writeRequirePINforRemoteOperationAttribute(DefaultClusterCallback callback, Boolean value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new BooleanType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), REQUIRE_P_I_NFOR_REMOTE_OPERATION_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), REQUIRE_PI_NFOR_REMOTE_OPERATION_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribeRequirePINforRemoteOperationAttribute( BooleanAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, REQUIRE_P_I_NFOR_REMOTE_OPERATION_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, REQUIRE_PI_NFOR_REMOTE_OPERATION_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -37089,7 +37089,7 @@ public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, REQUIRE_P_I_NFOR_REMOTE_OPERATION_ATTRIBUTE_ID, minInterval, maxInterval); + }, REQUIRE_PI_NFOR_REMOTE_OPERATION_ATTRIBUTE_ID, minInterval, maxInterval); } public void readExpiringUserTimeoutAttribute( @@ -37259,7 +37259,7 @@ public void onSuccess(byte[] tlv) { public void readAliroSupportedBLEUWBProtocolVersionsAttribute( AliroSupportedBLEUWBProtocolVersionsAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ALIRO_SUPPORTED_B_L_E_U_W_B_PROTOCOL_VERSIONS_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ALIRO_SUPPORTED_BLEUWB_PROTOCOL_VERSIONS_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -37267,12 +37267,12 @@ public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, ALIRO_SUPPORTED_B_L_E_U_W_B_PROTOCOL_VERSIONS_ATTRIBUTE_ID, true); + }, ALIRO_SUPPORTED_BLEUWB_PROTOCOL_VERSIONS_ATTRIBUTE_ID, true); } public void subscribeAliroSupportedBLEUWBProtocolVersionsAttribute( AliroSupportedBLEUWBProtocolVersionsAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ALIRO_SUPPORTED_B_L_E_U_W_B_PROTOCOL_VERSIONS_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ALIRO_SUPPORTED_BLEUWB_PROTOCOL_VERSIONS_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -37280,12 +37280,12 @@ public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, ALIRO_SUPPORTED_B_L_E_U_W_B_PROTOCOL_VERSIONS_ATTRIBUTE_ID, minInterval, maxInterval); + }, ALIRO_SUPPORTED_BLEUWB_PROTOCOL_VERSIONS_ATTRIBUTE_ID, minInterval, maxInterval); } public void readAliroBLEAdvertisingVersionAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ALIRO_B_L_E_ADVERTISING_VERSION_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ALIRO_BLE_ADVERTISING_VERSION_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -37293,12 +37293,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, ALIRO_B_L_E_ADVERTISING_VERSION_ATTRIBUTE_ID, true); + }, ALIRO_BLE_ADVERTISING_VERSION_ATTRIBUTE_ID, true); } public void subscribeAliroBLEAdvertisingVersionAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ALIRO_B_L_E_ADVERTISING_VERSION_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ALIRO_BLE_ADVERTISING_VERSION_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -37306,7 +37306,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, ALIRO_B_L_E_ADVERTISING_VERSION_ATTRIBUTE_ID, minInterval, maxInterval); + }, ALIRO_BLE_ADVERTISING_VERSION_ATTRIBUTE_ID, minInterval, maxInterval); } public void readNumberOfAliroCredentialIssuerKeysSupportedAttribute( @@ -40420,9 +40420,9 @@ public static class ThermostatCluster extends BaseChipCluster { private static final long ABS_MAX_HEAT_SETPOINT_LIMIT_ATTRIBUTE_ID = 4L; private static final long ABS_MIN_COOL_SETPOINT_LIMIT_ATTRIBUTE_ID = 5L; private static final long ABS_MAX_COOL_SETPOINT_LIMIT_ATTRIBUTE_ID = 6L; - private static final long P_I_COOLING_DEMAND_ATTRIBUTE_ID = 7L; - private static final long P_I_HEATING_DEMAND_ATTRIBUTE_ID = 8L; - private static final long H_V_A_C_SYSTEM_TYPE_CONFIGURATION_ATTRIBUTE_ID = 9L; + private static final long PI_COOLING_DEMAND_ATTRIBUTE_ID = 7L; + private static final long PI_HEATING_DEMAND_ATTRIBUTE_ID = 8L; + private static final long HVAC_SYSTEM_TYPE_CONFIGURATION_ATTRIBUTE_ID = 9L; private static final long LOCAL_TEMPERATURE_CALIBRATION_ATTRIBUTE_ID = 16L; private static final long OCCUPIED_COOLING_SETPOINT_ATTRIBUTE_ID = 17L; private static final long OCCUPIED_HEATING_SETPOINT_ATTRIBUTE_ID = 18L; @@ -40454,14 +40454,14 @@ public static class ThermostatCluster extends BaseChipCluster { private static final long UNOCCUPIED_SETBACK_MIN_ATTRIBUTE_ID = 56L; private static final long UNOCCUPIED_SETBACK_MAX_ATTRIBUTE_ID = 57L; private static final long EMERGENCY_HEAT_DELTA_ATTRIBUTE_ID = 58L; - private static final long A_C_TYPE_ATTRIBUTE_ID = 64L; - private static final long A_C_CAPACITY_ATTRIBUTE_ID = 65L; - private static final long A_C_REFRIGERANT_TYPE_ATTRIBUTE_ID = 66L; - private static final long A_C_COMPRESSOR_TYPE_ATTRIBUTE_ID = 67L; - private static final long A_C_ERROR_CODE_ATTRIBUTE_ID = 68L; - private static final long A_C_LOUVER_POSITION_ATTRIBUTE_ID = 69L; - private static final long A_C_COIL_TEMPERATURE_ATTRIBUTE_ID = 70L; - private static final long A_C_CAPACITYFORMAT_ATTRIBUTE_ID = 71L; + private static final long AC_TYPE_ATTRIBUTE_ID = 64L; + private static final long AC_CAPACITY_ATTRIBUTE_ID = 65L; + private static final long AC_REFRIGERANT_TYPE_ATTRIBUTE_ID = 66L; + private static final long AC_COMPRESSOR_TYPE_ATTRIBUTE_ID = 67L; + private static final long AC_ERROR_CODE_ATTRIBUTE_ID = 68L; + private static final long AC_LOUVER_POSITION_ATTRIBUTE_ID = 69L; + private static final long AC_COIL_TEMPERATURE_ATTRIBUTE_ID = 70L; + private static final long AC_CAPACITYFORMAT_ATTRIBUTE_ID = 71L; private static final long PRESET_TYPES_ATTRIBUTE_ID = 72L; private static final long SCHEDULE_TYPES_ATTRIBUTE_ID = 73L; private static final long NUMBER_OF_PRESETS_ATTRIBUTE_ID = 74L; @@ -40993,7 +40993,7 @@ public void onSuccess(byte[] tlv) { public void readPICoolingDemandAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, P_I_COOLING_DEMAND_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PI_COOLING_DEMAND_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -41001,12 +41001,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, P_I_COOLING_DEMAND_ATTRIBUTE_ID, true); + }, PI_COOLING_DEMAND_ATTRIBUTE_ID, true); } public void subscribePICoolingDemandAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, P_I_COOLING_DEMAND_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PI_COOLING_DEMAND_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -41014,12 +41014,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, P_I_COOLING_DEMAND_ATTRIBUTE_ID, minInterval, maxInterval); + }, PI_COOLING_DEMAND_ATTRIBUTE_ID, minInterval, maxInterval); } public void readPIHeatingDemandAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, P_I_HEATING_DEMAND_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PI_HEATING_DEMAND_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -41027,12 +41027,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, P_I_HEATING_DEMAND_ATTRIBUTE_ID, true); + }, PI_HEATING_DEMAND_ATTRIBUTE_ID, true); } public void subscribePIHeatingDemandAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, P_I_HEATING_DEMAND_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PI_HEATING_DEMAND_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -41040,12 +41040,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, P_I_HEATING_DEMAND_ATTRIBUTE_ID, minInterval, maxInterval); + }, PI_HEATING_DEMAND_ATTRIBUTE_ID, minInterval, maxInterval); } public void readHVACSystemTypeConfigurationAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, H_V_A_C_SYSTEM_TYPE_CONFIGURATION_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, HVAC_SYSTEM_TYPE_CONFIGURATION_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -41053,7 +41053,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, H_V_A_C_SYSTEM_TYPE_CONFIGURATION_ATTRIBUTE_ID, true); + }, HVAC_SYSTEM_TYPE_CONFIGURATION_ATTRIBUTE_ID, true); } public void writeHVACSystemTypeConfigurationAttribute(DefaultClusterCallback callback, Integer value) { @@ -41062,12 +41062,12 @@ public void writeHVACSystemTypeConfigurationAttribute(DefaultClusterCallback cal public void writeHVACSystemTypeConfigurationAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), H_V_A_C_SYSTEM_TYPE_CONFIGURATION_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), HVAC_SYSTEM_TYPE_CONFIGURATION_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribeHVACSystemTypeConfigurationAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, H_V_A_C_SYSTEM_TYPE_CONFIGURATION_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, HVAC_SYSTEM_TYPE_CONFIGURATION_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -41075,7 +41075,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, H_V_A_C_SYSTEM_TYPE_CONFIGURATION_ATTRIBUTE_ID, minInterval, maxInterval); + }, HVAC_SYSTEM_TYPE_CONFIGURATION_ATTRIBUTE_ID, minInterval, maxInterval); } public void readLocalTemperatureCalibrationAttribute( @@ -42057,7 +42057,7 @@ public void onSuccess(byte[] tlv) { public void readACTypeAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_TYPE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AC_TYPE_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -42065,7 +42065,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, A_C_TYPE_ATTRIBUTE_ID, true); + }, AC_TYPE_ATTRIBUTE_ID, true); } public void writeACTypeAttribute(DefaultClusterCallback callback, Integer value) { @@ -42074,12 +42074,12 @@ public void writeACTypeAttribute(DefaultClusterCallback callback, Integer value) public void writeACTypeAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), A_C_TYPE_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), AC_TYPE_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribeACTypeAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_TYPE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AC_TYPE_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -42087,12 +42087,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, A_C_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); + }, AC_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } public void readACCapacityAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_CAPACITY_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AC_CAPACITY_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -42100,7 +42100,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, A_C_CAPACITY_ATTRIBUTE_ID, true); + }, AC_CAPACITY_ATTRIBUTE_ID, true); } public void writeACCapacityAttribute(DefaultClusterCallback callback, Integer value) { @@ -42109,12 +42109,12 @@ public void writeACCapacityAttribute(DefaultClusterCallback callback, Integer va public void writeACCapacityAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), A_C_CAPACITY_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), AC_CAPACITY_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribeACCapacityAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_CAPACITY_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AC_CAPACITY_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -42122,12 +42122,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, A_C_CAPACITY_ATTRIBUTE_ID, minInterval, maxInterval); + }, AC_CAPACITY_ATTRIBUTE_ID, minInterval, maxInterval); } public void readACRefrigerantTypeAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_REFRIGERANT_TYPE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AC_REFRIGERANT_TYPE_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -42135,7 +42135,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, A_C_REFRIGERANT_TYPE_ATTRIBUTE_ID, true); + }, AC_REFRIGERANT_TYPE_ATTRIBUTE_ID, true); } public void writeACRefrigerantTypeAttribute(DefaultClusterCallback callback, Integer value) { @@ -42144,12 +42144,12 @@ public void writeACRefrigerantTypeAttribute(DefaultClusterCallback callback, Int public void writeACRefrigerantTypeAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), A_C_REFRIGERANT_TYPE_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), AC_REFRIGERANT_TYPE_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribeACRefrigerantTypeAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_REFRIGERANT_TYPE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AC_REFRIGERANT_TYPE_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -42157,12 +42157,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, A_C_REFRIGERANT_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); + }, AC_REFRIGERANT_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } public void readACCompressorTypeAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_COMPRESSOR_TYPE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AC_COMPRESSOR_TYPE_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -42170,7 +42170,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, A_C_COMPRESSOR_TYPE_ATTRIBUTE_ID, true); + }, AC_COMPRESSOR_TYPE_ATTRIBUTE_ID, true); } public void writeACCompressorTypeAttribute(DefaultClusterCallback callback, Integer value) { @@ -42179,12 +42179,12 @@ public void writeACCompressorTypeAttribute(DefaultClusterCallback callback, Inte public void writeACCompressorTypeAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), A_C_COMPRESSOR_TYPE_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), AC_COMPRESSOR_TYPE_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribeACCompressorTypeAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_COMPRESSOR_TYPE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AC_COMPRESSOR_TYPE_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -42192,12 +42192,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, A_C_COMPRESSOR_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); + }, AC_COMPRESSOR_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } public void readACErrorCodeAttribute( LongAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_ERROR_CODE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AC_ERROR_CODE_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -42205,7 +42205,7 @@ public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, A_C_ERROR_CODE_ATTRIBUTE_ID, true); + }, AC_ERROR_CODE_ATTRIBUTE_ID, true); } public void writeACErrorCodeAttribute(DefaultClusterCallback callback, Long value) { @@ -42214,12 +42214,12 @@ public void writeACErrorCodeAttribute(DefaultClusterCallback callback, Long valu public void writeACErrorCodeAttribute(DefaultClusterCallback callback, Long value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), A_C_ERROR_CODE_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), AC_ERROR_CODE_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribeACErrorCodeAttribute( LongAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_ERROR_CODE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AC_ERROR_CODE_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -42227,12 +42227,12 @@ public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, A_C_ERROR_CODE_ATTRIBUTE_ID, minInterval, maxInterval); + }, AC_ERROR_CODE_ATTRIBUTE_ID, minInterval, maxInterval); } public void readACLouverPositionAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_LOUVER_POSITION_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AC_LOUVER_POSITION_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -42240,7 +42240,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, A_C_LOUVER_POSITION_ATTRIBUTE_ID, true); + }, AC_LOUVER_POSITION_ATTRIBUTE_ID, true); } public void writeACLouverPositionAttribute(DefaultClusterCallback callback, Integer value) { @@ -42249,12 +42249,12 @@ public void writeACLouverPositionAttribute(DefaultClusterCallback callback, Inte public void writeACLouverPositionAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), A_C_LOUVER_POSITION_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), AC_LOUVER_POSITION_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribeACLouverPositionAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_LOUVER_POSITION_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AC_LOUVER_POSITION_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -42262,12 +42262,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, A_C_LOUVER_POSITION_ATTRIBUTE_ID, minInterval, maxInterval); + }, AC_LOUVER_POSITION_ATTRIBUTE_ID, minInterval, maxInterval); } public void readACCoilTemperatureAttribute( ACCoilTemperatureAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_COIL_TEMPERATURE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AC_COIL_TEMPERATURE_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -42275,12 +42275,12 @@ public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, A_C_COIL_TEMPERATURE_ATTRIBUTE_ID, true); + }, AC_COIL_TEMPERATURE_ATTRIBUTE_ID, true); } public void subscribeACCoilTemperatureAttribute( ACCoilTemperatureAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_COIL_TEMPERATURE_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AC_COIL_TEMPERATURE_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -42288,12 +42288,12 @@ public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, A_C_COIL_TEMPERATURE_ATTRIBUTE_ID, minInterval, maxInterval); + }, AC_COIL_TEMPERATURE_ATTRIBUTE_ID, minInterval, maxInterval); } public void readACCapacityformatAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_CAPACITYFORMAT_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AC_CAPACITYFORMAT_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -42301,7 +42301,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, A_C_CAPACITYFORMAT_ATTRIBUTE_ID, true); + }, AC_CAPACITYFORMAT_ATTRIBUTE_ID, true); } public void writeACCapacityformatAttribute(DefaultClusterCallback callback, Integer value) { @@ -42310,12 +42310,12 @@ public void writeACCapacityformatAttribute(DefaultClusterCallback callback, Inte public void writeACCapacityformatAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), A_C_CAPACITYFORMAT_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), AC_CAPACITYFORMAT_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribeACCapacityformatAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, A_C_CAPACITYFORMAT_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, AC_CAPACITYFORMAT_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -42323,7 +42323,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, A_C_CAPACITYFORMAT_ATTRIBUTE_ID, minInterval, maxInterval); + }, AC_CAPACITYFORMAT_ATTRIBUTE_ID, minInterval, maxInterval); } public void readPresetTypesAttribute( @@ -43729,14 +43729,14 @@ public static class ColorControlCluster extends BaseChipCluster { private static final long PRIMARY6_INTENSITY_ATTRIBUTE_ID = 42L; private static final long WHITE_POINT_X_ATTRIBUTE_ID = 48L; private static final long WHITE_POINT_Y_ATTRIBUTE_ID = 49L; - private static final long COLOR_POINT_R_X_ATTRIBUTE_ID = 50L; - private static final long COLOR_POINT_R_Y_ATTRIBUTE_ID = 51L; + private static final long COLOR_POINT_RX_ATTRIBUTE_ID = 50L; + private static final long COLOR_POINT_RY_ATTRIBUTE_ID = 51L; private static final long COLOR_POINT_R_INTENSITY_ATTRIBUTE_ID = 52L; - private static final long COLOR_POINT_G_X_ATTRIBUTE_ID = 54L; - private static final long COLOR_POINT_G_Y_ATTRIBUTE_ID = 55L; + private static final long COLOR_POINT_GX_ATTRIBUTE_ID = 54L; + private static final long COLOR_POINT_GY_ATTRIBUTE_ID = 55L; private static final long COLOR_POINT_G_INTENSITY_ATTRIBUTE_ID = 56L; - private static final long COLOR_POINT_B_X_ATTRIBUTE_ID = 58L; - private static final long COLOR_POINT_B_Y_ATTRIBUTE_ID = 59L; + private static final long COLOR_POINT_BX_ATTRIBUTE_ID = 58L; + private static final long COLOR_POINT_BY_ATTRIBUTE_ID = 59L; private static final long COLOR_POINT_B_INTENSITY_ATTRIBUTE_ID = 60L; private static final long ENHANCED_CURRENT_HUE_ATTRIBUTE_ID = 16384L; private static final long ENHANCED_COLOR_MODE_ATTRIBUTE_ID = 16385L; @@ -45330,7 +45330,7 @@ public void onSuccess(byte[] tlv) { public void readColorPointRXAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_R_X_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_RX_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -45338,7 +45338,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, COLOR_POINT_R_X_ATTRIBUTE_ID, true); + }, COLOR_POINT_RX_ATTRIBUTE_ID, true); } public void writeColorPointRXAttribute(DefaultClusterCallback callback, Integer value) { @@ -45347,12 +45347,12 @@ public void writeColorPointRXAttribute(DefaultClusterCallback callback, Integer public void writeColorPointRXAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), COLOR_POINT_R_X_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), COLOR_POINT_RX_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribeColorPointRXAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_R_X_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_RX_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -45360,12 +45360,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, COLOR_POINT_R_X_ATTRIBUTE_ID, minInterval, maxInterval); + }, COLOR_POINT_RX_ATTRIBUTE_ID, minInterval, maxInterval); } public void readColorPointRYAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_R_Y_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_RY_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -45373,7 +45373,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, COLOR_POINT_R_Y_ATTRIBUTE_ID, true); + }, COLOR_POINT_RY_ATTRIBUTE_ID, true); } public void writeColorPointRYAttribute(DefaultClusterCallback callback, Integer value) { @@ -45382,12 +45382,12 @@ public void writeColorPointRYAttribute(DefaultClusterCallback callback, Integer public void writeColorPointRYAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), COLOR_POINT_R_Y_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), COLOR_POINT_RY_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribeColorPointRYAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_R_Y_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_RY_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -45395,7 +45395,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, COLOR_POINT_R_Y_ATTRIBUTE_ID, minInterval, maxInterval); + }, COLOR_POINT_RY_ATTRIBUTE_ID, minInterval, maxInterval); } public void readColorPointRIntensityAttribute( @@ -45435,7 +45435,7 @@ public void onSuccess(byte[] tlv) { public void readColorPointGXAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_G_X_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_GX_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -45443,7 +45443,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, COLOR_POINT_G_X_ATTRIBUTE_ID, true); + }, COLOR_POINT_GX_ATTRIBUTE_ID, true); } public void writeColorPointGXAttribute(DefaultClusterCallback callback, Integer value) { @@ -45452,12 +45452,12 @@ public void writeColorPointGXAttribute(DefaultClusterCallback callback, Integer public void writeColorPointGXAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), COLOR_POINT_G_X_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), COLOR_POINT_GX_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribeColorPointGXAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_G_X_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_GX_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -45465,12 +45465,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, COLOR_POINT_G_X_ATTRIBUTE_ID, minInterval, maxInterval); + }, COLOR_POINT_GX_ATTRIBUTE_ID, minInterval, maxInterval); } public void readColorPointGYAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_G_Y_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_GY_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -45478,7 +45478,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, COLOR_POINT_G_Y_ATTRIBUTE_ID, true); + }, COLOR_POINT_GY_ATTRIBUTE_ID, true); } public void writeColorPointGYAttribute(DefaultClusterCallback callback, Integer value) { @@ -45487,12 +45487,12 @@ public void writeColorPointGYAttribute(DefaultClusterCallback callback, Integer public void writeColorPointGYAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), COLOR_POINT_G_Y_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), COLOR_POINT_GY_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribeColorPointGYAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_G_Y_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_GY_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -45500,7 +45500,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, COLOR_POINT_G_Y_ATTRIBUTE_ID, minInterval, maxInterval); + }, COLOR_POINT_GY_ATTRIBUTE_ID, minInterval, maxInterval); } public void readColorPointGIntensityAttribute( @@ -45540,7 +45540,7 @@ public void onSuccess(byte[] tlv) { public void readColorPointBXAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_B_X_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_BX_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -45548,7 +45548,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, COLOR_POINT_B_X_ATTRIBUTE_ID, true); + }, COLOR_POINT_BX_ATTRIBUTE_ID, true); } public void writeColorPointBXAttribute(DefaultClusterCallback callback, Integer value) { @@ -45557,12 +45557,12 @@ public void writeColorPointBXAttribute(DefaultClusterCallback callback, Integer public void writeColorPointBXAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), COLOR_POINT_B_X_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), COLOR_POINT_BX_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribeColorPointBXAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_B_X_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_BX_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -45570,12 +45570,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, COLOR_POINT_B_X_ATTRIBUTE_ID, minInterval, maxInterval); + }, COLOR_POINT_BX_ATTRIBUTE_ID, minInterval, maxInterval); } public void readColorPointBYAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_B_Y_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_BY_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -45583,7 +45583,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, COLOR_POINT_B_Y_ATTRIBUTE_ID, true); + }, COLOR_POINT_BY_ATTRIBUTE_ID, true); } public void writeColorPointBYAttribute(DefaultClusterCallback callback, Integer value) { @@ -45592,12 +45592,12 @@ public void writeColorPointBYAttribute(DefaultClusterCallback callback, Integer public void writeColorPointBYAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), COLOR_POINT_B_Y_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), COLOR_POINT_BY_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribeColorPointBYAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_B_Y_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, COLOR_POINT_BY_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -45605,7 +45605,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, COLOR_POINT_B_Y_ATTRIBUTE_ID, minInterval, maxInterval); + }, COLOR_POINT_BY_ATTRIBUTE_ID, minInterval, maxInterval); } public void readColorPointBIntensityAttribute( @@ -48553,9 +48553,9 @@ public static class OccupancySensingCluster extends BaseChipCluster { private static final long OCCUPANCY_SENSOR_TYPE_BITMAP_ATTRIBUTE_ID = 2L; private static final long HOLD_TIME_ATTRIBUTE_ID = 3L; private static final long HOLD_TIME_LIMITS_ATTRIBUTE_ID = 4L; - private static final long P_I_R_OCCUPIED_TO_UNOCCUPIED_DELAY_ATTRIBUTE_ID = 16L; - private static final long P_I_R_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID = 17L; - private static final long P_I_R_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID = 18L; + private static final long PIR_OCCUPIED_TO_UNOCCUPIED_DELAY_ATTRIBUTE_ID = 16L; + private static final long PIR_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID = 17L; + private static final long PIR_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID = 18L; private static final long ULTRASONIC_OCCUPIED_TO_UNOCCUPIED_DELAY_ATTRIBUTE_ID = 32L; private static final long ULTRASONIC_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID = 33L; private static final long ULTRASONIC_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID = 34L; @@ -48740,7 +48740,7 @@ public void onSuccess(byte[] tlv) { public void readPIROccupiedToUnoccupiedDelayAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, P_I_R_OCCUPIED_TO_UNOCCUPIED_DELAY_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PIR_OCCUPIED_TO_UNOCCUPIED_DELAY_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -48748,7 +48748,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, P_I_R_OCCUPIED_TO_UNOCCUPIED_DELAY_ATTRIBUTE_ID, true); + }, PIR_OCCUPIED_TO_UNOCCUPIED_DELAY_ATTRIBUTE_ID, true); } public void writePIROccupiedToUnoccupiedDelayAttribute(DefaultClusterCallback callback, Integer value) { @@ -48757,12 +48757,12 @@ public void writePIROccupiedToUnoccupiedDelayAttribute(DefaultClusterCallback ca public void writePIROccupiedToUnoccupiedDelayAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), P_I_R_OCCUPIED_TO_UNOCCUPIED_DELAY_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), PIR_OCCUPIED_TO_UNOCCUPIED_DELAY_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribePIROccupiedToUnoccupiedDelayAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, P_I_R_OCCUPIED_TO_UNOCCUPIED_DELAY_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PIR_OCCUPIED_TO_UNOCCUPIED_DELAY_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -48770,12 +48770,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, P_I_R_OCCUPIED_TO_UNOCCUPIED_DELAY_ATTRIBUTE_ID, minInterval, maxInterval); + }, PIR_OCCUPIED_TO_UNOCCUPIED_DELAY_ATTRIBUTE_ID, minInterval, maxInterval); } public void readPIRUnoccupiedToOccupiedDelayAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, P_I_R_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PIR_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -48783,7 +48783,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, P_I_R_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID, true); + }, PIR_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID, true); } public void writePIRUnoccupiedToOccupiedDelayAttribute(DefaultClusterCallback callback, Integer value) { @@ -48792,12 +48792,12 @@ public void writePIRUnoccupiedToOccupiedDelayAttribute(DefaultClusterCallback ca public void writePIRUnoccupiedToOccupiedDelayAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), P_I_R_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), PIR_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribePIRUnoccupiedToOccupiedDelayAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, P_I_R_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PIR_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -48805,12 +48805,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, P_I_R_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID, minInterval, maxInterval); + }, PIR_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID, minInterval, maxInterval); } public void readPIRUnoccupiedToOccupiedThresholdAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, P_I_R_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PIR_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -48818,7 +48818,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, P_I_R_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID, true); + }, PIR_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID, true); } public void writePIRUnoccupiedToOccupiedThresholdAttribute(DefaultClusterCallback callback, Integer value) { @@ -48827,12 +48827,12 @@ public void writePIRUnoccupiedToOccupiedThresholdAttribute(DefaultClusterCallbac public void writePIRUnoccupiedToOccupiedThresholdAttribute(DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = new UIntType(value); - writeAttribute(new WriteAttributesCallbackImpl(callback), P_I_R_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), PIR_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribePIRUnoccupiedToOccupiedThresholdAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, P_I_R_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PIR_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -48840,7 +48840,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, P_I_R_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID, minInterval, maxInterval); + }, PIR_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID, minInterval, maxInterval); } public void readUltrasonicOccupiedToUnoccupiedDelayAttribute( @@ -54599,7 +54599,7 @@ public static class ThreadBorderRouterManagementCluster extends BaseChipCluster public static final long CLUSTER_ID = 1106L; private static final long BORDER_ROUTER_NAME_ATTRIBUTE_ID = 0L; - private static final long BORDER_AGENT_I_D_ATTRIBUTE_ID = 1L; + private static final long BORDER_AGENT_ID_ATTRIBUTE_ID = 1L; private static final long THREAD_VERSION_ATTRIBUTE_ID = 2L; private static final long INTERFACE_ENABLED_ATTRIBUTE_ID = 3L; private static final long ACTIVE_DATASET_TIMESTAMP_ATTRIBUTE_ID = 4L; @@ -54773,7 +54773,7 @@ public void onSuccess(byte[] tlv) { public void readBorderAgentIDAttribute( OctetStringAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BORDER_AGENT_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BORDER_AGENT_ID_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -54781,12 +54781,12 @@ public void onSuccess(byte[] tlv) { byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, BORDER_AGENT_I_D_ATTRIBUTE_ID, true); + }, BORDER_AGENT_ID_ATTRIBUTE_ID, true); } public void subscribeBorderAgentIDAttribute( OctetStringAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BORDER_AGENT_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, BORDER_AGENT_ID_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -54794,7 +54794,7 @@ public void onSuccess(byte[] tlv) { byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, BORDER_AGENT_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + }, BORDER_AGENT_ID_ATTRIBUTE_ID, minInterval, maxInterval); } public void readThreadVersionAttribute( @@ -55061,7 +55061,7 @@ public void onSuccess(byte[] tlv) { public static class ThreadNetworkDirectoryCluster extends BaseChipCluster { public static final long CLUSTER_ID = 1107L; - private static final long PREFERRED_EXTENDED_PAN_I_D_ATTRIBUTE_ID = 0L; + private static final long PREFERRED_EXTENDED_PAN_ID_ATTRIBUTE_ID = 0L; private static final long THREAD_NETWORKS_ATTRIBUTE_ID = 1L; private static final long THREAD_NETWORK_TABLE_SIZE_ATTRIBUTE_ID = 2L; private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; @@ -55175,7 +55175,7 @@ public interface AttributeListAttributeCallback extends BaseAttributeCallback { public void readPreferredExtendedPanIDAttribute( PreferredExtendedPanIDAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PREFERRED_EXTENDED_PAN_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PREFERRED_EXTENDED_PAN_ID_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -55183,7 +55183,7 @@ public void onSuccess(byte[] tlv) { @Nullable byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, PREFERRED_EXTENDED_PAN_I_D_ATTRIBUTE_ID, true); + }, PREFERRED_EXTENDED_PAN_ID_ATTRIBUTE_ID, true); } public void writePreferredExtendedPanIDAttribute(DefaultClusterCallback callback, byte[] value) { @@ -55192,12 +55192,12 @@ public void writePreferredExtendedPanIDAttribute(DefaultClusterCallback callback public void writePreferredExtendedPanIDAttribute(DefaultClusterCallback callback, byte[] value, int timedWriteTimeoutMs) { BaseTLVType tlvValue = value != null ? new ByteArrayType(value) : new NullType(); - writeAttribute(new WriteAttributesCallbackImpl(callback), PREFERRED_EXTENDED_PAN_I_D_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); + writeAttribute(new WriteAttributesCallbackImpl(callback), PREFERRED_EXTENDED_PAN_ID_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs); } public void subscribePreferredExtendedPanIDAttribute( PreferredExtendedPanIDAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PREFERRED_EXTENDED_PAN_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PREFERRED_EXTENDED_PAN_ID_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -55205,7 +55205,7 @@ public void onSuccess(byte[] tlv) { @Nullable byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, PREFERRED_EXTENDED_PAN_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + }, PREFERRED_EXTENDED_PAN_ID_ATTRIBUTE_ID, minInterval, maxInterval); } public void readThreadNetworksAttribute( @@ -55420,7 +55420,7 @@ public void onSuccess(byte[] tlv) { public static class WakeOnLanCluster extends BaseChipCluster { public static final long CLUSTER_ID = 1283L; - private static final long M_A_C_ADDRESS_ATTRIBUTE_ID = 0L; + private static final long MAC_ADDRESS_ATTRIBUTE_ID = 0L; private static final long LINK_LOCAL_ADDRESS_ATTRIBUTE_ID = 1L; private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L; private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L; @@ -55457,7 +55457,7 @@ public interface AttributeListAttributeCallback extends BaseAttributeCallback { public void readMACAddressAttribute( CharStringAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, M_A_C_ADDRESS_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MAC_ADDRESS_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -55465,12 +55465,12 @@ public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, M_A_C_ADDRESS_ATTRIBUTE_ID, true); + }, MAC_ADDRESS_ATTRIBUTE_ID, true); } public void subscribeMACAddressAttribute( CharStringAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, M_A_C_ADDRESS_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MAC_ADDRESS_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -55478,7 +55478,7 @@ public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, M_A_C_ADDRESS_ATTRIBUTE_ID, minInterval, maxInterval); + }, MAC_ADDRESS_ATTRIBUTE_ID, minInterval, maxInterval); } public void readLinkLocalAddressAttribute( @@ -59222,9 +59222,9 @@ public static class ApplicationBasicCluster extends BaseChipCluster { public static final long CLUSTER_ID = 1293L; private static final long VENDOR_NAME_ATTRIBUTE_ID = 0L; - private static final long VENDOR_I_D_ATTRIBUTE_ID = 1L; + private static final long VENDOR_ID_ATTRIBUTE_ID = 1L; private static final long APPLICATION_NAME_ATTRIBUTE_ID = 2L; - private static final long PRODUCT_I_D_ATTRIBUTE_ID = 3L; + private static final long PRODUCT_ID_ATTRIBUTE_ID = 3L; private static final long APPLICATION_ATTRIBUTE_ID = 4L; private static final long STATUS_ATTRIBUTE_ID = 5L; private static final long APPLICATION_VERSION_ATTRIBUTE_ID = 6L; @@ -59298,7 +59298,7 @@ public void onSuccess(byte[] tlv) { public void readVendorIDAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VENDOR_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VENDOR_ID_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -59306,12 +59306,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, VENDOR_I_D_ATTRIBUTE_ID, true); + }, VENDOR_ID_ATTRIBUTE_ID, true); } public void subscribeVendorIDAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VENDOR_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, VENDOR_ID_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -59319,7 +59319,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, VENDOR_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + }, VENDOR_ID_ATTRIBUTE_ID, minInterval, maxInterval); } public void readApplicationNameAttribute( @@ -59350,7 +59350,7 @@ public void onSuccess(byte[] tlv) { public void readProductIDAttribute( IntegerAttributeCallback callback) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_ID_ATTRIBUTE_ID); readAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -59358,12 +59358,12 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, PRODUCT_I_D_ATTRIBUTE_ID, true); + }, PRODUCT_ID_ATTRIBUTE_ID, true); } public void subscribeProductIDAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_I_D_ATTRIBUTE_ID); + ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PRODUCT_ID_ATTRIBUTE_ID); subscribeAttribute(new ReportCallbackImpl(callback, path) { @Override @@ -59371,7 +59371,7 @@ public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); callback.onSuccess(value); } - }, PRODUCT_I_D_ATTRIBUTE_ID, minInterval, maxInterval); + }, PRODUCT_ID_ATTRIBUTE_ID, minInterval, maxInterval); } public void readApplicationAttribute( diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java index 4e3c6ce296c7b7..160f29d2cf8344 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipEventStructs.java @@ -30,8 +30,8 @@ public static class AccessControlClusterAccessControlEntryChangedEvent { public Integer changeType; public @Nullable ChipStructs.AccessControlClusterAccessControlEntryStruct latestValue; public Integer fabricIndex; - private static final long ADMIN_NODE_I_D_ID = 1L; - private static final long ADMIN_PASSCODE_I_D_ID = 2L; + private static final long ADMIN_NODE_ID_ID = 1L; + private static final long ADMIN_PASSCODE_ID_ID = 2L; private static final long CHANGE_TYPE_ID = 3L; private static final long LATEST_VALUE_ID = 4L; private static final long FABRIC_INDEX_ID = 254L; @@ -52,8 +52,8 @@ public AccessControlClusterAccessControlEntryChangedEvent( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(ADMIN_NODE_I_D_ID, adminNodeID != null ? new UIntType(adminNodeID) : new NullType())); - values.add(new StructElement(ADMIN_PASSCODE_I_D_ID, adminPasscodeID != null ? new UIntType(adminPasscodeID) : new NullType())); + values.add(new StructElement(ADMIN_NODE_ID_ID, adminNodeID != null ? new UIntType(adminNodeID) : new NullType())); + values.add(new StructElement(ADMIN_PASSCODE_ID_ID, adminPasscodeID != null ? new UIntType(adminPasscodeID) : new NullType())); values.add(new StructElement(CHANGE_TYPE_ID, new UIntType(changeType))); values.add(new StructElement(LATEST_VALUE_ID, latestValue != null ? latestValue.encodeTlv() : new NullType())); values.add(new StructElement(FABRIC_INDEX_ID, new UIntType(fabricIndex))); @@ -71,12 +71,12 @@ public static AccessControlClusterAccessControlEntryChangedEvent decodeTlv(BaseT @Nullable ChipStructs.AccessControlClusterAccessControlEntryStruct latestValue = null; Integer fabricIndex = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == ADMIN_NODE_I_D_ID) { + if (element.contextTagNum() == ADMIN_NODE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); adminNodeID = castingValue.value(Long.class); } - } else if (element.contextTagNum() == ADMIN_PASSCODE_I_D_ID) { + } else if (element.contextTagNum() == ADMIN_PASSCODE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); adminPasscodeID = castingValue.value(Integer.class); @@ -136,8 +136,8 @@ public static class AccessControlClusterAccessControlExtensionChangedEvent { public Integer changeType; public @Nullable ChipStructs.AccessControlClusterAccessControlExtensionStruct latestValue; public Integer fabricIndex; - private static final long ADMIN_NODE_I_D_ID = 1L; - private static final long ADMIN_PASSCODE_I_D_ID = 2L; + private static final long ADMIN_NODE_ID_ID = 1L; + private static final long ADMIN_PASSCODE_ID_ID = 2L; private static final long CHANGE_TYPE_ID = 3L; private static final long LATEST_VALUE_ID = 4L; private static final long FABRIC_INDEX_ID = 254L; @@ -158,8 +158,8 @@ public AccessControlClusterAccessControlExtensionChangedEvent( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(ADMIN_NODE_I_D_ID, adminNodeID != null ? new UIntType(adminNodeID) : new NullType())); - values.add(new StructElement(ADMIN_PASSCODE_I_D_ID, adminPasscodeID != null ? new UIntType(adminPasscodeID) : new NullType())); + values.add(new StructElement(ADMIN_NODE_ID_ID, adminNodeID != null ? new UIntType(adminNodeID) : new NullType())); + values.add(new StructElement(ADMIN_PASSCODE_ID_ID, adminPasscodeID != null ? new UIntType(adminPasscodeID) : new NullType())); values.add(new StructElement(CHANGE_TYPE_ID, new UIntType(changeType))); values.add(new StructElement(LATEST_VALUE_ID, latestValue != null ? latestValue.encodeTlv() : new NullType())); values.add(new StructElement(FABRIC_INDEX_ID, new UIntType(fabricIndex))); @@ -177,12 +177,12 @@ public static AccessControlClusterAccessControlExtensionChangedEvent decodeTlv(B @Nullable ChipStructs.AccessControlClusterAccessControlExtensionStruct latestValue = null; Integer fabricIndex = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == ADMIN_NODE_I_D_ID) { + if (element.contextTagNum() == ADMIN_NODE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); adminNodeID = castingValue.value(Long.class); } - } else if (element.contextTagNum() == ADMIN_PASSCODE_I_D_ID) { + } else if (element.contextTagNum() == ADMIN_PASSCODE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); adminPasscodeID = castingValue.value(Integer.class); @@ -289,7 +289,7 @@ public static class AccessControlClusterFabricRestrictionReviewUpdateEvent { public Integer fabricIndex; private static final long TOKEN_ID = 0L; private static final long INSTRUCTION_ID = 1L; - private static final long REDIRECT_U_R_L_ID = 2L; + private static final long REDIRECT_URL_ID = 2L; private static final long FABRIC_INDEX_ID = 254L; public AccessControlClusterFabricRestrictionReviewUpdateEvent( @@ -308,7 +308,7 @@ public StructType encodeTlv() { ArrayList values = new ArrayList<>(); values.add(new StructElement(TOKEN_ID, new UIntType(token))); values.add(new StructElement(INSTRUCTION_ID, instruction != null ? new StringType(instruction) : new NullType())); - values.add(new StructElement(REDIRECT_U_R_L_ID, redirectURL != null ? new StringType(redirectURL) : new NullType())); + values.add(new StructElement(REDIRECT_URL_ID, redirectURL != null ? new StringType(redirectURL) : new NullType())); values.add(new StructElement(FABRIC_INDEX_ID, new UIntType(fabricIndex))); return new StructType(values); @@ -333,7 +333,7 @@ public static AccessControlClusterFabricRestrictionReviewUpdateEvent decodeTlv(B StringType castingValue = element.value(StringType.class); instruction = castingValue.value(String.class); } - } else if (element.contextTagNum() == REDIRECT_U_R_L_ID) { + } else if (element.contextTagNum() == REDIRECT_URL_ID) { if (element.value(BaseTLVType.class).type() == TLVType.String) { StringType castingValue = element.value(StringType.class); redirectURL = castingValue.value(String.class); @@ -377,8 +377,8 @@ public static class ActionsClusterStateChangedEvent { public Integer actionID; public Long invokeID; public Integer newState; - private static final long ACTION_I_D_ID = 0L; - private static final long INVOKE_I_D_ID = 1L; + private static final long ACTION_ID_ID = 0L; + private static final long INVOKE_ID_ID = 1L; private static final long NEW_STATE_ID = 2L; public ActionsClusterStateChangedEvent( @@ -393,8 +393,8 @@ public ActionsClusterStateChangedEvent( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(ACTION_I_D_ID, new UIntType(actionID))); - values.add(new StructElement(INVOKE_I_D_ID, new UIntType(invokeID))); + values.add(new StructElement(ACTION_ID_ID, new UIntType(actionID))); + values.add(new StructElement(INVOKE_ID_ID, new UIntType(invokeID))); values.add(new StructElement(NEW_STATE_ID, new UIntType(newState))); return new StructType(values); @@ -408,12 +408,12 @@ public static ActionsClusterStateChangedEvent decodeTlv(BaseTLVType tlvValue) { Long invokeID = null; Integer newState = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == ACTION_I_D_ID) { + if (element.contextTagNum() == ACTION_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); actionID = castingValue.value(Integer.class); } - } else if (element.contextTagNum() == INVOKE_I_D_ID) { + } else if (element.contextTagNum() == INVOKE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); invokeID = castingValue.value(Long.class); @@ -454,8 +454,8 @@ public static class ActionsClusterActionFailedEvent { public Long invokeID; public Integer newState; public Integer error; - private static final long ACTION_I_D_ID = 0L; - private static final long INVOKE_I_D_ID = 1L; + private static final long ACTION_ID_ID = 0L; + private static final long INVOKE_ID_ID = 1L; private static final long NEW_STATE_ID = 2L; private static final long ERROR_ID = 3L; @@ -473,8 +473,8 @@ public ActionsClusterActionFailedEvent( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(ACTION_I_D_ID, new UIntType(actionID))); - values.add(new StructElement(INVOKE_I_D_ID, new UIntType(invokeID))); + values.add(new StructElement(ACTION_ID_ID, new UIntType(actionID))); + values.add(new StructElement(INVOKE_ID_ID, new UIntType(invokeID))); values.add(new StructElement(NEW_STATE_ID, new UIntType(newState))); values.add(new StructElement(ERROR_ID, new UIntType(error))); @@ -490,12 +490,12 @@ public static ActionsClusterActionFailedEvent decodeTlv(BaseTLVType tlvValue) { Integer newState = null; Integer error = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == ACTION_I_D_ID) { + if (element.contextTagNum() == ACTION_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); actionID = castingValue.value(Integer.class); } - } else if (element.contextTagNum() == INVOKE_I_D_ID) { + } else if (element.contextTagNum() == INVOKE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); invokeID = castingValue.value(Long.class); @@ -801,7 +801,7 @@ public static class OtaSoftwareUpdateRequestorClusterVersionAppliedEvent { public Long softwareVersion; public Integer productID; private static final long SOFTWARE_VERSION_ID = 0L; - private static final long PRODUCT_I_D_ID = 1L; + private static final long PRODUCT_ID_ID = 1L; public OtaSoftwareUpdateRequestorClusterVersionAppliedEvent( Long softwareVersion, @@ -814,7 +814,7 @@ public OtaSoftwareUpdateRequestorClusterVersionAppliedEvent( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); values.add(new StructElement(SOFTWARE_VERSION_ID, new UIntType(softwareVersion))); - values.add(new StructElement(PRODUCT_I_D_ID, new UIntType(productID))); + values.add(new StructElement(PRODUCT_ID_ID, new UIntType(productID))); return new StructType(values); } @@ -831,7 +831,7 @@ public static OtaSoftwareUpdateRequestorClusterVersionAppliedEvent decodeTlv(Bas UIntType castingValue = element.value(UIntType.class); softwareVersion = castingValue.value(Long.class); } - } else if (element.contextTagNum() == PRODUCT_I_D_ID) { + } else if (element.contextTagNum() == PRODUCT_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); productID = castingValue.value(Integer.class); @@ -1727,7 +1727,7 @@ public String toString() { } public static class TimeSynchronizationClusterDSTStatusEvent { public Boolean DSTOffsetActive; - private static final long D_S_T_OFFSET_ACTIVE_ID = 0L; + private static final long DST_OFFSET_ACTIVE_ID = 0L; public TimeSynchronizationClusterDSTStatusEvent( Boolean DSTOffsetActive @@ -1737,7 +1737,7 @@ public TimeSynchronizationClusterDSTStatusEvent( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(D_S_T_OFFSET_ACTIVE_ID, new BooleanType(DSTOffsetActive))); + values.add(new StructElement(DST_OFFSET_ACTIVE_ID, new BooleanType(DSTOffsetActive))); return new StructType(values); } @@ -1748,7 +1748,7 @@ public static TimeSynchronizationClusterDSTStatusEvent decodeTlv(BaseTLVType tlv } Boolean DSTOffsetActive = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == D_S_T_OFFSET_ACTIVE_ID) { + if (element.contextTagNum() == DST_OFFSET_ACTIVE_ID) { if (element.value(BaseTLVType.class).type() == TLVType.Boolean) { BooleanType castingValue = element.value(BooleanType.class); DSTOffsetActive = castingValue.value(Boolean.class); @@ -3893,7 +3893,7 @@ public static class DemandResponseLoadControlClusterLoadControlEventStatusChange public @Nullable Optional dutyCycleControl; public @Nullable Optional powerSavingsControl; public @Nullable Optional heatingSourceControl; - private static final long EVENT_I_D_ID = 0L; + private static final long EVENT_ID_ID = 0L; private static final long TRANSITION_INDEX_ID = 1L; private static final long STATUS_ID = 2L; private static final long CRITICALITY_ID = 3L; @@ -3930,7 +3930,7 @@ public DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(EVENT_I_D_ID, new ByteArrayType(eventID))); + values.add(new StructElement(EVENT_ID_ID, new ByteArrayType(eventID))); values.add(new StructElement(TRANSITION_INDEX_ID, transitionIndex != null ? new UIntType(transitionIndex) : new NullType())); values.add(new StructElement(STATUS_ID, new UIntType(status))); values.add(new StructElement(CRITICALITY_ID, new UIntType(criticality))); @@ -3959,7 +3959,7 @@ public static DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent @Nullable Optional powerSavingsControl = null; @Nullable Optional heatingSourceControl = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == EVENT_I_D_ID) { + if (element.contextTagNum() == EVENT_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { ByteArrayType castingValue = element.value(ByteArrayType.class); eventID = castingValue.value(byte[].class); @@ -4065,7 +4065,7 @@ public String toString() { } public static class MessagesClusterMessageQueuedEvent { public byte[] messageID; - private static final long MESSAGE_I_D_ID = 0L; + private static final long MESSAGE_ID_ID = 0L; public MessagesClusterMessageQueuedEvent( byte[] messageID @@ -4075,7 +4075,7 @@ public MessagesClusterMessageQueuedEvent( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(MESSAGE_I_D_ID, new ByteArrayType(messageID))); + values.add(new StructElement(MESSAGE_ID_ID, new ByteArrayType(messageID))); return new StructType(values); } @@ -4086,7 +4086,7 @@ public static MessagesClusterMessageQueuedEvent decodeTlv(BaseTLVType tlvValue) } byte[] messageID = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == MESSAGE_I_D_ID) { + if (element.contextTagNum() == MESSAGE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { ByteArrayType castingValue = element.value(ByteArrayType.class); messageID = castingValue.value(byte[].class); @@ -4111,7 +4111,7 @@ public String toString() { } public static class MessagesClusterMessagePresentedEvent { public byte[] messageID; - private static final long MESSAGE_I_D_ID = 0L; + private static final long MESSAGE_ID_ID = 0L; public MessagesClusterMessagePresentedEvent( byte[] messageID @@ -4121,7 +4121,7 @@ public MessagesClusterMessagePresentedEvent( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(MESSAGE_I_D_ID, new ByteArrayType(messageID))); + values.add(new StructElement(MESSAGE_ID_ID, new ByteArrayType(messageID))); return new StructType(values); } @@ -4132,7 +4132,7 @@ public static MessagesClusterMessagePresentedEvent decodeTlv(BaseTLVType tlvValu } byte[] messageID = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == MESSAGE_I_D_ID) { + if (element.contextTagNum() == MESSAGE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { ByteArrayType castingValue = element.value(ByteArrayType.class); messageID = castingValue.value(byte[].class); @@ -4160,8 +4160,8 @@ public static class MessagesClusterMessageCompleteEvent { public @Nullable Optional responseID; public @Nullable Optional reply; public @Nullable Integer futureMessagesPreference; - private static final long MESSAGE_I_D_ID = 0L; - private static final long RESPONSE_I_D_ID = 1L; + private static final long MESSAGE_ID_ID = 0L; + private static final long RESPONSE_ID_ID = 1L; private static final long REPLY_ID = 2L; private static final long FUTURE_MESSAGES_PREFERENCE_ID = 3L; @@ -4179,8 +4179,8 @@ public MessagesClusterMessageCompleteEvent( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(MESSAGE_I_D_ID, new ByteArrayType(messageID))); - values.add(new StructElement(RESPONSE_I_D_ID, responseID != null ? responseID.map((nonOptionalresponseID) -> new UIntType(nonOptionalresponseID)).orElse(new EmptyType()) : new NullType())); + values.add(new StructElement(MESSAGE_ID_ID, new ByteArrayType(messageID))); + values.add(new StructElement(RESPONSE_ID_ID, responseID != null ? responseID.map((nonOptionalresponseID) -> new UIntType(nonOptionalresponseID)).orElse(new EmptyType()) : new NullType())); values.add(new StructElement(REPLY_ID, reply != null ? reply.map((nonOptionalreply) -> new StringType(nonOptionalreply)).orElse(new EmptyType()) : new NullType())); values.add(new StructElement(FUTURE_MESSAGES_PREFERENCE_ID, futureMessagesPreference != null ? new UIntType(futureMessagesPreference) : new NullType())); @@ -4196,12 +4196,12 @@ public static MessagesClusterMessageCompleteEvent decodeTlv(BaseTLVType tlvValue @Nullable Optional reply = null; @Nullable Integer futureMessagesPreference = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == MESSAGE_I_D_ID) { + if (element.contextTagNum() == MESSAGE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { ByteArrayType castingValue = element.value(ByteArrayType.class); messageID = castingValue.value(byte[].class); } - } else if (element.contextTagNum() == RESPONSE_I_D_ID) { + } else if (element.contextTagNum() == RESPONSE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); responseID = Optional.of(castingValue.value(Long.class)); @@ -4426,7 +4426,7 @@ public String toString() { } public static class EnergyEvseClusterEVConnectedEvent { public Long sessionID; - private static final long SESSION_I_D_ID = 0L; + private static final long SESSION_ID_ID = 0L; public EnergyEvseClusterEVConnectedEvent( Long sessionID @@ -4436,7 +4436,7 @@ public EnergyEvseClusterEVConnectedEvent( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(SESSION_I_D_ID, new UIntType(sessionID))); + values.add(new StructElement(SESSION_ID_ID, new UIntType(sessionID))); return new StructType(values); } @@ -4447,7 +4447,7 @@ public static EnergyEvseClusterEVConnectedEvent decodeTlv(BaseTLVType tlvValue) } Long sessionID = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == SESSION_I_D_ID) { + if (element.contextTagNum() == SESSION_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); sessionID = castingValue.value(Long.class); @@ -4476,7 +4476,7 @@ public static class EnergyEvseClusterEVNotDetectedEvent { public Long sessionDuration; public Long sessionEnergyCharged; public Optional sessionEnergyDischarged; - private static final long SESSION_I_D_ID = 0L; + private static final long SESSION_ID_ID = 0L; private static final long STATE_ID = 1L; private static final long SESSION_DURATION_ID = 2L; private static final long SESSION_ENERGY_CHARGED_ID = 3L; @@ -4498,7 +4498,7 @@ public EnergyEvseClusterEVNotDetectedEvent( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(SESSION_I_D_ID, new UIntType(sessionID))); + values.add(new StructElement(SESSION_ID_ID, new UIntType(sessionID))); values.add(new StructElement(STATE_ID, new UIntType(state))); values.add(new StructElement(SESSION_DURATION_ID, new UIntType(sessionDuration))); values.add(new StructElement(SESSION_ENERGY_CHARGED_ID, new IntType(sessionEnergyCharged))); @@ -4517,7 +4517,7 @@ public static EnergyEvseClusterEVNotDetectedEvent decodeTlv(BaseTLVType tlvValue Long sessionEnergyCharged = null; Optional sessionEnergyDischarged = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == SESSION_I_D_ID) { + if (element.contextTagNum() == SESSION_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); sessionID = castingValue.value(Long.class); @@ -4581,7 +4581,7 @@ public static class EnergyEvseClusterEnergyTransferStartedEvent { public Integer state; public Long maximumCurrent; public Optional maximumDischargeCurrent; - private static final long SESSION_I_D_ID = 0L; + private static final long SESSION_ID_ID = 0L; private static final long STATE_ID = 1L; private static final long MAXIMUM_CURRENT_ID = 2L; private static final long MAXIMUM_DISCHARGE_CURRENT_ID = 3L; @@ -4600,7 +4600,7 @@ public EnergyEvseClusterEnergyTransferStartedEvent( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(SESSION_I_D_ID, new UIntType(sessionID))); + values.add(new StructElement(SESSION_ID_ID, new UIntType(sessionID))); values.add(new StructElement(STATE_ID, new UIntType(state))); values.add(new StructElement(MAXIMUM_CURRENT_ID, new IntType(maximumCurrent))); values.add(new StructElement(MAXIMUM_DISCHARGE_CURRENT_ID, maximumDischargeCurrent.map((nonOptionalmaximumDischargeCurrent) -> new IntType(nonOptionalmaximumDischargeCurrent)).orElse(new EmptyType()))); @@ -4617,7 +4617,7 @@ public static EnergyEvseClusterEnergyTransferStartedEvent decodeTlv(BaseTLVType Long maximumCurrent = null; Optional maximumDischargeCurrent = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == SESSION_I_D_ID) { + if (element.contextTagNum() == SESSION_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); sessionID = castingValue.value(Long.class); @@ -4673,7 +4673,7 @@ public static class EnergyEvseClusterEnergyTransferStoppedEvent { public Integer reason; public Long energyTransferred; public Optional energyDischarged; - private static final long SESSION_I_D_ID = 0L; + private static final long SESSION_ID_ID = 0L; private static final long STATE_ID = 1L; private static final long REASON_ID = 2L; private static final long ENERGY_TRANSFERRED_ID = 4L; @@ -4695,7 +4695,7 @@ public EnergyEvseClusterEnergyTransferStoppedEvent( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(SESSION_I_D_ID, new UIntType(sessionID))); + values.add(new StructElement(SESSION_ID_ID, new UIntType(sessionID))); values.add(new StructElement(STATE_ID, new UIntType(state))); values.add(new StructElement(REASON_ID, new UIntType(reason))); values.add(new StructElement(ENERGY_TRANSFERRED_ID, new IntType(energyTransferred))); @@ -4714,7 +4714,7 @@ public static EnergyEvseClusterEnergyTransferStoppedEvent decodeTlv(BaseTLVType Long energyTransferred = null; Optional energyDischarged = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == SESSION_I_D_ID) { + if (element.contextTagNum() == SESSION_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); sessionID = castingValue.value(Long.class); @@ -4778,7 +4778,7 @@ public static class EnergyEvseClusterFaultEvent { public Integer state; public Integer faultStatePreviousState; public Integer faultStateCurrentState; - private static final long SESSION_I_D_ID = 0L; + private static final long SESSION_ID_ID = 0L; private static final long STATE_ID = 1L; private static final long FAULT_STATE_PREVIOUS_STATE_ID = 2L; private static final long FAULT_STATE_CURRENT_STATE_ID = 4L; @@ -4797,7 +4797,7 @@ public EnergyEvseClusterFaultEvent( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(SESSION_I_D_ID, sessionID != null ? new UIntType(sessionID) : new NullType())); + values.add(new StructElement(SESSION_ID_ID, sessionID != null ? new UIntType(sessionID) : new NullType())); values.add(new StructElement(STATE_ID, new UIntType(state))); values.add(new StructElement(FAULT_STATE_PREVIOUS_STATE_ID, new UIntType(faultStatePreviousState))); values.add(new StructElement(FAULT_STATE_CURRENT_STATE_ID, new UIntType(faultStateCurrentState))); @@ -4814,7 +4814,7 @@ public static EnergyEvseClusterFaultEvent decodeTlv(BaseTLVType tlvValue) { Integer faultStatePreviousState = null; Integer faultStateCurrentState = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == SESSION_I_D_ID) { + if (element.contextTagNum() == SESSION_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); sessionID = castingValue.value(Long.class); diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java index 2871071475fe69..70e9ba6b1c6ef9 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java @@ -91,7 +91,7 @@ public static class DescriptorClusterSemanticTagStruct { public Integer tag; public @Nullable Optional label; private static final long MFG_CODE_ID = 0L; - private static final long NAMESPACE_I_D_ID = 1L; + private static final long NAMESPACE_ID_ID = 1L; private static final long TAG_ID = 2L; private static final long LABEL_ID = 3L; @@ -110,7 +110,7 @@ public DescriptorClusterSemanticTagStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); values.add(new StructElement(MFG_CODE_ID, mfgCode != null ? new UIntType(mfgCode) : new NullType())); - values.add(new StructElement(NAMESPACE_I_D_ID, new UIntType(namespaceID))); + values.add(new StructElement(NAMESPACE_ID_ID, new UIntType(namespaceID))); values.add(new StructElement(TAG_ID, new UIntType(tag))); values.add(new StructElement(LABEL_ID, label != null ? label.map((nonOptionallabel) -> new StringType(nonOptionallabel)).orElse(new EmptyType()) : new NullType())); @@ -131,7 +131,7 @@ public static DescriptorClusterSemanticTagStruct decodeTlv(BaseTLVType tlvValue) UIntType castingValue = element.value(UIntType.class); mfgCode = castingValue.value(Integer.class); } - } else if (element.contextTagNum() == NAMESPACE_I_D_ID) { + } else if (element.contextTagNum() == NAMESPACE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); namespaceID = castingValue.value(Integer.class); @@ -760,10 +760,10 @@ public static class ActionsClusterActionStruct { public Integer endpointListID; public Integer supportedCommands; public Integer state; - private static final long ACTION_I_D_ID = 0L; + private static final long ACTION_ID_ID = 0L; private static final long NAME_ID = 1L; private static final long TYPE_ID = 2L; - private static final long ENDPOINT_LIST_I_D_ID = 3L; + private static final long ENDPOINT_LIST_ID_ID = 3L; private static final long SUPPORTED_COMMANDS_ID = 4L; private static final long STATE_ID = 5L; @@ -785,10 +785,10 @@ public ActionsClusterActionStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(ACTION_I_D_ID, new UIntType(actionID))); + values.add(new StructElement(ACTION_ID_ID, new UIntType(actionID))); values.add(new StructElement(NAME_ID, new StringType(name))); values.add(new StructElement(TYPE_ID, new UIntType(type))); - values.add(new StructElement(ENDPOINT_LIST_I_D_ID, new UIntType(endpointListID))); + values.add(new StructElement(ENDPOINT_LIST_ID_ID, new UIntType(endpointListID))); values.add(new StructElement(SUPPORTED_COMMANDS_ID, new UIntType(supportedCommands))); values.add(new StructElement(STATE_ID, new UIntType(state))); @@ -806,7 +806,7 @@ public static ActionsClusterActionStruct decodeTlv(BaseTLVType tlvValue) { Integer supportedCommands = null; Integer state = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == ACTION_I_D_ID) { + if (element.contextTagNum() == ACTION_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); actionID = castingValue.value(Integer.class); @@ -821,7 +821,7 @@ public static ActionsClusterActionStruct decodeTlv(BaseTLVType tlvValue) { UIntType castingValue = element.value(UIntType.class); type = castingValue.value(Integer.class); } - } else if (element.contextTagNum() == ENDPOINT_LIST_I_D_ID) { + } else if (element.contextTagNum() == ENDPOINT_LIST_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); endpointListID = castingValue.value(Integer.class); @@ -879,7 +879,7 @@ public static class ActionsClusterEndpointListStruct { public String name; public Integer type; public ArrayList endpoints; - private static final long ENDPOINT_LIST_I_D_ID = 0L; + private static final long ENDPOINT_LIST_ID_ID = 0L; private static final long NAME_ID = 1L; private static final long TYPE_ID = 2L; private static final long ENDPOINTS_ID = 3L; @@ -898,7 +898,7 @@ public ActionsClusterEndpointListStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(ENDPOINT_LIST_I_D_ID, new UIntType(endpointListID))); + values.add(new StructElement(ENDPOINT_LIST_ID_ID, new UIntType(endpointListID))); values.add(new StructElement(NAME_ID, new StringType(name))); values.add(new StructElement(TYPE_ID, new UIntType(type))); values.add(new StructElement(ENDPOINTS_ID, ArrayType.generateArrayType(endpoints, (elementendpoints) -> new UIntType(elementendpoints)))); @@ -915,7 +915,7 @@ public static ActionsClusterEndpointListStruct decodeTlv(BaseTLVType tlvValue) { Integer type = null; ArrayList endpoints = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == ENDPOINT_LIST_I_D_ID) { + if (element.contextTagNum() == ENDPOINT_LIST_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); endpointListID = castingValue.value(Integer.class); @@ -1091,7 +1091,7 @@ public static class OtaSoftwareUpdateRequestorClusterProviderLocation { public Long providerNodeID; public Integer endpoint; public Integer fabricIndex; - private static final long PROVIDER_NODE_I_D_ID = 1L; + private static final long PROVIDER_NODE_ID_ID = 1L; private static final long ENDPOINT_ID = 2L; private static final long FABRIC_INDEX_ID = 254L; @@ -1107,7 +1107,7 @@ public OtaSoftwareUpdateRequestorClusterProviderLocation( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(PROVIDER_NODE_I_D_ID, new UIntType(providerNodeID))); + values.add(new StructElement(PROVIDER_NODE_ID_ID, new UIntType(providerNodeID))); values.add(new StructElement(ENDPOINT_ID, new UIntType(endpoint))); values.add(new StructElement(FABRIC_INDEX_ID, new UIntType(fabricIndex))); @@ -1122,7 +1122,7 @@ public static OtaSoftwareUpdateRequestorClusterProviderLocation decodeTlv(BaseTL Integer endpoint = null; Integer fabricIndex = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == PROVIDER_NODE_I_D_ID) { + if (element.contextTagNum() == PROVIDER_NODE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); providerNodeID = castingValue.value(Long.class); @@ -1412,7 +1412,7 @@ public static class NetworkCommissioningClusterNetworkInfoStruct { public Boolean connected; public @Nullable Optional networkIdentifier; public @Nullable Optional clientIdentifier; - private static final long NETWORK_I_D_ID = 0L; + private static final long NETWORK_ID_ID = 0L; private static final long CONNECTED_ID = 1L; private static final long NETWORK_IDENTIFIER_ID = 2L; private static final long CLIENT_IDENTIFIER_ID = 3L; @@ -1431,7 +1431,7 @@ public NetworkCommissioningClusterNetworkInfoStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(NETWORK_I_D_ID, new ByteArrayType(networkID))); + values.add(new StructElement(NETWORK_ID_ID, new ByteArrayType(networkID))); values.add(new StructElement(CONNECTED_ID, new BooleanType(connected))); values.add(new StructElement(NETWORK_IDENTIFIER_ID, networkIdentifier != null ? networkIdentifier.map((nonOptionalnetworkIdentifier) -> new ByteArrayType(nonOptionalnetworkIdentifier)).orElse(new EmptyType()) : new NullType())); values.add(new StructElement(CLIENT_IDENTIFIER_ID, clientIdentifier != null ? clientIdentifier.map((nonOptionalclientIdentifier) -> new ByteArrayType(nonOptionalclientIdentifier)).orElse(new EmptyType()) : new NullType())); @@ -1448,7 +1448,7 @@ public static NetworkCommissioningClusterNetworkInfoStruct decodeTlv(BaseTLVType @Nullable Optional networkIdentifier = null; @Nullable Optional clientIdentifier = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == NETWORK_I_D_ID) { + if (element.contextTagNum() == NETWORK_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { ByteArrayType castingValue = element.value(ByteArrayType.class); networkID = castingValue.value(byte[].class); @@ -2495,8 +2495,8 @@ public static class ThreadNetworkDiagnosticsClusterRouteTableStruct { private static final long ROUTER_ID_ID = 2L; private static final long NEXT_HOP_ID = 3L; private static final long PATH_COST_ID = 4L; - private static final long L_Q_I_IN_ID = 5L; - private static final long L_Q_I_OUT_ID = 6L; + private static final long LQI_IN_ID = 5L; + private static final long LQI_OUT_ID = 6L; private static final long AGE_ID = 7L; private static final long ALLOCATED_ID = 8L; private static final long LINK_ESTABLISHED_ID = 9L; @@ -2532,8 +2532,8 @@ public StructType encodeTlv() { values.add(new StructElement(ROUTER_ID_ID, new UIntType(routerId))); values.add(new StructElement(NEXT_HOP_ID, new UIntType(nextHop))); values.add(new StructElement(PATH_COST_ID, new UIntType(pathCost))); - values.add(new StructElement(L_Q_I_IN_ID, new UIntType(LQIIn))); - values.add(new StructElement(L_Q_I_OUT_ID, new UIntType(LQIOut))); + values.add(new StructElement(LQI_IN_ID, new UIntType(LQIIn))); + values.add(new StructElement(LQI_OUT_ID, new UIntType(LQIOut))); values.add(new StructElement(AGE_ID, new UIntType(age))); values.add(new StructElement(ALLOCATED_ID, new BooleanType(allocated))); values.add(new StructElement(LINK_ESTABLISHED_ID, new BooleanType(linkEstablished))); @@ -2581,12 +2581,12 @@ public static ThreadNetworkDiagnosticsClusterRouteTableStruct decodeTlv(BaseTLVT UIntType castingValue = element.value(UIntType.class); pathCost = castingValue.value(Integer.class); } - } else if (element.contextTagNum() == L_Q_I_IN_ID) { + } else if (element.contextTagNum() == LQI_IN_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); LQIIn = castingValue.value(Integer.class); } - } else if (element.contextTagNum() == L_Q_I_OUT_ID) { + } else if (element.contextTagNum() == LQI_OUT_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); LQIOut = castingValue.value(Integer.class); @@ -2800,7 +2800,7 @@ public String toString() { public static class TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct { public Long nodeID; public Integer endpoint; - private static final long NODE_I_D_ID = 0L; + private static final long NODE_ID_ID = 0L; private static final long ENDPOINT_ID = 1L; public TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct( @@ -2813,7 +2813,7 @@ public TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(NODE_I_D_ID, new UIntType(nodeID))); + values.add(new StructElement(NODE_ID_ID, new UIntType(nodeID))); values.add(new StructElement(ENDPOINT_ID, new UIntType(endpoint))); return new StructType(values); @@ -2826,7 +2826,7 @@ public static TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct deco Long nodeID = null; Integer endpoint = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == NODE_I_D_ID) { + if (element.contextTagNum() == NODE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); nodeID = castingValue.value(Long.class); @@ -2939,7 +2939,7 @@ public static class TimeSynchronizationClusterTrustedTimeSourceStruct { public Long nodeID; public Integer endpoint; private static final long FABRIC_INDEX_ID = 0L; - private static final long NODE_I_D_ID = 1L; + private static final long NODE_ID_ID = 1L; private static final long ENDPOINT_ID = 2L; public TimeSynchronizationClusterTrustedTimeSourceStruct( @@ -2955,7 +2955,7 @@ public TimeSynchronizationClusterTrustedTimeSourceStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); values.add(new StructElement(FABRIC_INDEX_ID, new UIntType(fabricIndex))); - values.add(new StructElement(NODE_I_D_ID, new UIntType(nodeID))); + values.add(new StructElement(NODE_ID_ID, new UIntType(nodeID))); values.add(new StructElement(ENDPOINT_ID, new UIntType(endpoint))); return new StructType(values); @@ -2974,7 +2974,7 @@ public static TimeSynchronizationClusterTrustedTimeSourceStruct decodeTlv(BaseTL UIntType castingValue = element.value(UIntType.class); fabricIndex = castingValue.value(Integer.class); } - } else if (element.contextTagNum() == NODE_I_D_ID) { + } else if (element.contextTagNum() == NODE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); nodeID = castingValue.value(Long.class); @@ -3079,9 +3079,9 @@ public static class OperationalCredentialsClusterFabricDescriptorStruct { public String label; public Integer fabricIndex; private static final long ROOT_PUBLIC_KEY_ID = 1L; - private static final long VENDOR_I_D_ID = 2L; - private static final long FABRIC_I_D_ID = 3L; - private static final long NODE_I_D_ID = 4L; + private static final long VENDOR_ID_ID = 2L; + private static final long FABRIC_ID_ID = 3L; + private static final long NODE_ID_ID = 4L; private static final long LABEL_ID = 5L; private static final long FABRIC_INDEX_ID = 254L; @@ -3104,9 +3104,9 @@ public OperationalCredentialsClusterFabricDescriptorStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); values.add(new StructElement(ROOT_PUBLIC_KEY_ID, new ByteArrayType(rootPublicKey))); - values.add(new StructElement(VENDOR_I_D_ID, new UIntType(vendorID))); - values.add(new StructElement(FABRIC_I_D_ID, new UIntType(fabricID))); - values.add(new StructElement(NODE_I_D_ID, new UIntType(nodeID))); + values.add(new StructElement(VENDOR_ID_ID, new UIntType(vendorID))); + values.add(new StructElement(FABRIC_ID_ID, new UIntType(fabricID))); + values.add(new StructElement(NODE_ID_ID, new UIntType(nodeID))); values.add(new StructElement(LABEL_ID, new StringType(label))); values.add(new StructElement(FABRIC_INDEX_ID, new UIntType(fabricIndex))); @@ -3129,17 +3129,17 @@ public static OperationalCredentialsClusterFabricDescriptorStruct decodeTlv(Base ByteArrayType castingValue = element.value(ByteArrayType.class); rootPublicKey = castingValue.value(byte[].class); } - } else if (element.contextTagNum() == VENDOR_I_D_ID) { + } else if (element.contextTagNum() == VENDOR_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); vendorID = castingValue.value(Integer.class); } - } else if (element.contextTagNum() == FABRIC_I_D_ID) { + } else if (element.contextTagNum() == FABRIC_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); fabricID = castingValue.value(Long.class); } - } else if (element.contextTagNum() == NODE_I_D_ID) { + } else if (element.contextTagNum() == NODE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); nodeID = castingValue.value(Long.class); @@ -3364,7 +3364,7 @@ public static class GroupKeyManagementClusterGroupKeyMapStruct { public Integer groupKeySetID; public Integer fabricIndex; private static final long GROUP_ID_ID = 1L; - private static final long GROUP_KEY_SET_I_D_ID = 2L; + private static final long GROUP_KEY_SET_ID_ID = 2L; private static final long FABRIC_INDEX_ID = 254L; public GroupKeyManagementClusterGroupKeyMapStruct( @@ -3380,7 +3380,7 @@ public GroupKeyManagementClusterGroupKeyMapStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); values.add(new StructElement(GROUP_ID_ID, new UIntType(groupId))); - values.add(new StructElement(GROUP_KEY_SET_I_D_ID, new UIntType(groupKeySetID))); + values.add(new StructElement(GROUP_KEY_SET_ID_ID, new UIntType(groupKeySetID))); values.add(new StructElement(FABRIC_INDEX_ID, new UIntType(fabricIndex))); return new StructType(values); @@ -3399,7 +3399,7 @@ public static GroupKeyManagementClusterGroupKeyMapStruct decodeTlv(BaseTLVType t UIntType castingValue = element.value(UIntType.class); groupId = castingValue.value(Integer.class); } - } else if (element.contextTagNum() == GROUP_KEY_SET_I_D_ID) { + } else if (element.contextTagNum() == GROUP_KEY_SET_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); groupKeySetID = castingValue.value(Integer.class); @@ -3444,7 +3444,7 @@ public static class GroupKeyManagementClusterGroupKeySetStruct { public @Nullable Long epochStartTime1; public @Nullable byte[] epochKey2; public @Nullable Long epochStartTime2; - private static final long GROUP_KEY_SET_I_D_ID = 0L; + private static final long GROUP_KEY_SET_ID_ID = 0L; private static final long GROUP_KEY_SECURITY_POLICY_ID = 1L; private static final long EPOCH_KEY0_ID = 2L; private static final long EPOCH_START_TIME0_ID = 3L; @@ -3475,7 +3475,7 @@ public GroupKeyManagementClusterGroupKeySetStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(GROUP_KEY_SET_I_D_ID, new UIntType(groupKeySetID))); + values.add(new StructElement(GROUP_KEY_SET_ID_ID, new UIntType(groupKeySetID))); values.add(new StructElement(GROUP_KEY_SECURITY_POLICY_ID, new UIntType(groupKeySecurityPolicy))); values.add(new StructElement(EPOCH_KEY0_ID, epochKey0 != null ? new ByteArrayType(epochKey0) : new NullType())); values.add(new StructElement(EPOCH_START_TIME0_ID, epochStartTime0 != null ? new UIntType(epochStartTime0) : new NullType())); @@ -3500,7 +3500,7 @@ public static GroupKeyManagementClusterGroupKeySetStruct decodeTlv(BaseTLVType t @Nullable byte[] epochKey2 = null; @Nullable Long epochStartTime2 = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == GROUP_KEY_SET_I_D_ID) { + if (element.contextTagNum() == GROUP_KEY_SET_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); groupKeySetID = castingValue.value(Integer.class); @@ -3713,7 +3713,7 @@ public static class IcdManagementClusterMonitoringRegistrationStruct { public Long monitoredSubject; public Integer clientType; public Integer fabricIndex; - private static final long CHECK_IN_NODE_I_D_ID = 1L; + private static final long CHECK_IN_NODE_ID_ID = 1L; private static final long MONITORED_SUBJECT_ID = 2L; private static final long CLIENT_TYPE_ID = 4L; private static final long FABRIC_INDEX_ID = 254L; @@ -3732,7 +3732,7 @@ public IcdManagementClusterMonitoringRegistrationStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(CHECK_IN_NODE_I_D_ID, new UIntType(checkInNodeID))); + values.add(new StructElement(CHECK_IN_NODE_ID_ID, new UIntType(checkInNodeID))); values.add(new StructElement(MONITORED_SUBJECT_ID, new UIntType(monitoredSubject))); values.add(new StructElement(CLIENT_TYPE_ID, new UIntType(clientType))); values.add(new StructElement(FABRIC_INDEX_ID, new UIntType(fabricIndex))); @@ -3749,7 +3749,7 @@ public static IcdManagementClusterMonitoringRegistrationStruct decodeTlv(BaseTLV Integer clientType = null; Integer fabricIndex = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == CHECK_IN_NODE_I_D_ID) { + if (element.contextTagNum() == CHECK_IN_NODE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); checkInNodeID = castingValue.value(Long.class); @@ -3803,7 +3803,7 @@ public static class OvenCavityOperationalStateClusterErrorStateStruct { public Integer errorStateID; public Optional errorStateLabel; public Optional errorStateDetails; - private static final long ERROR_STATE_I_D_ID = 0L; + private static final long ERROR_STATE_ID_ID = 0L; private static final long ERROR_STATE_LABEL_ID = 1L; private static final long ERROR_STATE_DETAILS_ID = 2L; @@ -3819,7 +3819,7 @@ public OvenCavityOperationalStateClusterErrorStateStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(ERROR_STATE_I_D_ID, new UIntType(errorStateID))); + values.add(new StructElement(ERROR_STATE_ID_ID, new UIntType(errorStateID))); values.add(new StructElement(ERROR_STATE_LABEL_ID, errorStateLabel.map((nonOptionalerrorStateLabel) -> new StringType(nonOptionalerrorStateLabel)).orElse(new EmptyType()))); values.add(new StructElement(ERROR_STATE_DETAILS_ID, errorStateDetails.map((nonOptionalerrorStateDetails) -> new StringType(nonOptionalerrorStateDetails)).orElse(new EmptyType()))); @@ -3834,7 +3834,7 @@ public static OvenCavityOperationalStateClusterErrorStateStruct decodeTlv(BaseTL Optional errorStateLabel = Optional.empty(); Optional errorStateDetails = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == ERROR_STATE_I_D_ID) { + if (element.contextTagNum() == ERROR_STATE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); errorStateID = castingValue.value(Integer.class); @@ -3878,7 +3878,7 @@ public String toString() { public static class OvenCavityOperationalStateClusterOperationalStateStruct { public Integer operationalStateID; public Optional operationalStateLabel; - private static final long OPERATIONAL_STATE_I_D_ID = 0L; + private static final long OPERATIONAL_STATE_ID_ID = 0L; private static final long OPERATIONAL_STATE_LABEL_ID = 1L; public OvenCavityOperationalStateClusterOperationalStateStruct( @@ -3891,7 +3891,7 @@ public OvenCavityOperationalStateClusterOperationalStateStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(OPERATIONAL_STATE_I_D_ID, new UIntType(operationalStateID))); + values.add(new StructElement(OPERATIONAL_STATE_ID_ID, new UIntType(operationalStateID))); values.add(new StructElement(OPERATIONAL_STATE_LABEL_ID, operationalStateLabel.map((nonOptionaloperationalStateLabel) -> new StringType(nonOptionaloperationalStateLabel)).orElse(new EmptyType()))); return new StructType(values); @@ -3904,7 +3904,7 @@ public static OvenCavityOperationalStateClusterOperationalStateStruct decodeTlv( Integer operationalStateID = null; Optional operationalStateLabel = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == OPERATIONAL_STATE_I_D_ID) { + if (element.contextTagNum() == OPERATIONAL_STATE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); operationalStateID = castingValue.value(Integer.class); @@ -5036,7 +5036,7 @@ public static class OperationalStateClusterErrorStateStruct { public Integer errorStateID; public Optional errorStateLabel; public Optional errorStateDetails; - private static final long ERROR_STATE_I_D_ID = 0L; + private static final long ERROR_STATE_ID_ID = 0L; private static final long ERROR_STATE_LABEL_ID = 1L; private static final long ERROR_STATE_DETAILS_ID = 2L; @@ -5052,7 +5052,7 @@ public OperationalStateClusterErrorStateStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(ERROR_STATE_I_D_ID, new UIntType(errorStateID))); + values.add(new StructElement(ERROR_STATE_ID_ID, new UIntType(errorStateID))); values.add(new StructElement(ERROR_STATE_LABEL_ID, errorStateLabel.map((nonOptionalerrorStateLabel) -> new StringType(nonOptionalerrorStateLabel)).orElse(new EmptyType()))); values.add(new StructElement(ERROR_STATE_DETAILS_ID, errorStateDetails.map((nonOptionalerrorStateDetails) -> new StringType(nonOptionalerrorStateDetails)).orElse(new EmptyType()))); @@ -5067,7 +5067,7 @@ public static OperationalStateClusterErrorStateStruct decodeTlv(BaseTLVType tlvV Optional errorStateLabel = Optional.empty(); Optional errorStateDetails = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == ERROR_STATE_I_D_ID) { + if (element.contextTagNum() == ERROR_STATE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); errorStateID = castingValue.value(Integer.class); @@ -5111,7 +5111,7 @@ public String toString() { public static class OperationalStateClusterOperationalStateStruct { public Integer operationalStateID; public Optional operationalStateLabel; - private static final long OPERATIONAL_STATE_I_D_ID = 0L; + private static final long OPERATIONAL_STATE_ID_ID = 0L; private static final long OPERATIONAL_STATE_LABEL_ID = 1L; public OperationalStateClusterOperationalStateStruct( @@ -5124,7 +5124,7 @@ public OperationalStateClusterOperationalStateStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(OPERATIONAL_STATE_I_D_ID, new UIntType(operationalStateID))); + values.add(new StructElement(OPERATIONAL_STATE_ID_ID, new UIntType(operationalStateID))); values.add(new StructElement(OPERATIONAL_STATE_LABEL_ID, operationalStateLabel.map((nonOptionaloperationalStateLabel) -> new StringType(nonOptionaloperationalStateLabel)).orElse(new EmptyType()))); return new StructType(values); @@ -5137,7 +5137,7 @@ public static OperationalStateClusterOperationalStateStruct decodeTlv(BaseTLVTyp Integer operationalStateID = null; Optional operationalStateLabel = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == OPERATIONAL_STATE_I_D_ID) { + if (element.contextTagNum() == OPERATIONAL_STATE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); operationalStateID = castingValue.value(Integer.class); @@ -5173,7 +5173,7 @@ public static class RvcOperationalStateClusterErrorStateStruct { public Integer errorStateID; public Optional errorStateLabel; public Optional errorStateDetails; - private static final long ERROR_STATE_I_D_ID = 0L; + private static final long ERROR_STATE_ID_ID = 0L; private static final long ERROR_STATE_LABEL_ID = 1L; private static final long ERROR_STATE_DETAILS_ID = 2L; @@ -5189,7 +5189,7 @@ public RvcOperationalStateClusterErrorStateStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(ERROR_STATE_I_D_ID, new UIntType(errorStateID))); + values.add(new StructElement(ERROR_STATE_ID_ID, new UIntType(errorStateID))); values.add(new StructElement(ERROR_STATE_LABEL_ID, errorStateLabel.map((nonOptionalerrorStateLabel) -> new StringType(nonOptionalerrorStateLabel)).orElse(new EmptyType()))); values.add(new StructElement(ERROR_STATE_DETAILS_ID, errorStateDetails.map((nonOptionalerrorStateDetails) -> new StringType(nonOptionalerrorStateDetails)).orElse(new EmptyType()))); @@ -5204,7 +5204,7 @@ public static RvcOperationalStateClusterErrorStateStruct decodeTlv(BaseTLVType t Optional errorStateLabel = Optional.empty(); Optional errorStateDetails = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == ERROR_STATE_I_D_ID) { + if (element.contextTagNum() == ERROR_STATE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); errorStateID = castingValue.value(Integer.class); @@ -5248,7 +5248,7 @@ public String toString() { public static class RvcOperationalStateClusterOperationalStateStruct { public Integer operationalStateID; public Optional operationalStateLabel; - private static final long OPERATIONAL_STATE_I_D_ID = 0L; + private static final long OPERATIONAL_STATE_ID_ID = 0L; private static final long OPERATIONAL_STATE_LABEL_ID = 1L; public RvcOperationalStateClusterOperationalStateStruct( @@ -5261,7 +5261,7 @@ public RvcOperationalStateClusterOperationalStateStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(OPERATIONAL_STATE_I_D_ID, new UIntType(operationalStateID))); + values.add(new StructElement(OPERATIONAL_STATE_ID_ID, new UIntType(operationalStateID))); values.add(new StructElement(OPERATIONAL_STATE_LABEL_ID, operationalStateLabel.map((nonOptionaloperationalStateLabel) -> new StringType(nonOptionaloperationalStateLabel)).orElse(new EmptyType()))); return new StructType(values); @@ -5274,7 +5274,7 @@ public static RvcOperationalStateClusterOperationalStateStruct decodeTlv(BaseTLV Integer operationalStateID = null; Optional operationalStateLabel = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == OPERATIONAL_STATE_I_D_ID) { + if (element.contextTagNum() == OPERATIONAL_STATE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); operationalStateID = castingValue.value(Integer.class); @@ -5316,7 +5316,7 @@ public static class ScenesManagementClusterAttributeValuePairStruct { public Optional valueSigned32; public Optional valueUnsigned64; public Optional valueSigned64; - private static final long ATTRIBUTE_I_D_ID = 0L; + private static final long ATTRIBUTE_ID_ID = 0L; private static final long VALUE_UNSIGNED8_ID = 1L; private static final long VALUE_SIGNED8_ID = 2L; private static final long VALUE_UNSIGNED16_ID = 3L; @@ -5350,7 +5350,7 @@ public ScenesManagementClusterAttributeValuePairStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(ATTRIBUTE_I_D_ID, new UIntType(attributeID))); + values.add(new StructElement(ATTRIBUTE_ID_ID, new UIntType(attributeID))); values.add(new StructElement(VALUE_UNSIGNED8_ID, valueUnsigned8.map((nonOptionalvalueUnsigned8) -> new UIntType(nonOptionalvalueUnsigned8)).orElse(new EmptyType()))); values.add(new StructElement(VALUE_SIGNED8_ID, valueSigned8.map((nonOptionalvalueSigned8) -> new IntType(nonOptionalvalueSigned8)).orElse(new EmptyType()))); values.add(new StructElement(VALUE_UNSIGNED16_ID, valueUnsigned16.map((nonOptionalvalueUnsigned16) -> new UIntType(nonOptionalvalueUnsigned16)).orElse(new EmptyType()))); @@ -5377,7 +5377,7 @@ public static ScenesManagementClusterAttributeValuePairStruct decodeTlv(BaseTLVT Optional valueUnsigned64 = Optional.empty(); Optional valueSigned64 = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == ATTRIBUTE_I_D_ID) { + if (element.contextTagNum() == ATTRIBUTE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); attributeID = castingValue.value(Long.class); @@ -5475,7 +5475,7 @@ public String toString() { public static class ScenesManagementClusterExtensionFieldSet { public Long clusterID; public ArrayList attributeValueList; - private static final long CLUSTER_I_D_ID = 0L; + private static final long CLUSTER_ID_ID = 0L; private static final long ATTRIBUTE_VALUE_LIST_ID = 1L; public ScenesManagementClusterExtensionFieldSet( @@ -5488,7 +5488,7 @@ public ScenesManagementClusterExtensionFieldSet( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(CLUSTER_I_D_ID, new UIntType(clusterID))); + values.add(new StructElement(CLUSTER_ID_ID, new UIntType(clusterID))); values.add(new StructElement(ATTRIBUTE_VALUE_LIST_ID, ArrayType.generateArrayType(attributeValueList, (elementattributeValueList) -> elementattributeValueList.encodeTlv()))); return new StructType(values); @@ -5501,7 +5501,7 @@ public static ScenesManagementClusterExtensionFieldSet decodeTlv(BaseTLVType tlv Long clusterID = null; ArrayList attributeValueList = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == CLUSTER_I_D_ID) { + if (element.contextTagNum() == CLUSTER_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); clusterID = castingValue.value(Long.class); @@ -7285,8 +7285,8 @@ public static class DemandResponseLoadControlClusterLoadControlEventStruct { public Integer criticality; public @Nullable Long startTime; public ArrayList transitions; - private static final long EVENT_I_D_ID = 0L; - private static final long PROGRAM_I_D_ID = 1L; + private static final long EVENT_ID_ID = 0L; + private static final long PROGRAM_ID_ID = 1L; private static final long CONTROL_ID = 2L; private static final long DEVICE_CLASS_ID = 3L; private static final long ENROLLMENT_GROUP_ID = 4L; @@ -7316,8 +7316,8 @@ public DemandResponseLoadControlClusterLoadControlEventStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(EVENT_I_D_ID, new ByteArrayType(eventID))); - values.add(new StructElement(PROGRAM_I_D_ID, programID != null ? new ByteArrayType(programID) : new NullType())); + values.add(new StructElement(EVENT_ID_ID, new ByteArrayType(eventID))); + values.add(new StructElement(PROGRAM_ID_ID, programID != null ? new ByteArrayType(programID) : new NullType())); values.add(new StructElement(CONTROL_ID, new UIntType(control))); values.add(new StructElement(DEVICE_CLASS_ID, new UIntType(deviceClass))); values.add(new StructElement(ENROLLMENT_GROUP_ID, enrollmentGroup.map((nonOptionalenrollmentGroup) -> new UIntType(nonOptionalenrollmentGroup)).orElse(new EmptyType()))); @@ -7341,12 +7341,12 @@ public static DemandResponseLoadControlClusterLoadControlEventStruct decodeTlv(B @Nullable Long startTime = null; ArrayList transitions = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == EVENT_I_D_ID) { + if (element.contextTagNum() == EVENT_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { ByteArrayType castingValue = element.value(ByteArrayType.class); eventID = castingValue.value(byte[].class); } - } else if (element.contextTagNum() == PROGRAM_I_D_ID) { + } else if (element.contextTagNum() == PROGRAM_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { ByteArrayType castingValue = element.value(ByteArrayType.class); programID = castingValue.value(byte[].class); @@ -7433,7 +7433,7 @@ public static class DemandResponseLoadControlClusterLoadControlProgramStruct { public @Nullable Integer enrollmentGroup; public @Nullable Integer randomStartMinutes; public @Nullable Integer randomDurationMinutes; - private static final long PROGRAM_I_D_ID = 0L; + private static final long PROGRAM_ID_ID = 0L; private static final long NAME_ID = 1L; private static final long ENROLLMENT_GROUP_ID = 2L; private static final long RANDOM_START_MINUTES_ID = 3L; @@ -7455,7 +7455,7 @@ public DemandResponseLoadControlClusterLoadControlProgramStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(PROGRAM_I_D_ID, new ByteArrayType(programID))); + values.add(new StructElement(PROGRAM_ID_ID, new ByteArrayType(programID))); values.add(new StructElement(NAME_ID, new StringType(name))); values.add(new StructElement(ENROLLMENT_GROUP_ID, enrollmentGroup != null ? new UIntType(enrollmentGroup) : new NullType())); values.add(new StructElement(RANDOM_START_MINUTES_ID, randomStartMinutes != null ? new UIntType(randomStartMinutes) : new NullType())); @@ -7474,7 +7474,7 @@ public static DemandResponseLoadControlClusterLoadControlProgramStruct decodeTlv @Nullable Integer randomStartMinutes = null; @Nullable Integer randomDurationMinutes = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == PROGRAM_I_D_ID) { + if (element.contextTagNum() == PROGRAM_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { ByteArrayType castingValue = element.value(ByteArrayType.class); programID = castingValue.value(byte[].class); @@ -7536,7 +7536,7 @@ public String toString() { public static class MessagesClusterMessageResponseOptionStruct { public Optional messageResponseID; public Optional label; - private static final long MESSAGE_RESPONSE_I_D_ID = 0L; + private static final long MESSAGE_RESPONSE_ID_ID = 0L; private static final long LABEL_ID = 1L; public MessagesClusterMessageResponseOptionStruct( @@ -7549,7 +7549,7 @@ public MessagesClusterMessageResponseOptionStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(MESSAGE_RESPONSE_I_D_ID, messageResponseID.map((nonOptionalmessageResponseID) -> new UIntType(nonOptionalmessageResponseID)).orElse(new EmptyType()))); + values.add(new StructElement(MESSAGE_RESPONSE_ID_ID, messageResponseID.map((nonOptionalmessageResponseID) -> new UIntType(nonOptionalmessageResponseID)).orElse(new EmptyType()))); values.add(new StructElement(LABEL_ID, label.map((nonOptionallabel) -> new StringType(nonOptionallabel)).orElse(new EmptyType()))); return new StructType(values); @@ -7562,7 +7562,7 @@ public static MessagesClusterMessageResponseOptionStruct decodeTlv(BaseTLVType t Optional messageResponseID = Optional.empty(); Optional label = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == MESSAGE_RESPONSE_I_D_ID) { + if (element.contextTagNum() == MESSAGE_RESPONSE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); messageResponseID = Optional.of(castingValue.value(Long.class)); @@ -7602,7 +7602,7 @@ public static class MessagesClusterMessageStruct { public @Nullable Long duration; public String messageText; public Optional> responses; - private static final long MESSAGE_I_D_ID = 0L; + private static final long MESSAGE_ID_ID = 0L; private static final long PRIORITY_ID = 1L; private static final long MESSAGE_CONTROL_ID = 2L; private static final long START_TIME_ID = 3L; @@ -7630,7 +7630,7 @@ public MessagesClusterMessageStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(MESSAGE_I_D_ID, new ByteArrayType(messageID))); + values.add(new StructElement(MESSAGE_ID_ID, new ByteArrayType(messageID))); values.add(new StructElement(PRIORITY_ID, new UIntType(priority))); values.add(new StructElement(MESSAGE_CONTROL_ID, new UIntType(messageControl))); values.add(new StructElement(START_TIME_ID, startTime != null ? new UIntType(startTime) : new NullType())); @@ -7653,7 +7653,7 @@ public static MessagesClusterMessageStruct decodeTlv(BaseTLVType tlvValue) { String messageText = null; Optional> responses = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == MESSAGE_I_D_ID) { + if (element.contextTagNum() == MESSAGE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { ByteArrayType castingValue = element.value(ByteArrayType.class); messageID = castingValue.value(byte[].class); @@ -8000,7 +8000,7 @@ public static class DeviceEnergyManagementClusterSlotStruct { private static final long SLOT_IS_PAUSABLE_ID = 5L; private static final long MIN_PAUSE_DURATION_ID = 6L; private static final long MAX_PAUSE_DURATION_ID = 7L; - private static final long MANUFACTURER_E_S_A_STATE_ID = 8L; + private static final long MANUFACTURER_ESA_STATE_ID = 8L; private static final long NOMINAL_POWER_ID = 9L; private static final long MIN_POWER_ID = 10L; private static final long MAX_POWER_ID = 11L; @@ -8061,7 +8061,7 @@ public StructType encodeTlv() { values.add(new StructElement(SLOT_IS_PAUSABLE_ID, slotIsPausable.map((nonOptionalslotIsPausable) -> new BooleanType(nonOptionalslotIsPausable)).orElse(new EmptyType()))); values.add(new StructElement(MIN_PAUSE_DURATION_ID, minPauseDuration.map((nonOptionalminPauseDuration) -> new UIntType(nonOptionalminPauseDuration)).orElse(new EmptyType()))); values.add(new StructElement(MAX_PAUSE_DURATION_ID, maxPauseDuration.map((nonOptionalmaxPauseDuration) -> new UIntType(nonOptionalmaxPauseDuration)).orElse(new EmptyType()))); - values.add(new StructElement(MANUFACTURER_E_S_A_STATE_ID, manufacturerESAState.map((nonOptionalmanufacturerESAState) -> new UIntType(nonOptionalmanufacturerESAState)).orElse(new EmptyType()))); + values.add(new StructElement(MANUFACTURER_ESA_STATE_ID, manufacturerESAState.map((nonOptionalmanufacturerESAState) -> new UIntType(nonOptionalmanufacturerESAState)).orElse(new EmptyType()))); values.add(new StructElement(NOMINAL_POWER_ID, nominalPower.map((nonOptionalnominalPower) -> new IntType(nonOptionalnominalPower)).orElse(new EmptyType()))); values.add(new StructElement(MIN_POWER_ID, minPower.map((nonOptionalminPower) -> new IntType(nonOptionalminPower)).orElse(new EmptyType()))); values.add(new StructElement(MAX_POWER_ID, maxPower.map((nonOptionalmaxPower) -> new IntType(nonOptionalmaxPower)).orElse(new EmptyType()))); @@ -8138,7 +8138,7 @@ public static DeviceEnergyManagementClusterSlotStruct decodeTlv(BaseTLVType tlvV UIntType castingValue = element.value(UIntType.class); maxPauseDuration = Optional.of(castingValue.value(Long.class)); } - } else if (element.contextTagNum() == MANUFACTURER_E_S_A_STATE_ID) { + } else if (element.contextTagNum() == MANUFACTURER_ESA_STATE_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); manufacturerESAState = Optional.of(castingValue.value(Integer.class)); @@ -8284,7 +8284,7 @@ public static class DeviceEnergyManagementClusterForecastStruct { public Boolean isPausable; public ArrayList slots; public Integer forecastUpdateReason; - private static final long FORECAST_I_D_ID = 0L; + private static final long FORECAST_ID_ID = 0L; private static final long ACTIVE_SLOT_NUMBER_ID = 1L; private static final long START_TIME_ID = 2L; private static final long END_TIME_ID = 3L; @@ -8318,7 +8318,7 @@ public DeviceEnergyManagementClusterForecastStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(FORECAST_I_D_ID, new UIntType(forecastID))); + values.add(new StructElement(FORECAST_ID_ID, new UIntType(forecastID))); values.add(new StructElement(ACTIVE_SLOT_NUMBER_ID, activeSlotNumber != null ? new UIntType(activeSlotNumber) : new NullType())); values.add(new StructElement(START_TIME_ID, new UIntType(startTime))); values.add(new StructElement(END_TIME_ID, new UIntType(endTime))); @@ -8345,7 +8345,7 @@ public static DeviceEnergyManagementClusterForecastStruct decodeTlv(BaseTLVType ArrayList slots = null; Integer forecastUpdateReason = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == FORECAST_I_D_ID) { + if (element.contextTagNum() == FORECAST_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); forecastID = castingValue.value(Long.class); @@ -9418,8 +9418,8 @@ public static class ServiceAreaClusterAreaStruct { public Long areaID; public @Nullable Long mapID; public ChipStructs.ServiceAreaClusterAreaInfoStruct areaDesc; - private static final long AREA_I_D_ID = 0L; - private static final long MAP_I_D_ID = 1L; + private static final long AREA_ID_ID = 0L; + private static final long MAP_ID_ID = 1L; private static final long AREA_DESC_ID = 2L; public ServiceAreaClusterAreaStruct( @@ -9434,8 +9434,8 @@ public ServiceAreaClusterAreaStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(AREA_I_D_ID, new UIntType(areaID))); - values.add(new StructElement(MAP_I_D_ID, mapID != null ? new UIntType(mapID) : new NullType())); + values.add(new StructElement(AREA_ID_ID, new UIntType(areaID))); + values.add(new StructElement(MAP_ID_ID, mapID != null ? new UIntType(mapID) : new NullType())); values.add(new StructElement(AREA_DESC_ID, areaDesc.encodeTlv())); return new StructType(values); @@ -9449,12 +9449,12 @@ public static ServiceAreaClusterAreaStruct decodeTlv(BaseTLVType tlvValue) { @Nullable Long mapID = null; ChipStructs.ServiceAreaClusterAreaInfoStruct areaDesc = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == AREA_I_D_ID) { + if (element.contextTagNum() == AREA_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); areaID = castingValue.value(Long.class); } - } else if (element.contextTagNum() == MAP_I_D_ID) { + } else if (element.contextTagNum() == MAP_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); mapID = castingValue.value(Long.class); @@ -9493,7 +9493,7 @@ public String toString() { public static class ServiceAreaClusterMapStruct { public Long mapID; public String name; - private static final long MAP_I_D_ID = 0L; + private static final long MAP_ID_ID = 0L; private static final long NAME_ID = 1L; public ServiceAreaClusterMapStruct( @@ -9506,7 +9506,7 @@ public ServiceAreaClusterMapStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(MAP_I_D_ID, new UIntType(mapID))); + values.add(new StructElement(MAP_ID_ID, new UIntType(mapID))); values.add(new StructElement(NAME_ID, new StringType(name))); return new StructType(values); @@ -9519,7 +9519,7 @@ public static ServiceAreaClusterMapStruct decodeTlv(BaseTLVType tlvValue) { Long mapID = null; String name = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == MAP_I_D_ID) { + if (element.contextTagNum() == MAP_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); mapID = castingValue.value(Long.class); @@ -9556,7 +9556,7 @@ public static class ServiceAreaClusterProgressStruct { public Integer status; public @Nullable Optional totalOperationalTime; public @Nullable Optional estimatedTime; - private static final long AREA_I_D_ID = 0L; + private static final long AREA_ID_ID = 0L; private static final long STATUS_ID = 1L; private static final long TOTAL_OPERATIONAL_TIME_ID = 2L; private static final long ESTIMATED_TIME_ID = 3L; @@ -9575,7 +9575,7 @@ public ServiceAreaClusterProgressStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(AREA_I_D_ID, new UIntType(areaID))); + values.add(new StructElement(AREA_ID_ID, new UIntType(areaID))); values.add(new StructElement(STATUS_ID, new UIntType(status))); values.add(new StructElement(TOTAL_OPERATIONAL_TIME_ID, totalOperationalTime != null ? totalOperationalTime.map((nonOptionaltotalOperationalTime) -> new UIntType(nonOptionaltotalOperationalTime)).orElse(new EmptyType()) : new NullType())); values.add(new StructElement(ESTIMATED_TIME_ID, estimatedTime != null ? estimatedTime.map((nonOptionalestimatedTime) -> new UIntType(nonOptionalestimatedTime)).orElse(new EmptyType()) : new NullType())); @@ -9592,7 +9592,7 @@ public static ServiceAreaClusterProgressStruct decodeTlv(BaseTLVType tlvValue) { @Nullable Optional totalOperationalTime = null; @Nullable Optional estimatedTime = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == AREA_I_D_ID) { + if (element.contextTagNum() == AREA_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); areaID = castingValue.value(Long.class); @@ -10312,7 +10312,7 @@ public String toString() { public static class ThermostatClusterAtomicAttributeStatusStruct { public Long attributeID; public Integer statusCode; - private static final long ATTRIBUTE_I_D_ID = 0L; + private static final long ATTRIBUTE_ID_ID = 0L; private static final long STATUS_CODE_ID = 1L; public ThermostatClusterAtomicAttributeStatusStruct( @@ -10325,7 +10325,7 @@ public ThermostatClusterAtomicAttributeStatusStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(ATTRIBUTE_I_D_ID, new UIntType(attributeID))); + values.add(new StructElement(ATTRIBUTE_ID_ID, new UIntType(attributeID))); values.add(new StructElement(STATUS_CODE_ID, new UIntType(statusCode))); return new StructType(values); @@ -10338,7 +10338,7 @@ public static ThermostatClusterAtomicAttributeStatusStruct decodeTlv(BaseTLVType Long attributeID = null; Integer statusCode = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == ATTRIBUTE_I_D_ID) { + if (element.contextTagNum() == ATTRIBUTE_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); attributeID = castingValue.value(Long.class); @@ -10451,7 +10451,7 @@ public static class ThreadNetworkDirectoryClusterThreadNetworkStruct { public String networkName; public Integer channel; public Long activeTimestamp; - private static final long EXTENDED_PAN_I_D_ID = 0L; + private static final long EXTENDED_PAN_ID_ID = 0L; private static final long NETWORK_NAME_ID = 1L; private static final long CHANNEL_ID = 2L; private static final long ACTIVE_TIMESTAMP_ID = 3L; @@ -10470,7 +10470,7 @@ public ThreadNetworkDirectoryClusterThreadNetworkStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(EXTENDED_PAN_I_D_ID, new ByteArrayType(extendedPanID))); + values.add(new StructElement(EXTENDED_PAN_ID_ID, new ByteArrayType(extendedPanID))); values.add(new StructElement(NETWORK_NAME_ID, new StringType(networkName))); values.add(new StructElement(CHANNEL_ID, new UIntType(channel))); values.add(new StructElement(ACTIVE_TIMESTAMP_ID, new UIntType(activeTimestamp))); @@ -10487,7 +10487,7 @@ public static ThreadNetworkDirectoryClusterThreadNetworkStruct decodeTlv(BaseTLV Integer channel = null; Long activeTimestamp = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == EXTENDED_PAN_I_D_ID) { + if (element.contextTagNum() == EXTENDED_PAN_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.ByteArray) { ByteArrayType castingValue = element.value(ByteArrayType.class); extendedPanID = castingValue.value(byte[].class); @@ -10894,7 +10894,7 @@ public static class ChannelClusterProgramStruct { private static final long SERIES_INFO_ID = 15L; private static final long CATEGORY_LIST_ID = 16L; private static final long CAST_LIST_ID = 17L; - private static final long EXTERNAL_I_D_LIST_ID = 18L; + private static final long EXTERNAL_ID_LIST_ID = 18L; public ChannelClusterProgramStruct( String identifier, @@ -10958,7 +10958,7 @@ public StructType encodeTlv() { values.add(new StructElement(SERIES_INFO_ID, seriesInfo != null ? seriesInfo.map((nonOptionalseriesInfo) -> nonOptionalseriesInfo.encodeTlv()).orElse(new EmptyType()) : new NullType())); values.add(new StructElement(CATEGORY_LIST_ID, categoryList.map((nonOptionalcategoryList) -> ArrayType.generateArrayType(nonOptionalcategoryList, (elementnonOptionalcategoryList) -> elementnonOptionalcategoryList.encodeTlv())).orElse(new EmptyType()))); values.add(new StructElement(CAST_LIST_ID, castList.map((nonOptionalcastList) -> ArrayType.generateArrayType(nonOptionalcastList, (elementnonOptionalcastList) -> elementnonOptionalcastList.encodeTlv())).orElse(new EmptyType()))); - values.add(new StructElement(EXTERNAL_I_D_LIST_ID, externalIDList.map((nonOptionalexternalIDList) -> ArrayType.generateArrayType(nonOptionalexternalIDList, (elementnonOptionalexternalIDList) -> elementnonOptionalexternalIDList.encodeTlv())).orElse(new EmptyType()))); + values.add(new StructElement(EXTERNAL_ID_LIST_ID, externalIDList.map((nonOptionalexternalIDList) -> ArrayType.generateArrayType(nonOptionalexternalIDList, (elementnonOptionalexternalIDList) -> elementnonOptionalexternalIDList.encodeTlv())).orElse(new EmptyType()))); return new StructType(values); } @@ -11077,7 +11077,7 @@ public static ChannelClusterProgramStruct decodeTlv(BaseTLVType tlvValue) { ArrayType castingValue = element.value(ArrayType.class); castList = Optional.of(castingValue.map((elementcastingValue) -> ChipStructs.ChannelClusterProgramCastStruct.decodeTlv(elementcastingValue))); } - } else if (element.contextTagNum() == EXTERNAL_I_D_LIST_ID) { + } else if (element.contextTagNum() == EXTERNAL_ID_LIST_ID) { if (element.value(BaseTLVType.class).type() == TLVType.Array) { ArrayType castingValue = element.value(ArrayType.class); externalIDList = Optional.of(castingValue.map((elementcastingValue) -> ChipStructs.ChannelClusterProgramCastStruct.decodeTlv(elementcastingValue))); @@ -12091,7 +12091,7 @@ public static class ContentLauncherClusterParameterStruct { public Optional> externalIDList; private static final long TYPE_ID = 0L; private static final long VALUE_ID = 1L; - private static final long EXTERNAL_I_D_LIST_ID = 2L; + private static final long EXTERNAL_ID_LIST_ID = 2L; public ContentLauncherClusterParameterStruct( Integer type, @@ -12107,7 +12107,7 @@ public StructType encodeTlv() { ArrayList values = new ArrayList<>(); values.add(new StructElement(TYPE_ID, new UIntType(type))); values.add(new StructElement(VALUE_ID, new StringType(value))); - values.add(new StructElement(EXTERNAL_I_D_LIST_ID, externalIDList.map((nonOptionalexternalIDList) -> ArrayType.generateArrayType(nonOptionalexternalIDList, (elementnonOptionalexternalIDList) -> elementnonOptionalexternalIDList.encodeTlv())).orElse(new EmptyType()))); + values.add(new StructElement(EXTERNAL_ID_LIST_ID, externalIDList.map((nonOptionalexternalIDList) -> ArrayType.generateArrayType(nonOptionalexternalIDList, (elementnonOptionalexternalIDList) -> elementnonOptionalexternalIDList.encodeTlv())).orElse(new EmptyType()))); return new StructType(values); } @@ -12130,7 +12130,7 @@ public static ContentLauncherClusterParameterStruct decodeTlv(BaseTLVType tlvVal StringType castingValue = element.value(StringType.class); value = castingValue.value(String.class); } - } else if (element.contextTagNum() == EXTERNAL_I_D_LIST_ID) { + } else if (element.contextTagNum() == EXTERNAL_ID_LIST_ID) { if (element.value(BaseTLVType.class).type() == TLVType.Array) { ArrayType castingValue = element.value(ArrayType.class); externalIDList = Optional.of(castingValue.map((elementcastingValue) -> ChipStructs.ContentLauncherClusterAdditionalInfoStruct.decodeTlv(elementcastingValue))); @@ -12211,7 +12211,7 @@ public static class ContentLauncherClusterStyleInformationStruct { public Optional imageURL; public Optional color; public Optional size; - private static final long IMAGE_U_R_L_ID = 0L; + private static final long IMAGE_URL_ID = 0L; private static final long COLOR_ID = 1L; private static final long SIZE_ID = 2L; @@ -12227,7 +12227,7 @@ public ContentLauncherClusterStyleInformationStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(IMAGE_U_R_L_ID, imageURL.map((nonOptionalimageURL) -> new StringType(nonOptionalimageURL)).orElse(new EmptyType()))); + values.add(new StructElement(IMAGE_URL_ID, imageURL.map((nonOptionalimageURL) -> new StringType(nonOptionalimageURL)).orElse(new EmptyType()))); values.add(new StructElement(COLOR_ID, color.map((nonOptionalcolor) -> new StringType(nonOptionalcolor)).orElse(new EmptyType()))); values.add(new StructElement(SIZE_ID, size.map((nonOptionalsize) -> nonOptionalsize.encodeTlv()).orElse(new EmptyType()))); @@ -12242,7 +12242,7 @@ public static ContentLauncherClusterStyleInformationStruct decodeTlv(BaseTLVType Optional color = Optional.empty(); Optional size = Optional.empty(); for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == IMAGE_U_R_L_ID) { + if (element.contextTagNum() == IMAGE_URL_ID) { if (element.value(BaseTLVType.class).type() == TLVType.String) { StringType castingValue = element.value(StringType.class); imageURL = Optional.of(castingValue.value(String.class)); @@ -12483,8 +12483,8 @@ public String toString() { public static class ApplicationLauncherClusterApplicationStruct { public Integer catalogVendorID; public String applicationID; - private static final long CATALOG_VENDOR_I_D_ID = 0L; - private static final long APPLICATION_I_D_ID = 1L; + private static final long CATALOG_VENDOR_ID_ID = 0L; + private static final long APPLICATION_ID_ID = 1L; public ApplicationLauncherClusterApplicationStruct( Integer catalogVendorID, @@ -12496,8 +12496,8 @@ public ApplicationLauncherClusterApplicationStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(CATALOG_VENDOR_I_D_ID, new UIntType(catalogVendorID))); - values.add(new StructElement(APPLICATION_I_D_ID, new StringType(applicationID))); + values.add(new StructElement(CATALOG_VENDOR_ID_ID, new UIntType(catalogVendorID))); + values.add(new StructElement(APPLICATION_ID_ID, new StringType(applicationID))); return new StructType(values); } @@ -12509,12 +12509,12 @@ public static ApplicationLauncherClusterApplicationStruct decodeTlv(BaseTLVType Integer catalogVendorID = null; String applicationID = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == CATALOG_VENDOR_I_D_ID) { + if (element.contextTagNum() == CATALOG_VENDOR_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); catalogVendorID = castingValue.value(Integer.class); } - } else if (element.contextTagNum() == APPLICATION_I_D_ID) { + } else if (element.contextTagNum() == APPLICATION_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.String) { StringType castingValue = element.value(StringType.class); applicationID = castingValue.value(String.class); @@ -12605,8 +12605,8 @@ public String toString() { public static class ApplicationBasicClusterApplicationStruct { public Integer catalogVendorID; public String applicationID; - private static final long CATALOG_VENDOR_I_D_ID = 0L; - private static final long APPLICATION_I_D_ID = 1L; + private static final long CATALOG_VENDOR_ID_ID = 0L; + private static final long APPLICATION_ID_ID = 1L; public ApplicationBasicClusterApplicationStruct( Integer catalogVendorID, @@ -12618,8 +12618,8 @@ public ApplicationBasicClusterApplicationStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(CATALOG_VENDOR_I_D_ID, new UIntType(catalogVendorID))); - values.add(new StructElement(APPLICATION_I_D_ID, new StringType(applicationID))); + values.add(new StructElement(CATALOG_VENDOR_ID_ID, new UIntType(catalogVendorID))); + values.add(new StructElement(APPLICATION_ID_ID, new StringType(applicationID))); return new StructType(values); } @@ -12631,12 +12631,12 @@ public static ApplicationBasicClusterApplicationStruct decodeTlv(BaseTLVType tlv Integer catalogVendorID = null; String applicationID = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == CATALOG_VENDOR_I_D_ID) { + if (element.contextTagNum() == CATALOG_VENDOR_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.UInt) { UIntType castingValue = element.value(UIntType.class); catalogVendorID = castingValue.value(Integer.class); } - } else if (element.contextTagNum() == APPLICATION_I_D_ID) { + } else if (element.contextTagNum() == APPLICATION_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.String) { StringType castingValue = element.value(StringType.class); applicationID = castingValue.value(String.class); @@ -12941,7 +12941,7 @@ public static class EcosystemInformationClusterEcosystemLocationStruct { public ChipStructs.EcosystemInformationClusterLocationDescriptorStruct locationDescriptor; public Long locationDescriptorLastEdit; public Integer fabricIndex; - private static final long UNIQUE_LOCATION_I_D_ID = 0L; + private static final long UNIQUE_LOCATION_ID_ID = 0L; private static final long LOCATION_DESCRIPTOR_ID = 1L; private static final long LOCATION_DESCRIPTOR_LAST_EDIT_ID = 2L; private static final long FABRIC_INDEX_ID = 254L; @@ -12960,7 +12960,7 @@ public EcosystemInformationClusterEcosystemLocationStruct( public StructType encodeTlv() { ArrayList values = new ArrayList<>(); - values.add(new StructElement(UNIQUE_LOCATION_I_D_ID, new StringType(uniqueLocationID))); + values.add(new StructElement(UNIQUE_LOCATION_ID_ID, new StringType(uniqueLocationID))); values.add(new StructElement(LOCATION_DESCRIPTOR_ID, locationDescriptor.encodeTlv())); values.add(new StructElement(LOCATION_DESCRIPTOR_LAST_EDIT_ID, new UIntType(locationDescriptorLastEdit))); values.add(new StructElement(FABRIC_INDEX_ID, new UIntType(fabricIndex))); @@ -12977,7 +12977,7 @@ public static EcosystemInformationClusterEcosystemLocationStruct decodeTlv(BaseT Long locationDescriptorLastEdit = null; Integer fabricIndex = null; for (StructElement element: ((StructType)tlvValue).value()) { - if (element.contextTagNum() == UNIQUE_LOCATION_I_D_ID) { + if (element.contextTagNum() == UNIQUE_LOCATION_ID_ID) { if (element.value(BaseTLVType.class).type() == TLVType.String) { StringType castingValue = element.value(StringType.class); uniqueLocationID = castingValue.value(String.class); diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessControlEntryChangedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessControlEntryChangedEvent.kt index 2fb1d2221393f9..7deb482b8bfb1e 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessControlEntryChangedEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessControlEntryChangedEvent.kt @@ -44,14 +44,14 @@ class AccessControlClusterAccessControlEntryChangedEvent( tlvWriter.apply { startStructure(tlvTag) if (adminNodeID != null) { - put(ContextSpecificTag(TAG_ADMIN_NODE_I_D), adminNodeID) + put(ContextSpecificTag(TAG_ADMIN_NODE_ID), adminNodeID) } else { - putNull(ContextSpecificTag(TAG_ADMIN_NODE_I_D)) + putNull(ContextSpecificTag(TAG_ADMIN_NODE_ID)) } if (adminPasscodeID != null) { - put(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D), adminPasscodeID) + put(ContextSpecificTag(TAG_ADMIN_PASSCODE_ID), adminPasscodeID) } else { - putNull(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D)) + putNull(ContextSpecificTag(TAG_ADMIN_PASSCODE_ID)) } put(ContextSpecificTag(TAG_CHANGE_TYPE), changeType) if (latestValue != null) { @@ -65,8 +65,8 @@ class AccessControlClusterAccessControlEntryChangedEvent( } companion object { - private const val TAG_ADMIN_NODE_I_D = 1 - private const val TAG_ADMIN_PASSCODE_I_D = 2 + private const val TAG_ADMIN_NODE_ID = 1 + private const val TAG_ADMIN_PASSCODE_ID = 2 private const val TAG_CHANGE_TYPE = 3 private const val TAG_LATEST_VALUE = 4 private const val TAG_FABRIC_INDEX = 254 @@ -78,16 +78,16 @@ class AccessControlClusterAccessControlEntryChangedEvent( tlvReader.enterStructure(tlvTag) val adminNodeID = if (!tlvReader.isNull()) { - tlvReader.getULong(ContextSpecificTag(TAG_ADMIN_NODE_I_D)) + tlvReader.getULong(ContextSpecificTag(TAG_ADMIN_NODE_ID)) } else { - tlvReader.getNull(ContextSpecificTag(TAG_ADMIN_NODE_I_D)) + tlvReader.getNull(ContextSpecificTag(TAG_ADMIN_NODE_ID)) null } val adminPasscodeID = if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D)) + tlvReader.getUInt(ContextSpecificTag(TAG_ADMIN_PASSCODE_ID)) } else { - tlvReader.getNull(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D)) + tlvReader.getNull(ContextSpecificTag(TAG_ADMIN_PASSCODE_ID)) null } val changeType = tlvReader.getUInt(ContextSpecificTag(TAG_CHANGE_TYPE)) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessControlExtensionChangedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessControlExtensionChangedEvent.kt index 66a3ec9dd07d0e..719690e3053dd5 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessControlExtensionChangedEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterAccessControlExtensionChangedEvent.kt @@ -44,14 +44,14 @@ class AccessControlClusterAccessControlExtensionChangedEvent( tlvWriter.apply { startStructure(tlvTag) if (adminNodeID != null) { - put(ContextSpecificTag(TAG_ADMIN_NODE_I_D), adminNodeID) + put(ContextSpecificTag(TAG_ADMIN_NODE_ID), adminNodeID) } else { - putNull(ContextSpecificTag(TAG_ADMIN_NODE_I_D)) + putNull(ContextSpecificTag(TAG_ADMIN_NODE_ID)) } if (adminPasscodeID != null) { - put(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D), adminPasscodeID) + put(ContextSpecificTag(TAG_ADMIN_PASSCODE_ID), adminPasscodeID) } else { - putNull(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D)) + putNull(ContextSpecificTag(TAG_ADMIN_PASSCODE_ID)) } put(ContextSpecificTag(TAG_CHANGE_TYPE), changeType) if (latestValue != null) { @@ -65,8 +65,8 @@ class AccessControlClusterAccessControlExtensionChangedEvent( } companion object { - private const val TAG_ADMIN_NODE_I_D = 1 - private const val TAG_ADMIN_PASSCODE_I_D = 2 + private const val TAG_ADMIN_NODE_ID = 1 + private const val TAG_ADMIN_PASSCODE_ID = 2 private const val TAG_CHANGE_TYPE = 3 private const val TAG_LATEST_VALUE = 4 private const val TAG_FABRIC_INDEX = 254 @@ -78,16 +78,16 @@ class AccessControlClusterAccessControlExtensionChangedEvent( tlvReader.enterStructure(tlvTag) val adminNodeID = if (!tlvReader.isNull()) { - tlvReader.getULong(ContextSpecificTag(TAG_ADMIN_NODE_I_D)) + tlvReader.getULong(ContextSpecificTag(TAG_ADMIN_NODE_ID)) } else { - tlvReader.getNull(ContextSpecificTag(TAG_ADMIN_NODE_I_D)) + tlvReader.getNull(ContextSpecificTag(TAG_ADMIN_NODE_ID)) null } val adminPasscodeID = if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D)) + tlvReader.getUInt(ContextSpecificTag(TAG_ADMIN_PASSCODE_ID)) } else { - tlvReader.getNull(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D)) + tlvReader.getNull(ContextSpecificTag(TAG_ADMIN_PASSCODE_ID)) null } val changeType = tlvReader.getUInt(ContextSpecificTag(TAG_CHANGE_TYPE)) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterFabricRestrictionReviewUpdateEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterFabricRestrictionReviewUpdateEvent.kt index 92934af0a1b4e1..7ea3d3fe02707d 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterFabricRestrictionReviewUpdateEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/AccessControlClusterFabricRestrictionReviewUpdateEvent.kt @@ -47,9 +47,9 @@ class AccessControlClusterFabricRestrictionReviewUpdateEvent( putNull(ContextSpecificTag(TAG_INSTRUCTION)) } if (redirectURL != null) { - put(ContextSpecificTag(TAG_REDIRECT_U_R_L), redirectURL) + put(ContextSpecificTag(TAG_REDIRECT_URL), redirectURL) } else { - putNull(ContextSpecificTag(TAG_REDIRECT_U_R_L)) + putNull(ContextSpecificTag(TAG_REDIRECT_URL)) } put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) endStructure() @@ -59,7 +59,7 @@ class AccessControlClusterFabricRestrictionReviewUpdateEvent( companion object { private const val TAG_TOKEN = 0 private const val TAG_INSTRUCTION = 1 - private const val TAG_REDIRECT_U_R_L = 2 + private const val TAG_REDIRECT_URL = 2 private const val TAG_FABRIC_INDEX = 254 fun fromTlv( @@ -77,9 +77,9 @@ class AccessControlClusterFabricRestrictionReviewUpdateEvent( } val redirectURL = if (!tlvReader.isNull()) { - tlvReader.getString(ContextSpecificTag(TAG_REDIRECT_U_R_L)) + tlvReader.getString(ContextSpecificTag(TAG_REDIRECT_URL)) } else { - tlvReader.getNull(ContextSpecificTag(TAG_REDIRECT_U_R_L)) + tlvReader.getNull(ContextSpecificTag(TAG_REDIRECT_URL)) null } val fabricIndex = tlvReader.getUInt(ContextSpecificTag(TAG_FABRIC_INDEX)) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ActionsClusterActionFailedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ActionsClusterActionFailedEvent.kt index ac1929f9697af5..16c1a67c5cfca9 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ActionsClusterActionFailedEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ActionsClusterActionFailedEvent.kt @@ -40,8 +40,8 @@ class ActionsClusterActionFailedEvent( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_ACTION_I_D), actionID) - put(ContextSpecificTag(TAG_INVOKE_I_D), invokeID) + put(ContextSpecificTag(TAG_ACTION_ID), actionID) + put(ContextSpecificTag(TAG_INVOKE_ID), invokeID) put(ContextSpecificTag(TAG_NEW_STATE), newState) put(ContextSpecificTag(TAG_ERROR), error) endStructure() @@ -49,15 +49,15 @@ class ActionsClusterActionFailedEvent( } companion object { - private const val TAG_ACTION_I_D = 0 - private const val TAG_INVOKE_I_D = 1 + private const val TAG_ACTION_ID = 0 + private const val TAG_INVOKE_ID = 1 private const val TAG_NEW_STATE = 2 private const val TAG_ERROR = 3 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ActionsClusterActionFailedEvent { tlvReader.enterStructure(tlvTag) - val actionID = tlvReader.getUInt(ContextSpecificTag(TAG_ACTION_I_D)) - val invokeID = tlvReader.getULong(ContextSpecificTag(TAG_INVOKE_I_D)) + val actionID = tlvReader.getUInt(ContextSpecificTag(TAG_ACTION_ID)) + val invokeID = tlvReader.getULong(ContextSpecificTag(TAG_INVOKE_ID)) val newState = tlvReader.getUInt(ContextSpecificTag(TAG_NEW_STATE)) val error = tlvReader.getUInt(ContextSpecificTag(TAG_ERROR)) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ActionsClusterStateChangedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ActionsClusterStateChangedEvent.kt index d95c5e9d66480b..cba68b0ed4f468 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ActionsClusterStateChangedEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/ActionsClusterStateChangedEvent.kt @@ -34,22 +34,22 @@ class ActionsClusterStateChangedEvent(val actionID: UInt, val invokeID: ULong, v fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_ACTION_I_D), actionID) - put(ContextSpecificTag(TAG_INVOKE_I_D), invokeID) + put(ContextSpecificTag(TAG_ACTION_ID), actionID) + put(ContextSpecificTag(TAG_INVOKE_ID), invokeID) put(ContextSpecificTag(TAG_NEW_STATE), newState) endStructure() } } companion object { - private const val TAG_ACTION_I_D = 0 - private const val TAG_INVOKE_I_D = 1 + private const val TAG_ACTION_ID = 0 + private const val TAG_INVOKE_ID = 1 private const val TAG_NEW_STATE = 2 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ActionsClusterStateChangedEvent { tlvReader.enterStructure(tlvTag) - val actionID = tlvReader.getUInt(ContextSpecificTag(TAG_ACTION_I_D)) - val invokeID = tlvReader.getULong(ContextSpecificTag(TAG_INVOKE_I_D)) + val actionID = tlvReader.getUInt(ContextSpecificTag(TAG_ACTION_ID)) + val invokeID = tlvReader.getULong(ContextSpecificTag(TAG_INVOKE_ID)) val newState = tlvReader.getUInt(ContextSpecificTag(TAG_NEW_STATE)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent.kt index 7c277de07bd584..1c24da6a705cf7 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent.kt @@ -68,7 +68,7 @@ class DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_EVENT_I_D), eventID) + put(ContextSpecificTag(TAG_EVENT_ID), eventID) if (transitionIndex != null) { put(ContextSpecificTag(TAG_TRANSITION_INDEX), transitionIndex) } else { @@ -122,7 +122,7 @@ class DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent( } companion object { - private const val TAG_EVENT_I_D = 0 + private const val TAG_EVENT_ID = 0 private const val TAG_TRANSITION_INDEX = 1 private const val TAG_STATUS = 2 private const val TAG_CRITICALITY = 3 @@ -138,7 +138,7 @@ class DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent( tlvReader: TlvReader, ): DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent { tlvReader.enterStructure(tlvTag) - val eventID = tlvReader.getByteArray(ContextSpecificTag(TAG_EVENT_I_D)) + val eventID = tlvReader.getByteArray(ContextSpecificTag(TAG_EVENT_ID)) val transitionIndex = if (!tlvReader.isNull()) { tlvReader.getUInt(ContextSpecificTag(TAG_TRANSITION_INDEX)) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEVConnectedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEVConnectedEvent.kt index 37d91a3291a9f2..a17f03a6ef2ab2 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEVConnectedEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEVConnectedEvent.kt @@ -32,17 +32,17 @@ class EnergyEvseClusterEVConnectedEvent(val sessionID: ULong) { fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_SESSION_I_D), sessionID) + put(ContextSpecificTag(TAG_SESSION_ID), sessionID) endStructure() } } companion object { - private const val TAG_SESSION_I_D = 0 + private const val TAG_SESSION_ID = 0 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterEVConnectedEvent { tlvReader.enterStructure(tlvTag) - val sessionID = tlvReader.getULong(ContextSpecificTag(TAG_SESSION_I_D)) + val sessionID = tlvReader.getULong(ContextSpecificTag(TAG_SESSION_ID)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEVNotDetectedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEVNotDetectedEvent.kt index 17654efa1b8956..a55f0578676d4d 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEVNotDetectedEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEVNotDetectedEvent.kt @@ -43,7 +43,7 @@ class EnergyEvseClusterEVNotDetectedEvent( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_SESSION_I_D), sessionID) + put(ContextSpecificTag(TAG_SESSION_ID), sessionID) put(ContextSpecificTag(TAG_STATE), state) put(ContextSpecificTag(TAG_SESSION_DURATION), sessionDuration) put(ContextSpecificTag(TAG_SESSION_ENERGY_CHARGED), sessionEnergyCharged) @@ -56,7 +56,7 @@ class EnergyEvseClusterEVNotDetectedEvent( } companion object { - private const val TAG_SESSION_I_D = 0 + private const val TAG_SESSION_ID = 0 private const val TAG_STATE = 1 private const val TAG_SESSION_DURATION = 2 private const val TAG_SESSION_ENERGY_CHARGED = 3 @@ -64,7 +64,7 @@ class EnergyEvseClusterEVNotDetectedEvent( fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterEVNotDetectedEvent { tlvReader.enterStructure(tlvTag) - val sessionID = tlvReader.getULong(ContextSpecificTag(TAG_SESSION_I_D)) + val sessionID = tlvReader.getULong(ContextSpecificTag(TAG_SESSION_ID)) val state = tlvReader.getUInt(ContextSpecificTag(TAG_STATE)) val sessionDuration = tlvReader.getULong(ContextSpecificTag(TAG_SESSION_DURATION)) val sessionEnergyCharged = tlvReader.getLong(ContextSpecificTag(TAG_SESSION_ENERGY_CHARGED)) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStartedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStartedEvent.kt index 345a0aef9f870e..6e951b49f6b296 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStartedEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStartedEvent.kt @@ -41,7 +41,7 @@ class EnergyEvseClusterEnergyTransferStartedEvent( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_SESSION_I_D), sessionID) + put(ContextSpecificTag(TAG_SESSION_ID), sessionID) put(ContextSpecificTag(TAG_STATE), state) put(ContextSpecificTag(TAG_MAXIMUM_CURRENT), maximumCurrent) if (maximumDischargeCurrent.isPresent) { @@ -53,14 +53,14 @@ class EnergyEvseClusterEnergyTransferStartedEvent( } companion object { - private const val TAG_SESSION_I_D = 0 + private const val TAG_SESSION_ID = 0 private const val TAG_STATE = 1 private const val TAG_MAXIMUM_CURRENT = 2 private const val TAG_MAXIMUM_DISCHARGE_CURRENT = 3 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterEnergyTransferStartedEvent { tlvReader.enterStructure(tlvTag) - val sessionID = tlvReader.getULong(ContextSpecificTag(TAG_SESSION_I_D)) + val sessionID = tlvReader.getULong(ContextSpecificTag(TAG_SESSION_ID)) val state = tlvReader.getUInt(ContextSpecificTag(TAG_STATE)) val maximumCurrent = tlvReader.getLong(ContextSpecificTag(TAG_MAXIMUM_CURRENT)) val maximumDischargeCurrent = diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStoppedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStoppedEvent.kt index b6c3f8cc88f71b..a069eafd10bbc8 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStoppedEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStoppedEvent.kt @@ -43,7 +43,7 @@ class EnergyEvseClusterEnergyTransferStoppedEvent( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_SESSION_I_D), sessionID) + put(ContextSpecificTag(TAG_SESSION_ID), sessionID) put(ContextSpecificTag(TAG_STATE), state) put(ContextSpecificTag(TAG_REASON), reason) put(ContextSpecificTag(TAG_ENERGY_TRANSFERRED), energyTransferred) @@ -56,7 +56,7 @@ class EnergyEvseClusterEnergyTransferStoppedEvent( } companion object { - private const val TAG_SESSION_I_D = 0 + private const val TAG_SESSION_ID = 0 private const val TAG_STATE = 1 private const val TAG_REASON = 2 private const val TAG_ENERGY_TRANSFERRED = 4 @@ -64,7 +64,7 @@ class EnergyEvseClusterEnergyTransferStoppedEvent( fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterEnergyTransferStoppedEvent { tlvReader.enterStructure(tlvTag) - val sessionID = tlvReader.getULong(ContextSpecificTag(TAG_SESSION_I_D)) + val sessionID = tlvReader.getULong(ContextSpecificTag(TAG_SESSION_ID)) val state = tlvReader.getUInt(ContextSpecificTag(TAG_STATE)) val reason = tlvReader.getUInt(ContextSpecificTag(TAG_REASON)) val energyTransferred = tlvReader.getLong(ContextSpecificTag(TAG_ENERGY_TRANSFERRED)) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt index e3c2019af5693d..cc694c8760ae5b 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt @@ -41,9 +41,9 @@ class EnergyEvseClusterFaultEvent( tlvWriter.apply { startStructure(tlvTag) if (sessionID != null) { - put(ContextSpecificTag(TAG_SESSION_I_D), sessionID) + put(ContextSpecificTag(TAG_SESSION_ID), sessionID) } else { - putNull(ContextSpecificTag(TAG_SESSION_I_D)) + putNull(ContextSpecificTag(TAG_SESSION_ID)) } put(ContextSpecificTag(TAG_STATE), state) put(ContextSpecificTag(TAG_FAULT_STATE_PREVIOUS_STATE), faultStatePreviousState) @@ -53,7 +53,7 @@ class EnergyEvseClusterFaultEvent( } companion object { - private const val TAG_SESSION_I_D = 0 + private const val TAG_SESSION_ID = 0 private const val TAG_STATE = 1 private const val TAG_FAULT_STATE_PREVIOUS_STATE = 2 private const val TAG_FAULT_STATE_CURRENT_STATE = 4 @@ -62,9 +62,9 @@ class EnergyEvseClusterFaultEvent( tlvReader.enterStructure(tlvTag) val sessionID = if (!tlvReader.isNull()) { - tlvReader.getULong(ContextSpecificTag(TAG_SESSION_I_D)) + tlvReader.getULong(ContextSpecificTag(TAG_SESSION_ID)) } else { - tlvReader.getNull(ContextSpecificTag(TAG_SESSION_I_D)) + tlvReader.getNull(ContextSpecificTag(TAG_SESSION_ID)) null } val state = tlvReader.getUInt(ContextSpecificTag(TAG_STATE)) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/MessagesClusterMessageCompleteEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/MessagesClusterMessageCompleteEvent.kt index b8524b20183e67..35b5ca1c1138b5 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/MessagesClusterMessageCompleteEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/MessagesClusterMessageCompleteEvent.kt @@ -41,14 +41,14 @@ class MessagesClusterMessageCompleteEvent( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_MESSAGE_I_D), messageID) + put(ContextSpecificTag(TAG_MESSAGE_ID), messageID) if (responseID != null) { if (responseID.isPresent) { val optresponseID = responseID.get() - put(ContextSpecificTag(TAG_RESPONSE_I_D), optresponseID) + put(ContextSpecificTag(TAG_RESPONSE_ID), optresponseID) } } else { - putNull(ContextSpecificTag(TAG_RESPONSE_I_D)) + putNull(ContextSpecificTag(TAG_RESPONSE_ID)) } if (reply != null) { if (reply.isPresent) { @@ -68,23 +68,23 @@ class MessagesClusterMessageCompleteEvent( } companion object { - private const val TAG_MESSAGE_I_D = 0 - private const val TAG_RESPONSE_I_D = 1 + private const val TAG_MESSAGE_ID = 0 + private const val TAG_RESPONSE_ID = 1 private const val TAG_REPLY = 2 private const val TAG_FUTURE_MESSAGES_PREFERENCE = 3 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): MessagesClusterMessageCompleteEvent { tlvReader.enterStructure(tlvTag) - val messageID = tlvReader.getByteArray(ContextSpecificTag(TAG_MESSAGE_I_D)) + val messageID = tlvReader.getByteArray(ContextSpecificTag(TAG_MESSAGE_ID)) val responseID = if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(ContextSpecificTag(TAG_RESPONSE_I_D))) { - Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_RESPONSE_I_D))) + if (tlvReader.isNextTag(ContextSpecificTag(TAG_RESPONSE_ID))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_RESPONSE_ID))) } else { Optional.empty() } } else { - tlvReader.getNull(ContextSpecificTag(TAG_RESPONSE_I_D)) + tlvReader.getNull(ContextSpecificTag(TAG_RESPONSE_ID)) null } val reply = diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/MessagesClusterMessagePresentedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/MessagesClusterMessagePresentedEvent.kt index a2e39882f9ab4a..257a121dcc3d4c 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/MessagesClusterMessagePresentedEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/MessagesClusterMessagePresentedEvent.kt @@ -32,17 +32,17 @@ class MessagesClusterMessagePresentedEvent(val messageID: ByteArray) { fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_MESSAGE_I_D), messageID) + put(ContextSpecificTag(TAG_MESSAGE_ID), messageID) endStructure() } } companion object { - private const val TAG_MESSAGE_I_D = 0 + private const val TAG_MESSAGE_ID = 0 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): MessagesClusterMessagePresentedEvent { tlvReader.enterStructure(tlvTag) - val messageID = tlvReader.getByteArray(ContextSpecificTag(TAG_MESSAGE_I_D)) + val messageID = tlvReader.getByteArray(ContextSpecificTag(TAG_MESSAGE_ID)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/MessagesClusterMessageQueuedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/MessagesClusterMessageQueuedEvent.kt index db5ed28fae6de0..47b80942b65984 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/MessagesClusterMessageQueuedEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/MessagesClusterMessageQueuedEvent.kt @@ -32,17 +32,17 @@ class MessagesClusterMessageQueuedEvent(val messageID: ByteArray) { fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_MESSAGE_I_D), messageID) + put(ContextSpecificTag(TAG_MESSAGE_ID), messageID) endStructure() } } companion object { - private const val TAG_MESSAGE_I_D = 0 + private const val TAG_MESSAGE_ID = 0 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): MessagesClusterMessageQueuedEvent { tlvReader.enterStructure(tlvTag) - val messageID = tlvReader.getByteArray(ContextSpecificTag(TAG_MESSAGE_I_D)) + val messageID = tlvReader.getByteArray(ContextSpecificTag(TAG_MESSAGE_ID)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OtaSoftwareUpdateRequestorClusterVersionAppliedEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OtaSoftwareUpdateRequestorClusterVersionAppliedEvent.kt index 17cf46b96d68af..70f0975a0afa0a 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OtaSoftwareUpdateRequestorClusterVersionAppliedEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/OtaSoftwareUpdateRequestorClusterVersionAppliedEvent.kt @@ -37,14 +37,14 @@ class OtaSoftwareUpdateRequestorClusterVersionAppliedEvent( tlvWriter.apply { startStructure(tlvTag) put(ContextSpecificTag(TAG_SOFTWARE_VERSION), softwareVersion) - put(ContextSpecificTag(TAG_PRODUCT_I_D), productID) + put(ContextSpecificTag(TAG_PRODUCT_ID), productID) endStructure() } } companion object { private const val TAG_SOFTWARE_VERSION = 0 - private const val TAG_PRODUCT_I_D = 1 + private const val TAG_PRODUCT_ID = 1 fun fromTlv( tlvTag: Tag, @@ -52,7 +52,7 @@ class OtaSoftwareUpdateRequestorClusterVersionAppliedEvent( ): OtaSoftwareUpdateRequestorClusterVersionAppliedEvent { tlvReader.enterStructure(tlvTag) val softwareVersion = tlvReader.getULong(ContextSpecificTag(TAG_SOFTWARE_VERSION)) - val productID = tlvReader.getUInt(ContextSpecificTag(TAG_PRODUCT_I_D)) + val productID = tlvReader.getUInt(ContextSpecificTag(TAG_PRODUCT_ID)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/TimeSynchronizationClusterDSTStatusEvent.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/TimeSynchronizationClusterDSTStatusEvent.kt index 7564293e97be61..493128994ba52e 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/TimeSynchronizationClusterDSTStatusEvent.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/eventstructs/TimeSynchronizationClusterDSTStatusEvent.kt @@ -32,17 +32,17 @@ class TimeSynchronizationClusterDSTStatusEvent(val DSTOffsetActive: Boolean) { fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_D_S_T_OFFSET_ACTIVE), DSTOffsetActive) + put(ContextSpecificTag(TAG_DST_OFFSET_ACTIVE), DSTOffsetActive) endStructure() } } companion object { - private const val TAG_D_S_T_OFFSET_ACTIVE = 0 + private const val TAG_DST_OFFSET_ACTIVE = 0 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): TimeSynchronizationClusterDSTStatusEvent { tlvReader.enterStructure(tlvTag) - val DSTOffsetActive = tlvReader.getBoolean(ContextSpecificTag(TAG_D_S_T_OFFSET_ACTIVE)) + val DSTOffsetActive = tlvReader.getBoolean(ContextSpecificTag(TAG_DST_OFFSET_ACTIVE)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActionsClusterActionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActionsClusterActionStruct.kt index a20404bb1e0d90..d464c189e40808 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActionsClusterActionStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActionsClusterActionStruct.kt @@ -44,10 +44,10 @@ class ActionsClusterActionStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_ACTION_I_D), actionID) + put(ContextSpecificTag(TAG_ACTION_ID), actionID) put(ContextSpecificTag(TAG_NAME), name) put(ContextSpecificTag(TAG_TYPE), type) - put(ContextSpecificTag(TAG_ENDPOINT_LIST_I_D), endpointListID) + put(ContextSpecificTag(TAG_ENDPOINT_LIST_ID), endpointListID) put(ContextSpecificTag(TAG_SUPPORTED_COMMANDS), supportedCommands) put(ContextSpecificTag(TAG_STATE), state) endStructure() @@ -55,19 +55,19 @@ class ActionsClusterActionStruct( } companion object { - private const val TAG_ACTION_I_D = 0 + private const val TAG_ACTION_ID = 0 private const val TAG_NAME = 1 private const val TAG_TYPE = 2 - private const val TAG_ENDPOINT_LIST_I_D = 3 + private const val TAG_ENDPOINT_LIST_ID = 3 private const val TAG_SUPPORTED_COMMANDS = 4 private const val TAG_STATE = 5 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ActionsClusterActionStruct { tlvReader.enterStructure(tlvTag) - val actionID = tlvReader.getUInt(ContextSpecificTag(TAG_ACTION_I_D)) + val actionID = tlvReader.getUInt(ContextSpecificTag(TAG_ACTION_ID)) val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) val type = tlvReader.getUInt(ContextSpecificTag(TAG_TYPE)) - val endpointListID = tlvReader.getUInt(ContextSpecificTag(TAG_ENDPOINT_LIST_I_D)) + val endpointListID = tlvReader.getUInt(ContextSpecificTag(TAG_ENDPOINT_LIST_ID)) val supportedCommands = tlvReader.getUInt(ContextSpecificTag(TAG_SUPPORTED_COMMANDS)) val state = tlvReader.getUInt(ContextSpecificTag(TAG_STATE)) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActionsClusterEndpointListStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActionsClusterEndpointListStruct.kt index 831224d12cff88..4f505fcc2fdcb6 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActionsClusterEndpointListStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ActionsClusterEndpointListStruct.kt @@ -41,7 +41,7 @@ class ActionsClusterEndpointListStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_ENDPOINT_LIST_I_D), endpointListID) + put(ContextSpecificTag(TAG_ENDPOINT_LIST_ID), endpointListID) put(ContextSpecificTag(TAG_NAME), name) put(ContextSpecificTag(TAG_TYPE), type) startArray(ContextSpecificTag(TAG_ENDPOINTS)) @@ -54,14 +54,14 @@ class ActionsClusterEndpointListStruct( } companion object { - private const val TAG_ENDPOINT_LIST_I_D = 0 + private const val TAG_ENDPOINT_LIST_ID = 0 private const val TAG_NAME = 1 private const val TAG_TYPE = 2 private const val TAG_ENDPOINTS = 3 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ActionsClusterEndpointListStruct { tlvReader.enterStructure(tlvTag) - val endpointListID = tlvReader.getUInt(ContextSpecificTag(TAG_ENDPOINT_LIST_I_D)) + val endpointListID = tlvReader.getUInt(ContextSpecificTag(TAG_ENDPOINT_LIST_ID)) val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) val type = tlvReader.getUInt(ContextSpecificTag(TAG_TYPE)) val endpoints = diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ApplicationBasicClusterApplicationStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ApplicationBasicClusterApplicationStruct.kt index 566b2efdf3b66b..0438c54949c213 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ApplicationBasicClusterApplicationStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ApplicationBasicClusterApplicationStruct.kt @@ -36,20 +36,20 @@ class ApplicationBasicClusterApplicationStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_CATALOG_VENDOR_I_D), catalogVendorID) - put(ContextSpecificTag(TAG_APPLICATION_I_D), applicationID) + put(ContextSpecificTag(TAG_CATALOG_VENDOR_ID), catalogVendorID) + put(ContextSpecificTag(TAG_APPLICATION_ID), applicationID) endStructure() } } companion object { - private const val TAG_CATALOG_VENDOR_I_D = 0 - private const val TAG_APPLICATION_I_D = 1 + private const val TAG_CATALOG_VENDOR_ID = 0 + private const val TAG_APPLICATION_ID = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ApplicationBasicClusterApplicationStruct { tlvReader.enterStructure(tlvTag) - val catalogVendorID = tlvReader.getUInt(ContextSpecificTag(TAG_CATALOG_VENDOR_I_D)) - val applicationID = tlvReader.getString(ContextSpecificTag(TAG_APPLICATION_I_D)) + val catalogVendorID = tlvReader.getUInt(ContextSpecificTag(TAG_CATALOG_VENDOR_ID)) + val applicationID = tlvReader.getString(ContextSpecificTag(TAG_APPLICATION_ID)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ApplicationLauncherClusterApplicationStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ApplicationLauncherClusterApplicationStruct.kt index 26e76b3c699590..33feca6b60ec82 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ApplicationLauncherClusterApplicationStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ApplicationLauncherClusterApplicationStruct.kt @@ -36,20 +36,20 @@ class ApplicationLauncherClusterApplicationStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_CATALOG_VENDOR_I_D), catalogVendorID) - put(ContextSpecificTag(TAG_APPLICATION_I_D), applicationID) + put(ContextSpecificTag(TAG_CATALOG_VENDOR_ID), catalogVendorID) + put(ContextSpecificTag(TAG_APPLICATION_ID), applicationID) endStructure() } } companion object { - private const val TAG_CATALOG_VENDOR_I_D = 0 - private const val TAG_APPLICATION_I_D = 1 + private const val TAG_CATALOG_VENDOR_ID = 0 + private const val TAG_APPLICATION_ID = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ApplicationLauncherClusterApplicationStruct { tlvReader.enterStructure(tlvTag) - val catalogVendorID = tlvReader.getUInt(ContextSpecificTag(TAG_CATALOG_VENDOR_I_D)) - val applicationID = tlvReader.getString(ContextSpecificTag(TAG_APPLICATION_I_D)) + val catalogVendorID = tlvReader.getUInt(ContextSpecificTag(TAG_CATALOG_VENDOR_ID)) + val applicationID = tlvReader.getString(ContextSpecificTag(TAG_APPLICATION_ID)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ChannelClusterProgramStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ChannelClusterProgramStruct.kt index e7e00d9518aa83..10ef68db6a61bc 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ChannelClusterProgramStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ChannelClusterProgramStruct.kt @@ -151,7 +151,7 @@ class ChannelClusterProgramStruct( } if (externalIDList.isPresent) { val optexternalIDList = externalIDList.get() - startArray(ContextSpecificTag(TAG_EXTERNAL_I_D_LIST)) + startArray(ContextSpecificTag(TAG_EXTERNAL_ID_LIST)) for (item in optexternalIDList.iterator()) { item.toTlv(AnonymousTag, this) } @@ -180,7 +180,7 @@ class ChannelClusterProgramStruct( private const val TAG_SERIES_INFO = 15 private const val TAG_CATEGORY_LIST = 16 private const val TAG_CAST_LIST = 17 - private const val TAG_EXTERNAL_I_D_LIST = 18 + private const val TAG_EXTERNAL_ID_LIST = 18 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ChannelClusterProgramStruct { tlvReader.enterStructure(tlvTag) @@ -308,10 +308,10 @@ class ChannelClusterProgramStruct( Optional.empty() } val externalIDList = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_EXTERNAL_I_D_LIST))) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_EXTERNAL_ID_LIST))) { Optional.of( buildList { - tlvReader.enterArray(ContextSpecificTag(TAG_EXTERNAL_I_D_LIST)) + tlvReader.enterArray(ContextSpecificTag(TAG_EXTERNAL_ID_LIST)) while (!tlvReader.isEndOfContainer()) { add(ChannelClusterProgramCastStruct.fromTlv(AnonymousTag, tlvReader)) } diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterParameterStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterParameterStruct.kt index 96e28a1c12b28f..2c6df6ee7123ad 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterParameterStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterParameterStruct.kt @@ -44,7 +44,7 @@ class ContentLauncherClusterParameterStruct( put(ContextSpecificTag(TAG_VALUE), value) if (externalIDList.isPresent) { val optexternalIDList = externalIDList.get() - startArray(ContextSpecificTag(TAG_EXTERNAL_I_D_LIST)) + startArray(ContextSpecificTag(TAG_EXTERNAL_ID_LIST)) for (item in optexternalIDList.iterator()) { item.toTlv(AnonymousTag, this) } @@ -57,17 +57,17 @@ class ContentLauncherClusterParameterStruct( companion object { private const val TAG_TYPE = 0 private const val TAG_VALUE = 1 - private const val TAG_EXTERNAL_I_D_LIST = 2 + private const val TAG_EXTERNAL_ID_LIST = 2 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ContentLauncherClusterParameterStruct { tlvReader.enterStructure(tlvTag) val type = tlvReader.getUInt(ContextSpecificTag(TAG_TYPE)) val value = tlvReader.getString(ContextSpecificTag(TAG_VALUE)) val externalIDList = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_EXTERNAL_I_D_LIST))) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_EXTERNAL_ID_LIST))) { Optional.of( buildList { - tlvReader.enterArray(ContextSpecificTag(TAG_EXTERNAL_I_D_LIST)) + tlvReader.enterArray(ContextSpecificTag(TAG_EXTERNAL_ID_LIST)) while (!tlvReader.isEndOfContainer()) { add(ContentLauncherClusterAdditionalInfoStruct.fromTlv(AnonymousTag, tlvReader)) } diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterStyleInformationStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterStyleInformationStruct.kt index 9c9da395d51915..41ef65feadd9f0 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterStyleInformationStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ContentLauncherClusterStyleInformationStruct.kt @@ -41,7 +41,7 @@ class ContentLauncherClusterStyleInformationStruct( startStructure(tlvTag) if (imageURL.isPresent) { val optimageURL = imageURL.get() - put(ContextSpecificTag(TAG_IMAGE_U_R_L), optimageURL) + put(ContextSpecificTag(TAG_IMAGE_URL), optimageURL) } if (color.isPresent) { val optcolor = color.get() @@ -56,15 +56,15 @@ class ContentLauncherClusterStyleInformationStruct( } companion object { - private const val TAG_IMAGE_U_R_L = 0 + private const val TAG_IMAGE_URL = 0 private const val TAG_COLOR = 1 private const val TAG_SIZE = 2 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ContentLauncherClusterStyleInformationStruct { tlvReader.enterStructure(tlvTag) val imageURL = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_IMAGE_U_R_L))) { - Optional.of(tlvReader.getString(ContextSpecificTag(TAG_IMAGE_U_R_L))) + if (tlvReader.isNextTag(ContextSpecificTag(TAG_IMAGE_URL))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_IMAGE_URL))) } else { Optional.empty() } diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventStruct.kt index 91a2071e0b3474..5b7a2e7f62773a 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventStruct.kt @@ -50,11 +50,11 @@ class DemandResponseLoadControlClusterLoadControlEventStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_EVENT_I_D), eventID) + put(ContextSpecificTag(TAG_EVENT_ID), eventID) if (programID != null) { - put(ContextSpecificTag(TAG_PROGRAM_I_D), programID) + put(ContextSpecificTag(TAG_PROGRAM_ID), programID) } else { - putNull(ContextSpecificTag(TAG_PROGRAM_I_D)) + putNull(ContextSpecificTag(TAG_PROGRAM_ID)) } put(ContextSpecificTag(TAG_CONTROL), control) put(ContextSpecificTag(TAG_DEVICE_CLASS), deviceClass) @@ -78,8 +78,8 @@ class DemandResponseLoadControlClusterLoadControlEventStruct( } companion object { - private const val TAG_EVENT_I_D = 0 - private const val TAG_PROGRAM_I_D = 1 + private const val TAG_EVENT_ID = 0 + private const val TAG_PROGRAM_ID = 1 private const val TAG_CONTROL = 2 private const val TAG_DEVICE_CLASS = 3 private const val TAG_ENROLLMENT_GROUP = 4 @@ -92,12 +92,12 @@ class DemandResponseLoadControlClusterLoadControlEventStruct( tlvReader: TlvReader, ): DemandResponseLoadControlClusterLoadControlEventStruct { tlvReader.enterStructure(tlvTag) - val eventID = tlvReader.getByteArray(ContextSpecificTag(TAG_EVENT_I_D)) + val eventID = tlvReader.getByteArray(ContextSpecificTag(TAG_EVENT_ID)) val programID = if (!tlvReader.isNull()) { - tlvReader.getByteArray(ContextSpecificTag(TAG_PROGRAM_I_D)) + tlvReader.getByteArray(ContextSpecificTag(TAG_PROGRAM_ID)) } else { - tlvReader.getNull(ContextSpecificTag(TAG_PROGRAM_I_D)) + tlvReader.getNull(ContextSpecificTag(TAG_PROGRAM_ID)) null } val control = tlvReader.getUInt(ContextSpecificTag(TAG_CONTROL)) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlProgramStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlProgramStruct.kt index 3a71f11aedee40..766287fcc6dd62 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlProgramStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DemandResponseLoadControlClusterLoadControlProgramStruct.kt @@ -42,7 +42,7 @@ class DemandResponseLoadControlClusterLoadControlProgramStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_PROGRAM_I_D), programID) + put(ContextSpecificTag(TAG_PROGRAM_ID), programID) put(ContextSpecificTag(TAG_NAME), name) if (enrollmentGroup != null) { put(ContextSpecificTag(TAG_ENROLLMENT_GROUP), enrollmentGroup) @@ -64,7 +64,7 @@ class DemandResponseLoadControlClusterLoadControlProgramStruct( } companion object { - private const val TAG_PROGRAM_I_D = 0 + private const val TAG_PROGRAM_ID = 0 private const val TAG_NAME = 1 private const val TAG_ENROLLMENT_GROUP = 2 private const val TAG_RANDOM_START_MINUTES = 3 @@ -75,7 +75,7 @@ class DemandResponseLoadControlClusterLoadControlProgramStruct( tlvReader: TlvReader, ): DemandResponseLoadControlClusterLoadControlProgramStruct { tlvReader.enterStructure(tlvTag) - val programID = tlvReader.getByteArray(ContextSpecificTag(TAG_PROGRAM_I_D)) + val programID = tlvReader.getByteArray(ContextSpecificTag(TAG_PROGRAM_ID)) val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) val enrollmentGroup = if (!tlvReader.isNull()) { diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DescriptorClusterSemanticTagStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DescriptorClusterSemanticTagStruct.kt index a3da0980b30450..6c13fcab833591 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DescriptorClusterSemanticTagStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DescriptorClusterSemanticTagStruct.kt @@ -46,7 +46,7 @@ class DescriptorClusterSemanticTagStruct( } else { putNull(ContextSpecificTag(TAG_MFG_CODE)) } - put(ContextSpecificTag(TAG_NAMESPACE_I_D), namespaceID) + put(ContextSpecificTag(TAG_NAMESPACE_ID), namespaceID) put(ContextSpecificTag(TAG_TAG), tag) if (label != null) { if (label.isPresent) { @@ -62,7 +62,7 @@ class DescriptorClusterSemanticTagStruct( companion object { private const val TAG_MFG_CODE = 0 - private const val TAG_NAMESPACE_I_D = 1 + private const val TAG_NAMESPACE_ID = 1 private const val TAG_TAG = 2 private const val TAG_LABEL = 3 @@ -75,7 +75,7 @@ class DescriptorClusterSemanticTagStruct( tlvReader.getNull(ContextSpecificTag(TAG_MFG_CODE)) null } - val namespaceID = tlvReader.getUInt(ContextSpecificTag(TAG_NAMESPACE_I_D)) + val namespaceID = tlvReader.getUInt(ContextSpecificTag(TAG_NAMESPACE_ID)) val tag = tlvReader.getUInt(ContextSpecificTag(TAG_TAG)) val label = if (!tlvReader.isNull()) { diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterForecastStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterForecastStruct.kt index 2f3b23fc592020..c554c72fb89dd2 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterForecastStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterForecastStruct.kt @@ -52,7 +52,7 @@ class DeviceEnergyManagementClusterForecastStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_FORECAST_I_D), forecastID) + put(ContextSpecificTag(TAG_FORECAST_ID), forecastID) if (activeSlotNumber != null) { put(ContextSpecificTag(TAG_ACTIVE_SLOT_NUMBER), activeSlotNumber) } else { @@ -84,7 +84,7 @@ class DeviceEnergyManagementClusterForecastStruct( } companion object { - private const val TAG_FORECAST_I_D = 0 + private const val TAG_FORECAST_ID = 0 private const val TAG_ACTIVE_SLOT_NUMBER = 1 private const val TAG_START_TIME = 2 private const val TAG_END_TIME = 3 @@ -96,7 +96,7 @@ class DeviceEnergyManagementClusterForecastStruct( fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): DeviceEnergyManagementClusterForecastStruct { tlvReader.enterStructure(tlvTag) - val forecastID = tlvReader.getULong(ContextSpecificTag(TAG_FORECAST_I_D)) + val forecastID = tlvReader.getULong(ContextSpecificTag(TAG_FORECAST_ID)) val activeSlotNumber = if (!tlvReader.isNull()) { tlvReader.getUInt(ContextSpecificTag(TAG_ACTIVE_SLOT_NUMBER)) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterSlotStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterSlotStruct.kt index f966446dda469d..e33cd10f7514d1 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterSlotStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/DeviceEnergyManagementClusterSlotStruct.kt @@ -89,7 +89,7 @@ class DeviceEnergyManagementClusterSlotStruct( } if (manufacturerESAState.isPresent) { val optmanufacturerESAState = manufacturerESAState.get() - put(ContextSpecificTag(TAG_MANUFACTURER_E_S_A_STATE), optmanufacturerESAState) + put(ContextSpecificTag(TAG_MANUFACTURER_ESA_STATE), optmanufacturerESAState) } if (nominalPower.isPresent) { val optnominalPower = nominalPower.get() @@ -144,7 +144,7 @@ class DeviceEnergyManagementClusterSlotStruct( private const val TAG_SLOT_IS_PAUSABLE = 5 private const val TAG_MIN_PAUSE_DURATION = 6 private const val TAG_MAX_PAUSE_DURATION = 7 - private const val TAG_MANUFACTURER_E_S_A_STATE = 8 + private const val TAG_MANUFACTURER_ESA_STATE = 8 private const val TAG_NOMINAL_POWER = 9 private const val TAG_MIN_POWER = 10 private const val TAG_MAX_POWER = 11 @@ -181,8 +181,8 @@ class DeviceEnergyManagementClusterSlotStruct( Optional.empty() } val manufacturerESAState = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_MANUFACTURER_E_S_A_STATE))) { - Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_MANUFACTURER_E_S_A_STATE))) + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MANUFACTURER_ESA_STATE))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_MANUFACTURER_ESA_STATE))) } else { Optional.empty() } diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterEcosystemLocationStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterEcosystemLocationStruct.kt index 5b1b7103aaed67..bb84dcffef2b40 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterEcosystemLocationStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/EcosystemInformationClusterEcosystemLocationStruct.kt @@ -40,7 +40,7 @@ class EcosystemInformationClusterEcosystemLocationStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_UNIQUE_LOCATION_I_D), uniqueLocationID) + put(ContextSpecificTag(TAG_UNIQUE_LOCATION_ID), uniqueLocationID) locationDescriptor.toTlv(ContextSpecificTag(TAG_LOCATION_DESCRIPTOR), this) put(ContextSpecificTag(TAG_LOCATION_DESCRIPTOR_LAST_EDIT), locationDescriptorLastEdit) put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) @@ -49,7 +49,7 @@ class EcosystemInformationClusterEcosystemLocationStruct( } companion object { - private const val TAG_UNIQUE_LOCATION_I_D = 0 + private const val TAG_UNIQUE_LOCATION_ID = 0 private const val TAG_LOCATION_DESCRIPTOR = 1 private const val TAG_LOCATION_DESCRIPTOR_LAST_EDIT = 2 private const val TAG_FABRIC_INDEX = 254 @@ -59,7 +59,7 @@ class EcosystemInformationClusterEcosystemLocationStruct( tlvReader: TlvReader, ): EcosystemInformationClusterEcosystemLocationStruct { tlvReader.enterStructure(tlvTag) - val uniqueLocationID = tlvReader.getString(ContextSpecificTag(TAG_UNIQUE_LOCATION_I_D)) + val uniqueLocationID = tlvReader.getString(ContextSpecificTag(TAG_UNIQUE_LOCATION_ID)) val locationDescriptor = EcosystemInformationClusterLocationDescriptorStruct.fromTlv( ContextSpecificTag(TAG_LOCATION_DESCRIPTOR), diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GroupKeyManagementClusterGroupKeyMapStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GroupKeyManagementClusterGroupKeyMapStruct.kt index ec1ba8a3efcda2..ddcab454a36fa2 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GroupKeyManagementClusterGroupKeyMapStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GroupKeyManagementClusterGroupKeyMapStruct.kt @@ -39,7 +39,7 @@ class GroupKeyManagementClusterGroupKeyMapStruct( tlvWriter.apply { startStructure(tlvTag) put(ContextSpecificTag(TAG_GROUP_ID), groupId) - put(ContextSpecificTag(TAG_GROUP_KEY_SET_I_D), groupKeySetID) + put(ContextSpecificTag(TAG_GROUP_KEY_SET_ID), groupKeySetID) put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) endStructure() } @@ -47,13 +47,13 @@ class GroupKeyManagementClusterGroupKeyMapStruct( companion object { private const val TAG_GROUP_ID = 1 - private const val TAG_GROUP_KEY_SET_I_D = 2 + private const val TAG_GROUP_KEY_SET_ID = 2 private const val TAG_FABRIC_INDEX = 254 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): GroupKeyManagementClusterGroupKeyMapStruct { tlvReader.enterStructure(tlvTag) val groupId = tlvReader.getUInt(ContextSpecificTag(TAG_GROUP_ID)) - val groupKeySetID = tlvReader.getUInt(ContextSpecificTag(TAG_GROUP_KEY_SET_I_D)) + val groupKeySetID = tlvReader.getUInt(ContextSpecificTag(TAG_GROUP_KEY_SET_ID)) val fabricIndex = tlvReader.getUInt(ContextSpecificTag(TAG_FABRIC_INDEX)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GroupKeyManagementClusterGroupKeySetStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GroupKeyManagementClusterGroupKeySetStruct.kt index e59269a8823c94..5dd1291b0d1f25 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GroupKeyManagementClusterGroupKeySetStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/GroupKeyManagementClusterGroupKeySetStruct.kt @@ -48,7 +48,7 @@ class GroupKeyManagementClusterGroupKeySetStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_GROUP_KEY_SET_I_D), groupKeySetID) + put(ContextSpecificTag(TAG_GROUP_KEY_SET_ID), groupKeySetID) put(ContextSpecificTag(TAG_GROUP_KEY_SECURITY_POLICY), groupKeySecurityPolicy) if (epochKey0 != null) { put(ContextSpecificTag(TAG_EPOCH_KEY0), epochKey0) @@ -85,7 +85,7 @@ class GroupKeyManagementClusterGroupKeySetStruct( } companion object { - private const val TAG_GROUP_KEY_SET_I_D = 0 + private const val TAG_GROUP_KEY_SET_ID = 0 private const val TAG_GROUP_KEY_SECURITY_POLICY = 1 private const val TAG_EPOCH_KEY0 = 2 private const val TAG_EPOCH_START_TIME0 = 3 @@ -96,7 +96,7 @@ class GroupKeyManagementClusterGroupKeySetStruct( fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): GroupKeyManagementClusterGroupKeySetStruct { tlvReader.enterStructure(tlvTag) - val groupKeySetID = tlvReader.getUInt(ContextSpecificTag(TAG_GROUP_KEY_SET_I_D)) + val groupKeySetID = tlvReader.getUInt(ContextSpecificTag(TAG_GROUP_KEY_SET_ID)) val groupKeySecurityPolicy = tlvReader.getUInt(ContextSpecificTag(TAG_GROUP_KEY_SECURITY_POLICY)) val epochKey0 = diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/IcdManagementClusterMonitoringRegistrationStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/IcdManagementClusterMonitoringRegistrationStruct.kt index fd60e6d6da4328..acdcc1643a7ba6 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/IcdManagementClusterMonitoringRegistrationStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/IcdManagementClusterMonitoringRegistrationStruct.kt @@ -40,7 +40,7 @@ class IcdManagementClusterMonitoringRegistrationStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_CHECK_IN_NODE_I_D), checkInNodeID) + put(ContextSpecificTag(TAG_CHECK_IN_NODE_ID), checkInNodeID) put(ContextSpecificTag(TAG_MONITORED_SUBJECT), monitoredSubject) put(ContextSpecificTag(TAG_CLIENT_TYPE), clientType) put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) @@ -49,7 +49,7 @@ class IcdManagementClusterMonitoringRegistrationStruct( } companion object { - private const val TAG_CHECK_IN_NODE_I_D = 1 + private const val TAG_CHECK_IN_NODE_ID = 1 private const val TAG_MONITORED_SUBJECT = 2 private const val TAG_CLIENT_TYPE = 4 private const val TAG_FABRIC_INDEX = 254 @@ -59,7 +59,7 @@ class IcdManagementClusterMonitoringRegistrationStruct( tlvReader: TlvReader, ): IcdManagementClusterMonitoringRegistrationStruct { tlvReader.enterStructure(tlvTag) - val checkInNodeID = tlvReader.getULong(ContextSpecificTag(TAG_CHECK_IN_NODE_I_D)) + val checkInNodeID = tlvReader.getULong(ContextSpecificTag(TAG_CHECK_IN_NODE_ID)) val monitoredSubject = tlvReader.getULong(ContextSpecificTag(TAG_MONITORED_SUBJECT)) val clientType = tlvReader.getUInt(ContextSpecificTag(TAG_CLIENT_TYPE)) val fabricIndex = tlvReader.getUInt(ContextSpecificTag(TAG_FABRIC_INDEX)) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/MessagesClusterMessageResponseOptionStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/MessagesClusterMessageResponseOptionStruct.kt index b8707df67125c1..0f582c0e9c5130 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/MessagesClusterMessageResponseOptionStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/MessagesClusterMessageResponseOptionStruct.kt @@ -39,7 +39,7 @@ class MessagesClusterMessageResponseOptionStruct( startStructure(tlvTag) if (messageResponseID.isPresent) { val optmessageResponseID = messageResponseID.get() - put(ContextSpecificTag(TAG_MESSAGE_RESPONSE_I_D), optmessageResponseID) + put(ContextSpecificTag(TAG_MESSAGE_RESPONSE_ID), optmessageResponseID) } if (label.isPresent) { val optlabel = label.get() @@ -50,14 +50,14 @@ class MessagesClusterMessageResponseOptionStruct( } companion object { - private const val TAG_MESSAGE_RESPONSE_I_D = 0 + private const val TAG_MESSAGE_RESPONSE_ID = 0 private const val TAG_LABEL = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): MessagesClusterMessageResponseOptionStruct { tlvReader.enterStructure(tlvTag) val messageResponseID = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_MESSAGE_RESPONSE_I_D))) { - Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_MESSAGE_RESPONSE_I_D))) + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MESSAGE_RESPONSE_ID))) { + Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_MESSAGE_RESPONSE_ID))) } else { Optional.empty() } diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/MessagesClusterMessageStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/MessagesClusterMessageStruct.kt index 6ad4f41ee313b2..89657c60fd97f2 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/MessagesClusterMessageStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/MessagesClusterMessageStruct.kt @@ -48,7 +48,7 @@ class MessagesClusterMessageStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_MESSAGE_I_D), messageID) + put(ContextSpecificTag(TAG_MESSAGE_ID), messageID) put(ContextSpecificTag(TAG_PRIORITY), priority) put(ContextSpecificTag(TAG_MESSAGE_CONTROL), messageControl) if (startTime != null) { @@ -75,7 +75,7 @@ class MessagesClusterMessageStruct( } companion object { - private const val TAG_MESSAGE_I_D = 0 + private const val TAG_MESSAGE_ID = 0 private const val TAG_PRIORITY = 1 private const val TAG_MESSAGE_CONTROL = 2 private const val TAG_START_TIME = 3 @@ -85,7 +85,7 @@ class MessagesClusterMessageStruct( fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): MessagesClusterMessageStruct { tlvReader.enterStructure(tlvTag) - val messageID = tlvReader.getByteArray(ContextSpecificTag(TAG_MESSAGE_I_D)) + val messageID = tlvReader.getByteArray(ContextSpecificTag(TAG_MESSAGE_ID)) val priority = tlvReader.getUInt(ContextSpecificTag(TAG_PRIORITY)) val messageControl = tlvReader.getUInt(ContextSpecificTag(TAG_MESSAGE_CONTROL)) val startTime = diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/NetworkCommissioningClusterNetworkInfoStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/NetworkCommissioningClusterNetworkInfoStruct.kt index 6d120b2c6e9215..54bfcc1315ca62 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/NetworkCommissioningClusterNetworkInfoStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/NetworkCommissioningClusterNetworkInfoStruct.kt @@ -41,7 +41,7 @@ class NetworkCommissioningClusterNetworkInfoStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_NETWORK_I_D), networkID) + put(ContextSpecificTag(TAG_NETWORK_ID), networkID) put(ContextSpecificTag(TAG_CONNECTED), connected) if (networkIdentifier != null) { if (networkIdentifier.isPresent) { @@ -64,14 +64,14 @@ class NetworkCommissioningClusterNetworkInfoStruct( } companion object { - private const val TAG_NETWORK_I_D = 0 + private const val TAG_NETWORK_ID = 0 private const val TAG_CONNECTED = 1 private const val TAG_NETWORK_IDENTIFIER = 2 private const val TAG_CLIENT_IDENTIFIER = 3 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): NetworkCommissioningClusterNetworkInfoStruct { tlvReader.enterStructure(tlvTag) - val networkID = tlvReader.getByteArray(ContextSpecificTag(TAG_NETWORK_I_D)) + val networkID = tlvReader.getByteArray(ContextSpecificTag(TAG_NETWORK_ID)) val connected = tlvReader.getBoolean(ContextSpecificTag(TAG_CONNECTED)) val networkIdentifier = if (!tlvReader.isNull()) { diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalCredentialsClusterFabricDescriptorStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalCredentialsClusterFabricDescriptorStruct.kt index 5d2af6b6862ffa..938092f700fc2a 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalCredentialsClusterFabricDescriptorStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalCredentialsClusterFabricDescriptorStruct.kt @@ -45,9 +45,9 @@ class OperationalCredentialsClusterFabricDescriptorStruct( tlvWriter.apply { startStructure(tlvTag) put(ContextSpecificTag(TAG_ROOT_PUBLIC_KEY), rootPublicKey) - put(ContextSpecificTag(TAG_VENDOR_I_D), vendorID) - put(ContextSpecificTag(TAG_FABRIC_I_D), fabricID) - put(ContextSpecificTag(TAG_NODE_I_D), nodeID) + put(ContextSpecificTag(TAG_VENDOR_ID), vendorID) + put(ContextSpecificTag(TAG_FABRIC_ID), fabricID) + put(ContextSpecificTag(TAG_NODE_ID), nodeID) put(ContextSpecificTag(TAG_LABEL), label) put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) endStructure() @@ -56,9 +56,9 @@ class OperationalCredentialsClusterFabricDescriptorStruct( companion object { private const val TAG_ROOT_PUBLIC_KEY = 1 - private const val TAG_VENDOR_I_D = 2 - private const val TAG_FABRIC_I_D = 3 - private const val TAG_NODE_I_D = 4 + private const val TAG_VENDOR_ID = 2 + private const val TAG_FABRIC_ID = 3 + private const val TAG_NODE_ID = 4 private const val TAG_LABEL = 5 private const val TAG_FABRIC_INDEX = 254 @@ -68,9 +68,9 @@ class OperationalCredentialsClusterFabricDescriptorStruct( ): OperationalCredentialsClusterFabricDescriptorStruct { tlvReader.enterStructure(tlvTag) val rootPublicKey = tlvReader.getByteArray(ContextSpecificTag(TAG_ROOT_PUBLIC_KEY)) - val vendorID = tlvReader.getUInt(ContextSpecificTag(TAG_VENDOR_I_D)) - val fabricID = tlvReader.getULong(ContextSpecificTag(TAG_FABRIC_I_D)) - val nodeID = tlvReader.getULong(ContextSpecificTag(TAG_NODE_I_D)) + val vendorID = tlvReader.getUInt(ContextSpecificTag(TAG_VENDOR_ID)) + val fabricID = tlvReader.getULong(ContextSpecificTag(TAG_FABRIC_ID)) + val nodeID = tlvReader.getULong(ContextSpecificTag(TAG_NODE_ID)) val label = tlvReader.getString(ContextSpecificTag(TAG_LABEL)) val fabricIndex = tlvReader.getUInt(ContextSpecificTag(TAG_FABRIC_INDEX)) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalStateClusterErrorStateStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalStateClusterErrorStateStruct.kt index c2a0b9a58dc85d..7f2f4b04d2a46b 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalStateClusterErrorStateStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalStateClusterErrorStateStruct.kt @@ -39,7 +39,7 @@ class OperationalStateClusterErrorStateStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_ERROR_STATE_I_D), errorStateID) + put(ContextSpecificTag(TAG_ERROR_STATE_ID), errorStateID) if (errorStateLabel.isPresent) { val opterrorStateLabel = errorStateLabel.get() put(ContextSpecificTag(TAG_ERROR_STATE_LABEL), opterrorStateLabel) @@ -53,13 +53,13 @@ class OperationalStateClusterErrorStateStruct( } companion object { - private const val TAG_ERROR_STATE_I_D = 0 + private const val TAG_ERROR_STATE_ID = 0 private const val TAG_ERROR_STATE_LABEL = 1 private const val TAG_ERROR_STATE_DETAILS = 2 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): OperationalStateClusterErrorStateStruct { tlvReader.enterStructure(tlvTag) - val errorStateID = tlvReader.getUInt(ContextSpecificTag(TAG_ERROR_STATE_I_D)) + val errorStateID = tlvReader.getUInt(ContextSpecificTag(TAG_ERROR_STATE_ID)) val errorStateLabel = if (tlvReader.isNextTag(ContextSpecificTag(TAG_ERROR_STATE_LABEL))) { Optional.of(tlvReader.getString(ContextSpecificTag(TAG_ERROR_STATE_LABEL))) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalStateClusterOperationalStateStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalStateClusterOperationalStateStruct.kt index 558446e0811069..f07d7ec323b8ac 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalStateClusterOperationalStateStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OperationalStateClusterOperationalStateStruct.kt @@ -37,7 +37,7 @@ class OperationalStateClusterOperationalStateStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_OPERATIONAL_STATE_I_D), operationalStateID) + put(ContextSpecificTag(TAG_OPERATIONAL_STATE_ID), operationalStateID) if (operationalStateLabel.isPresent) { val optoperationalStateLabel = operationalStateLabel.get() put(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL), optoperationalStateLabel) @@ -47,12 +47,12 @@ class OperationalStateClusterOperationalStateStruct( } companion object { - private const val TAG_OPERATIONAL_STATE_I_D = 0 + private const val TAG_OPERATIONAL_STATE_ID = 0 private const val TAG_OPERATIONAL_STATE_LABEL = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): OperationalStateClusterOperationalStateStruct { tlvReader.enterStructure(tlvTag) - val operationalStateID = tlvReader.getUInt(ContextSpecificTag(TAG_OPERATIONAL_STATE_I_D)) + val operationalStateID = tlvReader.getUInt(ContextSpecificTag(TAG_OPERATIONAL_STATE_ID)) val operationalStateLabel = if (tlvReader.isNextTag(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL))) { Optional.of(tlvReader.getString(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL))) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OtaSoftwareUpdateRequestorClusterProviderLocation.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OtaSoftwareUpdateRequestorClusterProviderLocation.kt index 25e6467fff7370..a5f1882a6e1f88 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OtaSoftwareUpdateRequestorClusterProviderLocation.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OtaSoftwareUpdateRequestorClusterProviderLocation.kt @@ -38,7 +38,7 @@ class OtaSoftwareUpdateRequestorClusterProviderLocation( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_PROVIDER_NODE_I_D), providerNodeID) + put(ContextSpecificTag(TAG_PROVIDER_NODE_ID), providerNodeID) put(ContextSpecificTag(TAG_ENDPOINT), endpoint) put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) endStructure() @@ -46,7 +46,7 @@ class OtaSoftwareUpdateRequestorClusterProviderLocation( } companion object { - private const val TAG_PROVIDER_NODE_I_D = 1 + private const val TAG_PROVIDER_NODE_ID = 1 private const val TAG_ENDPOINT = 2 private const val TAG_FABRIC_INDEX = 254 @@ -55,7 +55,7 @@ class OtaSoftwareUpdateRequestorClusterProviderLocation( tlvReader: TlvReader, ): OtaSoftwareUpdateRequestorClusterProviderLocation { tlvReader.enterStructure(tlvTag) - val providerNodeID = tlvReader.getULong(ContextSpecificTag(TAG_PROVIDER_NODE_I_D)) + val providerNodeID = tlvReader.getULong(ContextSpecificTag(TAG_PROVIDER_NODE_ID)) val endpoint = tlvReader.getUInt(ContextSpecificTag(TAG_ENDPOINT)) val fabricIndex = tlvReader.getUInt(ContextSpecificTag(TAG_FABRIC_INDEX)) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OvenCavityOperationalStateClusterErrorStateStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OvenCavityOperationalStateClusterErrorStateStruct.kt index 741be20fc83f17..dbaea8f76bd553 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OvenCavityOperationalStateClusterErrorStateStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OvenCavityOperationalStateClusterErrorStateStruct.kt @@ -39,7 +39,7 @@ class OvenCavityOperationalStateClusterErrorStateStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_ERROR_STATE_I_D), errorStateID) + put(ContextSpecificTag(TAG_ERROR_STATE_ID), errorStateID) if (errorStateLabel.isPresent) { val opterrorStateLabel = errorStateLabel.get() put(ContextSpecificTag(TAG_ERROR_STATE_LABEL), opterrorStateLabel) @@ -53,7 +53,7 @@ class OvenCavityOperationalStateClusterErrorStateStruct( } companion object { - private const val TAG_ERROR_STATE_I_D = 0 + private const val TAG_ERROR_STATE_ID = 0 private const val TAG_ERROR_STATE_LABEL = 1 private const val TAG_ERROR_STATE_DETAILS = 2 @@ -62,7 +62,7 @@ class OvenCavityOperationalStateClusterErrorStateStruct( tlvReader: TlvReader, ): OvenCavityOperationalStateClusterErrorStateStruct { tlvReader.enterStructure(tlvTag) - val errorStateID = tlvReader.getUInt(ContextSpecificTag(TAG_ERROR_STATE_I_D)) + val errorStateID = tlvReader.getUInt(ContextSpecificTag(TAG_ERROR_STATE_ID)) val errorStateLabel = if (tlvReader.isNextTag(ContextSpecificTag(TAG_ERROR_STATE_LABEL))) { Optional.of(tlvReader.getString(ContextSpecificTag(TAG_ERROR_STATE_LABEL))) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OvenCavityOperationalStateClusterOperationalStateStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OvenCavityOperationalStateClusterOperationalStateStruct.kt index b8cc6c5082de96..7665b08f051440 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OvenCavityOperationalStateClusterOperationalStateStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/OvenCavityOperationalStateClusterOperationalStateStruct.kt @@ -37,7 +37,7 @@ class OvenCavityOperationalStateClusterOperationalStateStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_OPERATIONAL_STATE_I_D), operationalStateID) + put(ContextSpecificTag(TAG_OPERATIONAL_STATE_ID), operationalStateID) if (operationalStateLabel.isPresent) { val optoperationalStateLabel = operationalStateLabel.get() put(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL), optoperationalStateLabel) @@ -47,7 +47,7 @@ class OvenCavityOperationalStateClusterOperationalStateStruct( } companion object { - private const val TAG_OPERATIONAL_STATE_I_D = 0 + private const val TAG_OPERATIONAL_STATE_ID = 0 private const val TAG_OPERATIONAL_STATE_LABEL = 1 fun fromTlv( @@ -55,7 +55,7 @@ class OvenCavityOperationalStateClusterOperationalStateStruct( tlvReader: TlvReader, ): OvenCavityOperationalStateClusterOperationalStateStruct { tlvReader.enterStructure(tlvTag) - val operationalStateID = tlvReader.getUInt(ContextSpecificTag(TAG_OPERATIONAL_STATE_I_D)) + val operationalStateID = tlvReader.getUInt(ContextSpecificTag(TAG_OPERATIONAL_STATE_ID)) val operationalStateLabel = if (tlvReader.isNextTag(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL))) { Optional.of(tlvReader.getString(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL))) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcOperationalStateClusterErrorStateStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcOperationalStateClusterErrorStateStruct.kt index c9cbcef3190287..b3d4b1b3719d86 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcOperationalStateClusterErrorStateStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcOperationalStateClusterErrorStateStruct.kt @@ -39,7 +39,7 @@ class RvcOperationalStateClusterErrorStateStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_ERROR_STATE_I_D), errorStateID) + put(ContextSpecificTag(TAG_ERROR_STATE_ID), errorStateID) if (errorStateLabel.isPresent) { val opterrorStateLabel = errorStateLabel.get() put(ContextSpecificTag(TAG_ERROR_STATE_LABEL), opterrorStateLabel) @@ -53,13 +53,13 @@ class RvcOperationalStateClusterErrorStateStruct( } companion object { - private const val TAG_ERROR_STATE_I_D = 0 + private const val TAG_ERROR_STATE_ID = 0 private const val TAG_ERROR_STATE_LABEL = 1 private const val TAG_ERROR_STATE_DETAILS = 2 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): RvcOperationalStateClusterErrorStateStruct { tlvReader.enterStructure(tlvTag) - val errorStateID = tlvReader.getUInt(ContextSpecificTag(TAG_ERROR_STATE_I_D)) + val errorStateID = tlvReader.getUInt(ContextSpecificTag(TAG_ERROR_STATE_ID)) val errorStateLabel = if (tlvReader.isNextTag(ContextSpecificTag(TAG_ERROR_STATE_LABEL))) { Optional.of(tlvReader.getString(ContextSpecificTag(TAG_ERROR_STATE_LABEL))) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcOperationalStateClusterOperationalStateStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcOperationalStateClusterOperationalStateStruct.kt index d91e485a254c7e..742857e296377c 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcOperationalStateClusterOperationalStateStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/RvcOperationalStateClusterOperationalStateStruct.kt @@ -37,7 +37,7 @@ class RvcOperationalStateClusterOperationalStateStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_OPERATIONAL_STATE_I_D), operationalStateID) + put(ContextSpecificTag(TAG_OPERATIONAL_STATE_ID), operationalStateID) if (operationalStateLabel.isPresent) { val optoperationalStateLabel = operationalStateLabel.get() put(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL), optoperationalStateLabel) @@ -47,7 +47,7 @@ class RvcOperationalStateClusterOperationalStateStruct( } companion object { - private const val TAG_OPERATIONAL_STATE_I_D = 0 + private const val TAG_OPERATIONAL_STATE_ID = 0 private const val TAG_OPERATIONAL_STATE_LABEL = 1 fun fromTlv( @@ -55,7 +55,7 @@ class RvcOperationalStateClusterOperationalStateStruct( tlvReader: TlvReader, ): RvcOperationalStateClusterOperationalStateStruct { tlvReader.enterStructure(tlvTag) - val operationalStateID = tlvReader.getUInt(ContextSpecificTag(TAG_OPERATIONAL_STATE_I_D)) + val operationalStateID = tlvReader.getUInt(ContextSpecificTag(TAG_OPERATIONAL_STATE_ID)) val operationalStateLabel = if (tlvReader.isNextTag(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL))) { Optional.of(tlvReader.getString(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL))) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt index f8526c71f933a5..80cafb38427a27 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt @@ -51,7 +51,7 @@ class ScenesManagementClusterAttributeValuePairStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_ATTRIBUTE_I_D), attributeID) + put(ContextSpecificTag(TAG_ATTRIBUTE_ID), attributeID) if (valueUnsigned8.isPresent) { val optvalueUnsigned8 = valueUnsigned8.get() put(ContextSpecificTag(TAG_VALUE_UNSIGNED8), optvalueUnsigned8) @@ -89,7 +89,7 @@ class ScenesManagementClusterAttributeValuePairStruct( } companion object { - private const val TAG_ATTRIBUTE_I_D = 0 + private const val TAG_ATTRIBUTE_ID = 0 private const val TAG_VALUE_UNSIGNED8 = 1 private const val TAG_VALUE_SIGNED8 = 2 private const val TAG_VALUE_UNSIGNED16 = 3 @@ -104,7 +104,7 @@ class ScenesManagementClusterAttributeValuePairStruct( tlvReader: TlvReader, ): ScenesManagementClusterAttributeValuePairStruct { tlvReader.enterStructure(tlvTag) - val attributeID = tlvReader.getULong(ContextSpecificTag(TAG_ATTRIBUTE_I_D)) + val attributeID = tlvReader.getULong(ContextSpecificTag(TAG_ATTRIBUTE_ID)) val valueUnsigned8 = if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_UNSIGNED8))) { Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_VALUE_UNSIGNED8))) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt index a2add794802904..31759e0aaaf091 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt @@ -37,7 +37,7 @@ class ScenesManagementClusterExtensionFieldSet( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_CLUSTER_I_D), clusterID) + put(ContextSpecificTag(TAG_CLUSTER_ID), clusterID) startArray(ContextSpecificTag(TAG_ATTRIBUTE_VALUE_LIST)) for (item in attributeValueList.iterator()) { item.toTlv(AnonymousTag, this) @@ -48,12 +48,12 @@ class ScenesManagementClusterExtensionFieldSet( } companion object { - private const val TAG_CLUSTER_I_D = 0 + private const val TAG_CLUSTER_ID = 0 private const val TAG_ATTRIBUTE_VALUE_LIST = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ScenesManagementClusterExtensionFieldSet { tlvReader.enterStructure(tlvTag) - val clusterID = tlvReader.getULong(ContextSpecificTag(TAG_CLUSTER_I_D)) + val clusterID = tlvReader.getULong(ContextSpecificTag(TAG_CLUSTER_ID)) val attributeValueList = buildList { tlvReader.enterArray(ContextSpecificTag(TAG_ATTRIBUTE_VALUE_LIST)) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterAreaStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterAreaStruct.kt index 3f8365d49b3b78..fc6405a96c2f7c 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterAreaStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterAreaStruct.kt @@ -38,11 +38,11 @@ class ServiceAreaClusterAreaStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_AREA_I_D), areaID) + put(ContextSpecificTag(TAG_AREA_ID), areaID) if (mapID != null) { - put(ContextSpecificTag(TAG_MAP_I_D), mapID) + put(ContextSpecificTag(TAG_MAP_ID), mapID) } else { - putNull(ContextSpecificTag(TAG_MAP_I_D)) + putNull(ContextSpecificTag(TAG_MAP_ID)) } areaDesc.toTlv(ContextSpecificTag(TAG_AREA_DESC), this) endStructure() @@ -50,18 +50,18 @@ class ServiceAreaClusterAreaStruct( } companion object { - private const val TAG_AREA_I_D = 0 - private const val TAG_MAP_I_D = 1 + private const val TAG_AREA_ID = 0 + private const val TAG_MAP_ID = 1 private const val TAG_AREA_DESC = 2 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterAreaStruct { tlvReader.enterStructure(tlvTag) - val areaID = tlvReader.getULong(ContextSpecificTag(TAG_AREA_I_D)) + val areaID = tlvReader.getULong(ContextSpecificTag(TAG_AREA_ID)) val mapID = if (!tlvReader.isNull()) { - tlvReader.getULong(ContextSpecificTag(TAG_MAP_I_D)) + tlvReader.getULong(ContextSpecificTag(TAG_MAP_ID)) } else { - tlvReader.getNull(ContextSpecificTag(TAG_MAP_I_D)) + tlvReader.getNull(ContextSpecificTag(TAG_MAP_ID)) null } val areaDesc = diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterMapStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterMapStruct.kt index f00877354d1506..a245321b6bfa1a 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterMapStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterMapStruct.kt @@ -33,19 +33,19 @@ class ServiceAreaClusterMapStruct(val mapID: ULong, val name: String) { fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_MAP_I_D), mapID) + put(ContextSpecificTag(TAG_MAP_ID), mapID) put(ContextSpecificTag(TAG_NAME), name) endStructure() } } companion object { - private const val TAG_MAP_I_D = 0 + private const val TAG_MAP_ID = 0 private const val TAG_NAME = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterMapStruct { tlvReader.enterStructure(tlvTag) - val mapID = tlvReader.getULong(ContextSpecificTag(TAG_MAP_I_D)) + val mapID = tlvReader.getULong(ContextSpecificTag(TAG_MAP_ID)) val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterProgressStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterProgressStruct.kt index ddc8238168981d..684f18805830ae 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterProgressStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterProgressStruct.kt @@ -41,7 +41,7 @@ class ServiceAreaClusterProgressStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_AREA_I_D), areaID) + put(ContextSpecificTag(TAG_AREA_ID), areaID) put(ContextSpecificTag(TAG_STATUS), status) if (totalOperationalTime != null) { if (totalOperationalTime.isPresent) { @@ -64,14 +64,14 @@ class ServiceAreaClusterProgressStruct( } companion object { - private const val TAG_AREA_I_D = 0 + private const val TAG_AREA_ID = 0 private const val TAG_STATUS = 1 private const val TAG_TOTAL_OPERATIONAL_TIME = 2 private const val TAG_ESTIMATED_TIME = 3 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterProgressStruct { tlvReader.enterStructure(tlvTag) - val areaID = tlvReader.getULong(ContextSpecificTag(TAG_AREA_I_D)) + val areaID = tlvReader.getULong(ContextSpecificTag(TAG_AREA_ID)) val status = tlvReader.getUInt(ContextSpecificTag(TAG_STATUS)) val totalOperationalTime = if (!tlvReader.isNull()) { diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterAtomicAttributeStatusStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterAtomicAttributeStatusStruct.kt index 7500a9619d6973..6073c7c9151733 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterAtomicAttributeStatusStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterAtomicAttributeStatusStruct.kt @@ -33,19 +33,19 @@ class ThermostatClusterAtomicAttributeStatusStruct(val attributeID: ULong, val s fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_ATTRIBUTE_I_D), attributeID) + put(ContextSpecificTag(TAG_ATTRIBUTE_ID), attributeID) put(ContextSpecificTag(TAG_STATUS_CODE), statusCode) endStructure() } } companion object { - private const val TAG_ATTRIBUTE_I_D = 0 + private const val TAG_ATTRIBUTE_ID = 0 private const val TAG_STATUS_CODE = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ThermostatClusterAtomicAttributeStatusStruct { tlvReader.enterStructure(tlvTag) - val attributeID = tlvReader.getULong(ContextSpecificTag(TAG_ATTRIBUTE_I_D)) + val attributeID = tlvReader.getULong(ContextSpecificTag(TAG_ATTRIBUTE_ID)) val statusCode = tlvReader.getUInt(ContextSpecificTag(TAG_STATUS_CODE)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterRouteTableStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterRouteTableStruct.kt index a5b201c7e11877..9ec7421f26e426 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterRouteTableStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDiagnosticsClusterRouteTableStruct.kt @@ -57,8 +57,8 @@ class ThreadNetworkDiagnosticsClusterRouteTableStruct( put(ContextSpecificTag(TAG_ROUTER_ID), routerId) put(ContextSpecificTag(TAG_NEXT_HOP), nextHop) put(ContextSpecificTag(TAG_PATH_COST), pathCost) - put(ContextSpecificTag(TAG_L_Q_I_IN), LQIIn) - put(ContextSpecificTag(TAG_L_Q_I_OUT), LQIOut) + put(ContextSpecificTag(TAG_LQI_IN), LQIIn) + put(ContextSpecificTag(TAG_LQI_OUT), LQIOut) put(ContextSpecificTag(TAG_AGE), age) put(ContextSpecificTag(TAG_ALLOCATED), allocated) put(ContextSpecificTag(TAG_LINK_ESTABLISHED), linkEstablished) @@ -72,8 +72,8 @@ class ThreadNetworkDiagnosticsClusterRouteTableStruct( private const val TAG_ROUTER_ID = 2 private const val TAG_NEXT_HOP = 3 private const val TAG_PATH_COST = 4 - private const val TAG_L_Q_I_IN = 5 - private const val TAG_L_Q_I_OUT = 6 + private const val TAG_LQI_IN = 5 + private const val TAG_LQI_OUT = 6 private const val TAG_AGE = 7 private const val TAG_ALLOCATED = 8 private const val TAG_LINK_ESTABLISHED = 9 @@ -88,8 +88,8 @@ class ThreadNetworkDiagnosticsClusterRouteTableStruct( val routerId = tlvReader.getUInt(ContextSpecificTag(TAG_ROUTER_ID)) val nextHop = tlvReader.getUInt(ContextSpecificTag(TAG_NEXT_HOP)) val pathCost = tlvReader.getUInt(ContextSpecificTag(TAG_PATH_COST)) - val LQIIn = tlvReader.getUInt(ContextSpecificTag(TAG_L_Q_I_IN)) - val LQIOut = tlvReader.getUInt(ContextSpecificTag(TAG_L_Q_I_OUT)) + val LQIIn = tlvReader.getUInt(ContextSpecificTag(TAG_LQI_IN)) + val LQIOut = tlvReader.getUInt(ContextSpecificTag(TAG_LQI_OUT)) val age = tlvReader.getUInt(ContextSpecificTag(TAG_AGE)) val allocated = tlvReader.getBoolean(ContextSpecificTag(TAG_ALLOCATED)) val linkEstablished = tlvReader.getBoolean(ContextSpecificTag(TAG_LINK_ESTABLISHED)) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt index ae988738b7be34..f71764e02878c9 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt @@ -40,7 +40,7 @@ class ThreadNetworkDirectoryClusterThreadNetworkStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_EXTENDED_PAN_I_D), extendedPanID) + put(ContextSpecificTag(TAG_EXTENDED_PAN_ID), extendedPanID) put(ContextSpecificTag(TAG_NETWORK_NAME), networkName) put(ContextSpecificTag(TAG_CHANNEL), channel) put(ContextSpecificTag(TAG_ACTIVE_TIMESTAMP), activeTimestamp) @@ -49,7 +49,7 @@ class ThreadNetworkDirectoryClusterThreadNetworkStruct( } companion object { - private const val TAG_EXTENDED_PAN_I_D = 0 + private const val TAG_EXTENDED_PAN_ID = 0 private const val TAG_NETWORK_NAME = 1 private const val TAG_CHANNEL = 2 private const val TAG_ACTIVE_TIMESTAMP = 3 @@ -59,7 +59,7 @@ class ThreadNetworkDirectoryClusterThreadNetworkStruct( tlvReader: TlvReader, ): ThreadNetworkDirectoryClusterThreadNetworkStruct { tlvReader.enterStructure(tlvTag) - val extendedPanID = tlvReader.getByteArray(ContextSpecificTag(TAG_EXTENDED_PAN_I_D)) + val extendedPanID = tlvReader.getByteArray(ContextSpecificTag(TAG_EXTENDED_PAN_ID)) val networkName = tlvReader.getString(ContextSpecificTag(TAG_NETWORK_NAME)) val channel = tlvReader.getUInt(ContextSpecificTag(TAG_CHANNEL)) val activeTimestamp = tlvReader.getULong(ContextSpecificTag(TAG_ACTIVE_TIMESTAMP)) diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct.kt index f9eb70cd134fc5..49458e2b72b493 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct.kt @@ -36,14 +36,14 @@ class TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_NODE_I_D), nodeID) + put(ContextSpecificTag(TAG_NODE_ID), nodeID) put(ContextSpecificTag(TAG_ENDPOINT), endpoint) endStructure() } } companion object { - private const val TAG_NODE_I_D = 0 + private const val TAG_NODE_ID = 0 private const val TAG_ENDPOINT = 1 fun fromTlv( @@ -51,7 +51,7 @@ class TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct( tlvReader: TlvReader, ): TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct { tlvReader.enterStructure(tlvTag) - val nodeID = tlvReader.getULong(ContextSpecificTag(TAG_NODE_I_D)) + val nodeID = tlvReader.getULong(ContextSpecificTag(TAG_NODE_ID)) val endpoint = tlvReader.getUInt(ContextSpecificTag(TAG_ENDPOINT)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterTrustedTimeSourceStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterTrustedTimeSourceStruct.kt index 6b55677ffd6417..12dd09376ac729 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterTrustedTimeSourceStruct.kt +++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TimeSynchronizationClusterTrustedTimeSourceStruct.kt @@ -39,7 +39,7 @@ class TimeSynchronizationClusterTrustedTimeSourceStruct( tlvWriter.apply { startStructure(tlvTag) put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) - put(ContextSpecificTag(TAG_NODE_I_D), nodeID) + put(ContextSpecificTag(TAG_NODE_ID), nodeID) put(ContextSpecificTag(TAG_ENDPOINT), endpoint) endStructure() } @@ -47,7 +47,7 @@ class TimeSynchronizationClusterTrustedTimeSourceStruct( companion object { private const val TAG_FABRIC_INDEX = 0 - private const val TAG_NODE_I_D = 1 + private const val TAG_NODE_ID = 1 private const val TAG_ENDPOINT = 2 fun fromTlv( @@ -56,7 +56,7 @@ class TimeSynchronizationClusterTrustedTimeSourceStruct( ): TimeSynchronizationClusterTrustedTimeSourceStruct { tlvReader.enterStructure(tlvTag) val fabricIndex = tlvReader.getUInt(ContextSpecificTag(TAG_FABRIC_INDEX)) - val nodeID = tlvReader.getULong(ContextSpecificTag(TAG_NODE_I_D)) + val nodeID = tlvReader.getULong(ContextSpecificTag(TAG_NODE_ID)) val endpoint = tlvReader.getUInt(ContextSpecificTag(TAG_ENDPOINT)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/AccountLoginCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/AccountLoginCluster.kt index 2d95215a32cb6d..3357ffff9b5b1a 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/AccountLoginCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/AccountLoginCluster.kt @@ -110,13 +110,13 @@ class AccountLoginCluster( val tlvReader = TlvReader(response.payload) tlvReader.enterStructure(AnonymousTag) - val TAG_SETUP_P_I_N: Int = 0 + val TAG_SETUP_PIN: Int = 0 var setupPIN_decoded: String? = null while (!tlvReader.isEndOfContainer()) { val tag = tlvReader.peekElement().tag - if (tag == ContextSpecificTag(TAG_SETUP_P_I_N)) { + if (tag == ContextSpecificTag(TAG_SETUP_PIN)) { setupPIN_decoded = tlvReader.getString(tag) } else { tlvReader.skipElement() @@ -146,8 +146,8 @@ class AccountLoginCluster( val TAG_TEMP_ACCOUNT_IDENTIFIER_REQ: Int = 0 tlvWriter.put(ContextSpecificTag(TAG_TEMP_ACCOUNT_IDENTIFIER_REQ), tempAccountIdentifier) - val TAG_SETUP_P_I_N_REQ: Int = 1 - tlvWriter.put(ContextSpecificTag(TAG_SETUP_P_I_N_REQ), setupPIN) + val TAG_SETUP_PIN_REQ: Int = 1 + tlvWriter.put(ContextSpecificTag(TAG_SETUP_PIN_REQ), setupPIN) val TAG_NODE_REQ: Int = 2 node?.let { tlvWriter.put(ContextSpecificTag(TAG_NODE_REQ), node) } diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ActionsCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ActionsCluster.kt index 2246c4663cc386..79245c8dc8657b 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/ActionsCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ActionsCluster.kt @@ -113,11 +113,11 @@ class ActionsCluster(private val controller: MatterController, private val endpo val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_ACTION_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_ACTION_I_D_REQ), actionID) + val TAG_ACTION_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_ACTION_ID_REQ), actionID) - val TAG_INVOKE_I_D_REQ: Int = 1 - invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_I_D_REQ), invokeID) } + val TAG_INVOKE_ID_REQ: Int = 1 + invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_ID_REQ), invokeID) } tlvWriter.endStructure() val request: InvokeRequest = @@ -142,11 +142,11 @@ class ActionsCluster(private val controller: MatterController, private val endpo val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_ACTION_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_ACTION_I_D_REQ), actionID) + val TAG_ACTION_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_ACTION_ID_REQ), actionID) - val TAG_INVOKE_I_D_REQ: Int = 1 - invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_I_D_REQ), invokeID) } + val TAG_INVOKE_ID_REQ: Int = 1 + invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_ID_REQ), invokeID) } val TAG_TRANSITION_TIME_REQ: Int = 2 tlvWriter.put(ContextSpecificTag(TAG_TRANSITION_TIME_REQ), transitionTime) @@ -169,11 +169,11 @@ class ActionsCluster(private val controller: MatterController, private val endpo val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_ACTION_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_ACTION_I_D_REQ), actionID) + val TAG_ACTION_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_ACTION_ID_REQ), actionID) - val TAG_INVOKE_I_D_REQ: Int = 1 - invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_I_D_REQ), invokeID) } + val TAG_INVOKE_ID_REQ: Int = 1 + invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_ID_REQ), invokeID) } tlvWriter.endStructure() val request: InvokeRequest = @@ -198,11 +198,11 @@ class ActionsCluster(private val controller: MatterController, private val endpo val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_ACTION_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_ACTION_I_D_REQ), actionID) + val TAG_ACTION_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_ACTION_ID_REQ), actionID) - val TAG_INVOKE_I_D_REQ: Int = 1 - invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_I_D_REQ), invokeID) } + val TAG_INVOKE_ID_REQ: Int = 1 + invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_ID_REQ), invokeID) } val TAG_DURATION_REQ: Int = 2 tlvWriter.put(ContextSpecificTag(TAG_DURATION_REQ), duration) @@ -225,11 +225,11 @@ class ActionsCluster(private val controller: MatterController, private val endpo val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_ACTION_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_ACTION_I_D_REQ), actionID) + val TAG_ACTION_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_ACTION_ID_REQ), actionID) - val TAG_INVOKE_I_D_REQ: Int = 1 - invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_I_D_REQ), invokeID) } + val TAG_INVOKE_ID_REQ: Int = 1 + invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_ID_REQ), invokeID) } tlvWriter.endStructure() val request: InvokeRequest = @@ -249,11 +249,11 @@ class ActionsCluster(private val controller: MatterController, private val endpo val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_ACTION_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_ACTION_I_D_REQ), actionID) + val TAG_ACTION_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_ACTION_ID_REQ), actionID) - val TAG_INVOKE_I_D_REQ: Int = 1 - invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_I_D_REQ), invokeID) } + val TAG_INVOKE_ID_REQ: Int = 1 + invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_ID_REQ), invokeID) } tlvWriter.endStructure() val request: InvokeRequest = @@ -278,11 +278,11 @@ class ActionsCluster(private val controller: MatterController, private val endpo val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_ACTION_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_ACTION_I_D_REQ), actionID) + val TAG_ACTION_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_ACTION_ID_REQ), actionID) - val TAG_INVOKE_I_D_REQ: Int = 1 - invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_I_D_REQ), invokeID) } + val TAG_INVOKE_ID_REQ: Int = 1 + invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_ID_REQ), invokeID) } val TAG_DURATION_REQ: Int = 2 tlvWriter.put(ContextSpecificTag(TAG_DURATION_REQ), duration) @@ -309,11 +309,11 @@ class ActionsCluster(private val controller: MatterController, private val endpo val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_ACTION_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_ACTION_I_D_REQ), actionID) + val TAG_ACTION_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_ACTION_ID_REQ), actionID) - val TAG_INVOKE_I_D_REQ: Int = 1 - invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_I_D_REQ), invokeID) } + val TAG_INVOKE_ID_REQ: Int = 1 + invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_ID_REQ), invokeID) } tlvWriter.endStructure() val request: InvokeRequest = @@ -337,11 +337,11 @@ class ActionsCluster(private val controller: MatterController, private val endpo val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_ACTION_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_ACTION_I_D_REQ), actionID) + val TAG_ACTION_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_ACTION_ID_REQ), actionID) - val TAG_INVOKE_I_D_REQ: Int = 1 - invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_I_D_REQ), invokeID) } + val TAG_INVOKE_ID_REQ: Int = 1 + invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_ID_REQ), invokeID) } tlvWriter.endStructure() val request: InvokeRequest = @@ -366,11 +366,11 @@ class ActionsCluster(private val controller: MatterController, private val endpo val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_ACTION_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_ACTION_I_D_REQ), actionID) + val TAG_ACTION_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_ACTION_ID_REQ), actionID) - val TAG_INVOKE_I_D_REQ: Int = 1 - invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_I_D_REQ), invokeID) } + val TAG_INVOKE_ID_REQ: Int = 1 + invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_ID_REQ), invokeID) } val TAG_DURATION_REQ: Int = 2 tlvWriter.put(ContextSpecificTag(TAG_DURATION_REQ), duration) @@ -397,11 +397,11 @@ class ActionsCluster(private val controller: MatterController, private val endpo val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_ACTION_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_ACTION_I_D_REQ), actionID) + val TAG_ACTION_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_ACTION_ID_REQ), actionID) - val TAG_INVOKE_I_D_REQ: Int = 1 - invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_I_D_REQ), invokeID) } + val TAG_INVOKE_ID_REQ: Int = 1 + invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_ID_REQ), invokeID) } tlvWriter.endStructure() val request: InvokeRequest = @@ -426,11 +426,11 @@ class ActionsCluster(private val controller: MatterController, private val endpo val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_ACTION_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_ACTION_I_D_REQ), actionID) + val TAG_ACTION_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_ACTION_ID_REQ), actionID) - val TAG_INVOKE_I_D_REQ: Int = 1 - invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_I_D_REQ), invokeID) } + val TAG_INVOKE_ID_REQ: Int = 1 + invokeID?.let { tlvWriter.put(ContextSpecificTag(TAG_INVOKE_ID_REQ), invokeID) } val TAG_DURATION_REQ: Int = 2 tlvWriter.put(ContextSpecificTag(TAG_DURATION_REQ), duration) diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/AdministratorCommissioningCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/AdministratorCommissioningCluster.kt index a9ea4c35f04602..5ac1e18a200d19 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/AdministratorCommissioningCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/AdministratorCommissioningCluster.kt @@ -120,8 +120,8 @@ class AdministratorCommissioningCluster( val TAG_COMMISSIONING_TIMEOUT_REQ: Int = 0 tlvWriter.put(ContextSpecificTag(TAG_COMMISSIONING_TIMEOUT_REQ), commissioningTimeout) - val TAG_P_A_K_E_PASSCODE_VERIFIER_REQ: Int = 1 - tlvWriter.put(ContextSpecificTag(TAG_P_A_K_E_PASSCODE_VERIFIER_REQ), PAKEPasscodeVerifier) + val TAG_PAKE_PASSCODE_VERIFIER_REQ: Int = 1 + tlvWriter.put(ContextSpecificTag(TAG_PAKE_PASSCODE_VERIFIER_REQ), PAKEPasscodeVerifier) val TAG_DISCRIMINATOR_REQ: Int = 2 tlvWriter.put(ContextSpecificTag(TAG_DISCRIMINATOR_REQ), discriminator) diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ChannelCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ChannelCluster.kt index 3bbf5997d1e3ec..67eccfdb2126b3 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/ChannelCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ChannelCluster.kt @@ -269,9 +269,9 @@ class ChannelCluster(private val controller: MatterController, private val endpo val TAG_RECORDING_FLAG_REQ: Int = 4 recordingFlag?.let { tlvWriter.put(ContextSpecificTag(TAG_RECORDING_FLAG_REQ), recordingFlag) } - val TAG_EXTERNAL_I_D_LIST_REQ: Int = 5 + val TAG_EXTERNAL_ID_LIST_REQ: Int = 5 externalIDList?.let { - tlvWriter.startArray(ContextSpecificTag(TAG_EXTERNAL_I_D_LIST_REQ)) + tlvWriter.startArray(ContextSpecificTag(TAG_EXTERNAL_ID_LIST_REQ)) for (item in externalIDList.iterator()) { item.toTlv(AnonymousTag, tlvWriter) } @@ -352,8 +352,8 @@ class ChannelCluster(private val controller: MatterController, private val endpo val TAG_SHOULD_RECORD_SERIES_REQ: Int = 1 tlvWriter.put(ContextSpecificTag(TAG_SHOULD_RECORD_SERIES_REQ), shouldRecordSeries) - val TAG_EXTERNAL_I_D_LIST_REQ: Int = 2 - tlvWriter.startArray(ContextSpecificTag(TAG_EXTERNAL_I_D_LIST_REQ)) + val TAG_EXTERNAL_ID_LIST_REQ: Int = 2 + tlvWriter.startArray(ContextSpecificTag(TAG_EXTERNAL_ID_LIST_REQ)) for (item in externalIDList.iterator()) { item.toTlv(AnonymousTag, tlvWriter) } @@ -392,8 +392,8 @@ class ChannelCluster(private val controller: MatterController, private val endpo val TAG_SHOULD_RECORD_SERIES_REQ: Int = 1 tlvWriter.put(ContextSpecificTag(TAG_SHOULD_RECORD_SERIES_REQ), shouldRecordSeries) - val TAG_EXTERNAL_I_D_LIST_REQ: Int = 2 - tlvWriter.startArray(ContextSpecificTag(TAG_EXTERNAL_I_D_LIST_REQ)) + val TAG_EXTERNAL_ID_LIST_REQ: Int = 2 + tlvWriter.startArray(ContextSpecificTag(TAG_EXTERNAL_ID_LIST_REQ)) for (item in externalIDList.iterator()) { item.toTlv(AnonymousTag, tlvWriter) } diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/CommissionerControlCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/CommissionerControlCluster.kt index 6a3d288d56e49c..2daf2b464e948f 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/CommissionerControlCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/CommissionerControlCluster.kt @@ -167,7 +167,7 @@ class CommissionerControlCluster( val TAG_COMMISSIONING_TIMEOUT: Int = 0 var commissioningTimeout_decoded: UShort? = null - val TAG_P_A_K_E_PASSCODE_VERIFIER: Int = 1 + val TAG_PAKE_PASSCODE_VERIFIER: Int = 1 var PAKEPasscodeVerifier_decoded: ByteArray? = null val TAG_DISCRIMINATOR: Int = 2 @@ -186,7 +186,7 @@ class CommissionerControlCluster( commissioningTimeout_decoded = tlvReader.getUShort(tag) } - if (tag == ContextSpecificTag(TAG_P_A_K_E_PASSCODE_VERIFIER)) { + if (tag == ContextSpecificTag(TAG_PAKE_PASSCODE_VERIFIER)) { PAKEPasscodeVerifier_decoded = tlvReader.getByteArray(tag) } diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ContentControlCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ContentControlCluster.kt index 9997c5eb2035a9..c2a44834d09481 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/ContentControlCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ContentControlCluster.kt @@ -116,11 +116,11 @@ class ContentControlCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_OLD_P_I_N_REQ: Int = 0 - oldPIN?.let { tlvWriter.put(ContextSpecificTag(TAG_OLD_P_I_N_REQ), oldPIN) } + val TAG_OLD_PIN_REQ: Int = 0 + oldPIN?.let { tlvWriter.put(ContextSpecificTag(TAG_OLD_PIN_REQ), oldPIN) } - val TAG_NEW_P_I_N_REQ: Int = 1 - tlvWriter.put(ContextSpecificTag(TAG_NEW_P_I_N_REQ), newPIN) + val TAG_NEW_PIN_REQ: Int = 1 + tlvWriter.put(ContextSpecificTag(TAG_NEW_PIN_REQ), newPIN) tlvWriter.endStructure() val request: InvokeRequest = @@ -153,13 +153,13 @@ class ContentControlCluster( val tlvReader = TlvReader(response.payload) tlvReader.enterStructure(AnonymousTag) - val TAG_P_I_N_CODE: Int = 0 + val TAG_PIN_CODE: Int = 0 var PINCode_decoded: String? = null while (!tlvReader.isEndOfContainer()) { val tag = tlvReader.peekElement().tag - if (tag == ContextSpecificTag(TAG_P_I_N_CODE)) { + if (tag == ContextSpecificTag(TAG_PIN_CODE)) { PINCode_decoded = tlvReader.getString(tag) } else { tlvReader.skipElement() @@ -221,8 +221,8 @@ class ContentControlCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_P_I_N_CODE_REQ: Int = 0 - PINCode?.let { tlvWriter.put(ContextSpecificTag(TAG_P_I_N_CODE_REQ), PINCode) } + val TAG_PIN_CODE_REQ: Int = 0 + PINCode?.let { tlvWriter.put(ContextSpecificTag(TAG_PIN_CODE_REQ), PINCode) } val TAG_BONUS_TIME_REQ: Int = 1 bonusTime?.let { tlvWriter.put(ContextSpecificTag(TAG_BONUS_TIME_REQ), bonusTime) } diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ContentLauncherCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ContentLauncherCluster.kt index 67bc46c79b3bbe..ae0b6d4935427f 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/ContentLauncherCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ContentLauncherCluster.kt @@ -190,8 +190,8 @@ class ContentLauncherCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_CONTENT_U_R_L_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_CONTENT_U_R_L_REQ), contentURL) + val TAG_CONTENT_URL_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_CONTENT_URL_REQ), contentURL) val TAG_DISPLAY_STRING_REQ: Int = 1 displayString?.let { tlvWriter.put(ContextSpecificTag(TAG_DISPLAY_STRING_REQ), displayString) } diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/DemandResponseLoadControlCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/DemandResponseLoadControlCluster.kt index f9d0eaf448b2c4..ea72cd4cd78068 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/DemandResponseLoadControlCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/DemandResponseLoadControlCluster.kt @@ -157,8 +157,8 @@ class DemandResponseLoadControlCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_LOAD_CONTROL_PROGRAM_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_LOAD_CONTROL_PROGRAM_I_D_REQ), loadControlProgramID) + val TAG_LOAD_CONTROL_PROGRAM_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_LOAD_CONTROL_PROGRAM_ID_REQ), loadControlProgramID) tlvWriter.endStructure() val request: InvokeRequest = @@ -206,8 +206,8 @@ class DemandResponseLoadControlCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_EVENT_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_EVENT_I_D_REQ), eventID) + val TAG_EVENT_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_EVENT_ID_REQ), eventID) val TAG_CANCEL_CONTROL_REQ: Int = 1 tlvWriter.put(ContextSpecificTag(TAG_CANCEL_CONTROL_REQ), cancelControl) diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/DeviceEnergyManagementCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/DeviceEnergyManagementCluster.kt index b0c1a5f3200107..455b52d4d0853b 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/DeviceEnergyManagementCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/DeviceEnergyManagementCluster.kt @@ -242,8 +242,8 @@ class DeviceEnergyManagementCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_FORECAST_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_FORECAST_I_D_REQ), forecastID) + val TAG_FORECAST_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_FORECAST_ID_REQ), forecastID) val TAG_SLOT_ADJUSTMENTS_REQ: Int = 1 tlvWriter.startArray(ContextSpecificTag(TAG_SLOT_ADJUSTMENTS_REQ)) diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/DiagnosticLogsCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/DiagnosticLogsCluster.kt index bc49bc27cdd316..fb4d455810d966 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/DiagnosticLogsCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/DiagnosticLogsCluster.kt @@ -131,7 +131,7 @@ class DiagnosticLogsCluster( val TAG_LOG_CONTENT: Int = 1 var logContent_decoded: ByteArray? = null - val TAG_U_T_C_TIME_STAMP: Int = 2 + val TAG_UTC_TIME_STAMP: Int = 2 var UTCTimeStamp_decoded: ULong? = null val TAG_TIME_SINCE_BOOT: Int = 3 @@ -148,7 +148,7 @@ class DiagnosticLogsCluster( logContent_decoded = tlvReader.getByteArray(tag) } - if (tag == ContextSpecificTag(TAG_U_T_C_TIME_STAMP)) { + if (tag == ContextSpecificTag(TAG_UTC_TIME_STAMP)) { UTCTimeStamp_decoded = if (tlvReader.isNull()) { tlvReader.getNull(tag) diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/DoorLockCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/DoorLockCluster.kt index 79acaad63e1e48..ff0525a58d8c27 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/DoorLockCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/DoorLockCluster.kt @@ -227,8 +227,8 @@ class DoorLockCluster(private val controller: MatterController, private val endp val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_P_I_N_CODE_REQ: Int = 0 - PINCode?.let { tlvWriter.put(ContextSpecificTag(TAG_P_I_N_CODE_REQ), PINCode) } + val TAG_PIN_CODE_REQ: Int = 0 + PINCode?.let { tlvWriter.put(ContextSpecificTag(TAG_PIN_CODE_REQ), PINCode) } tlvWriter.endStructure() val request: InvokeRequest = @@ -248,8 +248,8 @@ class DoorLockCluster(private val controller: MatterController, private val endp val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_P_I_N_CODE_REQ: Int = 0 - PINCode?.let { tlvWriter.put(ContextSpecificTag(TAG_P_I_N_CODE_REQ), PINCode) } + val TAG_PIN_CODE_REQ: Int = 0 + PINCode?.let { tlvWriter.put(ContextSpecificTag(TAG_PIN_CODE_REQ), PINCode) } tlvWriter.endStructure() val request: InvokeRequest = @@ -276,8 +276,8 @@ class DoorLockCluster(private val controller: MatterController, private val endp val TAG_TIMEOUT_REQ: Int = 0 tlvWriter.put(ContextSpecificTag(TAG_TIMEOUT_REQ), timeout) - val TAG_P_I_N_CODE_REQ: Int = 1 - PINCode?.let { tlvWriter.put(ContextSpecificTag(TAG_P_I_N_CODE_REQ), PINCode) } + val TAG_PIN_CODE_REQ: Int = 1 + PINCode?.let { tlvWriter.put(ContextSpecificTag(TAG_PIN_CODE_REQ), PINCode) } tlvWriter.endStructure() val request: InvokeRequest = @@ -907,8 +907,8 @@ class DoorLockCluster(private val controller: MatterController, private val endp val TAG_USER_NAME_REQ: Int = 2 userName?.let { tlvWriter.put(ContextSpecificTag(TAG_USER_NAME_REQ), userName) } - val TAG_USER_UNIQUE_I_D_REQ: Int = 3 - userUniqueID?.let { tlvWriter.put(ContextSpecificTag(TAG_USER_UNIQUE_I_D_REQ), userUniqueID) } + val TAG_USER_UNIQUE_ID_REQ: Int = 3 + userUniqueID?.let { tlvWriter.put(ContextSpecificTag(TAG_USER_UNIQUE_ID_REQ), userUniqueID) } val TAG_USER_STATUS_REQ: Int = 4 userStatus?.let { tlvWriter.put(ContextSpecificTag(TAG_USER_STATUS_REQ), userStatus) } @@ -961,7 +961,7 @@ class DoorLockCluster(private val controller: MatterController, private val endp val TAG_USER_NAME: Int = 1 var userName_decoded: String? = null - val TAG_USER_UNIQUE_I_D: Int = 2 + val TAG_USER_UNIQUE_ID: Int = 2 var userUniqueID_decoded: UInt? = null val TAG_USER_STATUS: Int = 3 @@ -1007,7 +1007,7 @@ class DoorLockCluster(private val controller: MatterController, private val endp } } - if (tag == ContextSpecificTag(TAG_USER_UNIQUE_I_D)) { + if (tag == ContextSpecificTag(TAG_USER_UNIQUE_ID)) { userUniqueID_decoded = if (tlvReader.isNull()) { tlvReader.getNull(tag) @@ -1435,8 +1435,8 @@ class DoorLockCluster(private val controller: MatterController, private val endp val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_P_I_N_CODE_REQ: Int = 0 - PINCode?.let { tlvWriter.put(ContextSpecificTag(TAG_P_I_N_CODE_REQ), PINCode) } + val TAG_PIN_CODE_REQ: Int = 0 + PINCode?.let { tlvWriter.put(ContextSpecificTag(TAG_PIN_CODE_REQ), PINCode) } tlvWriter.endStructure() val request: InvokeRequest = diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/GeneralCommissioningCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/GeneralCommissioningCluster.kt index 559a466d01924f..92e76e250f0eca 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/GeneralCommissioningCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/GeneralCommissioningCluster.kt @@ -302,11 +302,11 @@ class GeneralCommissioningCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_T_C_VERSION_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_T_C_VERSION_REQ), TCVersion) + val TAG_TC_VERSION_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_TC_VERSION_REQ), TCVersion) - val TAG_T_C_USER_RESPONSE_REQ: Int = 1 - tlvWriter.put(ContextSpecificTag(TAG_T_C_USER_RESPONSE_REQ), TCUserResponse) + val TAG_TC_USER_RESPONSE_REQ: Int = 1 + tlvWriter.put(ContextSpecificTag(TAG_TC_USER_RESPONSE_REQ), TCUserResponse) tlvWriter.endStructure() val request: InvokeRequest = diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/GroupKeyManagementCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/GroupKeyManagementCluster.kt index 4ca4541acd23df..a693149fedc58e 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/GroupKeyManagementCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/GroupKeyManagementCluster.kt @@ -145,8 +145,8 @@ class GroupKeyManagementCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_GROUP_KEY_SET_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_GROUP_KEY_SET_I_D_REQ), groupKeySetID) + val TAG_GROUP_KEY_SET_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_GROUP_KEY_SET_ID_REQ), groupKeySetID) tlvWriter.endStructure() val request: InvokeRequest = @@ -189,8 +189,8 @@ class GroupKeyManagementCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_GROUP_KEY_SET_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_GROUP_KEY_SET_I_D_REQ), groupKeySetID) + val TAG_GROUP_KEY_SET_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_GROUP_KEY_SET_ID_REQ), groupKeySetID) tlvWriter.endStructure() val request: InvokeRequest = diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/GroupsCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/GroupsCluster.kt index 7fe81f72933311..6af48037daf4f7 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/GroupsCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/GroupsCluster.kt @@ -99,8 +99,8 @@ class GroupsCluster(private val controller: MatterController, private val endpoi val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_GROUP_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_GROUP_I_D_REQ), groupID) + val TAG_GROUP_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_GROUP_ID_REQ), groupID) val TAG_GROUP_NAME_REQ: Int = 1 tlvWriter.put(ContextSpecificTag(TAG_GROUP_NAME_REQ), groupName) @@ -121,7 +121,7 @@ class GroupsCluster(private val controller: MatterController, private val endpoi val TAG_STATUS: Int = 0 var status_decoded: UByte? = null - val TAG_GROUP_I_D: Int = 1 + val TAG_GROUP_ID: Int = 1 var groupID_decoded: UShort? = null while (!tlvReader.isEndOfContainer()) { @@ -131,7 +131,7 @@ class GroupsCluster(private val controller: MatterController, private val endpoi status_decoded = tlvReader.getUByte(tag) } - if (tag == ContextSpecificTag(TAG_GROUP_I_D)) { + if (tag == ContextSpecificTag(TAG_GROUP_ID)) { groupID_decoded = tlvReader.getUShort(tag) } else { tlvReader.skipElement() @@ -157,8 +157,8 @@ class GroupsCluster(private val controller: MatterController, private val endpoi val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_GROUP_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_GROUP_I_D_REQ), groupID) + val TAG_GROUP_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_GROUP_ID_REQ), groupID) tlvWriter.endStructure() val request: InvokeRequest = @@ -176,7 +176,7 @@ class GroupsCluster(private val controller: MatterController, private val endpoi val TAG_STATUS: Int = 0 var status_decoded: UByte? = null - val TAG_GROUP_I_D: Int = 1 + val TAG_GROUP_ID: Int = 1 var groupID_decoded: UShort? = null val TAG_GROUP_NAME: Int = 2 @@ -189,7 +189,7 @@ class GroupsCluster(private val controller: MatterController, private val endpoi status_decoded = tlvReader.getUByte(tag) } - if (tag == ContextSpecificTag(TAG_GROUP_I_D)) { + if (tag == ContextSpecificTag(TAG_GROUP_ID)) { groupID_decoded = tlvReader.getUShort(tag) } @@ -302,8 +302,8 @@ class GroupsCluster(private val controller: MatterController, private val endpoi val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_GROUP_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_GROUP_I_D_REQ), groupID) + val TAG_GROUP_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_GROUP_ID_REQ), groupID) tlvWriter.endStructure() val request: InvokeRequest = @@ -321,7 +321,7 @@ class GroupsCluster(private val controller: MatterController, private val endpoi val TAG_STATUS: Int = 0 var status_decoded: UByte? = null - val TAG_GROUP_I_D: Int = 1 + val TAG_GROUP_ID: Int = 1 var groupID_decoded: UShort? = null while (!tlvReader.isEndOfContainer()) { @@ -331,7 +331,7 @@ class GroupsCluster(private val controller: MatterController, private val endpoi status_decoded = tlvReader.getUByte(tag) } - if (tag == ContextSpecificTag(TAG_GROUP_I_D)) { + if (tag == ContextSpecificTag(TAG_GROUP_ID)) { groupID_decoded = tlvReader.getUShort(tag) } else { tlvReader.skipElement() @@ -379,8 +379,8 @@ class GroupsCluster(private val controller: MatterController, private val endpoi val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_GROUP_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_GROUP_I_D_REQ), groupID) + val TAG_GROUP_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_GROUP_ID_REQ), groupID) val TAG_GROUP_NAME_REQ: Int = 1 tlvWriter.put(ContextSpecificTag(TAG_GROUP_NAME_REQ), groupName) diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/IcdManagementCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/IcdManagementCluster.kt index 68f206d72e71f4..414e38d360a803 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/IcdManagementCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/IcdManagementCluster.kt @@ -115,8 +115,8 @@ class IcdManagementCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_CHECK_IN_NODE_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_CHECK_IN_NODE_I_D_REQ), checkInNodeID) + val TAG_CHECK_IN_NODE_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_CHECK_IN_NODE_ID_REQ), checkInNodeID) val TAG_MONITORED_SUBJECT_REQ: Int = 1 tlvWriter.put(ContextSpecificTag(TAG_MONITORED_SUBJECT_REQ), monitoredSubject) @@ -145,13 +145,13 @@ class IcdManagementCluster( val tlvReader = TlvReader(response.payload) tlvReader.enterStructure(AnonymousTag) - val TAG_I_C_D_COUNTER: Int = 0 + val TAG_ICD_COUNTER: Int = 0 var ICDCounter_decoded: UInt? = null while (!tlvReader.isEndOfContainer()) { val tag = tlvReader.peekElement().tag - if (tag == ContextSpecificTag(TAG_I_C_D_COUNTER)) { + if (tag == ContextSpecificTag(TAG_ICD_COUNTER)) { ICDCounter_decoded = tlvReader.getUInt(tag) } else { tlvReader.skipElement() @@ -177,8 +177,8 @@ class IcdManagementCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_CHECK_IN_NODE_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_CHECK_IN_NODE_I_D_REQ), checkInNodeID) + val TAG_CHECK_IN_NODE_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_CHECK_IN_NODE_ID_REQ), checkInNodeID) val TAG_VERIFICATION_KEY_REQ: Int = 1 verificationKey?.let { diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/MediaPlaybackCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/MediaPlaybackCluster.kt index 305eb38b66b221..53a4847c134590 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/MediaPlaybackCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/MediaPlaybackCluster.kt @@ -867,8 +867,8 @@ class MediaPlaybackCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_TRACK_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_TRACK_I_D_REQ), trackID) + val TAG_TRACK_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_TRACK_ID_REQ), trackID) val TAG_AUDIO_OUTPUT_INDEX_REQ: Int = 1 tlvWriter.put(ContextSpecificTag(TAG_AUDIO_OUTPUT_INDEX_REQ), audioOutputIndex) @@ -891,8 +891,8 @@ class MediaPlaybackCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_TRACK_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_TRACK_I_D_REQ), trackID) + val TAG_TRACK_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_TRACK_ID_REQ), trackID) tlvWriter.endStructure() val request: InvokeRequest = diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/MessagesCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/MessagesCluster.kt index 12d6830ad3f6bd..e832c5cefe49b3 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/MessagesCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/MessagesCluster.kt @@ -116,8 +116,8 @@ class MessagesCluster(private val controller: MatterController, private val endp val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_MESSAGE_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_MESSAGE_I_D_REQ), messageID) + val TAG_MESSAGE_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_MESSAGE_ID_REQ), messageID) val TAG_PRIORITY_REQ: Int = 1 tlvWriter.put(ContextSpecificTag(TAG_PRIORITY_REQ), priority) diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/NetworkCommissioningCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/NetworkCommissioningCluster.kt index 29ff013692c6d5..2a144baed4f8fd 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/NetworkCommissioningCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/NetworkCommissioningCluster.kt @@ -576,8 +576,8 @@ class NetworkCommissioningCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_NETWORK_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_NETWORK_I_D_REQ), networkID) + val TAG_NETWORK_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_NETWORK_ID_REQ), networkID) val TAG_BREADCRUMB_REQ: Int = 1 breadcrumb?.let { tlvWriter.put(ContextSpecificTag(TAG_BREADCRUMB_REQ), breadcrumb) } @@ -701,8 +701,8 @@ class NetworkCommissioningCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_NETWORK_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_NETWORK_I_D_REQ), networkID) + val TAG_NETWORK_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_NETWORK_ID_REQ), networkID) val TAG_BREADCRUMB_REQ: Int = 1 breadcrumb?.let { tlvWriter.put(ContextSpecificTag(TAG_BREADCRUMB_REQ), breadcrumb) } @@ -788,8 +788,8 @@ class NetworkCommissioningCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_NETWORK_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_NETWORK_I_D_REQ), networkID) + val TAG_NETWORK_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_NETWORK_ID_REQ), networkID) val TAG_NETWORK_INDEX_REQ: Int = 1 tlvWriter.put(ContextSpecificTag(TAG_NETWORK_INDEX_REQ), networkIndex) diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/OperationalCredentialsCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/OperationalCredentialsCluster.kt index bf066e2c0bfd8c..d96efd654fe092 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/OperationalCredentialsCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/OperationalCredentialsCluster.kt @@ -244,12 +244,12 @@ class OperationalCredentialsCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_C_S_R_NONCE_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_C_S_R_NONCE_REQ), CSRNonce) + val TAG_CSR_NONCE_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_CSR_NONCE_REQ), CSRNonce) - val TAG_IS_FOR_UPDATE_N_O_C_REQ: Int = 1 + val TAG_IS_FOR_UPDATE_NOC_REQ: Int = 1 isForUpdateNOC?.let { - tlvWriter.put(ContextSpecificTag(TAG_IS_FOR_UPDATE_N_O_C_REQ), isForUpdateNOC) + tlvWriter.put(ContextSpecificTag(TAG_IS_FOR_UPDATE_NOC_REQ), isForUpdateNOC) } tlvWriter.endStructure() @@ -265,7 +265,7 @@ class OperationalCredentialsCluster( val tlvReader = TlvReader(response.payload) tlvReader.enterStructure(AnonymousTag) - val TAG_N_O_C_S_R_ELEMENTS: Int = 0 + val TAG_NOCSR_ELEMENTS: Int = 0 var NOCSRElements_decoded: ByteArray? = null val TAG_ATTESTATION_SIGNATURE: Int = 1 @@ -274,7 +274,7 @@ class OperationalCredentialsCluster( while (!tlvReader.isEndOfContainer()) { val tag = tlvReader.peekElement().tag - if (tag == ContextSpecificTag(TAG_N_O_C_S_R_ELEMENTS)) { + if (tag == ContextSpecificTag(TAG_NOCSR_ELEMENTS)) { NOCSRElements_decoded = tlvReader.getByteArray(tag) } @@ -311,14 +311,14 @@ class OperationalCredentialsCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_N_O_C_VALUE_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_N_O_C_VALUE_REQ), NOCValue) + val TAG_NOC_VALUE_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_NOC_VALUE_REQ), NOCValue) - val TAG_I_C_A_C_VALUE_REQ: Int = 1 - ICACValue?.let { tlvWriter.put(ContextSpecificTag(TAG_I_C_A_C_VALUE_REQ), ICACValue) } + val TAG_ICAC_VALUE_REQ: Int = 1 + ICACValue?.let { tlvWriter.put(ContextSpecificTag(TAG_ICAC_VALUE_REQ), ICACValue) } - val TAG_I_P_K_VALUE_REQ: Int = 2 - tlvWriter.put(ContextSpecificTag(TAG_I_P_K_VALUE_REQ), IPKValue) + val TAG_IPK_VALUE_REQ: Int = 2 + tlvWriter.put(ContextSpecificTag(TAG_IPK_VALUE_REQ), IPKValue) val TAG_CASE_ADMIN_SUBJECT_REQ: Int = 3 tlvWriter.put(ContextSpecificTag(TAG_CASE_ADMIN_SUBJECT_REQ), caseAdminSubject) @@ -405,11 +405,11 @@ class OperationalCredentialsCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_N_O_C_VALUE_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_N_O_C_VALUE_REQ), NOCValue) + val TAG_NOC_VALUE_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_NOC_VALUE_REQ), NOCValue) - val TAG_I_C_A_C_VALUE_REQ: Int = 1 - ICACValue?.let { tlvWriter.put(ContextSpecificTag(TAG_I_C_A_C_VALUE_REQ), ICACValue) } + val TAG_ICAC_VALUE_REQ: Int = 1 + ICACValue?.let { tlvWriter.put(ContextSpecificTag(TAG_ICAC_VALUE_REQ), ICACValue) } tlvWriter.endStructure() val request: InvokeRequest = @@ -645,8 +645,8 @@ class OperationalCredentialsCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_ROOT_C_A_CERTIFICATE_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_ROOT_C_A_CERTIFICATE_REQ), rootCACertificate) + val TAG_ROOT_CA_CERTIFICATE_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_ROOT_CA_CERTIFICATE_REQ), rootCACertificate) tlvWriter.endStructure() val request: InvokeRequest = diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/OtaSoftwareUpdateProviderCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/OtaSoftwareUpdateProviderCluster.kt index cfcedb7a1c563e..cf8525ed7f2ad7 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/OtaSoftwareUpdateProviderCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/OtaSoftwareUpdateProviderCluster.kt @@ -112,11 +112,11 @@ class OtaSoftwareUpdateProviderCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_VENDOR_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_VENDOR_I_D_REQ), vendorID) + val TAG_VENDOR_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_VENDOR_ID_REQ), vendorID) - val TAG_PRODUCT_I_D_REQ: Int = 1 - tlvWriter.put(ContextSpecificTag(TAG_PRODUCT_I_D_REQ), productID) + val TAG_PRODUCT_ID_REQ: Int = 1 + tlvWriter.put(ContextSpecificTag(TAG_PRODUCT_ID_REQ), productID) val TAG_SOFTWARE_VERSION_REQ: Int = 2 tlvWriter.put(ContextSpecificTag(TAG_SOFTWARE_VERSION_REQ), softwareVersion) @@ -165,7 +165,7 @@ class OtaSoftwareUpdateProviderCluster( val TAG_DELAYED_ACTION_TIME: Int = 1 var delayedActionTime_decoded: UInt? = null - val TAG_IMAGE_U_R_I: Int = 2 + val TAG_IMAGE_URI: Int = 2 var imageURI_decoded: String? = null val TAG_SOFTWARE_VERSION: Int = 3 @@ -204,7 +204,7 @@ class OtaSoftwareUpdateProviderCluster( } } - if (tag == ContextSpecificTag(TAG_IMAGE_U_R_I)) { + if (tag == ContextSpecificTag(TAG_IMAGE_URI)) { imageURI_decoded = if (tlvReader.isNull()) { tlvReader.getNull(tag) diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/OtaSoftwareUpdateRequestorCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/OtaSoftwareUpdateRequestorCluster.kt index 56a8444d796431..21ca7bd092ed56 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/OtaSoftwareUpdateRequestorCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/OtaSoftwareUpdateRequestorCluster.kt @@ -124,11 +124,11 @@ class OtaSoftwareUpdateRequestorCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_PROVIDER_NODE_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_PROVIDER_NODE_I_D_REQ), providerNodeID) + val TAG_PROVIDER_NODE_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_PROVIDER_NODE_ID_REQ), providerNodeID) - val TAG_VENDOR_I_D_REQ: Int = 1 - tlvWriter.put(ContextSpecificTag(TAG_VENDOR_I_D_REQ), vendorID) + val TAG_VENDOR_ID_REQ: Int = 1 + tlvWriter.put(ContextSpecificTag(TAG_VENDOR_ID_REQ), vendorID) val TAG_ANNOUNCEMENT_REASON_REQ: Int = 2 tlvWriter.put(ContextSpecificTag(TAG_ANNOUNCEMENT_REASON_REQ), announcementReason) diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ScenesManagementCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ScenesManagementCluster.kt index f3f1927f553668..e363f8c88f37f3 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/ScenesManagementCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ScenesManagementCluster.kt @@ -147,11 +147,11 @@ class ScenesManagementCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_GROUP_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_GROUP_I_D_REQ), groupID) + val TAG_GROUP_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_GROUP_ID_REQ), groupID) - val TAG_SCENE_I_D_REQ: Int = 1 - tlvWriter.put(ContextSpecificTag(TAG_SCENE_I_D_REQ), sceneID) + val TAG_SCENE_ID_REQ: Int = 1 + tlvWriter.put(ContextSpecificTag(TAG_SCENE_ID_REQ), sceneID) val TAG_TRANSITION_TIME_REQ: Int = 2 tlvWriter.put(ContextSpecificTag(TAG_TRANSITION_TIME_REQ), transitionTime) @@ -182,10 +182,10 @@ class ScenesManagementCluster( val TAG_STATUS: Int = 0 var status_decoded: UByte? = null - val TAG_GROUP_I_D: Int = 1 + val TAG_GROUP_ID: Int = 1 var groupID_decoded: UShort? = null - val TAG_SCENE_I_D: Int = 2 + val TAG_SCENE_ID: Int = 2 var sceneID_decoded: UByte? = null while (!tlvReader.isEndOfContainer()) { @@ -195,11 +195,11 @@ class ScenesManagementCluster( status_decoded = tlvReader.getUByte(tag) } - if (tag == ContextSpecificTag(TAG_GROUP_I_D)) { + if (tag == ContextSpecificTag(TAG_GROUP_ID)) { groupID_decoded = tlvReader.getUShort(tag) } - if (tag == ContextSpecificTag(TAG_SCENE_I_D)) { + if (tag == ContextSpecificTag(TAG_SCENE_ID)) { sceneID_decoded = tlvReader.getUByte(tag) } else { tlvReader.skipElement() @@ -233,11 +233,11 @@ class ScenesManagementCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_GROUP_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_GROUP_I_D_REQ), groupID) + val TAG_GROUP_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_GROUP_ID_REQ), groupID) - val TAG_SCENE_I_D_REQ: Int = 1 - tlvWriter.put(ContextSpecificTag(TAG_SCENE_I_D_REQ), sceneID) + val TAG_SCENE_ID_REQ: Int = 1 + tlvWriter.put(ContextSpecificTag(TAG_SCENE_ID_REQ), sceneID) tlvWriter.endStructure() val request: InvokeRequest = @@ -255,10 +255,10 @@ class ScenesManagementCluster( val TAG_STATUS: Int = 0 var status_decoded: UByte? = null - val TAG_GROUP_I_D: Int = 1 + val TAG_GROUP_ID: Int = 1 var groupID_decoded: UShort? = null - val TAG_SCENE_I_D: Int = 2 + val TAG_SCENE_ID: Int = 2 var sceneID_decoded: UByte? = null val TAG_TRANSITION_TIME: Int = 3 @@ -277,11 +277,11 @@ class ScenesManagementCluster( status_decoded = tlvReader.getUByte(tag) } - if (tag == ContextSpecificTag(TAG_GROUP_I_D)) { + if (tag == ContextSpecificTag(TAG_GROUP_ID)) { groupID_decoded = tlvReader.getUShort(tag) } - if (tag == ContextSpecificTag(TAG_SCENE_I_D)) { + if (tag == ContextSpecificTag(TAG_SCENE_ID)) { sceneID_decoded = tlvReader.getUByte(tag) } @@ -370,11 +370,11 @@ class ScenesManagementCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_GROUP_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_GROUP_I_D_REQ), groupID) + val TAG_GROUP_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_GROUP_ID_REQ), groupID) - val TAG_SCENE_I_D_REQ: Int = 1 - tlvWriter.put(ContextSpecificTag(TAG_SCENE_I_D_REQ), sceneID) + val TAG_SCENE_ID_REQ: Int = 1 + tlvWriter.put(ContextSpecificTag(TAG_SCENE_ID_REQ), sceneID) tlvWriter.endStructure() val request: InvokeRequest = @@ -392,10 +392,10 @@ class ScenesManagementCluster( val TAG_STATUS: Int = 0 var status_decoded: UByte? = null - val TAG_GROUP_I_D: Int = 1 + val TAG_GROUP_ID: Int = 1 var groupID_decoded: UShort? = null - val TAG_SCENE_I_D: Int = 2 + val TAG_SCENE_ID: Int = 2 var sceneID_decoded: UByte? = null while (!tlvReader.isEndOfContainer()) { @@ -405,11 +405,11 @@ class ScenesManagementCluster( status_decoded = tlvReader.getUByte(tag) } - if (tag == ContextSpecificTag(TAG_GROUP_I_D)) { + if (tag == ContextSpecificTag(TAG_GROUP_ID)) { groupID_decoded = tlvReader.getUShort(tag) } - if (tag == ContextSpecificTag(TAG_SCENE_I_D)) { + if (tag == ContextSpecificTag(TAG_SCENE_ID)) { sceneID_decoded = tlvReader.getUByte(tag) } else { tlvReader.skipElement() @@ -442,8 +442,8 @@ class ScenesManagementCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_GROUP_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_GROUP_I_D_REQ), groupID) + val TAG_GROUP_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_GROUP_ID_REQ), groupID) tlvWriter.endStructure() val request: InvokeRequest = @@ -461,7 +461,7 @@ class ScenesManagementCluster( val TAG_STATUS: Int = 0 var status_decoded: UByte? = null - val TAG_GROUP_I_D: Int = 1 + val TAG_GROUP_ID: Int = 1 var groupID_decoded: UShort? = null while (!tlvReader.isEndOfContainer()) { @@ -471,7 +471,7 @@ class ScenesManagementCluster( status_decoded = tlvReader.getUByte(tag) } - if (tag == ContextSpecificTag(TAG_GROUP_I_D)) { + if (tag == ContextSpecificTag(TAG_GROUP_ID)) { groupID_decoded = tlvReader.getUShort(tag) } else { tlvReader.skipElement() @@ -501,11 +501,11 @@ class ScenesManagementCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_GROUP_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_GROUP_I_D_REQ), groupID) + val TAG_GROUP_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_GROUP_ID_REQ), groupID) - val TAG_SCENE_I_D_REQ: Int = 1 - tlvWriter.put(ContextSpecificTag(TAG_SCENE_I_D_REQ), sceneID) + val TAG_SCENE_ID_REQ: Int = 1 + tlvWriter.put(ContextSpecificTag(TAG_SCENE_ID_REQ), sceneID) tlvWriter.endStructure() val request: InvokeRequest = @@ -523,10 +523,10 @@ class ScenesManagementCluster( val TAG_STATUS: Int = 0 var status_decoded: UByte? = null - val TAG_GROUP_I_D: Int = 1 + val TAG_GROUP_ID: Int = 1 var groupID_decoded: UShort? = null - val TAG_SCENE_I_D: Int = 2 + val TAG_SCENE_ID: Int = 2 var sceneID_decoded: UByte? = null while (!tlvReader.isEndOfContainer()) { @@ -536,11 +536,11 @@ class ScenesManagementCluster( status_decoded = tlvReader.getUByte(tag) } - if (tag == ContextSpecificTag(TAG_GROUP_I_D)) { + if (tag == ContextSpecificTag(TAG_GROUP_ID)) { groupID_decoded = tlvReader.getUShort(tag) } - if (tag == ContextSpecificTag(TAG_SCENE_I_D)) { + if (tag == ContextSpecificTag(TAG_SCENE_ID)) { sceneID_decoded = tlvReader.getUByte(tag) } else { tlvReader.skipElement() @@ -575,11 +575,11 @@ class ScenesManagementCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_GROUP_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_GROUP_I_D_REQ), groupID) + val TAG_GROUP_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_GROUP_ID_REQ), groupID) - val TAG_SCENE_I_D_REQ: Int = 1 - tlvWriter.put(ContextSpecificTag(TAG_SCENE_I_D_REQ), sceneID) + val TAG_SCENE_ID_REQ: Int = 1 + tlvWriter.put(ContextSpecificTag(TAG_SCENE_ID_REQ), sceneID) val TAG_TRANSITION_TIME_REQ: Int = 2 transitionTime?.let { @@ -607,8 +607,8 @@ class ScenesManagementCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_GROUP_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_GROUP_I_D_REQ), groupID) + val TAG_GROUP_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_GROUP_ID_REQ), groupID) tlvWriter.endStructure() val request: InvokeRequest = @@ -629,7 +629,7 @@ class ScenesManagementCluster( val TAG_CAPACITY: Int = 1 var capacity_decoded: UByte? = null - val TAG_GROUP_I_D: Int = 2 + val TAG_GROUP_ID: Int = 2 var groupID_decoded: UShort? = null val TAG_SCENE_LIST: Int = 3 @@ -657,7 +657,7 @@ class ScenesManagementCluster( } } - if (tag == ContextSpecificTag(TAG_GROUP_I_D)) { + if (tag == ContextSpecificTag(TAG_GROUP_ID)) { groupID_decoded = tlvReader.getUShort(tag) } diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ThreadNetworkDirectoryCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ThreadNetworkDirectoryCluster.kt index b5af2b1db2895a..ee5b2e9aea94ec 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/ThreadNetworkDirectoryCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ThreadNetworkDirectoryCluster.kt @@ -137,8 +137,8 @@ class ThreadNetworkDirectoryCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_EXTENDED_PAN_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_EXTENDED_PAN_I_D_REQ), extendedPanID) + val TAG_EXTENDED_PAN_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_EXTENDED_PAN_ID_REQ), extendedPanID) tlvWriter.endStructure() val request: InvokeRequest = @@ -161,8 +161,8 @@ class ThreadNetworkDirectoryCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_EXTENDED_PAN_I_D_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_EXTENDED_PAN_I_D_REQ), extendedPanID) + val TAG_EXTENDED_PAN_ID_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_EXTENDED_PAN_ID_REQ), extendedPanID) tlvWriter.endStructure() val request: InvokeRequest = diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/TimeSynchronizationCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/TimeSynchronizationCluster.kt index 74305abcccf194..c968311230c6cb 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/clusters/TimeSynchronizationCluster.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/TimeSynchronizationCluster.kt @@ -161,8 +161,8 @@ class TimeSynchronizationCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_U_T_C_TIME_REQ: Int = 0 - tlvWriter.put(ContextSpecificTag(TAG_U_T_C_TIME_REQ), UTCTime) + val TAG_UTC_TIME_REQ: Int = 0 + tlvWriter.put(ContextSpecificTag(TAG_UTC_TIME_REQ), UTCTime) val TAG_GRANULARITY_REQ: Int = 1 tlvWriter.put(ContextSpecificTag(TAG_GRANULARITY_REQ), granularity) @@ -237,13 +237,13 @@ class TimeSynchronizationCluster( val tlvReader = TlvReader(response.payload) tlvReader.enterStructure(AnonymousTag) - val TAG_D_S_T_OFFSET_REQUIRED: Int = 0 + val TAG_DST_OFFSET_REQUIRED: Int = 0 var DSTOffsetRequired_decoded: Boolean? = null while (!tlvReader.isEndOfContainer()) { val tag = tlvReader.peekElement().tag - if (tag == ContextSpecificTag(TAG_D_S_T_OFFSET_REQUIRED)) { + if (tag == ContextSpecificTag(TAG_DST_OFFSET_REQUIRED)) { DSTOffsetRequired_decoded = tlvReader.getBoolean(tag) } else { tlvReader.skipElement() @@ -268,8 +268,8 @@ class TimeSynchronizationCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_D_S_T_OFFSET_REQ: Int = 0 - tlvWriter.startArray(ContextSpecificTag(TAG_D_S_T_OFFSET_REQ)) + val TAG_DST_OFFSET_REQ: Int = 0 + tlvWriter.startArray(ContextSpecificTag(TAG_DST_OFFSET_REQ)) for (item in DSTOffset.iterator()) { item.toTlv(AnonymousTag, tlvWriter) } @@ -293,8 +293,8 @@ class TimeSynchronizationCluster( val tlvWriter = TlvWriter() tlvWriter.startStructure(AnonymousTag) - val TAG_DEFAULT_N_T_P_REQ: Int = 0 - defaultNTP?.let { tlvWriter.put(ContextSpecificTag(TAG_DEFAULT_N_T_P_REQ), defaultNTP) } + val TAG_DEFAULT_NTP_REQ: Int = 0 + defaultNTP?.let { tlvWriter.put(ContextSpecificTag(TAG_DEFAULT_NTP_REQ), defaultNTP) } tlvWriter.endStructure() val request: InvokeRequest = diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterAccessControlEntryChangedEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterAccessControlEntryChangedEvent.kt index c4fb86f66ea95e..2ac4b28ebebcb9 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterAccessControlEntryChangedEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterAccessControlEntryChangedEvent.kt @@ -43,14 +43,14 @@ class AccessControlClusterAccessControlEntryChangedEvent( tlvWriter.apply { startStructure(tlvTag) if (adminNodeID != null) { - put(ContextSpecificTag(TAG_ADMIN_NODE_I_D), adminNodeID) + put(ContextSpecificTag(TAG_ADMIN_NODE_ID), adminNodeID) } else { - putNull(ContextSpecificTag(TAG_ADMIN_NODE_I_D)) + putNull(ContextSpecificTag(TAG_ADMIN_NODE_ID)) } if (adminPasscodeID != null) { - put(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D), adminPasscodeID) + put(ContextSpecificTag(TAG_ADMIN_PASSCODE_ID), adminPasscodeID) } else { - putNull(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D)) + putNull(ContextSpecificTag(TAG_ADMIN_PASSCODE_ID)) } put(ContextSpecificTag(TAG_CHANGE_TYPE), changeType) if (latestValue != null) { @@ -64,8 +64,8 @@ class AccessControlClusterAccessControlEntryChangedEvent( } companion object { - private const val TAG_ADMIN_NODE_I_D = 1 - private const val TAG_ADMIN_PASSCODE_I_D = 2 + private const val TAG_ADMIN_NODE_ID = 1 + private const val TAG_ADMIN_PASSCODE_ID = 2 private const val TAG_CHANGE_TYPE = 3 private const val TAG_LATEST_VALUE = 4 private const val TAG_FABRIC_INDEX = 254 @@ -77,16 +77,16 @@ class AccessControlClusterAccessControlEntryChangedEvent( tlvReader.enterStructure(tlvTag) val adminNodeID = if (!tlvReader.isNull()) { - tlvReader.getULong(ContextSpecificTag(TAG_ADMIN_NODE_I_D)) + tlvReader.getULong(ContextSpecificTag(TAG_ADMIN_NODE_ID)) } else { - tlvReader.getNull(ContextSpecificTag(TAG_ADMIN_NODE_I_D)) + tlvReader.getNull(ContextSpecificTag(TAG_ADMIN_NODE_ID)) null } val adminPasscodeID = if (!tlvReader.isNull()) { - tlvReader.getUShort(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D)) + tlvReader.getUShort(ContextSpecificTag(TAG_ADMIN_PASSCODE_ID)) } else { - tlvReader.getNull(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D)) + tlvReader.getNull(ContextSpecificTag(TAG_ADMIN_PASSCODE_ID)) null } val changeType = tlvReader.getUByte(ContextSpecificTag(TAG_CHANGE_TYPE)) diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterAccessControlExtensionChangedEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterAccessControlExtensionChangedEvent.kt index eefb09a6b6286a..668ee86be2e380 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterAccessControlExtensionChangedEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterAccessControlExtensionChangedEvent.kt @@ -44,14 +44,14 @@ class AccessControlClusterAccessControlExtensionChangedEvent( tlvWriter.apply { startStructure(tlvTag) if (adminNodeID != null) { - put(ContextSpecificTag(TAG_ADMIN_NODE_I_D), adminNodeID) + put(ContextSpecificTag(TAG_ADMIN_NODE_ID), adminNodeID) } else { - putNull(ContextSpecificTag(TAG_ADMIN_NODE_I_D)) + putNull(ContextSpecificTag(TAG_ADMIN_NODE_ID)) } if (adminPasscodeID != null) { - put(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D), adminPasscodeID) + put(ContextSpecificTag(TAG_ADMIN_PASSCODE_ID), adminPasscodeID) } else { - putNull(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D)) + putNull(ContextSpecificTag(TAG_ADMIN_PASSCODE_ID)) } put(ContextSpecificTag(TAG_CHANGE_TYPE), changeType) if (latestValue != null) { @@ -65,8 +65,8 @@ class AccessControlClusterAccessControlExtensionChangedEvent( } companion object { - private const val TAG_ADMIN_NODE_I_D = 1 - private const val TAG_ADMIN_PASSCODE_I_D = 2 + private const val TAG_ADMIN_NODE_ID = 1 + private const val TAG_ADMIN_PASSCODE_ID = 2 private const val TAG_CHANGE_TYPE = 3 private const val TAG_LATEST_VALUE = 4 private const val TAG_FABRIC_INDEX = 254 @@ -78,16 +78,16 @@ class AccessControlClusterAccessControlExtensionChangedEvent( tlvReader.enterStructure(tlvTag) val adminNodeID = if (!tlvReader.isNull()) { - tlvReader.getULong(ContextSpecificTag(TAG_ADMIN_NODE_I_D)) + tlvReader.getULong(ContextSpecificTag(TAG_ADMIN_NODE_ID)) } else { - tlvReader.getNull(ContextSpecificTag(TAG_ADMIN_NODE_I_D)) + tlvReader.getNull(ContextSpecificTag(TAG_ADMIN_NODE_ID)) null } val adminPasscodeID = if (!tlvReader.isNull()) { - tlvReader.getUShort(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D)) + tlvReader.getUShort(ContextSpecificTag(TAG_ADMIN_PASSCODE_ID)) } else { - tlvReader.getNull(ContextSpecificTag(TAG_ADMIN_PASSCODE_I_D)) + tlvReader.getNull(ContextSpecificTag(TAG_ADMIN_PASSCODE_ID)) null } val changeType = tlvReader.getUByte(ContextSpecificTag(TAG_CHANGE_TYPE)) diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterFabricRestrictionReviewUpdateEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterFabricRestrictionReviewUpdateEvent.kt index 2dca6ad48fbbe1..6bf03e6afc8c13 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterFabricRestrictionReviewUpdateEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/AccessControlClusterFabricRestrictionReviewUpdateEvent.kt @@ -47,9 +47,9 @@ class AccessControlClusterFabricRestrictionReviewUpdateEvent( putNull(ContextSpecificTag(TAG_INSTRUCTION)) } if (redirectURL != null) { - put(ContextSpecificTag(TAG_REDIRECT_U_R_L), redirectURL) + put(ContextSpecificTag(TAG_REDIRECT_URL), redirectURL) } else { - putNull(ContextSpecificTag(TAG_REDIRECT_U_R_L)) + putNull(ContextSpecificTag(TAG_REDIRECT_URL)) } put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) endStructure() @@ -59,7 +59,7 @@ class AccessControlClusterFabricRestrictionReviewUpdateEvent( companion object { private const val TAG_TOKEN = 0 private const val TAG_INSTRUCTION = 1 - private const val TAG_REDIRECT_U_R_L = 2 + private const val TAG_REDIRECT_URL = 2 private const val TAG_FABRIC_INDEX = 254 fun fromTlv( @@ -77,9 +77,9 @@ class AccessControlClusterFabricRestrictionReviewUpdateEvent( } val redirectURL = if (!tlvReader.isNull()) { - tlvReader.getString(ContextSpecificTag(TAG_REDIRECT_U_R_L)) + tlvReader.getString(ContextSpecificTag(TAG_REDIRECT_URL)) } else { - tlvReader.getNull(ContextSpecificTag(TAG_REDIRECT_U_R_L)) + tlvReader.getNull(ContextSpecificTag(TAG_REDIRECT_URL)) null } val fabricIndex = tlvReader.getUByte(ContextSpecificTag(TAG_FABRIC_INDEX)) diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ActionsClusterActionFailedEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ActionsClusterActionFailedEvent.kt index d41926f85961f3..a1fe90125f5e61 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ActionsClusterActionFailedEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ActionsClusterActionFailedEvent.kt @@ -40,8 +40,8 @@ class ActionsClusterActionFailedEvent( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_ACTION_I_D), actionID) - put(ContextSpecificTag(TAG_INVOKE_I_D), invokeID) + put(ContextSpecificTag(TAG_ACTION_ID), actionID) + put(ContextSpecificTag(TAG_INVOKE_ID), invokeID) put(ContextSpecificTag(TAG_NEW_STATE), newState) put(ContextSpecificTag(TAG_ERROR), error) endStructure() @@ -49,15 +49,15 @@ class ActionsClusterActionFailedEvent( } companion object { - private const val TAG_ACTION_I_D = 0 - private const val TAG_INVOKE_I_D = 1 + private const val TAG_ACTION_ID = 0 + private const val TAG_INVOKE_ID = 1 private const val TAG_NEW_STATE = 2 private const val TAG_ERROR = 3 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ActionsClusterActionFailedEvent { tlvReader.enterStructure(tlvTag) - val actionID = tlvReader.getUShort(ContextSpecificTag(TAG_ACTION_I_D)) - val invokeID = tlvReader.getUInt(ContextSpecificTag(TAG_INVOKE_I_D)) + val actionID = tlvReader.getUShort(ContextSpecificTag(TAG_ACTION_ID)) + val invokeID = tlvReader.getUInt(ContextSpecificTag(TAG_INVOKE_ID)) val newState = tlvReader.getUByte(ContextSpecificTag(TAG_NEW_STATE)) val error = tlvReader.getUByte(ContextSpecificTag(TAG_ERROR)) diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ActionsClusterStateChangedEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ActionsClusterStateChangedEvent.kt index f4c4d26bbad39c..8fdefb84b1b3ba 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ActionsClusterStateChangedEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/ActionsClusterStateChangedEvent.kt @@ -38,22 +38,22 @@ class ActionsClusterStateChangedEvent( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_ACTION_I_D), actionID) - put(ContextSpecificTag(TAG_INVOKE_I_D), invokeID) + put(ContextSpecificTag(TAG_ACTION_ID), actionID) + put(ContextSpecificTag(TAG_INVOKE_ID), invokeID) put(ContextSpecificTag(TAG_NEW_STATE), newState) endStructure() } } companion object { - private const val TAG_ACTION_I_D = 0 - private const val TAG_INVOKE_I_D = 1 + private const val TAG_ACTION_ID = 0 + private const val TAG_INVOKE_ID = 1 private const val TAG_NEW_STATE = 2 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ActionsClusterStateChangedEvent { tlvReader.enterStructure(tlvTag) - val actionID = tlvReader.getUShort(ContextSpecificTag(TAG_ACTION_I_D)) - val invokeID = tlvReader.getUInt(ContextSpecificTag(TAG_INVOKE_I_D)) + val actionID = tlvReader.getUShort(ContextSpecificTag(TAG_ACTION_ID)) + val invokeID = tlvReader.getUInt(ContextSpecificTag(TAG_INVOKE_ID)) val newState = tlvReader.getUByte(ContextSpecificTag(TAG_NEW_STATE)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent.kt index a5e1a7f60ed084..d5e263249bd4c4 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent.kt @@ -68,7 +68,7 @@ class DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_EVENT_I_D), eventID) + put(ContextSpecificTag(TAG_EVENT_ID), eventID) if (transitionIndex != null) { put(ContextSpecificTag(TAG_TRANSITION_INDEX), transitionIndex) } else { @@ -122,7 +122,7 @@ class DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent( } companion object { - private const val TAG_EVENT_I_D = 0 + private const val TAG_EVENT_ID = 0 private const val TAG_TRANSITION_INDEX = 1 private const val TAG_STATUS = 2 private const val TAG_CRITICALITY = 3 @@ -138,7 +138,7 @@ class DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent( tlvReader: TlvReader, ): DemandResponseLoadControlClusterLoadControlEventStatusChangeEvent { tlvReader.enterStructure(tlvTag) - val eventID = tlvReader.getByteArray(ContextSpecificTag(TAG_EVENT_I_D)) + val eventID = tlvReader.getByteArray(ContextSpecificTag(TAG_EVENT_ID)) val transitionIndex = if (!tlvReader.isNull()) { tlvReader.getUByte(ContextSpecificTag(TAG_TRANSITION_INDEX)) diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEVConnectedEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEVConnectedEvent.kt index a0770e7e82af07..672690fcdac70f 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEVConnectedEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEVConnectedEvent.kt @@ -32,17 +32,17 @@ class EnergyEvseClusterEVConnectedEvent(val sessionID: UInt) { fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_SESSION_I_D), sessionID) + put(ContextSpecificTag(TAG_SESSION_ID), sessionID) endStructure() } } companion object { - private const val TAG_SESSION_I_D = 0 + private const val TAG_SESSION_ID = 0 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterEVConnectedEvent { tlvReader.enterStructure(tlvTag) - val sessionID = tlvReader.getUInt(ContextSpecificTag(TAG_SESSION_I_D)) + val sessionID = tlvReader.getUInt(ContextSpecificTag(TAG_SESSION_ID)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEVNotDetectedEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEVNotDetectedEvent.kt index 7af6ae3d0842fb..7f033f40a6c888 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEVNotDetectedEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEVNotDetectedEvent.kt @@ -43,7 +43,7 @@ class EnergyEvseClusterEVNotDetectedEvent( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_SESSION_I_D), sessionID) + put(ContextSpecificTag(TAG_SESSION_ID), sessionID) put(ContextSpecificTag(TAG_STATE), state) put(ContextSpecificTag(TAG_SESSION_DURATION), sessionDuration) put(ContextSpecificTag(TAG_SESSION_ENERGY_CHARGED), sessionEnergyCharged) @@ -56,7 +56,7 @@ class EnergyEvseClusterEVNotDetectedEvent( } companion object { - private const val TAG_SESSION_I_D = 0 + private const val TAG_SESSION_ID = 0 private const val TAG_STATE = 1 private const val TAG_SESSION_DURATION = 2 private const val TAG_SESSION_ENERGY_CHARGED = 3 @@ -64,7 +64,7 @@ class EnergyEvseClusterEVNotDetectedEvent( fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterEVNotDetectedEvent { tlvReader.enterStructure(tlvTag) - val sessionID = tlvReader.getUInt(ContextSpecificTag(TAG_SESSION_I_D)) + val sessionID = tlvReader.getUInt(ContextSpecificTag(TAG_SESSION_ID)) val state = tlvReader.getUByte(ContextSpecificTag(TAG_STATE)) val sessionDuration = tlvReader.getUInt(ContextSpecificTag(TAG_SESSION_DURATION)) val sessionEnergyCharged = tlvReader.getLong(ContextSpecificTag(TAG_SESSION_ENERGY_CHARGED)) diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStartedEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStartedEvent.kt index 17459394a0bfef..d6ca275c22f47a 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStartedEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStartedEvent.kt @@ -41,7 +41,7 @@ class EnergyEvseClusterEnergyTransferStartedEvent( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_SESSION_I_D), sessionID) + put(ContextSpecificTag(TAG_SESSION_ID), sessionID) put(ContextSpecificTag(TAG_STATE), state) put(ContextSpecificTag(TAG_MAXIMUM_CURRENT), maximumCurrent) if (maximumDischargeCurrent.isPresent) { @@ -53,14 +53,14 @@ class EnergyEvseClusterEnergyTransferStartedEvent( } companion object { - private const val TAG_SESSION_I_D = 0 + private const val TAG_SESSION_ID = 0 private const val TAG_STATE = 1 private const val TAG_MAXIMUM_CURRENT = 2 private const val TAG_MAXIMUM_DISCHARGE_CURRENT = 3 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterEnergyTransferStartedEvent { tlvReader.enterStructure(tlvTag) - val sessionID = tlvReader.getUInt(ContextSpecificTag(TAG_SESSION_I_D)) + val sessionID = tlvReader.getUInt(ContextSpecificTag(TAG_SESSION_ID)) val state = tlvReader.getUByte(ContextSpecificTag(TAG_STATE)) val maximumCurrent = tlvReader.getLong(ContextSpecificTag(TAG_MAXIMUM_CURRENT)) val maximumDischargeCurrent = diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStoppedEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStoppedEvent.kt index 56c91b5c1beb71..1dea5f56e6e64d 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStoppedEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterEnergyTransferStoppedEvent.kt @@ -43,7 +43,7 @@ class EnergyEvseClusterEnergyTransferStoppedEvent( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_SESSION_I_D), sessionID) + put(ContextSpecificTag(TAG_SESSION_ID), sessionID) put(ContextSpecificTag(TAG_STATE), state) put(ContextSpecificTag(TAG_REASON), reason) put(ContextSpecificTag(TAG_ENERGY_TRANSFERRED), energyTransferred) @@ -56,7 +56,7 @@ class EnergyEvseClusterEnergyTransferStoppedEvent( } companion object { - private const val TAG_SESSION_I_D = 0 + private const val TAG_SESSION_ID = 0 private const val TAG_STATE = 1 private const val TAG_REASON = 2 private const val TAG_ENERGY_TRANSFERRED = 4 @@ -64,7 +64,7 @@ class EnergyEvseClusterEnergyTransferStoppedEvent( fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): EnergyEvseClusterEnergyTransferStoppedEvent { tlvReader.enterStructure(tlvTag) - val sessionID = tlvReader.getUInt(ContextSpecificTag(TAG_SESSION_I_D)) + val sessionID = tlvReader.getUInt(ContextSpecificTag(TAG_SESSION_ID)) val state = tlvReader.getUByte(ContextSpecificTag(TAG_STATE)) val reason = tlvReader.getUByte(ContextSpecificTag(TAG_REASON)) val energyTransferred = tlvReader.getLong(ContextSpecificTag(TAG_ENERGY_TRANSFERRED)) diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt index 534afc36af6d91..02800fa6ed6733 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/EnergyEvseClusterFaultEvent.kt @@ -41,9 +41,9 @@ class EnergyEvseClusterFaultEvent( tlvWriter.apply { startStructure(tlvTag) if (sessionID != null) { - put(ContextSpecificTag(TAG_SESSION_I_D), sessionID) + put(ContextSpecificTag(TAG_SESSION_ID), sessionID) } else { - putNull(ContextSpecificTag(TAG_SESSION_I_D)) + putNull(ContextSpecificTag(TAG_SESSION_ID)) } put(ContextSpecificTag(TAG_STATE), state) put(ContextSpecificTag(TAG_FAULT_STATE_PREVIOUS_STATE), faultStatePreviousState) @@ -53,7 +53,7 @@ class EnergyEvseClusterFaultEvent( } companion object { - private const val TAG_SESSION_I_D = 0 + private const val TAG_SESSION_ID = 0 private const val TAG_STATE = 1 private const val TAG_FAULT_STATE_PREVIOUS_STATE = 2 private const val TAG_FAULT_STATE_CURRENT_STATE = 4 @@ -62,9 +62,9 @@ class EnergyEvseClusterFaultEvent( tlvReader.enterStructure(tlvTag) val sessionID = if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_SESSION_I_D)) + tlvReader.getUInt(ContextSpecificTag(TAG_SESSION_ID)) } else { - tlvReader.getNull(ContextSpecificTag(TAG_SESSION_I_D)) + tlvReader.getNull(ContextSpecificTag(TAG_SESSION_ID)) null } val state = tlvReader.getUByte(ContextSpecificTag(TAG_STATE)) diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/MessagesClusterMessageCompleteEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/MessagesClusterMessageCompleteEvent.kt index b47a0919d5e5aa..9255c6a84b3e93 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/MessagesClusterMessageCompleteEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/MessagesClusterMessageCompleteEvent.kt @@ -41,14 +41,14 @@ class MessagesClusterMessageCompleteEvent( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_MESSAGE_I_D), messageID) + put(ContextSpecificTag(TAG_MESSAGE_ID), messageID) if (responseID != null) { if (responseID.isPresent) { val optresponseID = responseID.get() - put(ContextSpecificTag(TAG_RESPONSE_I_D), optresponseID) + put(ContextSpecificTag(TAG_RESPONSE_ID), optresponseID) } } else { - putNull(ContextSpecificTag(TAG_RESPONSE_I_D)) + putNull(ContextSpecificTag(TAG_RESPONSE_ID)) } if (reply != null) { if (reply.isPresent) { @@ -68,23 +68,23 @@ class MessagesClusterMessageCompleteEvent( } companion object { - private const val TAG_MESSAGE_I_D = 0 - private const val TAG_RESPONSE_I_D = 1 + private const val TAG_MESSAGE_ID = 0 + private const val TAG_RESPONSE_ID = 1 private const val TAG_REPLY = 2 private const val TAG_FUTURE_MESSAGES_PREFERENCE = 3 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): MessagesClusterMessageCompleteEvent { tlvReader.enterStructure(tlvTag) - val messageID = tlvReader.getByteArray(ContextSpecificTag(TAG_MESSAGE_I_D)) + val messageID = tlvReader.getByteArray(ContextSpecificTag(TAG_MESSAGE_ID)) val responseID = if (!tlvReader.isNull()) { - if (tlvReader.isNextTag(ContextSpecificTag(TAG_RESPONSE_I_D))) { - Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_RESPONSE_I_D))) + if (tlvReader.isNextTag(ContextSpecificTag(TAG_RESPONSE_ID))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_RESPONSE_ID))) } else { Optional.empty() } } else { - tlvReader.getNull(ContextSpecificTag(TAG_RESPONSE_I_D)) + tlvReader.getNull(ContextSpecificTag(TAG_RESPONSE_ID)) null } val reply = diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/MessagesClusterMessagePresentedEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/MessagesClusterMessagePresentedEvent.kt index 7ca3f028ab4b99..eb92978ebc2d27 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/MessagesClusterMessagePresentedEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/MessagesClusterMessagePresentedEvent.kt @@ -32,17 +32,17 @@ class MessagesClusterMessagePresentedEvent(val messageID: ByteArray) { fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_MESSAGE_I_D), messageID) + put(ContextSpecificTag(TAG_MESSAGE_ID), messageID) endStructure() } } companion object { - private const val TAG_MESSAGE_I_D = 0 + private const val TAG_MESSAGE_ID = 0 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): MessagesClusterMessagePresentedEvent { tlvReader.enterStructure(tlvTag) - val messageID = tlvReader.getByteArray(ContextSpecificTag(TAG_MESSAGE_I_D)) + val messageID = tlvReader.getByteArray(ContextSpecificTag(TAG_MESSAGE_ID)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/MessagesClusterMessageQueuedEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/MessagesClusterMessageQueuedEvent.kt index 6292136f5419a8..5f0e2b0b3c46fe 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/MessagesClusterMessageQueuedEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/MessagesClusterMessageQueuedEvent.kt @@ -32,17 +32,17 @@ class MessagesClusterMessageQueuedEvent(val messageID: ByteArray) { fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_MESSAGE_I_D), messageID) + put(ContextSpecificTag(TAG_MESSAGE_ID), messageID) endStructure() } } companion object { - private const val TAG_MESSAGE_I_D = 0 + private const val TAG_MESSAGE_ID = 0 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): MessagesClusterMessageQueuedEvent { tlvReader.enterStructure(tlvTag) - val messageID = tlvReader.getByteArray(ContextSpecificTag(TAG_MESSAGE_I_D)) + val messageID = tlvReader.getByteArray(ContextSpecificTag(TAG_MESSAGE_ID)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/OtaSoftwareUpdateRequestorClusterVersionAppliedEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/OtaSoftwareUpdateRequestorClusterVersionAppliedEvent.kt index 42e62ce0b2bb27..bc361f53a5b2a3 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/OtaSoftwareUpdateRequestorClusterVersionAppliedEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/OtaSoftwareUpdateRequestorClusterVersionAppliedEvent.kt @@ -37,14 +37,14 @@ class OtaSoftwareUpdateRequestorClusterVersionAppliedEvent( tlvWriter.apply { startStructure(tlvTag) put(ContextSpecificTag(TAG_SOFTWARE_VERSION), softwareVersion) - put(ContextSpecificTag(TAG_PRODUCT_I_D), productID) + put(ContextSpecificTag(TAG_PRODUCT_ID), productID) endStructure() } } companion object { private const val TAG_SOFTWARE_VERSION = 0 - private const val TAG_PRODUCT_I_D = 1 + private const val TAG_PRODUCT_ID = 1 fun fromTlv( tlvTag: Tag, @@ -52,7 +52,7 @@ class OtaSoftwareUpdateRequestorClusterVersionAppliedEvent( ): OtaSoftwareUpdateRequestorClusterVersionAppliedEvent { tlvReader.enterStructure(tlvTag) val softwareVersion = tlvReader.getUInt(ContextSpecificTag(TAG_SOFTWARE_VERSION)) - val productID = tlvReader.getUShort(ContextSpecificTag(TAG_PRODUCT_I_D)) + val productID = tlvReader.getUShort(ContextSpecificTag(TAG_PRODUCT_ID)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/TimeSynchronizationClusterDSTStatusEvent.kt b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/TimeSynchronizationClusterDSTStatusEvent.kt index 1f92e4003e280a..53a976552ca1a1 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/eventstructs/TimeSynchronizationClusterDSTStatusEvent.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/eventstructs/TimeSynchronizationClusterDSTStatusEvent.kt @@ -32,17 +32,17 @@ class TimeSynchronizationClusterDSTStatusEvent(val DSTOffsetActive: Boolean) { fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_D_S_T_OFFSET_ACTIVE), DSTOffsetActive) + put(ContextSpecificTag(TAG_DST_OFFSET_ACTIVE), DSTOffsetActive) endStructure() } } companion object { - private const val TAG_D_S_T_OFFSET_ACTIVE = 0 + private const val TAG_DST_OFFSET_ACTIVE = 0 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): TimeSynchronizationClusterDSTStatusEvent { tlvReader.enterStructure(tlvTag) - val DSTOffsetActive = tlvReader.getBoolean(ContextSpecificTag(TAG_D_S_T_OFFSET_ACTIVE)) + val DSTOffsetActive = tlvReader.getBoolean(ContextSpecificTag(TAG_DST_OFFSET_ACTIVE)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ActionsClusterActionStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ActionsClusterActionStruct.kt index bf3650489d0cd4..080da76540c4a6 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ActionsClusterActionStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ActionsClusterActionStruct.kt @@ -44,10 +44,10 @@ class ActionsClusterActionStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_ACTION_I_D), actionID) + put(ContextSpecificTag(TAG_ACTION_ID), actionID) put(ContextSpecificTag(TAG_NAME), name) put(ContextSpecificTag(TAG_TYPE), type) - put(ContextSpecificTag(TAG_ENDPOINT_LIST_I_D), endpointListID) + put(ContextSpecificTag(TAG_ENDPOINT_LIST_ID), endpointListID) put(ContextSpecificTag(TAG_SUPPORTED_COMMANDS), supportedCommands) put(ContextSpecificTag(TAG_STATE), state) endStructure() @@ -55,19 +55,19 @@ class ActionsClusterActionStruct( } companion object { - private const val TAG_ACTION_I_D = 0 + private const val TAG_ACTION_ID = 0 private const val TAG_NAME = 1 private const val TAG_TYPE = 2 - private const val TAG_ENDPOINT_LIST_I_D = 3 + private const val TAG_ENDPOINT_LIST_ID = 3 private const val TAG_SUPPORTED_COMMANDS = 4 private const val TAG_STATE = 5 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ActionsClusterActionStruct { tlvReader.enterStructure(tlvTag) - val actionID = tlvReader.getUShort(ContextSpecificTag(TAG_ACTION_I_D)) + val actionID = tlvReader.getUShort(ContextSpecificTag(TAG_ACTION_ID)) val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) val type = tlvReader.getUByte(ContextSpecificTag(TAG_TYPE)) - val endpointListID = tlvReader.getUShort(ContextSpecificTag(TAG_ENDPOINT_LIST_I_D)) + val endpointListID = tlvReader.getUShort(ContextSpecificTag(TAG_ENDPOINT_LIST_ID)) val supportedCommands = tlvReader.getUShort(ContextSpecificTag(TAG_SUPPORTED_COMMANDS)) val state = tlvReader.getUByte(ContextSpecificTag(TAG_STATE)) diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ActionsClusterEndpointListStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ActionsClusterEndpointListStruct.kt index ce70c5b1ea7878..3c4603e164076d 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ActionsClusterEndpointListStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ActionsClusterEndpointListStruct.kt @@ -41,7 +41,7 @@ class ActionsClusterEndpointListStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_ENDPOINT_LIST_I_D), endpointListID) + put(ContextSpecificTag(TAG_ENDPOINT_LIST_ID), endpointListID) put(ContextSpecificTag(TAG_NAME), name) put(ContextSpecificTag(TAG_TYPE), type) startArray(ContextSpecificTag(TAG_ENDPOINTS)) @@ -54,14 +54,14 @@ class ActionsClusterEndpointListStruct( } companion object { - private const val TAG_ENDPOINT_LIST_I_D = 0 + private const val TAG_ENDPOINT_LIST_ID = 0 private const val TAG_NAME = 1 private const val TAG_TYPE = 2 private const val TAG_ENDPOINTS = 3 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ActionsClusterEndpointListStruct { tlvReader.enterStructure(tlvTag) - val endpointListID = tlvReader.getUShort(ContextSpecificTag(TAG_ENDPOINT_LIST_I_D)) + val endpointListID = tlvReader.getUShort(ContextSpecificTag(TAG_ENDPOINT_LIST_ID)) val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) val type = tlvReader.getUByte(ContextSpecificTag(TAG_TYPE)) val endpoints = diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ApplicationBasicClusterApplicationStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ApplicationBasicClusterApplicationStruct.kt index 603c99e96d754e..be4a1e7984e307 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ApplicationBasicClusterApplicationStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ApplicationBasicClusterApplicationStruct.kt @@ -36,20 +36,20 @@ class ApplicationBasicClusterApplicationStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_CATALOG_VENDOR_I_D), catalogVendorID) - put(ContextSpecificTag(TAG_APPLICATION_I_D), applicationID) + put(ContextSpecificTag(TAG_CATALOG_VENDOR_ID), catalogVendorID) + put(ContextSpecificTag(TAG_APPLICATION_ID), applicationID) endStructure() } } companion object { - private const val TAG_CATALOG_VENDOR_I_D = 0 - private const val TAG_APPLICATION_I_D = 1 + private const val TAG_CATALOG_VENDOR_ID = 0 + private const val TAG_APPLICATION_ID = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ApplicationBasicClusterApplicationStruct { tlvReader.enterStructure(tlvTag) - val catalogVendorID = tlvReader.getUShort(ContextSpecificTag(TAG_CATALOG_VENDOR_I_D)) - val applicationID = tlvReader.getString(ContextSpecificTag(TAG_APPLICATION_I_D)) + val catalogVendorID = tlvReader.getUShort(ContextSpecificTag(TAG_CATALOG_VENDOR_ID)) + val applicationID = tlvReader.getString(ContextSpecificTag(TAG_APPLICATION_ID)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ApplicationLauncherClusterApplicationStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ApplicationLauncherClusterApplicationStruct.kt index 8827b46c04e4bb..ea921ee690d16c 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ApplicationLauncherClusterApplicationStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ApplicationLauncherClusterApplicationStruct.kt @@ -36,20 +36,20 @@ class ApplicationLauncherClusterApplicationStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_CATALOG_VENDOR_I_D), catalogVendorID) - put(ContextSpecificTag(TAG_APPLICATION_I_D), applicationID) + put(ContextSpecificTag(TAG_CATALOG_VENDOR_ID), catalogVendorID) + put(ContextSpecificTag(TAG_APPLICATION_ID), applicationID) endStructure() } } companion object { - private const val TAG_CATALOG_VENDOR_I_D = 0 - private const val TAG_APPLICATION_I_D = 1 + private const val TAG_CATALOG_VENDOR_ID = 0 + private const val TAG_APPLICATION_ID = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ApplicationLauncherClusterApplicationStruct { tlvReader.enterStructure(tlvTag) - val catalogVendorID = tlvReader.getUShort(ContextSpecificTag(TAG_CATALOG_VENDOR_I_D)) - val applicationID = tlvReader.getString(ContextSpecificTag(TAG_APPLICATION_I_D)) + val catalogVendorID = tlvReader.getUShort(ContextSpecificTag(TAG_CATALOG_VENDOR_ID)) + val applicationID = tlvReader.getString(ContextSpecificTag(TAG_APPLICATION_ID)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ChannelClusterProgramStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ChannelClusterProgramStruct.kt index 243e78b0a56087..c8dfd42de67a1c 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ChannelClusterProgramStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ChannelClusterProgramStruct.kt @@ -151,7 +151,7 @@ class ChannelClusterProgramStruct( } if (externalIDList.isPresent) { val optexternalIDList = externalIDList.get() - startArray(ContextSpecificTag(TAG_EXTERNAL_I_D_LIST)) + startArray(ContextSpecificTag(TAG_EXTERNAL_ID_LIST)) for (item in optexternalIDList.iterator()) { item.toTlv(AnonymousTag, this) } @@ -180,7 +180,7 @@ class ChannelClusterProgramStruct( private const val TAG_SERIES_INFO = 15 private const val TAG_CATEGORY_LIST = 16 private const val TAG_CAST_LIST = 17 - private const val TAG_EXTERNAL_I_D_LIST = 18 + private const val TAG_EXTERNAL_ID_LIST = 18 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ChannelClusterProgramStruct { tlvReader.enterStructure(tlvTag) @@ -308,10 +308,10 @@ class ChannelClusterProgramStruct( Optional.empty() } val externalIDList = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_EXTERNAL_I_D_LIST))) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_EXTERNAL_ID_LIST))) { Optional.of( buildList { - tlvReader.enterArray(ContextSpecificTag(TAG_EXTERNAL_I_D_LIST)) + tlvReader.enterArray(ContextSpecificTag(TAG_EXTERNAL_ID_LIST)) while (!tlvReader.isEndOfContainer()) { add(ChannelClusterProgramCastStruct.fromTlv(AnonymousTag, tlvReader)) } diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ContentLauncherClusterParameterStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ContentLauncherClusterParameterStruct.kt index 6d94bd649275bb..1785ef89c54840 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ContentLauncherClusterParameterStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ContentLauncherClusterParameterStruct.kt @@ -44,7 +44,7 @@ class ContentLauncherClusterParameterStruct( put(ContextSpecificTag(TAG_VALUE), value) if (externalIDList.isPresent) { val optexternalIDList = externalIDList.get() - startArray(ContextSpecificTag(TAG_EXTERNAL_I_D_LIST)) + startArray(ContextSpecificTag(TAG_EXTERNAL_ID_LIST)) for (item in optexternalIDList.iterator()) { item.toTlv(AnonymousTag, this) } @@ -57,17 +57,17 @@ class ContentLauncherClusterParameterStruct( companion object { private const val TAG_TYPE = 0 private const val TAG_VALUE = 1 - private const val TAG_EXTERNAL_I_D_LIST = 2 + private const val TAG_EXTERNAL_ID_LIST = 2 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ContentLauncherClusterParameterStruct { tlvReader.enterStructure(tlvTag) val type = tlvReader.getUByte(ContextSpecificTag(TAG_TYPE)) val value = tlvReader.getString(ContextSpecificTag(TAG_VALUE)) val externalIDList = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_EXTERNAL_I_D_LIST))) { + if (tlvReader.isNextTag(ContextSpecificTag(TAG_EXTERNAL_ID_LIST))) { Optional.of( buildList { - tlvReader.enterArray(ContextSpecificTag(TAG_EXTERNAL_I_D_LIST)) + tlvReader.enterArray(ContextSpecificTag(TAG_EXTERNAL_ID_LIST)) while (!tlvReader.isEndOfContainer()) { add(ContentLauncherClusterAdditionalInfoStruct.fromTlv(AnonymousTag, tlvReader)) } diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ContentLauncherClusterStyleInformationStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ContentLauncherClusterStyleInformationStruct.kt index be5d5dd35f25b9..b1a5ea8bfe0a70 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ContentLauncherClusterStyleInformationStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ContentLauncherClusterStyleInformationStruct.kt @@ -41,7 +41,7 @@ class ContentLauncherClusterStyleInformationStruct( startStructure(tlvTag) if (imageURL.isPresent) { val optimageURL = imageURL.get() - put(ContextSpecificTag(TAG_IMAGE_U_R_L), optimageURL) + put(ContextSpecificTag(TAG_IMAGE_URL), optimageURL) } if (color.isPresent) { val optcolor = color.get() @@ -56,15 +56,15 @@ class ContentLauncherClusterStyleInformationStruct( } companion object { - private const val TAG_IMAGE_U_R_L = 0 + private const val TAG_IMAGE_URL = 0 private const val TAG_COLOR = 1 private const val TAG_SIZE = 2 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ContentLauncherClusterStyleInformationStruct { tlvReader.enterStructure(tlvTag) val imageURL = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_IMAGE_U_R_L))) { - Optional.of(tlvReader.getString(ContextSpecificTag(TAG_IMAGE_U_R_L))) + if (tlvReader.isNextTag(ContextSpecificTag(TAG_IMAGE_URL))) { + Optional.of(tlvReader.getString(ContextSpecificTag(TAG_IMAGE_URL))) } else { Optional.empty() } diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventStruct.kt index 83fb56f785729e..e17da92ffddf7e 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/DemandResponseLoadControlClusterLoadControlEventStruct.kt @@ -50,11 +50,11 @@ class DemandResponseLoadControlClusterLoadControlEventStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_EVENT_I_D), eventID) + put(ContextSpecificTag(TAG_EVENT_ID), eventID) if (programID != null) { - put(ContextSpecificTag(TAG_PROGRAM_I_D), programID) + put(ContextSpecificTag(TAG_PROGRAM_ID), programID) } else { - putNull(ContextSpecificTag(TAG_PROGRAM_I_D)) + putNull(ContextSpecificTag(TAG_PROGRAM_ID)) } put(ContextSpecificTag(TAG_CONTROL), control) put(ContextSpecificTag(TAG_DEVICE_CLASS), deviceClass) @@ -78,8 +78,8 @@ class DemandResponseLoadControlClusterLoadControlEventStruct( } companion object { - private const val TAG_EVENT_I_D = 0 - private const val TAG_PROGRAM_I_D = 1 + private const val TAG_EVENT_ID = 0 + private const val TAG_PROGRAM_ID = 1 private const val TAG_CONTROL = 2 private const val TAG_DEVICE_CLASS = 3 private const val TAG_ENROLLMENT_GROUP = 4 @@ -92,12 +92,12 @@ class DemandResponseLoadControlClusterLoadControlEventStruct( tlvReader: TlvReader, ): DemandResponseLoadControlClusterLoadControlEventStruct { tlvReader.enterStructure(tlvTag) - val eventID = tlvReader.getByteArray(ContextSpecificTag(TAG_EVENT_I_D)) + val eventID = tlvReader.getByteArray(ContextSpecificTag(TAG_EVENT_ID)) val programID = if (!tlvReader.isNull()) { - tlvReader.getByteArray(ContextSpecificTag(TAG_PROGRAM_I_D)) + tlvReader.getByteArray(ContextSpecificTag(TAG_PROGRAM_ID)) } else { - tlvReader.getNull(ContextSpecificTag(TAG_PROGRAM_I_D)) + tlvReader.getNull(ContextSpecificTag(TAG_PROGRAM_ID)) null } val control = tlvReader.getUShort(ContextSpecificTag(TAG_CONTROL)) diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/DemandResponseLoadControlClusterLoadControlProgramStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/DemandResponseLoadControlClusterLoadControlProgramStruct.kt index 7e73951b402727..e22ed84158307e 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/DemandResponseLoadControlClusterLoadControlProgramStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/DemandResponseLoadControlClusterLoadControlProgramStruct.kt @@ -42,7 +42,7 @@ class DemandResponseLoadControlClusterLoadControlProgramStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_PROGRAM_I_D), programID) + put(ContextSpecificTag(TAG_PROGRAM_ID), programID) put(ContextSpecificTag(TAG_NAME), name) if (enrollmentGroup != null) { put(ContextSpecificTag(TAG_ENROLLMENT_GROUP), enrollmentGroup) @@ -64,7 +64,7 @@ class DemandResponseLoadControlClusterLoadControlProgramStruct( } companion object { - private const val TAG_PROGRAM_I_D = 0 + private const val TAG_PROGRAM_ID = 0 private const val TAG_NAME = 1 private const val TAG_ENROLLMENT_GROUP = 2 private const val TAG_RANDOM_START_MINUTES = 3 @@ -75,7 +75,7 @@ class DemandResponseLoadControlClusterLoadControlProgramStruct( tlvReader: TlvReader, ): DemandResponseLoadControlClusterLoadControlProgramStruct { tlvReader.enterStructure(tlvTag) - val programID = tlvReader.getByteArray(ContextSpecificTag(TAG_PROGRAM_I_D)) + val programID = tlvReader.getByteArray(ContextSpecificTag(TAG_PROGRAM_ID)) val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) val enrollmentGroup = if (!tlvReader.isNull()) { diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/DescriptorClusterSemanticTagStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/DescriptorClusterSemanticTagStruct.kt index 358cf48bbbbb13..f0206f14fa26cc 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/DescriptorClusterSemanticTagStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/DescriptorClusterSemanticTagStruct.kt @@ -46,7 +46,7 @@ class DescriptorClusterSemanticTagStruct( } else { putNull(ContextSpecificTag(TAG_MFG_CODE)) } - put(ContextSpecificTag(TAG_NAMESPACE_I_D), namespaceID) + put(ContextSpecificTag(TAG_NAMESPACE_ID), namespaceID) put(ContextSpecificTag(TAG_TAG), tag) if (label != null) { if (label.isPresent) { @@ -62,7 +62,7 @@ class DescriptorClusterSemanticTagStruct( companion object { private const val TAG_MFG_CODE = 0 - private const val TAG_NAMESPACE_I_D = 1 + private const val TAG_NAMESPACE_ID = 1 private const val TAG_TAG = 2 private const val TAG_LABEL = 3 @@ -75,7 +75,7 @@ class DescriptorClusterSemanticTagStruct( tlvReader.getNull(ContextSpecificTag(TAG_MFG_CODE)) null } - val namespaceID = tlvReader.getUByte(ContextSpecificTag(TAG_NAMESPACE_I_D)) + val namespaceID = tlvReader.getUByte(ContextSpecificTag(TAG_NAMESPACE_ID)) val tag = tlvReader.getUByte(ContextSpecificTag(TAG_TAG)) val label = if (!tlvReader.isNull()) { diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterForecastStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterForecastStruct.kt index f58179f523f7bd..d10b032374dade 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterForecastStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterForecastStruct.kt @@ -52,7 +52,7 @@ class DeviceEnergyManagementClusterForecastStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_FORECAST_I_D), forecastID) + put(ContextSpecificTag(TAG_FORECAST_ID), forecastID) if (activeSlotNumber != null) { put(ContextSpecificTag(TAG_ACTIVE_SLOT_NUMBER), activeSlotNumber) } else { @@ -84,7 +84,7 @@ class DeviceEnergyManagementClusterForecastStruct( } companion object { - private const val TAG_FORECAST_I_D = 0 + private const val TAG_FORECAST_ID = 0 private const val TAG_ACTIVE_SLOT_NUMBER = 1 private const val TAG_START_TIME = 2 private const val TAG_END_TIME = 3 @@ -96,7 +96,7 @@ class DeviceEnergyManagementClusterForecastStruct( fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): DeviceEnergyManagementClusterForecastStruct { tlvReader.enterStructure(tlvTag) - val forecastID = tlvReader.getUInt(ContextSpecificTag(TAG_FORECAST_I_D)) + val forecastID = tlvReader.getUInt(ContextSpecificTag(TAG_FORECAST_ID)) val activeSlotNumber = if (!tlvReader.isNull()) { tlvReader.getUShort(ContextSpecificTag(TAG_ACTIVE_SLOT_NUMBER)) diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterSlotStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterSlotStruct.kt index 794aef83e5158e..d1babaf255c322 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterSlotStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/DeviceEnergyManagementClusterSlotStruct.kt @@ -89,7 +89,7 @@ class DeviceEnergyManagementClusterSlotStruct( } if (manufacturerESAState.isPresent) { val optmanufacturerESAState = manufacturerESAState.get() - put(ContextSpecificTag(TAG_MANUFACTURER_E_S_A_STATE), optmanufacturerESAState) + put(ContextSpecificTag(TAG_MANUFACTURER_ESA_STATE), optmanufacturerESAState) } if (nominalPower.isPresent) { val optnominalPower = nominalPower.get() @@ -144,7 +144,7 @@ class DeviceEnergyManagementClusterSlotStruct( private const val TAG_SLOT_IS_PAUSABLE = 5 private const val TAG_MIN_PAUSE_DURATION = 6 private const val TAG_MAX_PAUSE_DURATION = 7 - private const val TAG_MANUFACTURER_E_S_A_STATE = 8 + private const val TAG_MANUFACTURER_ESA_STATE = 8 private const val TAG_NOMINAL_POWER = 9 private const val TAG_MIN_POWER = 10 private const val TAG_MAX_POWER = 11 @@ -181,8 +181,8 @@ class DeviceEnergyManagementClusterSlotStruct( Optional.empty() } val manufacturerESAState = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_MANUFACTURER_E_S_A_STATE))) { - Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_MANUFACTURER_E_S_A_STATE))) + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MANUFACTURER_ESA_STATE))) { + Optional.of(tlvReader.getUShort(ContextSpecificTag(TAG_MANUFACTURER_ESA_STATE))) } else { Optional.empty() } diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/EcosystemInformationClusterEcosystemLocationStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/EcosystemInformationClusterEcosystemLocationStruct.kt index 5d44434897197d..f59492e6195cfd 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/EcosystemInformationClusterEcosystemLocationStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/EcosystemInformationClusterEcosystemLocationStruct.kt @@ -40,7 +40,7 @@ class EcosystemInformationClusterEcosystemLocationStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_UNIQUE_LOCATION_I_D), uniqueLocationID) + put(ContextSpecificTag(TAG_UNIQUE_LOCATION_ID), uniqueLocationID) locationDescriptor.toTlv(ContextSpecificTag(TAG_LOCATION_DESCRIPTOR), this) put(ContextSpecificTag(TAG_LOCATION_DESCRIPTOR_LAST_EDIT), locationDescriptorLastEdit) put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) @@ -49,7 +49,7 @@ class EcosystemInformationClusterEcosystemLocationStruct( } companion object { - private const val TAG_UNIQUE_LOCATION_I_D = 0 + private const val TAG_UNIQUE_LOCATION_ID = 0 private const val TAG_LOCATION_DESCRIPTOR = 1 private const val TAG_LOCATION_DESCRIPTOR_LAST_EDIT = 2 private const val TAG_FABRIC_INDEX = 254 @@ -59,7 +59,7 @@ class EcosystemInformationClusterEcosystemLocationStruct( tlvReader: TlvReader, ): EcosystemInformationClusterEcosystemLocationStruct { tlvReader.enterStructure(tlvTag) - val uniqueLocationID = tlvReader.getString(ContextSpecificTag(TAG_UNIQUE_LOCATION_I_D)) + val uniqueLocationID = tlvReader.getString(ContextSpecificTag(TAG_UNIQUE_LOCATION_ID)) val locationDescriptor = EcosystemInformationClusterLocationDescriptorStruct.fromTlv( ContextSpecificTag(TAG_LOCATION_DESCRIPTOR), diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/GroupKeyManagementClusterGroupKeyMapStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/GroupKeyManagementClusterGroupKeyMapStruct.kt index fae021994f551c..ad1823e569c56e 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/GroupKeyManagementClusterGroupKeyMapStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/GroupKeyManagementClusterGroupKeyMapStruct.kt @@ -39,7 +39,7 @@ class GroupKeyManagementClusterGroupKeyMapStruct( tlvWriter.apply { startStructure(tlvTag) put(ContextSpecificTag(TAG_GROUP_ID), groupId) - put(ContextSpecificTag(TAG_GROUP_KEY_SET_I_D), groupKeySetID) + put(ContextSpecificTag(TAG_GROUP_KEY_SET_ID), groupKeySetID) put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) endStructure() } @@ -47,13 +47,13 @@ class GroupKeyManagementClusterGroupKeyMapStruct( companion object { private const val TAG_GROUP_ID = 1 - private const val TAG_GROUP_KEY_SET_I_D = 2 + private const val TAG_GROUP_KEY_SET_ID = 2 private const val TAG_FABRIC_INDEX = 254 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): GroupKeyManagementClusterGroupKeyMapStruct { tlvReader.enterStructure(tlvTag) val groupId = tlvReader.getUShort(ContextSpecificTag(TAG_GROUP_ID)) - val groupKeySetID = tlvReader.getUShort(ContextSpecificTag(TAG_GROUP_KEY_SET_I_D)) + val groupKeySetID = tlvReader.getUShort(ContextSpecificTag(TAG_GROUP_KEY_SET_ID)) val fabricIndex = tlvReader.getUByte(ContextSpecificTag(TAG_FABRIC_INDEX)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/GroupKeyManagementClusterGroupKeySetStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/GroupKeyManagementClusterGroupKeySetStruct.kt index 9443c0f6f80abb..1419d29377c27a 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/GroupKeyManagementClusterGroupKeySetStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/GroupKeyManagementClusterGroupKeySetStruct.kt @@ -48,7 +48,7 @@ class GroupKeyManagementClusterGroupKeySetStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_GROUP_KEY_SET_I_D), groupKeySetID) + put(ContextSpecificTag(TAG_GROUP_KEY_SET_ID), groupKeySetID) put(ContextSpecificTag(TAG_GROUP_KEY_SECURITY_POLICY), groupKeySecurityPolicy) if (epochKey0 != null) { put(ContextSpecificTag(TAG_EPOCH_KEY0), epochKey0) @@ -85,7 +85,7 @@ class GroupKeyManagementClusterGroupKeySetStruct( } companion object { - private const val TAG_GROUP_KEY_SET_I_D = 0 + private const val TAG_GROUP_KEY_SET_ID = 0 private const val TAG_GROUP_KEY_SECURITY_POLICY = 1 private const val TAG_EPOCH_KEY0 = 2 private const val TAG_EPOCH_START_TIME0 = 3 @@ -96,7 +96,7 @@ class GroupKeyManagementClusterGroupKeySetStruct( fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): GroupKeyManagementClusterGroupKeySetStruct { tlvReader.enterStructure(tlvTag) - val groupKeySetID = tlvReader.getUShort(ContextSpecificTag(TAG_GROUP_KEY_SET_I_D)) + val groupKeySetID = tlvReader.getUShort(ContextSpecificTag(TAG_GROUP_KEY_SET_ID)) val groupKeySecurityPolicy = tlvReader.getUByte(ContextSpecificTag(TAG_GROUP_KEY_SECURITY_POLICY)) val epochKey0 = diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/IcdManagementClusterMonitoringRegistrationStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/IcdManagementClusterMonitoringRegistrationStruct.kt index fbf95fd9f40918..478ce9f25c4cd6 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/IcdManagementClusterMonitoringRegistrationStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/IcdManagementClusterMonitoringRegistrationStruct.kt @@ -40,7 +40,7 @@ class IcdManagementClusterMonitoringRegistrationStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_CHECK_IN_NODE_I_D), checkInNodeID) + put(ContextSpecificTag(TAG_CHECK_IN_NODE_ID), checkInNodeID) put(ContextSpecificTag(TAG_MONITORED_SUBJECT), monitoredSubject) put(ContextSpecificTag(TAG_CLIENT_TYPE), clientType) put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) @@ -49,7 +49,7 @@ class IcdManagementClusterMonitoringRegistrationStruct( } companion object { - private const val TAG_CHECK_IN_NODE_I_D = 1 + private const val TAG_CHECK_IN_NODE_ID = 1 private const val TAG_MONITORED_SUBJECT = 2 private const val TAG_CLIENT_TYPE = 4 private const val TAG_FABRIC_INDEX = 254 @@ -59,7 +59,7 @@ class IcdManagementClusterMonitoringRegistrationStruct( tlvReader: TlvReader, ): IcdManagementClusterMonitoringRegistrationStruct { tlvReader.enterStructure(tlvTag) - val checkInNodeID = tlvReader.getULong(ContextSpecificTag(TAG_CHECK_IN_NODE_I_D)) + val checkInNodeID = tlvReader.getULong(ContextSpecificTag(TAG_CHECK_IN_NODE_ID)) val monitoredSubject = tlvReader.getULong(ContextSpecificTag(TAG_MONITORED_SUBJECT)) val clientType = tlvReader.getUByte(ContextSpecificTag(TAG_CLIENT_TYPE)) val fabricIndex = tlvReader.getUByte(ContextSpecificTag(TAG_FABRIC_INDEX)) diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/MessagesClusterMessageResponseOptionStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/MessagesClusterMessageResponseOptionStruct.kt index ed263ece2ddd42..7240826c29fe10 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/MessagesClusterMessageResponseOptionStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/MessagesClusterMessageResponseOptionStruct.kt @@ -39,7 +39,7 @@ class MessagesClusterMessageResponseOptionStruct( startStructure(tlvTag) if (messageResponseID.isPresent) { val optmessageResponseID = messageResponseID.get() - put(ContextSpecificTag(TAG_MESSAGE_RESPONSE_I_D), optmessageResponseID) + put(ContextSpecificTag(TAG_MESSAGE_RESPONSE_ID), optmessageResponseID) } if (label.isPresent) { val optlabel = label.get() @@ -50,14 +50,14 @@ class MessagesClusterMessageResponseOptionStruct( } companion object { - private const val TAG_MESSAGE_RESPONSE_I_D = 0 + private const val TAG_MESSAGE_RESPONSE_ID = 0 private const val TAG_LABEL = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): MessagesClusterMessageResponseOptionStruct { tlvReader.enterStructure(tlvTag) val messageResponseID = - if (tlvReader.isNextTag(ContextSpecificTag(TAG_MESSAGE_RESPONSE_I_D))) { - Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_MESSAGE_RESPONSE_I_D))) + if (tlvReader.isNextTag(ContextSpecificTag(TAG_MESSAGE_RESPONSE_ID))) { + Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_MESSAGE_RESPONSE_ID))) } else { Optional.empty() } diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/MessagesClusterMessageStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/MessagesClusterMessageStruct.kt index 90990310f0ff9d..ff033fa133550b 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/MessagesClusterMessageStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/MessagesClusterMessageStruct.kt @@ -48,7 +48,7 @@ class MessagesClusterMessageStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_MESSAGE_I_D), messageID) + put(ContextSpecificTag(TAG_MESSAGE_ID), messageID) put(ContextSpecificTag(TAG_PRIORITY), priority) put(ContextSpecificTag(TAG_MESSAGE_CONTROL), messageControl) if (startTime != null) { @@ -75,7 +75,7 @@ class MessagesClusterMessageStruct( } companion object { - private const val TAG_MESSAGE_I_D = 0 + private const val TAG_MESSAGE_ID = 0 private const val TAG_PRIORITY = 1 private const val TAG_MESSAGE_CONTROL = 2 private const val TAG_START_TIME = 3 @@ -85,7 +85,7 @@ class MessagesClusterMessageStruct( fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): MessagesClusterMessageStruct { tlvReader.enterStructure(tlvTag) - val messageID = tlvReader.getByteArray(ContextSpecificTag(TAG_MESSAGE_I_D)) + val messageID = tlvReader.getByteArray(ContextSpecificTag(TAG_MESSAGE_ID)) val priority = tlvReader.getUByte(ContextSpecificTag(TAG_PRIORITY)) val messageControl = tlvReader.getUByte(ContextSpecificTag(TAG_MESSAGE_CONTROL)) val startTime = diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/NetworkCommissioningClusterNetworkInfoStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/NetworkCommissioningClusterNetworkInfoStruct.kt index 7a8718ff52de5e..e7503f37514dc7 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/NetworkCommissioningClusterNetworkInfoStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/NetworkCommissioningClusterNetworkInfoStruct.kt @@ -41,7 +41,7 @@ class NetworkCommissioningClusterNetworkInfoStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_NETWORK_I_D), networkID) + put(ContextSpecificTag(TAG_NETWORK_ID), networkID) put(ContextSpecificTag(TAG_CONNECTED), connected) if (networkIdentifier != null) { if (networkIdentifier.isPresent) { @@ -64,14 +64,14 @@ class NetworkCommissioningClusterNetworkInfoStruct( } companion object { - private const val TAG_NETWORK_I_D = 0 + private const val TAG_NETWORK_ID = 0 private const val TAG_CONNECTED = 1 private const val TAG_NETWORK_IDENTIFIER = 2 private const val TAG_CLIENT_IDENTIFIER = 3 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): NetworkCommissioningClusterNetworkInfoStruct { tlvReader.enterStructure(tlvTag) - val networkID = tlvReader.getByteArray(ContextSpecificTag(TAG_NETWORK_I_D)) + val networkID = tlvReader.getByteArray(ContextSpecificTag(TAG_NETWORK_ID)) val connected = tlvReader.getBoolean(ContextSpecificTag(TAG_CONNECTED)) val networkIdentifier = if (!tlvReader.isNull()) { diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/OperationalCredentialsClusterFabricDescriptorStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/OperationalCredentialsClusterFabricDescriptorStruct.kt index 66c28dc3e1752c..6fad97097ca764 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/OperationalCredentialsClusterFabricDescriptorStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/OperationalCredentialsClusterFabricDescriptorStruct.kt @@ -45,9 +45,9 @@ class OperationalCredentialsClusterFabricDescriptorStruct( tlvWriter.apply { startStructure(tlvTag) put(ContextSpecificTag(TAG_ROOT_PUBLIC_KEY), rootPublicKey) - put(ContextSpecificTag(TAG_VENDOR_I_D), vendorID) - put(ContextSpecificTag(TAG_FABRIC_I_D), fabricID) - put(ContextSpecificTag(TAG_NODE_I_D), nodeID) + put(ContextSpecificTag(TAG_VENDOR_ID), vendorID) + put(ContextSpecificTag(TAG_FABRIC_ID), fabricID) + put(ContextSpecificTag(TAG_NODE_ID), nodeID) put(ContextSpecificTag(TAG_LABEL), label) put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) endStructure() @@ -56,9 +56,9 @@ class OperationalCredentialsClusterFabricDescriptorStruct( companion object { private const val TAG_ROOT_PUBLIC_KEY = 1 - private const val TAG_VENDOR_I_D = 2 - private const val TAG_FABRIC_I_D = 3 - private const val TAG_NODE_I_D = 4 + private const val TAG_VENDOR_ID = 2 + private const val TAG_FABRIC_ID = 3 + private const val TAG_NODE_ID = 4 private const val TAG_LABEL = 5 private const val TAG_FABRIC_INDEX = 254 @@ -68,9 +68,9 @@ class OperationalCredentialsClusterFabricDescriptorStruct( ): OperationalCredentialsClusterFabricDescriptorStruct { tlvReader.enterStructure(tlvTag) val rootPublicKey = tlvReader.getByteArray(ContextSpecificTag(TAG_ROOT_PUBLIC_KEY)) - val vendorID = tlvReader.getUShort(ContextSpecificTag(TAG_VENDOR_I_D)) - val fabricID = tlvReader.getULong(ContextSpecificTag(TAG_FABRIC_I_D)) - val nodeID = tlvReader.getULong(ContextSpecificTag(TAG_NODE_I_D)) + val vendorID = tlvReader.getUShort(ContextSpecificTag(TAG_VENDOR_ID)) + val fabricID = tlvReader.getULong(ContextSpecificTag(TAG_FABRIC_ID)) + val nodeID = tlvReader.getULong(ContextSpecificTag(TAG_NODE_ID)) val label = tlvReader.getString(ContextSpecificTag(TAG_LABEL)) val fabricIndex = tlvReader.getUByte(ContextSpecificTag(TAG_FABRIC_INDEX)) diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/OperationalStateClusterErrorStateStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/OperationalStateClusterErrorStateStruct.kt index 94eb1ac4612a23..bea86d884fdc49 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/OperationalStateClusterErrorStateStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/OperationalStateClusterErrorStateStruct.kt @@ -39,7 +39,7 @@ class OperationalStateClusterErrorStateStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_ERROR_STATE_I_D), errorStateID) + put(ContextSpecificTag(TAG_ERROR_STATE_ID), errorStateID) if (errorStateLabel.isPresent) { val opterrorStateLabel = errorStateLabel.get() put(ContextSpecificTag(TAG_ERROR_STATE_LABEL), opterrorStateLabel) @@ -53,13 +53,13 @@ class OperationalStateClusterErrorStateStruct( } companion object { - private const val TAG_ERROR_STATE_I_D = 0 + private const val TAG_ERROR_STATE_ID = 0 private const val TAG_ERROR_STATE_LABEL = 1 private const val TAG_ERROR_STATE_DETAILS = 2 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): OperationalStateClusterErrorStateStruct { tlvReader.enterStructure(tlvTag) - val errorStateID = tlvReader.getUByte(ContextSpecificTag(TAG_ERROR_STATE_I_D)) + val errorStateID = tlvReader.getUByte(ContextSpecificTag(TAG_ERROR_STATE_ID)) val errorStateLabel = if (tlvReader.isNextTag(ContextSpecificTag(TAG_ERROR_STATE_LABEL))) { Optional.of(tlvReader.getString(ContextSpecificTag(TAG_ERROR_STATE_LABEL))) diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/OperationalStateClusterOperationalStateStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/OperationalStateClusterOperationalStateStruct.kt index 22ba9ba6e8afdf..7626d4a76910f8 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/OperationalStateClusterOperationalStateStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/OperationalStateClusterOperationalStateStruct.kt @@ -37,7 +37,7 @@ class OperationalStateClusterOperationalStateStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_OPERATIONAL_STATE_I_D), operationalStateID) + put(ContextSpecificTag(TAG_OPERATIONAL_STATE_ID), operationalStateID) if (operationalStateLabel.isPresent) { val optoperationalStateLabel = operationalStateLabel.get() put(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL), optoperationalStateLabel) @@ -47,12 +47,12 @@ class OperationalStateClusterOperationalStateStruct( } companion object { - private const val TAG_OPERATIONAL_STATE_I_D = 0 + private const val TAG_OPERATIONAL_STATE_ID = 0 private const val TAG_OPERATIONAL_STATE_LABEL = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): OperationalStateClusterOperationalStateStruct { tlvReader.enterStructure(tlvTag) - val operationalStateID = tlvReader.getUByte(ContextSpecificTag(TAG_OPERATIONAL_STATE_I_D)) + val operationalStateID = tlvReader.getUByte(ContextSpecificTag(TAG_OPERATIONAL_STATE_ID)) val operationalStateLabel = if (tlvReader.isNextTag(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL))) { Optional.of(tlvReader.getString(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL))) diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/OtaSoftwareUpdateRequestorClusterProviderLocation.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/OtaSoftwareUpdateRequestorClusterProviderLocation.kt index 5708a4006e50cb..209c1580f35df2 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/OtaSoftwareUpdateRequestorClusterProviderLocation.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/OtaSoftwareUpdateRequestorClusterProviderLocation.kt @@ -38,7 +38,7 @@ class OtaSoftwareUpdateRequestorClusterProviderLocation( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_PROVIDER_NODE_I_D), providerNodeID) + put(ContextSpecificTag(TAG_PROVIDER_NODE_ID), providerNodeID) put(ContextSpecificTag(TAG_ENDPOINT), endpoint) put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) endStructure() @@ -46,7 +46,7 @@ class OtaSoftwareUpdateRequestorClusterProviderLocation( } companion object { - private const val TAG_PROVIDER_NODE_I_D = 1 + private const val TAG_PROVIDER_NODE_ID = 1 private const val TAG_ENDPOINT = 2 private const val TAG_FABRIC_INDEX = 254 @@ -55,7 +55,7 @@ class OtaSoftwareUpdateRequestorClusterProviderLocation( tlvReader: TlvReader, ): OtaSoftwareUpdateRequestorClusterProviderLocation { tlvReader.enterStructure(tlvTag) - val providerNodeID = tlvReader.getULong(ContextSpecificTag(TAG_PROVIDER_NODE_I_D)) + val providerNodeID = tlvReader.getULong(ContextSpecificTag(TAG_PROVIDER_NODE_ID)) val endpoint = tlvReader.getUShort(ContextSpecificTag(TAG_ENDPOINT)) val fabricIndex = tlvReader.getUByte(ContextSpecificTag(TAG_FABRIC_INDEX)) diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/OvenCavityOperationalStateClusterErrorStateStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/OvenCavityOperationalStateClusterErrorStateStruct.kt index cbb84396c25805..442c55ea088e3d 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/OvenCavityOperationalStateClusterErrorStateStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/OvenCavityOperationalStateClusterErrorStateStruct.kt @@ -39,7 +39,7 @@ class OvenCavityOperationalStateClusterErrorStateStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_ERROR_STATE_I_D), errorStateID) + put(ContextSpecificTag(TAG_ERROR_STATE_ID), errorStateID) if (errorStateLabel.isPresent) { val opterrorStateLabel = errorStateLabel.get() put(ContextSpecificTag(TAG_ERROR_STATE_LABEL), opterrorStateLabel) @@ -53,7 +53,7 @@ class OvenCavityOperationalStateClusterErrorStateStruct( } companion object { - private const val TAG_ERROR_STATE_I_D = 0 + private const val TAG_ERROR_STATE_ID = 0 private const val TAG_ERROR_STATE_LABEL = 1 private const val TAG_ERROR_STATE_DETAILS = 2 @@ -62,7 +62,7 @@ class OvenCavityOperationalStateClusterErrorStateStruct( tlvReader: TlvReader, ): OvenCavityOperationalStateClusterErrorStateStruct { tlvReader.enterStructure(tlvTag) - val errorStateID = tlvReader.getUByte(ContextSpecificTag(TAG_ERROR_STATE_I_D)) + val errorStateID = tlvReader.getUByte(ContextSpecificTag(TAG_ERROR_STATE_ID)) val errorStateLabel = if (tlvReader.isNextTag(ContextSpecificTag(TAG_ERROR_STATE_LABEL))) { Optional.of(tlvReader.getString(ContextSpecificTag(TAG_ERROR_STATE_LABEL))) diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/OvenCavityOperationalStateClusterOperationalStateStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/OvenCavityOperationalStateClusterOperationalStateStruct.kt index b7d604467bd9bc..ef6a876dcef05f 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/OvenCavityOperationalStateClusterOperationalStateStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/OvenCavityOperationalStateClusterOperationalStateStruct.kt @@ -37,7 +37,7 @@ class OvenCavityOperationalStateClusterOperationalStateStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_OPERATIONAL_STATE_I_D), operationalStateID) + put(ContextSpecificTag(TAG_OPERATIONAL_STATE_ID), operationalStateID) if (operationalStateLabel.isPresent) { val optoperationalStateLabel = operationalStateLabel.get() put(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL), optoperationalStateLabel) @@ -47,7 +47,7 @@ class OvenCavityOperationalStateClusterOperationalStateStruct( } companion object { - private const val TAG_OPERATIONAL_STATE_I_D = 0 + private const val TAG_OPERATIONAL_STATE_ID = 0 private const val TAG_OPERATIONAL_STATE_LABEL = 1 fun fromTlv( @@ -55,7 +55,7 @@ class OvenCavityOperationalStateClusterOperationalStateStruct( tlvReader: TlvReader, ): OvenCavityOperationalStateClusterOperationalStateStruct { tlvReader.enterStructure(tlvTag) - val operationalStateID = tlvReader.getUByte(ContextSpecificTag(TAG_OPERATIONAL_STATE_I_D)) + val operationalStateID = tlvReader.getUByte(ContextSpecificTag(TAG_OPERATIONAL_STATE_ID)) val operationalStateLabel = if (tlvReader.isNextTag(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL))) { Optional.of(tlvReader.getString(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL))) diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/RvcOperationalStateClusterErrorStateStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/RvcOperationalStateClusterErrorStateStruct.kt index 1ccfa0c395aad5..e60738d973b0c5 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/RvcOperationalStateClusterErrorStateStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/RvcOperationalStateClusterErrorStateStruct.kt @@ -39,7 +39,7 @@ class RvcOperationalStateClusterErrorStateStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_ERROR_STATE_I_D), errorStateID) + put(ContextSpecificTag(TAG_ERROR_STATE_ID), errorStateID) if (errorStateLabel.isPresent) { val opterrorStateLabel = errorStateLabel.get() put(ContextSpecificTag(TAG_ERROR_STATE_LABEL), opterrorStateLabel) @@ -53,13 +53,13 @@ class RvcOperationalStateClusterErrorStateStruct( } companion object { - private const val TAG_ERROR_STATE_I_D = 0 + private const val TAG_ERROR_STATE_ID = 0 private const val TAG_ERROR_STATE_LABEL = 1 private const val TAG_ERROR_STATE_DETAILS = 2 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): RvcOperationalStateClusterErrorStateStruct { tlvReader.enterStructure(tlvTag) - val errorStateID = tlvReader.getUByte(ContextSpecificTag(TAG_ERROR_STATE_I_D)) + val errorStateID = tlvReader.getUByte(ContextSpecificTag(TAG_ERROR_STATE_ID)) val errorStateLabel = if (tlvReader.isNextTag(ContextSpecificTag(TAG_ERROR_STATE_LABEL))) { Optional.of(tlvReader.getString(ContextSpecificTag(TAG_ERROR_STATE_LABEL))) diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/RvcOperationalStateClusterOperationalStateStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/RvcOperationalStateClusterOperationalStateStruct.kt index 3ab7c3ab3bf63c..00680b85bb0c7b 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/RvcOperationalStateClusterOperationalStateStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/RvcOperationalStateClusterOperationalStateStruct.kt @@ -37,7 +37,7 @@ class RvcOperationalStateClusterOperationalStateStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_OPERATIONAL_STATE_I_D), operationalStateID) + put(ContextSpecificTag(TAG_OPERATIONAL_STATE_ID), operationalStateID) if (operationalStateLabel.isPresent) { val optoperationalStateLabel = operationalStateLabel.get() put(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL), optoperationalStateLabel) @@ -47,7 +47,7 @@ class RvcOperationalStateClusterOperationalStateStruct( } companion object { - private const val TAG_OPERATIONAL_STATE_I_D = 0 + private const val TAG_OPERATIONAL_STATE_ID = 0 private const val TAG_OPERATIONAL_STATE_LABEL = 1 fun fromTlv( @@ -55,7 +55,7 @@ class RvcOperationalStateClusterOperationalStateStruct( tlvReader: TlvReader, ): RvcOperationalStateClusterOperationalStateStruct { tlvReader.enterStructure(tlvTag) - val operationalStateID = tlvReader.getUByte(ContextSpecificTag(TAG_OPERATIONAL_STATE_I_D)) + val operationalStateID = tlvReader.getUByte(ContextSpecificTag(TAG_OPERATIONAL_STATE_ID)) val operationalStateLabel = if (tlvReader.isNextTag(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL))) { Optional.of(tlvReader.getString(ContextSpecificTag(TAG_OPERATIONAL_STATE_LABEL))) diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt index 9f142d41b3da4f..232bfea8c1e5a7 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePairStruct.kt @@ -51,7 +51,7 @@ class ScenesManagementClusterAttributeValuePairStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_ATTRIBUTE_I_D), attributeID) + put(ContextSpecificTag(TAG_ATTRIBUTE_ID), attributeID) if (valueUnsigned8.isPresent) { val optvalueUnsigned8 = valueUnsigned8.get() put(ContextSpecificTag(TAG_VALUE_UNSIGNED8), optvalueUnsigned8) @@ -89,7 +89,7 @@ class ScenesManagementClusterAttributeValuePairStruct( } companion object { - private const val TAG_ATTRIBUTE_I_D = 0 + private const val TAG_ATTRIBUTE_ID = 0 private const val TAG_VALUE_UNSIGNED8 = 1 private const val TAG_VALUE_SIGNED8 = 2 private const val TAG_VALUE_UNSIGNED16 = 3 @@ -104,7 +104,7 @@ class ScenesManagementClusterAttributeValuePairStruct( tlvReader: TlvReader, ): ScenesManagementClusterAttributeValuePairStruct { tlvReader.enterStructure(tlvTag) - val attributeID = tlvReader.getUInt(ContextSpecificTag(TAG_ATTRIBUTE_I_D)) + val attributeID = tlvReader.getUInt(ContextSpecificTag(TAG_ATTRIBUTE_ID)) val valueUnsigned8 = if (tlvReader.isNextTag(ContextSpecificTag(TAG_VALUE_UNSIGNED8))) { Optional.of(tlvReader.getUByte(ContextSpecificTag(TAG_VALUE_UNSIGNED8))) diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt index bd219e98d152fd..4fcc98ecaf5921 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt @@ -37,7 +37,7 @@ class ScenesManagementClusterExtensionFieldSet( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_CLUSTER_I_D), clusterID) + put(ContextSpecificTag(TAG_CLUSTER_ID), clusterID) startArray(ContextSpecificTag(TAG_ATTRIBUTE_VALUE_LIST)) for (item in attributeValueList.iterator()) { item.toTlv(AnonymousTag, this) @@ -48,12 +48,12 @@ class ScenesManagementClusterExtensionFieldSet( } companion object { - private const val TAG_CLUSTER_I_D = 0 + private const val TAG_CLUSTER_ID = 0 private const val TAG_ATTRIBUTE_VALUE_LIST = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ScenesManagementClusterExtensionFieldSet { tlvReader.enterStructure(tlvTag) - val clusterID = tlvReader.getUInt(ContextSpecificTag(TAG_CLUSTER_I_D)) + val clusterID = tlvReader.getUInt(ContextSpecificTag(TAG_CLUSTER_ID)) val attributeValueList = buildList { tlvReader.enterArray(ContextSpecificTag(TAG_ATTRIBUTE_VALUE_LIST)) diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterAreaStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterAreaStruct.kt index adfe228d332c39..d310fe5c315bf8 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterAreaStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterAreaStruct.kt @@ -38,11 +38,11 @@ class ServiceAreaClusterAreaStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_AREA_I_D), areaID) + put(ContextSpecificTag(TAG_AREA_ID), areaID) if (mapID != null) { - put(ContextSpecificTag(TAG_MAP_I_D), mapID) + put(ContextSpecificTag(TAG_MAP_ID), mapID) } else { - putNull(ContextSpecificTag(TAG_MAP_I_D)) + putNull(ContextSpecificTag(TAG_MAP_ID)) } areaDesc.toTlv(ContextSpecificTag(TAG_AREA_DESC), this) endStructure() @@ -50,18 +50,18 @@ class ServiceAreaClusterAreaStruct( } companion object { - private const val TAG_AREA_I_D = 0 - private const val TAG_MAP_I_D = 1 + private const val TAG_AREA_ID = 0 + private const val TAG_MAP_ID = 1 private const val TAG_AREA_DESC = 2 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterAreaStruct { tlvReader.enterStructure(tlvTag) - val areaID = tlvReader.getUInt(ContextSpecificTag(TAG_AREA_I_D)) + val areaID = tlvReader.getUInt(ContextSpecificTag(TAG_AREA_ID)) val mapID = if (!tlvReader.isNull()) { - tlvReader.getUInt(ContextSpecificTag(TAG_MAP_I_D)) + tlvReader.getUInt(ContextSpecificTag(TAG_MAP_ID)) } else { - tlvReader.getNull(ContextSpecificTag(TAG_MAP_I_D)) + tlvReader.getNull(ContextSpecificTag(TAG_MAP_ID)) null } val areaDesc = diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterMapStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterMapStruct.kt index 528888247d791b..19df0938c57b93 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterMapStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterMapStruct.kt @@ -33,19 +33,19 @@ class ServiceAreaClusterMapStruct(val mapID: UInt, val name: String) { fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_MAP_I_D), mapID) + put(ContextSpecificTag(TAG_MAP_ID), mapID) put(ContextSpecificTag(TAG_NAME), name) endStructure() } } companion object { - private const val TAG_MAP_I_D = 0 + private const val TAG_MAP_ID = 0 private const val TAG_NAME = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterMapStruct { tlvReader.enterStructure(tlvTag) - val mapID = tlvReader.getUInt(ContextSpecificTag(TAG_MAP_I_D)) + val mapID = tlvReader.getUInt(ContextSpecificTag(TAG_MAP_ID)) val name = tlvReader.getString(ContextSpecificTag(TAG_NAME)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterProgressStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterProgressStruct.kt index 4421bb606a7466..02b16f17cd101d 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterProgressStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterProgressStruct.kt @@ -41,7 +41,7 @@ class ServiceAreaClusterProgressStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_AREA_I_D), areaID) + put(ContextSpecificTag(TAG_AREA_ID), areaID) put(ContextSpecificTag(TAG_STATUS), status) if (totalOperationalTime != null) { if (totalOperationalTime.isPresent) { @@ -64,14 +64,14 @@ class ServiceAreaClusterProgressStruct( } companion object { - private const val TAG_AREA_I_D = 0 + private const val TAG_AREA_ID = 0 private const val TAG_STATUS = 1 private const val TAG_TOTAL_OPERATIONAL_TIME = 2 private const val TAG_ESTIMATED_TIME = 3 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterProgressStruct { tlvReader.enterStructure(tlvTag) - val areaID = tlvReader.getUInt(ContextSpecificTag(TAG_AREA_I_D)) + val areaID = tlvReader.getUInt(ContextSpecificTag(TAG_AREA_ID)) val status = tlvReader.getUByte(ContextSpecificTag(TAG_STATUS)) val totalOperationalTime = if (!tlvReader.isNull()) { diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterAtomicAttributeStatusStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterAtomicAttributeStatusStruct.kt index 2a67c0cccb8688..42fc80b898b3b8 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterAtomicAttributeStatusStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterAtomicAttributeStatusStruct.kt @@ -33,19 +33,19 @@ class ThermostatClusterAtomicAttributeStatusStruct(val attributeID: UInt, val st fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_ATTRIBUTE_I_D), attributeID) + put(ContextSpecificTag(TAG_ATTRIBUTE_ID), attributeID) put(ContextSpecificTag(TAG_STATUS_CODE), statusCode) endStructure() } } companion object { - private const val TAG_ATTRIBUTE_I_D = 0 + private const val TAG_ATTRIBUTE_ID = 0 private const val TAG_STATUS_CODE = 1 fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ThermostatClusterAtomicAttributeStatusStruct { tlvReader.enterStructure(tlvTag) - val attributeID = tlvReader.getUInt(ContextSpecificTag(TAG_ATTRIBUTE_I_D)) + val attributeID = tlvReader.getUInt(ContextSpecificTag(TAG_ATTRIBUTE_ID)) val statusCode = tlvReader.getUByte(ContextSpecificTag(TAG_STATUS_CODE)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ThreadNetworkDiagnosticsClusterRouteTableStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ThreadNetworkDiagnosticsClusterRouteTableStruct.kt index 797bd6aa66e11d..86860ea6803c82 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ThreadNetworkDiagnosticsClusterRouteTableStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ThreadNetworkDiagnosticsClusterRouteTableStruct.kt @@ -57,8 +57,8 @@ class ThreadNetworkDiagnosticsClusterRouteTableStruct( put(ContextSpecificTag(TAG_ROUTER_ID), routerId) put(ContextSpecificTag(TAG_NEXT_HOP), nextHop) put(ContextSpecificTag(TAG_PATH_COST), pathCost) - put(ContextSpecificTag(TAG_L_Q_I_IN), LQIIn) - put(ContextSpecificTag(TAG_L_Q_I_OUT), LQIOut) + put(ContextSpecificTag(TAG_LQI_IN), LQIIn) + put(ContextSpecificTag(TAG_LQI_OUT), LQIOut) put(ContextSpecificTag(TAG_AGE), age) put(ContextSpecificTag(TAG_ALLOCATED), allocated) put(ContextSpecificTag(TAG_LINK_ESTABLISHED), linkEstablished) @@ -72,8 +72,8 @@ class ThreadNetworkDiagnosticsClusterRouteTableStruct( private const val TAG_ROUTER_ID = 2 private const val TAG_NEXT_HOP = 3 private const val TAG_PATH_COST = 4 - private const val TAG_L_Q_I_IN = 5 - private const val TAG_L_Q_I_OUT = 6 + private const val TAG_LQI_IN = 5 + private const val TAG_LQI_OUT = 6 private const val TAG_AGE = 7 private const val TAG_ALLOCATED = 8 private const val TAG_LINK_ESTABLISHED = 9 @@ -88,8 +88,8 @@ class ThreadNetworkDiagnosticsClusterRouteTableStruct( val routerId = tlvReader.getUByte(ContextSpecificTag(TAG_ROUTER_ID)) val nextHop = tlvReader.getUByte(ContextSpecificTag(TAG_NEXT_HOP)) val pathCost = tlvReader.getUByte(ContextSpecificTag(TAG_PATH_COST)) - val LQIIn = tlvReader.getUByte(ContextSpecificTag(TAG_L_Q_I_IN)) - val LQIOut = tlvReader.getUByte(ContextSpecificTag(TAG_L_Q_I_OUT)) + val LQIIn = tlvReader.getUByte(ContextSpecificTag(TAG_LQI_IN)) + val LQIOut = tlvReader.getUByte(ContextSpecificTag(TAG_LQI_OUT)) val age = tlvReader.getUByte(ContextSpecificTag(TAG_AGE)) val allocated = tlvReader.getBoolean(ContextSpecificTag(TAG_ALLOCATED)) val linkEstablished = tlvReader.getBoolean(ContextSpecificTag(TAG_LINK_ESTABLISHED)) diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt index bacfb457534ddd..04f8c6abcd3ba8 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ThreadNetworkDirectoryClusterThreadNetworkStruct.kt @@ -40,7 +40,7 @@ class ThreadNetworkDirectoryClusterThreadNetworkStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_EXTENDED_PAN_I_D), extendedPanID) + put(ContextSpecificTag(TAG_EXTENDED_PAN_ID), extendedPanID) put(ContextSpecificTag(TAG_NETWORK_NAME), networkName) put(ContextSpecificTag(TAG_CHANNEL), channel) put(ContextSpecificTag(TAG_ACTIVE_TIMESTAMP), activeTimestamp) @@ -49,7 +49,7 @@ class ThreadNetworkDirectoryClusterThreadNetworkStruct( } companion object { - private const val TAG_EXTENDED_PAN_I_D = 0 + private const val TAG_EXTENDED_PAN_ID = 0 private const val TAG_NETWORK_NAME = 1 private const val TAG_CHANNEL = 2 private const val TAG_ACTIVE_TIMESTAMP = 3 @@ -59,7 +59,7 @@ class ThreadNetworkDirectoryClusterThreadNetworkStruct( tlvReader: TlvReader, ): ThreadNetworkDirectoryClusterThreadNetworkStruct { tlvReader.enterStructure(tlvTag) - val extendedPanID = tlvReader.getByteArray(ContextSpecificTag(TAG_EXTENDED_PAN_I_D)) + val extendedPanID = tlvReader.getByteArray(ContextSpecificTag(TAG_EXTENDED_PAN_ID)) val networkName = tlvReader.getString(ContextSpecificTag(TAG_NETWORK_NAME)) val channel = tlvReader.getUShort(ContextSpecificTag(TAG_CHANNEL)) val activeTimestamp = tlvReader.getULong(ContextSpecificTag(TAG_ACTIVE_TIMESTAMP)) diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct.kt index b90c3a65207937..f294cfbe427ee1 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct.kt @@ -36,14 +36,14 @@ class TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct( fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) { tlvWriter.apply { startStructure(tlvTag) - put(ContextSpecificTag(TAG_NODE_I_D), nodeID) + put(ContextSpecificTag(TAG_NODE_ID), nodeID) put(ContextSpecificTag(TAG_ENDPOINT), endpoint) endStructure() } } companion object { - private const val TAG_NODE_I_D = 0 + private const val TAG_NODE_ID = 0 private const val TAG_ENDPOINT = 1 fun fromTlv( @@ -51,7 +51,7 @@ class TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct( tlvReader: TlvReader, ): TimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct { tlvReader.enterStructure(tlvTag) - val nodeID = tlvReader.getULong(ContextSpecificTag(TAG_NODE_I_D)) + val nodeID = tlvReader.getULong(ContextSpecificTag(TAG_NODE_ID)) val endpoint = tlvReader.getUShort(ContextSpecificTag(TAG_ENDPOINT)) tlvReader.exitContainer() diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/TimeSynchronizationClusterTrustedTimeSourceStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/TimeSynchronizationClusterTrustedTimeSourceStruct.kt index 4e1df456a93348..215bb8c35d2e57 100644 --- a/src/controller/java/generated/java/matter/controller/cluster/structs/TimeSynchronizationClusterTrustedTimeSourceStruct.kt +++ b/src/controller/java/generated/java/matter/controller/cluster/structs/TimeSynchronizationClusterTrustedTimeSourceStruct.kt @@ -39,7 +39,7 @@ class TimeSynchronizationClusterTrustedTimeSourceStruct( tlvWriter.apply { startStructure(tlvTag) put(ContextSpecificTag(TAG_FABRIC_INDEX), fabricIndex) - put(ContextSpecificTag(TAG_NODE_I_D), nodeID) + put(ContextSpecificTag(TAG_NODE_ID), nodeID) put(ContextSpecificTag(TAG_ENDPOINT), endpoint) endStructure() } @@ -47,7 +47,7 @@ class TimeSynchronizationClusterTrustedTimeSourceStruct( companion object { private const val TAG_FABRIC_INDEX = 0 - private const val TAG_NODE_I_D = 1 + private const val TAG_NODE_ID = 1 private const val TAG_ENDPOINT = 2 fun fromTlv( @@ -56,7 +56,7 @@ class TimeSynchronizationClusterTrustedTimeSourceStruct( ): TimeSynchronizationClusterTrustedTimeSourceStruct { tlvReader.enterStructure(tlvTag) val fabricIndex = tlvReader.getUByte(ContextSpecificTag(TAG_FABRIC_INDEX)) - val nodeID = tlvReader.getULong(ContextSpecificTag(TAG_NODE_I_D)) + val nodeID = tlvReader.getULong(ContextSpecificTag(TAG_NODE_ID)) val endpoint = tlvReader.getUShort(ContextSpecificTag(TAG_ENDPOINT)) tlvReader.exitContainer() diff --git a/src/controller/python/chip/yaml/runner.py b/src/controller/python/chip/yaml/runner.py index 84f0e06ff7fddf..00e0de2154e5ec 100644 --- a/src/controller/python/chip/yaml/runner.py +++ b/src/controller/python/chip/yaml/runner.py @@ -24,7 +24,6 @@ import chip.interaction_model import chip.yaml.format_converter as Converter -import stringcase # type: ignore from chip.ChipDeviceCtrl import ChipDeviceController, discovery from chip.clusters import ClusterObjects from chip.clusters.Attribute import (AttributeStatus, EventReadResult, SubscriptionTransaction, TypedAttributePath, @@ -32,6 +31,7 @@ from chip.exceptions import ChipStackError from chip.yaml.data_model_lookup import DataModelLookup from chip.yaml.errors import ActionCreationError, UnexpectedActionCreationError +from matter_idl.generators.filters import to_pascal_case, to_snake_case from matter_yamltests.pseudo_clusters.pseudo_clusters import get_default_pseudo_clusters from .data_model_lookup import PreDefinedDataModelLookup @@ -150,7 +150,7 @@ def __init__(self, test_step, cluster: str, context: _ExecutionContext): ''' super().__init__(test_step) self._busy_wait_ms = test_step.busy_wait_ms - self._command_name = stringcase.pascalcase(test_step.command) + self._command_name = to_pascal_case(test_step.command) self._cluster = cluster self._interation_timeout_ms = test_step.timed_interaction_timeout_ms self._request_object = None @@ -217,7 +217,7 @@ def __init__(self, test_step, cluster: str, context: _ExecutionContext): UnexpectedActionCreationError: Raised if there is an unexpected parsing error. ''' super().__init__(test_step) - self._attribute_name = stringcase.pascalcase(test_step.attribute) + self._attribute_name = to_pascal_case(test_step.attribute) self._cluster = cluster self._endpoint = test_step.endpoint self._node_id = test_step.node_id @@ -294,7 +294,7 @@ def __init__(self, test_step, cluster: str, context: _ExecutionContext): UnexpectedActionCreationError: Raised if there is an unexpected parsing error. ''' super().__init__(test_step) - self._event_name = stringcase.pascalcase(test_step.event) + self._event_name = to_pascal_case(test_step.event) self._cluster = cluster self._endpoint = test_step.endpoint self._node_id = test_step.node_id @@ -531,7 +531,7 @@ def __init__(self, test_step, cluster: str, context: _ExecutionContext): UnexpectedActionCreationError: Raised if there is an unexpected parsing error. ''' super().__init__(test_step) - self._attribute_name = stringcase.pascalcase(test_step.attribute) + self._attribute_name = to_pascal_case(test_step.attribute) self._busy_wait_ms = test_step.busy_wait_ms self._cluster = cluster self._endpoint = test_step.endpoint @@ -609,9 +609,9 @@ def __init__(self, test_step, context: _ExecutionContext): ''' super().__init__(test_step) if test_step.attribute is not None: - queue_name = stringcase.pascalcase(test_step.attribute) + queue_name = to_pascal_case(test_step.attribute) elif test_step.event is not None: - queue_name = stringcase.pascalcase(test_step.event) + queue_name = to_pascal_case(test_step.event) else: raise UnexpectedActionCreationError( 'WaitForReport needs to wait on either attribute or event, neither were provided') @@ -886,12 +886,12 @@ def decode(self, result: _ActionResult): return response if isinstance(response, chip.interaction_model.InteractionModelError): - decoded_response['error'] = stringcase.snakecase(response.status.name).upper() + decoded_response['error'] = to_snake_case(response.status.name).upper() decoded_response['clusterError'] = response.clusterStatus return decoded_response if isinstance(response, chip.interaction_model.Status): - decoded_response['error'] = stringcase.snakecase(response.name).upper() + decoded_response['error'] = to_snake_case(response.name).upper() return decoded_response if isinstance(response, _GetCommissionerNodeIdResult): @@ -936,7 +936,7 @@ def decode(self, result: _ActionResult): decoded_response = [] for event in response.event_result_list: if event.Status != chip.interaction_model.Status.Success: - error_message = stringcase.snakecase(event.Status.name).upper() + error_message = to_snake_case(event.Status.name).upper() decoded_response.append({'error': error_message}) continue cluster_id = event.Header.ClusterId From 859ee35fc6a8a3efa5cdf940578f799065414e77 Mon Sep 17 00:00:00 2001 From: Jakub Latusek Date: Wed, 14 Aug 2024 16:12:13 +0200 Subject: [PATCH 17/59] [Tizen] Update Tizen SDK to 8.0 (#34171) * Update tizen to 8.0 * Install platform certificate * Reverse restyle diff * Review fix - version update * Add information about used 7.0 tizen package --------- Co-authored-by: Arkadiusz Bokowy --- .../docker/images/base/chip-build/version | 2 +- .../stage-2/chip-build-tizen/Dockerfile | 4 ++-- .../tizen-sdk-installer/install.sh | 20 ++++++++++--------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/integrations/docker/images/base/chip-build/version b/integrations/docker/images/base/chip-build/version index 5b9870bc97994b..18dcb8d04c629c 100644 --- a/integrations/docker/images/base/chip-build/version +++ b/integrations/docker/images/base/chip-build/version @@ -1 +1 @@ -71 : [NXP] Update k32w1 SDK as it will use common NXP SDK +72 : Update Tizen version to 8.0 diff --git a/integrations/docker/images/stage-2/chip-build-tizen/Dockerfile b/integrations/docker/images/stage-2/chip-build-tizen/Dockerfile index 4d907b1d6e48f4..c127296bac04f3 100644 --- a/integrations/docker/images/stage-2/chip-build-tizen/Dockerfile +++ b/integrations/docker/images/stage-2/chip-build-tizen/Dockerfile @@ -20,7 +20,7 @@ RUN set -x \ # ------------------------------------------------------------------------------ # Install tizen -ENV TIZEN_VERSION 7.0 +ENV TIZEN_VERSION 8.0 ENV TIZEN_SDK_ROOT /opt/tizen-sdk COPY tizen-sdk-installer $TIZEN_SDK_ROOT/files/installer @@ -35,7 +35,7 @@ RUN set -x \ # ------------------------------------------------------------------------------ # Set environment ENV TIZEN_SDK_TOOLCHAIN $TIZEN_SDK_ROOT/tools/arm-linux-gnueabi-gcc-9.2 -ENV TIZEN_SDK_SYSROOT $TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/mobile/rootstraps/mobile-$TIZEN_VERSION-device.core +ENV TIZEN_SDK_SYSROOT $TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/tizen/rootstraps/tizen-$TIZEN_VERSION-device.core ENV PATH="$TIZEN_SDK_TOOLCHAIN/bin:$TIZEN_SDK_ROOT/tools/ide/bin:$TIZEN_SDK_ROOT/tools:$PATH" # ------------------------------------------------------------------------------ diff --git a/integrations/docker/images/stage-2/chip-build-tizen/tizen-sdk-installer/install.sh b/integrations/docker/images/stage-2/chip-build-tizen/tizen-sdk-installer/install.sh index e206e71c19a3a6..59843f99ba9573 100755 --- a/integrations/docker/images/stage-2/chip-build-tizen/tizen-sdk-installer/install.sh +++ b/integrations/docker/images/stage-2/chip-build-tizen/tizen-sdk-installer/install.sh @@ -21,7 +21,7 @@ set -e # Default settings options TIZEN_SDK_ROOT=/opt/tizen-sdk TIZEN_SDK_DATA_PATH=$HOME/tizen-sdk-data -TIZEN_VERSION=7.0 +TIZEN_VERSION=8.0 SECRET_TOOL=false SCRIPT_NAME=$(basename -- "$(readlink -f "${BASH_SOURCE:?}")") @@ -133,7 +133,7 @@ function install_tizen_sdk() { info "Tizen SDK installation directory: $TIZEN_SDK_ROOT" - TIZEN_SDK_SYSROOT="$TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/mobile/rootstraps/mobile-$TIZEN_VERSION-device.core" + TIZEN_SDK_SYSROOT="$TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/tizen/rootstraps/tizen-$TIZEN_VERSION-device.core" cd "$TMP_DIR" || return @@ -144,7 +144,7 @@ function install_tizen_sdk() { URL="http://download.tizen.org/sdk/tizenstudio/official/binary/" PKG_ARR=( 'certificate-encryptor_1.0.10_ubuntu-64.zip' - 'certificate-generator_0.1.3_ubuntu-64.zip' + 'certificate-generator_0.1.4_ubuntu-64.zip' 'new-common-cli_2.5.64_ubuntu-64.zip' 'new-native-cli_2.5.64_ubuntu-64.zip' 'sdb_4.2.23_ubuntu-64.zip') @@ -167,8 +167,8 @@ function install_tizen_sdk() { # Different versions of Tizen have different rootstrap versions URL="http://download.tizen.org/sdk/tizenstudio/official/binary/" PKG_ARR=( - "mobile-$TIZEN_VERSION-core-add-ons_*_ubuntu-64.zip" - "mobile-$TIZEN_VERSION-rs-device.core_*_ubuntu-64.zip") + "tizen-$TIZEN_VERSION-core-add-ons_*_ubuntu-64.zip" + "tizen-$TIZEN_VERSION-rs-device.core_*_ubuntu-64.zip") download "$URL" "${PKG_ARR[@]}" # Base packages @@ -232,13 +232,15 @@ function install_tizen_sdk() { 'capi-system-peripheral-io-*.armv7l.rpm' 'capi-system-peripheral-io-devel-*.armv7l.rpm' 'capi-system-resource-1*.armv7l.rpm' - 'libnsd-dns-sd-*.armv7l.rpm') + 'libnsd-dns-sd-*.armv7l.rpm' + 'sensord-*.armv7l.rpm') download "$URL" "${PKG_ARR[@]}" # Tizen Developer Platform Certificate URL="http://download.tizen.org/sdk/extensions/Tizen_IoT_Headless/binary/" + # Tizen site do not has this package available in version 8.0. Certificates are the same for 7.0 and 8.0. PKG_ARR=( - "$TIZEN_VERSION-iot-things-add-ons_*_ubuntu-64.zip") + "7.0-iot-things-add-ons_*_ubuntu-64.zip") download "$URL" "${PKG_ARR[@]}" # Install all @@ -271,7 +273,7 @@ function install_tizen_sdk() { ln -sf "$(basename "$(readlink "$LNK")")" "$LNK" done ln -sf ../../lib/libcap.so.2 "$TIZEN_SDK_SYSROOT/usr/lib/libcap.so" - ln -sf openssl1.1.pc "$TIZEN_SDK_SYSROOT/usr/lib/pkgconfig/openssl.pc" + ln -sf openssl3.pc "$TIZEN_SDK_SYSROOT/usr/lib/pkgconfig/openssl.pc" info "Done." echo @@ -282,7 +284,7 @@ function install_tizen_sdk() { echo "export TIZEN_VERSION=\"$TIZEN_VERSION\"" echo "export TIZEN_SDK_ROOT=\"$(realpath "$TIZEN_SDK_ROOT")\"" echo "export TIZEN_SDK_TOOLCHAIN=\"\$TIZEN_SDK_ROOT/tools/arm-linux-gnueabi-gcc-9.2\"" - echo "export TIZEN_SDK_SYSROOT=\"\$TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/mobile/rootstraps/mobile-$TIZEN_VERSION-device.core\"" + echo "export TIZEN_SDK_SYSROOT=\"\$TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/tizen/rootstraps/tizen-$TIZEN_VERSION-device.core\"" echo "export PATH=\"\$TIZEN_SDK_TOOLCHAIN/bin:\$TIZEN_SDK_ROOT/tools/ide/bin:\$TIZEN_SDK_ROOT/tools:\$PATH\"" echo -n "$COLOR_NONE" } From 350b13f76c0ad630081c4e50d608f6d62477ac1a Mon Sep 17 00:00:00 2001 From: fesseha-eve <88329315+fessehaeve@users.noreply.github.com> Date: Wed, 14 Aug 2024 16:24:47 +0200 Subject: [PATCH 18/59] updated list of AcceptedCommands list for Thermostat cluster with Preset feature enabled (#34981) --- src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml b/src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml index 194babe282315b..35da0e04be380f 100644 --- a/src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml @@ -624,7 +624,7 @@ tests: response: constraints: type: list - contains: [254] + contains: [6, 254] - label: "Step 7a: TH reads from the DUT the GeneratedCommandList attribute." From 5ffe9ec641deeb64edd03ddf60788bc06e4652e5 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 14 Aug 2024 11:05:20 -0400 Subject: [PATCH 19/59] Update CCTRL 2.2 to not potentially use uninitialized variables in the class on teardown (#34955) * Do not use uninitialized bits in teardown * Extra guard for file remove * Fix a few more instances of app_process --------- Co-authored-by: Andrei Litvin --- src/python_testing/TC_BRBINFO_4_1.py | 15 +++++++++++---- src/python_testing/TC_CCTRL_2_2.py | 14 ++++++++++---- src/python_testing/TC_MCORE_FS_1_1.py | 15 ++++++++++----- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/python_testing/TC_BRBINFO_4_1.py b/src/python_testing/TC_BRBINFO_4_1.py index 6c65f634bb6a7b..18e478c872fe2f 100644 --- a/src/python_testing/TC_BRBINFO_4_1.py +++ b/src/python_testing/TC_BRBINFO_4_1.py @@ -107,6 +107,7 @@ async def setup_class(self): self.set_of_dut_endpoints_before_adding_device = set(root_part_list) super().setup_class() + self.app_process = None app = self.user_params.get("th_server_app_path", None) if not app: asserts.fail('This test requires a TH_SERVER app. Specify app path with --string-arg th_server_app_path:') @@ -135,10 +136,16 @@ async def setup_class(self): params.commissioningParameters.setupManualCode, params.commissioningParameters.setupQRCode) def teardown_class(self): - logging.warning("Stopping app with SIGTERM") - self.app_process.send_signal(signal.SIGTERM.value) - self.app_process.wait() - os.remove(self.kvs) + # In case the th_server_app_path does not exist, then we failed the test + # and there is nothing to remove + if self.app_process is not None: + logging.warning("Stopping app with SIGTERM") + self.app_process.send_signal(signal.SIGTERM.value) + self.app_process.wait() + + if os.path.exists(self.kvs): + os.remove(self.kvs) + super().teardown_class() # diff --git a/src/python_testing/TC_CCTRL_2_2.py b/src/python_testing/TC_CCTRL_2_2.py index a2d209f0545400..6fd6b9764abac2 100644 --- a/src/python_testing/TC_CCTRL_2_2.py +++ b/src/python_testing/TC_CCTRL_2_2.py @@ -45,6 +45,7 @@ class TC_CCTRL_2_2(MatterBaseTest): async def setup_class(self): super().setup_class() # TODO: confirm whether we can open processes like this on the TH + self.app_process = None app = self.user_params.get("th_server_app_path", None) if not app: asserts.fail('This test requires a TH_SERVER app. Specify app path with --string-arg th_server_app_path:') @@ -73,11 +74,16 @@ async def setup_class(self): logging.info("Commissioning TH_SERVER complete") def teardown_class(self): - logging.warning("Stopping app with SIGTERM") - self.app_process.send_signal(signal.SIGTERM.value) - self.app_process.wait() + # In case the th_server_app_path does not exist, then we failed the test + # and there is nothing to remove + if self.app_process is not None: + logging.warning("Stopping app with SIGTERM") + self.app_process.send_signal(signal.SIGTERM.value) + self.app_process.wait() + + if os.path.exists(self.kvs): + os.remove(self.kvs) - os.remove(self.kvs) super().teardown_class() def steps_TC_CCTRL_2_2(self) -> list[TestStep]: diff --git a/src/python_testing/TC_MCORE_FS_1_1.py b/src/python_testing/TC_MCORE_FS_1_1.py index 50f4dc55c7399b..0680210babd191 100755 --- a/src/python_testing/TC_MCORE_FS_1_1.py +++ b/src/python_testing/TC_MCORE_FS_1_1.py @@ -37,6 +37,7 @@ class TC_MCORE_FS_1_1(MatterBaseTest): async def setup_class(self): super().setup_class() # TODO: confirm whether we can open processes like this on the TH + self.app_process = None app = self.user_params.get("th_server_app_path", None) if not app: asserts.fail('This test requires a TH_SERVER app. Specify app path with --string-arg th_server_app_path:') @@ -64,11 +65,15 @@ async def setup_class(self): logging.info("Commissioning TH_SERVER complete") def teardown_class(self): - logging.warning("Stopping app with SIGTERM") - self.app_process.send_signal(signal.SIGTERM.value) - self.app_process.wait() - - os.remove(self.kvs) + # In case the th_server_app_path does not exist, then we failed the test + # and there is nothing to remove + if self.app_process is not None: + logging.warning("Stopping app with SIGTERM") + self.app_process.send_signal(signal.SIGTERM.value) + self.app_process.wait() + + if os.path.exists(self.kvs): + os.remove(self.kvs) super().teardown_class() def steps_TC_MCORE_FS_1_1(self) -> list[TestStep]: From e1f29bdeddc89e73753406a9400c370ed81b1b02 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Wed, 14 Aug 2024 17:36:31 +0200 Subject: [PATCH 20/59] [Python] Auto-import all clusters into the chip.clusters namespace (#34928) * Auto-import all clusters into the chip.clusters namespace * Fix __all__ lists * ZAP-generate __all__ with all clusters --- .../py_matter_idl/matter_idl/lint/__init__.py | 2 +- scripts/tools/memory/memdf/__init__.py | 5 +- .../python/chip/clusters/Objects.py | 132 ++++++++++++++++++ .../python/chip/clusters/__init__.py | 58 +------- src/controller/python/chip/yaml/__init__.py | 2 +- .../templates/python-cluster-Objects-py.zapt | 9 ++ 6 files changed, 149 insertions(+), 59 deletions(-) diff --git a/scripts/py_matter_idl/matter_idl/lint/__init__.py b/scripts/py_matter_idl/matter_idl/lint/__init__.py index 3ab2b9f7badd25..6c7b1373f7a95e 100644 --- a/scripts/py_matter_idl/matter_idl/lint/__init__.py +++ b/scripts/py_matter_idl/matter_idl/lint/__init__.py @@ -14,4 +14,4 @@ from .lint_rules_parser import CreateParser -__all__ = [CreateParser] +__all__ = ['CreateParser'] diff --git a/scripts/tools/memory/memdf/__init__.py b/scripts/tools/memory/memdf/__init__.py index fa0e1070112ae4..0a523fbb29bbcb 100644 --- a/scripts/tools/memory/memdf/__init__.py +++ b/scripts/tools/memory/memdf/__init__.py @@ -18,4 +18,7 @@ from memdf.df import DF, DFs, ExtentDF, SectionDF, SegmentDF, SymbolDF from memdf.util.config import Config, ConfigDescription -__all__ = [DF, SymbolDF, SectionDF, SegmentDF, ExtentDF, DFs, Config, ConfigDescription] +__all__ = [ + 'DF', 'SymbolDF', 'SectionDF', 'SegmentDF', 'ExtentDF', + 'DFs', 'Config', 'ConfigDescription', +] diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index cff7adf4ae6fbb..eff056a243e54a 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -36,6 +36,138 @@ ClusterObjectDescriptor, ClusterObjectFieldDescriptor) from .Types import Nullable, NullValue + +__all__ = [ + "Globals", + "Identify", + "Groups", + "OnOff", + "OnOffSwitchConfiguration", + "LevelControl", + "BinaryInputBasic", + "PulseWidthModulation", + "Descriptor", + "Binding", + "AccessControl", + "Actions", + "BasicInformation", + "OtaSoftwareUpdateProvider", + "OtaSoftwareUpdateRequestor", + "LocalizationConfiguration", + "TimeFormatLocalization", + "UnitLocalization", + "PowerSourceConfiguration", + "PowerSource", + "GeneralCommissioning", + "NetworkCommissioning", + "DiagnosticLogs", + "GeneralDiagnostics", + "SoftwareDiagnostics", + "ThreadNetworkDiagnostics", + "WiFiNetworkDiagnostics", + "EthernetNetworkDiagnostics", + "TimeSynchronization", + "BridgedDeviceBasicInformation", + "Switch", + "AdministratorCommissioning", + "OperationalCredentials", + "GroupKeyManagement", + "FixedLabel", + "UserLabel", + "ProxyConfiguration", + "ProxyDiscovery", + "ProxyValid", + "BooleanState", + "IcdManagement", + "Timer", + "OvenCavityOperationalState", + "OvenMode", + "LaundryDryerControls", + "ModeSelect", + "LaundryWasherMode", + "RefrigeratorAndTemperatureControlledCabinetMode", + "LaundryWasherControls", + "RvcRunMode", + "RvcCleanMode", + "TemperatureControl", + "RefrigeratorAlarm", + "DishwasherMode", + "AirQuality", + "SmokeCoAlarm", + "DishwasherAlarm", + "MicrowaveOvenMode", + "MicrowaveOvenControl", + "OperationalState", + "RvcOperationalState", + "ScenesManagement", + "HepaFilterMonitoring", + "ActivatedCarbonFilterMonitoring", + "BooleanStateConfiguration", + "ValveConfigurationAndControl", + "ElectricalPowerMeasurement", + "ElectricalEnergyMeasurement", + "WaterHeaterManagement", + "DemandResponseLoadControl", + "Messages", + "DeviceEnergyManagement", + "EnergyEvse", + "EnergyPreference", + "PowerTopology", + "EnergyEvseMode", + "WaterHeaterMode", + "DeviceEnergyManagementMode", + "DoorLock", + "WindowCovering", + "BarrierControl", + "ServiceArea", + "PumpConfigurationAndControl", + "Thermostat", + "FanControl", + "ThermostatUserInterfaceConfiguration", + "ColorControl", + "BallastConfiguration", + "IlluminanceMeasurement", + "TemperatureMeasurement", + "PressureMeasurement", + "FlowMeasurement", + "RelativeHumidityMeasurement", + "OccupancySensing", + "CarbonMonoxideConcentrationMeasurement", + "CarbonDioxideConcentrationMeasurement", + "NitrogenDioxideConcentrationMeasurement", + "OzoneConcentrationMeasurement", + "Pm25ConcentrationMeasurement", + "FormaldehydeConcentrationMeasurement", + "Pm1ConcentrationMeasurement", + "Pm10ConcentrationMeasurement", + "TotalVolatileOrganicCompoundsConcentrationMeasurement", + "RadonConcentrationMeasurement", + "WiFiNetworkManagement", + "ThreadBorderRouterManagement", + "ThreadNetworkDirectory", + "WakeOnLan", + "Channel", + "TargetNavigator", + "MediaPlayback", + "MediaInput", + "LowPower", + "KeypadInput", + "ContentLauncher", + "AudioOutput", + "ApplicationLauncher", + "ApplicationBasic", + "AccountLogin", + "ContentControl", + "ContentAppObserver", + "EcosystemInformation", + "CommissionerControl", + "ElectricalMeasurement", + "UnitTesting", + "FaultInjection", + "SampleMei", +] + + class Globals: class Enums: class AreaTypeTag(MatterIntEnum): diff --git a/src/controller/python/chip/clusters/__init__.py b/src/controller/python/chip/clusters/__init__.py index b135345e9657de..14dc6f3e1d4185 100644 --- a/src/controller/python/chip/clusters/__init__.py +++ b/src/controller/python/chip/clusters/__init__.py @@ -15,59 +15,5 @@ # limitations under the License. # -# -# @file -# Provides Python APIs for CHIP. -# - -"""Provides Python APIs for CHIP.""" - -from . import Attribute, CHIPClusters, Command -from .Objects import (AccessControl, AccountLogin, Actions, ActivatedCarbonFilterMonitoring, AdministratorCommissioning, AirQuality, - ApplicationBasic, ApplicationLauncher, AudioOutput, BallastConfiguration, BarrierControl, BasicInformation, - BinaryInputBasic, Binding, BooleanState, BooleanStateConfiguration, BridgedDeviceBasicInformation, - CarbonDioxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurement, Channel, ColorControl, - CommissionerControl, ContentControl, ContentLauncher, DemandResponseLoadControl, Descriptor, - DeviceEnergyManagement, DeviceEnergyManagementMode, DiagnosticLogs, DishwasherAlarm, DishwasherMode, DoorLock, - EcosystemInformation, ElectricalEnergyMeasurement, ElectricalMeasurement, ElectricalPowerMeasurement, - EnergyEvse, EnergyEvseMode, EnergyPreference, EthernetNetworkDiagnostics, FanControl, FaultInjection, - FixedLabel, FlowMeasurement, FormaldehydeConcentrationMeasurement, GeneralCommissioning, GeneralDiagnostics, - Globals, GroupKeyManagement, Groups, HepaFilterMonitoring, IcdManagement, Identify, IlluminanceMeasurement, - KeypadInput, LaundryDryerControls, LaundryWasherControls, LaundryWasherMode, LevelControl, - LocalizationConfiguration, LowPower, MediaInput, MediaPlayback, MicrowaveOvenControl, MicrowaveOvenMode, - ModeSelect, NetworkCommissioning, NitrogenDioxideConcentrationMeasurement, OccupancySensing, OnOff, - OnOffSwitchConfiguration, OperationalCredentials, OperationalState, OtaSoftwareUpdateProvider, - OtaSoftwareUpdateRequestor, OvenCavityOperationalState, OvenMode, OzoneConcentrationMeasurement, - Pm1ConcentrationMeasurement, Pm10ConcentrationMeasurement, Pm25ConcentrationMeasurement, PowerSource, - PowerSourceConfiguration, PowerTopology, PressureMeasurement, ProxyConfiguration, ProxyDiscovery, ProxyValid, - PulseWidthModulation, PumpConfigurationAndControl, RadonConcentrationMeasurement, RefrigeratorAlarm, - RefrigeratorAndTemperatureControlledCabinetMode, RelativeHumidityMeasurement, RvcCleanMode, - RvcOperationalState, RvcRunMode, ScenesManagement, ServiceArea, SmokeCoAlarm, SoftwareDiagnostics, Switch, - TargetNavigator, TemperatureControl, TemperatureMeasurement, Thermostat, ThermostatUserInterfaceConfiguration, - ThreadBorderRouterManagement, ThreadNetworkDiagnostics, ThreadNetworkDirectory, TimeFormatLocalization, - TimeSynchronization, TotalVolatileOrganicCompoundsConcentrationMeasurement, UnitLocalization, UnitTesting, - UserLabel, ValveConfigurationAndControl, WakeOnLan, WaterHeaterManagement, WaterHeaterMode, - WiFiNetworkDiagnostics, WindowCovering) - -__all__ = [Attribute, CHIPClusters, Command, AccessControl, AccountLogin, Actions, ActivatedCarbonFilterMonitoring, AdministratorCommissioning, AirQuality, - ApplicationBasic, ApplicationLauncher, AudioOutput, BallastConfiguration, BarrierControl, BasicInformation, - BinaryInputBasic, Binding, BooleanState, BooleanStateConfiguration, BridgedDeviceBasicInformation, CarbonDioxideConcentrationMeasurement, - CarbonMonoxideConcentrationMeasurement, Channel, ColorControl, CommissionerControl, - ContentControl, ContentLauncher, DemandResponseLoadControl, Descriptor, DeviceEnergyManagementMode, DeviceEnergyManagement, DeviceEnergyManagementMode, DiagnosticLogs, DishwasherAlarm, DishwasherMode, - DoorLock, EcosystemInformation, ElectricalEnergyMeasurement, ElectricalMeasurement, ElectricalPowerMeasurement, EnergyEvse, EnergyEvseMode, EnergyPreference, - EthernetNetworkDiagnostics, FanControl, FaultInjection, FixedLabel, FlowMeasurement, - FormaldehydeConcentrationMeasurement, GeneralCommissioning, GeneralDiagnostics, Globals, GroupKeyManagement, Groups, - HepaFilterMonitoring, IcdManagement, Identify, IlluminanceMeasurement, KeypadInput, LaundryDryerControls, - LaundryWasherControls, LaundryWasherMode, LevelControl, LocalizationConfiguration, LowPower, MediaInput, MediaPlayback, MicrowaveOvenControl, - MicrowaveOvenMode, ModeSelect, NetworkCommissioning, NitrogenDioxideConcentrationMeasurement, - OccupancySensing, OnOff, OnOffSwitchConfiguration, OperationalCredentials, OperationalState, - OtaSoftwareUpdateProvider, OtaSoftwareUpdateRequestor, OvenCavityOperationalState, OvenMode, - OzoneConcentrationMeasurement, Pm1ConcentrationMeasurement, Pm10ConcentrationMeasurement, - Pm25ConcentrationMeasurement, PowerSource, PowerSourceConfiguration, PowerTopology, PressureMeasurement, ProxyConfiguration, - ProxyDiscovery, ProxyValid, PulseWidthModulation, PumpConfigurationAndControl, RadonConcentrationMeasurement, - RefrigeratorAlarm, RefrigeratorAndTemperatureControlledCabinetMode, RelativeHumidityMeasurement, RvcCleanMode, - RvcOperationalState, RvcRunMode, ScenesManagement, ServiceArea, SmokeCoAlarm, SoftwareDiagnostics, - Switch, TargetNavigator, TemperatureControl, TemperatureMeasurement, Thermostat, ThermostatUserInterfaceConfiguration, - ThreadBorderRouterManagement, ThreadNetworkDiagnostics, ThreadNetworkDirectory, TimeFormatLocalization, TimeSynchronization, - TotalVolatileOrganicCompoundsConcentrationMeasurement, UnitLocalization, - UnitTesting, UserLabel, ValveConfigurationAndControl, WakeOnLan, WaterHeaterManagement, WaterHeaterMode, WiFiNetworkDiagnostics, WindowCovering] +from . import Attribute, CHIPClusters, Command, Objects # noqa: F401 +from .Objects import * # noqa: F401, F403 diff --git a/src/controller/python/chip/yaml/__init__.py b/src/controller/python/chip/yaml/__init__.py index 7f312912b6664a..db829e97647a16 100644 --- a/src/controller/python/chip/yaml/__init__.py +++ b/src/controller/python/chip/yaml/__init__.py @@ -23,4 +23,4 @@ from . import runner -__all__ = [runner] +__all__ = ['runner'] diff --git a/src/controller/python/templates/python-cluster-Objects-py.zapt b/src/controller/python/templates/python-cluster-Objects-py.zapt index 0aa05721e69a16..3cb973d86dd356 100644 --- a/src/controller/python/templates/python-cluster-Objects-py.zapt +++ b/src/controller/python/templates/python-cluster-Objects-py.zapt @@ -19,6 +19,15 @@ from .ClusterObjects import (Cluster, ClusterAttributeDescriptor, ClusterCommand ClusterObjectDescriptor, ClusterObjectFieldDescriptor) from .Types import Nullable, NullValue + +__all__ = [ + "Globals", +{{#zcl_clusters}} + "{{asUpperCamelCase name}}", +{{/zcl_clusters}} +] + + class Globals: class Enums: {{#zcl_enums}} From 51dbf0ace51ba44f1c7512158aec3be864c6b097 Mon Sep 17 00:00:00 2001 From: Kiel Oleson Date: Wed, 14 Aug 2024 10:37:18 -0700 Subject: [PATCH 21/59] fix unused variable issue on non-macOS testing (#34970) --- .../Framework/CHIPTests/TestHelpers/MTRTestServerAppRunner.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestServerAppRunner.m b/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestServerAppRunner.m index 18424ed332a6af..077cd494045f4c 100644 --- a/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestServerAppRunner.m +++ b/src/darwin/Framework/CHIPTests/TestHelpers/MTRTestServerAppRunner.m @@ -21,11 +21,13 @@ static unsigned sAppRunnerIndex = 1; +#if HAVE_NSTASK // kBasePort gets the discriminator added to it to figure out the port the app // should be using. This ensures that apps with distinct discriminators use // distinct ports. static const uint16_t kMinDiscriminator = 1111; static const uint16_t kBasePort = 5542 - kMinDiscriminator; +#endif // HAVE_NSTASK @implementation MTRTestServerAppRunner { unsigned _uniqueIndex; From f84ad54cae4602088410324bc46d8f618b0c9438 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 14 Aug 2024 14:49:14 -0400 Subject: [PATCH 22/59] Add constraint enforcement on responseTimeoutSeconds in commissioner control cluster (#34982) * Add constraint enforcement on responseTimeoutSeconds This adds constraints in the implementation and also fixes up error codes in CCTRL_2_2 test. * Fix comment --- .../commissioner-control-server.cpp | 8 ++++++++ src/python_testing/TC_CCTRL_2_2.py | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/app/clusters/commissioner-control-server/commissioner-control-server.cpp b/src/app/clusters/commissioner-control-server/commissioner-control-server.cpp index 25f6153959a22e..d8a655f6afb241 100644 --- a/src/app/clusters/commissioner-control-server/commissioner-control-server.cpp +++ b/src/app/clusters/commissioner-control-server/commissioner-control-server.cpp @@ -216,6 +216,14 @@ bool emberAfCommissionerControlClusterCommissionNodeCallback( auto sourceNodeId = GetNodeId(commandObj); + // Constraint on responseTimeoutSeconds is [30; 120] seconds + if ((commandData.responseTimeoutSeconds < 30) || (commandData.responseTimeoutSeconds > 120)) + { + ChipLogError(Zcl, "Invalid responseTimeoutSeconds for CommissionNode."); + commandObj->AddStatus(commandPath, Status::ConstraintError); + return true; + } + // Check if the command is executed via a CASE session if (sourceNodeId == kUndefinedNodeId) { diff --git a/src/python_testing/TC_CCTRL_2_2.py b/src/python_testing/TC_CCTRL_2_2.py index 6fd6b9764abac2..5204352b8b66a5 100644 --- a/src/python_testing/TC_CCTRL_2_2.py +++ b/src/python_testing/TC_CCTRL_2_2.py @@ -217,7 +217,7 @@ async def test_TC_CCTRL_2_2(self): await self.send_single_cmd(cmd=cmd) asserts.fail("Unexpected success on CommissionNode") except InteractionModelError as e: - asserts.assert_equal(e.status, Status.Failure, "Incorrect error returned") + asserts.assert_equal(e.status, Status.ConstraintError, "Incorrect error returned") self.step(16) cmd = Clusters.CommissionerControl.Commands.CommissionNode(requestId=good_request_id, responseTimeoutSeconds=121) @@ -225,7 +225,7 @@ async def test_TC_CCTRL_2_2(self): await self.send_single_cmd(cmd=cmd) asserts.fail("Unexpected success on CommissionNode") except InteractionModelError as e: - asserts.assert_equal(e.status, Status.Failure, "Incorrect error returned") + asserts.assert_equal(e.status, Status.ConstraintError, "Incorrect error returned") self.step(17) cmd = Clusters.CommissionerControl.Commands.CommissionNode(requestId=good_request_id, responseTimeoutSeconds=30) From 4205cc36e473ee2dac850f9018d1a9c7d8ea9fef Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 14 Aug 2024 14:59:10 -0400 Subject: [PATCH 23/59] Fix conversion error (#34989) --- .../CodegenDataModelProvider_Write.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/codegen-data-model-provider/CodegenDataModelProvider_Write.cpp b/src/app/codegen-data-model-provider/CodegenDataModelProvider_Write.cpp index 333c9e27e4bf9f..7420427f84909b 100644 --- a/src/app/codegen-data-model-provider/CodegenDataModelProvider_Write.cpp +++ b/src/app/codegen-data-model-provider/CodegenDataModelProvider_Write.cpp @@ -51,7 +51,7 @@ using Protocols::InteractionModel::Status; /// /// If it returns std::nullopt, then there is no AAI to handle the given path /// and processing should figure out the value otherwise (generally from other ember data) -std::optional TryWriteViaAccessInterface(const ConcreteAttributePath & path, AttributeAccessInterface * aai, +std::optional TryWriteViaAccessInterface(const ConcreteDataAttributePath & path, AttributeAccessInterface * aai, AttributeValueDecoder & decoder) { // Processing can happen only if an attribute access interface actually exists.. From 12c1a57647451cf222c677ed4812ae203d80ce7b Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Thu, 15 Aug 2024 00:30:59 +0200 Subject: [PATCH 24/59] Update ZAP to newest nightly to get fix for global types (#34996) * Update zap.version * Update zap.json * Bump min ZAP version * Regen ZAP files after update * Restore extra newline --- scripts/setup/zap.json | 4 ++-- scripts/setup/zap.version | 2 +- scripts/tools/zap/zap_execution.py | 2 +- src/controller/python/chip/clusters/Objects.py | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/setup/zap.json b/scripts/setup/zap.json index d137149db06241..38dec0696910f5 100644 --- a/scripts/setup/zap.json +++ b/scripts/setup/zap.json @@ -8,13 +8,13 @@ "mac-amd64", "windows-amd64" ], - "tags": ["version:2@v2024.08.06-nightly.1"] + "tags": ["version:2@v2024.08.14-nightly.1"] }, { "_comment": "Always get the amd64 version on mac until usable arm64 zap build is available", "path": "fuchsia/third_party/zap/mac-amd64", "platforms": ["mac-arm64"], - "tags": ["version:2@v2024.08.06-nightly.1"] + "tags": ["version:2@v2024.08.14-nightly.1"] } ] } diff --git a/scripts/setup/zap.version b/scripts/setup/zap.version index db8c344a7deaa4..5e2fd1daf0596d 100644 --- a/scripts/setup/zap.version +++ b/scripts/setup/zap.version @@ -1 +1 @@ -v2024.08.06-nightly +v2024.08.14-nightly diff --git a/scripts/tools/zap/zap_execution.py b/scripts/tools/zap/zap_execution.py index d2d4bc557a9808..40bc2e2a4b94a8 100644 --- a/scripts/tools/zap/zap_execution.py +++ b/scripts/tools/zap/zap_execution.py @@ -23,7 +23,7 @@ # Use scripts/tools/zap/version_update.py to manage ZAP versioning as many # files may need updating for versions # -MIN_ZAP_VERSION = '2024.8.5' +MIN_ZAP_VERSION = '2024.8.14' class ZapTool: diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index eff056a243e54a..ed3c9154cc8c3a 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -47252,7 +47252,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ]) uniqueLocationID: 'str' = "" - locationDescriptor: 'Globals.Structs.LocationDescriptorStruct' = field(default_factory=lambda: EcosystemInformation.Structs.LocationDescriptorStruct()) + locationDescriptor: 'Globals.Structs.LocationDescriptorStruct' = field(default_factory=lambda: Globals.Structs.LocationDescriptorStruct()) locationDescriptorLastEdit: 'uint' = 0 fabricIndex: 'uint' = 0 @@ -51090,7 +51090,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="field2", Tag=1, Type=Globals.Enums.TestGlobalEnum), ]) - field1: 'Globals.Structs.TestGlobalStruct' = field(default_factory=lambda: UnitTesting.Structs.TestGlobalStruct()) + field1: 'Globals.Structs.TestGlobalStruct' = field(default_factory=lambda: Globals.Structs.TestGlobalStruct()) field2: 'Globals.Enums.TestGlobalEnum' = 0 @dataclass @@ -51303,7 +51303,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="field2", Tag=1, Type=Globals.Enums.TestGlobalEnum), ]) - field1: 'Globals.Structs.TestGlobalStruct' = field(default_factory=lambda: UnitTesting.Structs.TestGlobalStruct()) + field1: 'Globals.Structs.TestGlobalStruct' = field(default_factory=lambda: Globals.Structs.TestGlobalStruct()) field2: 'Globals.Enums.TestGlobalEnum' = 0 @dataclass @@ -52127,7 +52127,7 @@ def attribute_id(cls) -> int: def attribute_type(cls) -> ClusterObjectFieldDescriptor: return ClusterObjectFieldDescriptor(Type=Globals.Structs.TestGlobalStruct) - value: 'Globals.Structs.TestGlobalStruct' = field(default_factory=lambda: UnitTesting.Structs.TestGlobalStruct()) + value: 'Globals.Structs.TestGlobalStruct' = field(default_factory=lambda: Globals.Structs.TestGlobalStruct()) @dataclass class Unsupported(ClusterAttributeDescriptor): From c11c0ee9de0381a97393d08b802e3f345f53f434 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Wed, 14 Aug 2024 18:33:57 -0400 Subject: [PATCH 25/59] Create new ICD Manager in fabric-admin to service KeepActive Command (#34894) --------- Co-authored-by: Restyled.io Co-authored-by: yunhanw --- examples/fabric-admin/BUILD.gn | 4 + .../commands/common/CHIPCommand.cpp | 6 +- .../commands/common/CHIPCommand.h | 1 - .../commands/common/IcdManager.cpp | 47 ++++++++ .../fabric-admin/commands/common/IcdManager.h | 51 +++++++++ .../commands/common/StayActiveSender.cpp | 99 ++++++++++++++++ .../commands/common/StayActiveSender.h | 107 ++++++++++++++++++ .../commands/pairing/PairingCommand.cpp | 2 +- examples/fabric-admin/rpc/RpcServer.cpp | 73 ++++++++++-- 9 files changed, 377 insertions(+), 13 deletions(-) create mode 100644 examples/fabric-admin/commands/common/IcdManager.cpp create mode 100644 examples/fabric-admin/commands/common/IcdManager.h create mode 100644 examples/fabric-admin/commands/common/StayActiveSender.cpp create mode 100644 examples/fabric-admin/commands/common/StayActiveSender.h diff --git a/examples/fabric-admin/BUILD.gn b/examples/fabric-admin/BUILD.gn index 7fbd13e07183ed..77e851a53c36d2 100644 --- a/examples/fabric-admin/BUILD.gn +++ b/examples/fabric-admin/BUILD.gn @@ -69,8 +69,12 @@ static_library("fabric-admin-utils") { "commands/common/Commands.h", "commands/common/CredentialIssuerCommands.h", "commands/common/HexConversion.h", + "commands/common/IcdManager.cpp", + "commands/common/IcdManager.h", "commands/common/RemoteDataModelLogger.cpp", "commands/common/RemoteDataModelLogger.h", + "commands/common/StayActiveSender.cpp", + "commands/common/StayActiveSender.h", "commands/fabric-sync/FabricSyncCommand.cpp", "commands/pairing/DeviceSynchronization.cpp", "commands/pairing/DeviceSynchronization.h", diff --git a/examples/fabric-admin/commands/common/CHIPCommand.cpp b/examples/fabric-admin/commands/common/CHIPCommand.cpp index 982c857d206136..0c5455439b22d9 100644 --- a/examples/fabric-admin/commands/common/CHIPCommand.cpp +++ b/examples/fabric-admin/commands/common/CHIPCommand.cpp @@ -18,6 +18,7 @@ #include "CHIPCommand.h" +#include "IcdManager.h" #include #include #include @@ -52,7 +53,6 @@ chip::Credentials::GroupDataProviderImpl CHIPCommand::sGroupDataProvider{ kMaxGr // All fabrics share the same ICD client storage. chip::app::DefaultICDClientStorage CHIPCommand::sICDClientStorage; chip::Crypto::RawKeySessionKeystore CHIPCommand::sSessionKeystore; -chip::app::DefaultCheckInDelegate CHIPCommand::sCheckInDelegate; chip::app::CheckInHandler CHIPCommand::sCheckInHandler; namespace { @@ -148,9 +148,9 @@ CHIP_ERROR CHIPCommand::MaybeSetUpStack() auto engine = chip::app::InteractionModelEngine::GetInstance(); VerifyOrReturnError(engine != nullptr, CHIP_ERROR_INCORRECT_STATE); - ReturnLogErrorOnFailure(sCheckInDelegate.Init(&sICDClientStorage, engine)); + ReturnLogErrorOnFailure(IcdManager::Instance().Init(&sICDClientStorage, engine)); ReturnLogErrorOnFailure(sCheckInHandler.Init(DeviceControllerFactory::GetInstance().GetSystemState()->ExchangeMgr(), - &sICDClientStorage, &sCheckInDelegate, engine)); + &sICDClientStorage, &IcdManager::Instance(), engine)); CommissionerIdentity nullIdentity{ kIdentityNull, chip::kUndefinedNodeId }; ReturnLogErrorOnFailure(InitializeCommissioner(nullIdentity, kIdentityNullFabricId)); diff --git a/examples/fabric-admin/commands/common/CHIPCommand.h b/examples/fabric-admin/commands/common/CHIPCommand.h index 6711b3e4f9aa3d..abd68f6344ea44 100644 --- a/examples/fabric-admin/commands/common/CHIPCommand.h +++ b/examples/fabric-admin/commands/common/CHIPCommand.h @@ -168,7 +168,6 @@ class CHIPCommand : public Command static chip::Credentials::GroupDataProviderImpl sGroupDataProvider; static chip::app::DefaultICDClientStorage sICDClientStorage; - static chip::app::DefaultCheckInDelegate sCheckInDelegate; static chip::app::CheckInHandler sCheckInHandler; CredentialIssuerCommands * mCredIssuerCmds; diff --git a/examples/fabric-admin/commands/common/IcdManager.cpp b/examples/fabric-admin/commands/common/IcdManager.cpp new file mode 100644 index 00000000000000..201d7325541982 --- /dev/null +++ b/examples/fabric-admin/commands/common/IcdManager.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "IcdManager.h" + +IcdManager IcdManager::sInstance; + +IcdManager & IcdManager::Instance() +{ + return sInstance; +} + +void IcdManager::OnCheckInComplete(const chip::app::ICDClientInfo & clientInfo) +{ + DefaultCheckInDelegate::OnCheckInComplete(clientInfo); + if (mDelegate) + { + mDelegate->OnCheckInCompleted(clientInfo); + } +} + +void IcdManager::SetDelegate(Delegate * delegate) +{ + // To keep IcdManager simple, there is an assumption that there is only ever + // one delegate set and it's lifetime is identical to IcdManager. In the + // future this assumption can change should there be a need, but that will + // require code changes to IcdManager. For now we will crash if someone tries + // to call SetDelegate for a second time or if delegate is non-null. + VerifyOrDie(delegate); + VerifyOrDie(!mDelegate); + mDelegate = delegate; +} diff --git a/examples/fabric-admin/commands/common/IcdManager.h b/examples/fabric-admin/commands/common/IcdManager.h new file mode 100644 index 00000000000000..8993f24e531e83 --- /dev/null +++ b/examples/fabric-admin/commands/common/IcdManager.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +#include + +/** + * @brief Manages check-ins from ICD devices. + * + * Intended to be used as a thin CheckInDelegate. This allows a delegate register + * themselves so they can be aware when ICD device checks-in allowing the + * delegate to interact with the ICD device during the short window that it is + * awake. + */ +class IcdManager : public chip::app::DefaultCheckInDelegate +{ +public: + class Delegate + { + public: + virtual ~Delegate() = default; + virtual void OnCheckInCompleted(const chip::app::ICDClientInfo & clientInfo) = 0; + }; + + static IcdManager & Instance(); + void OnCheckInComplete(const chip::app::ICDClientInfo & clientInfo) override; + + // There is an assumption delegate assigned only happens once and that it lives + // for the entirety of the lifetime of fabric admin. + void SetDelegate(Delegate * delegate); + +private: + static IcdManager sInstance; + Delegate * mDelegate = nullptr; +}; diff --git a/examples/fabric-admin/commands/common/StayActiveSender.cpp b/examples/fabric-admin/commands/common/StayActiveSender.cpp new file mode 100644 index 00000000000000..16f1d5cd132f81 --- /dev/null +++ b/examples/fabric-admin/commands/common/StayActiveSender.cpp @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "StayActiveSender.h" + +#include +#include +#include +#include + +CHIP_ERROR StayActiveSender::SendStayActiveCommand(uint32_t stayActiveDurationMs, const chip::ScopedNodeId & peerNode, + chip::app::InteractionModelEngine * engine, OnDoneCallbackType onDone) +{ + ConstructorOnlyInternallyCallable internal; + auto stayActiveSender = chip::Platform::New(internal, stayActiveDurationMs, peerNode, + chip::app::InteractionModelEngine::GetInstance(), onDone); + VerifyOrReturnError(stayActiveSender != nullptr, CHIP_ERROR_NO_MEMORY); + CHIP_ERROR err = stayActiveSender->EstablishSessionToPeer(); + if (CHIP_NO_ERROR != err) + { + chip::Platform::Delete(stayActiveSender); + } + return err; +} + +StayActiveSender::StayActiveSender(const ConstructorOnlyInternallyCallable & _, uint32_t stayActiveDurationMs, + const chip::ScopedNodeId & peerNode, chip::app::InteractionModelEngine * engine, + OnDoneCallbackType onDone) : + mStayActiveDurationMs(stayActiveDurationMs), + mPeerNode(peerNode), mpImEngine(engine), mOnDone(onDone), mOnConnectedCallback(HandleDeviceConnected, this), + mOnConnectionFailureCallback(HandleDeviceConnectionFailure, this) +{} + +CHIP_ERROR StayActiveSender::SendStayActiveCommand(chip::Messaging::ExchangeManager & exchangeMgr, + const chip::SessionHandle & sessionHandle) +{ + auto onSuccess = [&](const chip::app::ConcreteCommandPath & commandPath, const chip::app::StatusIB & status, + const auto & dataResponse) { + uint32_t promisedActiveDurationMs = dataResponse.promisedActiveDuration; + ChipLogProgress(ICD, "StayActive command succeeded with promised duration %u", promisedActiveDurationMs); + mOnDone(promisedActiveDurationMs); + chip::Platform::Delete(this); + }; + + auto onFailure = [&](CHIP_ERROR error) { + ChipLogError(ICD, "StayActive command failed: %" CHIP_ERROR_FORMAT, error.Format()); + chip::Platform::Delete(this); + }; + + chip::EndpointId endpointId = 0; + chip::app::Clusters::IcdManagement::Commands::StayActiveRequest::Type request; + request.stayActiveDuration = mStayActiveDurationMs; + return chip::Controller::InvokeCommandRequest(&exchangeMgr, sessionHandle, endpointId, request, onSuccess, onFailure); +} + +CHIP_ERROR StayActiveSender::EstablishSessionToPeer() +{ + ChipLogProgress(ICD, "Trying to establish a CASE session to extend the active period for lit icd device"); + auto * caseSessionManager = mpImEngine->GetCASESessionManager(); + VerifyOrReturnError(caseSessionManager != nullptr, CHIP_ERROR_INVALID_CASE_PARAMETER); + caseSessionManager->FindOrEstablishSession(mPeerNode, &mOnConnectedCallback, &mOnConnectionFailureCallback); + return CHIP_NO_ERROR; +} + +void StayActiveSender::HandleDeviceConnected(void * context, chip::Messaging::ExchangeManager & exchangeMgr, + const chip::SessionHandle & sessionHandle) +{ + StayActiveSender * const _this = static_cast(context); + VerifyOrDie(_this != nullptr); + + CHIP_ERROR err = _this->SendStayActiveCommand(exchangeMgr, sessionHandle); + if (CHIP_NO_ERROR != err) + { + ChipLogError(ICD, "Failed to send stay active command"); + chip::Platform::Delete(_this); + } +} + +void StayActiveSender::HandleDeviceConnectionFailure(void * context, const chip::ScopedNodeId & peerId, CHIP_ERROR err) +{ + StayActiveSender * const _this = static_cast(context); + VerifyOrDie(_this != nullptr); + ChipLogError(ICD, "Failed to establish CASE for stay active command with error '%" CHIP_ERROR_FORMAT "'", err.Format()); + chip::Platform::Delete(_this); +} diff --git a/examples/fabric-admin/commands/common/StayActiveSender.h b/examples/fabric-admin/commands/common/StayActiveSender.h new file mode 100644 index 00000000000000..c0caa380e6f912 --- /dev/null +++ b/examples/fabric-admin/commands/common/StayActiveSender.h @@ -0,0 +1,107 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#include +#include +#include + +/** + * @brief StayActiveSender contains all the data and methods needed for active period extension of an ICD client. + * + * Lifetime of instance of StayActiveSender is entirely self managed. + */ +class StayActiveSender +{ +private: + // Ideally StayActiveSender would be a private constructor, unfortunately that is not possible as Platform::New + // does not have access to private constructors. As a workaround we have defined this private struct that can + // be forwarded by Platform::New that allows us to enforce that the only way StayActiveSender is constructed is + // if SendStayActiveCommand is called. + struct ConstructorOnlyInternallyCallable + { + }; + +public: + using OnDoneCallbackType = std::function; + + /** + * @brief Attempts to send a StayActiveRequest command + * + * @param[in] stayActiveDurationMs StayActiveRequest command parameter. + * @param[in] peerNode Peer node we sending StayActiveRequest command to + * @param[in] engine Interaction Model Engine instance for sending command. + * @param[in] onDone Upon this function returning success, it is expected that onDone will be called after we + * have successfully recieved a response + * + * @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error code. + */ + static CHIP_ERROR SendStayActiveCommand(uint32_t stayActiveDurationMs, const chip::ScopedNodeId & peerNode, + chip::app::InteractionModelEngine * engine, OnDoneCallbackType onDone); + + // Ideally this would be a private constructor, unfortunately that is not possible as Platform::New does not + // have access to private constructors. As a workaround we have defined a private struct that can be forwarded + // by Platform::New that allows us to enforce that the only way this is constructed is if SendStayActiveCommand + // is called. + StayActiveSender(const ConstructorOnlyInternallyCallable & _, uint32_t stayActiveDurationMs, + const chip::ScopedNodeId & peerNode, chip::app::InteractionModelEngine * engine, OnDoneCallbackType onDone); + +private: + /** + * @brief Sets up a CASE session with the peer to extend the client's active period with that peer. + * Returns error if we did not even manage to kick off a CASE attempt. + */ + CHIP_ERROR EstablishSessionToPeer(); + + // CASE session callbacks + /** + *@brief Callback received on successfully establishing a CASE session in order to keep the 'lit icd device' active + * + * @param[in] context - context of the client establishing the CASE session + * @param[in] exchangeMgr - exchange manager to use for the re-registration + * @param[in] sessionHandle - session handle to use for the re-registration + */ + static void HandleDeviceConnected(void * context, chip::Messaging::ExchangeManager & exchangeMgr, + const chip::SessionHandle & sessionHandle); + /** + * @brief Callback received on failure to establish a CASE session + * + * @param[in] context - context of the client establishing the CASE session + * @param[in] peerId - Scoped Node ID of the peer node + * @param[in] err - failure reason + */ + static void HandleDeviceConnectionFailure(void * context, const chip::ScopedNodeId & peerId, CHIP_ERROR err); + + /** + * @brief Used to send a stayActive command to the peer + * + * @param[in] exchangeMgr - exchange manager to use for the re-registration + * @param[in] sessionHandle - session handle to use for the re-registration + */ + CHIP_ERROR SendStayActiveCommand(chip::Messaging::ExchangeManager & exchangeMgr, const chip::SessionHandle & sessionHandle); + + uint32_t mStayActiveDurationMs = 0; + chip::ScopedNodeId mPeerNode; + chip::app::InteractionModelEngine * mpImEngine = nullptr; + OnDoneCallbackType mOnDone; + + chip::Callback::Callback mOnConnectedCallback; + chip::Callback::Callback mOnConnectionFailureCallback; +}; diff --git a/examples/fabric-admin/commands/pairing/PairingCommand.cpp b/examples/fabric-admin/commands/pairing/PairingCommand.cpp index 21b023f423ed84..aecd259d373d3f 100644 --- a/examples/fabric-admin/commands/pairing/PairingCommand.cpp +++ b/examples/fabric-admin/commands/pairing/PairingCommand.cpp @@ -464,7 +464,7 @@ void PairingCommand::OnICDRegistrationComplete(ScopedNodeId nodeId, uint32_t icd sizeof(icdSymmetricKeyHex), chip::Encoding::HexFlags::kNullTerminate); app::ICDClientInfo clientInfo; - clientInfo.peer_node = chip::ScopedNodeId(mICDCheckInNodeId.Value(), nodeId.GetFabricIndex()); + clientInfo.peer_node = nodeId; clientInfo.monitored_subject = mICDMonitoredSubject.Value(); clientInfo.start_icd_counter = icdCounter; diff --git a/examples/fabric-admin/rpc/RpcServer.cpp b/examples/fabric-admin/rpc/RpcServer.cpp index 16ff695e159712..86d90ad294beb7 100644 --- a/examples/fabric-admin/rpc/RpcServer.cpp +++ b/examples/fabric-admin/rpc/RpcServer.cpp @@ -20,11 +20,16 @@ #include "pw_rpc_system_server/rpc_server.h" #include "pw_rpc_system_server/socket.h" +#include +#include + +#include "RpcClient.h" +#include +#include #include #include #include #include -#include #if defined(PW_RPC_FABRIC_ADMIN_SERVICE) && PW_RPC_FABRIC_ADMIN_SERVICE #include "pigweed/rpc_services/FabricAdmin.h" @@ -35,9 +40,33 @@ using namespace ::chip; namespace { #if defined(PW_RPC_FABRIC_ADMIN_SERVICE) && PW_RPC_FABRIC_ADMIN_SERVICE -class FabricAdmin final : public rpc::FabricAdmin + +class FabricAdmin final : public rpc::FabricAdmin, public IcdManager::Delegate { public: + void OnCheckInCompleted(const chip::app::ICDClientInfo & clientInfo) override + { + chip::NodeId nodeId = clientInfo.peer_node.GetNodeId(); + auto it = mPendingKeepActiveTimesMs.find(nodeId); + VerifyOrReturn(it != mPendingKeepActiveTimesMs.end()); + // TODO(#33221): We also need a mechanism here to drop KeepActive + // request if they were recieved over 60 mins ago. + uint32_t stayActiveDurationMs = it->second; + + // TODO(#33221): If there is a failure in sending the message this request just gets dropped. + // Work to see if there should be update to spec on whether some sort of failure later on + // Should be indicated in some manner, or identify a better recovery mechanism here. + mPendingKeepActiveTimesMs.erase(nodeId); + + auto onDone = [=](uint32_t promisedActiveDuration) { ActiveChanged(nodeId, promisedActiveDuration); }; + CHIP_ERROR err = StayActiveSender::SendStayActiveCommand(stayActiveDurationMs, clientInfo.peer_node, + chip::app::InteractionModelEngine::GetInstance(), onDone); + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to send StayActive command %s", err.AsString()); + } + } + pw::Status OpenCommissioningWindow(const chip_rpc_DeviceCommissioningWindowInfo & request, chip_rpc_OperationStatus & response) override { @@ -65,14 +94,41 @@ class FabricAdmin final : public rpc::FabricAdmin pw::Status KeepActive(const chip_rpc_KeepActiveParameters & request, pw_protobuf_Empty & response) override { ChipLogProgress(NotSpecified, "Received KeepActive request: 0x%lx, %u", request.node_id, request.stay_active_duration_ms); - // TODO(#33221): When we get this command hopefully we are already registered with an ICD device to be - // notified when it wakes up. We will need to add in hooks there to make sure we send the StayActiveRequest - // Important thing to note: - // * If we get this call multiple times before we get a wakeup from ICD, we only send out one StayActiveRequest command - // * After 60 mins from last exipry we no longer will send out a StayActiveRequest. - + // TODO(#33221): We should really be using ScopedNode, but that requires larger fix in communication between + // fabric-admin and fabric-bridge. For now we make the assumption that there is only one fabric used by + // fabric-admin. + KeepActiveWorkData * data = chip::Platform::New(this, request.node_id, request.stay_active_duration_ms); + VerifyOrReturnValue(data, pw::Status::Internal()); + chip::DeviceLayer::PlatformMgr().ScheduleWork(KeepActiveWork, reinterpret_cast(data)); return pw::OkStatus(); } + + void ScheduleSendingKeepActiveOnCheckIn(chip::NodeId nodeId, uint32_t stayActiveDurationMs) + { + mPendingKeepActiveTimesMs[nodeId] = stayActiveDurationMs; + } + +private: + struct KeepActiveWorkData + { + KeepActiveWorkData(FabricAdmin * fabricAdmin, chip::NodeId nodeId, uint32_t stayActiveDurationMs) : + mFabricAdmin(fabricAdmin), mNodeId(nodeId), mStayActiveDurationMs(stayActiveDurationMs) + {} + + FabricAdmin * mFabricAdmin; + chip::NodeId mNodeId; + uint32_t mStayActiveDurationMs; + }; + + static void KeepActiveWork(intptr_t arg) + { + KeepActiveWorkData * data = reinterpret_cast(arg); + data->mFabricAdmin->ScheduleSendingKeepActiveOnCheckIn(data->mNodeId, data->mStayActiveDurationMs); + chip::Platform::Delete(data); + } + + // Modifications to mPendingKeepActiveTimesMs should be done on the MatterEventLoop thread + std::map mPendingKeepActiveTimesMs; }; FabricAdmin fabric_admin_service; @@ -82,6 +138,7 @@ void RegisterServices(pw::rpc::Server & server) { #if defined(PW_RPC_FABRIC_ADMIN_SERVICE) && PW_RPC_FABRIC_ADMIN_SERVICE server.RegisterService(fabric_admin_service); + IcdManager::Instance().SetDelegate(&fabric_admin_service); #endif } From 4b8ac58eae4c5117810cada35a87f8815aa08774 Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Wed, 14 Aug 2024 20:46:08 -0400 Subject: [PATCH 26/59] [Silabs]Provision storage sourceset (#34929) * Create a separte source_set for the provision storage implementation * Fix efr32 build using provision flash storage * fix argument duplication which is not needed. * apply suggested renames --- examples/platform/silabs/SiWx917/BUILD.gn | 10 +--- examples/platform/silabs/efr32/BUILD.gn | 7 +-- examples/platform/silabs/provision/BUILD.gn | 52 +++++++++++++++++++ .../silabs/efr32/efr32-chip-mbedtls-config.h | 6 +++ third_party/silabs/efr32_sdk.gni | 9 ++++ 5 files changed, 69 insertions(+), 15 deletions(-) create mode 100644 examples/platform/silabs/provision/BUILD.gn diff --git a/examples/platform/silabs/SiWx917/BUILD.gn b/examples/platform/silabs/SiWx917/BUILD.gn index 1a4bc788637603..80d247b56c4df4 100644 --- a/examples/platform/silabs/SiWx917/BUILD.gn +++ b/examples/platform/silabs/SiWx917/BUILD.gn @@ -115,12 +115,6 @@ source_set("siwx917-matter-shell") { config("siwx917-common-config") { defines = [ "OTA_PERIODIC_TIMEOUT=${ota_periodic_query_timeout_sec}" ] - if (sl_si91x_crypto_flavor == "psa") { - libs = - [ "${sdk_support_root}/matter/provision/lib/libProvisionPSA_si917.a" ] - } else { - libs = [ "${sdk_support_root}/matter/provision/lib/libProvision_si917.a" ] - } if (!disable_lcd) { include_dirs = [ "${silabs_common_plat_dir}/display" ] @@ -177,7 +171,7 @@ config("silabs-wifi-config") { } source_set("siwx917-common") { - deps = [ "${chip_root}/src/platform/silabs/provision:provision-headers" ] + deps = [ "${silabs_common_plat_dir}/provision:storage" ] defines = [] public_deps = [] public_configs = [ @@ -197,8 +191,6 @@ source_set("siwx917-common") { "${silabs_common_plat_dir}/LEDWidget.cpp", "${silabs_common_plat_dir}/MatterConfig.cpp", "${silabs_common_plat_dir}/SoftwareFaultReports.cpp", - "${silabs_common_plat_dir}/provision/ProvisionStorageCustom.cpp", - "${silabs_common_plat_dir}/provision/ProvisionStorageFlash.cpp", "${silabs_common_plat_dir}/silabs_utils.cpp", "${silabs_common_plat_dir}/syscalls_stubs.cpp", "${silabs_plat_si91x_wifi_dir}/dhcp_client.cpp", diff --git a/examples/platform/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn index bff7d1e37be125..22b7458588d97c 100644 --- a/examples/platform/silabs/efr32/BUILD.gn +++ b/examples/platform/silabs/efr32/BUILD.gn @@ -148,9 +148,6 @@ source_set("efr-matter-shell") { config("efr32-common-config") { defines = [ "OTA_PERIODIC_TIMEOUT=${ota_periodic_query_timeout_sec}" ] - libs = [ - "${sdk_support_root}/matter/provision/lib/libProvision_${silabs_family}.a", - ] if (!disable_lcd) { include_dirs = [ "${silabs_common_plat_dir}/display" ] @@ -212,7 +209,7 @@ config("silabs-wifi-config") { } source_set("efr32-common") { - deps = [ "${chip_root}/src/platform/silabs/provision:provision-headers" ] + deps = [ "${silabs_common_plat_dir}/provision:storage" ] defines = [] public_deps = [] public_configs = [ @@ -241,8 +238,6 @@ source_set("efr32-common") { "${silabs_common_plat_dir}/LEDWidget.cpp", "${silabs_common_plat_dir}/MatterConfig.cpp", "${silabs_common_plat_dir}/SoftwareFaultReports.cpp", - "${silabs_common_plat_dir}/provision/ProvisionStorageCustom.cpp", - "${silabs_common_plat_dir}/provision/ProvisionStorageDefault.cpp", "${silabs_common_plat_dir}/silabs_utils.cpp", "${silabs_common_plat_dir}/syscalls_stubs.cpp", ] diff --git a/examples/platform/silabs/provision/BUILD.gn b/examples/platform/silabs/provision/BUILD.gn new file mode 100644 index 00000000000000..ccd5b919bc0379 --- /dev/null +++ b/examples/platform/silabs/provision/BUILD.gn @@ -0,0 +1,52 @@ +# Copyright (c) 2024 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("//build_overrides/efr32_sdk.gni") +import("${efr32_sdk_build_root}/silabs_board.gni") + +if (wifi_soc) { + import("${efr32_sdk_build_root}/SiWx917_sdk.gni") +} else { + import("${efr32_sdk_build_root}/efr32_sdk.gni") +} + +source_set("storage") { + sources = [ "ProvisionStorageCustom.cpp" ] + + if (use_provision_flash_storage) { + sources += [ "ProvisionStorageFlash.cpp" ] + } else { + sources += [ "ProvisionStorageDefault.cpp" ] + } + + if (wifi_soc) { + if (sl_si91x_crypto_flavor == "psa") { + libs = + [ "${sdk_support_root}/matter/provision/lib/libProvisionPSA_si917.a" ] + } else { + libs = [ "${sdk_support_root}/matter/provision/lib/libProvision_si917.a" ] + } + } else { + if (use_provision_flash_storage) { + libs = [ "${sdk_support_root}/matter/provision/lib/libProvisionFlash_${silabs_family}.a" ] + } else { + libs = [ "${sdk_support_root}/matter/provision/lib/libProvision_${silabs_family}.a" ] + } + } + + deps = [ "${chip_root}/src/lib" ] + public_deps = + [ "${chip_root}/src/platform/silabs/provision:provision-headers" ] +} diff --git a/src/platform/silabs/efr32/efr32-chip-mbedtls-config.h b/src/platform/silabs/efr32/efr32-chip-mbedtls-config.h index 6ecfae7d3e4476..c707fe9e9ff323 100644 --- a/src/platform/silabs/efr32/efr32-chip-mbedtls-config.h +++ b/src/platform/silabs/efr32/efr32-chip-mbedtls-config.h @@ -87,6 +87,12 @@ #define PSA_WANT_ALG_SOME_PAKE #endif // SL_USE_COAP_CONFIG +#if SL_MATTER_PROVISION_FLASH +#define MBEDTLS_SHA256_C +#define MBEDTLS_HMAC_DRBG_C +#define MBEDTLS_ECDSA_DETERMINISTIC +#endif // SL_MATTER_PROVISION_FLASH + #define MBEDTLS_PLATFORM_SNPRINTF_MACRO snprintf #define MBEDTLS_AES_ROM_TABLES diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index ccbae7f1ec23ff..c9126d02e43a9f 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -82,6 +82,9 @@ declare_args() { chip_enable_multi_ota_requestor = false chip_enable_multi_ota_encryption = false chip_enable_ota_custom_tlv_testing = false + + # Factory Provision storage + use_provision_flash_storage = wifi_soc } examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" @@ -469,6 +472,12 @@ template("efr32_sdk") { defines += [ "SL_USE_COAP_CONFIG=0" ] } + if (use_provision_flash_storage) { + defines += [ "SL_MATTER_PROVISION_FLASH=1" ] + } else { + defines += [ "SL_MATTER_PROVISION_FLASH=0" ] + } + if (chip_enable_ble_rs911x) { defines += [ "RSI_BLE_ENABLE=1", From 9d8587d7119142fae862540cef0e0449ab07397f Mon Sep 17 00:00:00 2001 From: Alex Tsitsiura Date: Thu, 15 Aug 2024 16:39:30 +0300 Subject: [PATCH 27/59] [Telink] Update Docker image (Zephyr update) (#34980) * [Telink] Update Docker image (Zephyr update) * [Telink] Update Docker image (Zephyr update) --------- Co-authored-by: Andrei Litvin --- integrations/docker/images/base/chip-build/version | 2 +- integrations/docker/images/stage-2/chip-build-telink/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/integrations/docker/images/base/chip-build/version b/integrations/docker/images/base/chip-build/version index 18dcb8d04c629c..dfc4231a8e7a46 100644 --- a/integrations/docker/images/base/chip-build/version +++ b/integrations/docker/images/base/chip-build/version @@ -1 +1 @@ -72 : Update Tizen version to 8.0 +73 : [Telink] Update Docker image (Zephyr update) diff --git a/integrations/docker/images/stage-2/chip-build-telink/Dockerfile b/integrations/docker/images/stage-2/chip-build-telink/Dockerfile index bea580245e8639..e9c3da681291cc 100644 --- a/integrations/docker/images/stage-2/chip-build-telink/Dockerfile +++ b/integrations/docker/images/stage-2/chip-build-telink/Dockerfile @@ -18,7 +18,7 @@ RUN set -x \ && : # last line # Setup Zephyr -ARG ZEPHYR_REVISION=ef7bfc2214602ecf237332b71e6a2bdd69205fbd +ARG ZEPHYR_REVISION=446337fb7b31cd9751720a57d0add62da89c962a WORKDIR /opt/telink/zephyrproject RUN set -x \ && python3 -m pip install --break-system-packages -U --no-cache-dir west \ From 0d71711875e486c9961761808965d4f91c88bbea Mon Sep 17 00:00:00 2001 From: jrhees-cae <61466710+jrhees-cae@users.noreply.github.com> Date: Thu, 15 Aug 2024 08:22:41 -0600 Subject: [PATCH 28/59] [DRLK] Bugfix: return INVALID_COMMAND when attempting to add/modify (#34120) * [DRLK] Bugfix: return INVALID_COMMAND when attempting to add/modify credential from a different fabric than the User/Credential's creator fabric Add YAML test steps to verify correct behavior Fixes #34119 * Restyled by prettier-yaml * Update src/app/tests/suites/DL_UsersAndCredentials.yaml Co-authored-by: Andrei Litvin --------- Co-authored-by: Restyled.io Co-authored-by: Andrei Litvin --- .../door-lock-server/door-lock-server.cpp | 35 ++ .../tests/suites/DL_UsersAndCredentials.yaml | 333 +++++++++++++++++- 2 files changed, 365 insertions(+), 3 deletions(-) diff --git a/src/app/clusters/door-lock-server/door-lock-server.cpp b/src/app/clusters/door-lock-server/door-lock-server.cpp index 29a76853220ef0..3842130aa356f1 100644 --- a/src/app/clusters/door-lock-server/door-lock-server.cpp +++ b/src/app/clusters/door-lock-server/door-lock-server.cpp @@ -803,6 +803,19 @@ void DoorLockServer::setCredentialCommandHandler( return; } + // return INVALID_COMMAND if the accessing fabric index doesn’t match the + // CreatorFabricIndex of the credential being modified + if (existingCredential.createdBy != fabricIdx) + { + ChipLogProgress(Zcl, + "[createCredential] Unable to modify credential. Fabric index differs from creator fabric " + "[endpointId=%d,credentialIndex=%d,creatorIdx=%d,modifierIdx=%d]", + commandPath.mEndpointId, credentialIndex, existingCredential.createdBy, fabricIdx); + + sendSetCredentialResponse(commandObj, commandPath, DlStatus::kInvalidField, 0, nextAvailableCredentialSlot); + return; + } + // if userIndex is NULL then we're changing the programming user PIN if (userIndex.IsNull()) { @@ -2218,6 +2231,17 @@ DlStatus DoorLockServer::createNewCredentialAndAddItToUser(chip::EndpointId endp return DlStatus::kInvalidField; } + // return INVALID_COMMAND if the accessing fabric index doesn’t match the + // CreatorFabricIndex in the user record pointed to by UserIndex + if (user.createdBy != modifierFabricIdx) + { + ChipLogProgress(Zcl, + "[createCredential] Unable to create credential for user created by different fabric " + "[endpointId=%d,userIndex=%d,creatorIdx=%d,fabricIdx=%d]", + endpointId, userIndex, user.createdBy, modifierFabricIdx); + return DlStatus::kInvalidField; + } + // Add new credential to the user auto status = addCredentialToUser(endpointId, modifierFabricIdx, userIndex, credential); if (DlStatus::kSuccess != status) @@ -2338,6 +2362,17 @@ DlStatus DoorLockServer::modifyCredentialForUser(chip::EndpointId endpointId, ch return DlStatus::kFailure; } + // return INVALID_COMMAND if the accessing fabric index doesn’t match the + // CreatorFabricIndex in the user record pointed to by UserIndex + if (user.createdBy != modifierFabricIdx) + { + ChipLogProgress(Zcl, + "[createCredential] Unable to modify credential for user created by different fabric " + "[endpointId=%d,userIndex=%d,creatorIdx=%d,fabricIdx=%d]", + endpointId, userIndex, user.createdBy, modifierFabricIdx); + return DlStatus::kInvalidField; + } + for (size_t i = 0; i < user.credentials.size(); ++i) { // appclusters, 5.2.4.40: user should already be associated with given credential diff --git a/src/app/tests/suites/DL_UsersAndCredentials.yaml b/src/app/tests/suites/DL_UsersAndCredentials.yaml index 5030145412db2f..6edbef1d645aa9 100644 --- a/src/app/tests/suites/DL_UsersAndCredentials.yaml +++ b/src/app/tests/suites/DL_UsersAndCredentials.yaml @@ -18,6 +18,18 @@ config: nodeId: 0x12344321 cluster: "Door Lock" endpoint: 1 + payload: + type: char_string + defaultValue: "MT:-24J0AFN00KA0648G00" + discriminator: + type: int16u + defaultValue: 3840 + waitAfterCommissioning: + type: int16u + defaultValue: 1000 + PakeVerifier: + type: octet_string + defaultValue: "hex:b96170aae803346884724fe9a3b287c30330c2a660375d17bb205a8cf1aecb350457f8ab79ee253ab6a8e46bb09e543ae422736de501e3db37d441fe344920d09548e4c18240630c4ff4913c53513839b7c07fcc0627a1b8573a149fcd1fa466cf" tests: - label: "Wait for the commissioned device to be retrieved" @@ -64,6 +76,57 @@ tests: saveAs: NumberOfTotalUsersSupportedValue value: 10 + # + # Commission to second fabric to facilitate testing SetCredential/SetUser fabric restrictions + # + - label: "Open Commissioning Window from alpha" + endpoint: 0 + cluster: "Administrator Commissioning" + command: "OpenCommissioningWindow" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "CommissioningTimeout" + value: 180 + - name: "PAKEPasscodeVerifier" + value: PakeVerifier + - name: "Discriminator" + value: discriminator + - name: "Iterations" + value: 1000 + - name: "Salt" + value: "SPAKE2P Key Salt" + + - label: "Waiting after opening commissioning window" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: waitAfterCommissioning + + - label: "Commission from TH2" + identity: "beta" + endpoint: 0 + cluster: "CommissionerCommands" + command: "PairWithCode" + arguments: + values: + - name: "nodeId" + value: nodeId + - name: "payload" + value: payload + + - label: "Wait for the commissioned device to be retrieved for TH2" + endpoint: 0 + identity: beta + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + - label: "Read fails for user with index 0" command: "GetUser" arguments: @@ -448,6 +511,136 @@ tests: - name: "NextUserIndex" value: null + - label: + "Modify UserStatus, UserType, CredentialRule for existing user from + different fabric" + command: "SetUser" + identity: "beta" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "OperationType" + value: 2 + - name: "UserIndex" + value: 1 + - name: "UserName" + value: null + - name: "UserUniqueID" + value: null + - name: "UserStatus" + value: 3 + - name: "UserType" + value: 6 + - name: "CredentialRule" + value: 2 + + - label: "Read the modified user back and verify its fields" + command: "GetUser" + arguments: + values: + - name: "UserIndex" + value: 1 + response: + values: + - name: "UserIndex" + value: 1 + - name: "UserName" + value: "test_user" + - name: "UserUniqueID" + value: 0x1BCDA0A0 + - name: "UserStatus" + value: 3 + - name: "UserType" + value: 6 + - name: "CredentialRule" + value: 2 + - name: "Credentials" + value: [] + - name: "CreatorFabricIndex" + value: 1 + - name: "LastModifiedFabricIndex" + value: 2 + - name: "NextUserIndex" + value: null + + - label: + "Attempt to modify UserName for existing user from different fabric" + command: "SetUser" + identity: "beta" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "OperationType" + value: 2 + - name: "UserIndex" + value: 1 + - name: "UserName" + value: "test_fab2" + - name: "UserUniqueID" + value: null + - name: "UserStatus" + value: null + - name: "UserType" + value: null + - name: "CredentialRule" + value: null + response: + error: INVALID_COMMAND + + - label: + "Attempt to modify userUniqueId for existing user from different + fabric" + command: "SetUser" + identity: "beta" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "OperationType" + value: 2 + - name: "UserIndex" + value: 1 + - name: "UserName" + value: null + - name: "UserUniqueID" + value: 0x1234ABCD + - name: "UserStatus" + value: null + - name: "UserType" + value: null + - name: "CredentialRule" + value: null + response: + error: INVALID_COMMAND + + - label: "Read the modified user back and verify its fields" + command: "GetUser" + arguments: + values: + - name: "UserIndex" + value: 1 + response: + values: + - name: "UserIndex" + value: 1 + - name: "UserName" + value: "test_user" + - name: "UserUniqueID" + value: 0x1BCDA0A0 + - name: "UserStatus" + value: 3 + - name: "UserType" + value: 6 + - name: "CredentialRule" + value: 2 + - name: "Credentials" + value: [] + - name: "CreatorFabricIndex" + value: 1 + - name: "LastModifiedFabricIndex" + value: 2 + - name: "NextUserIndex" + value: null + - label: "Add another user with non-default fields" command: "SetUser" timedInteractionTimeoutMs: 10000 @@ -1327,6 +1520,83 @@ tests: - name: "NextCredentialIndex" value: 2 + - label: + "Attempt to create new RFID credential from different fabric and add + it to existing user" + command: "SetCredential" + identity: "beta" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "OperationType" + value: 0 + - name: "Credential" + value: { CredentialType: 2, CredentialIndex: 1 } + - name: "CredentialData" + value: "rfid_data_123456" + - name: "UserIndex" + value: 1 + - name: "UserStatus" + value: null + - name: "UserType" + value: null + response: + values: + - name: "Status" + value: 0x85 + - name: "UserIndex" + value: null + - name: "NextCredentialIndex" + value: 2 + + - label: "Verify user has not been modified" + command: "GetUser" + arguments: + values: + - name: "UserIndex" + value: 1 + response: + values: + - name: "UserIndex" + value: 1 + - name: "UserName" + value: "" + - name: "UserUniqueID" + value: null + - name: "UserStatus" + value: 1 + - name: "UserType" + value: 0 + - name: "CredentialRule" + value: 0 + - name: "Credentials" + value: [{ CredentialType: 1, CredentialIndex: 1 }] + - name: "CreatorFabricIndex" + value: 1 + - name: "LastModifiedFabricIndex" + value: 1 + - name: "NextUserIndex" + value: null + + - label: "Verify no credential has been created" + command: "GetCredentialStatus" + arguments: + values: + - name: "Credential" + value: { CredentialType: 2, CredentialIndex: 1 } + response: + values: + - name: "CredentialExists" + value: false + - name: "UserIndex" + value: null + - name: "CreatorFabricIndex" + value: null + - name: "LastModifiedFabricIndex" + value: null + - name: "NextCredentialIndex" + value: null + - label: "Create new RFID credential and add it to existing user" command: "SetCredential" timedInteractionTimeoutMs: 10000 @@ -1405,6 +1675,63 @@ tests: - name: "NextCredentialIndex" value: null + - label: + "Attempt to modify credentialData of existing RFID credential from + different fabric" + command: "SetCredential" + identity: "beta" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "OperationType" + value: 2 + - name: "Credential" + value: { CredentialType: 2, CredentialIndex: 1 } + - name: "CredentialData" + value: "rfid_data_654321" + - name: "UserIndex" + value: 1 + - name: "UserStatus" + value: null + - name: "UserType" + value: null + response: + values: + - name: "Status" + value: 0x85 + - name: "UserIndex" + value: null + - name: "NextCredentialIndex" + value: 2 + + - label: + "Verify that credential was not changed by attempting to create new + credential with unmodified data" + command: "SetCredential" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "OperationType" + value: 0 + - name: "Credential" + value: { CredentialType: 2, CredentialIndex: 2 } + - name: "CredentialData" + value: "rfid_data_123456" + - name: "UserIndex" + value: null + - name: "UserStatus" + value: null + - name: "UserType" + value: null + response: + values: + - name: "Status" + value: 0x02 + - name: "UserIndex" + value: null + - name: "NextCredentialIndex" + value: 3 + - label: "Create new RFID credential and user with index 0 fails" command: "SetCredential" timedInteractionTimeoutMs: 10000 @@ -2054,10 +2381,10 @@ tests: - label: "Make sure a LockUserChange event was generated" command: "readEvent" event: "LockUserChange" - # I wish there were a way to not hardcode this 25, but it's experimentally - # determined: doing a read without an eventNumber filter here shows 24 + # I wish there were a way to not hardcode this 27, but it's experimentally + # determined: doing a read without an eventNumber filter here shows 26 # LockUserChange events before this removal. - eventNumber: 25 + eventNumber: 27 response: value: { From 5e37f1efdded50a0d926947d1381d70ccf26389d Mon Sep 17 00:00:00 2001 From: Marius Tache <102153746+marius-alex-tache@users.noreply.github.com> Date: Thu, 15 Aug 2024 17:25:33 +0300 Subject: [PATCH 29/59] [NXP][k32w1] Rework reference apps (#34926) * [NXP][platform][common] Update pw RPC flag in streamer_nxp Signed-off-by: marius-alex-tache (cherry picked from commit 4ae033a1bddd5d914e862791c111eebca41a62e8) * [NXP][examples][common] Fix binding issue due to generated Zap flag renaming Signed-off-by: Martin Girardot (cherry picked from commit b50b382478138ad02103e55194b0145b1e61e841) * [NXP][examples][common] make-pretty update (cherry picked from commit efc51cc65471f4f5f667947ef18a4656e1d29578) * [NXP][examples][common] Fix contact-sensor-app always returning empty diagnostic logs The LogProvider class method GetSizeForIntent() was always returning zero as log size due to an incorrect evaluation of the result of the SyncGetValue() call. GetSizeForIntent() is evaluating the size of the diagnostic log by trying to read the key using a zero length buffer. This action will return the size of the key in storage, but it will also yield a CHIP_ERROR_BUFFER_TOO_SMALL error code. GetSizeForIntent() however was not expecting this error code and it was returning zero in all situations when the status returned by SyncGetValue() was anything else but CHIP_NO_ERROR. The function was updated to take into account that, under these circumstances, the SyncGetValue() function always returns CHIP_ERROR_BUFFER_TOO_SMALL. Signed-off-by: Marian Chereji Reviewed-by: Doru-Cristian Gucea (cherry picked from commit dd3b3b784318f73cf6f0390f79d1fdf0160169d3) * [NXP][examples][common] Call init using the base class reference Signed-off-by: marius-alex-tache (cherry picked from commit b7a0a0a4d88bd5d03b70f36b34c2475b614bd296) * [NXP][examples][common] Update app task common code New task base API: - PostEventsProcessedAction - this will be called in the main loop, after all events have been processed. An example of concrete action is to animate some LEDs. - PrintOnboardingInfo - the default implementation remains the same. It can be overwritten by the concrete application task class. - AppMatter_DisallowDeviceToSleep/AppMatter_AllowDeviceToSleep - An application that uses low power mode should overwrite the API to implement the allow/disallow entering low power mechanism. Before taking the OT mutex, the device is disallowed to enter low power. The device is allowed to enter low power after the OT mutex is released. Other changes: - The app event queue handle should be static such that the concrete application task can initialize it during Start() call. - The ticksToWait passed to xQueueReceived is used to specify the maximum amount of time the task should block waiting for an event. This can be modified according to the application needs, e.g. is needed by an application that has LED animation. - PostEvent should take into account ISR context when populating the event queue. - PostEvent becomes a static method. - Thread device type is specified by the following flag: CONFIG_THREAD_DEVICE_TYPE This is set by default to kThreadDeviceType_Router. Signed-off-by: marius-alex-tache (cherry picked from commit d88e78ea6c973eb736915110bb227ad3515eec98) * [NXP][examples][common] Add additional common components - Add led widget component - Add diagnostic logs component - chip::NXP::App::DiagnosticLogsDemo::DisplayUsage should be implemeneted to showcase how the diagnostic logs provider should be used. - Add low power component - chip::NXP::App::LowPower::Init should be implemented according to the application needs. A default example is implemented, which registers an empty enter/exit low power callback. - Add operational keystore component - the API contains two functions: - GetInstance - should return the address of a concrete operational keystore class - Init - can be used to register a persistent storage delegate in case the concrete class is using persistent storage (which will be our case) - Add user interface feedback component - this component defines an abstract interface that can be implemented by applications in order to provide some kind of feedback to the user in certain conditions: logging, LED animations, etc. Add example of lighting manager, which uses LED animation for user feedback. - Add clusters component - add an API for identify related callbacks. Add implementation for common MatterPostAttributeChangeCallback, which delegates the work to the device manager component. - Add RPC component - this is a simple Init API that can be used to initialize PW RPC related components, such as UART. Signed-off-by: marius-alex-tache (cherry picked from commit 46a1d3d673b9cae14d33c749e3741727449e6ff9) * [NXP][examples][common] Add missing header in Identify Signed-off-by: marius-alex-tache (cherry picked from commit 3abfee2c6eea327ae931a150733ac83639d157d5) * [NXP][examples][common] Add multi-image OTA requestor initiator Signed-off-by: marius-alex-tache (cherry picked from commit 5848e4d4e2d384c4bfe41714bd41e25c4b1ba1e8) * [NXP][examples][common] Update pw RPC implementation Update AppRpc API by adding two new methods used by the common RPC implementation: - ButtonHandler - Reboot Signed-off-by: marius-alex-tache (cherry picked from commit 5e40934145825c61444e43e479ed7ac5c26605a4) * [NXP][examples][common] Small updates to common app code - Add call to feedback manager init. - Remove PostEventsProcessedAction. Call FeedbackMgr().DisplayInLoop() directly in the main loop. - Move PostEvent in AppTaskBase interface and make it virtual. - Add demo of diagnostic logs usage. - Update PrintOnboardingInfo to take into account user action requried commissioning flow. - Remove usage of deprecated sFunction from Lighting manager. - Add LowPower::Init call. - If FSL_OSA_TASK_ENABLE is used, then call AppTaskMain inside Start, instead of creating the app task. - Add PrintCurrentVersion API to print the software version string and software version. - Enclose DeviceInfoProviderImpl usage based on CONFIG_DEVICE_INFO_PROVIDER_IMPL - Add diagnostic logs cluster init under the corresponding flag. Signed-off-by: marius-alex-tache (cherry picked from commit 1619c92380275dc0466f9cf9dc9e818671406b06) * [NXP][examples][common] Make Animate pure virtual Signed-off-by: marius-alex-tache (cherry picked from commit eaf3789fc2d1e562fe030acc758e5f322b5f02d3) * [NXP][examples][common] Add pw RPC init RPC_TASK_STACK_SIZE and RPC_TASK_PRIORITY can now be defined in the build system to override the default values. Signed-off-by: marius-alex-tache (cherry picked from commit 7962d612b14502dc3f514c5c3d39891b086cfd63) * [NXP][examples][common] Allow platforms to redefine the path to the FactoryDataProvider.h that needs to be included Signed-off-by: Dina Benamar (cherry picked from commit 097cd999c4767572f8cc55fac18f93ac3cb5d50c) * [NXP][examples][common] Add TestEventTriggerDelegate * TestEventTriggerDelegate is now used at Server Initialization to add the ICDManager instance as Handler Signed-off-by: Andrei Menzopol (cherry picked from commit edce1dc967130589e74cdd9c8289719171141178) * [NXP][examples][common] Minor updates for some components The KVS wear stats are stored in the user diagnostic log key hence only initialize this key if the KVS wear stats are not enabled. Signed-off-by: Marian Chereji [nxp noup][examples][common] Remove UpdateState API The interface can be simplified by calling RestoreState instead of UpdateState when needed. This implies that the caller must update the cluster attribute by itself. Signed-off-by: marius-alex-tache [nxp noup][examples][common] Rename LightingManager to LedManager Signed-off-by: marius-alex-tache * [NXP][examples][common] Add initial version of lighting app - Copy lighting app sources to common folder - Add device callbacks - Use common OTA support - Use common app factory data - Use led widgets for lighting app - Use common app task and button management - Decouple lighting manager from app task - Update LED status function - Update lighting manager related flags Flags: - LIGHTING_MANAGER_ENABLE_DIMMABLE_LED to enable dimmable LED feature - LIGHTING_MANAGER_ENABLE_STATUS_LED to enable status LED usage These flags can be overwritten in AppConfig.h. - Make lighting manager more configurable - Create button manager The ButtonManager class should define the buttons callbacks and all callback delegates. Moved AppMatterButton_registerButtons implementation inside the button manager source file. - Update lighting manager interface - Replace lighting manager calls with feedback manager LightingManager now implements the UserFeedbackInterface abstract class and the dimmable feature was moved to a new class: LightingManagerDimmable. - Move identify code in a separate file - Remove deprecated #include statements from all files. - Add commissioning complete state A boolean static member is added to AppTask. It is set when the kCommissioningComplete event is received. It should be used by other components if they need a way to check the state of the device. - Add button action to switch to ICD active mode - Add support for BooleanState in device callbacks - Add diagnostic logs usage demo - Enclose feedback manager calls in CONFIG_ENABLE_FEEDBACK flag This flag should be defined whenever the application must provide some kind of user interface feedback, such as LED animation. In case of low power, this flag will not be defined. - Remove unused features (e.g. diagnostic logs) - Overwrite event queue and ticks to wait - Call PlatformMgrImpl API for PreInitMatterStack actions - Replace PW_RPC_ENABLED with CONFIG_ENABLE_PW_RPC Signed-off-by: marius-alex-tache (cherry picked from commit bed6655227d44900279cbd0ef547771da9143895) * [NXP][examples][common] Add initial version of contact sensor Signed-off-by: marius-alex-tache (cherry picked from commit 637580aa6c63048ae1a956807c284165c2af17ed) * [NXP][openthread][k32w1] Update mbedtls target Signed-off-by: marius-alex-tache (cherry picked from commit 3c84b1fd3987958bc0dcf49a283c281e48b400f8) * [NXP][platform][k32w] OTA/FactoryData changes * Add FactoryDataDriver interface which handles factory data update functionality and factory data ram backup operations; must be implemented for each platform * Make FactoryDataProvider global instances * Move Restore mechanism and plain-text SignWithDacKey in common FactoryDataProvider * Adapt Validate and SearchForId to use factory data config which stores size, start, payload * Move OTAFactoryDataProcessor in common folder * Adapt to be generic and use FactoryDataDriver functions instead Signed-off-by: Andrei Menzopol (cherry picked from commit 3a81c2367013c2a2ed08ecbbeac89ce15943998e) * [NXP][platform][k32w1] SDK 2.15 platform updates * remove RNG_SetPseudoRandomNoSeed call to accomodate new RNG API changes. * add SDK root, SDK release, and SDK 2.15 gn arguments. They will be used to differentiate between SDK versions (2.12 vs 2.15) and release status (repo vs packages). Signed-off-by: Andrei Menzopol [nxp noup][platform][k32w] Small fixes for k32w platform code * correct typos * remove executable access permissions * remove unused files * change openthread_root to ot-nxp/openthread-k32w1 * use nxp_mbedtls gn target Signed-off-by: Andrei Menzopol (cherry picked from commit 1905c1cea645506f8a88e514c2eacecea81ac385) * [NXP][platform][k32w1] Add "chip_key_storage" solution selector and littlefs support Updated the K32W1 platform build files by adding the "chip_key_storage" selector which will help developers select an implementation option for the key storage between "littlefs" and "fwk_nvm". Signed-off-by: Marian Chereji [nxp noup][k32w1] Temporarily disable OpenThread settings save-on-idle when using LittleFS key storage When using LittleFS key storage, the OpenThread settings save-on-idle feature requires additional support in the application idle task, which is not yet available. In order for the OT settings saving to work at this stage and in this configuration, the save-on-idle feature must be disabled until the required idle task support will be implemented. Signed-off-by: Marian Chereji [nxp noup][platform][k32w1] Fix minimum data chunk size required when programming the flash memory According to the specifications, the internal flash memory of the K32W1 platform supports programming chunks of memory which are 128 bytes long (instead of 256). Signed-off-by: Marian Chereji [nxp noup][platform][k32w1] Increase LittleFS cache size to 1K to suppress frequent data synchronizations A small cache size forces LittleFS to perform frequent data synchronizations with the storage (flash memory) and this consumes a number of data blocks which are not available in the K32W1 Matter applications. To reduce the fast consumption of flash memory data blocks, the LittleFS cache size was increased to 1KB. Signed-off-by: Marian Chereji (cherry picked from commit 753f7d7390661bd5dbd29cc9cfa7d3a4e4728ba2) * [NXP][platform][k32w1] Add Zephyr NVS based key storage build option Added a new build option (chip_key_storage="nvs") which allows the developers to use the Zephyr NVS file system as a key storage solution. Signed-off-by: Marian Chereji (cherry picked from commit 1d42e48d8f50f6e9999b49025ea3d71545e89a3d) * [NXP][examples][k32w1] App updates * the sdk root was moved to platform args. * update readme files * Add CONNECTIVITY_MANAGER_THREAD_DEVICE_TYPE define. * Set define accordingly based on FTD/MTD configuration. * Solve issue when lighting-app is MTD but device type is set to Router because it was hardcoded. * Remove deprecated files * Move some headers in examples/platform for common usage Signed-off-by: Andrei Menzopol (cherry picked from commit c2b626df132e058ce674df0ee20965b3029c462d) * [NXP][examples][k32w1] Update ZclCallbacks after transition to common code Signed-off-by: marius-alex-tache * [NXP][k32w1] Remove k32w parent folder Signed-off-by: marius-alex-tache * [NXP][platform][k32w1] Add FactoryDataDriver implementation Signed-off-by: marius-alex-tache * [NXP][platform][k32w] Remove k32w/common This folder was moved to nxp/common/legacy area. Signed-off-by: marius-alex-tache (cherry picked from commit 755081c71bde287e2d065e5fd9b1a0922c3b341a) * [NXP][scripts] Minor updates for NXP related scripts Add HWParams APP FactoryData support * Add proper format for HWParameters app factory data section * Put changes under new argument Signed-off-by: Andrei Menzopol [nxp noup][scripts][common] Fix Crc16 attribute when using latest version Signed-off-by: marius-alex-tache [nxp noup][scripts] Update structure k32w1 path All k32w1 folders were moved under nxp, removing the k32w parent. Signed-off-by: marius-alex-tache [nxp noup][scripts][ota] Update paths after k32w transition Signed-off-by: marius-alex-tache (cherry picked from commit 4963ce98725b74e94f498f959d46edf4933fa56c) * [NXP][platform][common] Add nxp_factory_data, nxp_ota gn targets The application can use these targets to integrate the default, platform-specific NXP factory data provider and OTA implementation. Each platform should define an "nxp_factory_data" and "nxp_ota" source sets. Usage: deps += [ "${chip_root}/src/platform/nxp:nxp_factory_data" ] deps += [ "${chip_root}/src/platform/nxp:nxp_ota" ] Signed-off-by: marius-alex-tache (cherry picked from commit 4869c4a97134692fe87a59b9b69d33f836d9b2e9) * [NXP][platform][common] Create NXPConfigNVS.cpp file, remove NXPConfig BLE dependencies Signed-off-by: Martin Girardot (cherry picked from commit 50e14e4a1b9f8561126310e19ebbaf72ca7bbdbe) * [NXP] revert mcxw71 headers Signed-off-by: marius-alex-tache * [NXP][k32w1] Add default logging target Signed-off-by: marius-alex-tache * [NXP][k32w1] Update paths to reference nxp_matter_support Signed-off-by: marius-alex-tache * [NXP] Bump nxp_matter_support Signed-off-by: marius-alex-tache * Restyled by whitespace * Restyled by clang-format * Restyled by gn * Restyled by prettier-markdown * Restyled by autopep8 * Restyled by isort * [NXP][k32w1] Fix gn import order Signed-off-by: marius-alex-tache * [NXP][k32w1] Fix wrong README reference Signed-off-by: marius-alex-tache * [NXP][k32w1] Update workflow docker image Signed-off-by: marius-alex-tache * [NXP][rw61x] Adding nxp_ota and nxp_factory_data as they are now mandatory Signed-off-by: Gatien Chapon * [NXP][platform][common] Fix build warning (cherry picked from commit 72b1cbaaf36fe6cf2af57a8c7ad3cc457b45c713) * Restyled by gn * [NXP][platform] Remove deprecated files Signed-off-by: marius-alex-tache * [NXP][workflow] Create separate jobs for k32w0/k32w1 k32w0 builds use chip-build-k32w Docker image, but k32w1 builds use chip-build-nxp Docker image. Signed-off-by: marius-alex-tache * [NXP][k32w0] Adding nxp_ota and nxp_factory_data as they are now mandatory Signed-off-by: marius-alex-tache * [NXP][scripts] Fix script issue when there is no --args Signed-off-by: Martin Girardot * [NXP][k32w1] Disable SMU2 Signed-off-by: marius-alex-tache --------- Signed-off-by: marius-alex-tache Signed-off-by: Gatien Chapon Signed-off-by: Martin Girardot Co-authored-by: Martin Girardot Co-authored-by: Dina Benamar Co-authored-by: Marian Chereji Co-authored-by: Andrei Menzopol Co-authored-by: Restyled.io Co-authored-by: Gatien Chapon Co-authored-by: Yassine El Aissaoui --- .github/workflows/examples-nxp.yaml | 64 +- .../contact-sensor-app/nxp/common/AppTask.cpp | 53 + .../nxp/common/DeviceCallbacks.cpp | 69 + .../nxp/common/ZclCallbacks.cpp | 38 + .../nxp/common/include/AppEvent.h | 18 +- .../nxp/common/include/AppTask.h | 50 + .../nxp/common/include/DeviceCallbacks.h | 51 + .../contact-sensor-app/nxp/common/main.cpp | 39 + .../nxp/k32w/k32w1/BUILD.gn | 186 --- .../nxp/k32w/k32w1/build_overrides | 1 - .../nxp/k32w/k32w1/main/AppTask.cpp | 908 ----------- .../k32w/k32w1/main/ContactSensorManager.cpp | 84 - .../nxp/k32w/k32w1/main/ZclCallbacks.cpp | 113 -- .../nxp/k32w/k32w1/main/include/AppEvent.h | 63 - .../nxp/k32w/k32w1/main/include/AppTask.h | 144 -- .../k32w1/main/include/ContactSensorManager.h | 66 - .../nxp/k32w/k32w1/main/include/app_config.h | 52 - .../nxp/k32w/k32w1/main/main.cpp | 143 -- .../k32w/k32w1/third_party/connectedhomeip | 1 - .../nxp/{k32w => }/k32w1/.gn | 2 +- .../contact-sensor-app/nxp/k32w1/BUILD.gn | 261 +++ .../nxp/{k32w => }/k32w1/README.md | 132 +- .../nxp/{k32w => }/k32w1/args.gni | 7 +- .../nxp/k32w1/build_overrides | 1 + .../nxp/k32w1/include/config/AppConfig.h | 29 + .../include/config}/CHIPProjectConfig.h | 7 + .../nxp/k32w1/third_party/connectedhomeip | 1 + examples/lighting-app/nxp/common/AppTask.cpp | 37 + .../DeviceCallbacks.cpp} | 55 +- .../nxp/common/include/AppEvent.h | 19 +- .../lighting-app/nxp/common/include/AppTask.h | 46 + .../nxp/common/include/DeviceCallbacks.h | 51 + examples/lighting-app/nxp/common/main.cpp | 39 + examples/lighting-app/nxp/k32w/k32w1/BUILD.gn | 196 --- .../nxp/k32w/k32w1/build_overrides | 1 - .../nxp/k32w/k32w1/include/FreeRTOSConfig.h | 181 --- .../nxp/k32w/k32w1/main/AppTask.cpp | 932 ----------- .../nxp/k32w/k32w1/main/LightingManager.cpp | 121 -- .../nxp/k32w/k32w1/main/include/AppEvent.h | 57 - .../nxp/k32w/k32w1/main/include/AppTask.h | 126 -- .../k32w/k32w1/main/include/LightingManager.h | 74 - .../nxp/k32w/k32w1/main/include/app_config.h | 49 - .../lighting-app/nxp/k32w/k32w1/main/main.cpp | 156 -- .../k32w/k32w1/third_party/connectedhomeip | 1 - .../lighting-app/nxp/{k32w => }/k32w1/.gn | 2 +- examples/lighting-app/nxp/k32w1/BUILD.gn | 268 +++ .../nxp/{k32w => }/k32w1/README.md | 159 +- .../nxp/{k32w => }/k32w1/args.gni | 11 +- .../lighting-app/nxp/k32w1/build_overrides | 1 + .../nxp/k32w1/include/config/AppConfig.h | 29 + .../include/config}/CHIPProjectConfig.h | 0 .../nxp/k32w1/third_party/connectedhomeip | 1 + .../nxp/{k32w => }/k32w1/with_pw_rpc.gni | 18 +- examples/platform/nxp/Rpc.cpp | 12 +- .../nxp/common/app_task/include/AppTaskBase.h | 49 +- .../common/app_task/include/AppTaskFreeRTOS.h | 24 +- .../common/app_task/include/AppTaskZephyr.h | 12 +- .../common/app_task/source/AppTaskBase.cpp | 127 +- .../app_task/source/AppTaskFreeRTOS.cpp | 75 +- .../nxp/common/clusters/include/Identify.h | 31 + .../common/clusters/source/ZclCallbacks.cpp | 52 + .../source/CommonDeviceCallbacks.cpp | 1 - .../include/DiagnosticLogsDemo.h | 31 + .../DiagnosticLogsProviderDelegateImpl.h | 0 .../source/DiagnosticLogsDemo.cpp | 47 + .../DiagnosticLogsProviderDelegateImpl.cpp | 2 +- .../source/AppFactoryDataDefaultImpl.cpp | 7 +- .../nxp/common/led_widget/include/LedDimmer.h | 37 + .../nxp/common/led_widget/include/LedOnOff.h | 47 + .../led_widget/include/LedWidgetInterface.h} | 43 +- .../nxp/common/low_power/include/LowPower.h | 32 + .../nxp/common/low_power/source/LowPower.cpp | 48 + .../include/OperationalKeystore.h | 41 + .../source/OperationalKeystoreEmpty.cpp | 31 + .../OTARequestorInitiatorMultiImage.cpp | 43 + .../platform/nxp/common/rpc/include/AppRpc.h | 56 + .../common/ui_feedback/include/LedManager.h | 91 ++ .../include/UserInterfaceFeedback.h | 72 + .../common/ui_feedback/source/LedManager.cpp | 150 ++ examples/platform/nxp/k32w/k32w1/BUILD.gn | 35 - examples/platform/nxp/k32w/k32w1/app/BUILD.gn | 27 - examples/platform/nxp/k32w/k32w1/app/args.gni | 28 - examples/platform/nxp/k32w/k32w1/args.gni | 38 - .../k32w1/app/ldscripts/k32w1_app.ld | 0 .../freeRTOS}/FreeRTOSConfig.h | 5 - .../openthread}/OpenThreadConfig.h | 0 .../nxp/{k32w => }/k32w1/app/support/BUILD.gn | 16 +- .../k32w1/app/support/FreeRtosHooks.c | 8 +- .../k32w1/app/support/FreeRtosHooks.h | 0 .../k32w1/app/support/Memconfig.cpp | 0 .../platform/nxp/k32w1/board/peripherals.c | 66 + .../platform/nxp/k32w1/board/peripherals.h | 101 ++ .../nxp/k32w1/button/ButtonManager.cpp | 215 +++ .../platform/nxp/k32w1/button/ButtonManager.h | 108 ++ .../platform/nxp/k32w1/clusters/Identify.cpp | 123 ++ .../k32w1/doc/images/debug_k32w1.jpg | Bin .../k32w1/doc/images/import_demo.jpg | Bin .../k32w1/doc/images/installed_sdks.jpg | Bin .../{k32w => }/k32w1/doc/images/k32w1-evk.jpg | Bin .../k32w1/doc/images/mcux-sdk-download.jpg | Bin .../k32w1/doc/images/new_project.jpg | Bin .../k32w1/doc/images/ota_topology.JPG | Bin .../source/AppFactoryDataExample.cpp | 76 + .../OperationalKeystore.cpp | 34 + .../LED_Dimmer.h => k32w1/ota/OtaUtils.cpp} | 11 +- examples/platform/nxp/k32w1/rpc/AppRpc.cpp | 75 + .../util/LedDimmer.cpp} | 18 +- .../LEDWidget.cpp => k32w1/util/LedOnOff.cpp} | 70 +- .../k32w1/util/LightingManagerDimmable.cpp | 79 + .../nxp/k32w1/util/LightingManagerDimmable.h | 85 + examples/platform/nxp/pw_rpc_server.gni | 1 + scripts/build/builders/nxp.py | 5 +- .../nxp/factory_data_generator/generate.py | 12 + scripts/tools/nxp/ota/README.md | 2 +- src/lib/shell/streamer_nxp.cpp | 4 +- src/platform/nxp/BUILD.gn | 17 +- src/platform/nxp/common/NXPConfig.cpp | 3 +- src/platform/nxp/common/NXPConfig.h | 3 +- src/platform/nxp/common/NXPConfigKS.cpp | 3 +- src/platform/nxp/common/NXPConfigNVS.cpp | 347 ++++ .../nxp/k32w/common/BLEManagerCommon.cpp | 1435 ----------------- .../nxp/k32w/common/BLEManagerCommon.h | 249 --- .../CHIPDevicePlatformRamStorageConfig.h | 173 -- .../nxp/k32w/common/FactoryDataProvider.cpp | 368 ----- .../nxp/k32w/common/FactoryDataProvider.h | 151 -- .../nxp/k32w/common/K32W_OTA_README.md | 149 -- .../nxp/k32w/common/OTAImageProcessorImpl.cpp | 424 ----- .../nxp/k32w/common/OTAImageProcessorImpl.h | 114 -- .../nxp/k32w/common/OTATlvProcessor.cpp | 178 -- .../nxp/k32w/common/OTATlvProcessor.h | 180 --- src/platform/nxp/k32w/k32w1/BUILD.gn | 153 -- .../k32w/k32w1/SoftwareUpdateManagerImpl.cpp | 46 - .../k32w/k32w1/SoftwareUpdateManagerImpl.h | 89 - src/platform/nxp/k32w0/BUILD.gn | 5 + .../nxp/{k32w => }/k32w1/BLEManagerImpl.cpp | 3 +- .../nxp/{k32w => }/k32w1/BLEManagerImpl.h | 2 +- src/platform/nxp/k32w1/BUILD.gn | 211 +++ .../nxp/{k32w => }/k32w1/BlePlatformConfig.h | 0 .../{k32w => }/k32w1/CHIPCryptoPalK32W1.cpp | 0 .../k32w1/CHIPDevicePlatformConfig.h | 10 + .../k32w1/CHIPDevicePlatformEvent.h | 0 .../nxp/{k32w => }/k32w1/CHIPPlatformConfig.h | 0 .../k32w1/ConfigurationManagerImpl.cpp | 51 +- .../k32w1/ConfigurationManagerImpl.h | 8 +- .../k32w1/ConnectivityManagerImpl.cpp | 0 .../k32w1/ConnectivityManagerImpl.h | 0 .../k32w1/DiagnosticDataProviderImpl.cpp | 2 +- .../k32w1/DiagnosticDataProviderImpl.h | 0 .../nxp/k32w1/FactoryDataDriverImpl.cpp | 147 ++ .../nxp/k32w1/FactoryDataDriverImpl.h | 59 + .../k32w1/FactoryDataProviderImpl.cpp | 206 ++- .../k32w1/FactoryDataProviderImpl.h | 29 +- .../nxp/{k32w => }/k32w1/InetPlatformConfig.h | 0 .../nxp/{k32w => }/k32w1/K32W1Config.cpp | 46 +- .../nxp/{k32w => }/k32w1/K32W1Config.h | 2 +- .../K32W1PersistentStorageOpKeystore.cpp | 0 .../k32w1/K32W1PersistentStorageOpKeystore.h | 0 .../k32w1/KeyValueStoreManagerImpl.cpp | 26 +- .../k32w1/KeyValueStoreManagerImpl.h | 0 src/platform/nxp/{k32w => }/k32w1/Logging.cpp | 6 +- .../nxp/{k32w => }/k32w1/LowPowerHooks.cpp | 0 .../{k32w => }/k32w1/OTAFirmwareProcessor.cpp | 4 +- .../{k32w => }/k32w1/OTAFirmwareProcessor.h | 2 +- .../nxp/{k32w => }/k32w1/OTAHooks.cpp | 19 +- .../{k32w => }/k32w1/PlatformManagerImpl.cpp | 39 +- .../{k32w => }/k32w1/PlatformManagerImpl.h | 4 +- .../nxp/{k32w => }/k32w1/SMU2Manager.cpp | 1 + .../nxp/{k32w => }/k32w1/SMU2Manager.h | 0 .../{k32w => }/k32w1/SystemPlatformConfig.h | 0 .../{k32w => }/k32w1/SystemTimeSupport.cpp | 0 .../k32w1/ThreadStackManagerImpl.cpp | 14 +- .../{k32w => }/k32w1/ThreadStackManagerImpl.h | 0 src/platform/nxp/{k32w => }/k32w1/args.gni | 27 +- .../nxp/{k32w => }/k32w1/ble_function_mux.c | 0 .../nxp/{k32w => }/k32w1/ble_function_mux.h | 0 src/platform/nxp/{k32w => }/k32w1/gatt_db.h | 0 .../nxp/{k32w => }/k32w1/gatt_uuid128.h | 0 .../k32w1/k32w1-chip-mbedtls-config.h | 0 .../nxp/{k32w => }/k32w1/ram_storage.c | 0 .../nxp/{k32w => }/k32w1/ram_storage.h | 0 src/platform/nxp/rt/rw61x/BUILD.gn | 5 + third_party/nxp/nxp_matter_support | 2 +- .../platforms/nxp/{k32w => }/k32w1/BUILD.gn | 39 +- 183 files changed, 4708 insertions(+), 7959 deletions(-) create mode 100644 examples/contact-sensor-app/nxp/common/AppTask.cpp create mode 100644 examples/contact-sensor-app/nxp/common/DeviceCallbacks.cpp create mode 100644 examples/contact-sensor-app/nxp/common/ZclCallbacks.cpp rename src/platform/nxp/k32w/k32w1/DefaultTestEventTriggerDelegate.cpp => examples/contact-sensor-app/nxp/common/include/AppEvent.h (62%) create mode 100644 examples/contact-sensor-app/nxp/common/include/AppTask.h create mode 100644 examples/contact-sensor-app/nxp/common/include/DeviceCallbacks.h create mode 100644 examples/contact-sensor-app/nxp/common/main.cpp delete mode 100644 examples/contact-sensor-app/nxp/k32w/k32w1/BUILD.gn delete mode 120000 examples/contact-sensor-app/nxp/k32w/k32w1/build_overrides delete mode 100644 examples/contact-sensor-app/nxp/k32w/k32w1/main/AppTask.cpp delete mode 100644 examples/contact-sensor-app/nxp/k32w/k32w1/main/ContactSensorManager.cpp delete mode 100644 examples/contact-sensor-app/nxp/k32w/k32w1/main/ZclCallbacks.cpp delete mode 100644 examples/contact-sensor-app/nxp/k32w/k32w1/main/include/AppEvent.h delete mode 100644 examples/contact-sensor-app/nxp/k32w/k32w1/main/include/AppTask.h delete mode 100644 examples/contact-sensor-app/nxp/k32w/k32w1/main/include/ContactSensorManager.h delete mode 100644 examples/contact-sensor-app/nxp/k32w/k32w1/main/include/app_config.h delete mode 100644 examples/contact-sensor-app/nxp/k32w/k32w1/main/main.cpp delete mode 120000 examples/contact-sensor-app/nxp/k32w/k32w1/third_party/connectedhomeip rename examples/contact-sensor-app/nxp/{k32w => }/k32w1/.gn (93%) create mode 100644 examples/contact-sensor-app/nxp/k32w1/BUILD.gn rename examples/contact-sensor-app/nxp/{k32w => }/k32w1/README.md (83%) rename examples/contact-sensor-app/nxp/{k32w => }/k32w1/args.gni (84%) create mode 120000 examples/contact-sensor-app/nxp/k32w1/build_overrides create mode 100644 examples/contact-sensor-app/nxp/k32w1/include/config/AppConfig.h rename examples/contact-sensor-app/nxp/{k32w/k32w1/include => k32w1/include/config}/CHIPProjectConfig.h (98%) create mode 120000 examples/contact-sensor-app/nxp/k32w1/third_party/connectedhomeip create mode 100644 examples/lighting-app/nxp/common/AppTask.cpp rename examples/lighting-app/nxp/{k32w/k32w1/main/ZclCallbacks.cpp => common/DeviceCallbacks.cpp} (51%) rename src/platform/nxp/k32w/k32w1/DefaultTestEventTriggerDelegate.h => examples/lighting-app/nxp/common/include/AppEvent.h (60%) create mode 100644 examples/lighting-app/nxp/common/include/AppTask.h create mode 100644 examples/lighting-app/nxp/common/include/DeviceCallbacks.h create mode 100644 examples/lighting-app/nxp/common/main.cpp delete mode 100644 examples/lighting-app/nxp/k32w/k32w1/BUILD.gn delete mode 120000 examples/lighting-app/nxp/k32w/k32w1/build_overrides delete mode 100644 examples/lighting-app/nxp/k32w/k32w1/include/FreeRTOSConfig.h delete mode 100644 examples/lighting-app/nxp/k32w/k32w1/main/AppTask.cpp delete mode 100644 examples/lighting-app/nxp/k32w/k32w1/main/LightingManager.cpp delete mode 100644 examples/lighting-app/nxp/k32w/k32w1/main/include/AppEvent.h delete mode 100644 examples/lighting-app/nxp/k32w/k32w1/main/include/AppTask.h delete mode 100644 examples/lighting-app/nxp/k32w/k32w1/main/include/LightingManager.h delete mode 100644 examples/lighting-app/nxp/k32w/k32w1/main/include/app_config.h delete mode 100644 examples/lighting-app/nxp/k32w/k32w1/main/main.cpp delete mode 120000 examples/lighting-app/nxp/k32w/k32w1/third_party/connectedhomeip rename examples/lighting-app/nxp/{k32w => }/k32w1/.gn (93%) create mode 100644 examples/lighting-app/nxp/k32w1/BUILD.gn rename examples/lighting-app/nxp/{k32w => }/k32w1/README.md (80%) rename examples/lighting-app/nxp/{k32w => }/k32w1/args.gni (74%) create mode 120000 examples/lighting-app/nxp/k32w1/build_overrides create mode 100644 examples/lighting-app/nxp/k32w1/include/config/AppConfig.h rename examples/lighting-app/nxp/{k32w/k32w1/include => k32w1/include/config}/CHIPProjectConfig.h (100%) create mode 120000 examples/lighting-app/nxp/k32w1/third_party/connectedhomeip rename examples/lighting-app/nxp/{k32w => }/k32w1/with_pw_rpc.gni (84%) create mode 100644 examples/platform/nxp/common/clusters/include/Identify.h create mode 100644 examples/platform/nxp/common/clusters/source/ZclCallbacks.cpp create mode 100644 examples/platform/nxp/common/diagnostic_logs/include/DiagnosticLogsDemo.h rename examples/platform/nxp/common/diagnostic_logs/{ => include}/DiagnosticLogsProviderDelegateImpl.h (100%) create mode 100644 examples/platform/nxp/common/diagnostic_logs/source/DiagnosticLogsDemo.cpp rename examples/platform/nxp/common/diagnostic_logs/{ => source}/DiagnosticLogsProviderDelegateImpl.cpp (98%) create mode 100644 examples/platform/nxp/common/led_widget/include/LedDimmer.h create mode 100644 examples/platform/nxp/common/led_widget/include/LedOnOff.h rename examples/platform/nxp/{k32w/k32w1/util/include/LEDWidget.h => common/led_widget/include/LedWidgetInterface.h} (55%) create mode 100644 examples/platform/nxp/common/low_power/include/LowPower.h create mode 100644 examples/platform/nxp/common/low_power/source/LowPower.cpp create mode 100644 examples/platform/nxp/common/operational_keystore/include/OperationalKeystore.h create mode 100644 examples/platform/nxp/common/operational_keystore/source/OperationalKeystoreEmpty.cpp create mode 100644 examples/platform/nxp/common/ota_requestor/source/OTARequestorInitiatorMultiImage.cpp create mode 100644 examples/platform/nxp/common/rpc/include/AppRpc.h create mode 100644 examples/platform/nxp/common/ui_feedback/include/LedManager.h create mode 100644 examples/platform/nxp/common/ui_feedback/include/UserInterfaceFeedback.h create mode 100644 examples/platform/nxp/common/ui_feedback/source/LedManager.cpp delete mode 100644 examples/platform/nxp/k32w/k32w1/BUILD.gn delete mode 100644 examples/platform/nxp/k32w/k32w1/app/BUILD.gn delete mode 100644 examples/platform/nxp/k32w/k32w1/app/args.gni delete mode 100644 examples/platform/nxp/k32w/k32w1/args.gni rename examples/platform/nxp/{k32w => }/k32w1/app/ldscripts/k32w1_app.ld (100%) rename examples/{contact-sensor-app/nxp/k32w/k32w1/include => platform/nxp/k32w1/app/project_include/freeRTOS}/FreeRTOSConfig.h (97%) rename examples/platform/nxp/{k32w/k32w1/app/project_include => k32w1/app/project_include/openthread}/OpenThreadConfig.h (100%) rename examples/platform/nxp/{k32w => }/k32w1/app/support/BUILD.gn (78%) rename examples/platform/nxp/{k32w => }/k32w1/app/support/FreeRtosHooks.c (96%) rename examples/platform/nxp/{k32w => }/k32w1/app/support/FreeRtosHooks.h (100%) rename examples/platform/nxp/{k32w => }/k32w1/app/support/Memconfig.cpp (100%) create mode 100644 examples/platform/nxp/k32w1/board/peripherals.c create mode 100644 examples/platform/nxp/k32w1/board/peripherals.h create mode 100644 examples/platform/nxp/k32w1/button/ButtonManager.cpp create mode 100644 examples/platform/nxp/k32w1/button/ButtonManager.h create mode 100644 examples/platform/nxp/k32w1/clusters/Identify.cpp rename examples/platform/nxp/{k32w => }/k32w1/doc/images/debug_k32w1.jpg (100%) rename examples/platform/nxp/{k32w => }/k32w1/doc/images/import_demo.jpg (100%) rename examples/platform/nxp/{k32w => }/k32w1/doc/images/installed_sdks.jpg (100%) rename examples/platform/nxp/{k32w => }/k32w1/doc/images/k32w1-evk.jpg (100%) rename examples/platform/nxp/{k32w => }/k32w1/doc/images/mcux-sdk-download.jpg (100%) rename examples/platform/nxp/{k32w => }/k32w1/doc/images/new_project.jpg (100%) rename examples/platform/nxp/{k32w => }/k32w1/doc/images/ota_topology.JPG (100%) create mode 100644 examples/platform/nxp/k32w1/factory_data/source/AppFactoryDataExample.cpp create mode 100644 examples/platform/nxp/k32w1/operational_keystore/OperationalKeystore.cpp rename examples/platform/nxp/{k32w/k32w1/util/include/LED_Dimmer.h => k32w1/ota/OtaUtils.cpp} (81%) create mode 100644 examples/platform/nxp/k32w1/rpc/AppRpc.cpp rename examples/platform/nxp/{k32w/k32w1/util/LED_Dimmer.cpp => k32w1/util/LedDimmer.cpp} (97%) rename examples/platform/nxp/{k32w/k32w1/util/LEDWidget.cpp => k32w1/util/LedOnOff.cpp} (53%) create mode 100644 examples/platform/nxp/k32w1/util/LightingManagerDimmable.cpp create mode 100644 examples/platform/nxp/k32w1/util/LightingManagerDimmable.h create mode 100644 src/platform/nxp/common/NXPConfigNVS.cpp delete mode 100644 src/platform/nxp/k32w/common/BLEManagerCommon.cpp delete mode 100644 src/platform/nxp/k32w/common/BLEManagerCommon.h delete mode 100644 src/platform/nxp/k32w/common/CHIPDevicePlatformRamStorageConfig.h delete mode 100644 src/platform/nxp/k32w/common/FactoryDataProvider.cpp delete mode 100644 src/platform/nxp/k32w/common/FactoryDataProvider.h delete mode 100644 src/platform/nxp/k32w/common/K32W_OTA_README.md delete mode 100644 src/platform/nxp/k32w/common/OTAImageProcessorImpl.cpp delete mode 100644 src/platform/nxp/k32w/common/OTAImageProcessorImpl.h delete mode 100644 src/platform/nxp/k32w/common/OTATlvProcessor.cpp delete mode 100644 src/platform/nxp/k32w/common/OTATlvProcessor.h delete mode 100644 src/platform/nxp/k32w/k32w1/BUILD.gn delete mode 100644 src/platform/nxp/k32w/k32w1/SoftwareUpdateManagerImpl.cpp delete mode 100644 src/platform/nxp/k32w/k32w1/SoftwareUpdateManagerImpl.h rename src/platform/nxp/{k32w => }/k32w1/BLEManagerImpl.cpp (97%) rename src/platform/nxp/{k32w => }/k32w1/BLEManagerImpl.h (97%) create mode 100644 src/platform/nxp/k32w1/BUILD.gn rename src/platform/nxp/{k32w => }/k32w1/BlePlatformConfig.h (100%) rename src/platform/nxp/{k32w => }/k32w1/CHIPCryptoPalK32W1.cpp (100%) rename src/platform/nxp/{k32w => }/k32w1/CHIPDevicePlatformConfig.h (94%) rename src/platform/nxp/{k32w => }/k32w1/CHIPDevicePlatformEvent.h (100%) rename src/platform/nxp/{k32w => }/k32w1/CHIPPlatformConfig.h (100%) rename src/platform/nxp/{k32w => }/k32w1/ConfigurationManagerImpl.cpp (80%) rename src/platform/nxp/{k32w => }/k32w1/ConfigurationManagerImpl.h (95%) rename src/platform/nxp/{k32w => }/k32w1/ConnectivityManagerImpl.cpp (100%) rename src/platform/nxp/{k32w => }/k32w1/ConnectivityManagerImpl.h (100%) rename src/platform/nxp/{k32w => }/k32w1/DiagnosticDataProviderImpl.cpp (99%) rename src/platform/nxp/{k32w => }/k32w1/DiagnosticDataProviderImpl.h (100%) create mode 100644 src/platform/nxp/k32w1/FactoryDataDriverImpl.cpp create mode 100644 src/platform/nxp/k32w1/FactoryDataDriverImpl.h rename src/platform/nxp/{k32w => }/k32w1/FactoryDataProviderImpl.cpp (70%) rename src/platform/nxp/{k32w => }/k32w1/FactoryDataProviderImpl.h (81%) rename src/platform/nxp/{k32w => }/k32w1/InetPlatformConfig.h (100%) rename src/platform/nxp/{k32w => }/k32w1/K32W1Config.cpp (87%) rename src/platform/nxp/{k32w => }/k32w1/K32W1Config.h (99%) rename src/platform/nxp/{k32w => }/k32w1/K32W1PersistentStorageOpKeystore.cpp (100%) rename src/platform/nxp/{k32w => }/k32w1/K32W1PersistentStorageOpKeystore.h (100%) rename src/platform/nxp/{k32w => }/k32w1/KeyValueStoreManagerImpl.cpp (85%) rename src/platform/nxp/{k32w => }/k32w1/KeyValueStoreManagerImpl.h (100%) rename src/platform/nxp/{k32w => }/k32w1/Logging.cpp (98%) rename src/platform/nxp/{k32w => }/k32w1/LowPowerHooks.cpp (100%) rename src/platform/nxp/{k32w => }/k32w1/OTAFirmwareProcessor.cpp (96%) rename src/platform/nxp/{k32w => }/k32w1/OTAFirmwareProcessor.h (96%) rename src/platform/nxp/{k32w => }/k32w1/OTAHooks.cpp (82%) rename src/platform/nxp/{k32w => }/k32w1/PlatformManagerImpl.cpp (80%) rename src/platform/nxp/{k32w => }/k32w1/PlatformManagerImpl.h (96%) rename src/platform/nxp/{k32w => }/k32w1/SMU2Manager.cpp (99%) rename src/platform/nxp/{k32w => }/k32w1/SMU2Manager.h (100%) rename src/platform/nxp/{k32w => }/k32w1/SystemPlatformConfig.h (100%) rename src/platform/nxp/{k32w => }/k32w1/SystemTimeSupport.cpp (100%) rename src/platform/nxp/{k32w => }/k32w1/ThreadStackManagerImpl.cpp (90%) rename src/platform/nxp/{k32w => }/k32w1/ThreadStackManagerImpl.h (100%) rename src/platform/nxp/{k32w => }/k32w1/args.gni (72%) rename src/platform/nxp/{k32w => }/k32w1/ble_function_mux.c (100%) rename src/platform/nxp/{k32w => }/k32w1/ble_function_mux.h (100%) rename src/platform/nxp/{k32w => }/k32w1/gatt_db.h (100%) rename src/platform/nxp/{k32w => }/k32w1/gatt_uuid128.h (100%) rename src/platform/nxp/{k32w => }/k32w1/k32w1-chip-mbedtls-config.h (100%) rename src/platform/nxp/{k32w => }/k32w1/ram_storage.c (100%) rename src/platform/nxp/{k32w => }/k32w1/ram_storage.h (100%) rename third_party/openthread/platforms/nxp/{k32w => }/k32w1/BUILD.gn (73%) diff --git a/.github/workflows/examples-nxp.yaml b/.github/workflows/examples-nxp.yaml index 747813d6aa1037..975d9292a18941 100644 --- a/.github/workflows/examples-nxp.yaml +++ b/.github/workflows/examples-nxp.yaml @@ -29,8 +29,8 @@ env: CHIP_NO_LOG_TIMESTAMPS: true jobs: - k32w: - name: K32W + k32w0: + name: K32W0 env: BUILD_TYPE: gn_k32w @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-k32w:66 + image: ghcr.io/project-chip/chip-build-k32w:71 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -66,8 +66,6 @@ jobs: --target nxp-k32w0-freertos-contact-sensor \ --target nxp-k32w0-freertos-contact-sensor-low-power \ --target nxp-k32w0-freertos-contact-sensor-low-power-factory \ - --target nxp-k32w1-freertos-lighting \ - --target nxp-k32w1-freertos-contact-sensor-low-power \ build \ --copy-artifacts-to out/artifacts \ " @@ -77,16 +75,62 @@ jobs: nxp k32w0+release light \ out/artifacts/nxp-k32w0-freertos-lighting/chip-k32w0x-light-example.elf \ /tmp/bloat_reports/ - .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - nxp k32w1+release light \ - out/artifacts/nxp-k32w1-freertos-lighting/chip-k32w1-light-example.elf \ - /tmp/bloat_reports/ - name: Get contact sensor size stats run: | .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nxp k32w0+release contact \ out/artifacts/nxp-k32w0-freertos-contact-sensor-low-power/chip-k32w0x-contact-example.elf \ /tmp/bloat_reports/ + - name: Uploading Size Reports + uses: ./.github/actions/upload-size-reports + if: ${{ !env.ACT }} + with: + platform-name: K32W0 + k32w1: + name: K32W1 + + env: + BUILD_TYPE: gn_k32w + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: ghcr.io/project-chip/chip-build-nxp:71 + volumes: + - "/tmp/bloat_reports:/tmp/bloat_reports" + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Checkout submodules & Bootstrap + uses: ./.github/actions/checkout-submodules-and-bootstrap + with: + platform: nxp + extra-submodule-parameters: --recursive + + - name: Set up environment for size reports + uses: ./.github/actions/setup-size-reports + if: ${{ !env.ACT }} + with: + gh-context: ${{ toJson(github) }} + + - name: Build examples + run: | + scripts/run_in_build_env.sh "\ + ./scripts/build/build_examples.py \ + --target nxp-k32w1-freertos-lighting \ + --target nxp-k32w1-freertos-contact-sensor-low-power \ + build \ + --copy-artifacts-to out/artifacts \ + " + - name: Get lighting app size stats + run: | + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + nxp k32w1+release light \ + out/artifacts/nxp-k32w1-freertos-lighting/chip-k32w1-light-example.elf \ + /tmp/bloat_reports/ + - name: Get contact sensor size stats + run: | .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ nxp k32w1+release contact \ out/artifacts/nxp-k32w1-freertos-contact-sensor-low-power/chip-k32w1-contact-example.elf \ @@ -95,7 +139,7 @@ jobs: uses: ./.github/actions/upload-size-reports if: ${{ !env.ACT }} with: - platform-name: K32W + platform-name: K32W1 rw61x: name: RW61X diff --git a/examples/contact-sensor-app/nxp/common/AppTask.cpp b/examples/contact-sensor-app/nxp/common/AppTask.cpp new file mode 100644 index 00000000000000..f49c603cbb16a6 --- /dev/null +++ b/examples/contact-sensor-app/nxp/common/AppTask.cpp @@ -0,0 +1,53 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "AppTask.h" + +#if CONFIG_LOW_POWER +#include "PWR_Interface.h" +#endif + +#include + +void ContactSensorApp::AppTask::PreInitMatterStack() +{ + ChipLogProgress(DeviceLayer, "Welcome to NXP Contact Sensor Demo App"); +} + +#if CONFIG_LOW_POWER +void ContactSensorApp::AppTask::AppMatter_DisallowDeviceToSleep() +{ + PWR_DisallowDeviceToSleep(); +} + +void ContactSensorApp::AppTask::AppMatter_AllowDeviceToSleep() +{ + PWR_AllowDeviceToSleep(); +} +#endif + +ContactSensorApp::AppTask & ContactSensorApp::AppTask::GetDefaultInstance() +{ + static ContactSensorApp::AppTask sAppTask; + return sAppTask; +} + +chip::NXP::App::AppTaskBase & chip::NXP::App::GetAppTask() +{ + return ContactSensorApp::AppTask::GetDefaultInstance(); +} diff --git a/examples/contact-sensor-app/nxp/common/DeviceCallbacks.cpp b/examples/contact-sensor-app/nxp/common/DeviceCallbacks.cpp new file mode 100644 index 00000000000000..8cd301d81f5aa6 --- /dev/null +++ b/examples/contact-sensor-app/nxp/common/DeviceCallbacks.cpp @@ -0,0 +1,69 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include "DeviceCallbacks.h" +#if CONFIG_ENABLE_FEEDBACK +#include "UserInterfaceFeedback.h" +#endif + +#include +#include +#include + +using namespace ::chip; +using namespace ::chip::app::Clusters; + +void logBooleanStateEvent(bool state) +{ + chip::EventNumber eventNumber; + chip::app::Clusters::BooleanState::Events::StateChange::Type event{ state }; + if (CHIP_NO_ERROR != chip::app::LogEvent(event, 1, eventNumber)) + { + ChipLogProgress(Zcl, "booleanstate: failed to reacord state-change event"); + } +} + +void ContactSensorApp::DeviceCallbacks::PostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + chip::AttributeId attributeId, uint8_t type, uint16_t size, + uint8_t * value) +{ + if (clusterId == BooleanState::Id) + { + if (attributeId != BooleanState::Attributes::StateValue::Id) + { + ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId)); + return; + } +#if CONFIG_ENABLE_FEEDBACK + FeedbackMgr().RestoreState(); +#endif + logBooleanStateEvent(static_cast(*value)); + } + else + { + ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId)); + } +} + +chip::DeviceManager::CHIPDeviceManagerCallbacks & chip::NXP::App::GetDeviceCallbacks() +{ + static ContactSensorApp::DeviceCallbacks sDeviceCallbacks; + return sDeviceCallbacks; +} diff --git a/examples/contact-sensor-app/nxp/common/ZclCallbacks.cpp b/examples/contact-sensor-app/nxp/common/ZclCallbacks.cpp new file mode 100644 index 00000000000000..cbadc5510d27aa --- /dev/null +++ b/examples/contact-sensor-app/nxp/common/ZclCallbacks.cpp @@ -0,0 +1,38 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +#if CONFIG_ENABLE_FEEDBACK +#include "UserInterfaceFeedback.h" +#endif + +/** @brief BooleanState Cluster Init + * + * This function is called when a specific cluster is initialized. It gives the + * application an opportunity to take care of cluster initialization procedures. + * It is called exactly once for each endpoint where cluster is present. + */ +void emberAfBooleanStateClusterInitCallback(chip::EndpointId endpoint) +{ + ChipLogProgress(Zcl, "emberAfBooleanStateClusterInitCallback\n"); +#if CONFIG_ENABLE_FEEDBACK + FeedbackMgr().RestoreState(); +#endif +} diff --git a/src/platform/nxp/k32w/k32w1/DefaultTestEventTriggerDelegate.cpp b/examples/contact-sensor-app/nxp/common/include/AppEvent.h similarity index 62% rename from src/platform/nxp/k32w/k32w1/DefaultTestEventTriggerDelegate.cpp rename to examples/contact-sensor-app/nxp/common/include/AppEvent.h index 69935bb024559d..b292afaddf8c18 100644 --- a/src/platform/nxp/k32w/k32w1/DefaultTestEventTriggerDelegate.cpp +++ b/examples/contact-sensor-app/nxp/common/include/AppEvent.h @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2022 Project CHIP Authors + * Copyright (c) 2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,16 +16,12 @@ * limitations under the License. */ -#include "DefaultTestEventTriggerDelegate.h" +#pragma once -#include -#include +struct AppEvent; +typedef void (*EventHandler)(const AppEvent &); -namespace chip { - -bool DefaultTestEventTriggerDelegate::DoesEnableKeyMatch(const ByteSpan & enableKey) const +struct AppEvent { - return !mEnableKey.empty() && mEnableKey.data_equal(enableKey); -} - -} // namespace chip + EventHandler Handler; +}; diff --git a/examples/contact-sensor-app/nxp/common/include/AppTask.h b/examples/contact-sensor-app/nxp/common/include/AppTask.h new file mode 100644 index 00000000000000..69b3ffc8200804 --- /dev/null +++ b/examples/contact-sensor-app/nxp/common/include/AppTask.h @@ -0,0 +1,50 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "AppConfig.h" +#include "AppTaskFreeRTOS.h" + +#include + +namespace ContactSensorApp { + +class AppTask : public chip::NXP::App::AppTaskFreeRTOS +{ +public: + // AppTaskFreeRTOS virtual methods + void PreInitMatterStack() override; +#if CONFIG_LOW_POWER + void AppMatter_DisallowDeviceToSleep() override; + void AppMatter_AllowDeviceToSleep() override; +#endif + + // This returns an instance of this class. + static AppTask & GetDefaultInstance(); +}; + +} // namespace ContactSensorApp + +/** + * Returns the application-specific implementation of the AppTaskBase object. + * + * Applications can use this to gain access to features of the AppTaskBase + * that are specific to the selected application. + */ +chip::NXP::App::AppTaskBase & GetAppTask(); diff --git a/examples/contact-sensor-app/nxp/common/include/DeviceCallbacks.h b/examples/contact-sensor-app/nxp/common/include/DeviceCallbacks.h new file mode 100644 index 00000000000000..7234c2b8c74f53 --- /dev/null +++ b/examples/contact-sensor-app/nxp/common/include/DeviceCallbacks.h @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file DeviceCallbacks.h + * + * Lighting app implementation for the DeviceManager callbacks for all applications + * + **/ + +#pragma once + +#include "CHIPDeviceManager.h" +#include "CommonDeviceCallbacks.h" + +namespace ContactSensorApp { + +class DeviceCallbacks : public chip::NXP::App::CommonDeviceCallbacks +{ +public: + void PostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId, + uint8_t type, uint16_t size, uint8_t * value) override; +}; + +} // namespace ContactSensorApp + +namespace chip::NXP::App { +/** + * Returns the application-specific implementation of the CommonDeviceCallbacks object. + * + * Applications can use this to gain access to features of the CommonDeviceCallbacks + * that are specific to the selected application. + */ +chip::DeviceManager::CHIPDeviceManagerCallbacks & GetDeviceCallbacks(); + +} // namespace chip::NXP::App diff --git a/examples/contact-sensor-app/nxp/common/main.cpp b/examples/contact-sensor-app/nxp/common/main.cpp new file mode 100644 index 00000000000000..d9672b5402c867 --- /dev/null +++ b/examples/contact-sensor-app/nxp/common/main.cpp @@ -0,0 +1,39 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "AppTask.h" +#include "FreeRTOS.h" + +#if configAPPLICATION_ALLOCATED_HEAP +uint8_t __attribute__((section(".heap"))) ucHeap[configTOTAL_HEAP_SIZE]; +#endif + +#if FSL_OSA_MAIN_FUNC_ENABLE +extern "C" void main_task(void const * argument) +{ + chip::DeviceLayer::PlatformMgrImpl().HardwareInit(); + chip::NXP::App::GetAppTask().Start(); +} +#else +extern "C" int main(int argc, char * argv[]) +{ + chip::DeviceLayer::PlatformMgrImpl().HardwareInit(); + chip::NXP::App::GetAppTask().Start(); + vTaskStartScheduler(); +} +#endif diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/BUILD.gn b/examples/contact-sensor-app/nxp/k32w/k32w1/BUILD.gn deleted file mode 100644 index f4ccc1ec4d8c39..00000000000000 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/BUILD.gn +++ /dev/null @@ -1,186 +0,0 @@ -# Copyright (c) 2021-2023 Project CHIP Authors -# Copyright (c) 2023 NXP -# -# 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("//build_overrides/nxp_sdk.gni") -import("//build_overrides/openthread.gni") - -import("${nxp_sdk_build_root}/nxp_sdk.gni") - -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") -import("${chip_root}/src/platform/nxp/${nxp_platform}/args.gni") - -declare_args() { - chip_software_version = 0 - - # Setup discriminator as argument - setup_discriminator = 3840 - chip_with_diag_logs_demo = true -} - -assert(current_os == "freertos") - -common_example_dir = "${chip_root}/examples/platform/nxp/common" -k32w1_platform_dir = "${chip_root}/examples/platform/nxp/k32w/k32w1" -k32w1_sdk_root = getenv("NXP_K32W1_SDK_ROOT") - -k32w1_sdk("sdk") { - sources = [ - "${k32w1_platform_dir}/app/project_include/OpenThreadConfig.h", - "include/CHIPProjectConfig.h", - "include/FreeRTOSConfig.h", - "main/include/app_config.h", - ] - - public_deps = - [ "${chip_root}/third_party/openthread/platforms:libopenthread-platform" ] - - include_dirs = [ - "main/include", - "main", - "include", - "${k32w1_platform_dir}/app/project_include", - "${k32w1_platform_dir}/app/support", - "${k32w1_platform_dir}/util/include", - ] - - defines = [] - if (is_debug) { - defines += [ "BUILD_RELEASE=0" ] - } else { - defines += [ "BUILD_RELEASE=1" ] - } - - if (chip_software_version != 0) { - defines += [ - "CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION=${chip_software_version}", - ] - } - - defines += [ - "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setup_discriminator}", - ] - - if (chip_with_diag_logs_demo) { - defines += [ "CONFIG_DIAG_LOGS_DEMO=1" ] - } -} - -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", - "main/AppTask.cpp", - "main/ContactSensorManager.cpp", - "main/ZclCallbacks.cpp", - "main/include/AppEvent.h", - "main/include/AppTask.h", - "main/include/ContactSensorManager.h", - "main/main.cpp", - ] - - include_dirs = [ "${common_example_dir}/diagnostic_logs" ] - - deps = [ - ":sdk", - "${chip_root}/examples/common/QRCode", - "${chip_root}/examples/providers:device_info_provider", - "${chip_root}/src/lib", - "${chip_root}/src/platform:syscalls_stub", - "${chip_root}/src/platform/logging:default", - "${chip_root}/third_party/mbedtls:mbedtls", - "${k32w1_platform_dir}/app/support:freertos_mbedtls_utils", - ] - - #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/" ] - } - - if (chip_openthread_ftd) { - deps += [ - "${openthread_root}:libopenthread-cli-ftd", - "${openthread_root}:libopenthread-ftd", - ] - } else { - deps += [ - "${openthread_root}:libopenthread-cli-mtd", - "${openthread_root}:libopenthread-mtd", - ] - } - - #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 - - ldscript = "${k32w1_sdk_root}/middleware/wireless/framework/Common/devices/kw45_k32w1/gcc/connectivity.ld" - - inputs = [ ldscript ] - - ldflags = [ - "-Wl,--defsym=__heap_size__=0", - "-Wl,--defsym=__stack_size__=0x480", - "-Wl,--defsym=lp_ram_lower_limit=0x04000000", - "-Wl,--defsym=lp_ram_upper_limit=0x2001C000", - "-Wl,-print-memory-usage", - "-Wl,--no-warn-rwx-segments", - "-T" + rebase_path(ldscript, root_build_dir), - ] - - if (chip_with_factory_data == 1) { - ldflags += [ "-Wl,--defsym=gUseFactoryData_d=1" ] - } - - if (chip_with_diag_logs_demo) { - sources += [ - "${common_example_dir}/diagnostic_logs/DiagnosticLogsProviderDelegateImpl.cpp", - "${common_example_dir}/diagnostic_logs/DiagnosticLogsProviderDelegateImpl.h", - ] - } - - output_dir = root_out_dir -} - -group("k32w1") { - deps = [ ":contact_sensor_app" ] -} - -group("default") { - deps = [ ":k32w1" ] -} diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/build_overrides b/examples/contact-sensor-app/nxp/k32w/k32w1/build_overrides deleted file mode 120000 index ad07557834803a..00000000000000 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/build_overrides +++ /dev/null @@ -1 +0,0 @@ -../../../../build_overrides/ \ No newline at end of file diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/main/AppTask.cpp b/examples/contact-sensor-app/nxp/k32w/k32w1/main/AppTask.cpp deleted file mode 100644 index 6f0459178cd173..00000000000000 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/main/AppTask.cpp +++ /dev/null @@ -1,908 +0,0 @@ -/* - * - * Copyright (c) 2022-2023 Project CHIP Authors - * Copyright (c) 2022 Google LLC. - * Copyright (c) 2023 NXP - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "AppTask.h" -#include "AppEvent.h" -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#if CONFIG_DIAG_LOGS_DEMO -#include "DiagnosticLogsProviderDelegateImpl.h" -#endif - -#include -#include -#include -#include - -/* OTA related includes */ -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR -#include "OtaSupport.h" -#include -#include -#include -#include -#include -#endif - -#include - -#include "K32W1PersistentStorageOpKeystore.h" - -#include "LEDWidget.h" -#include "app.h" -#include "app_config.h" -#include "fsl_component_button.h" -#include "fwk_platform.h" - -#define FACTORY_RESET_TRIGGER_TIMEOUT 6000 -#define FACTORY_RESET_CANCEL_WINDOW_TIMEOUT 3000 -#define APP_TASK_PRIORITY 2 -#define APP_EVENT_QUEUE_SIZE 10 - -TimerHandle_t sFunctionTimer; // FreeRTOS app sw timer. - -static QueueHandle_t sAppEventQueue; - -#if !defined(chip_with_low_power) || (chip_with_low_power == 0) -/* - * The status LED and the external flash CS pin are wired together. - * The OTA image writing may fail if used together. - */ -#ifndef CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR -static LEDWidget sStatusLED; -#endif -static LEDWidget sContactSensorLED; -#endif - -static bool sIsThreadProvisioned = false; -static bool sHaveBLEConnections = false; -#if CHIP_ENABLE_LIT -static bool sIsDeviceCommissioned = false; -#endif - -static uint32_t eventMask = 0; - -#if CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI -extern "C" void otPlatUartProcess(void); -#endif - -extern "C" void PWR_DisallowDeviceToSleep(void); -extern "C" void PWR_AllowDeviceToSleep(void); - -using namespace ::chip::Credentials; -using namespace ::chip::DeviceLayer; -using namespace chip; -using namespace chip::app; -#if CONFIG_DIAG_LOGS_DEMO -using namespace chip::app::Clusters::DiagnosticLogs; -#endif - -AppTask AppTask::sAppTask; -#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA -static AppTask::FactoryDataProvider sFactoryDataProvider; -#endif - -static Identify gIdentify = { chip::EndpointId{ 1 }, AppTask::OnIdentifyStart, AppTask::OnIdentifyStop, - Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator }; - -/* OTA related variables */ -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR -static DefaultOTARequestor gRequestorCore __attribute__((section(".data"))); -static DefaultOTARequestorStorage gRequestorStorage __attribute__((section(".data"))); -static DeviceLayer::DefaultOTARequestorDriver gRequestorUser __attribute__((section(".data"))); -static BDXDownloader gDownloader __attribute__((section(".data"))); - -constexpr uint16_t requestedOtaBlockSize = 1024; -#endif - -static pm_notify_element_t appNotifyElement = { - .notifyCallback = AppTask::LowPowerCallback, - .data = NULL, -}; - -static void app_gap_callback(gapGenericEvent_t * event) -{ - /* This callback is called in the context of BLE task, so event processing - * should be posted to app task. */ -} - -static void app_gatt_callback(deviceId_t id, gattServerEvent_t * event) -{ - /* This callback is called in the context of BLE task, so event processing - * should be posted to app task. */ -} - -CHIP_ERROR AppTask::StartAppTask() -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - sAppEventQueue = xQueueCreate(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent)); - if (sAppEventQueue == NULL) - { - err = APP_ERROR_EVENT_QUEUE_FAILED; - K32W_LOG("Failed to allocate app event queue"); - assert(err == CHIP_NO_ERROR); - } - - return err; -} - -CHIP_ERROR AppTask::Init() -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - if (ContactSensorMgr().Init() != 0) - { - K32W_LOG("ContactSensorMgr().Init() failed"); - assert(0); - } - - // Register enter/exit low power application callback. - status_t status = PM_RegisterNotify(kPM_NotifyGroup2, &appNotifyElement); - if (status != kStatus_Success) - { - K32W_LOG("Failed to register low power app callback.") - return APP_ERROR_PM_REGISTER_LP_CALLBACK_FAILED; - } - - PlatformMgr().AddEventHandler(MatterEventHandler, 0); - - // Init ZCL Data Model and start server - PlatformMgr().ScheduleWork(InitServer, 0); - -#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA - ReturnErrorOnFailure(sFactoryDataProvider.Init()); - SetDeviceInstanceInfoProvider(&sFactoryDataProvider); - SetDeviceAttestationCredentialsProvider(&sFactoryDataProvider); - SetCommissionableDataProvider(&sFactoryDataProvider); -#else - SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); -#endif // CONFIG_CHIP_LOAD_REAL_FACTORY_DATA - - // QR code will be used with CHIP Tool - AppTask::PrintOnboardingInfo(); - -#if !defined(chip_with_low_power) || (chip_with_low_power == 0) - /* start with all LEDS turnedd off */ -#ifndef CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - sStatusLED.Init(SYSTEM_STATE_LED, false); -#endif - - sContactSensorLED.Init(CONTACT_SENSOR_STATE_LED, false); - sContactSensorLED.Set(ContactSensorMgr().IsContactClosed()); -#endif - - UpdateDeviceState(); - - /* intialize the Keyboard and button press callback */ - BUTTON_InstallCallback((button_handle_t) g_buttonHandle[0], KBD_Callback, (void *) BLE_BUTTON); - BUTTON_InstallCallback((button_handle_t) g_buttonHandle[1], KBD_Callback, (void *) CONTACT_SENSOR_BUTTON); - - // Create FreeRTOS sw timer for Function Selection. - sFunctionTimer = xTimerCreate("FnTmr", // Just a text name, not used by the RTOS kernel - 1, // == default timer period (mS) - false, // no timer reload (==one-shot) - (void *) this, // init timer id = app task obj context - TimerEventHandler // timer callback handler - ); - if (sFunctionTimer == NULL) - { - err = APP_ERROR_CREATE_TIMER_FAILED; - K32W_LOG("app_timer_create() failed"); - assert(err == CHIP_NO_ERROR); - } - - ContactSensorMgr().SetCallback(OnStateChanged); - - // Print the current software version - char currentSoftwareVer[ConfigurationManager::kMaxSoftwareVersionStringLength + 1] = { 0 }; - err = ConfigurationMgr().GetSoftwareVersionString(currentSoftwareVer, sizeof(currentSoftwareVer)); - if (err != CHIP_NO_ERROR) - { - K32W_LOG("Get version error"); - assert(err == CHIP_NO_ERROR); - } - - uint32_t currentVersion; - err = ConfigurationMgr().GetSoftwareVersion(currentVersion); - - K32W_LOG("Current Software Version: %s, %d", currentSoftwareVer, currentVersion); - - auto & bleManager = chip::DeviceLayer::Internal::BLEMgrImpl(); - bleManager.RegisterAppCallbacks(app_gap_callback, app_gatt_callback); - - return err; -} - -void LockOpenThreadTask(void) -{ - PWR_DisallowDeviceToSleep(); - chip::DeviceLayer::ThreadStackMgr().LockThreadStack(); -} - -void UnlockOpenThreadTask(void) -{ - chip::DeviceLayer::ThreadStackMgr().UnlockThreadStack(); - PWR_AllowDeviceToSleep(); -} - -void AppTask::InitServer(intptr_t arg) -{ - static chip::CommonCaseDeviceServerInitParams initParams; - (void) initParams.InitializeStaticResourcesBeforeServerInit(); - -#if CHIP_CRYPTO_PLATFORM - static chip::K32W1PersistentStorageOpKeystore sK32W1PersistentStorageOpKeystore; - VerifyOrDie((sK32W1PersistentStorageOpKeystore.Init(initParams.persistentStorageDelegate)) == CHIP_NO_ERROR); - initParams.operationalKeystore = &sK32W1PersistentStorageOpKeystore; -#endif - - // Init ZCL Data Model and start server - chip::Inet::EndPointStateOpenThread::OpenThreadEndpointInitParam nativeParams; - nativeParams.lockCb = LockOpenThreadTask; - nativeParams.unlockCb = UnlockOpenThreadTask; - nativeParams.openThreadInstancePtr = chip::DeviceLayer::ThreadStackMgrImpl().OTInstance(); - initParams.endpointNativeParams = static_cast(&nativeParams); - VerifyOrDie((chip::Server::GetInstance().Init(initParams)) == CHIP_NO_ERROR); - -#if CONFIG_DIAG_LOGS_DEMO - char diagLog[CHIP_DEVICE_CONFIG_MAX_DIAG_LOG_SIZE]; - uint16_t diagLogSize = CHIP_DEVICE_CONFIG_MAX_DIAG_LOG_SIZE; - - StorageKeyName keyUser = LogProvider::GetKeyDiagUserSupport(); - StorageKeyName keyNwk = LogProvider::GetKeyDiagNetwork(); - StorageKeyName keyCrash = LogProvider::GetKeyDiagCrashLog(); - - memset(diagLog, 0, diagLogSize); - Server::GetInstance().GetPersistentStorage().SyncSetKeyValue(keyUser.KeyName(), diagLog, diagLogSize); - - memset(diagLog, 1, diagLogSize); - Server::GetInstance().GetPersistentStorage().SyncSetKeyValue(keyNwk.KeyName(), diagLog, diagLogSize); - - memset(diagLog, 2, diagLogSize); - Server::GetInstance().GetPersistentStorage().SyncSetKeyValue(keyCrash.KeyName(), diagLog, diagLogSize); -#endif -} - -void AppTask::PrintOnboardingInfo() -{ - chip::PayloadContents payload; - CHIP_ERROR err = GetPayloadContents(payload, chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); - if (err != CHIP_NO_ERROR) - { - ChipLogError(AppServer, "GetPayloadContents() failed: %" CHIP_ERROR_FORMAT, err.Format()); - } - payload.commissioningFlow = chip::CommissioningFlow::kUserActionRequired; - PrintOnboardingCodes(payload); -} - -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR -void AppTask::InitOTA(intptr_t arg) -{ - // Initialize and interconnect the Requestor and Image Processor objects -- START - SetRequestorInstance(&gRequestorCore); - - gRequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage()); - gRequestorCore.Init(chip::Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader); - gRequestorUser.SetMaxDownloadBlockSize(requestedOtaBlockSize); - auto & imageProcessor = OTAImageProcessorImpl::GetDefaultInstance(); - gRequestorUser.Init(&gRequestorCore, &imageProcessor); - CHIP_ERROR err = imageProcessor.Init(&gDownloader); - if (err != CHIP_NO_ERROR) - { - K32W_LOG("Image processor init failed"); - assert(err == CHIP_NO_ERROR); - } - - // Connect the gDownloader and Image Processor objects - gDownloader.SetImageProcessorDelegate(&imageProcessor); - // Initialize and interconnect the Requestor and Image Processor objects -- END -} -#endif - -void AppTask::AppTaskMain(void * pvParameter) -{ - AppEvent event; - - CHIP_ERROR err = sAppTask.Init(); - if (err != CHIP_NO_ERROR) - { - K32W_LOG("AppTask.Init() failed"); - assert(err == CHIP_NO_ERROR); - } - - while (true) - { - TickType_t xTicksToWait = pdMS_TO_TICKS(10); - -#if defined(chip_with_low_power) && (chip_with_low_power == 1) - xTicksToWait = portMAX_DELAY; -#endif - - BaseType_t eventReceived = xQueueReceive(sAppEventQueue, &event, xTicksToWait); - while (eventReceived == pdTRUE) - { - sAppTask.DispatchEvent(&event); - eventReceived = xQueueReceive(sAppEventQueue, &event, 0); - } - - // Collect connectivity and configuration state from the CHIP stack. Because the - // CHIP event loop is being run in a separate task, the stack must be locked - // while these values are queried. However we use a non-blocking lock request - // (TryLockChipStack()) to avoid blocking other UI activities when the CHIP - // task is busy (e.g. with a long crypto operation). - if (PlatformMgr().TryLockChipStack()) - { -#if CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI - otPlatUartProcess(); -#endif - - sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0); - PlatformMgr().UnlockChipStack(); - } - - // Update the status LED if factory reset or identify process have not been initiated. - // - // If system has "full connectivity", keep the LED On constantly. - // - // If thread and service provisioned, but not attached to the thread network yet OR no - // connectivity to the service OR subscriptions are not fully established - // THEN blink the LED Off for a short period of time. - // - // If the system has ble connection(s) uptill the stage above, THEN blink the LEDs at an even - // rate of 100ms. - // - // Otherwise, blink the LED ON for a very short time. - -#if !defined(chip_with_low_power) || (chip_with_low_power == 0) -#ifndef CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - if (sAppTask.mFunction != Function::kFactoryReset && sAppTask.mFunction != Function::kIdentify) - { - if (sIsThreadProvisioned) - { - sStatusLED.Blink(950, 50); - } - else if (sHaveBLEConnections) - { - sStatusLED.Blink(100, 100); - } - else - { - sStatusLED.Blink(50, 950); - } - } - - sStatusLED.Animate(); -#endif - - sContactSensorLED.Animate(); -#endif - } -} - -void AppTask::ButtonEventHandler(uint8_t pin_no, uint8_t button_action) -{ - if ((pin_no != RESET_BUTTON) && (pin_no != CONTACT_SENSOR_BUTTON) && (pin_no != SOFT_RESET_BUTTON) && (pin_no != BLE_BUTTON)) - { - return; - } - - AppEvent button_event; - button_event.Type = AppEvent::kButton; - button_event.ButtonEvent.PinNo = pin_no; - button_event.ButtonEvent.Action = button_action; - - if (pin_no == RESET_BUTTON) - { - button_event.Handler = ResetActionEventHandler; - } - else if (pin_no == CONTACT_SENSOR_BUTTON) - { - button_event.Handler = ContactActionEventHandler; - } - else if (pin_no == SOFT_RESET_BUTTON) - { - // Soft reset ensures that platform manager shutdown procedure is called. - button_event.Handler = SoftResetHandler; - } - else if (pin_no == BLE_BUTTON) - { - button_event.Handler = BleHandler; - - if (button_action == RESET_BUTTON_PUSH) - { - 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); -} - -button_status_t AppTask::KBD_Callback(void * buttonHandle, button_callback_message_t * message, void * callbackParam) -{ - uint32_t pinNb = (uint32_t) callbackParam; - switch (message->event) - { - case kBUTTON_EventOneClick: - case kBUTTON_EventShortPress: - switch (pinNb) - { - case BLE_BUTTON: - K32W_LOG("pb1 short press"); - if (sAppTask.mResetTimerActive) - { - 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); - } - break; - - case CONTACT_SENSOR_BUTTON: - K32W_LOG("pb2 short press"); - ButtonEventHandler(CONTACT_SENSOR_BUTTON, CONTACT_SENSOR_BUTTON_PUSH); - break; - } - break; - - case kBUTTON_EventLongPress: - switch (pinNb) - { - case BLE_BUTTON: - K32W_LOG("pb1 long press"); - ButtonEventHandler(BLE_BUTTON, RESET_BUTTON_PUSH); - break; - - case CONTACT_SENSOR_BUTTON: - K32W_LOG("pb2 long press"); - ButtonEventHandler(SOFT_RESET_BUTTON, SOFT_RESET_BUTTON_PUSH); - break; - } - break; - - default: - /* No action required */ - break; - } - return kStatus_BUTTON_Success; -} - -void AppTask::TimerEventHandler(TimerHandle_t xTimer) -{ - AppEvent event; - event.Type = AppEvent::kTimer; - event.TimerEvent.Context = (void *) xTimer; - event.Handler = FunctionTimerEventHandler; - sAppTask.PostEvent(&event); -} - -void AppTask::FunctionTimerEventHandler(void * aGenericEvent) -{ - AppEvent * aEvent = (AppEvent *) aGenericEvent; - - if (aEvent->Type != AppEvent::kTimer) - return; - - K32W_LOG("Device will factory reset..."); - - // Actually trigger Factory Reset - chip::Server::GetInstance().ScheduleFactoryReset(); -} - -void AppTask::ResetActionEventHandler(void * aGenericEvent) -{ - AppEvent * aEvent = (AppEvent *) aGenericEvent; - - if (aEvent->ButtonEvent.PinNo != RESET_BUTTON && aEvent->ButtonEvent.PinNo != BLE_BUTTON) - return; - - if (sAppTask.mResetTimerActive) - { - sAppTask.CancelTimer(); - sAppTask.mFunction = Function::kNoneSelected; - -#if !defined(chip_with_low_power) || (chip_with_low_power == 0) - /* restore initial state for the LED indicating contact state */ - if (!ContactSensorMgr().IsContactClosed()) - { - sContactSensorLED.Set(false); - } - else - { - sContactSensorLED.Set(true); - } -#endif - - K32W_LOG("Factory Reset was cancelled!"); - } - else - { - uint32_t resetTimeout = FACTORY_RESET_TRIGGER_TIMEOUT; - - if (sAppTask.mFunction != Function::kNoneSelected) - { - K32W_LOG("Another function is scheduled. Could not initiate Factory Reset!"); - return; - } - - K32W_LOG("Factory Reset Triggered. Push the RESET button within %lu ms to cancel!", resetTimeout); - sAppTask.mFunction = Function::kFactoryReset; - - /* LEDs will start blinking to signal that a Factory Reset was scheduled */ -#if !defined(chip_with_low_power) || (chip_with_low_power == 0) -#ifndef CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - sStatusLED.Set(false); - sStatusLED.Blink(500); -#endif - sContactSensorLED.Set(false); - sContactSensorLED.Blink(500); -#endif - - sAppTask.StartTimer(FACTORY_RESET_TRIGGER_TIMEOUT); - } -} - -void AppTask::ContactActionEventHandler(void * aGenericEvent) -{ - AppEvent * aEvent = (AppEvent *) aGenericEvent; - ContactSensorManager::Action action = ContactSensorManager::Action::kInvalid; - CHIP_ERROR err = CHIP_NO_ERROR; - bool state_changed = false; - - if (sAppTask.mFunction != Function::kNoneSelected) - { - K32W_LOG("Another function is scheduled. Could not change contact state."); - return; - } - - if (aEvent->Type == AppEvent::kContact) - { - action = static_cast(aEvent->ContactEvent.Action); - } - else if (aEvent->Type == AppEvent::kButton) - { - if (ContactSensorMgr().IsContactClosed()) - { - action = ContactSensorManager::Action::kSignalLost; - } - else - { - action = ContactSensorManager::Action::kSignalDetected; - } - - sAppTask.SetSyncClusterToButtonAction(true); - } - else - { - err = APP_ERROR_UNHANDLED_EVENT; - action = ContactSensorManager::Action::kInvalid; - } - - if (err == CHIP_NO_ERROR) - { - ContactSensorMgr().InitiateAction(action); - } -} - -void AppTask::SoftResetHandler(void * aGenericEvent) -{ - AppEvent * aEvent = (AppEvent *) aGenericEvent; - if (aEvent->ButtonEvent.PinNo != SOFT_RESET_BUTTON) - return; - - PlatformMgrImpl().CleanReset(); -} - -void AppTask::BleHandler(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 toggle BLE state!"); - return; - } - PlatformMgr().ScheduleWork(AppTask::BleStartAdvertising, 0); -} - -void AppTask::BleStartAdvertising(intptr_t arg) -{ - if (ConnectivityMgr().IsBLEAdvertisingEnabled()) - { - ConnectivityMgr().SetBLEAdvertisingEnabled(false); - K32W_LOG("Stopped BLE Advertising!"); - } - else - { - ConnectivityMgr().SetBLEAdvertisingEnabled(true); - - if (chip::Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() == CHIP_NO_ERROR) - { - K32W_LOG("Started BLE Advertising!"); - } - else - { - K32W_LOG("OpenBasicCommissioningWindow() failed"); - } - } -} - -#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) - { - if (event->ServiceProvisioningChange.IsServiceProvisioned) - { - sIsThreadProvisioned = TRUE; - } - else - { - 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) - { - K32W_LOG("Dnssd platform initialized."); - PlatformMgr().ScheduleWork(InitOTA, 0); - } -#endif -} - -void AppTask::CancelTimer() -{ - if (xTimerStop(sFunctionTimer, 0) == pdFAIL) - { - K32W_LOG("app timer stop() failed"); - } - - mResetTimerActive = false; -} - -void AppTask::StartTimer(uint32_t aTimeoutInMs) -{ - if (xTimerIsTimerActive(sFunctionTimer)) - { - K32W_LOG("app timer already started!"); - CancelTimer(); - } - - // timer is not active, change its period to required value (== restart). - // FreeRTOS- Block for a maximum of 100 ticks if the change period command - // cannot immediately be sent to the timer command queue. - if (xTimerChangePeriod(sFunctionTimer, aTimeoutInMs / portTICK_PERIOD_MS, 100) != pdPASS) - { - K32W_LOG("app timer start() failed"); - } - - mResetTimerActive = true; -} - -void AppTask::OnStateChanged(ContactSensorManager::State aState) -{ - // If the contact state was changed, update LED state and cluster state (only if button was pressed). - // - turn on the contact LED if contact sensor is in closed state. - // - turn off the lock LED if contact sensor is in opened state. - if (ContactSensorManager::State::kContactClosed == aState) - { - K32W_LOG("Contact state changed to closed.") -#if !defined(chip_with_low_power) || (chip_with_low_power == 0) - sContactSensorLED.Set(true); -#endif - } - else if (ContactSensorManager::State::kContactOpened == aState) - { - K32W_LOG("Contact state changed to opened.") -#if !defined(chip_with_low_power) || (chip_with_low_power == 0) - sContactSensorLED.Set(false); -#endif - } - - if (sAppTask.IsSyncClusterToButtonAction()) - { - sAppTask.UpdateClusterState(); - } - - sAppTask.mFunction = Function::kNoneSelected; -} - -void AppTask::OnIdentifyStart(Identify * identify) -{ - if (Clusters::Identify::EffectIdentifierEnum::kBlink == identify->mCurrentEffectIdentifier) - { - if (Function::kNoneSelected != sAppTask.mFunction) - { - K32W_LOG("Another function is scheduled. Could not initiate Identify process!"); - return; - } - K32W_LOG("Identify process has started. Status LED should blink every 0.5 seconds."); - sAppTask.mFunction = Function::kIdentify; -#if !defined(chip_with_low_power) || (chip_with_low_power == 0) -#ifndef CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - sStatusLED.Set(false); - sStatusLED.Blink(500); -#endif -#endif - } -} - -void AppTask::OnIdentifyStop(Identify * identify) -{ - if (Clusters::Identify::EffectIdentifierEnum::kBlink == identify->mCurrentEffectIdentifier) - { - K32W_LOG("Identify process has stopped."); - sAppTask.mFunction = Function::kNoneSelected; - } -} - -status_t AppTask::LowPowerCallback(pm_event_type_t eventType, uint8_t powerState, void * data) -{ - return kStatus_Success; -} - -void AppTask::PostContactActionRequest(ContactSensorManager::Action aAction) -{ - AppEvent event; - event.Type = AppEvent::kContact; - event.ContactEvent.Action = static_cast(aAction); - event.Handler = ContactActionEventHandler; - PostEvent(&event); -} - -void AppTask::PostEvent(const AppEvent * aEvent) -{ - portBASE_TYPE taskToWake = pdFALSE; - if (sAppEventQueue != NULL) - { - if (__get_IPSR()) - { - if (!xQueueSendToFrontFromISR(sAppEventQueue, aEvent, &taskToWake)) - { - K32W_LOG("Failed to post event to app task event queue"); - } - if (taskToWake) - { - portYIELD_FROM_ISR(taskToWake); - } - } - else if (!xQueueSend(sAppEventQueue, aEvent, 0)) - { - K32W_LOG("Failed to post event to app task event queue"); - } - } -} - -void AppTask::DispatchEvent(AppEvent * aEvent) -{ -#if defined(chip_with_low_power) && (chip_with_low_power == 1) - /* specific processing for events sent from App_PostCallbackMessage (see main.cpp) */ - if (aEvent->Type == AppEvent::kEventType_Lp) - { - aEvent->Handler(aEvent->param); - } - else -#endif - - if (aEvent->Handler) - { - aEvent->Handler(aEvent); - } - else - { - K32W_LOG("Event received with no handler. Dropping event."); - } -} - -void AppTask::UpdateClusterState(void) -{ - PlatformMgr().ScheduleWork(UpdateClusterStateInternal, 0); -} -extern void logBooleanStateEvent(bool state); -void AppTask::UpdateClusterStateInternal(intptr_t arg) -{ - uint8_t newValue = ContactSensorMgr().IsContactClosed(); - - // write the new on/off value - Protocols::InteractionModel::Status status = app::Clusters::BooleanState::Attributes::StateValue::Set(1, newValue); - - if (status != Protocols::InteractionModel::Status::Success) - { - ChipLogError(NotSpecified, "ERR: updating boolean status value %x", to_underlying(status)); - } - logBooleanStateEvent(newValue); -} - -void AppTask::UpdateDeviceState(void) -{ - PlatformMgr().ScheduleWork(UpdateDeviceStateInternal, 0); -} - -void AppTask::UpdateDeviceStateInternal(intptr_t arg) -{ - bool stateValueAttrValue = 0; - - /* get onoff attribute value */ - (void) app::Clusters::BooleanState::Attributes::StateValue::Get(1, &stateValueAttrValue); - -#if !defined(chip_with_low_power) || (chip_with_low_power == 0) - /* set the device state */ - sContactSensorLED.Set(stateValueAttrValue); -#endif -} - -extern "C" void OTAIdleActivities(void) -{ -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - OTA_TransactionResume(); -#endif -} diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/main/ContactSensorManager.cpp b/examples/contact-sensor-app/nxp/k32w/k32w1/main/ContactSensorManager.cpp deleted file mode 100644 index 9e0a665cbb5aa9..00000000000000 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/main/ContactSensorManager.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * - * Copyright (c) 2022-2023 Project CHIP Authors - * Copyright (c) 2022 Google LLC. - * Copyright (c) 2023 NXP - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ContactSensorManager.h" - -#include "AppTask.h" -#include "FreeRTOS.h" - -#include "app_config.h" - -ContactSensorManager ContactSensorManager::sContactSensor; - -int ContactSensorManager::Init() -{ - int err = 0; - - mState = State::kContactOpened; - mCallbackStateChanged = nullptr; - - return err; -} - -void ContactSensorManager::SetCallback(CallbackStateChanged aCallbackStateChanged) -{ - mCallbackStateChanged = aCallbackStateChanged; -} - -bool ContactSensorManager::IsContactClosed() -{ - return mState == State::kContactClosed; -} - -void ContactSensorManager::InitiateAction(Action aAction) -{ - AppEvent event; - event.Type = AppEvent::kContact; - event.ContactEvent.Action = static_cast(aAction); - event.Handler = HandleAction; - GetAppTask().PostEvent(&event); -} - -void ContactSensorManager::HandleAction(void * aGenericEvent) -{ - AppEvent * event = static_cast(aGenericEvent); - Action action = static_cast(event->ContactEvent.Action); - // Change current state based on action: - // - if state is closed and action is signal lost, change state to opened - // - if state is opened and action is signal detected, change state to closed - // - else, the state/action combination does not change the state. - if (State::kContactClosed == sContactSensor.mState && Action::kSignalLost == action) - { - sContactSensor.mState = State::kContactOpened; - } - else if (State::kContactOpened == sContactSensor.mState && Action::kSignalDetected == action) - { - sContactSensor.mState = State::kContactClosed; - } - - if (sContactSensor.mCallbackStateChanged != nullptr) - { - sContactSensor.mCallbackStateChanged(sContactSensor.mState); - } - else - { - K32W_LOG("Callback for state change was not set. Please set an appropriate callback."); - } -} diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/main/ZclCallbacks.cpp b/examples/contact-sensor-app/nxp/k32w/k32w1/main/ZclCallbacks.cpp deleted file mode 100644 index e69daab9803d23..00000000000000 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/main/ZclCallbacks.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * - * Copyright (c) 2022-2023 Project CHIP Authors - * Copyright (c) 2023 NXP - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#include "AppTask.h" -#include "ContactSensorManager.h" - -#include -#include -#include -#include -#include -#include - -#if CONFIG_DIAG_LOGS_DEMO -#include "DiagnosticLogsProviderDelegateImpl.h" -#include -#endif - -using namespace ::chip; -using namespace ::chip::app; -using namespace ::chip::app::Clusters; -using namespace ::chip::app::Clusters::BooleanState; -#if CONFIG_DIAG_LOGS_DEMO -using namespace ::chip::app::Clusters::DiagnosticLogs; -#endif - -void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & path, uint8_t type, uint16_t size, uint8_t * value) -{ - ChipLogProgress(Zcl, "MatterPostAttributeChangeCallback, value:%d\n", *value); - if (path.mClusterId != BooleanState::Id) - { - ChipLogProgress(Zcl, "Unknown cluster ID: " ChipLogFormatMEI, ChipLogValueMEI(path.mClusterId)); - return; - } - - if (path.mAttributeId != BooleanState::Attributes::StateValue::Id) - { - ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(path.mAttributeId)); - return; - } - - AppTask & task = GetAppTask(); - // If the callback is called after the cluster attribute was changed due to pressing a button, - // set the sync value to false. Both LED and attribute were updated at this point. - // On the other hand, if the cluster attribute was changed due to a cluster command, - // forward the request to AppTask in order to update the LED state. - if (task.IsSyncClusterToButtonAction()) - { - task.SetSyncClusterToButtonAction(false); - } - else - { - task.PostContactActionRequest(*value ? ContactSensorManager::Action::kSignalDetected - : ContactSensorManager::Action::kSignalLost); - } -} - -/** @brief OnOff Cluster Init - * - * This function is called when a specific cluster is initialized. It gives the - * application an opportunity to take care of cluster initialization procedures. - * It is called exactly once for each endpoint where cluster is present. - * - * @param endpoint Ver.: always - * - * TODO Issue #3841 - * emberAfOnOffClusterInitCallback happens before the stack initialize the cluster - * attributes to the default value. - * The logic here expects something similar to the deprecated Plugins callback - * emberAfPluginOnOffClusterServerPostInitCallback. - * - */ -void emberAfBooleanStateClusterInitCallback(EndpointId endpoint) -{ - ChipLogProgress(Zcl, "emberAfBooleanStateClusterInitCallback\n"); - GetAppTask().UpdateClusterState(); -} - -void logBooleanStateEvent(bool state) -{ - EventNumber eventNumber; - Events::StateChange::Type event{ state }; - if (CHIP_NO_ERROR != LogEvent(event, 1, eventNumber)) - { - ChipLogProgress(Zcl, "booleanstate: failed to reacord state-change event"); - } -} - -#if CONFIG_DIAG_LOGS_DEMO -void emberAfDiagnosticLogsClusterInitCallback(chip::EndpointId endpoint) -{ - auto & logProvider = LogProvider::GetInstance(); - DiagnosticLogsServer::Instance().SetDiagnosticLogsProviderDelegate(endpoint, &logProvider); -} -#endif diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/AppEvent.h b/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/AppEvent.h deleted file mode 100644 index f3e0d729abe2e7..00000000000000 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/AppEvent.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * - * Copyright (c) 2022 Nest Labs, Inc. - * Copyright (c) 2023 NXP - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -struct AppEvent; -typedef void (*EventHandler)(void *); - -struct AppEvent -{ - enum AppEventTypes - { - kButton = 0, - kTimer, - kContact, - kInstall, -#if defined(chip_with_low_power) && (chip_with_low_power == 1) - kEventType_Lp, -#endif - kOTAResume, - }; - - AppEventTypes Type; - - union - { - struct - { - uint8_t PinNo; - uint8_t Action; - } ButtonEvent; - struct - { - void * Context; - } TimerEvent; - struct - { - uint8_t Action; - } ContactEvent; - }; - - EventHandler Handler; - -#if defined(chip_with_low_power) && (chip_with_low_power == 1) - void * param; -#endif -}; 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 deleted file mode 100644 index 64842e310561b2..00000000000000 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/AppTask.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * - * Copyright (c) 2022 Google LLC. - * Copyright (c) 2023 NXP - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "AppEvent.h" -#include "ContactSensorManager.h" - -#include "CHIPProjectConfig.h" - -#include -#include - -#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA -#include -#endif - -#include "FreeRTOS.h" -#include "fsl_component_button.h" -#include "fsl_pm_core.h" -#include "timers.h" - -// Application-defined error codes in the CHIP_ERROR space. -#define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) -#define APP_ERROR_CREATE_TASK_FAILED CHIP_APPLICATION_ERROR(0x02) -#define APP_ERROR_UNHANDLED_EVENT CHIP_APPLICATION_ERROR(0x03) -#define APP_ERROR_CREATE_TIMER_FAILED CHIP_APPLICATION_ERROR(0x04) -#define APP_ERROR_START_TIMER_FAILED CHIP_APPLICATION_ERROR(0x05) -#define APP_ERROR_STOP_TIMER_FAILED CHIP_APPLICATION_ERROR(0x06) -#define APP_ERROR_PM_REGISTER_LP_CALLBACK_FAILED CHIP_APPLICATION_ERROR(0x07) - -class AppTask -{ -public: -#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA - using FactoryDataProvider = chip::DeviceLayer::FactoryDataProviderImpl; -#endif - CHIP_ERROR StartAppTask(); - static void AppTaskMain(void * pvParameter); - - void PostContactActionRequest(ContactSensorManager::Action aAction); - void PostEvent(const AppEvent * event); - - void UpdateClusterState(void); - void UpdateDeviceState(void); - - bool IsSyncClusterToButtonAction(); - void SetSyncClusterToButtonAction(bool value); - // Identify cluster callbacks. - static void OnIdentifyStart(Identify * identify); - static void OnIdentifyStop(Identify * identify); - - static status_t LowPowerCallback(pm_event_type_t eventType, uint8_t powerState, void * data); - -private: - friend AppTask & GetAppTask(void); - - CHIP_ERROR Init(); - - static void OnStateChanged(ContactSensorManager::State aState); - - void CancelTimer(void); - - void DispatchEvent(AppEvent * event); - - static void FunctionTimerEventHandler(void * aGenericEvent); - static button_status_t KBD_Callback(void * buttonHandle, button_callback_message_t * message, void * callbackParam); - static void HandleKeyboard(void); - static void SoftResetHandler(void * aGenericEvent); - static void BleHandler(void * aGenericEvent); - static void BleStartAdvertising(intptr_t arg); - 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); - - static void MatterEventHandler(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg); - - void StartTimer(uint32_t aTimeoutInMs); - -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - static void InitOTA(intptr_t arg); -#endif - - static void UpdateClusterStateInternal(intptr_t arg); - static void UpdateDeviceStateInternal(intptr_t arg); - static void InitServer(intptr_t arg); - static void PrintOnboardingInfo(); - - enum class Function : uint8_t - { - kNoneSelected = 0, - kFactoryReset, - kContact, - kIdentify, - kInvalid - }; - - Function mFunction = Function::kNoneSelected; - bool mResetTimerActive = false; - bool mSyncClusterToButtonAction = false; - - static AppTask sAppTask; -}; - -inline AppTask & GetAppTask(void) -{ - return AppTask::sAppTask; -} - -inline bool AppTask::IsSyncClusterToButtonAction() -{ - return mSyncClusterToButtonAction; -} - -inline void AppTask::SetSyncClusterToButtonAction(bool value) -{ - mSyncClusterToButtonAction = value; -} diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/ContactSensorManager.h b/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/ContactSensorManager.h deleted file mode 100644 index 69a71ee14ee344..00000000000000 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/ContactSensorManager.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * - * Copyright (c) 2022 Google LLC. - * Copyright (c) 2023 NXP - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "AppEvent.h" - -#include "FreeRTOS.h" -#include "timers.h" // provides FreeRTOS timer support - -class ContactSensorManager -{ -public: - enum class Action : uint8_t - { - kSignalDetected = 0, - kSignalLost, - kInvalid - }; - - enum class State : uint8_t - { - kContactClosed = 0, - kContactOpened, - kInvalid - }; - - int Init(); - bool IsContactClosed(); - void InitiateAction(Action aAction); - - typedef void (*CallbackStateChanged)(State aState); - void SetCallback(CallbackStateChanged aCallbackStateChanged); - - static void HandleAction(void * aGenericEvent); - -private: - friend ContactSensorManager & ContactSensorMgr(void); - State mState; - CallbackStateChanged mCallbackStateChanged; - static ContactSensorManager sContactSensor; -}; - -inline ContactSensorManager & ContactSensorMgr(void) -{ - return ContactSensorManager::sContactSensor; -} 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 deleted file mode 100644 index 7001f636dbd0d7..00000000000000 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/main/include/app_config.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * - * Copyright (c) 2022 Google LLC. - * Copyright (c) 2023 NXP - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -// ---- Contact Example App Config ---- - -#define RESET_BUTTON 1 -#define CONTACT_SENSOR_BUTTON 2 -#define SOFT_RESET_BUTTON 3 -#define BLE_BUTTON 4 - -#define RESET_BUTTON_PUSH 1 -#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 - -#define CONTACT_SENSOR_STATE_LED 1 -#define SYSTEM_STATE_LED 0 - -// ---- Contact Example SWU Config ---- -#define SWU_INTERVAl_WINDOW_MIN_MS (23 * 60 * 60 * 1000) // 23 hours -#define SWU_INTERVAl_WINDOW_MAX_MS (24 * 60 * 60 * 1000) // 24 hours - -// ---- Thread Polling Config ---- -// #define THREAD_ACTIVE_POLLING_INTERVAL_MS 100 -// #define THREAD_INACTIVE_POLLING_INTERVAL_MS 1000 - -#if K32W_LOG_ENABLED -#define K32W_LOG(...) otPlatLog(OT_LOG_LEVEL_NONE, OT_LOG_REGION_API, ##__VA_ARGS__); -#else -#define K32W_LOG(...) -#endif diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/main/main.cpp b/examples/contact-sensor-app/nxp/k32w/k32w1/main/main.cpp deleted file mode 100644 index 700bbc5ad9356c..00000000000000 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/main/main.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * - * Copyright (c) 2022 Google LLC. - * Copyright (c) 2023 NXP - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ================================================================================ -// Main Code -// ================================================================================ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "FreeRtosHooks.h" -#include "app_config.h" -#include "openthread/platform/logging.h" - -using namespace ::chip; -using namespace ::chip::Inet; -using namespace ::chip::DeviceLayer; -using namespace ::chip::Logging; - -#include - -typedef void (*InitFunc)(void); -extern InitFunc __init_array_start; -extern InitFunc __init_array_end; - -extern "C" void main_task(void const * argument) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - /* Call C++ constructors */ - InitFunc * pFunc = &__init_array_start; - for (; pFunc < &__init_array_end; ++pFunc) - { - (*pFunc)(); - } - - mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree); - - err = PlatformMgrImpl().InitBoardFwk(); - if (err != CHIP_NO_ERROR) - { - return; - } - - /* Used for HW initializations */ - otSysInit(0, NULL); - - if (err != CHIP_NO_ERROR) - { - return; - } - - K32W_LOG("Welcome to NXP Contact Sensor Demo App"); - - /* Mbedtls Threading support is needed because both - * Thread and Matter tasks are using it */ - freertos_mbedtls_mutex_init(); - - // Init Chip memory management before the stack - chip::Platform::MemoryInit(); - - err = PlatformMgr().InitChipStack(); - if (err != CHIP_NO_ERROR) - { - K32W_LOG("Error during PlatformMgr().InitMatterStack()"); - goto exit; - } - - err = ThreadStackMgr().InitThreadStack(); - if (err != CHIP_NO_ERROR) - { - K32W_LOG("Error during ThreadStackMgr().InitThreadStack()"); - goto exit; - } - - err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); - if (err != CHIP_NO_ERROR) - { - goto exit; - } - - // Start OpenThread task - err = ThreadStackMgrImpl().StartThreadTask(); - if (err != CHIP_NO_ERROR) - { - K32W_LOG("Error during ThreadStackMgrImpl().StartThreadTask()"); - goto exit; - } - - err = GetAppTask().StartAppTask(); - if (err != CHIP_NO_ERROR) - { - K32W_LOG("Error during GetAppTask().StartAppTask()"); - goto exit; - } - - err = PlatformMgr().StartEventLoopTask(); - if (err != CHIP_NO_ERROR) - { - K32W_LOG("Error during PlatformMgr().StartEventLoopTask();"); - goto exit; - } - - GetAppTask().AppTaskMain(NULL); - -exit: - return; -} - -/** - * Glue function called directly by the OpenThread stack - * when system event processing work is pending. - */ -extern "C" void otSysEventSignalPending(void) -{ - BaseType_t yieldRequired = ThreadStackMgrImpl().SignalThreadActivityPendingFromISR(); - portYIELD_FROM_ISR(yieldRequired); -} diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/third_party/connectedhomeip b/examples/contact-sensor-app/nxp/k32w/k32w1/third_party/connectedhomeip deleted file mode 120000 index 305f2077ffe860..00000000000000 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/third_party/connectedhomeip +++ /dev/null @@ -1 +0,0 @@ -../../../../../.. \ No newline at end of file diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/.gn b/examples/contact-sensor-app/nxp/k32w1/.gn similarity index 93% rename from examples/contact-sensor-app/nxp/k32w/k32w1/.gn rename to examples/contact-sensor-app/nxp/k32w1/.gn index 1e848295f6aa5b..885f306753076d 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/.gn +++ b/examples/contact-sensor-app/nxp/k32w1/.gn @@ -28,5 +28,5 @@ default_args = { import("//args.gni") # Import default platform configs - import("${chip_root}/src/platform/nxp/k32w/k32w1/args.gni") + import("${chip_root}/src/platform/nxp/k32w1/args.gni") } diff --git a/examples/contact-sensor-app/nxp/k32w1/BUILD.gn b/examples/contact-sensor-app/nxp/k32w1/BUILD.gn new file mode 100644 index 00000000000000..119dc5cf722eac --- /dev/null +++ b/examples/contact-sensor-app/nxp/k32w1/BUILD.gn @@ -0,0 +1,261 @@ +# Copyright (c) 2021-2023 Project CHIP Authors +# Copyright (c) 2023 NXP +# +# 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("//build_overrides/nxp_sdk.gni") +import("//build_overrides/openthread.gni") + +import("${nxp_sdk_build_root}/nxp_sdk.gni") + +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/platform/device.gni") +import("${chip_root}/src/platform/nxp/${nxp_platform}/args.gni") + +declare_args() { + # Setup discriminator as argument + setup_discriminator = 3840 + chip_with_diag_logs_demo = true +} + +assert(current_os == "freertos") +assert(target_os == "freertos") + +example_platform_dir = "${chip_root}/examples/platform/nxp/${nxp_platform}" +common_example_dir = "${chip_root}/examples/platform/nxp/common" + +k32w1_sdk("sdk") { + defines = [] + include_dirs = [] + sources = [] + + # Indicate the path to CHIPProjectConfig.h + include_dirs += [ "include/config" ] + + # Indicate the default path to FreeRTOSConfig.h + include_dirs += [ "${example_platform_dir}/app/project_include/freeRTOS" ] + + # Indicate the default path to OpenThreadConfig.h + include_dirs += [ "${example_platform_dir}/app/project_include/openthread" ] + + include_dirs += [ + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/K32W1480", + ] + + sources += [ + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/K32W1480/clock_config.c", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/K32W1480/pin_mux.c", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/app_services_init.c", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board.c", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_comp.c", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_dcdc.c", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_extflash.c", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_lp.c", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/hardware_init.c", + ] + + if (is_debug) { + defines += [ "BUILD_RELEASE=0" ] + } else { + defines += [ "BUILD_RELEASE=1" ] + } + + defines += [ + "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setup_discriminator}", + ] + + if (chip_key_storage == "littlefs") { + include_dirs += [ "${example_platform_dir}/board" ] + sources += [ + "${example_platform_dir}/board/peripherals.c", + "${example_platform_dir}/board/peripherals.h", + ] + } +} + +k32w1_executable("contact_sensor_app") { + output_name = "chip-k32w1-contact-example" + + defines = [] + deps = [] + include_dirs = [] + sources = [] + + # Defines used by common code + defines += [ + "CONFIG_NET_L2_OPENTHREAD=1", + "CONFIG_NETWORK_LAYER_BLE=1", + "CONFIG_THREAD_DEVICE_TYPE=kThreadDeviceType_SleepyEndDevice", + "CONFIG_OPERATIONAL_KEYSTORE=1", + "EXTERNAL_FACTORY_DATA_PROVIDER_HEADER=\"platform/nxp/common/legacy/FactoryDataProvider.h\"", + ] + + if (chip_with_diag_logs_demo) { + defines += [ "CONFIG_DIAG_LOGS_DEMO=1" ] + } + + if (chip_with_low_power == 1) { + defines += [ "CONFIG_LOW_POWER=1" ] + } else { + defines += [ + "CONFIG_ENABLE_FEEDBACK=1", + "APP_QUEUE_TICKS_TO_WAIT=pdMS_TO_TICKS(10)", + ] + } + + # App common files + include_dirs += [ + "${common_example_dir}/app_task/include", + "${common_example_dir}/matter_button/include", + "${common_example_dir}/clusters/include", + "${common_example_dir}/device_callbacks/include", + "${common_example_dir}/device_manager/include", + "${common_example_dir}/diagnostic_logs/include", + "${common_example_dir}/factory_data/include", + "${common_example_dir}/led_widget/include", + "${common_example_dir}/low_power/include", + "${common_example_dir}/operational_keystore/include", + "${common_example_dir}/ui_feedback/include", + ] + + sources += [ + "${common_example_dir}/app_task/source/AppTaskBase.cpp", + "${common_example_dir}/app_task/source/AppTaskFreeRTOS.cpp", + "${common_example_dir}/clusters/source/ZclCallbacks.cpp", + "${common_example_dir}/device_callbacks/source/CommonDeviceCallbacks.cpp", + "${common_example_dir}/device_manager/source/CHIPDeviceManager.cpp", + "${example_platform_dir}/factory_data/source/AppFactoryDataExample.cpp", + ] + + if (chip_with_low_power == 1) { + sources += [ "${common_example_dir}/low_power/source/LowPower.cpp" ] + } + + if (chip_with_factory_data == 1) { + include_dirs += [ "${chip_root}/src/platform/nxp/common/legacy" ] + deps += [ "${chip_root}/src/platform/nxp:nxp_factory_data" ] + } + + if (chip_enable_ota_requestor) { + defines += [ + "CONFIG_CHIP_OTA_IMAGE_PROCESSOR_HEADER=\"platform/nxp/common/legacy/OTAImageProcessorImpl.h\"", + + # The status LED and the external flash CS pin are wired together. The OTA image writing may fail if used together. + "LED_MANAGER_ENABLE_STATUS_LED=0", + ] + + include_dirs += [ "${common_example_dir}/ota_requestor/include" ] + sources += [ "${common_example_dir}/ota_requestor/source/OTARequestorInitiatorMultiImage.cpp" ] + deps += [ "${chip_root}/src/platform/nxp:nxp_ota" ] + } + + if (chip_with_diag_logs_demo) { + sources += [ + "${common_example_dir}/diagnostic_logs/source/DiagnosticLogsDemo.cpp", + "${common_example_dir}/diagnostic_logs/source/DiagnosticLogsProviderDelegateImpl.cpp", + ] + } + + # Platform specific files + include_dirs += [ + "${example_platform_dir}/util", + "${example_platform_dir}/app/support", + "${example_platform_dir}/button", + ] + + sources += [ + "${example_platform_dir}/button/ButtonManager.cpp", + "${example_platform_dir}/clusters/Identify.cpp", + "${example_platform_dir}/operational_keystore/OperationalKeystore.cpp", + ] + + if (chip_enable_ota_requestor) { + sources += [ "${example_platform_dir}/ota/OtaUtils.cpp" ] + } + + include_dirs += [ + "include/config", + "../common/include", + ] + + sources += [ + "../common/AppTask.cpp", + "../common/DeviceCallbacks.cpp", + "../common/ZclCallbacks.cpp", + "../common/main.cpp", + ] + + if (chip_with_low_power == 0) { + sources += [ + "${common_example_dir}/ui_feedback/source/LedManager.cpp", + "${example_platform_dir}/util/LedOnOff.cpp", + ] + } + + deps += [ + "${chip_root}/examples/providers:device_info_provider", + "${chip_root}/src/platform/logging:default", + ] + + #lit and sit are using different zap files + if (chip_enable_icd_lit) { + deps += [ "${chip_root}/examples/contact-sensor-app/nxp/zap-lit/" ] + } else { + deps += [ "${chip_root}/examples/contact-sensor-app/nxp/zap-sit/" ] + } + + if (chip_openthread_ftd) { + deps += [ + "${openthread_root}:libopenthread-cli-ftd", + "${openthread_root}:libopenthread-ftd", + ] + } else { + deps += [ + "${openthread_root}:libopenthread-cli-mtd", + "${openthread_root}:libopenthread-mtd", + ] + } + + cflags = [ "-Wconversion" ] + + ldscript = "${k32w1_sdk_root}/middleware/wireless/framework/Common/devices/kw45_k32w1/gcc/connectivity.ld" + + inputs = [ ldscript ] + + ldflags = [ + "-Wl,--defsym=__heap_size__=0", + "-Wl,--defsym=__stack_size__=0x480", + "-Wl,--defsym=lp_ram_lower_limit=0x04000000", + "-Wl,--defsym=lp_ram_upper_limit=0x2001C000", + "-Wl,-print-memory-usage", + "-Wl,--no-warn-rwx-segments", + "-T" + rebase_path(ldscript, root_build_dir), + ] + + if (chip_with_factory_data == 1) { + ldflags += [ "-Wl,--defsym=gUseFactoryData_d=1" ] + } + + output_dir = root_out_dir +} + +group("default") { + deps = [ ":contact_sensor_app" ] +} diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/README.md b/examples/contact-sensor-app/nxp/k32w1/README.md similarity index 83% rename from examples/contact-sensor-app/nxp/k32w/k32w1/README.md rename to examples/contact-sensor-app/nxp/k32w1/README.md index f3896a01b8362e..7a70f746f6e445 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/README.md +++ b/examples/contact-sensor-app/nxp/k32w1/README.md @@ -14,29 +14,29 @@ into an existing Matter network and can be controlled by this network.
- [Matter K32W1 Contact Sensor Example Application](#matter-k32w1-contact-sensor-example-application) -- [Introduction](#introduction) - - [Bluetooth LE Advertising](#bluetooth-le-advertising) - - [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) - - [Flashing the host image](#flashing-the-host-image) -- [Debugging](#debugging) -- [OTA](#ota) - - [Convert srec into sb3 file](#convert-srec-into-sb3-file) - - [Convert sb3 into ota file](#convert-sb3-into-ota-file) - - [Running OTA](#running-ota) - - [Known issues](#known-issues) -- [Low power](#low-power) - - + - [Introduction](#introduction) + - [Bluetooth LE Advertising](#bluetooth-le-advertising) + - [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous) + - [Thread Provisioning](#thread-provisioning) + - [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) + - [Flashing the host image](#flashing-the-host-image) + - [Debugging](#debugging) + - [OTA](#ota) + - [Convert `srec` into `sb3` file](#convert-srec-into-sb3-file) + - [Convert `sb3` into `ota` file](#convert-sb3-into-ota-file) + - [OTA factory data](#ota-factory-data) + - [Running OTA](#running-ota) + - [Low power](#low-power) + - [Known issues](#known-issues) ## Introduction -![K32W1 EVK](../../../../platform/nxp/k32w/k32w1/doc/images/k32w1-evk.jpg) +![K32W1 EVK](../../../platform/nxp/k32w1/doc/images/k32w1-evk.jpg) The K32W1 contact sensor example application provides a working demonstration of a connected contact sensor device, built using the Matter codebase and the NXP @@ -118,23 +118,50 @@ Matter shutdown procedure. ## Building -In order to build the Matter example, we recommend using a Linux distribution -(the demo-application was compiled on Ubuntu 20.04). +In order to build the Project CHIP example, we recommend using a Linux +distribution. Supported Operating Systems and prerequisites are listed in +[BUILDING](../../../../docs/guides/BUILDING.md). -- Download [K32W1 SDK for Matter](https://mcuxpresso.nxp.com/). Creating an - nxp.com account is required before being able to download the SDK. Once the - account is created, login and follow the steps for downloading K32W1 SDK. - The SDK Builder UI selection should be similar with the one from the image - below. - ![MCUXpresso SDK Download](../../../../platform/nxp/k32w/k32w1/doc/images/mcux-sdk-download.jpg) +- Make sure that below prerequisites are correctly installed + +``` +sudo apt-get install git gcc g++ pkg-config libssl-dev libdbus-1-dev \ + libglib2.0-dev libavahi-client-dev ninja-build python3-venv python3-dev \ + python3-pip unzip libgirepository1.0-dev libcairo2-dev libreadline-dev +``` + +- Step 1: checkout NXP specific submodules only ``` -user@ubuntu:~/Desktop/git/connectedhomeip$ export NXP_K32W1_SDK_ROOT=/home/user/Desktop/SDK_K32W1/ -user@ubuntu:~/Desktop/git/connectedhomeip$ source ./scripts/activate.sh user@ubuntu:~/Desktop/git/connectedhomeip$ scripts/checkout_submodules.py --shallow --platform nxp --recursive -user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/contact-sensor-app/nxp/k32w/k32w1 -user@ubuntu:~/Desktop/git/connectedhomeip/examples/contact-sensor-app/nxp/k32w/k32w1$ gn gen out/debug -user@ubuntu:~/Desktop/git/connectedhomeip/examples/contact-sensor-app/nxp/k32w/k32w1$ ninja -C out/debug +``` + +- Step 2: activate local environment + +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ source scripts/activate.sh +``` + +If the script says the environment is out of date, you can update it by running +the following command: + +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ source scripts/bootstrap.sh +``` + +- Step 3: Init NXP SDK(s) + +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ scripts/setup/nxp/update_nxp_sdk.py --platform common_sdk +``` + +Note: By default setup/nxp/update_nxp_sdk.py will try to initialize all NXP +SDKs. Arg "-- help" could be used to view all available options. + +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/contact-sensor-app/nxp/k32w1 +user@ubuntu:~/Desktop/git/connectedhomeip/examples/contact-sensor-app/nxp/k32w1$ gn gen out/debug +user@ubuntu:~/Desktop/git/connectedhomeip/examples/contact-sensor-app/nxp/k32w1$ ninja -C out/debug ``` In case that Openthread CLI is needed, chip_with_ot_cli build argument must be @@ -185,7 +212,7 @@ using Fibonacci backoff for retries pacing. Use `chip_with_factory_data=1` in the gn build command to enable factory data. For a full guide on manufacturing flow, please see -[Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp/nxp_manufacturing_flow.md). +[Guide for writing manufacturing data on NXP devices](../../../../docs/guides/nxp/nxp_manufacturing_flow.md). ## Flashing @@ -248,7 +275,7 @@ One option for debugging would be to use MCUXpresso IDE. - Drag-and-drop the zip file containing the NXP SDK in the "Installed SDKs" tab: -![Installed SDKs](../../../../platform/nxp/k32w/k32w1/doc/images/installed_sdks.jpg) +![Installed SDKs](../../../platform/nxp/k32w1/doc/images/installed_sdks.jpg) - Import any demo application from the installed SDK: @@ -256,7 +283,7 @@ One option for debugging would be to use MCUXpresso IDE. Import SDK example(s).. -> choose a demo app (demo_apps -> hello_world) -> Finish ``` -![Import demo](../../../../platform/nxp/k32w/k32w1/doc/images/import_demo.jpg) +![Import demo](../../../platform/nxp/k32w1/doc/images/import_demo.jpg) - Flash the previously imported demo application on the board: @@ -275,7 +302,7 @@ resulted after ot-nxp compilation. File -> Import -> C/C++ -> Existing Code as Makefile Project ``` -![New Project](../../../../platform/nxp/k32w/k32w1/doc/images/new_project.jpg) +![New Project](../../../platform/nxp/k32w1/doc/images/new_project.jpg) - Replace the path of the existing demo application with the path of the K32W1 application: @@ -284,7 +311,7 @@ File -> Import -> C/C++ -> Existing Code as Makefile Project Run -> Debug Configurations... -> C/C++ Application ``` -![Debug K32W1](../../../../platform/nxp/k32w/k32w1/doc/images/debug_k32w1.jpg) +![Debug K32W1](../../../platform/nxp/k32w1/doc/images/debug_k32w1.jpg) ## OTA @@ -312,16 +339,21 @@ In `OTAP` application In order to build an OTA image, use NXP wrapper over the standard tool `src/app/ota_image_tool.py`: -- `scripts/tools/nxp/factory_data_generator/ota_image_tool.py` The tool can be - used to generate an OTA image with the following format: - `| OTA image header | TLV1 | TLV2 | ... | TLVn |` where each TLV is in the - form `|tag|length|value|` +- `scripts/tools/nxp/factory_data_generator/ota_image_tool.py`. + +The tool can be used to generate an OTA image with the following format: + +``` + | OTA image header | TLV1 | TLV2 | ... | TLVn | +``` + +where each TLV is in the form `|tag|length|value|`. Note that "standard" TLV format is used. Matter TLV format is only used for factory data TLV value. Please see more in the -[OTA image tool guide](../../../../../scripts/tools/nxp/ota/README.md). +[OTA image tool guide](../../../../scripts/tools/nxp/ota/README.md). Here is an example that generates an OTA image with application update TLV from a `sb3` file: @@ -338,12 +370,24 @@ having a correct OTA process, the OTA header version should be the same as the binary embedded software version. A user can set a custom software version in the gn build args by setting `chip_software_version` to the wanted version. +### OTA factory data + +A user can update the factory data through OTA, at the same time the application +firmware is updated by enabling the following processor in the `gn args`: + +- `chip_enable_ota_factory_data_processor=1` to enable default factory data + update processor (disabled by default). + +The OTA image used must be updated to include the new factory data. + +[OTA image tool guide](../../../../scripts/tools/nxp/ota/README.md). + ### Running OTA The OTA topology used for OTA testing is illustrated in the figure below. Topology is similar with the one used for Matter Test Events. -![OTA_TOPOLOGY](../../../../platform/nxp/k32w/k32w1/doc/images/ota_topology.JPG) +![OTA_TOPOLOGY](../../../platform/nxp/k32w1/doc/images/ota_topology.JPG) The concept for OTA is the next one: diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/args.gni b/examples/contact-sensor-app/nxp/k32w1/args.gni similarity index 84% rename from examples/contact-sensor-app/nxp/k32w/k32w1/args.gni rename to examples/contact-sensor-app/nxp/k32w1/args.gni index 23e6730b79045c..cb952c94bd74d1 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/args.gni +++ b/examples/contact-sensor-app/nxp/k32w1/args.gni @@ -17,12 +17,17 @@ import("//build_overrides/chip.gni") import("${chip_root}/config/standalone/args.gni") # SDK target. This is overridden to add our SDK app_config.h & defines. -k32w1_sdk_target = get_label_info(":sdk", "label_no_toolchain") +nxp_sdk_target = get_label_info(":sdk", "label_no_toolchain") +nxp_device = "K32W1480" chip_enable_ota_requestor = true chip_stack_lock_tracking = "fatal" chip_enable_ble = true +chip_system_config_provide_statistics = false +chip_system_config_use_open_thread_inet_endpoints = true +chip_with_lwip = false + chip_enable_icd_server = true chip_enable_icd_lit = false icd_enforce_sit_slow_poll_limit = true diff --git a/examples/contact-sensor-app/nxp/k32w1/build_overrides b/examples/contact-sensor-app/nxp/k32w1/build_overrides new file mode 120000 index 00000000000000..ee19c065d619a2 --- /dev/null +++ b/examples/contact-sensor-app/nxp/k32w1/build_overrides @@ -0,0 +1 @@ +../../../build_overrides/ \ No newline at end of file diff --git a/examples/contact-sensor-app/nxp/k32w1/include/config/AppConfig.h b/examples/contact-sensor-app/nxp/k32w1/include/config/AppConfig.h new file mode 100644 index 00000000000000..0c8019d8e7e33c --- /dev/null +++ b/examples/contact-sensor-app/nxp/k32w1/include/config/AppConfig.h @@ -0,0 +1,29 @@ +/* + * Copyright 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +/* ---- App Config ---- */ +#define APP_DEVICE_TYPE_ENDPOINT 1 +#define APP_CLUSTER_ATTRIBUTE chip::app::Clusters::BooleanState::Attributes::StateValue + +/* ---- Button Manager Config ---- */ +#define BUTTON_MANAGER_FACTORY_RESET_TIMEOUT_MS 6000 + +/* ---- LED Manager Config ---- */ +#define LED_MANAGER_STATUS_LED_INDEX 0 +#define LED_MANAGER_LIGHT_LED_INDEX 1 diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h b/examples/contact-sensor-app/nxp/k32w1/include/config/CHIPProjectConfig.h similarity index 98% rename from examples/contact-sensor-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h rename to examples/contact-sensor-app/nxp/k32w1/include/config/CHIPProjectConfig.h index 0d9a4e3b503bee..a16c1bb8b3341c 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h +++ b/examples/contact-sensor-app/nxp/k32w1/include/config/CHIPProjectConfig.h @@ -192,6 +192,13 @@ #define CHIP_DEVICE_CONFIG_ENABLE_SED 1 +/** + * @def CHIP_DEVICE_CONFIG_KVS_WEAR_STATS + * + * @brief Toggle support for key value store wear stats on or off. + */ +#define CHIP_DEVICE_CONFIG_KVS_WEAR_STATS 1 + /** * @def CHIP_IM_MAX_NUM_COMMAND_HANDLER * diff --git a/examples/contact-sensor-app/nxp/k32w1/third_party/connectedhomeip b/examples/contact-sensor-app/nxp/k32w1/third_party/connectedhomeip new file mode 120000 index 00000000000000..59307833b4fee9 --- /dev/null +++ b/examples/contact-sensor-app/nxp/k32w1/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../../.. \ No newline at end of file diff --git a/examples/lighting-app/nxp/common/AppTask.cpp b/examples/lighting-app/nxp/common/AppTask.cpp new file mode 100644 index 00000000000000..6bca4669760c2a --- /dev/null +++ b/examples/lighting-app/nxp/common/AppTask.cpp @@ -0,0 +1,37 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "AppTask.h" + +#include + +void LightingApp::AppTask::PreInitMatterStack() +{ + ChipLogProgress(DeviceLayer, "Welcome to NXP Lighting Demo App"); +} + +LightingApp::AppTask & LightingApp::AppTask::GetDefaultInstance() +{ + static LightingApp::AppTask sAppTask; + return sAppTask; +} + +chip::NXP::App::AppTaskBase & chip::NXP::App::GetAppTask() +{ + return LightingApp::AppTask::GetDefaultInstance(); +} diff --git a/examples/lighting-app/nxp/k32w/k32w1/main/ZclCallbacks.cpp b/examples/lighting-app/nxp/common/DeviceCallbacks.cpp similarity index 51% rename from examples/lighting-app/nxp/k32w/k32w1/main/ZclCallbacks.cpp rename to examples/lighting-app/nxp/common/DeviceCallbacks.cpp index 97a3fb9aa72a98..140cdffb9febe2 100644 --- a/examples/lighting-app/nxp/k32w/k32w1/main/ZclCallbacks.cpp +++ b/examples/lighting-app/nxp/common/DeviceCallbacks.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,59 +18,72 @@ #include -#include "AppTask.h" -#include "LightingManager.h" +#include "DeviceCallbacks.h" +#if CONFIG_ENABLE_FEEDBACK +#include "UserInterfaceFeedback.h" +#endif #include #include -#include -#include using namespace ::chip; using namespace ::chip::app::Clusters; -void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & path, uint8_t type, uint16_t size, uint8_t * value) +void LightingApp::DeviceCallbacks::PostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, + chip::AttributeId attributeId, uint8_t type, uint16_t size, + uint8_t * value) { - if (path.mClusterId == OnOff::Id) + if (clusterId == OnOff::Id) { - if (path.mAttributeId != OnOff::Attributes::OnOff::Id) + if (attributeId != OnOff::Attributes::OnOff::Id) { - ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(path.mAttributeId)); + ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId)); return; } - - LightingMgr().InitiateAction(0, *value ? LightingManager::TURNON_ACTION : LightingManager::TURNOFF_ACTION, *value); +#if CONFIG_ENABLE_FEEDBACK + FeedbackMgr().RestoreState(); +#endif } - else if (path.mClusterId == LevelControl::Id) + else if (clusterId == LevelControl::Id) { - if (path.mAttributeId != LevelControl::Attributes::CurrentLevel::Id) + if (attributeId != LevelControl::Attributes::CurrentLevel::Id) { - ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(path.mAttributeId)); + ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId)); return; } - +#if LIGHTING_MANAGER_ENABLE_DIMMABLE_LED if (*value > 1 && *value < 254) { ChipLogProgress(Zcl, "Setting value: %d", *value); - LightingMgr().InitiateAction(0, LightingManager::DIM_ACTION, *value); + // The cluster attribute value will be read in RestoreState and the proper action will be taken: e.g. ApplyDim. +#if CONFIG_ENABLE_FEEDBACK + FeedbackMgr().RestoreState(); +#endif } +#endif } - else if (path.mClusterId == ColorControl::Id) + else if (clusterId == ColorControl::Id) { ChipLogProgress(Zcl, "Color Control attribute ID: " ChipLogFormatMEI " Type: %u Value: %u, length %u", - ChipLogValueMEI(path.mAttributeId), type, *value, size); + ChipLogValueMEI(attributeId), type, *value, size); // WIP Apply attribute change to Light } - else if (path.mClusterId == OnOffSwitchConfiguration::Id) + else if (clusterId == OnOffSwitchConfiguration::Id) { ChipLogProgress(Zcl, "OnOff Switch Configuration attribute ID: " ChipLogFormatMEI " Type: %u Value: %u, length %u", - ChipLogValueMEI(path.mAttributeId), type, *value, size); + ChipLogValueMEI(attributeId), type, *value, size); // WIP Apply attribute change to Light } else { - ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(path.mAttributeId)); + ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId)); } } + +chip::DeviceManager::CHIPDeviceManagerCallbacks & chip::NXP::App::GetDeviceCallbacks() +{ + static LightingApp::DeviceCallbacks sDeviceCallbacks; + return sDeviceCallbacks; +} diff --git a/src/platform/nxp/k32w/k32w1/DefaultTestEventTriggerDelegate.h b/examples/lighting-app/nxp/common/include/AppEvent.h similarity index 60% rename from src/platform/nxp/k32w/k32w1/DefaultTestEventTriggerDelegate.h rename to examples/lighting-app/nxp/common/include/AppEvent.h index 0bfd4c5b0fa725..b292afaddf8c18 100644 --- a/src/platform/nxp/k32w/k32w1/DefaultTestEventTriggerDelegate.h +++ b/examples/lighting-app/nxp/common/include/AppEvent.h @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2022 Project CHIP Authors + * Copyright (c) 2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,19 +18,10 @@ #pragma once -#include +struct AppEvent; +typedef void (*EventHandler)(const AppEvent &); -namespace chip { - -class DefaultTestEventTriggerDelegate : public TestEventTriggerDelegate +struct AppEvent { -public: - explicit DefaultTestEventTriggerDelegate(const ByteSpan & enableKey) : mEnableKey(enableKey) {} - - bool DoesEnableKeyMatch(const ByteSpan & enableKey) const override; - -private: - ByteSpan mEnableKey; + EventHandler Handler; }; - -} // namespace chip diff --git a/examples/lighting-app/nxp/common/include/AppTask.h b/examples/lighting-app/nxp/common/include/AppTask.h new file mode 100644 index 00000000000000..9f73d340f35957 --- /dev/null +++ b/examples/lighting-app/nxp/common/include/AppTask.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "AppConfig.h" +#include "AppTaskFreeRTOS.h" + +#include + +namespace LightingApp { + +class AppTask : public chip::NXP::App::AppTaskFreeRTOS +{ +public: + // AppTaskFreeRTOS virtual methods + void PreInitMatterStack() override; + + // This returns an instance of this class. + static AppTask & GetDefaultInstance(); +}; + +} // namespace LightingApp + +/** + * Returns the application-specific implementation of the AppTaskBase object. + * + * Applications can use this to gain access to features of the AppTaskBase + * that are specific to the selected application. + */ +chip::NXP::App::AppTaskBase & GetAppTask(); diff --git a/examples/lighting-app/nxp/common/include/DeviceCallbacks.h b/examples/lighting-app/nxp/common/include/DeviceCallbacks.h new file mode 100644 index 00000000000000..555021b36ebb16 --- /dev/null +++ b/examples/lighting-app/nxp/common/include/DeviceCallbacks.h @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file DeviceCallbacks.h + * + * Lighting app implementation for the DeviceManager callbacks for all applications + * + **/ + +#pragma once + +#include "CHIPDeviceManager.h" +#include "CommonDeviceCallbacks.h" + +namespace LightingApp { + +class DeviceCallbacks : public chip::NXP::App::CommonDeviceCallbacks +{ +public: + void PostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId, + uint8_t type, uint16_t size, uint8_t * value) override; +}; + +} // namespace LightingApp + +namespace chip::NXP::App { +/** + * Returns the application-specific implementation of the CommonDeviceCallbacks object. + * + * Applications can use this to gain access to features of the CommonDeviceCallbacks + * that are specific to the selected application. + */ +chip::DeviceManager::CHIPDeviceManagerCallbacks & GetDeviceCallbacks(); + +} // namespace chip::NXP::App diff --git a/examples/lighting-app/nxp/common/main.cpp b/examples/lighting-app/nxp/common/main.cpp new file mode 100644 index 00000000000000..d9672b5402c867 --- /dev/null +++ b/examples/lighting-app/nxp/common/main.cpp @@ -0,0 +1,39 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "AppTask.h" +#include "FreeRTOS.h" + +#if configAPPLICATION_ALLOCATED_HEAP +uint8_t __attribute__((section(".heap"))) ucHeap[configTOTAL_HEAP_SIZE]; +#endif + +#if FSL_OSA_MAIN_FUNC_ENABLE +extern "C" void main_task(void const * argument) +{ + chip::DeviceLayer::PlatformMgrImpl().HardwareInit(); + chip::NXP::App::GetAppTask().Start(); +} +#else +extern "C" int main(int argc, char * argv[]) +{ + chip::DeviceLayer::PlatformMgrImpl().HardwareInit(); + chip::NXP::App::GetAppTask().Start(); + vTaskStartScheduler(); +} +#endif diff --git a/examples/lighting-app/nxp/k32w/k32w1/BUILD.gn b/examples/lighting-app/nxp/k32w/k32w1/BUILD.gn deleted file mode 100644 index dd40445e0e7b79..00000000000000 --- a/examples/lighting-app/nxp/k32w/k32w1/BUILD.gn +++ /dev/null @@ -1,196 +0,0 @@ -# Copyright (c) 2021 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build_overrides/chip.gni") -import("//build_overrides/nxp_sdk.gni") -import("//build_overrides/openthread.gni") -import("${nxp_sdk_build_root}/nxp_sdk.gni") - -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/crypto/crypto.gni") -import("${chip_root}/src/lib/core/core.gni") -import("${chip_root}/src/platform/device.gni") -import("${chip_root}/src/platform/nxp/${nxp_platform}/args.gni") - -import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") - -if (chip_enable_pw_rpc) { - import("//build_overrides/pigweed.gni") - import("$dir_pw_build/target_types.gni") - import("${chip_root}/examples/platform/nxp/pw_rpc_server.gni") -} - -declare_args() { - chip_software_version = 0 - - # Setup discriminator as argument - setup_discriminator = 3840 -} - -assert(current_os == "freertos") - -k32w1_platform_dir = "${chip_root}/examples/platform/nxp/k32w/k32w1" -k32w1_sdk_root = getenv("NXP_K32W1_SDK_ROOT") - -k32w1_sdk("sdk") { - sources = [ - "${k32w1_platform_dir}/app/project_include/OpenThreadConfig.h", - "include/CHIPProjectConfig.h", - "include/FreeRTOSConfig.h", - "main/include/app_config.h", - ] - - public_deps = - [ "${chip_root}/third_party/openthread/platforms:libopenthread-platform" ] - - include_dirs = [ - "main/include", - "main", - "include", - "${k32w1_platform_dir}/app/project_include", - "${k32w1_platform_dir}/app/support", - "${k32w1_platform_dir}/app/ldscripts", - "${k32w1_platform_dir}/util/include", - ] - - defines = [] - if (is_debug) { - defines += [ "BUILD_RELEASE=0" ] - } else { - defines += [ "BUILD_RELEASE=1" ] - } - - if (chip_software_version != 0) { - defines += [ - "CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION=${chip_software_version}", - ] - } - - if (chip_enable_pw_rpc) { - defines += [ - "PW_RPC_ENABLED", - "STREAMER_UART_FLUSH_DELAY_MS=0", - "STREAMER_UART_SERIAL_MANAGER_RING_BUFFER_SIZE=512", - "BOARD_APP_UART_CLK_FREQ=96000000", - ] - } - - defines += [ - "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setup_discriminator}", - ] -} - -k32w1_executable("light_app") { - output_name = "chip-k32w1-light-example" - - sources = [] - deps = [] - defines = [] - - if (chip_config_dimmable_led) { - defines += [ "CHIP_CONFIG_ENABLE_DIMMABLE_LED = 1" ] - } else { - defines += [ "CHIP_CONFIG_ENABLE_DIMMABLE_LED = 0" ] - } - - if (chip_enable_pw_rpc) { - forward_variables_from(pw_rpc_server, "*") - } else { - cflags = [ "-Wconversion" ] - } - - sources += [ - "${k32w1_platform_dir}/util/LEDWidget.cpp", - "${k32w1_platform_dir}/util/include/LEDWidget.h", - "main/AppTask.cpp", - "main/LightingManager.cpp", - "main/ZclCallbacks.cpp", - "main/include/AppEvent.h", - "main/include/AppTask.h", - "main/include/LightingManager.h", - "main/main.cpp", - ] - - if (chip_config_dimmable_led) { - sources += [ - "${k32w1_platform_dir}/util/LED_Dimmer.cpp", - "${k32w1_platform_dir}/util/include/LED_Dimmer.h", - ] - deps += [ "${chip_root}/examples/lighting-app/lighting-common/" ] - } else { - deps += [ "${chip_root}/examples/lighting-app/nxp/zap/" ] - } - - deps += [ - ":sdk", - "${chip_root}/examples/common/QRCode", - "${chip_root}/examples/providers:device_info_provider", - "${chip_root}/src/lib", - "${chip_root}/src/platform:syscalls_stub", - "${chip_root}/src/platform/logging:default", - "${chip_root}/third_party/mbedtls:mbedtls", - "${k32w1_platform_dir}/app/support:freertos_mbedtls_utils", - ] - - if (chip_openthread_ftd) { - deps += [ - "${openthread_root}:libopenthread-cli-ftd", - "${openthread_root}:libopenthread-ftd", - ] - } else { - deps += [ - "${openthread_root}:libopenthread-cli-mtd", - "${openthread_root}:libopenthread-mtd", - ] - } - - if (use_smu2_static) { - ldscript = "${k32w1_platform_dir}/app/ldscripts/k32w1_app.ld" - base_ldscript_dir = "${k32w1_sdk_root}/middleware/wireless/framework/Common/devices/kw45_k32w1/gcc" - } else { - ldscript = "${k32w1_sdk_root}/middleware/wireless/framework/Common/devices/kw45_k32w1/gcc/connectivity.ld" - } - - inputs = [ ldscript ] - - ldflags = [ - "-Wl,--defsym=__heap_size__=0", - "-Wl,--defsym=__stack_size__=0x480", - "-Wl,--defsym=gUseFactoryData_d=1", - "-Wl,-print-memory-usage", - "-Wl,--no-warn-rwx-segments", - "-T" + rebase_path(ldscript, root_build_dir), - ] - - if (chip_with_factory_data == 1) { - ldflags += [ "-Wl,--defsym=gUseFactoryData_d=1" ] - } - - if (use_smu2_static) { - ldflags += [ "-L" + rebase_path(base_ldscript_dir, root_build_dir) ] - } - - output_dir = root_out_dir -} - -group("k32w1") { - deps = [ ":light_app" ] -} - -group("default") { - deps = [ ":k32w1" ] -} diff --git a/examples/lighting-app/nxp/k32w/k32w1/build_overrides b/examples/lighting-app/nxp/k32w/k32w1/build_overrides deleted file mode 120000 index ad07557834803a..00000000000000 --- a/examples/lighting-app/nxp/k32w/k32w1/build_overrides +++ /dev/null @@ -1 +0,0 @@ -../../../../build_overrides/ \ No newline at end of file diff --git a/examples/lighting-app/nxp/k32w/k32w1/include/FreeRTOSConfig.h b/examples/lighting-app/nxp/k32w/k32w1/include/FreeRTOSConfig.h deleted file mode 100644 index 95279e6337a7f7..00000000000000 --- a/examples/lighting-app/nxp/k32w/k32w1/include/FreeRTOSConfig.h +++ /dev/null @@ -1,181 +0,0 @@ -/* - * FreeRTOS Kernel V10.2.0 - * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * http://www.FreeRTOS.org - * http://aws.amazon.com/freertos - * - * 1 tab == 4 spaces! - */ - -#pragma once - -/*----------------------------------------------------------- - * Application specific definitions. - * - * These definitions should be adjusted for your particular hardware and - * application requirements. - * - * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE - * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. - * - * See http://www.freertos.org/a00110.html. - *----------------------------------------------------------*/ - -#define configUSE_PREEMPTION 1 -#define configUSE_TICKLESS_IDLE 0 -/* Ensure stdint is only used by the compiler, and not the assembler. */ -#if defined(__ICCARM__) || defined(__ARMCC_VERSION) || defined(__GNUC__) -#include -extern uint32_t SystemCoreClock; -#endif -#define configCPU_CLOCK_HZ (SystemCoreClock) -#define configTICK_RATE_HZ ((TickType_t) 100) -#define configMAX_PRIORITIES (8) -// idle task stack size needs to be increased for OTA EEPROM processing -#define configMINIMAL_STACK_SIZE ((unsigned short) 450) -#define configMAX_TASK_NAME_LEN 20 -#define configUSE_16_BIT_TICKS 0 -#define configIDLE_SHOULD_YIELD 1 -#define configUSE_TASK_NOTIFICATIONS 1 -#define configUSE_MUTEXES 1 -#define configUSE_RECURSIVE_MUTEXES 1 -#define configUSE_COUNTING_SEMAPHORES 1 -#define configUSE_ALTERNATIVE_API 0 /* Deprecated! */ -#define configQUEUE_REGISTRY_SIZE 8 -#define configUSE_QUEUE_SETS 0 -#define configUSE_TIME_SLICING 0 -#define configUSE_NEWLIB_REENTRANT 0 -#define configENABLE_BACKWARD_COMPATIBILITY 1 -#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5 - -/* Tasks.c additions (e.g. Thread Aware Debug capability) */ -#define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H 1 - -/* Used memory allocation (heap_x.c) */ -#define configFRTOS_MEMORY_SCHEME 4 - -/* Memory allocation related definitions. */ -#define configSUPPORT_STATIC_ALLOCATION 0 -#define configSUPPORT_DYNAMIC_ALLOCATION 1 -#define configTOTAL_HEAP_SIZE ((size_t) (gTotalHeapSize_c)) -#define configAPPLICATION_ALLOCATED_HEAP 1 - -/* Hook function related definitions. */ -#ifndef configUSE_IDLE_HOOK -#define configUSE_IDLE_HOOK 1 -#endif -#define configUSE_TICK_HOOK 0 -#define configCHECK_FOR_STACK_OVERFLOW 0 -#ifndef configUSE_MALLOC_FAILED_HOOK -#define configUSE_MALLOC_FAILED_HOOK 0 -#endif -#define configUSE_DAEMON_TASK_STARTUP_HOOK 0 - -/* Run time and task stats gathering related definitions. */ -#define configGENERATE_RUN_TIME_STATS 0 -#define configUSE_TRACE_FACILITY 1 -#define configUSE_STATS_FORMATTING_FUNCTIONS 0 - -/* Task aware debugging. */ -#define configRECORD_STACK_HIGH_ADDRESS 1 - -/* Co-routine related definitions. */ -#define configUSE_CO_ROUTINES 0 -#define configMAX_CO_ROUTINE_PRIORITIES 2 - -/* Software timer related definitions. */ -#define configUSE_TIMERS 1 -#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1) -#define configTIMER_QUEUE_LENGTH 10 -#define configTIMER_TASK_STACK_DEPTH (360) - -/* Define to trap errors during development. */ -#define configASSERT(x) \ - if ((x) == 0) \ - { \ - taskDISABLE_INTERRUPTS(); \ - for (;;) \ - ; \ - } - -/* Optional functions - most linkers will remove unused functions anyway. */ -#define INCLUDE_vTaskPrioritySet 1 -#define INCLUDE_uxTaskPriorityGet 1 -#define INCLUDE_vTaskDelete 1 -#define INCLUDE_vTaskSuspend 1 -#define INCLUDE_xResumeFromISR 1 -#define INCLUDE_vTaskDelayUntil 1 -#define INCLUDE_vTaskDelay 1 -#define INCLUDE_xTaskGetSchedulerState 1 -#define INCLUDE_xTaskGetCurrentTaskHandle 1 -#define INCLUDE_uxTaskGetStackHighWaterMark 1 -#define INCLUDE_xTaskGetIdleTaskHandle 0 -#define INCLUDE_eTaskGetState 0 -#define INCLUDE_xEventGroupSetBitFromISR 1 -#define INCLUDE_xTimerPendFunctionCall 1 -#define INCLUDE_xTaskAbortDelay 0 -#define INCLUDE_xTaskGetHandle 0 -#define INCLUDE_xTaskResumeFromISR 1 -#define INCLUDE_xQueueGetMutexHolder 1 - -/* Interrupt nesting behaviour configuration. Cortex-M specific. */ -#ifdef __NVIC_PRIO_BITS -/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ -#define configPRIO_BITS __NVIC_PRIO_BITS -#else -#define configPRIO_BITS 3 -#endif - -/* The lowest interrupt priority that can be used in a call to a "set priority" -function. */ -#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x7 - -/* The highest interrupt priority that can be used by any interrupt service -routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL -INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER -PRIORITY THAN THIS! (higher priorities are lower numeric values. */ -#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 1 - -/* Interrupt priorities used by the kernel port layer itself. These are generic -to all Cortex-M ports, and do not rely on any particular library functions. */ -#define configKERNEL_INTERRUPT_PRIORITY (configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) -/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! -See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ -#define configMAX_SYSCALL_INTERRUPT_PRIORITY (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) - -#ifndef configENABLE_FPU -#define configENABLE_FPU 0 -#endif -#ifndef configENABLE_MPU -#define configENABLE_MPU 0 -#endif -#ifndef configENABLE_TRUSTZONE -#define configENABLE_TRUSTZONE 0 -#endif -#ifndef configRUN_FREERTOS_SECURE_ONLY -#define configRUN_FREERTOS_SECURE_ONLY 1 -#endif - -/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS -standard names. */ -#define vPortSVCHandler SVC_Handler -#define xPortPendSVHandler PendSV_Handler -#define xPortSysTickHandler SysTick_Handler diff --git a/examples/lighting-app/nxp/k32w/k32w1/main/AppTask.cpp b/examples/lighting-app/nxp/k32w/k32w1/main/AppTask.cpp deleted file mode 100644 index 4c1d0875470ee4..00000000000000 --- a/examples/lighting-app/nxp/k32w/k32w1/main/AppTask.cpp +++ /dev/null @@ -1,932 +0,0 @@ -/* - * - * Copyright (c) 2021 Project CHIP Authors - * Copyright (c) 2021 Google LLC. - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "AppTask.h" -#include "AppEvent.h" -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#if defined(USE_SMU2_DYNAMIC) -#include -#endif - -#include -#include -#include -#include - -/* OTA related includes */ -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR -#include "OtaSupport.h" -#include -#include -#include -#include -#include -#endif - -#include "K32W1PersistentStorageOpKeystore.h" - -#include "LEDWidget.h" -#include "app.h" -#include "app_config.h" -#include "fsl_component_button.h" -#include "fwk_platform.h" - -#if CHIP_CONFIG_ENABLE_DIMMABLE_LED -#include "LED_Dimmer.h" -#endif - -#define FACTORY_RESET_TRIGGER_TIMEOUT 6000 -#define FACTORY_RESET_CANCEL_WINDOW_TIMEOUT 3000 -#define APP_TASK_PRIORITY 2 -#define APP_EVENT_QUEUE_SIZE 10 - -TimerHandle_t sFunctionTimer; // FreeRTOS app sw timer. - -static QueueHandle_t sAppEventQueue; - -/* - * The status LED and the external flash CS pin are wired together. - * The OTA image writing may fail if used together. - */ -#ifndef CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR -static LEDWidget sStatusLED; -#endif -static LEDWidget sLightLED; - -static bool sIsThreadProvisioned = false; -#ifndef CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR -static bool sHaveFullConnectivity = false; -#endif -static bool sHaveBLEConnections = false; - -#if CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI -extern "C" void otPlatUartProcess(void); -#endif - -using namespace ::chip::Credentials; -using namespace ::chip::DeviceLayer; -using namespace chip; -using namespace chip::app; - -AppTask AppTask::sAppTask; -#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA -static AppTask::FactoryDataProvider sFactoryDataProvider; -#endif - -// This key is for testing/certification only and should not be used in production devices. -// For production devices this key must be provided from factory data. -uint8_t sTestEventTriggerEnableKey[TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }; - -static Identify gIdentify = { chip::EndpointId{ 1 }, AppTask::OnIdentifyStart, AppTask::OnIdentifyStop, - Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator, AppTask::OnTriggerEffect, - // Use invalid value for identifiers to enable TriggerEffect command - // to stop Identify command for each effect - Clusters::Identify::EffectIdentifierEnum::kUnknownEnumValue, - Clusters::Identify::EffectVariantEnum::kDefault }; - -/* OTA related variables */ -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR -static DefaultOTARequestor gRequestorCore; -static DefaultOTARequestorStorage gRequestorStorage; -static DeviceLayer::DefaultOTARequestorDriver gRequestorUser; -static BDXDownloader gDownloader; - -constexpr uint16_t requestedOtaBlockSize = 1024; -#endif - -CHIP_ERROR AppTask::StartAppTask() -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - sAppEventQueue = xQueueCreate(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent)); - if (sAppEventQueue == NULL) - { - err = APP_ERROR_EVENT_QUEUE_FAILED; - K32W_LOG("Failed to allocate app event queue"); - assert(err == CHIP_NO_ERROR); - } - - return err; -} - -CHIP_ERROR AppTask::Init() -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - PlatformMgr().AddEventHandler(MatterEventHandler, 0); - - // Init ZCL Data Model and start server - PlatformMgr().ScheduleWork(InitServer, 0); - -#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA - ReturnErrorOnFailure(sFactoryDataProvider.Init()); - SetDeviceInstanceInfoProvider(&sFactoryDataProvider); - SetDeviceAttestationCredentialsProvider(&sFactoryDataProvider); - SetCommissionableDataProvider(&sFactoryDataProvider); -#else - SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); -#endif // CONFIG_CHIP_LOAD_REAL_FACTORY_DATA - - // QR code will be used with CHIP Tool - AppTask::PrintOnboardingInfo(); - - if (LightingMgr().Init() != 0) - { - K32W_LOG("LightingMgr().Init() failed"); - assert(0); - } - - LightingMgr().SetCallbacks(ActionInitiated, ActionCompleted); - - /* start with all LEDS turnedd off */ -#ifndef CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - sStatusLED.Init(SYSTEM_STATE_LED, false); -#endif - -#if CHIP_CONFIG_ENABLE_DIMMABLE_LED - init_dimmable(); -#else - sLightLED.Init(LIGHT_STATE_LED, false); -#endif - - UpdateDeviceState(); - - /* intialize the Keyboard and button press callback */ - BUTTON_InstallCallback((button_handle_t) g_buttonHandle[0], KBD_Callback, (void *) BLE_BUTTON); - BUTTON_InstallCallback((button_handle_t) g_buttonHandle[1], KBD_Callback, (void *) LIGHT_BUTTON); - - // Create FreeRTOS sw timer for Function Selection. - sFunctionTimer = xTimerCreate("FnTmr", // Just a text name, not used by the RTOS kernel - 1, // == default timer period (mS) - false, // no timer reload (==one-shot) - (void *) this, // init timer id = app task obj context - TimerEventHandler // timer callback handler - ); - - if (sFunctionTimer == NULL) - { - err = APP_ERROR_CREATE_TIMER_FAILED; - K32W_LOG("app_timer_create() failed"); - assert(err == CHIP_NO_ERROR); - } - - // Print the current software version - char currentSoftwareVer[ConfigurationManager::kMaxSoftwareVersionStringLength + 1] = { 0 }; - err = ConfigurationMgr().GetSoftwareVersionString(currentSoftwareVer, sizeof(currentSoftwareVer)); - if (err != CHIP_NO_ERROR) - { - K32W_LOG("Get version error"); - assert(err == CHIP_NO_ERROR); - } - - uint32_t currentVersion; - err = ConfigurationMgr().GetSoftwareVersion(currentVersion); - - K32W_LOG("Current Software Version: %s, %d", currentSoftwareVer, currentVersion); - - return err; -} - -void LockOpenThreadTask(void) -{ - chip::DeviceLayer::ThreadStackMgr().LockThreadStack(); -} - -void UnlockOpenThreadTask(void) -{ - chip::DeviceLayer::ThreadStackMgr().UnlockThreadStack(); -} - -void AppTask::InitServer(intptr_t arg) -{ - static chip::CommonCaseDeviceServerInitParams initParams; - (void) initParams.InitializeStaticResourcesBeforeServerInit(); - -#if CHIP_CRYPTO_PLATFORM - static chip::K32W1PersistentStorageOpKeystore sK32W1PersistentStorageOpKeystore; - VerifyOrDie((sK32W1PersistentStorageOpKeystore.Init(initParams.persistentStorageDelegate)) == CHIP_NO_ERROR); - initParams.operationalKeystore = &sK32W1PersistentStorageOpKeystore; -#endif - -#if defined(USE_SMU2_DYNAMIC) - VerifyOrDie(SMU2::Init() == CHIP_NO_ERROR); -#endif - - // Init ZCL Data Model and start server - static DefaultTestEventTriggerDelegate sTestEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; - initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; - chip::Inet::EndPointStateOpenThread::OpenThreadEndpointInitParam nativeParams; - nativeParams.lockCb = LockOpenThreadTask; - nativeParams.unlockCb = UnlockOpenThreadTask; - nativeParams.openThreadInstancePtr = chip::DeviceLayer::ThreadStackMgrImpl().OTInstance(); - initParams.endpointNativeParams = static_cast(&nativeParams); - VerifyOrDie((chip::Server::GetInstance().Init(initParams)) == CHIP_NO_ERROR); -} - -void AppTask::PrintOnboardingInfo() -{ - chip::PayloadContents payload; - CHIP_ERROR err = GetPayloadContents(payload, chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); - if (err != CHIP_NO_ERROR) - { - ChipLogError(AppServer, "GetPayloadContents() failed: %" CHIP_ERROR_FORMAT, err.Format()); - } - payload.commissioningFlow = chip::CommissioningFlow::kUserActionRequired; - PrintOnboardingCodes(payload); -} - -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR -void AppTask::InitOTA(intptr_t arg) -{ - // Initialize and interconnect the Requestor and Image Processor objects -- START - SetRequestorInstance(&gRequestorCore); - - gRequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage()); - gRequestorCore.Init(chip::Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader); - gRequestorUser.SetMaxDownloadBlockSize(requestedOtaBlockSize); - auto & imageProcessor = OTAImageProcessorImpl::GetDefaultInstance(); - gRequestorUser.Init(&gRequestorCore, &imageProcessor); - CHIP_ERROR err = imageProcessor.Init(&gDownloader); - if (err != CHIP_NO_ERROR) - { - K32W_LOG("Image processor init failed"); - assert(err == CHIP_NO_ERROR); - } - - // Connect the gDownloader and Image Processor objects - gDownloader.SetImageProcessorDelegate(&imageProcessor); - // Initialize and interconnect the Requestor and Image Processor objects -- END -} -#endif - -void AppTask::AppTaskMain(void * pvParameter) -{ - AppEvent event; - - CHIP_ERROR err = sAppTask.Init(); - if (err != CHIP_NO_ERROR) - { - K32W_LOG("AppTask.Init() failed"); - assert(err == CHIP_NO_ERROR); - } - - while (true) - { - BaseType_t eventReceived = xQueueReceive(sAppEventQueue, &event, pdMS_TO_TICKS(10)); - while (eventReceived == pdTRUE) - { - sAppTask.DispatchEvent(&event); - eventReceived = xQueueReceive(sAppEventQueue, &event, 0); - } - - // Collect connectivity and configuration state from the CHIP stack. Because the - // CHIP event loop is being run in a separate task, the stack must be locked - // while these values are queried. However we use a non-blocking lock request - // (TryLockChipStack()) to avoid blocking other UI activities when the CHIP - // task is busy (e.g. with a long crypto operation). - if (PlatformMgr().TryLockChipStack()) - { -#if CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI - otPlatUartProcess(); -#endif - - sIsThreadProvisioned = ConnectivityMgr().IsThreadProvisioned(); - sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0); - PlatformMgr().UnlockChipStack(); - } - - // Update the status LED if factory reset or identify process have not been initiated. - // - // If system has "full connectivity", keep the LED On constantly. - // - // If thread and service provisioned, but not attached to the thread network yet OR no - // connectivity to the service OR subscriptions are not fully established - // THEN blink the LED Off for a short period of time. - // - // If the system has ble connection(s) uptill the stage above, THEN blink the LEDs at an even - // rate of 100ms. - // - // Otherwise, blink the LED ON for a very short time. - if (sAppTask.mFunction != kFunction_FactoryReset) - { -#ifndef CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - if (sHaveFullConnectivity) - { - sStatusLED.Set(true); - } - else if (sIsThreadProvisioned) - { - sStatusLED.Blink(950, 50); - } - else if (sHaveBLEConnections) - { - sStatusLED.Blink(100, 100); - } - else - { - sStatusLED.Blink(50, 950); - } -#endif - } - -#ifndef CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - sStatusLED.Animate(); -#endif - sLightLED.Animate(); - } -} - -void AppTask::ButtonEventHandler(uint8_t pin_no, uint8_t button_action) -{ - if ((pin_no != RESET_BUTTON) && (pin_no != LIGHT_BUTTON) && (pin_no != SOFT_RESET_BUTTON) && (pin_no != BLE_BUTTON)) - { - return; - } - - AppEvent button_event; - button_event.Type = AppEvent::kEventType_Button; - button_event.ButtonEvent.PinNo = pin_no; - button_event.ButtonEvent.Action = button_action; - - if (pin_no == LIGHT_BUTTON) - { - button_event.Handler = LightActionEventHandler; - } - else if (pin_no == SOFT_RESET_BUTTON) - { - // Soft reset ensures that platform manager shutdown procedure is called. - button_event.Handler = SoftResetHandler; - } - else if (pin_no == BLE_BUTTON) - { - button_event.Handler = BleHandler; - - if (button_action == RESET_BUTTON_PUSH) - { - button_event.Handler = ResetActionEventHandler; - } - } - sAppTask.PostEvent(&button_event); -} - -button_status_t AppTask::KBD_Callback(void * buttonHandle, button_callback_message_t * message, void * callbackParam) -{ - uint32_t pinNb = (uint32_t) callbackParam; - switch (message->event) - { - case kBUTTON_EventOneClick: - case kBUTTON_EventShortPress: - switch (pinNb) - { - case BLE_BUTTON: - // K32W_LOG("pb1 short press"); - if (sAppTask.mResetTimerActive) - { - ButtonEventHandler(BLE_BUTTON, RESET_BUTTON_PUSH); - } - else - { - ButtonEventHandler(BLE_BUTTON, BLE_BUTTON_PUSH); - } - break; - - case LIGHT_BUTTON: - // K32W_LOG("pb2 short press"); - ButtonEventHandler(LIGHT_BUTTON, LIGHT_BUTTON_PUSH); - break; - } - break; - - case kBUTTON_EventLongPress: - switch (pinNb) - { - case BLE_BUTTON: - // K32W_LOG("pb1 long press"); - ButtonEventHandler(BLE_BUTTON, RESET_BUTTON_PUSH); - break; - - case LIGHT_BUTTON: - // K32W_LOG("pb2 long press"); - ButtonEventHandler(SOFT_RESET_BUTTON, SOFT_RESET_BUTTON_PUSH); - break; - } - break; - - default: - /* No action required */ - break; - } - return kStatus_BUTTON_Success; -} - -void AppTask::TimerEventHandler(TimerHandle_t xTimer) -{ - AppEvent event; - event.Type = AppEvent::kEventType_Timer; - event.TimerEvent.Context = (void *) xTimer; - event.Handler = FunctionTimerEventHandler; - sAppTask.PostEvent(&event); -} - -void AppTask::FunctionTimerEventHandler(AppEvent * aEvent) -{ - if (aEvent->Type != AppEvent::kEventType_Timer) - return; - - K32W_LOG("Device will factory reset..."); - - // Actually trigger Factory Reset - chip::Server::GetInstance().ScheduleFactoryReset(); -} - -void AppTask::ResetActionEventHandler(AppEvent * aEvent) -{ - if (aEvent->ButtonEvent.PinNo != RESET_BUTTON && aEvent->ButtonEvent.PinNo != BLE_BUTTON) - return; - - if (sAppTask.mResetTimerActive) - { - sAppTask.CancelTimer(); - sAppTask.mFunction = kFunction_NoneSelected; - - RestoreLightingState(); - - K32W_LOG("Factory Reset was cancelled!"); - } - else - { - uint32_t resetTimeout = FACTORY_RESET_TRIGGER_TIMEOUT; - - if (sAppTask.mFunction != kFunction_NoneSelected) - { - K32W_LOG("Another function is scheduled. Could not initiate Factory Reset!"); - return; - } - - K32W_LOG("Factory Reset Triggered. Push the RESET button within %lu ms to cancel!", resetTimeout); - sAppTask.mFunction = kFunction_FactoryReset; - - /* LEDs will start blinking to signal that a Factory Reset was scheduled */ -#ifndef CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - sStatusLED.Set(false); -#endif - -#if CHIP_CONFIG_ENABLE_DIMMABLE_LED - sLightLED.SetLevel(0); -#else - sLightLED.Set(false); -#endif - -#ifndef CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - sStatusLED.Blink(500); -#endif - sLightLED.Blink(500); - - sAppTask.StartTimer(FACTORY_RESET_TRIGGER_TIMEOUT); - } -} - -void AppTask::LightActionEventHandler(AppEvent * aEvent) -{ - LightingManager::Action_t action; - CHIP_ERROR err = CHIP_NO_ERROR; - int32_t actor = 0; - bool initiated = false; - - if (sAppTask.mFunction != kFunction_NoneSelected) - { - K32W_LOG("Another function is scheduled. Could not initiate ON/OFF Light command!"); - return; - } - - if (aEvent->Type == AppEvent::kEventType_TurnOn) - { - action = static_cast(aEvent->LightEvent.Action); - actor = aEvent->LightEvent.Actor; - } - else if (aEvent->Type == AppEvent::kEventType_Button) - { - actor = AppEvent::kEventType_Button; - - if (LightingMgr().IsTurnedOff()) - { - action = LightingManager::TURNON_ACTION; - } - else - { - action = LightingManager::TURNOFF_ACTION; - } - } - else - { - err = APP_ERROR_UNHANDLED_EVENT; - action = LightingManager::INVALID_ACTION; - } - - if (err == CHIP_NO_ERROR) - { - initiated = LightingMgr().InitiateAction(actor, action, LightingMgr().IsTurnedOff() ? 0 : 1); - - if (!initiated) - { - K32W_LOG("Action is already in progress or active."); - } - } -} - -void AppTask::SoftResetHandler(AppEvent * aEvent) -{ - if (aEvent->ButtonEvent.PinNo != SOFT_RESET_BUTTON) - return; - - PlatformMgrImpl().CleanReset(); -} - -void AppTask::BleHandler(AppEvent * aEvent) -{ - if (aEvent->ButtonEvent.PinNo != BLE_BUTTON) - return; - - if (sAppTask.mFunction != kFunction_NoneSelected) - { - K32W_LOG("Another function is scheduled. Could not toggle BLE state!"); - return; - } - PlatformMgr().ScheduleWork(AppTask::BleStartAdvertising, 0); -} - -void AppTask::BleStartAdvertising(intptr_t arg) -{ - if (ConnectivityMgr().IsBLEAdvertisingEnabled()) - { - ConnectivityMgr().SetBLEAdvertisingEnabled(false); - K32W_LOG("Stopped BLE Advertising!"); - } - else - { - ConnectivityMgr().SetBLEAdvertisingEnabled(true); - if (chip::Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() == CHIP_NO_ERROR) - { - K32W_LOG("Started BLE Advertising!"); - } - else - { - K32W_LOG("OpenBasicCommissioningWindow() failed"); - } - } -} - -void AppTask::MatterEventHandler(const ChipDeviceEvent * event, intptr_t) -{ -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - if (event->Type == DeviceEventType::kDnssdInitialized) - { - K32W_LOG("Dnssd platform initialized."); - PlatformMgr().ScheduleWork(InitOTA, 0); - } -#else - if (event->Type == DeviceEventType::kDnssdInitialized) - { - sHaveFullConnectivity = TRUE; - } -#endif -} - -void AppTask::CancelTimer() -{ - if (xTimerStop(sFunctionTimer, 0) == pdFAIL) - { - K32W_LOG("app timer stop() failed"); - } - - mResetTimerActive = false; -} - -void AppTask::StartTimer(uint32_t aTimeoutInMs) -{ - if (xTimerIsTimerActive(sFunctionTimer)) - { - K32W_LOG("app timer already started!"); - CancelTimer(); - } - - // timer is not active, change its period to required value (== restart). - // FreeRTOS- Block for a maximum of 100 ticks if the change period command - // cannot immediately be sent to the timer command queue. - if (xTimerChangePeriod(sFunctionTimer, aTimeoutInMs / portTICK_PERIOD_MS, 100) != pdPASS) - { - K32W_LOG("app timer start() failed"); - } - - mResetTimerActive = true; -} - -void AppTask::ActionInitiated(LightingManager::Action_t aAction, int32_t aActor) -{ - // start flashing the LEDs rapidly to indicate action initiation. - if (aAction == LightingManager::TURNON_ACTION) - { - K32W_LOG("Turn on Action has been initiated") - } - else if (aAction == LightingManager::TURNOFF_ACTION) - { - K32W_LOG("Turn off Action has been initiated") - } - else if (aAction == LightingManager::DIM_ACTION) - { - K32W_LOG("Dim Action has been initiated"); - } - - if (aActor == AppEvent::kEventType_Button) - { - sAppTask.mSyncClusterToButtonAction = true; - } - - sAppTask.mFunction = kFunctionTurnOnTurnOff; -} - -void AppTask::ActionCompleted(LightingManager::Action_t aAction, uint8_t level) -{ - // Turn on the light LED if in a TURNON state OR - // Turn off the light LED if in a TURNOFF state. - if (aAction == LightingManager::TURNON_ACTION) - { - K32W_LOG("Turn on action has been completed") -#if CHIP_CONFIG_ENABLE_DIMMABLE_LED -#else - sLightLED.Set(true); -#endif - } - else if (aAction == LightingManager::TURNOFF_ACTION) - { - K32W_LOG("Turn off action has been completed") -#if CHIP_CONFIG_ENABLE_DIMMABLE_LED -#else - sLightLED.Set(false); -#endif - } - else if (aAction == LightingManager::DIM_ACTION) - { - K32W_LOG("Move to level %d completed", level); - } -#if CHIP_CONFIG_ENABLE_DIMMABLE_LED - sLightLED.SetLevel(LightingMgr().IsTurnedOff() ? 1 : LightingMgr().GetDimLevel()); -#endif - - if (sAppTask.mSyncClusterToButtonAction) - { - sAppTask.UpdateClusterState(); - sAppTask.mSyncClusterToButtonAction = false; - } - - sAppTask.mFunction = kFunction_NoneSelected; -} - -void AppTask::RestoreLightingState(void) -{ -#if CHIP_CONFIG_ENABLE_DIMMABLE_LED - LightingMgr().SetState(!LightingMgr().IsTurnedOff()); -#else - /* restore initial state for the LED indicating Lighting state */ - if (LightingMgr().IsTurnedOff()) - { - sLightLED.Set(false); - } - else - { - sLightLED.Set(true); - } -#endif -} - -void AppTask::OnIdentifyStart(Identify * identify) -{ - if ((kFunction_NoneSelected != sAppTask.mFunction) && (kFunction_TriggerEffect != sAppTask.mFunction)) - { - K32W_LOG("Another function is scheduled. Could not initiate Identify process!"); - return; - } - - if (kFunction_TriggerEffect == sAppTask.mFunction) - { - chip::DeviceLayer::SystemLayer().CancelTimer(OnTriggerEffectComplete, identify); - OnTriggerEffectComplete(&chip::DeviceLayer::SystemLayer(), identify); - } - - ChipLogProgress(Zcl, "Identify process has started. Status LED should blink with a period of 0.5 seconds."); - sAppTask.mFunction = kFunction_Identify; -#if CHIP_CONFIG_ENABLE_DIMMABLE_LED - sLightLED.SetLevel(0); -#else - sLightLED.Set(false); -#endif - sLightLED.Blink(250); -} - -void AppTask::OnIdentifyStop(Identify * identify) -{ - if (kFunction_Identify == sAppTask.mFunction) - { - ChipLogProgress(Zcl, "Identify process has stopped."); - sAppTask.mFunction = kFunction_NoneSelected; - - RestoreLightingState(); - } -} - -void AppTask::OnTriggerEffectComplete(chip::System::Layer * systemLayer, void * appState) -{ - // Let Identify command take over if called during TriggerEffect already running - if (kFunction_TriggerEffect == sAppTask.mFunction) - { - ChipLogProgress(Zcl, "TriggerEffect has stopped."); - sAppTask.mFunction = kFunction_NoneSelected; - - // TriggerEffect finished - reset identifiers - // Use invalid value for identifiers to enable TriggerEffect command - // to stop Identify command for each effect - gIdentify.mCurrentEffectIdentifier = Clusters::Identify::EffectIdentifierEnum::kUnknownEnumValue; - gIdentify.mTargetEffectIdentifier = Clusters::Identify::EffectIdentifierEnum::kUnknownEnumValue; - gIdentify.mEffectVariant = Clusters::Identify::EffectVariantEnum::kDefault; - - RestoreLightingState(); - } -} - -void AppTask::OnTriggerEffect(Identify * identify) -{ - // Allow overlapping TriggerEffect calls - if ((kFunction_NoneSelected != sAppTask.mFunction) && (kFunction_TriggerEffect != sAppTask.mFunction)) - { - K32W_LOG("Another function is scheduled. Could not initiate Identify process!"); - return; - } - - sAppTask.mFunction = kFunction_TriggerEffect; - uint16_t timerDelay = 0; - - ChipLogProgress(Zcl, "TriggerEffect has started."); - - switch (identify->mCurrentEffectIdentifier) - { - case Clusters::Identify::EffectIdentifierEnum::kBlink: - timerDelay = 2; - break; - - case Clusters::Identify::EffectIdentifierEnum::kBreathe: - timerDelay = 15; - break; - - case Clusters::Identify::EffectIdentifierEnum::kOkay: - timerDelay = 4; - break; - - case Clusters::Identify::EffectIdentifierEnum::kChannelChange: - ChipLogProgress(Zcl, "Channel Change effect not supported, using effect %d", - to_underlying(Clusters::Identify::EffectIdentifierEnum::kBlink)); - timerDelay = 2; - break; - - case Clusters::Identify::EffectIdentifierEnum::kFinishEffect: - chip::DeviceLayer::SystemLayer().CancelTimer(OnTriggerEffectComplete, identify); - timerDelay = 1; - break; - - case Clusters::Identify::EffectIdentifierEnum::kStopEffect: - chip::DeviceLayer::SystemLayer().CancelTimer(OnTriggerEffectComplete, identify); - OnTriggerEffectComplete(&chip::DeviceLayer::SystemLayer(), identify); - break; - - default: - ChipLogProgress(Zcl, "Invalid effect identifier."); - } - - if (timerDelay) - { -#if CHIP_CONFIG_ENABLE_DIMMABLE_LED - sLightLED.SetLevel(0); -#else - sLightLED.Set(false); -#endif - sLightLED.Blink(500); - - chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds16(timerDelay), OnTriggerEffectComplete, identify); - } -} - -void AppTask::PostTurnOnActionRequest(int32_t aActor, LightingManager::Action_t aAction) -{ - AppEvent event; - event.Type = AppEvent::kEventType_TurnOn; - event.LightEvent.Actor = aActor; - event.LightEvent.Action = aAction; - event.Handler = LightActionEventHandler; - PostEvent(&event); -} - -void AppTask::PostEvent(const AppEvent * aEvent) -{ - portBASE_TYPE taskToWake = pdFALSE; - if (sAppEventQueue != NULL) - { - if (__get_IPSR()) - { - if (!xQueueSendToFrontFromISR(sAppEventQueue, aEvent, &taskToWake)) - { - K32W_LOG("Failed to post event to app task event queue"); - } - - portYIELD_FROM_ISR(taskToWake); - } - else - { - if (!xQueueSend(sAppEventQueue, aEvent, 1)) - { - K32W_LOG("Failed to post event to app task event queue"); - } - } - } -} - -void AppTask::DispatchEvent(AppEvent * aEvent) -{ - if (aEvent->Handler) - { - aEvent->Handler(aEvent); - } - else - { - K32W_LOG("Event received with no handler. Dropping event."); - } -} - -void AppTask::UpdateClusterState(void) -{ - PlatformMgr().ScheduleWork(UpdateClusterStateInternal, 0); -} - -void AppTask::UpdateClusterStateInternal(intptr_t arg) -{ - uint8_t newValue = !LightingMgr().IsTurnedOff(); - - // write the new on/off value - Protocols::InteractionModel::Status status = app::Clusters::OnOff::Attributes::OnOff::Set(1, newValue); - if (status != Protocols::InteractionModel::Status::Success) - { - ChipLogError(NotSpecified, "ERR: updating on/off %x", to_underlying(status)); - } -} - -void AppTask::UpdateDeviceState(void) -{ - PlatformMgr().ScheduleWork(UpdateDeviceStateInternal, 0); -} - -void AppTask::UpdateDeviceStateInternal(intptr_t arg) -{ - bool onoffAttrValue = 0; - - /* get onoff attribute value */ - (void) app::Clusters::OnOff::Attributes::OnOff::Get(1, &onoffAttrValue); - - /* set the device state */ -#if CHIP_CONFIG_ENABLE_DIMMABLE_LED -#else - sLightLED.Set(onoffAttrValue); -#endif - LightingMgr().SetState(onoffAttrValue); -} - -extern "C" void OTAIdleActivities(void) -{ -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - OTA_TransactionResume(); -#endif -} diff --git a/examples/lighting-app/nxp/k32w/k32w1/main/LightingManager.cpp b/examples/lighting-app/nxp/k32w/k32w1/main/LightingManager.cpp deleted file mode 100644 index 2627138043bbe4..00000000000000 --- a/examples/lighting-app/nxp/k32w/k32w1/main/LightingManager.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * - * Copyright (c) 2021 Project CHIP Authors - * Copyright (c) 2019 Google LLC. - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "LightingManager.h" - -#if CHIP_CONFIG_ENABLE_DIMMABLE_LED -#include "LED_Dimmer.h" -#endif - -#include "AppTask.h" -#include "FreeRTOS.h" - -#include "app_config.h" - -LightingManager LightingManager::sLight; - -int LightingManager::Init() -{ - mState = kState_On; - - mLevel = kLevel_Max; - - return 0; -} - -void LightingManager::SetCallbacks(Callback_fn_initiated aActionInitiated_CB, Callback_fn_completed aActionCompleted_CB) -{ - mActionInitiated_CB = aActionInitiated_CB; - mActionCompleted_CB = aActionCompleted_CB; -} - -void LightingManager::SetState(bool state) -{ - mState = state ? kState_On : kState_Off; -} - -void LightingManager::SetDimLevel(uint8_t level) -{ - mLevel = level; -} - -bool LightingManager::IsTurnedOff() -{ - return (mState == kState_Off) ? true : false; -} - -uint8_t LightingManager::GetDimLevel() -{ - return mLevel; -} - -bool LightingManager::InitiateAction(int32_t aActor, Action_t aAction, uint8_t kValue) -{ - bool action_initiated = false; - State_t current_state; - - if (mState == kState_On && aAction == TURNOFF_ACTION) - { - action_initiated = true; - current_state = kState_Off; - } - else if (mState == kState_Off && aAction == TURNON_ACTION) - { - action_initiated = true; - current_state = kState_On; - } - - else if (aAction == DIM_ACTION && kValue != mLevel) - { - action_initiated = true; - if (kValue == 1) - { - current_state = kState_Off; - } - else - { - current_state = kState_On; - } - } - - if (action_initiated) - { - if (mActionInitiated_CB) - { - mActionInitiated_CB(aAction, aActor); - } - - if (aAction == TURNON_ACTION || aAction == TURNOFF_ACTION) - { - SetState(current_state == kState_On); - } - else if (aAction == DIM_ACTION) - { - mState = current_state; - SetDimLevel(kValue); - } - - if (mActionCompleted_CB) - { - mActionCompleted_CB(aAction, kValue); - } - } - - return action_initiated; -} diff --git a/examples/lighting-app/nxp/k32w/k32w1/main/include/AppEvent.h b/examples/lighting-app/nxp/k32w/k32w1/main/include/AppEvent.h deleted file mode 100644 index 902c70b3cb656f..00000000000000 --- a/examples/lighting-app/nxp/k32w/k32w1/main/include/AppEvent.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * - * Copyright (c) 2021 Nest Labs, Inc. - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -struct AppEvent; -typedef void (*EventHandler)(AppEvent *); - -struct AppEvent -{ - enum AppEventTypes - { - kEventType_None = 0, - kEventType_Button, - kEventType_Timer, - kEventType_TurnOn, - kEventType_Install, - kEventType_OTAResume, - }; - - AppEventTypes Type; - - union - { - struct - { - uint8_t PinNo; - uint8_t Action; - } ButtonEvent; - struct - { - void * Context; - } TimerEvent; - struct - { - uint8_t Action; - int32_t Actor; - } LightEvent; - }; - - EventHandler Handler; -}; diff --git a/examples/lighting-app/nxp/k32w/k32w1/main/include/AppTask.h b/examples/lighting-app/nxp/k32w/k32w1/main/include/AppTask.h deleted file mode 100644 index 096690c680b1d2..00000000000000 --- a/examples/lighting-app/nxp/k32w/k32w1/main/include/AppTask.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * - * Copyright (c) 2021 Google LLC. - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "AppEvent.h" -#include "LightingManager.h" - -#include -#include - -#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA -#include -#endif - -#include "FreeRTOS.h" -#include "fsl_component_button.h" -#include "timers.h" - -// Application-defined error codes in the CHIP_ERROR space. -#define APP_ERROR_EVENT_QUEUE_FAILED CHIP_APPLICATION_ERROR(0x01) -#define APP_ERROR_CREATE_TASK_FAILED CHIP_APPLICATION_ERROR(0x02) -#define APP_ERROR_UNHANDLED_EVENT CHIP_APPLICATION_ERROR(0x03) -#define APP_ERROR_CREATE_TIMER_FAILED CHIP_APPLICATION_ERROR(0x04) -#define APP_ERROR_START_TIMER_FAILED CHIP_APPLICATION_ERROR(0x05) -#define APP_ERROR_STOP_TIMER_FAILED CHIP_APPLICATION_ERROR(0x06) - -class AppTask -{ -public: -#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA - using FactoryDataProvider = chip::DeviceLayer::FactoryDataProviderImpl; -#endif - CHIP_ERROR StartAppTask(); - static void AppTaskMain(void * pvParameter); - - void PostTurnOnActionRequest(int32_t aActor, LightingManager::Action_t aAction); - void PostEvent(const AppEvent * event); - - void UpdateClusterState(void); - void UpdateDeviceState(void); - - // Identify cluster callbacks. - static void OnIdentifyStart(Identify * identify); - static void OnIdentifyStop(Identify * identify); - static void OnTriggerEffect(Identify * identify); - static void OnTriggerEffectComplete(chip::System::Layer * systemLayer, void * appState); - static void ButtonEventHandler(uint8_t pin_no, uint8_t button_action); - -private: - friend AppTask & GetAppTask(void); - - CHIP_ERROR Init(); - - static void ActionInitiated(LightingManager::Action_t aAction, int32_t aActor); - static void ActionCompleted(LightingManager::Action_t aAction, uint8_t level); - - void CancelTimer(void); - - void DispatchEvent(AppEvent * event); - - static void FunctionTimerEventHandler(AppEvent * aEvent); - static button_status_t KBD_Callback(void * buttonHandle, button_callback_message_t * message, void * callbackParam); - static void SoftResetHandler(AppEvent * aEvent); - static void BleHandler(AppEvent * aEvent); - static void BleStartAdvertising(intptr_t arg); - static void LightActionEventHandler(AppEvent * aEvent); - static void ResetActionEventHandler(AppEvent * aEvent); - static void InstallEventHandler(AppEvent * aEvent); - - static void TimerEventHandler(TimerHandle_t xTimer); - - static void MatterEventHandler(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg); - void StartTimer(uint32_t aTimeoutInMs); - - static void RestoreLightingState(void); - -#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR - static void InitOTA(intptr_t arg); - static void StartOTAQuery(intptr_t arg); -#endif - - static void UpdateClusterStateInternal(intptr_t arg); - static void UpdateDeviceStateInternal(intptr_t arg); - static void InitServer(intptr_t arg); - static void PrintOnboardingInfo(); - - enum Function_t - { - kFunction_NoneSelected = 0, - kFunction_FactoryReset, - kFunctionTurnOnTurnOff, - kFunction_Identify, - kFunction_TriggerEffect, - kFunction_Invalid - } Function; - - Function_t mFunction = kFunction_NoneSelected; - bool mResetTimerActive = false; - bool mSyncClusterToButtonAction = false; - - static AppTask sAppTask; -}; - -inline AppTask & GetAppTask(void) -{ - return AppTask::sAppTask; -} diff --git a/examples/lighting-app/nxp/k32w/k32w1/main/include/LightingManager.h b/examples/lighting-app/nxp/k32w/k32w1/main/include/LightingManager.h deleted file mode 100644 index f96d6c7ecae40c..00000000000000 --- a/examples/lighting-app/nxp/k32w/k32w1/main/include/LightingManager.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * - * Copyright (c) 2021 Google LLC. - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include - -#include "AppEvent.h" - -#include "FreeRTOS.h" -#include "timers.h" // provides FreeRTOS timer support - -class LightingManager -{ -public: - enum Action_t - { - TURNON_ACTION = 0, - TURNOFF_ACTION, - DIM_ACTION, - INVALID_ACTION - } Action; - - enum State_t - { - kState_On = 0, - kState_Off, - } State; - - static const uint8_t kLevel_Max = 254; - static const uint8_t kLevel_Min = 0; - - int Init(); - bool IsTurnedOff(); - uint8_t GetDimLevel(); - bool InitiateAction(int32_t aActor, Action_t aAction, uint8_t kValue); - - typedef void (*Callback_fn_initiated)(Action_t, int32_t aActor); - typedef void (*Callback_fn_completed)(Action_t, uint8_t level); - void SetCallbacks(Callback_fn_initiated aActionInitiated_CB, Callback_fn_completed aActionCompleted_CB); - void SetState(bool state); - void SetDimLevel(uint8_t level); - -private: - friend LightingManager & LightingMgr(void); - State_t mState; - uint8_t mLevel; - - Callback_fn_initiated mActionInitiated_CB; - Callback_fn_completed mActionCompleted_CB; - - static LightingManager sLight; -}; - -inline LightingManager & LightingMgr(void) -{ - return LightingManager::sLight; -} diff --git a/examples/lighting-app/nxp/k32w/k32w1/main/include/app_config.h b/examples/lighting-app/nxp/k32w/k32w1/main/include/app_config.h deleted file mode 100644 index 1478b53b11aba1..00000000000000 --- a/examples/lighting-app/nxp/k32w/k32w1/main/include/app_config.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * - * Copyright (c) 2021 Google LLC. - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -// ---- Light Example App Config ---- - -#define RESET_BUTTON 1 -#define LIGHT_BUTTON 2 -#define SOFT_RESET_BUTTON 3 -#define BLE_BUTTON 4 - -#define RESET_BUTTON_PUSH 1 -#define LIGHT_BUTTON_PUSH 2 -#define SOFT_RESET_BUTTON_PUSH 3 -#define BLE_BUTTON_PUSH 4 - -#define APP_BUTTON_PUSH 1 - -#define LIGHT_STATE_LED 1 -#define SYSTEM_STATE_LED 0 - -// Time it takes for the light to switch on/off -#define ACTUATOR_MOVEMENT_PERIOS_MS 50 - -// ---- Light Example SWU Config ---- -#define SWU_INTERVAl_WINDOW_MIN_MS (23 * 60 * 60 * 1000) // 23 hours -#define SWU_INTERVAl_WINDOW_MAX_MS (24 * 60 * 60 * 1000) // 24 hours - -#if K32W_LOG_ENABLED -#define K32W_LOG(...) otPlatLog(OT_LOG_LEVEL_NONE, OT_LOG_REGION_API, ##__VA_ARGS__); -#else -#define K32W_LOG(...) -#endif diff --git a/examples/lighting-app/nxp/k32w/k32w1/main/main.cpp b/examples/lighting-app/nxp/k32w/k32w1/main/main.cpp deleted file mode 100644 index 53a6efbbb3ffd5..00000000000000 --- a/examples/lighting-app/nxp/k32w/k32w1/main/main.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - * - * Copyright (c) 2021 Google LLC. - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// ================================================================================ -// Main Code -// ================================================================================ - -#include "openthread/platform/logging.h" -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "FreeRtosHooks.h" -#include "app_config.h" -#include "pin_mux.h" - -using namespace ::chip; -using namespace ::chip::Inet; -using namespace ::chip::DeviceLayer; -using namespace ::chip::Logging; - -#include - -#if PW_RPC_ENABLED -#include "Rpc.h" -#endif - -typedef void (*InitFunc)(void); -extern InitFunc __init_array_start; -extern InitFunc __init_array_end; - -extern "C" void main_task(void const * argument) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - /* Call C++ constructors */ - InitFunc * pFunc = &__init_array_start; - for (; pFunc < &__init_array_end; ++pFunc) - { - (*pFunc)(); - } - - mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree); - - err = PlatformMgrImpl().InitBoardFwk(); - if (err != CHIP_NO_ERROR) - { - return; - } - - /* Used for HW initializations */ - otSysInit(0, NULL); - -#if PW_RPC_ENABLED - /* set clock */ - CLOCK_SetIpSrc(kCLOCK_Lpuart1, kCLOCK_IpSrcFro192M); - /* enable clock */ - CLOCK_EnableClock(kCLOCK_Lpuart1); - - BOARD_InitPinLPUART1_TX(); - BOARD_InitPinLPUART1_RX(); - chip::rpc::Init(); -#endif - - K32W_LOG("Welcome to NXP Lighting Demo App"); - - /* Mbedtls Threading support is needed because both - * Thread and Matter tasks are using it */ - freertos_mbedtls_mutex_init(); - - // Init Chip memory management before the stack - chip::Platform::MemoryInit(); - - err = PlatformMgr().InitChipStack(); - if (err != CHIP_NO_ERROR) - { - K32W_LOG("Error during PlatformMgr().InitMatterStack()"); - goto exit; - } - - err = ThreadStackMgr().InitThreadStack(); - if (err != CHIP_NO_ERROR) - { - K32W_LOG("Error during ThreadStackMgr().InitThreadStack()"); - goto exit; - } - - err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); - - if (err != CHIP_NO_ERROR) - { - goto exit; - } - - // Start OpenThread task - err = ThreadStackMgrImpl().StartThreadTask(); - if (err != CHIP_NO_ERROR) - { - K32W_LOG("Error during ThreadStackMgrImpl().StartThreadTask()"); - goto exit; - } - - err = GetAppTask().StartAppTask(); - if (err != CHIP_NO_ERROR) - { - K32W_LOG("Error during GetAppTask().StartAppTask()"); - goto exit; - } - - err = PlatformMgr().StartEventLoopTask(); - if (err != CHIP_NO_ERROR) - { - K32W_LOG("Error during PlatformMgr().StartEventLoopTask();"); - goto exit; - } - - GetAppTask().AppTaskMain(NULL); - -exit: - return; -} - -/** - * Glue function called directly by the OpenThread stack - * when system event processing work is pending. - */ -extern "C" void otSysEventSignalPending(void) -{ - { - BaseType_t yieldRequired = ThreadStackMgrImpl().SignalThreadActivityPendingFromISR(); - portYIELD_FROM_ISR(yieldRequired); - } -} diff --git a/examples/lighting-app/nxp/k32w/k32w1/third_party/connectedhomeip b/examples/lighting-app/nxp/k32w/k32w1/third_party/connectedhomeip deleted file mode 120000 index 305f2077ffe860..00000000000000 --- a/examples/lighting-app/nxp/k32w/k32w1/third_party/connectedhomeip +++ /dev/null @@ -1 +0,0 @@ -../../../../../.. \ No newline at end of file diff --git a/examples/lighting-app/nxp/k32w/k32w1/.gn b/examples/lighting-app/nxp/k32w1/.gn similarity index 93% rename from examples/lighting-app/nxp/k32w/k32w1/.gn rename to examples/lighting-app/nxp/k32w1/.gn index a88f6f5aa7cb3f..afa5bfea46aca8 100644 --- a/examples/lighting-app/nxp/k32w/k32w1/.gn +++ b/examples/lighting-app/nxp/k32w1/.gn @@ -27,5 +27,5 @@ default_args = { import("//args.gni") # Import default platform configs - import("${chip_root}/src/platform/nxp/k32w/k32w1/args.gni") + import("${chip_root}/src/platform/nxp/k32w1/args.gni") } diff --git a/examples/lighting-app/nxp/k32w1/BUILD.gn b/examples/lighting-app/nxp/k32w1/BUILD.gn new file mode 100644 index 00000000000000..b6e6db814ad221 --- /dev/null +++ b/examples/lighting-app/nxp/k32w1/BUILD.gn @@ -0,0 +1,268 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/chip.gni") +import("//build_overrides/nxp_sdk.gni") +import("//build_overrides/openthread.gni") + +import("${nxp_sdk_build_root}/nxp_sdk.gni") + +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/crypto/crypto.gni") +import("${chip_root}/src/platform/device.gni") +import("${chip_root}/src/platform/nxp/${nxp_platform}/args.gni") + +import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") + +if (chip_enable_pw_rpc) { + import("//build_overrides/pigweed.gni") + import("$dir_pw_build/target_types.gni") + import("${chip_root}/examples/platform/nxp/pw_rpc_server.gni") +} + +declare_args() { + # Setup discriminator as argument + setup_discriminator = 3840 +} + +assert(current_os == "freertos") +assert(target_os == "freertos") + +example_platform_dir = "${chip_root}/examples/platform/nxp/${nxp_platform}" +common_example_dir = "${chip_root}/examples/platform/nxp/common" + +k32w1_sdk("sdk") { + defines = [] + include_dirs = [] + sources = [] + + # Indicate the path to CHIPProjectConfig.h + include_dirs += [ "include/config" ] + + # Indicate the default path to FreeRTOSConfig.h + include_dirs += [ "${example_platform_dir}/app/project_include/freeRTOS" ] + + # Indicate the default path to OpenThreadConfig.h + include_dirs += [ "${example_platform_dir}/app/project_include/openthread" ] + + include_dirs += [ + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/K32W1480", + ] + + sources += [ + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/K32W1480/clock_config.c", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/K32W1480/pin_mux.c", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/app_services_init.c", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board.c", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_comp.c", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_dcdc.c", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_extflash.c", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/board_lp.c", + "${k32w1_sdk_root}/middleware/wireless/framework/boards/kw45_k32w1/hardware_init.c", + ] + + if (is_debug) { + defines += [ "BUILD_RELEASE=0" ] + } else { + defines += [ "BUILD_RELEASE=1" ] + } + + if (chip_enable_pw_rpc) { + defines += [ + "CONFIG_ENABLE_PW_RPC", + "STREAMER_UART_FLUSH_DELAY_MS=0", + "STREAMER_UART_SERIAL_MANAGER_RING_BUFFER_SIZE=512", + "BOARD_APP_UART_CLK_FREQ=96000000", + ] + } + + defines += [ + "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR=${setup_discriminator}", + ] + + if (chip_key_storage == "littlefs") { + include_dirs += [ "${example_platform_dir}/board" ] + sources += [ + "${example_platform_dir}/board/peripherals.c", + "${example_platform_dir}/board/peripherals.h", + ] + } +} + +k32w1_executable("light_app") { + output_name = "chip-k32w1-light-example" + + defines = [] + deps = [] + sources = [] + + if (chip_enable_pw_rpc) { + forward_variables_from(pw_rpc_server, "*") + } else { + include_dirs = [] + cflags = [ "-Wconversion" ] + } + + # Defines used by common code + defines += [ + "CONFIG_NET_L2_OPENTHREAD=1", + "CONFIG_NETWORK_LAYER_BLE=1", + "CONFIG_OPERATIONAL_KEYSTORE=1", + "CONFIG_ENABLE_FEEDBACK=1", + "APP_QUEUE_TICKS_TO_WAIT=pdMS_TO_TICKS(10)", + "EXTERNAL_FACTORY_DATA_PROVIDER_HEADER=\"platform/nxp/common/legacy/FactoryDataProvider.h\"", + ] + + # App common files + include_dirs += [ + "${common_example_dir}/app_task/include", + "${common_example_dir}/matter_button/include", + "${common_example_dir}/clusters/include", + "${common_example_dir}/device_callbacks/include", + "${common_example_dir}/device_manager/include", + "${common_example_dir}/factory_data/include", + "${common_example_dir}/led_widget/include", + "${common_example_dir}/operational_keystore/include", + "${common_example_dir}/rpc/include", + "${common_example_dir}/ui_feedback/include", + ] + + sources += [ + "${common_example_dir}/app_task/source/AppTaskBase.cpp", + "${common_example_dir}/app_task/source/AppTaskFreeRTOS.cpp", + "${common_example_dir}/clusters/source/ZclCallbacks.cpp", + "${common_example_dir}/device_callbacks/source/CommonDeviceCallbacks.cpp", + "${common_example_dir}/device_manager/source/CHIPDeviceManager.cpp", + "${example_platform_dir}/factory_data/source/AppFactoryDataExample.cpp", + ] + + if (chip_enable_ota_requestor) { + defines += [ + "CONFIG_CHIP_OTA_IMAGE_PROCESSOR_HEADER=\"platform/nxp/common/legacy/OTAImageProcessorImpl.h\"", + + # The status LED and the external flash CS pin are wired together. The OTA image writing may fail if used together. + "LED_MANAGER_ENABLE_STATUS_LED=0", + ] + + include_dirs += [ "${common_example_dir}/ota_requestor/include" ] + sources += [ "${common_example_dir}/ota_requestor/source/OTARequestorInitiatorMultiImage.cpp" ] + deps += [ "${chip_root}/src/platform/nxp:nxp_ota" ] + } + + # Platform specific files + include_dirs += [ + "${example_platform_dir}/util", + "${example_platform_dir}/app/support", + "${example_platform_dir}/button", + ] + + sources += [ + "${example_platform_dir}/button/ButtonManager.cpp", + "${example_platform_dir}/clusters/Identify.cpp", + "${example_platform_dir}/operational_keystore/OperationalKeystore.cpp", + ] + + if (chip_enable_ota_requestor) { + sources += [ "${example_platform_dir}/ota/OtaUtils.cpp" ] + } + + if (chip_enable_pw_rpc) { + sources += [ "${example_platform_dir}/rpc/AppRpc.cpp" ] + } + + if (chip_with_factory_data == 1) { + include_dirs += [ "${chip_root}/src/platform/nxp/common/legacy" ] + deps += [ "${chip_root}/src/platform/nxp:nxp_factory_data" ] + } + + sources += [ + "../common/AppTask.cpp", + "../common/DeviceCallbacks.cpp", + "../common/main.cpp", + ] + + include_dirs += [ + "../common", + "../common/include", + "include/config", + ] + + deps += [ + "${chip_root}/examples/providers:device_info_provider", + "${chip_root}/src/platform/logging:default", + ] + + if (chip_config_dimmable_led) { + defines += [ "LIGHTING_MANAGER_ENABLE_DIMMABLE_LED=1" ] + sources += [ + "${common_example_dir}/led_widget/include/LedDimmer.h", + "${example_platform_dir}/util/LedDimmer.cpp", + "${example_platform_dir}/util/LightingManagerDimmable.cpp", + ] + deps += [ "${chip_root}/examples/lighting-app/lighting-common/" ] + } else { + sources += [ + "${common_example_dir}/ui_feedback/source/LedManager.cpp", + "${example_platform_dir}/util/LedOnOff.cpp", + ] + deps += [ "${chip_root}/examples/lighting-app/nxp/zap/" ] + } + + if (chip_openthread_ftd) { + deps += [ + "${openthread_root}:libopenthread-cli-ftd", + "${openthread_root}:libopenthread-ftd", + ] + } else { + deps += [ + "${openthread_root}:libopenthread-cli-mtd", + "${openthread_root}:libopenthread-mtd", + ] + } + + if (use_smu2_static) { + ldscript = "${example_platform_dir}/app/ldscripts/k32w1_app.ld" + base_ldscript_dir = "${k32w1_sdk_root}/middleware/wireless/framework/Common/devices/kw45_k32w1/gcc" + } else { + ldscript = "${k32w1_sdk_root}/middleware/wireless/framework/Common/devices/kw45_k32w1/gcc/connectivity.ld" + } + + inputs = [ ldscript ] + + ldflags = [ + "-Wl,--defsym=__heap_size__=0", + "-Wl,--defsym=__stack_size__=0x480", + "-Wl,-print-memory-usage", + "-Wl,--no-warn-rwx-segments", + "-T" + rebase_path(ldscript, root_build_dir), + ] + + if (chip_with_factory_data == 1) { + ldflags += [ "-Wl,--defsym=gUseFactoryData_d=1" ] + } + + if (use_smu2_static) { + ldflags += [ "-L" + rebase_path(base_ldscript_dir, root_build_dir) ] + } + + output_dir = root_out_dir +} + +group("default") { + deps = [ ":light_app" ] +} diff --git a/examples/lighting-app/nxp/k32w/k32w1/README.md b/examples/lighting-app/nxp/k32w1/README.md similarity index 80% rename from examples/lighting-app/nxp/k32w/k32w1/README.md rename to examples/lighting-app/nxp/k32w1/README.md index 3bf2ab8105481b..349deef640727d 100644 --- a/examples/lighting-app/nxp/k32w/k32w1/README.md +++ b/examples/lighting-app/nxp/k32w1/README.md @@ -16,30 +16,32 @@ into an existing Matter network and can be controlled by this network.
- [Matter K32W1 Lighting Example Application](#matter-k32w1-lighting-example-application) -- [Introduction](#introduction) - - [Bluetooth LE Advertising](#bluetooth-le-advertising) - - [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous) -- [Device UI](#device-ui) -- [Building](#building) - - [SMU2](#smu2-memory) - - [LED PWM](#led-pwm) -- [Manufacturing data](#manufacturing-data) -- [Flashing](#flashing) - - [Flashing the NBU image](#flashing-the-nbu-image) - - [Flashing the host image](#flashing-the-host-image) -- [Debugging](#debugging) -- [OTA](#ota) - - [Convert srec into sb3 file](#convert-srec-into-sb3-file) - - [Convert sb3 into ota file](#convert-sb3-into-ota-file) - - [Running OTA](#running-ota) - - [Known issues](#known-issues) -- [Running RPC console](#running-rpc-console) + - [Introduction](#introduction) + - [Bluetooth LE Advertising](#bluetooth-le-advertising) + - [Bluetooth LE Rendezvous](#bluetooth-le-rendezvous) + - [Thread Provisioning](#thread-provisioning) + - [Device UI](#device-ui) + - [Building](#building) + - [`SMU2` Memory](#smu2-memory) + - [LED PWM](#led-pwm) + - [Manufacturing data](#manufacturing-data) + - [Flashing](#flashing) + - [Flashing the `NBU` image](#flashing-the-nbu-image) + - [Flashing the host image](#flashing-the-host-image) + - [Debugging](#debugging) + - [OTA](#ota) + - [Convert `srec` into `sb3` file](#convert-srec-into-sb3-file) + - [Convert `sb3` into `ota` file](#convert-sb3-into-ota-file) + - [OTA factory data](#ota-factory-data) + - [Running OTA](#running-ota) + - [Known issues](#known-issues) + - [Running RPC console](#running-rpc-console) ## Introduction -![K32W1 EVK](../../../../platform/nxp/k32w/k32w1/doc/images/k32w1-evk.jpg) +![K32W1 EVK](../../../platform/nxp/k32w1/doc/images/k32w1-evk.jpg) The K32W1 lighting example application provides a working demonstration of a light bulb device, built using the Matter codebase and the NXP K32W1 SDK. The @@ -119,26 +121,52 @@ does a clean soft reset that takes into account Matter shutdown procedure. ## Building -In order to build the Matter example, we recommend using a Linux distribution -(the demo-application was compiled on Ubuntu 20.04). +In order to build the Project CHIP example, we recommend using a Linux +distribution. Supported Operating Systems and prerequisites are listed in +[BUILDING](../../../../docs/guides/BUILDING.md). -- Download [K32W1 SDK for Matter](https://mcuxpresso.nxp.com/). Creating an - nxp.com account is required before being able to download the SDK. Once the - account is created, login and follow the steps for downloading K32W148-EVK - MCUXpresso SDK. The SDK Builder UI selection should be similar with the one - from the image below. +- Make sure that below prerequisites are correctly installed - ![MCUXpresso SDK Download](../../../../platform/nxp/k32w/k32w1/doc/images/mcux-sdk-download.jpg) +``` +sudo apt-get install git gcc g++ pkg-config libssl-dev libdbus-1-dev \ + libglib2.0-dev libavahi-client-dev ninja-build python3-venv python3-dev \ + python3-pip unzip libgirepository1.0-dev libcairo2-dev libreadline-dev +``` - Please refer to Matter release notes for getting the latest released SDK. +- Step 1: checkout NXP specific submodules only ``` -user@ubuntu:~/Desktop/git/connectedhomeip$ export NXP_K32W1_SDK_ROOT=/home/user/Desktop/SDK_K32W1/ -user@ubuntu:~/Desktop/git/connectedhomeip$ source ./scripts/activate.sh user@ubuntu:~/Desktop/git/connectedhomeip$ scripts/checkout_submodules.py --shallow --platform nxp --recursive -user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/lighting-app/nxp/k32w/k32w1 -user@ubuntu:~/Desktop/git/connectedhomeip/examples/lighting-app/nxp/k32w/k32w1$ gn gen out/debug -user@ubuntu:~/Desktop/git/connectedhomeip/examples/lighting-app/nxp/k32w/k32w1$ ninja -C out/debug +``` + +- Step 2: activate local environment + +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ source scripts/activate.sh +``` + +If the script says the environment is out of date, you can update it by running +the following command: + +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ source scripts/bootstrap.sh +``` + +- Step 3: Init NXP SDK(s) + +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ scripts/setup/nxp/update_nxp_sdk.py --platform common_sdk +``` + +Note: By default setup/nxp/update_nxp_sdk.py will try to initialize all NXP +SDKs. Arg "-- help" could be used to view all available options. + +- Start building the application. + +``` +user@ubuntu:~/Desktop/git/connectedhomeip$ cd examples/lighting-app/nxp/k32w1 +user@ubuntu:~/Desktop/git/connectedhomeip/examples/lighting-app/nxp/k32w1$ gn gen out/debug +user@ubuntu:~/Desktop/git/connectedhomeip/examples/lighting-app/nxp/k32w1$ ninja -C out/debug ``` In case that Openthread CLI is needed, `chip_with_ot_cli` build argument must be @@ -162,8 +190,8 @@ memory: These instances and global variables are placed in `SMU2` memory through name matching in the application linker script. They should not be changed or, if changed, the names must be updated in `k32w1_app.ld`. See -[k32w1_app.ld](../../../../platform/nxp/k32w/k32w1/app/ldscripts/k32w1_app.ld) -for names and `SMU2` memory range size. +[k32w1_app.ld](../../../platform/nxp/k32w1/app/ldscripts/k32w1_app.ld) for names +and `SMU2` memory range size. The OpenThread buffers can be allocated from a 13KB `SMU2` range after a successful commissioning process until a factory reset is initiated. This way, @@ -171,6 +199,8 @@ the OpenThread buffers will be dynamically allocated instead of statically, freeing some `SRAM`. To enable this feature compile with OpenThread FTD support (`chip_openthread_ftd=true`) and with `use_smu2_dynamic=true`. +`use_smu2_static` and `use_smu2_dynamic` are set to `true` by default. + ### LED PWM In the default configuration, the onboard RGB LED pins are configured as GPIO @@ -180,14 +210,14 @@ this feature, compile the application with: `chip_config_dimmable_led=true` If the feature is enabled, the LED brightness can be controlled using **Level control** cluster -[commands](../../../../../docs/guides/chip_tool_guide.md#step-7-control-application-data-model-clusters). +[commands](../../../../docs/guides/chip_tool_guide.md#step-7-control-application-data-model-clusters). ## Manufacturing data Use `chip_with_factory_data=1` in the gn build command to enable factory data. For a full guide on manufacturing flow, please see -[Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp/nxp_manufacturing_flow.md). +[Guide for writing manufacturing data on NXP devices](../../../../docs/guides/nxp/nxp_manufacturing_flow.md). ## Flashing @@ -250,7 +280,7 @@ One option for debugging would be to use MCUXpresso IDE. - Drag-and-drop the zip file containing the NXP SDK in the "Installed SDKs" tab: -![Installed SDKs](../../../../platform/nxp/k32w/k32w1/doc/images/installed_sdks.jpg) +![Installed SDKs](../../../platform/nxp/k32w1/doc/images/installed_sdks.jpg) - Import any demo application from the installed SDK: @@ -258,7 +288,7 @@ One option for debugging would be to use MCUXpresso IDE. Import SDK example(s).. -> choose a demo app (demo_apps -> hello_world) -> Finish ``` -![Import demo](../../../../platform/nxp/k32w/k32w1/doc/images/import_demo.jpg) +![Import demo](../../../platform/nxp/k32w1/doc/images/import_demo.jpg) - Flash the previously imported demo application on the board: @@ -277,7 +307,7 @@ resulted after ot-nxp compilation. File -> Import -> C/C++ -> Existing Code as Makefile Project ``` -![New Project](../../../../platform/nxp/k32w/k32w1/doc/images/new_project.jpg) +![New Project](../../../platform/nxp/k32w1/doc/images/new_project.jpg) - Replace the path of the existing demo application with the path of the K32W1 application: @@ -286,7 +316,7 @@ File -> Import -> C/C++ -> Existing Code as Makefile Project Run -> Debug Configurations... -> C/C++ Application ``` -![Debug K32W1](../../../../platform/nxp/k32w/k32w1/doc/images/debug_k32w1.jpg) +![Debug K32W1](../../../platform/nxp/k32w1/doc/images/debug_k32w1.jpg) ## OTA @@ -314,16 +344,21 @@ In `OTAP` application In order to build an OTA image, use NXP wrapper over the standard tool `src/app/ota_image_tool.py`: -- `scripts/tools/nxp/factory_data_generator/ota_image_tool.py` The tool can be - used to generate an OTA image with the following format: - `| OTA image header | TLV1 | TLV2 | ... | TLVn |` where each TLV is in the - form `|tag|length|value|` +- `scripts/tools/nxp/factory_data_generator/ota_image_tool.py` + +The tool can be used to generate an OTA image with the following format: + +``` + | OTA image header | TLV1 | TLV2 | ... | TLVn | +``` + +where each TLV is in the form `|tag|length|value|`. Note that "standard" TLV format is used. Matter TLV format is only used for factory data TLV value. Please see more in the -[OTA image tool guide](../../../../../scripts/tools/nxp/ota/README.md). +[OTA image tool guide](../../../../scripts/tools/nxp/ota/README.md). Here is an example that generates an OTA image with application update TLV from a sb3 file: @@ -340,12 +375,24 @@ having a correct OTA process, the OTA header version should be the same as the binary embedded software version. A user can set a custom software version in the gn build args by setting `chip_software_version` to the wanted version. +### OTA factory data + +A user can update the factory data through OTA, at the same time the application +firmware is updated by enabling the following processor in the `gn args`: + +- `chip_enable_ota_factory_data_processor=1` to enable default factory data + update processor (disabled by default). + +The OTA image used must be updated to include the new factory data. + +[OTA image tool guide](../../../../scripts/tools/nxp/ota/README.md). + ### Running OTA The OTA topology used for OTA testing is illustrated in the figure below. Topology is similar with the one used for Matter Test Events. -![OTA_TOPOLOGY](../../../../platform/nxp/k32w/k32w1/doc/images/ota_topology.JPG) +![OTA_TOPOLOGY](../../../platform/nxp/k32w1/doc/images/ota_topology.JPG) The concept for OTA is the next one: @@ -460,10 +507,16 @@ by running: `chip-console --device /dev/tty. -b 115200 -o pw_log.out` The console should already have been installed in the virtual environment. From -the `chip-console`, a user can send specific commands to the device, e.g.: +the `chip-console`, a user can send specific commands to the device. + +For button commands, please run `rpcs.chip.rpc.Button.Event(index)` based on the +table below: + +| index | action | +| ----- | --------------------------------------------- | +| 0 | Start/stop BLE advertising | +| 1 | Factory reset the device | +| 2 | Application specific action (e.g. toggle LED) | +| 3 | Soft reset the device | -- To toggle the LED (`#define LIGHT_BUTTON 2` in `app_config.h`) - `rpcs.chip.rpc.Button.Event(idx=2)` -- To start BLE advertising (`#define BLE_BUTTON 4` in `app_config.h`) - `rpcs.chip.rpc.Button.Event(idx=4)` -- To reboot the device `rpcs.chip.rpc.Device.Reboot()` +To reboot the device, please run `rpcs.chip.rpc.Device.Reboot()`. diff --git a/examples/lighting-app/nxp/k32w/k32w1/args.gni b/examples/lighting-app/nxp/k32w1/args.gni similarity index 74% rename from examples/lighting-app/nxp/k32w/k32w1/args.gni rename to examples/lighting-app/nxp/k32w1/args.gni index d0c28a1e048545..7d5e752aae6934 100644 --- a/examples/lighting-app/nxp/k32w/k32w1/args.gni +++ b/examples/lighting-app/nxp/k32w1/args.gni @@ -13,9 +13,11 @@ # limitations under the License. import("//build_overrides/chip.gni") +import("${chip_root}/config/standalone/args.gni") # SDK target. This is overridden to add our SDK app_config.h & defines. -k32w1_sdk_target = get_label_info(":sdk", "label_no_toolchain") +nxp_sdk_target = get_label_info(":sdk", "label_no_toolchain") +nxp_device = "K32W1480" chip_config_dimmable_led = false chip_enable_ota_requestor = true @@ -27,3 +29,10 @@ is_debug = false chip_crypto = "platform" chip_openthread_ftd = true chip_with_ot_cli = 0 + +chip_system_config_provide_statistics = false +chip_system_config_use_open_thread_inet_endpoints = true +chip_with_lwip = false + +use_smu2_static = false +use_smu2_dynamic = false diff --git a/examples/lighting-app/nxp/k32w1/build_overrides b/examples/lighting-app/nxp/k32w1/build_overrides new file mode 120000 index 00000000000000..ee19c065d619a2 --- /dev/null +++ b/examples/lighting-app/nxp/k32w1/build_overrides @@ -0,0 +1 @@ +../../../build_overrides/ \ No newline at end of file diff --git a/examples/lighting-app/nxp/k32w1/include/config/AppConfig.h b/examples/lighting-app/nxp/k32w1/include/config/AppConfig.h new file mode 100644 index 00000000000000..6dcccf749bbebe --- /dev/null +++ b/examples/lighting-app/nxp/k32w1/include/config/AppConfig.h @@ -0,0 +1,29 @@ +/* + * Copyright 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +/* ---- App Config ---- */ +#define APP_DEVICE_TYPE_ENDPOINT 1 +#define APP_CLUSTER_ATTRIBUTE chip::app::Clusters::OnOff::Attributes::OnOff + +/* ---- Button Manager Config ---- */ +#define BUTTON_MANAGER_FACTORY_RESET_TIMEOUT_MS 6000 + +/* ---- LED Manager Config ---- */ +#define LED_MANAGER_STATUS_LED_INDEX 0 +#define LED_MANAGER_LIGHT_LED_INDEX 1 diff --git a/examples/lighting-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h b/examples/lighting-app/nxp/k32w1/include/config/CHIPProjectConfig.h similarity index 100% rename from examples/lighting-app/nxp/k32w/k32w1/include/CHIPProjectConfig.h rename to examples/lighting-app/nxp/k32w1/include/config/CHIPProjectConfig.h diff --git a/examples/lighting-app/nxp/k32w1/third_party/connectedhomeip b/examples/lighting-app/nxp/k32w1/third_party/connectedhomeip new file mode 120000 index 00000000000000..59307833b4fee9 --- /dev/null +++ b/examples/lighting-app/nxp/k32w1/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../../.. \ No newline at end of file diff --git a/examples/lighting-app/nxp/k32w/k32w1/with_pw_rpc.gni b/examples/lighting-app/nxp/k32w1/with_pw_rpc.gni similarity index 84% rename from examples/lighting-app/nxp/k32w/k32w1/with_pw_rpc.gni rename to examples/lighting-app/nxp/k32w1/with_pw_rpc.gni index d6bea63f8402c0..c2dc1950544640 100644 --- a/examples/lighting-app/nxp/k32w/k32w1/with_pw_rpc.gni +++ b/examples/lighting-app/nxp/k32w1/with_pw_rpc.gni @@ -17,17 +17,21 @@ import("//build_overrides/chip.gni") import("${chip_root}/config/nxp/lib/pw_rpc/pw_rpc.gni") -import("${chip_root}/examples/platform/nxp/k32w/k32w1/args.gni") -k32w1_sdk_target = get_label_info(":sdk", "label_no_toolchain") +nxp_sdk_target = get_label_info(":sdk", "label_no_toolchain") -chip_enable_ota_requestor = true -chip_stack_lock_tracking = "fatal" +chip_crypto = "platform" chip_enable_ble = true +chip_enable_ota_requestor = true chip_enable_pw_rpc = true -chip_with_ot_cli = 0 -is_debug = false chip_openthread_ftd = true -chip_crypto = "platform" +chip_stack_lock_tracking = "fatal" + +chip_system_config_provide_statistics = false +chip_system_config_use_open_thread_inet_endpoints = true + +chip_with_lwip = false +chip_with_ot_cli = 0 cpp_standard = "gnu++17" +is_debug = false diff --git a/examples/platform/nxp/Rpc.cpp b/examples/platform/nxp/Rpc.cpp index 262825386ed13c..c0cb0b933f2ac7 100644 --- a/examples/platform/nxp/Rpc.cpp +++ b/examples/platform/nxp/Rpc.cpp @@ -16,7 +16,7 @@ * limitations under the License. */ -#include "AppTask.h" +#include "AppRpc.h" #include "FreeRTOS.h" #include "PigweedLogger.h" #include "PigweedLoggerMutex.h" @@ -43,8 +43,14 @@ #include "pigweed/rpc_services/Locking.h" #endif // defined(PW_RPC_LOCKING_SERVICE) && PW_RPC_LOCKING_SERVICE +#ifndef RPC_TASK_STACK_SIZE #define RPC_TASK_STACK_SIZE 2048 +#endif + +#ifndef RPC_TASK_PRIORITY #define RPC_TASK_PRIORITY 1 +#endif + TaskHandle_t RpcTaskHandle; namespace chip { @@ -56,7 +62,7 @@ class NxpButton final : public Button public: pw::Status Event(const chip_rpc_ButtonEvent & request, pw_protobuf_Empty & response) override { - GetAppTask().ButtonEventHandler(request.idx, request.idx); + chip::NXP::App::Rpc::ButtonHandler(request); return pw::OkStatus(); } }; @@ -77,7 +83,7 @@ class NxpDevice final : public Device static constexpr TickType_t kRebootTimerPeriodTicks = 300; TimerHandle_t mRebootTimer; - static void RebootHandler(TimerHandle_t) { NVIC_SystemReset(); } + static void RebootHandler(TimerHandle_t) { chip::NXP::App::Rpc::Reboot(); } }; #endif // defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE diff --git a/examples/platform/nxp/common/app_task/include/AppTaskBase.h b/examples/platform/nxp/common/app_task/include/AppTaskBase.h index 98cec56832b705..76e18df7f47eb0 100644 --- a/examples/platform/nxp/common/app_task/include/AppTaskBase.h +++ b/examples/platform/nxp/common/app_task/include/AppTaskBase.h @@ -27,9 +27,8 @@ #include #include -namespace chip { -namespace NXP { -namespace App { +namespace chip::NXP::App { + class AppTaskBase { public: @@ -97,6 +96,44 @@ class AppTaskBase */ virtual void AppMatter_RegisterCustomCliCommands(void){}; + /** + * \brief Disallow entering low power mode. + * + * This function can be overridden in order to implement a specific disallow mechanism. + * + */ + virtual void AppMatter_DisallowDeviceToSleep(void) {} + + /** + * \brief Allow entering low power mode. + * + * This function can be overridden in order to implement a specific allow mechanism. + * + */ + virtual void AppMatter_AllowDeviceToSleep(void) {} + + /** + * \brief Print onboarding information. + * + * It can be overwritten by derived classes for custom information, + * such as setting the commissioning flow to kUserActionRequired. + * + */ + virtual void PrintOnboardingInfo(); + + /** + * \brief Print current software version string and software version. + * + * It uses the ConfigurationManager API to extract the information. + */ + virtual void PrintCurrentVersion(); + + /** + * \brief Send event to the event queue. + * + */ + virtual void PostEvent(const AppEvent & event){}; + /** * \brief This function could be overridden in order to dispatch event. * @@ -142,6 +179,7 @@ class AppTaskBase private: inline static chip::CommonCaseDeviceServerInitParams initParams; + /* Functions used by the public commisioning handlers */ static void StartCommissioning(intptr_t arg); static void StopCommissioning(intptr_t arg); @@ -154,6 +192,5 @@ class AppTaskBase * Applications can use this to gain access to features of the AppTaskBase. */ extern AppTaskBase & GetAppTask(); -} // namespace App -} // namespace NXP -} // namespace chip + +} // namespace chip::NXP::App diff --git a/examples/platform/nxp/common/app_task/include/AppTaskFreeRTOS.h b/examples/platform/nxp/common/app_task/include/AppTaskFreeRTOS.h index 7ebc4a7430ccaf..0dd5c0d20652a7 100644 --- a/examples/platform/nxp/common/app_task/include/AppTaskFreeRTOS.h +++ b/examples/platform/nxp/common/app_task/include/AppTaskFreeRTOS.h @@ -21,9 +21,8 @@ #include "AppTaskBase.h" -namespace chip { -namespace NXP { -namespace App { +namespace chip::NXP::App { + class AppTaskFreeRTOS : public AppTaskBase { public: @@ -53,7 +52,7 @@ class AppTaskFreeRTOS : public AppTaskBase * \brief Send event to the event queue. * */ - void PostEvent(const AppEvent & event); + void PostEvent(const AppEvent & event) override; /** * \brief Return a pointer to the NXP Wifi Driver instance. @@ -72,9 +71,20 @@ class AppTaskFreeRTOS : public AppTaskBase */ virtual CHIP_ERROR AppMatter_Register(void) override; + /** + * \brief The app event queue handle should be static such that the concrete + * application task can initialize it during Start() call. + */ + QueueHandle_t appEventQueue; + + /** + * \brief This value is used when xQueueReceive is called to specify + * the maximum amount of time the task should block waiting for an event. + * This can be modified according to the application needs. + */ + TickType_t ticksToWait; + private: void DispatchEvent(const AppEvent & event); }; -} // namespace App -} // namespace NXP -} // namespace chip +} // namespace chip::NXP::App diff --git a/examples/platform/nxp/common/app_task/include/AppTaskZephyr.h b/examples/platform/nxp/common/app_task/include/AppTaskZephyr.h index 77cfaa0e468ccf..9a333a768e1f93 100644 --- a/examples/platform/nxp/common/app_task/include/AppTaskZephyr.h +++ b/examples/platform/nxp/common/app_task/include/AppTaskZephyr.h @@ -21,9 +21,8 @@ #include "AppTaskBase.h" -namespace chip { -namespace NXP { -namespace App { +namespace chip::NXP::App { + class AppTaskZephyr : public AppTaskBase { public: @@ -43,7 +42,7 @@ class AppTaskZephyr : public AppTaskBase * \brief Send event to the event queue. * */ - void PostEvent(const AppEvent & event); + void PostEvent(const AppEvent & event) override; /** * \brief Return a pointer to the NXP Wifi Driver instance. @@ -65,6 +64,5 @@ class AppTaskZephyr : public AppTaskBase private: void DispatchEvent(const AppEvent & event); }; -} // namespace App -} // namespace NXP -} // namespace chip + +} // namespace chip::NXP::App diff --git a/examples/platform/nxp/common/app_task/source/AppTaskBase.cpp b/examples/platform/nxp/common/app_task/source/AppTaskBase.cpp index 9ba90e6c146b74..10422121e5c81f 100644 --- a/examples/platform/nxp/common/app_task/source/AppTaskBase.cpp +++ b/examples/platform/nxp/common/app_task/source/AppTaskBase.cpp @@ -26,7 +26,6 @@ #include #include -#include #include #include @@ -37,7 +36,18 @@ #include -#ifdef EMBER_AF_PLUGIN_BINDING +#if defined(MATTER_DM_PLUGIN_USER_LABEL) || defined(MATTER_DM_PLUGIN_FIXED_LABEL) +#ifndef CONFIG_DEVICE_INFO_PROVIDER_IMPL +#define CONFIG_DEVICE_INFO_PROVIDER_IMPL 1 +#endif +#endif + +#if CONFIG_DEVICE_INFO_PROVIDER_IMPL +#include +#endif + +/* Flag generated by Zap */ +#ifdef MATTER_DM_PLUGIN_BINDING #include "binding-handler.h" #endif @@ -50,10 +60,22 @@ #include "TcpDownload.h" #endif +#if CONFIG_OPERATIONAL_KEYSTORE +#include "OperationalKeystore.h" +#endif + #if CONFIG_CHIP_OTA_PROVIDER #include #endif +#if CONFIG_DIAG_LOGS_DEMO +#include "DiagnosticLogsDemo.h" +#endif + +#if CONFIG_LOW_POWER +#include "LowPower.h" +#endif + #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR #include "OTARequestorInitiator.h" #endif @@ -66,6 +88,19 @@ #include #endif +#ifdef SMOKE_CO_ALARM +#include +#include +#endif + +#if CHIP_CONFIG_ENABLE_ICD_SERVER +#include +#endif + +#ifndef CONFIG_THREAD_DEVICE_TYPE +#define CONFIG_THREAD_DEVICE_TYPE kThreadDeviceType_Router +#endif + using namespace chip; using namespace chip::TLV; using namespace ::chip::Credentials; @@ -73,14 +108,16 @@ using namespace ::chip::DeviceLayer; using namespace ::chip::DeviceManager; using namespace ::chip::app::Clusters; +#if CONFIG_DEVICE_INFO_PROVIDER_IMPL chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider; +#endif #if CONFIG_CHIP_WIFI || CHIP_DEVICE_CONFIG_ENABLE_WPA app::Clusters::NetworkCommissioning::Instance sNetworkCommissioningInstance(0, chip::NXP::App::GetAppTask().GetWifiDriverInstance()); #endif -#if CONFIG_CHIP_TEST_EVENT && CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR +#if CHIP_CONFIG_ENABLE_ICD_SERVER || (CONFIG_CHIP_TEST_EVENT && CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR) static uint8_t sTestEventTriggerEnableKey[TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }; @@ -89,12 +126,14 @@ static uint8_t sTestEventTriggerEnableKey[TestEventTriggerDelegate::kEnableKeyLe #if CONFIG_NET_L2_OPENTHREAD void LockOpenThreadTask(void) { + chip::NXP::App::GetAppTask().AppMatter_DisallowDeviceToSleep(); chip::DeviceLayer::ThreadStackMgr().LockThreadStack(); } void UnlockOpenThreadTask(void) { chip::DeviceLayer::ThreadStackMgr().UnlockThreadStack(); + chip::NXP::App::GetAppTask().AppMatter_AllowDeviceToSleep(); } #endif @@ -106,7 +145,26 @@ void chip::NXP::App::AppTaskBase::InitServer(intptr_t arg) static OTATestEventTriggerDelegate testEventTriggerDelegate{ ByteSpan(sTestEventTriggerEnableKey) }; initParams.testEventTriggerDelegate = &testEventTriggerDelegate; #endif + +#ifdef SMOKE_CO_ALARM + static SimpleTestEventTriggerDelegate sTestEventTriggerDelegate{}; + static SmokeCOTestEventTriggerHandler sSmokeCOTestEventTriggerHandler{}; + VerifyOrDie(sTestEventTriggerDelegate.Init(ByteSpan(sTestEventTriggerEnableKey)) == CHIP_NO_ERROR); + VerifyOrDie(sTestEventTriggerDelegate.AddHandler(&sSmokeCOTestEventTriggerHandler) == CHIP_NO_ERROR); + initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; +#endif + +#if CHIP_CONFIG_ENABLE_ICD_SERVER + static SimpleTestEventTriggerDelegate sTestEventTriggerDelegate{}; + VerifyOrDie(sTestEventTriggerDelegate.Init(ByteSpan(sTestEventTriggerEnableKey)) == CHIP_NO_ERROR); + initParams.testEventTriggerDelegate = &sTestEventTriggerDelegate; +#endif + +#if CONFIG_OPERATIONAL_KEYSTORE + initParams.operationalKeystore = chip::NXP::App::OperationalKeystore::GetInstance(); +#endif (void) initParams.InitializeStaticResourcesBeforeServerInit(); + #if CONFIG_NET_L2_OPENTHREAD // Init ZCL Data Model and start server chip::Inet::EndPointStateOpenThread::OpenThreadEndpointInitParam nativeParams; @@ -117,12 +175,22 @@ void chip::NXP::App::AppTaskBase::InitServer(intptr_t arg) #endif VerifyOrDie((chip::Server::GetInstance().Init(initParams)) == CHIP_NO_ERROR); + auto * persistentStorage = &Server::GetInstance().GetPersistentStorage(); +#if CONFIG_OPERATIONAL_KEYSTORE + chip::NXP::App::OperationalKeystore::Init(persistentStorage); +#endif - gExampleDeviceInfoProvider.SetStorageDelegate(&Server::GetInstance().GetPersistentStorage()); +#if CONFIG_DEVICE_INFO_PROVIDER_IMPL + gExampleDeviceInfoProvider.SetStorageDelegate(persistentStorage); chip::DeviceLayer::SetDeviceInfoProvider(&gExampleDeviceInfoProvider); +#endif GetAppTask().PostInitMatterServerInstance(); +#if CONFIG_DIAG_LOGS_DEMO + chip::NXP::App::DiagnosticLogsDemo::DisplayUsage(); +#endif + #if CONFIG_CHIP_OTA_PROVIDER InitOTAServer(); #endif @@ -135,6 +203,10 @@ CHIP_ERROR chip::NXP::App::AppTaskBase::Init() /* Init Chip memory management before the stack */ chip::Platform::MemoryInit(); +#if CONFIG_LOW_POWER + chip::NXP::App::LowPower::Init(); +#endif + /* Initialize Matter factory data before initializing the Matter stack */ err = AppFactoryData_PreMatterStackInit(); @@ -187,7 +259,7 @@ CHIP_ERROR chip::NXP::App::AppTaskBase::Init() return err; } - err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router); + err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::CONFIG_THREAD_DEVICE_TYPE); if (err != CHIP_NO_ERROR) { return err; @@ -200,7 +272,8 @@ CHIP_ERROR chip::NXP::App::AppTaskBase::Init() */ PlatformMgr().ScheduleWork(InitServer, 0); -#ifdef EMBER_AF_PLUGIN_BINDING +/* Flag generated by Zap */ +#ifdef MATTER_DM_PLUGIN_BINDING /* Init binding handlers */ err = InitBindingHandlers(); if (err != CHIP_NO_ERROR) @@ -227,11 +300,9 @@ CHIP_ERROR chip::NXP::App::AppTaskBase::Init() ConfigurationMgr().LogDeviceConfig(); // QR code will be used with CHIP Tool -#if CONFIG_NETWORK_LAYER_BLE - PrintOnboardingCodes(chip::RendezvousInformationFlag(chip::RendezvousInformationFlag::kBLE)); -#else - PrintOnboardingCodes(chip::RendezvousInformationFlag(chip::RendezvousInformationFlag::kOnNetwork)); -#endif /* CONFIG_NETWORK_LAYER_BLE */ + PrintOnboardingInfo(); + + PrintCurrentVersion(); /* Start a task to run the CHIP Device event loop. */ err = PlatformMgr().StartEventLoopTask(); @@ -333,3 +404,37 @@ void chip::NXP::App::AppTaskBase::FactoryResetHandler(void) chip::Server::GetInstance().GenerateShutDownEvent(); chip::Server::GetInstance().ScheduleFactoryReset(); } + +void chip::NXP::App::AppTaskBase::PrintOnboardingInfo() +{ +#if CONFIG_NETWORK_LAYER_BLE + auto flags = chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE); +#else + auto flags = chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kOnNetwork); +#endif /* CONFIG_NETWORK_LAYER_BLE */ + + chip::PayloadContents payload; + CHIP_ERROR err = GetPayloadContents(payload, flags); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "GetPayloadContents() failed: %" CHIP_ERROR_FORMAT, err.Format()); + } +#if CONFIG_USER_ACTION_REQUIRED + payload.commissioningFlow = chip::CommissioningFlow::kUserActionRequired; +#endif + PrintOnboardingCodes(payload); +} + +void chip::NXP::App::AppTaskBase::PrintCurrentVersion() +{ + // Print the current software version + char currentSoftwareVer[ConfigurationManager::kMaxSoftwareVersionStringLength + 1] = { 0 }; + auto err = ConfigurationMgr().GetSoftwareVersionString(currentSoftwareVer, sizeof(currentSoftwareVer)); + ReturnOnFailure(err); + + uint32_t currentVersion; + err = ConfigurationMgr().GetSoftwareVersion(currentVersion); + ReturnOnFailure(err); + + ChipLogProgress(DeviceLayer, "Current Software Version: %s, %d", currentSoftwareVer, static_cast(currentVersion)); +} diff --git a/examples/platform/nxp/common/app_task/source/AppTaskFreeRTOS.cpp b/examples/platform/nxp/common/app_task/source/AppTaskFreeRTOS.cpp index c48894ed6467cf..5b8e3eab70be40 100644 --- a/examples/platform/nxp/common/app_task/source/AppTaskFreeRTOS.cpp +++ b/examples/platform/nxp/common/app_task/source/AppTaskFreeRTOS.cpp @@ -34,6 +34,14 @@ #include "AppCLIBase.h" #endif +#if CONFIG_ENABLE_FEEDBACK +#include "UserInterfaceFeedback.h" +#endif + +#if CONFIG_ENABLE_PW_RPC +#include "AppRpc.h" +#endif + #include #include @@ -45,12 +53,18 @@ #ifndef APP_TASK_STACK_SIZE #define APP_TASK_STACK_SIZE ((configSTACK_DEPTH_TYPE) 6144 / sizeof(portSTACK_TYPE)) #endif + #ifndef APP_TASK_PRIORITY #define APP_TASK_PRIORITY 2 #endif + +#ifndef APP_EVENT_QUEUE_SIZE #define APP_EVENT_QUEUE_SIZE 10 +#endif -static QueueHandle_t sAppEventQueue; +#ifndef APP_QUEUE_TICKS_TO_WAIT +#define APP_QUEUE_TICKS_TO_WAIT portMAX_DELAY +#endif using namespace chip; using namespace chip::TLV; @@ -71,12 +85,18 @@ chip::DeviceLayer::NetworkCommissioning::WiFiDriver * chip::NXP::App::AppTaskFre CHIP_ERROR chip::NXP::App::AppTaskFreeRTOS::AppMatter_Register() { CHIP_ERROR err = CHIP_NO_ERROR; + /* Register Matter CLI cmds */ #ifdef ENABLE_CHIP_SHELL err = chip::NXP::App::GetAppCLI().Init(); VerifyOrReturnError(err == CHIP_NO_ERROR, err, ChipLogError(DeviceLayer, "Error during CLI init")); AppMatter_RegisterCustomCliCommands(); #endif + +#if CONFIG_ENABLE_FEEDBACK + FeedbackMgr().Init(); +#endif + /* Register Matter buttons */ err = AppMatterButton_registerButtons(); if (err != CHIP_NO_ERROR) @@ -92,14 +112,30 @@ CHIP_ERROR chip::NXP::App::AppTaskFreeRTOS::Start() CHIP_ERROR err = CHIP_NO_ERROR; TaskHandle_t taskHandle; - sAppEventQueue = xQueueCreate(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent)); - if (sAppEventQueue == NULL) +#if CONFIG_ENABLE_PW_RPC + chip::NXP::App::Rpc::Init(); +#endif + + appEventQueue = xQueueCreate(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent)); + if (appEventQueue == NULL) { err = CHIP_ERROR_NO_MEMORY; ChipLogError(DeviceLayer, "Failed to allocate app event queue"); assert(err == CHIP_NO_ERROR); } + ticksToWait = APP_QUEUE_TICKS_TO_WAIT; + +#if FSL_OSA_MAIN_FUNC_ENABLE + /* When OSA is used, this code will be called from within the startup_task + * and the scheduler will be started at this point. Just call AppTaskMain to + * start the main loop instead of creating a task, since we are already in it. + * Task parameters are configured through SDK flags: + * - gMainThreadPriority_c + * - gMainThreadStackSize_c + */ + AppTaskFreeRTOS::AppTaskMain(this); +#else /* AppTaskMain function will loss actual object instance, give it as parameter */ if (xTaskCreate(&AppTaskFreeRTOS::AppTaskMain, "AppTaskMain", APP_TASK_STACK_SIZE, this, APP_TASK_PRIORITY, &taskHandle) != pdPASS) @@ -108,6 +144,7 @@ CHIP_ERROR chip::NXP::App::AppTaskFreeRTOS::Start() ChipLogError(DeviceLayer, "Failed to start app task"); assert(err == CHIP_NO_ERROR); } +#endif // FSL_OSA_TASK_ENABLE return err; } @@ -122,31 +159,43 @@ void chip::NXP::App::AppTaskFreeRTOS::AppTaskMain(void * pvParameter) sAppTask->PreInitMatterStack(); err = sAppTask->Init(); + VerifyOrDieWithMsg(err == CHIP_NO_ERROR, DeviceLayer, "AppTask.Init() failed"); sAppTask->PostInitMatterStack(); - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "AppTask.Init() failed"); - assert(err == CHIP_NO_ERROR); - } while (true) { - BaseType_t eventReceived = xQueueReceive(sAppEventQueue, &event, portMAX_DELAY); + BaseType_t eventReceived = xQueueReceive(sAppTask->appEventQueue, &event, sAppTask->ticksToWait); while (eventReceived == pdTRUE) { sAppTask->DispatchEvent(event); - eventReceived = xQueueReceive(sAppEventQueue, &event, 0); + eventReceived = xQueueReceive(sAppTask->appEventQueue, &event, 0); } +#if CONFIG_ENABLE_FEEDBACK + FeedbackMgr().DisplayInLoop(); +#endif } } void chip::NXP::App::AppTaskFreeRTOS::PostEvent(const AppEvent & event) { - if (sAppEventQueue != NULL) + if (appEventQueue != NULL) { - if (!xQueueSend(sAppEventQueue, &event, 0)) + if (__get_IPSR()) + { + portBASE_TYPE taskToWake = pdFALSE; + if (!xQueueSendToFrontFromISR(appEventQueue, &event, &taskToWake)) + { + ChipLogError(DeviceLayer, "Failed to post event to app task event queue from ISR"); + } + + portYIELD_FROM_ISR(taskToWake); + } + else { - ChipLogError(DeviceLayer, "Failed to post event to app task event queue"); + if (!xQueueSend(appEventQueue, &event, 0)) + { + ChipLogError(DeviceLayer, "Failed to post event to app task event queue"); + } } } } diff --git a/examples/platform/nxp/common/clusters/include/Identify.h b/examples/platform/nxp/common/clusters/include/Identify.h new file mode 100644 index 00000000000000..a742e3808791bc --- /dev/null +++ b/examples/platform/nxp/common/clusters/include/Identify.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include + +namespace chip::NXP::App { + +// Identify cluster callbacks. +void OnIdentifyStart(Identify * identify); +void OnIdentifyStop(Identify * identify); +void OnTriggerEffect(Identify * identify); +void OnTriggerEffectComplete(chip::System::Layer * systemLayer, void * appState); + +} // namespace chip::NXP::App diff --git a/examples/platform/nxp/common/clusters/source/ZclCallbacks.cpp b/examples/platform/nxp/common/clusters/source/ZclCallbacks.cpp new file mode 100644 index 00000000000000..99329a818cc68c --- /dev/null +++ b/examples/platform/nxp/common/clusters/source/ZclCallbacks.cpp @@ -0,0 +1,52 @@ +/* + * + * Copyright (c) 2021-2023 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "CHIPDeviceManager.h" + +#include + +#if CONFIG_DIAG_LOGS_DEMO +#include "DiagnosticLogsProviderDelegateImpl.h" +#include +#endif + +void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & path, uint8_t type, uint16_t size, uint8_t * value) +{ + chip::DeviceManager::CHIPDeviceManagerCallbacks * cb = + chip::DeviceManager::CHIPDeviceManager::GetInstance().GetCHIPDeviceManagerCallbacks(); + if (cb != nullptr) + { + // propagate event to device manager + cb->PostAttributeChangeCallback(path.mEndpointId, path.mClusterId, path.mAttributeId, type, size, value); + } +} + +#if CONFIG_DIAG_LOGS_DEMO +/** @brief DiagnosticLogs Cluster Init + * + * This function is called when a specific cluster is initialized. It gives the + * application an opportunity to take care of cluster initialization procedures. + * It is called exactly once for each endpoint where cluster is present. + */ +void emberAfDiagnosticLogsClusterInitCallback(chip::EndpointId endpoint) +{ + auto & logProvider = chip::app::Clusters::DiagnosticLogs::LogProvider::GetInstance(); + auto & server = chip::app::Clusters::DiagnosticLogs::DiagnosticLogsServer::Instance(); + server.SetDiagnosticLogsProviderDelegate(endpoint, &logProvider); +} +#endif diff --git a/examples/platform/nxp/common/device_callbacks/source/CommonDeviceCallbacks.cpp b/examples/platform/nxp/common/device_callbacks/source/CommonDeviceCallbacks.cpp index d38d6f59f8c572..bc7a8dca431c42 100644 --- a/examples/platform/nxp/common/device_callbacks/source/CommonDeviceCallbacks.cpp +++ b/examples/platform/nxp/common/device_callbacks/source/CommonDeviceCallbacks.cpp @@ -33,7 +33,6 @@ #include #if CHIP_ENABLE_OPENTHREAD && CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED #include "openthread-system.h" -#include "ot_platform_common.h" #endif /* CHIP_ENABLE_OPENTHREAD && CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED */ #if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR diff --git a/examples/platform/nxp/common/diagnostic_logs/include/DiagnosticLogsDemo.h b/examples/platform/nxp/common/diagnostic_logs/include/DiagnosticLogsDemo.h new file mode 100644 index 00000000000000..e801837e09a04b --- /dev/null +++ b/examples/platform/nxp/common/diagnostic_logs/include/DiagnosticLogsDemo.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include + +namespace chip::NXP::App::DiagnosticLogsDemo { + +/** + * @brief Display a demo usage of the diagnostic logs provider. + * + */ +CHIP_ERROR DisplayUsage(); + +} // namespace chip::NXP::App::DiagnosticLogsDemo diff --git a/examples/platform/nxp/common/diagnostic_logs/DiagnosticLogsProviderDelegateImpl.h b/examples/platform/nxp/common/diagnostic_logs/include/DiagnosticLogsProviderDelegateImpl.h similarity index 100% rename from examples/platform/nxp/common/diagnostic_logs/DiagnosticLogsProviderDelegateImpl.h rename to examples/platform/nxp/common/diagnostic_logs/include/DiagnosticLogsProviderDelegateImpl.h diff --git a/examples/platform/nxp/common/diagnostic_logs/source/DiagnosticLogsDemo.cpp b/examples/platform/nxp/common/diagnostic_logs/source/DiagnosticLogsDemo.cpp new file mode 100644 index 00000000000000..359952609352f0 --- /dev/null +++ b/examples/platform/nxp/common/diagnostic_logs/source/DiagnosticLogsDemo.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "DiagnosticLogsDemo.h" +#include "DiagnosticLogsProviderDelegateImpl.h" + +#include + +CHIP_ERROR chip::NXP::App::DiagnosticLogsDemo::DisplayUsage() +{ + char diagLog[CHIP_DEVICE_CONFIG_MAX_DIAG_LOG_SIZE]; + uint16_t diagLogSize = CHIP_DEVICE_CONFIG_MAX_DIAG_LOG_SIZE; + + chip::StorageKeyName keyUser = chip::app::Clusters::DiagnosticLogs::LogProvider::GetKeyDiagUserSupport(); + chip::StorageKeyName keyNwk = chip::app::Clusters::DiagnosticLogs::LogProvider::GetKeyDiagNetwork(); + chip::StorageKeyName keyCrash = chip::app::Clusters::DiagnosticLogs::LogProvider::GetKeyDiagCrashLog(); + + auto & persistentStorage = chip::Server::GetInstance().GetPersistentStorage(); + /* The KVS wear stats are stored in the user diagnostic log key hence only + * initialize this key if the KVS wear stats are not enabled. */ +#if (CHIP_DEVICE_CONFIG_KVS_WEAR_STATS != 1) + memset(diagLog, 0, diagLogSize); + persistentStorage.SyncSetKeyValue(keyUser.KeyName(), diagLog, diagLogSize); +#endif + + memset(diagLog, 1, diagLogSize); + persistentStorage.SyncSetKeyValue(keyNwk.KeyName(), diagLog, diagLogSize); + + memset(diagLog, 2, diagLogSize); + persistentStorage.SyncSetKeyValue(keyCrash.KeyName(), diagLog, diagLogSize); + + return CHIP_NO_ERROR; +} diff --git a/examples/platform/nxp/common/diagnostic_logs/DiagnosticLogsProviderDelegateImpl.cpp b/examples/platform/nxp/common/diagnostic_logs/source/DiagnosticLogsProviderDelegateImpl.cpp similarity index 98% rename from examples/platform/nxp/common/diagnostic_logs/DiagnosticLogsProviderDelegateImpl.cpp rename to examples/platform/nxp/common/diagnostic_logs/source/DiagnosticLogsProviderDelegateImpl.cpp index 359edc3dedc9a6..929905afad828f 100644 --- a/examples/platform/nxp/common/diagnostic_logs/DiagnosticLogsProviderDelegateImpl.cpp +++ b/examples/platform/nxp/common/diagnostic_logs/source/DiagnosticLogsProviderDelegateImpl.cpp @@ -142,7 +142,7 @@ size_t LogProvider::GetSizeForIntent(IntentEnum intent) VerifyOrReturnValue(buffer.Get() != nullptr, 0); err = Server::GetInstance().GetPersistentStorage().SyncGetKeyValue(key.KeyName(), buffer.Get(), sizeForIntent); - VerifyOrReturnValue(err == CHIP_NO_ERROR, 0); + VerifyOrReturnValue(err == CHIP_ERROR_BUFFER_TOO_SMALL, 0); return sizeForIntent; } diff --git a/examples/platform/nxp/common/factory_data/source/AppFactoryDataDefaultImpl.cpp b/examples/platform/nxp/common/factory_data/source/AppFactoryDataDefaultImpl.cpp index 4fd176075f00d2..c1b85604226677 100644 --- a/examples/platform/nxp/common/factory_data/source/AppFactoryDataDefaultImpl.cpp +++ b/examples/platform/nxp/common/factory_data/source/AppFactoryDataDefaultImpl.cpp @@ -24,7 +24,10 @@ #include #if CONFIG_CHIP_PLAT_LOAD_REAL_FACTORY_DATA -#include "FactoryDataProvider.h" +#ifndef EXTERNAL_FACTORY_DATA_PROVIDER_HEADER +#define EXTERNAL_FACTORY_DATA_PROVIDER_HEADER "platform/nxp/common/factory_data/FactoryDataProvider.h" +#endif +#include EXTERNAL_FACTORY_DATA_PROVIDER_HEADER #if CONFIG_CHIP_ENCRYPTED_FACTORY_DATA /* * Test key used to encrypt factory data before storing it to the flash. @@ -64,7 +67,7 @@ CHIP_ERROR chip::NXP::App::AppFactoryData_PostMatterStackInit(void) FactoryDataPrvdImpl().SetAes128Key(&aes128TestKey[0]); #endif /* CONFIG_CHIP_ENCRYPTED_FACTORY_DATA */ - ReturnErrorOnFailure(FactoryDataPrvdImpl().Init()); + ReturnErrorOnFailure(FactoryDataPrvd().Init()); SetDeviceInstanceInfoProvider(&FactoryDataPrvd()); SetDeviceAttestationCredentialsProvider(&FactoryDataPrvd()); diff --git a/examples/platform/nxp/common/led_widget/include/LedDimmer.h b/examples/platform/nxp/common/led_widget/include/LedDimmer.h new file mode 100644 index 00000000000000..83632738baf769 --- /dev/null +++ b/examples/platform/nxp/common/led_widget/include/LedDimmer.h @@ -0,0 +1,37 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "LedWidgetInterface.h" + +namespace chip::NXP::App { + +/** + * @brief + * A class that manages dimmer LED operations. + */ +class LedDimmer : public LedWidgetInterface +{ +public: + void Init(uint8_t index = 0, bool inverted = false) override; + void Set(uint8_t level = 0) override; + void Animate(uint32_t onTimeMS = 0, uint32_t offTimeMS = 0) override {} +}; + +} // namespace chip::NXP::App diff --git a/examples/platform/nxp/common/led_widget/include/LedOnOff.h b/examples/platform/nxp/common/led_widget/include/LedOnOff.h new file mode 100644 index 00000000000000..128bbb89aaa3cd --- /dev/null +++ b/examples/platform/nxp/common/led_widget/include/LedOnOff.h @@ -0,0 +1,47 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "LedWidgetInterface.h" + +namespace chip::NXP::App { + +/** + * @brief + * A base class that manages an on-off LED on a board. + */ +class LedOnOff : public LedWidgetInterface +{ +public: + void Init(uint8_t index = 0, bool inverted = 0) override; + void Set(uint8_t level = 0) override; + void Animate(uint32_t onTimeMS = 0, uint32_t offTimeMS = 0) override; + +private: + uint64_t mLastChangeTimeMS = 0; + uint32_t mOnTimeMS = 0; + uint32_t mOffTimeMS = 0; + uint8_t mIndex = 0; + + bool mOnLogic = true; + + void DoSet(bool state); +}; + +} // namespace chip::NXP::App diff --git a/examples/platform/nxp/k32w/k32w1/util/include/LEDWidget.h b/examples/platform/nxp/common/led_widget/include/LedWidgetInterface.h similarity index 55% rename from examples/platform/nxp/k32w/k32w1/util/include/LEDWidget.h rename to examples/platform/nxp/common/led_widget/include/LedWidgetInterface.h index a73ab8a904018b..155da65eea9d06 100644 --- a/examples/platform/nxp/k32w/k32w1/util/include/LEDWidget.h +++ b/examples/platform/nxp/common/led_widget/include/LedWidgetInterface.h @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2020 Google LLC. + * Copyright (c) 2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,28 +16,29 @@ * limitations under the License. */ -// #include "LED.h" -#include "EmbeddedTypes.h" #pragma once -class LEDWidget +#include "EmbeddedTypes.h" + +namespace chip::NXP::App { + +/** + * @brief + * An interface that defines LED operations. + */ +class LedWidgetInterface { public: - void Init(uint8_t gpioNum, bool inverted); - void Set(bool state); - void SetLevel(uint8_t level); - void Invert(void); - void Blink(uint32_t changeRateMS); - void Blink(uint32_t onTimeMS, uint32_t offTimeMS); - void Animate(); - -private: - uint64_t mLastChangeTimeMS; - uint32_t mBlinkOnTimeMS; - uint32_t mBlinkOffTimeMS; - uint8_t mGPIONum; - bool mState; - bool mOnLogic; - - void DoSet(bool state); + virtual ~LedWidgetInterface() {} + + virtual void Init(uint8_t index = 0, bool inverted = false) = 0; + virtual void Set(uint8_t level = 0) = 0; + virtual void Animate(uint32_t onTimeMS = 0, uint32_t offTimeMS = 0) = 0; + + bool IsTurnedOff() { return !mState; } + +protected: + bool mState = false; }; + +} // namespace chip::NXP::App diff --git a/examples/platform/nxp/common/low_power/include/LowPower.h b/examples/platform/nxp/common/low_power/include/LowPower.h new file mode 100644 index 00000000000000..fc2bdd8ff0fcfd --- /dev/null +++ b/examples/platform/nxp/common/low_power/include/LowPower.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +namespace chip::NXP::App::LowPower { + +/** + * @brief Low-power related init function. + * + * For example, it can be used to register an enter/exit low power callback. + * + */ +CHIP_ERROR Init(); + +} // namespace chip::NXP::App::LowPower diff --git a/examples/platform/nxp/common/low_power/source/LowPower.cpp b/examples/platform/nxp/common/low_power/source/LowPower.cpp new file mode 100644 index 00000000000000..9b5afd19b18bf8 --- /dev/null +++ b/examples/platform/nxp/common/low_power/source/LowPower.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "LowPower.h" +#include "fsl_pm_core.h" + +#include + +#define APP_ERROR_PM_REGISTER_LP_CALLBACK_FAILED CHIP_APPLICATION_ERROR(0x01) + +static status_t LowPowerCallback(pm_event_type_t type, uint8_t state, void * data); + +static pm_notify_element_t appNotifyElement = { + .notifyCallback = LowPowerCallback, + .data = NULL, +}; + +static status_t LowPowerCallback(pm_event_type_t type, uint8_t state, void * data) +{ + // This is just an example. It does nothing by default. + return kStatus_Success; +} + +namespace chip::NXP::App::LowPower { + +CHIP_ERROR Init() +{ + status_t status = PM_RegisterNotify(kPM_NotifyGroup2, &appNotifyElement); + VerifyOrReturnError(status == kStatus_Success, APP_ERROR_PM_REGISTER_LP_CALLBACK_FAILED); + + return CHIP_NO_ERROR; +} + +} // namespace chip::NXP::App::LowPower diff --git a/examples/platform/nxp/common/operational_keystore/include/OperationalKeystore.h b/examples/platform/nxp/common/operational_keystore/include/OperationalKeystore.h new file mode 100644 index 00000000000000..4bb3582fc63de0 --- /dev/null +++ b/examples/platform/nxp/common/operational_keystore/include/OperationalKeystore.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include +#include + +namespace chip::NXP::App::OperationalKeystore { + +/** + * @brief Getter for operational keystore instance. + * + * It can be overwritten to return an instance of a dervied keystore implementation. + * + */ +chip::Crypto::OperationalKeystore * GetInstance(); + +/** + * @brief Initialization entry for specific operational keystore actions. + * + * For example, it can be overwritten to register a persistent storage delegate. + * + */ +CHIP_ERROR Init(PersistentStorageDelegate * delegate); + +} // namespace chip::NXP::App::OperationalKeystore diff --git a/examples/platform/nxp/common/operational_keystore/source/OperationalKeystoreEmpty.cpp b/examples/platform/nxp/common/operational_keystore/source/OperationalKeystoreEmpty.cpp new file mode 100644 index 00000000000000..6d69720bc060c0 --- /dev/null +++ b/examples/platform/nxp/common/operational_keystore/source/OperationalKeystoreEmpty.cpp @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "OperationalKeystore.h" + +chip::Crypto::OperationalKeystore * chip::NXP::App::OperationalKeystore::GetInstance() +{ + // Default implementation returns a null pointer. + // Applications that have a specific operational keystore defined should implement + // this function and return a pointer to that instance. + return nullptr; +} + +CHIP_ERROR chip::NXP::App::OperationalKeystore::Init(PersistentStorageDelegate * delegate) +{ + return CHIP_NO_ERROR; +} diff --git a/examples/platform/nxp/common/ota_requestor/source/OTARequestorInitiatorMultiImage.cpp b/examples/platform/nxp/common/ota_requestor/source/OTARequestorInitiatorMultiImage.cpp new file mode 100644 index 00000000000000..527b416a86a4e4 --- /dev/null +++ b/examples/platform/nxp/common/ota_requestor/source/OTARequestorInitiatorMultiImage.cpp @@ -0,0 +1,43 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "OTARequestorInitiator.h" + +using namespace chip; + +constexpr uint16_t requestedOtaBlockSize = 1024; + +void chip::NXP::App::OTARequestorInitiator::InitOTA(intptr_t context) +{ + auto * otaRequestorInit = reinterpret_cast(context); + // Set the global instance of the OTA requestor core component + SetRequestorInstance(&otaRequestorInit->gRequestorCore); + + otaRequestorInit->gRequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage()); + otaRequestorInit->gRequestorCore.Init(chip::Server::GetInstance(), otaRequestorInit->gRequestorStorage, + otaRequestorInit->gRequestorUser, otaRequestorInit->gDownloader); + otaRequestorInit->gRequestorUser.SetMaxDownloadBlockSize(requestedOtaBlockSize); + + auto & imageProcessor = OTAImageProcessorImpl::GetDefaultInstance(); + otaRequestorInit->gRequestorUser.Init(&otaRequestorInit->gRequestorCore, &imageProcessor); + imageProcessor.Init(&otaRequestorInit->gDownloader); + // Set the image processor instance used for handling image being downloaded + otaRequestorInit->gDownloader.SetImageProcessorDelegate(&imageProcessor); +} + +void chip::NXP::App::OTARequestorInitiator::HandleSelfTest() {} diff --git a/examples/platform/nxp/common/rpc/include/AppRpc.h b/examples/platform/nxp/common/rpc/include/AppRpc.h new file mode 100644 index 00000000000000..9e56a8b80d0b00 --- /dev/null +++ b/examples/platform/nxp/common/rpc/include/AppRpc.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#if defined(PW_RPC_BUTTON_SERVICE) && PW_RPC_BUTTON_SERVICE +#include "pigweed/rpc_services/Button.h" +#endif + +namespace chip::NXP::App::Rpc { + +/** + * @brief Initialization of RPC-related board code. + * + * For example, enabling clock for UART interface + * and initializing board pins. + * + */ +CHIP_ERROR Init(); + +#if defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE +/** + * @brief Rebooting the device. + * + * RPC implementation will delegate reboot procedure to this function. + * + */ +void Reboot(); +#endif + +#if defined(PW_RPC_BUTTON_SERVICE) && PW_RPC_BUTTON_SERVICE +/** + * @brief Handles button events. + * + * RPC implementation will delegate handling events to this function. + */ +void ButtonHandler(const chip_rpc_ButtonEvent & request); +#endif + +} // namespace chip::NXP::App::Rpc diff --git a/examples/platform/nxp/common/ui_feedback/include/LedManager.h b/examples/platform/nxp/common/ui_feedback/include/LedManager.h new file mode 100644 index 00000000000000..b14fae7aebb60c --- /dev/null +++ b/examples/platform/nxp/common/ui_feedback/include/LedManager.h @@ -0,0 +1,91 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "AppConfig.h" +#include "LedOnOff.h" +#include "LedWidgetInterface.h" +#include "UserInterfaceFeedback.h" + +#include +#include + +using namespace chip::NXP::App; + +/** + * @brief Specifies the array index of the status LED. + * + * The status LED is usually used to indicate additional information + * related to the connectivity status of the application. + */ +#ifndef LED_MANAGER_STATUS_LED_INDEX +#define LED_MANAGER_STATUS_LED_INDEX 0 +#endif + +/** + * @brief Specifies the array index of the light LED. + * + * The light LED is usually used to indicate the state of some cluster + * attribute: e.g OnOff attribute from OnOff cluster. + */ +#ifndef LED_MANAGER_LIGHT_LED_INDEX +#define LED_MANAGER_LIGHT_LED_INDEX 1 +#endif + +/** + * @brief Enable status LED. + * + */ +#ifndef LED_MANAGER_ENABLE_STATUS_LED +#define LED_MANAGER_ENABLE_STATUS_LED 0 +#endif + +/** + * @brief Manager of LedWidgetInterface concrete classes. + * + * It implements the UserInterfaceFeedback abstract interface. + */ +class LedManager : public UserInterfaceFeedback +{ +public: + void Init() override; + void DisplayInLoop() override; + void DisplayOnAction(Action action) override; + void RestoreState() override; + +private: + void ApplyTurnOn(); + void ApplyTurnOff(); + void AnimateOnAction(uint32_t onTimeMS, uint32_t offTimeMS); + +#if LED_MANAGER_ENABLE_STATUS_LED + void UpdateStatus(); + + LedOnOff statusLed; +#endif + LedOnOff lightLed; + + friend LedManager & LightingMgr(void); + static LedManager sLedManager; +}; + +inline LedManager & LightingMgr(void) +{ + return LedManager::sLedManager; +} diff --git a/examples/platform/nxp/common/ui_feedback/include/UserInterfaceFeedback.h b/examples/platform/nxp/common/ui_feedback/include/UserInterfaceFeedback.h new file mode 100644 index 00000000000000..9e844a73d9191f --- /dev/null +++ b/examples/platform/nxp/common/ui_feedback/include/UserInterfaceFeedback.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +/** + * @brief Defines an abstract interface for providing feedback to the user. + * + * For example, the feedback can be provided through a logging mechanism or + * through LED animation. + */ +class UserInterfaceFeedback +{ +public: + /** + * @brief Set of possible actions handled by the DisplayOnAction method. + * + */ + enum class Action : uint8_t + { + kFactoryReset = 0, + kTriggerEffect, + kIdentify + }; + + virtual ~UserInterfaceFeedback() = default; + + virtual void Init() = 0; + + /** + * @brief Provide feedback in app task main loop. + * + * For a concrete example, this can be a LED animation command. + */ + virtual void DisplayInLoop() = 0; + + /** + * @brief Provide feedback on a specific action. + * + */ + virtual void DisplayOnAction(Action action) = 0; + + /** + * @brief Restore feedback state based on a default config. + * + * For example, the restoration can be based on a cluster attribute + * value, such as OnOff value in case of a LightingManager. + */ + virtual void RestoreState() = 0; +}; + +/** + * @brief Getter for the concrete class that implements the interface. + * + * It returns a reference to UserInterfaceFeedback, such that only the + * public API can be used regardless of the actual concrete class. + */ +extern UserInterfaceFeedback & FeedbackMgr(); diff --git a/examples/platform/nxp/common/ui_feedback/source/LedManager.cpp b/examples/platform/nxp/common/ui_feedback/source/LedManager.cpp new file mode 100644 index 00000000000000..ac2456f327b61c --- /dev/null +++ b/examples/platform/nxp/common/ui_feedback/source/LedManager.cpp @@ -0,0 +1,150 @@ +/* + * + * Copyright (c) 2021, 2024 Project CHIP Authors + * Copyright (c) 2019 Google LLC. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "LedManager.h" + +#include "AppConfig.h" +#include "AppTask.h" + +#include +#include +#include +#include +#include + +LedManager LedManager::sLedManager; + +#if CONFIG_ENABLE_FEEDBACK +UserInterfaceFeedback & FeedbackMgr() +{ + return LightingMgr(); +} +#endif + +void LedManager::ApplyTurnOn() +{ + if (!lightLed.IsTurnedOff()) + return; + + lightLed.Set(true); +} + +void LedManager::ApplyTurnOff() +{ + if (lightLed.IsTurnedOff()) + return; + + lightLed.Set(false); +} + +void LedManager::Init() +{ + /* start with all LEDS turned off */ +#if LED_MANAGER_ENABLE_STATUS_LED + statusLed.Init(LED_MANAGER_STATUS_LED_INDEX, false); +#endif + /* The parameters will not be used by the dimmer init. */ + lightLed.Init(LED_MANAGER_LIGHT_LED_INDEX, false); + + RestoreState(); +} + +void LedManager::DisplayInLoop() +{ +#if LED_MANAGER_ENABLE_STATUS_LED + UpdateStatus(); + statusLed.Animate(); +#endif + lightLed.Animate(); +} + +void LedManager::DisplayOnAction(Action action) +{ + switch (action) + { + case UserInterfaceFeedback::Action::kFactoryReset: + case UserInterfaceFeedback::Action::kTriggerEffect: + AnimateOnAction(500, 500); + break; + case UserInterfaceFeedback::Action::kIdentify: + AnimateOnAction(250, 250); + break; + default: + break; + } +} + +void LedManager::RestoreState() +{ + /* restore initial state for the LED indicating Lighting state */ + lightLed.Set(false); + + chip::DeviceLayer::PlatformMgr().ScheduleWork([](intptr_t arg) { + bool val = false; + APP_CLUSTER_ATTRIBUTE::Get(APP_DEVICE_TYPE_ENDPOINT, &val); + if (val) + LightingMgr().ApplyTurnOn(); + else + LightingMgr().ApplyTurnOff(); + }); +} + +void LedManager::AnimateOnAction(uint32_t onTimeMS, uint32_t offTimeMS) +{ +#if LED_MANAGER_ENABLE_STATUS_LED + statusLed.Set(false); + statusLed.Animate(onTimeMS, offTimeMS); +#endif + + lightLed.Set(false); + lightLed.Animate(onTimeMS, offTimeMS); +} + +#if LED_MANAGER_ENABLE_STATUS_LED +void LedManager::UpdateStatus() +{ + bool isThreadProvisioned = false; + uint16_t bleConnections = 0; + + // Collect connectivity and configuration state from the CHIP stack. Because the + // CHIP event loop is being run in a separate task, the stack must be locked + // while these values are queried. However we use a non-blocking lock request + // (TryLockChipStack()) to avoid blocking other UI activities when the CHIP + // task is busy (e.g. with a long crypto operation). + if (chip::DeviceLayer::PlatformMgr().TryLockChipStack()) + { + isThreadProvisioned = chip::DeviceLayer::ConnectivityMgr().IsThreadProvisioned(); + bleConnections = chip::DeviceLayer::ConnectivityMgr().NumBLEConnections(); + chip::DeviceLayer::PlatformMgr().UnlockChipStack(); + } + + if (isThreadProvisioned) + { + statusLed.Animate(950, 50); + } + else if (bleConnections != 0) + { + statusLed.Animate(100, 100); + } + else + { + statusLed.Animate(50, 950); + } +} +#endif diff --git a/examples/platform/nxp/k32w/k32w1/BUILD.gn b/examples/platform/nxp/k32w/k32w1/BUILD.gn deleted file mode 100644 index 5cd2a8b31392c2..00000000000000 --- a/examples/platform/nxp/k32w/k32w1/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (c) 2020 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("//build_overrides/nxp_sdk.gni") - -import("${nxp_sdk_build_root}/nxp_sdk.gni") - -import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni") - -config("chip_examples_project_config") { - include_dirs = [ - "app/project_include", - "${chip_root}", - ] -} - -source_set("openthread_core_config_k32w1_chip_examples") { - sources = [ "app/project_include/OpenThreadConfig.h" ] - - public_deps = [ "${chip_root}/third_party/openthread/platforms/nxp/k32w/k32w1:openthread_core_config_k32w1" ] - - public_configs = [ ":chip_examples_project_config" ] -} diff --git a/examples/platform/nxp/k32w/k32w1/app/BUILD.gn b/examples/platform/nxp/k32w/k32w1/app/BUILD.gn deleted file mode 100644 index 6671d140688df9..00000000000000 --- a/examples/platform/nxp/k32w/k32w1/app/BUILD.gn +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2020 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") - -config("chip_examples_project_config") { - include_dirs = [ "app/project_include" ] -} - -source_set("openthread_core_config_k32w1_chip_examples") { - sources = [ "app/project_include/OpenThreadConfig.h" ] - - public_deps = [ "${chip_root}/third_party/openthread/platforms/nxp/k32w/k32w1:openthread_core_config_k32w1" ] - - public_configs = [ ":chip_examples_project_config" ] -} diff --git a/examples/platform/nxp/k32w/k32w1/app/args.gni b/examples/platform/nxp/k32w/k32w1/app/args.gni deleted file mode 100644 index 2705c251fb807d..00000000000000 --- a/examples/platform/nxp/k32w/k32w1/app/args.gni +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (c) 2020 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}/src/platform/nxp/k32w/k32w1/args.gni") - -openthread_project_core_config_file = "OpenThreadConfig.h" - -chip_ble_project_config_include = "" -chip_device_project_config_include = "" -chip_project_config_include = "" -chip_inet_project_config_include = "" -chip_system_project_config_include = "" - -chip_system_config_provide_statistics = false -chip_with_nlfaultinjection = true diff --git a/examples/platform/nxp/k32w/k32w1/args.gni b/examples/platform/nxp/k32w/k32w1/args.gni deleted file mode 100644 index f7d9dccd82e1fd..00000000000000 --- a/examples/platform/nxp/k32w/k32w1/args.gni +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (c) 2020 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}/src/platform/nxp/k32w/k32w1/args.gni") - -arm_float_abi = "hard" -arm_cpu = "cortex-m33" -arm_fpu = "fpv5-sp-d16" -arm_arch = "armv8-m.main+dsp+fp" - -chip_openthread_ftd = false -openthread_core_config_deps = [] -openthread_core_config_deps = [ "${chip_root}/examples/platform/nxp/k32w/k32w1:openthread_core_config_k32w1_chip_examples" ] - -chip_ble_project_config_include = "" -chip_device_project_config_include = "" -chip_project_config_include = "" -chip_inet_project_config_include = "" -chip_system_project_config_include = "" - -chip_system_config_provide_statistics = false -chip_with_nlfaultinjection = true - -chip_system_config_use_open_thread_inet_endpoints = true -chip_with_lwip = false diff --git a/examples/platform/nxp/k32w/k32w1/app/ldscripts/k32w1_app.ld b/examples/platform/nxp/k32w1/app/ldscripts/k32w1_app.ld similarity index 100% rename from examples/platform/nxp/k32w/k32w1/app/ldscripts/k32w1_app.ld rename to examples/platform/nxp/k32w1/app/ldscripts/k32w1_app.ld diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/include/FreeRTOSConfig.h b/examples/platform/nxp/k32w1/app/project_include/freeRTOS/FreeRTOSConfig.h similarity index 97% rename from examples/contact-sensor-app/nxp/k32w/k32w1/include/FreeRTOSConfig.h rename to examples/platform/nxp/k32w1/app/project_include/freeRTOS/FreeRTOSConfig.h index a4e204700672a3..286566a027b6f9 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/include/FreeRTOSConfig.h +++ b/examples/platform/nxp/k32w1/app/project_include/freeRTOS/FreeRTOSConfig.h @@ -85,14 +85,9 @@ extern uint32_t SystemCoreClock; /* Tasks.c additions (e.g. Thread Aware Debug capability) */ #define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H 1 -/* Used memory allocation (heap_x.c) */ -#define configFRTOS_MEMORY_SCHEME 4 - /* Memory allocation related definitions. */ #define configSUPPORT_STATIC_ALLOCATION 0 #define configSUPPORT_DYNAMIC_ALLOCATION 1 -#define configTOTAL_HEAP_SIZE ((size_t) (gTotalHeapSize_c)) -#define configAPPLICATION_ALLOCATED_HEAP 1 /* Hook function related definitions. */ #ifndef configUSE_IDLE_HOOK diff --git a/examples/platform/nxp/k32w/k32w1/app/project_include/OpenThreadConfig.h b/examples/platform/nxp/k32w1/app/project_include/openthread/OpenThreadConfig.h similarity index 100% rename from examples/platform/nxp/k32w/k32w1/app/project_include/OpenThreadConfig.h rename to examples/platform/nxp/k32w1/app/project_include/openthread/OpenThreadConfig.h diff --git a/examples/platform/nxp/k32w/k32w1/app/support/BUILD.gn b/examples/platform/nxp/k32w1/app/support/BUILD.gn similarity index 78% rename from examples/platform/nxp/k32w/k32w1/app/support/BUILD.gn rename to examples/platform/nxp/k32w1/app/support/BUILD.gn index dc688edc2c78ed..96d05e9ba29f13 100644 --- a/examples/platform/nxp/k32w/k32w1/app/support/BUILD.gn +++ b/examples/platform/nxp/k32w1/app/support/BUILD.gn @@ -15,8 +15,12 @@ import("//build_overrides/chip.gni") import("//build_overrides/nxp_sdk.gni") +import("${nxp_sdk_matter_support_root}/gn_build/nxp_sdk.gni") + +import("${chip_root}/src/platform/nxp/${nxp_platform}/args.gni") + config("support_config") { - include_dirs = [ "../../../../.." ] + include_dirs = [ "${chip_root}" ] # Link options that provides replace dynamic memory operations in standard # library with the FreeRTOS malloc in platform code. @@ -29,7 +33,7 @@ config("support_config") { "-Wl,--wrap=MemoryAlloc", # Wrap these in case internal newlib call them (e.g. strdup will) - # directly call _malloc_r) + # directly call _malloc_r "-Wl,--wrap=_malloc_r", "-Wl,--wrap=_realloc_r", "-Wl,--wrap=_free_r", @@ -38,7 +42,7 @@ config("support_config") { ] } -source_set("freertos_mbedtls_utils") { +source_set("freertos_memory_utils") { sources = [ "FreeRtosHooks.c", "FreeRtosHooks.h", @@ -49,5 +53,11 @@ source_set("freertos_mbedtls_utils") { cflags = [ "-Wconversion" ] + if (chip_key_storage == "fwk_nvm") { + defines = [ "CHIP_PLAT_NVM_SUPPORT=1" ] + } else if (chip_key_storage == "littlefs") { + defines = [ "CHIP_PLAT_NVM_SUPPORT=3" ] + } + public_configs = [ ":support_config" ] } diff --git a/examples/platform/nxp/k32w/k32w1/app/support/FreeRtosHooks.c b/examples/platform/nxp/k32w1/app/support/FreeRtosHooks.c similarity index 96% rename from examples/platform/nxp/k32w/k32w1/app/support/FreeRtosHooks.c rename to examples/platform/nxp/k32w1/app/support/FreeRtosHooks.c index a7c78a77440e03..72d5f1acc6161e 100644 --- a/examples/platform/nxp/k32w/k32w1/app/support/FreeRtosHooks.c +++ b/examples/platform/nxp/k32w1/app/support/FreeRtosHooks.c @@ -27,7 +27,11 @@ #include #include +#if (CHIP_PLAT_NVM_SUPPORT == 1) #include "NVM_Interface.h" +#elif (CHIP_PLAT_NVM_SUPPORT == 3) +#include "fwk_file_cache.h" +#endif #include "PWR_Interface.h" #include "board.h" #include "fsl_os_abstraction.h" @@ -139,8 +143,10 @@ void vApplicationIdleHook(void) // to ensure there is no context switch during the actual // writing, thus avoiding race conditions. OSA_InterruptDisable(); -#if CHIP_PLAT_NVM_SUPPORT +#if (CHIP_PLAT_NVM_SUPPORT == 1) NvIdle(); +#elif (CHIP_PLAT_NVM_SUPPORT == 3) + FC_Process(); #endif OSA_InterruptEnable(); diff --git a/examples/platform/nxp/k32w/k32w1/app/support/FreeRtosHooks.h b/examples/platform/nxp/k32w1/app/support/FreeRtosHooks.h similarity index 100% rename from examples/platform/nxp/k32w/k32w1/app/support/FreeRtosHooks.h rename to examples/platform/nxp/k32w1/app/support/FreeRtosHooks.h diff --git a/examples/platform/nxp/k32w/k32w1/app/support/Memconfig.cpp b/examples/platform/nxp/k32w1/app/support/Memconfig.cpp similarity index 100% rename from examples/platform/nxp/k32w/k32w1/app/support/Memconfig.cpp rename to examples/platform/nxp/k32w1/app/support/Memconfig.cpp diff --git a/examples/platform/nxp/k32w1/board/peripherals.c b/examples/platform/nxp/k32w1/board/peripherals.c new file mode 100644 index 00000000000000..f66203bfe2153b --- /dev/null +++ b/examples/platform/nxp/k32w1/board/peripherals.c @@ -0,0 +1,66 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * Copyright (c) 2024 NXP + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*********************************************************************************************************************** + * Included files + **********************************************************************************************************************/ +#include "peripherals.h" + +/*********************************************************************************************************************** + * BOARD_InitPeripherals functional group + **********************************************************************************************************************/ + +/* LittleFS context */ +extern struct lfs_mflash_ctx LittleFS_ctx; +const struct lfs_config LittleFS_config = { .context = (void *) &LittleFS_ctx, + .read = lfs_mflash_read, + .prog = lfs_mflash_prog, + .erase = lfs_mflash_erase, + .sync = lfs_mflash_sync, +#ifdef LFS_THREADSAFE + .lock = lfs_mutex_lock, + .unlock = lfs_mutex_unlock, +#endif + .read_size = LITTLEFS_READ_SIZE, + .prog_size = LITTLEFS_PROG_SIZE, + .block_size = LITTLEFS_BLOCK_SIZE, + .block_count = LITTLEFS_BLOCK_COUNT, + .block_cycles = LITTLEFS_BLOCK_CYCLES, + .cache_size = LITTLEFS_CACHE_SIZE, + .lookahead_size = LITTLEFS_LOOKAHEAD_SIZE }; + +/* Empty initialization function (commented out) +static void LittleFS_init(void) { +} */ + +/*********************************************************************************************************************** + * Initialization functions + **********************************************************************************************************************/ +void BOARD_InitPeripherals(void) +{ + /* Initialize components */ +} + +/*********************************************************************************************************************** + * BOARD_InitBootPeripherals function + **********************************************************************************************************************/ +void BOARD_InitBootPeripherals(void) +{ + BOARD_InitPeripherals(); +} diff --git a/examples/platform/nxp/k32w1/board/peripherals.h b/examples/platform/nxp/k32w1/board/peripherals.h new file mode 100644 index 00000000000000..38caf2657c4d0f --- /dev/null +++ b/examples/platform/nxp/k32w1/board/peripherals.h @@ -0,0 +1,101 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * Copyright (c) 2024 NXP + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _PERIPHERALS_H_ +#define _PERIPHERALS_H_ + +/*********************************************************************************************************************** + * Included files + **********************************************************************************************************************/ +#include "fsl_common.h" + +#include "lfs.h" + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus */ + +/*********************************************************************************************************************** + * User definitions + **********************************************************************************************************************/ +extern uint32_t NV_STORAGE_START_ADDRESS[]; +extern uint32_t NV_STORAGE_MAX_SECTORS[]; + +#define LITTLEFS_START_ADDR (uint32_t)(NV_STORAGE_START_ADDRESS) + +/*********************************************************************************************************************** + * Definitions + **********************************************************************************************************************/ +/* Definitions for BOARD_InitPeripherals functional group */ +/* Maximum block read size definition */ +#define LITTLEFS_READ_SIZE 16 +/* Maximum block program size definition */ +#define LITTLEFS_PROG_SIZE 128 +/* Erasable block size definition */ +#define LITTLEFS_BLOCK_SIZE 8192 +/* Block count definition */ +#define LITTLEFS_BLOCK_COUNT (uint32_t)(NV_STORAGE_MAX_SECTORS) +/* Block cycles definition */ +#define LITTLEFS_BLOCK_CYCLES 100 +/* Minimum block cache size definition */ +#define LITTLEFS_CACHE_SIZE 1024 +/* Minimum lookahead buffer size definition */ +#define LITTLEFS_LOOKAHEAD_SIZE 16 +/* Block starting address definition */ +#define LITTLEFS_START_ADDR (uint32_t)(NV_STORAGE_START_ADDRESS) + +/*********************************************************************************************************************** + * Global variables + **********************************************************************************************************************/ +/* LittleFS configuration */ +extern const struct lfs_config LittleFS_config; + +/*********************************************************************************************************************** + * Callback functions + **********************************************************************************************************************/ +/* LittleFS read a block region callback*/ +extern int lfs_mflash_read(const struct lfs_config *, lfs_block_t, lfs_off_t, void *, lfs_size_t); +/* LittleFS program a block region callback*/ +extern int lfs_mflash_prog(const struct lfs_config *, lfs_block_t, lfs_off_t, const void *, lfs_size_t); +/* LittleFS erase a block callback*/ +extern int lfs_mflash_erase(const struct lfs_config *, lfs_block_t); +/* LittleFS state sync callback*/ +extern int lfs_mflash_sync(const struct lfs_config *); +/* LittleFS state lock callback*/ +extern int lfs_mutex_lock(const struct lfs_config *); +/* LittleFS state unlock callback*/ +extern int lfs_mutex_unlock(const struct lfs_config *); + +/*********************************************************************************************************************** + * Initialization functions + **********************************************************************************************************************/ + +void BOARD_InitPeripherals(void); + +/*********************************************************************************************************************** + * BOARD_InitBootPeripherals function + **********************************************************************************************************************/ + +void BOARD_InitBootPeripherals(void); + +#if defined(__cplusplus) +} +#endif + +#endif /* _PERIPHERALS_H_ */ diff --git a/examples/platform/nxp/k32w1/button/ButtonManager.cpp b/examples/platform/nxp/k32w1/button/ButtonManager.cpp new file mode 100644 index 00000000000000..47e5f9fd4b6c9d --- /dev/null +++ b/examples/platform/nxp/k32w1/button/ButtonManager.cpp @@ -0,0 +1,215 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ButtonManager.h" +#include "AppConfig.h" +#include "AppMatterButton.h" +#include "AppTask.h" +#include "UserInterfaceFeedback.h" + +#include + +extern "C" { +#include "app.h" +#include "board_comp.h" +} + +CHIP_ERROR chip::NXP::App::AppMatterButton_registerButtons(void) +{ + /* Board buttons are initialized in otSysInit, when APP_InitServices is called. */ + button_status_t bStatus; + + bStatus = BUTTON_InstallCallback((button_handle_t) g_buttonHandle[0], ButtonManager::BleCallback, NULL); + VerifyOrReturnError(bStatus == kStatus_BUTTON_Success, CHIP_ERROR_UNEXPECTED_EVENT, + ChipLogError(DeviceLayer, "button init error")); + + bStatus = BUTTON_InstallCallback((button_handle_t) g_buttonHandle[1], ButtonManager::AppActionCallback, NULL); + VerifyOrReturnError(bStatus == kStatus_BUTTON_Success, CHIP_ERROR_UNEXPECTED_EVENT, + ChipLogError(DeviceLayer, "button init error")); + + ReturnErrorOnFailure(ButtonMgr().Init()); + + return CHIP_NO_ERROR; +} + +ButtonManager ButtonManager::sInstance; + +TimerHandle_t resetTimer; + +CHIP_ERROR ButtonManager::Init() +{ + resetTimer = xTimerCreate("FnTmr", 1, false, (void *) this, [](TimerHandle_t xTimer) { + AppEvent event; + event.Handler = FunctionTimerEventHandler; + chip::NXP::App::GetAppTask().PostEvent(event); + }); + VerifyOrReturnError(resetTimer != NULL, APP_ERROR_CREATE_TIMER_FAILED); + + return CHIP_NO_ERROR; +} + +button_status_t ButtonManager::BleCallback(void * handle, button_callback_message_t * message, void * param) +{ + AppEvent event; + + switch (message->event) + { + case kBUTTON_EventOneClick: + case kBUTTON_EventShortPress: + event.Handler = ButtonManager::BleHandler; + break; + case kBUTTON_EventLongPress: + event.Handler = ButtonManager::ResetActionEventHandler; + break; + default: + /* No action required */ + break; + } + + chip::NXP::App::GetAppTask().PostEvent(event); + + return kStatus_BUTTON_Success; +} + +button_status_t ButtonManager::AppActionCallback(void * handle, button_callback_message_t * message, void * param) +{ + AppEvent event; + + switch (message->event) + { + case kBUTTON_EventOneClick: + case kBUTTON_EventShortPress: + event.Handler = ButtonManager::AppActionEventHandler; + break; + case kBUTTON_EventLongPress: + // Soft reset ensures that platform manager shutdown procedure is called. + event.Handler = ButtonManager::SoftResetHandler; + break; + default: + /* No action required */ + break; + } + + chip::NXP::App::GetAppTask().PostEvent(event); + + return kStatus_BUTTON_Success; +} + +void ButtonManager::FunctionTimerEventHandler(const AppEvent & event) +{ + ChipLogProgress(DeviceLayer, "Device will factory reset..."); + + // Actually trigger Factory Reset + chip::Server::GetInstance().ScheduleFactoryReset(); +} + +void ButtonManager::ResetActionEventHandler(const AppEvent & event) +{ + if (xTimerIsTimerActive(resetTimer)) + { + ButtonMgr().CancelTimer(); +#if CONFIG_ENABLE_FEEDBACK + FeedbackMgr().RestoreState(); +#endif + ChipLogProgress(DeviceLayer, "Factory Reset was cancelled!"); + } + else + { + uint32_t resetTimeout = BUTTON_MANAGER_FACTORY_RESET_TIMEOUT_MS; + ChipLogProgress(DeviceLayer, "Factory Reset Triggered. Push the RESET button within %lu ms to cancel!", resetTimeout); + +#if CONFIG_ENABLE_FEEDBACK + FeedbackMgr().DisplayOnAction(UserInterfaceFeedback::Action::kFactoryReset); +#endif + ButtonMgr().StartTimer(resetTimeout); + } +} + +void ButtonManager::AppActionEventHandler(const AppEvent & event) +{ + chip::DeviceLayer::PlatformMgr().ScheduleWork( + [](intptr_t arg) { + bool val = false; + APP_CLUSTER_ATTRIBUTE::Get(APP_DEVICE_TYPE_ENDPOINT, &val); + auto status = APP_CLUSTER_ATTRIBUTE::Set(APP_DEVICE_TYPE_ENDPOINT, (bool) !val); + if (status != chip::Protocols::InteractionModel::Status::Success) + { + ChipLogProgress(DeviceLayer, "Error when updating cluster attribute"); + } + }, + (intptr_t) nullptr); +} + +void ButtonManager::SoftResetHandler(const AppEvent & event) +{ + chip::DeviceLayer::PlatformMgrImpl().CleanReset(); +} + +#if CHIP_CONFIG_ENABLE_ICD_LIT +static void UserActiveModeHandler(const AppEvent & event) +{ + chip::DeviceLayer::PlatformMgr().ScheduleWork( + [](intptr_t arg) { chip::app::ICDNotifier::GetInstance().NotifyNetworkActivityNotification(); }, 0); +} +#endif + +void ButtonManager::BleHandler(const AppEvent & event) +{ + if (xTimerIsTimerActive(resetTimer)) + { + // If a factory reset is scheduled, pressing the BLE button will cancel it. + ResetActionEventHandler(event); + return; + } + +#if CHIP_CONFIG_ENABLE_ICD_LIT + if (chip::DeviceLayer::ConfigurationMgr().IsFullyProvisioned()) + { + // If the device is commissioned and a factory reset is not scheduled, switch to active mode. + UserActiveModeHandler(event); + return; + } +#endif + + chip::NXP::App::GetAppTask().SwitchCommissioningStateHandler(); +} + +void ButtonManager::CancelTimer() +{ + if (xTimerStop(resetTimer, 0) == pdFAIL) + { + ChipLogProgress(DeviceLayer, "app timer stop() failed"); + } +} + +void ButtonManager::StartTimer(uint32_t aTimeoutInMs) +{ + if (xTimerIsTimerActive(resetTimer)) + { + ChipLogProgress(DeviceLayer, "app timer already started!"); + CancelTimer(); + } + + // timer is not active, change its period to required value (== restart). + // FreeRTOS- Block for a maximum of 100 ticks if the change period command + // cannot immediately be sent to the timer command queue. + if (xTimerChangePeriod(resetTimer, aTimeoutInMs / portTICK_PERIOD_MS, 100) != pdPASS) + { + ChipLogProgress(DeviceLayer, "app timer start() failed"); + } +} diff --git a/examples/platform/nxp/k32w1/button/ButtonManager.h b/examples/platform/nxp/k32w1/button/ButtonManager.h new file mode 100644 index 00000000000000..aec2411e1095af --- /dev/null +++ b/examples/platform/nxp/k32w1/button/ButtonManager.h @@ -0,0 +1,108 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "AppEvent.h" + +#include "FreeRTOS.h" +#include "timers.h" + +#include "fsl_component_button.h" + +#include + +// Application-defined error codes in the CHIP_ERROR space. +#define APP_ERROR_CREATE_TIMER_FAILED CHIP_APPLICATION_ERROR(0x01) + +/** + * @brief Timeout (ms) for factory data reset action. + * + * During this timeout, the factory reset action can be cancelled by pressing a button. + */ +#ifndef BUTTON_MANAGER_FACTORY_RESET_TIMEOUT_MS +#define BUTTON_MANAGER_FACTORY_RESET_TIMEOUT_MS 6000 +#endif + +/** + * @brief This class describes a manager for button callbacks. + * + */ +class ButtonManager +{ +public: + CHIP_ERROR Init(); + + // These are the callbacks registered with the buttons. They will delegate actions + // to other methods based on the button event: short press, long press etc. + static button_status_t BleCallback(void * handle, button_callback_message_t * message, void * param); + static button_status_t AppActionCallback(void * handle, button_callback_message_t * message, void * param); + +private: + /** + * @brief This callback performs a soft reset. + * + * This can be used when the user wants to clean reset the device, + * meaning that Matter is properly shutdown, unlike a RESET button + * press, where the device resets without calling the shutdown procedure. + */ + static void SoftResetHandler(const AppEvent & event); + + /** + * @brief This callback toggles between BLE start/stop advertising. + * + * It is used during commissioning to ensure a user-intent commissioning flow. + */ + static void BleHandler(const AppEvent & event); + + /** + * @brief This callback updates the application state. + * + * An example of application state would be the lighting manager light LED state. + * This handler will toggle the light LED state. + */ + static void AppActionEventHandler(const AppEvent & event); + + /** + * @brief This callback schedules a factory reset. + * + * The factory reset is scheduled based on the value of BUTTON_MANAGER_FACTORY_RESET_TIMEOUT_MS. + * Until the timer expires, the user can cancel the factory reset operation by doing an action. + * In this reference app, the action would be pressing again the factory reset button. + */ + static void ResetActionEventHandler(const AppEvent & event); + + /** + * @brief This callback performs a factory reset. + * + * This is the callback registered with the timer scheduled in ResetActionEventHandler. + * It will schedule a factory reset using the Matter server instance. + */ + static void FunctionTimerEventHandler(const AppEvent & event); + + void CancelTimer(); + void StartTimer(uint32_t aTimeoutInMs); + + friend ButtonManager & ButtonMgr(); + static ButtonManager sInstance; +}; + +inline ButtonManager & ButtonMgr() +{ + return ButtonManager::sInstance; +} diff --git a/examples/platform/nxp/k32w1/clusters/Identify.cpp b/examples/platform/nxp/k32w1/clusters/Identify.cpp new file mode 100644 index 00000000000000..2d309f975eaca0 --- /dev/null +++ b/examples/platform/nxp/k32w1/clusters/Identify.cpp @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "Identify.h" +#include "AppTask.h" +#include "UserInterfaceFeedback.h" + +#include + +using namespace chip; +using namespace chip::app; + +static Identify gIdentify = { EndpointId{ 1 }, NXP::App::OnIdentifyStart, NXP::App::OnIdentifyStop, + Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator, NXP::App::OnTriggerEffect, + // Use invalid value for identifiers to enable TriggerEffect command + // to stop Identify command for each effect + Clusters::Identify::EffectIdentifierEnum::kUnknownEnumValue, + Clusters::Identify::EffectVariantEnum::kDefault }; + +namespace chip::NXP::App { + +void OnIdentifyStart(Identify * identify) +{ + chip::DeviceLayer::SystemLayer().CancelTimer(OnTriggerEffectComplete, identify); + OnTriggerEffectComplete(&chip::DeviceLayer::SystemLayer(), identify); + + ChipLogProgress(Zcl, "Identify process has started. Status LED should blink with a period of 0.5 seconds."); + +#if CONFIG_ENABLE_FEEDBACK + FeedbackMgr().DisplayOnAction(UserInterfaceFeedback::Action::kIdentify); +#endif +} + +void OnIdentifyStop(Identify * identify) +{ + ChipLogProgress(Zcl, "Identify process has stopped."); + +#if CONFIG_ENABLE_FEEDBACK + FeedbackMgr().RestoreState(); +#endif +} + +void OnTriggerEffectComplete(chip::System::Layer * systemLayer, void * appState) +{ + // Let Identify command take over if called during TriggerEffect already running + ChipLogProgress(Zcl, "TriggerEffect has stopped."); + + // TriggerEffect finished - reset identifiers + // Use invalid value for identifiers to enable TriggerEffect command + // to stop Identify command for each effect + gIdentify.mCurrentEffectIdentifier = Clusters::Identify::EffectIdentifierEnum::kUnknownEnumValue; + gIdentify.mTargetEffectIdentifier = Clusters::Identify::EffectIdentifierEnum::kUnknownEnumValue; + gIdentify.mEffectVariant = Clusters::Identify::EffectVariantEnum::kDefault; + +#if CONFIG_ENABLE_FEEDBACK + FeedbackMgr().RestoreState(); +#endif +} + +void OnTriggerEffect(Identify * identify) +{ + uint16_t timerDelay = 0; + + ChipLogProgress(Zcl, "TriggerEffect has started."); + + switch (identify->mCurrentEffectIdentifier) + { + case Clusters::Identify::EffectIdentifierEnum::kBlink: + timerDelay = 2; + break; + + case Clusters::Identify::EffectIdentifierEnum::kBreathe: + timerDelay = 15; + break; + + case Clusters::Identify::EffectIdentifierEnum::kOkay: + timerDelay = 4; + break; + + case Clusters::Identify::EffectIdentifierEnum::kChannelChange: + ChipLogProgress(Zcl, "Channel Change effect not supported, using effect %d", + to_underlying(Clusters::Identify::EffectIdentifierEnum::kBlink)); + timerDelay = 2; + break; + + case Clusters::Identify::EffectIdentifierEnum::kFinishEffect: + chip::DeviceLayer::SystemLayer().CancelTimer(OnTriggerEffectComplete, identify); + timerDelay = 1; + break; + + case Clusters::Identify::EffectIdentifierEnum::kStopEffect: + chip::DeviceLayer::SystemLayer().CancelTimer(OnTriggerEffectComplete, identify); + OnTriggerEffectComplete(&chip::DeviceLayer::SystemLayer(), identify); + break; + + default: + ChipLogProgress(Zcl, "Invalid effect identifier."); + } + + if (timerDelay) + { +#if CONFIG_ENABLE_FEEDBACK + FeedbackMgr().DisplayOnAction(UserInterfaceFeedback::Action::kTriggerEffect); +#endif + chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds16(timerDelay), OnTriggerEffectComplete, identify); + } +} + +} // namespace chip::NXP::App diff --git a/examples/platform/nxp/k32w/k32w1/doc/images/debug_k32w1.jpg b/examples/platform/nxp/k32w1/doc/images/debug_k32w1.jpg similarity index 100% rename from examples/platform/nxp/k32w/k32w1/doc/images/debug_k32w1.jpg rename to examples/platform/nxp/k32w1/doc/images/debug_k32w1.jpg diff --git a/examples/platform/nxp/k32w/k32w1/doc/images/import_demo.jpg b/examples/platform/nxp/k32w1/doc/images/import_demo.jpg similarity index 100% rename from examples/platform/nxp/k32w/k32w1/doc/images/import_demo.jpg rename to examples/platform/nxp/k32w1/doc/images/import_demo.jpg diff --git a/examples/platform/nxp/k32w/k32w1/doc/images/installed_sdks.jpg b/examples/platform/nxp/k32w1/doc/images/installed_sdks.jpg similarity index 100% rename from examples/platform/nxp/k32w/k32w1/doc/images/installed_sdks.jpg rename to examples/platform/nxp/k32w1/doc/images/installed_sdks.jpg diff --git a/examples/platform/nxp/k32w/k32w1/doc/images/k32w1-evk.jpg b/examples/platform/nxp/k32w1/doc/images/k32w1-evk.jpg similarity index 100% rename from examples/platform/nxp/k32w/k32w1/doc/images/k32w1-evk.jpg rename to examples/platform/nxp/k32w1/doc/images/k32w1-evk.jpg diff --git a/examples/platform/nxp/k32w/k32w1/doc/images/mcux-sdk-download.jpg b/examples/platform/nxp/k32w1/doc/images/mcux-sdk-download.jpg similarity index 100% rename from examples/platform/nxp/k32w/k32w1/doc/images/mcux-sdk-download.jpg rename to examples/platform/nxp/k32w1/doc/images/mcux-sdk-download.jpg diff --git a/examples/platform/nxp/k32w/k32w1/doc/images/new_project.jpg b/examples/platform/nxp/k32w1/doc/images/new_project.jpg similarity index 100% rename from examples/platform/nxp/k32w/k32w1/doc/images/new_project.jpg rename to examples/platform/nxp/k32w1/doc/images/new_project.jpg diff --git a/examples/platform/nxp/k32w/k32w1/doc/images/ota_topology.JPG b/examples/platform/nxp/k32w1/doc/images/ota_topology.JPG similarity index 100% rename from examples/platform/nxp/k32w/k32w1/doc/images/ota_topology.JPG rename to examples/platform/nxp/k32w1/doc/images/ota_topology.JPG diff --git a/examples/platform/nxp/k32w1/factory_data/source/AppFactoryDataExample.cpp b/examples/platform/nxp/k32w1/factory_data/source/AppFactoryDataExample.cpp new file mode 100644 index 00000000000000..dbccc2fd7dc7f9 --- /dev/null +++ b/examples/platform/nxp/k32w1/factory_data/source/AppFactoryDataExample.cpp @@ -0,0 +1,76 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * Copyright 2023-2024 NXP + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "AppFactoryData.h" + +#include +#include +#include + +#if CONFIG_CHIP_PLAT_LOAD_REAL_FACTORY_DATA +#include "FactoryDataDriver.h" +#include "FactoryDataProvider.h" +#else +#include +#endif + +using namespace chip; +using namespace ::chip::Credentials; +using namespace ::chip::DeviceLayer; + +#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA && CONFIG_CHIP_OTA_FACTORY_DATA_PROCESSOR +/** + * Custom factory data restore mechanism. This function must be implemented by vendors. + */ +CHIP_ERROR CustomFactoryDataRestoreMechanism(void) +{ + ChipLogProgress(DeviceLayer, "This is a custom factory data restore mechanism."); + + return CHIP_NO_ERROR; +} +#endif + +/** + * Allows to register Matter factory data before initializing the Matter stack + */ +CHIP_ERROR NXP::App::AppFactoryData_PreMatterStackInit(void) +{ + return CHIP_NO_ERROR; +} + +/** + * Allows to register Matter factory data after initializing the Matter stack + */ +CHIP_ERROR NXP::App::AppFactoryData_PostMatterStackInit(void) +{ +#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA + ReturnErrorOnFailure(FactoryDataDrv().Init()); +#if CONFIG_CHIP_OTA_FACTORY_DATA_PROCESSOR + FactoryDataPrvd().RegisterRestoreMechanism(CustomFactoryDataRestoreMechanism); +#endif + ReturnErrorOnFailure(FactoryDataPrvd().Init()); + SetDeviceInstanceInfoProvider(&FactoryDataPrvd()); + SetDeviceAttestationCredentialsProvider(&FactoryDataPrvd()); + SetCommissionableDataProvider(&FactoryDataPrvd()); +#else + // Initialize device attestation with example one (only for debug purpose) + SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); +#endif + return CHIP_NO_ERROR; +} diff --git a/examples/platform/nxp/k32w1/operational_keystore/OperationalKeystore.cpp b/examples/platform/nxp/k32w1/operational_keystore/OperationalKeystore.cpp new file mode 100644 index 00000000000000..ecd72266178984 --- /dev/null +++ b/examples/platform/nxp/k32w1/operational_keystore/OperationalKeystore.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "OperationalKeystore.h" +#include "K32W1PersistentStorageOpKeystore.h" + +static chip::K32W1PersistentStorageOpKeystore sInstance; + +chip::Crypto::OperationalKeystore * chip::NXP::App::OperationalKeystore::GetInstance() +{ + return &sInstance; +} + +CHIP_ERROR chip::NXP::App::OperationalKeystore::Init(PersistentStorageDelegate * delegate) +{ + VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INTERNAL); + sInstance.Init(delegate); + + return CHIP_NO_ERROR; +} diff --git a/examples/platform/nxp/k32w/k32w1/util/include/LED_Dimmer.h b/examples/platform/nxp/k32w1/ota/OtaUtils.cpp similarity index 81% rename from examples/platform/nxp/k32w/k32w1/util/include/LED_Dimmer.h rename to examples/platform/nxp/k32w1/ota/OtaUtils.cpp index 424ffa20c97bbd..4088196ba34973 100644 --- a/examples/platform/nxp/k32w/k32w1/util/include/LED_Dimmer.h +++ b/examples/platform/nxp/k32w1/ota/OtaUtils.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2020 Google LLC. + * Copyright (c) 2024 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,6 +16,9 @@ * limitations under the License. */ -void init_dimmable(); -void init_tpm(); -void move_to_level(uint8_t level); +#include "OtaSupport.h" + +extern "C" void OTAIdleActivities(void) +{ + OTA_TransactionResume(); +} diff --git a/examples/platform/nxp/k32w1/rpc/AppRpc.cpp b/examples/platform/nxp/k32w1/rpc/AppRpc.cpp new file mode 100644 index 00000000000000..beea8408438300 --- /dev/null +++ b/examples/platform/nxp/k32w1/rpc/AppRpc.cpp @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "AppRpc.h" +#include "ButtonManager.h" +#include "clock_config.h" +#include "pin_mux.h" + +#include "Rpc.h" + +CHIP_ERROR chip::NXP::App::Rpc::Init() +{ + /* set clock */ + CLOCK_SetIpSrc(kCLOCK_Lpuart1, kCLOCK_IpSrcFro192M); + /* enable clock */ + CLOCK_EnableClock(kCLOCK_Lpuart1); + + BOARD_InitPinLPUART1_TX(); + BOARD_InitPinLPUART1_RX(); + chip::rpc::Init(); + + return CHIP_NO_ERROR; +} + +#if defined(PW_RPC_DEVICE_SERVICE) && PW_RPC_DEVICE_SERVICE +void chip::NXP::App::Rpc::Reboot() +{ + NVIC_SystemReset(); +} +#endif + +#if defined(PW_RPC_BUTTON_SERVICE) && PW_RPC_BUTTON_SERVICE +void chip::NXP::App::Rpc::ButtonHandler(const chip_rpc_ButtonEvent & request) +{ + button_callback_message_t * message = new button_callback_message_t; + + switch (request.idx) + { + case 0: + message->event = kBUTTON_EventShortPress; + ButtonMgr().BleCallback(nullptr, message, nullptr); + break; + case 1: + message->event = kBUTTON_EventLongPress; + ButtonMgr().BleCallback(nullptr, message, nullptr); + break; + case 2: + message->event = kBUTTON_EventShortPress; + ButtonMgr().AppActionCallback(nullptr, message, nullptr); + break; + case 3: + message->event = kBUTTON_EventLongPress; + ButtonMgr().AppActionCallback(nullptr, message, nullptr); + break; + default: + break; + } + + delete message; +} +#endif diff --git a/examples/platform/nxp/k32w/k32w1/util/LED_Dimmer.cpp b/examples/platform/nxp/k32w1/util/LedDimmer.cpp similarity index 97% rename from examples/platform/nxp/k32w/k32w1/util/LED_Dimmer.cpp rename to examples/platform/nxp/k32w1/util/LedDimmer.cpp index 02a62724716e53..c682abb5c1480a 100644 --- a/examples/platform/nxp/k32w/k32w1/util/LED_Dimmer.cpp +++ b/examples/platform/nxp/k32w1/util/LedDimmer.cpp @@ -17,7 +17,7 @@ * limitations under the License. */ -#include "LED_Dimmer.h" +#include "LedDimmer.h" #include "fsl_common.h" #include "fsl_port.h" #include "fsl_tpm.h" @@ -36,9 +36,11 @@ #define DEMO_PWM_FREQUENCY (24000U) #endif +namespace chip::NXP::App { + volatile uint8_t updatedDutycycle = 0U; -void init_dimmable() +static void initConfig() { const port_pin_config_t porta20_pin17_config = { /* Internal pull-up/down resistor is disabled */ (uint16_t) kPORT_PullDisable, @@ -105,15 +107,15 @@ void init_dimmable() }; /* PORTA19 (pin 14) is configured as TPM0_CH0 */ PORT_SetPinConfig(PORTA, 19U, &porta19_pin14_config); - - init_tpm(); } -void init_tpm() +void LedDimmer::Init(uint8_t index, bool inverted) { tpm_config_t tpmInfo; tpm_chnl_pwm_signal_param_t tpmParam[3]; + initConfig(); + /* TPM 0 Clock Gate Control: Clock enabled */ CLOCK_EnableClock(kCLOCK_Tpm0); /* Set the source for the LPIT module */ @@ -157,10 +159,12 @@ void init_tpm() TPM_StartTimer(BOARD_TPM_BASEADDR, kTPM_SystemClock); } -void move_to_level(uint8_t level) +void LedDimmer::Set(uint8_t level) { uint8_t control; + mState = level != 0; + updatedDutycycle = static_cast(level * 90) / 255; control = TPM_GetChannelContorlBits(BOARD_TPM_BASEADDR, (tpm_chnl_t) BOARD_FIRST_TPM_CHANNEL); @@ -191,3 +195,5 @@ void move_to_level(uint8_t level) TPM_EnableChannel(BOARD_TPM_BASEADDR, (tpm_chnl_t) BOARD_SECOND_TPM_CHANNEL, control); TPM_EnableChannel(BOARD_TPM_BASEADDR, (tpm_chnl_t) BOARD_THIRD_TPM_CHANNEL, control); } + +} // namespace chip::NXP::App diff --git a/examples/platform/nxp/k32w/k32w1/util/LEDWidget.cpp b/examples/platform/nxp/k32w1/util/LedOnOff.cpp similarity index 53% rename from examples/platform/nxp/k32w/k32w1/util/LEDWidget.cpp rename to examples/platform/nxp/k32w1/util/LedOnOff.cpp index 695da50e3dae32..92b1f41ebfba4f 100644 --- a/examples/platform/nxp/k32w/k32w1/util/LEDWidget.cpp +++ b/examples/platform/nxp/k32w1/util/LedOnOff.cpp @@ -17,93 +17,69 @@ * limitations under the License. */ -#include "LEDWidget.h" +#include "LedOnOff.h" +#include "app.h" #include -#include "app.h" - -#if CHIP_CONFIG_ENABLE_DIMMABLE_LED -#include "LED_Dimmer.h" -#endif +namespace chip::NXP::App { #if (defined(gAppLedCnt_c) && (gAppLedCnt_c > 0)) -void LEDWidget::Init(uint8_t led, bool inverted) +void LedOnOff::Init(uint8_t index, bool inverted) { mLastChangeTimeMS = 0; - mBlinkOnTimeMS = 0; - mBlinkOffTimeMS = 0; - mGPIONum = led; + mOnTimeMS = 0; + mOffTimeMS = 0; + mIndex = index; mState = false; mOnLogic = !inverted; Set(false); } -void LEDWidget::Invert(void) -{ - Set(!mState); -} - -void LEDWidget::Set(bool state) -{ - mLastChangeTimeMS = mBlinkOnTimeMS = mBlinkOffTimeMS = 0; - DoSet(state); -} - -void LEDWidget::SetLevel(uint8_t level) +void LedOnOff::Set(uint8_t level) { -#if CHIP_CONFIG_ENABLE_DIMMABLE_LED - move_to_level(level); -#endif + mLastChangeTimeMS = mOnTimeMS = mOffTimeMS = 0; + DoSet(level != 0); } -void LEDWidget::Blink(uint32_t changeRateMS) +void LedOnOff::Animate(uint32_t onTimeMS, uint32_t offTimeMS) { - Blink(changeRateMS, changeRateMS); -} - -void LEDWidget::Blink(uint32_t onTimeMS, uint32_t offTimeMS) -{ - mBlinkOnTimeMS = onTimeMS; - mBlinkOffTimeMS = offTimeMS; - Animate(); -} + if (onTimeMS && offTimeMS) + { + mOnTimeMS = onTimeMS; + mOffTimeMS = offTimeMS; + } -void LEDWidget::Animate() -{ - if (mBlinkOnTimeMS != 0 && mBlinkOffTimeMS != 0) + if (mOnTimeMS && mOffTimeMS) { uint64_t nowMS = chip::System::SystemClock().GetMonotonicMilliseconds64().count(); - uint64_t stateDurMS = mState ? mBlinkOnTimeMS : mBlinkOffTimeMS; + uint64_t stateDurMS = mState ? mOnTimeMS : mOffTimeMS; uint64_t nextChangeTimeMS = mLastChangeTimeMS + stateDurMS; if (nextChangeTimeMS < nowMS) { -#if CHIP_CONFIG_ENABLE_DIMMABLE_LED - SetLevel(!mState * 254); - mState = !mState; -#else DoSet(!mState); -#endif mLastChangeTimeMS = nowMS; } } } -void LEDWidget::DoSet(bool state) +void LedOnOff::DoSet(bool state) { mState = state; if (state) { - (void) LED_TurnOnOff((led_handle_t) g_ledHandle[mGPIONum], mOnLogic); + (void) LED_TurnOnOff((led_handle_t) g_ledHandle[mIndex], mOnLogic); } else { - (void) LED_TurnOnOff((led_handle_t) g_ledHandle[mGPIONum], !mOnLogic); + (void) LED_TurnOnOff((led_handle_t) g_ledHandle[mIndex], !mOnLogic); } } #endif /* (defined(gAppLedCnt_c) && (gAppLedCnt_c > 0)) */ + +} // namespace chip::NXP::App diff --git a/examples/platform/nxp/k32w1/util/LightingManagerDimmable.cpp b/examples/platform/nxp/k32w1/util/LightingManagerDimmable.cpp new file mode 100644 index 00000000000000..8476101f5d1a3e --- /dev/null +++ b/examples/platform/nxp/k32w1/util/LightingManagerDimmable.cpp @@ -0,0 +1,79 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "LightingManagerDimmable.h" + +#include "AppConfig.h" +#include "AppTask.h" + +#include +#include +#include +#include +#include + +LightingManagerDimmable LightingManagerDimmable::sLightingManager; + +#if CONFIG_ENABLE_FEEDBACK +UserInterfaceFeedback & FeedbackMgr() +{ + return LightingMgr(); +} +#endif + +void LightingManagerDimmable::ApplyDim(uint8_t value) +{ + ChipLogProgress(DeviceLayer, "Dim action has been initiated"); + LightingManagerDimmable::lightLed.Set(LightingManagerDimmable::lightLed.IsTurnedOff() ? 1 : value); + ChipLogProgress(DeviceLayer, "Move to level %d completed", value); +} + +void LightingManagerDimmable::Init() +{ + /* The parameters will not be used by the dimmer init. */ + lightLed.Init(LIGHTING_MANAGER_LIGHT_LED_INDEX, false); + + RestoreState(); +} + +void LightingManagerDimmable::DisplayInLoop() +{ + lightLed.Animate(); +} + +void LightingManagerDimmable::DisplayOnAction(Action action) +{ + // Do nothing for now. +} + +void LightingManagerDimmable::RestoreState() +{ + /* restore initial state for the LED indicating Lighting state */ + lightLed.Set(false); + + chip::DeviceLayer::PlatformMgr().ScheduleWork([](intptr_t arg) { + chip::app::DataModel::Nullable currentLevel; + chip::app::Clusters::LevelControl::Attributes::CurrentLevel::Get(LIGHTING_MANAGER_APP_DEVICE_TYPE_ENDPOINT, currentLevel); + LightingMgr().ApplyDim(currentLevel.Value()); + }); +} + +void LightingManagerDimmable::UpdateState() +{ + // Do nothing for now. +} diff --git a/examples/platform/nxp/k32w1/util/LightingManagerDimmable.h b/examples/platform/nxp/k32w1/util/LightingManagerDimmable.h new file mode 100644 index 00000000000000..0cd4475ebfb7da --- /dev/null +++ b/examples/platform/nxp/k32w1/util/LightingManagerDimmable.h @@ -0,0 +1,85 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "AppConfig.h" +#include "LedDimmer.h" +#include "LedWidgetInterface.h" +#include "UserInterfaceFeedback.h" + +#include +#include + +using namespace chip::NXP::App; + +/* These flags can be overwritten in AppConfig.h */ +/** + * @brief Specifies the endpoint on which Application Device Type cluster is present. + * + * For example, this should be 1 for Contact Sensor and Lighting App reference apps. + */ +#ifndef LIGHTING_MANAGER_APP_DEVICE_TYPE_ENDPOINT +#define LIGHTING_MANAGER_APP_DEVICE_TYPE_ENDPOINT 1 +#endif + +/** + * @brief Specifies the array index of the light LED. + * + * The light LED is usually used to indicate the state of some cluster + * attribute: e.g OnOff attribute from OnOff cluster. + */ +#ifndef LIGHTING_MANAGER_LIGHT_LED_INDEX +#define LIGHTING_MANAGER_LIGHT_LED_INDEX 1 +#endif + +/** + * @brief Enable dimmable LED instead of a simple on/off LED. + * + */ +#ifndef LIGHTING_MANAGER_ENABLE_DIMMABLE_LED +#define LIGHTING_MANAGER_ENABLE_DIMMABLE_LED 1 +#endif + +/** + * @brief Manager of LedDimmer instance. + * + * It implements the UserInterfaceFeedback abstract interface. + */ +class LightingManagerDimmable : public UserInterfaceFeedback +{ +public: + void Init() override; + void DisplayInLoop() override; + void DisplayOnAction(Action action) override; + void RestoreState() override; + void UpdateState() override; + +private: + void ApplyDim(uint8_t value); + + LedDimmer lightLed; + + friend LightingManagerDimmable & LightingMgr(void); + static LightingManagerDimmable sLightingManager; +}; + +inline LightingManagerDimmable & LightingMgr(void) +{ + return LightingManagerDimmable::sLightingManager; +} diff --git a/examples/platform/nxp/pw_rpc_server.gni b/examples/platform/nxp/pw_rpc_server.gni index 0ec2d3b121b2d5..7133b44bf24aac 100644 --- a/examples/platform/nxp/pw_rpc_server.gni +++ b/examples/platform/nxp/pw_rpc_server.gni @@ -48,6 +48,7 @@ pw_rpc_server = { ] deps = [ + "$dir_pw_hdlc:default_addresses", "$dir_pw_hdlc:rpc_channel_output", "$dir_pw_stream:sys_io_stream", "$dir_pw_trace", diff --git a/scripts/build/builders/nxp.py b/scripts/build/builders/nxp.py index e119a78b5e2cc2..00678e8b0cc246 100644 --- a/scripts/build/builders/nxp.py +++ b/scripts/build/builders/nxp.py @@ -56,7 +56,7 @@ def FolderName(self, os_env): if self == NxpBoard.K32W0: return 'k32w0' elif self == NxpBoard.K32W1: - return 'k32w/k32w1' + return 'k32w1' elif self == NxpBoard.RW61X: if os_env == NxpOsUsed.ZEPHYR: return 'zephyr' @@ -250,7 +250,8 @@ def generate(self): cmd += 'export NXP_K32W0_SDK_ROOT="' + str(p.sdk_storage_location_abspath) + '" \n ' elif p.sdk_name == 'common': cmd += 'export NXP_SDK_ROOT="' + str(p.sdk_storage_location_abspath) + '" \n ' - cmd += 'gn gen --check --fail-on-unused-args --export-compile-commands --root=%s' % self.root + # add empty space at the end to avoid concatenation issue when there is no --args + cmd += 'gn gen --check --fail-on-unused-args --export-compile-commands --root=%s ' % self.root extra_args = [] diff --git a/scripts/tools/nxp/factory_data_generator/generate.py b/scripts/tools/nxp/factory_data_generator/generate.py index 0d905d41faae0b..b3ee98562b6c3a 100755 --- a/scripts/tools/nxp/factory_data_generator/generate.py +++ b/scripts/tools/nxp/factory_data_generator/generate.py @@ -22,6 +22,7 @@ import subprocess import sys +from crc import Calculator, Crc16 from custom import (CertDeclaration, DacCert, DacPKey, Discriminator, HardwareVersion, HardwareVersionStr, IterationCount, ManufacturingDate, PaiCert, PartNumber, ProductFinish, ProductId, ProductLabel, ProductName, ProductPrimaryColor, ProductURL, Salt, SerialNum, SetupPasscode, StrArgument, UniqueId, VendorId, VendorName, @@ -133,6 +134,15 @@ def to_bin(self, klv, out, aes128_key): size = len(fullContent) + if (self.args.hw_params): + calculator = Calculator(Crc16.XMODEM) + crc_sum = calculator.checksum(fullContent) + + fullContent = bytearray(b"APP_FACT_DATA: ") + size.to_bytes(4, 'little') + \ + fullContent + crc_sum.to_bytes(2, 'little') + + size = len(fullContent) + logging.info("Size of final generated binary is: {} bytes".format(size)) file.write(fullContent) else: @@ -235,6 +245,8 @@ def main(): help="[str] Visible finish of the product") optional.add_argument("--product_primary_color", type=ProductPrimaryColor, metavar=ProductPrimaryColor.VALUES, help="[str] Representative color of the visible parts of the product") + optional.add_argument("--hw_params", action='store_true', + help="[bool] If present, store factory data in HWParameters APP section") args = parser.parse_args() diff --git a/scripts/tools/nxp/ota/README.md b/scripts/tools/nxp/ota/README.md index d96ab70d63c251..5c3a12adba7cf9 100644 --- a/scripts/tools/nxp/ota/README.md +++ b/scripts/tools/nxp/ota/README.md @@ -14,7 +14,7 @@ thus the `OTAImageProcessorImpl` instance should take this into account. ## Supported platforms - K32W0 - - [K32W OTA README](../../../../src/platform/nxp/k32w/common/K32W_OTA_README.md) + [K32W OTA README](../../../../src/platform/nxp/common/legacy/OTA_README.md) ## Usage diff --git a/src/lib/shell/streamer_nxp.cpp b/src/lib/shell/streamer_nxp.cpp index e46fce84072529..355015ce8f1ddd 100644 --- a/src/lib/shell/streamer_nxp.cpp +++ b/src/lib/shell/streamer_nxp.cpp @@ -66,7 +66,7 @@ #endif // pw RPC uses UART DMA by default -#ifdef PW_RPC_ENABLED +#ifdef CONFIG_ENABLE_PW_RPC #define CONSUMER_TASK_HANDLE RpcTaskHandle #ifndef STREAMER_UART_USE_DMA #define STREAMER_UART_USE_DMA 1 @@ -76,7 +76,7 @@ #ifndef STREAMER_UART_USE_DMA #define STREAMER_UART_USE_DMA 0 #endif -#endif // PW_RPC_ENABLED +#endif // CONFIG_ENABLE_PW_RPC #if STREAMER_UART_USE_DMA typedef serial_port_uart_dma_config_t streamer_serial_port_uart_config_t; diff --git a/src/platform/nxp/BUILD.gn b/src/platform/nxp/BUILD.gn index b60e57af6a4353..0865a1d36dacb6 100644 --- a/src/platform/nxp/BUILD.gn +++ b/src/platform/nxp/BUILD.gn @@ -26,9 +26,24 @@ source_set("logging") { "${chip_root}/src/platform/logging:headers", ] - if (nxp_platform == "k32w/k32w0" || nxp_platform == "k32w/k32w1") { + if (nxp_platform == "k32w/k32w0" || nxp_platform == "k32w1") { sources = [ "${chip_root}/src/platform/nxp/${nxp_platform}/Logging.cpp" ] } else { sources = [ "${chip_root}/src/platform/nxp/common/Logging.cpp" ] } } + +# The application can use this target to integrate the default, platform-specific +# NXP factory data provider. Each platform should define an "nxp_factory_data" source set. +# Usage: deps += [ "${chip_root}/src/platform/nxp:nxp_factory_data" ] +group("nxp_factory_data") { + public_deps = + [ "${chip_root}/src/platform/nxp/${nxp_platform}:nxp_factory_data" ] +} + +# The application can use this target to integrate the default, platform-specific +# NXP OTA implementation. Each platform should define an "nxp_ota" source set. +# Usage: deps += [ "${chip_root}/src/platform/nxp:nxp_ota" ] +group("nxp_ota") { + public_deps = [ "${chip_root}/src/platform/nxp/${nxp_platform}:nxp_ota" ] +} diff --git a/src/platform/nxp/common/NXPConfig.cpp b/src/platform/nxp/common/NXPConfig.cpp index b047d8afebc5ae..029c5e1766385f 100644 --- a/src/platform/nxp/common/NXPConfig.cpp +++ b/src/platform/nxp/common/NXPConfig.cpp @@ -21,8 +21,6 @@ * Utilities for accessing persisted device configuration on * platforms based on the NXP SDK. */ -/* this file behaves like a config.h, comes first */ -#include #include "NXPConfig.h" @@ -30,6 +28,7 @@ #include "FunctionLib.h" #include "board.h" #include +#include #include /* FS Writes in Idle task only - LittleFS only , already enabled by default on NVM */ diff --git a/src/platform/nxp/common/NXPConfig.h b/src/platform/nxp/common/NXPConfig.h index c20dc7e5071d48..432acfa196abbb 100644 --- a/src/platform/nxp/common/NXPConfig.h +++ b/src/platform/nxp/common/NXPConfig.h @@ -23,10 +23,9 @@ #pragma once -#include - #include "FreeRTOS.h" #include +#include #define CHIP_PLAT_NO_NVM 0 #define CHIP_PLAT_NVM_FWK 1 diff --git a/src/platform/nxp/common/NXPConfigKS.cpp b/src/platform/nxp/common/NXPConfigKS.cpp index f7dd6bdc972919..1940a8081cbf7c 100644 --- a/src/platform/nxp/common/NXPConfigKS.cpp +++ b/src/platform/nxp/common/NXPConfigKS.cpp @@ -20,8 +20,6 @@ * Utilities for accessing persisted device configuration on * platforms based on the NXP SDK. */ -/* this file behaves like a config.h, comes first */ -#include #include "NXPConfig.h" @@ -29,6 +27,7 @@ #include "FunctionLib.h" #include "board.h" #include +#include #include #include "fwk_file_cache.h" diff --git a/src/platform/nxp/common/NXPConfigNVS.cpp b/src/platform/nxp/common/NXPConfigNVS.cpp new file mode 100644 index 00000000000000..34d98a36d25002 --- /dev/null +++ b/src/platform/nxp/common/NXPConfigNVS.cpp @@ -0,0 +1,347 @@ +/* + * + * Copyright (c) 2020-2022 Project CHIP Authors + * Copyright 2024 NXP + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "NXPConfig.h" +#include +#include +#include +#include + +/* Only for flash init, to be move to sdk framework */ +#include "port/nvs_port.h" + +// These can be overridden by the application as needed. +#ifndef CHIP_DEVICE_INTEGER_SETTINGS_KEY +/// Key for all integer keys +#define CHIP_DEVICE_INTEGER_SETTINGS_KEY "mt_i" +#endif // CHIP_DEVICE_CONFIG_SETTINGS_KEY +#ifndef CHIP_DEVICE_STRING_SETTINGS_KEY +/// Key for all string keys +#define CHIP_DEVICE_STRING_SETTINGS_KEY "mt_s" +#endif // CHIP_DEVICE_CONFIG_SETTINGS_KEY + +namespace chip { +namespace DeviceLayer { +namespace Internal { + +namespace { + +struct ReadRequest +{ + void * const destination; // NOTE: can be nullptr in which case `configSize` should still be returned + const size_t bufferSize; // size of destination buffer + CHIP_ERROR result; // [out] read result + size_t configSize; // [out] size of configuration value +}; + +struct DeleteSubtreeEntry +{ + int result; +}; + +// Callback for settings_load_subtree_direct() function +int ConfigValueCallback(const char * name, size_t configSize, settings_read_cb readCb, void * cbArg, void * param) +{ + // If requested config key X, process just node X and ignore all its descendants: X/* + if (name != nullptr && *name != '\0') + return 0; + + ReadRequest & request = *reinterpret_cast(param); + + if (!request.destination || configSize > request.bufferSize) + { + request.result = CHIP_ERROR_BUFFER_TOO_SMALL; + request.configSize = configSize; + return 1; + } + + // Found requested key + const ssize_t bytesRead = readCb(cbArg, request.destination, request.bufferSize); + request.result = bytesRead > 0 ? CHIP_NO_ERROR : CHIP_ERROR_PERSISTED_STORAGE_FAILED; + request.configSize = bytesRead > 0 ? bytesRead : 0; + + // Return 1 to stop processing further keys + return 1; +} + +// Read configuration value of maximum size `bufferSize` and store the actual size in `configSize`. +CHIP_ERROR ReadConfigValueImpl(const NXPConfig::Key key, void * const destination, const size_t bufferSize, size_t & configSize) +{ + ReadRequest request{ destination, bufferSize, CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND, 0 }; + char key_name[SETTINGS_MAX_NAME_LEN + 1]; + + sprintf(key_name, CHIP_DEVICE_INTEGER_SETTINGS_KEY "/%04x", key); + settings_load_subtree_direct(key_name, ConfigValueCallback, &request); + configSize = request.configSize; + return request.result; +} + +CHIP_ERROR WriteConfigValueImpl(const NXPConfig::Key key, const void * const source, const size_t length) +{ + char key_name[SETTINGS_MAX_NAME_LEN + 1]; + sprintf(key_name, CHIP_DEVICE_INTEGER_SETTINGS_KEY "/%04x", key); + if (settings_save_one(key_name, source, length) != 0) + return CHIP_ERROR_PERSISTED_STORAGE_FAILED; +#if (DEBUG_NVM > 0) + ChipLogProgress(DeviceLayer, "WriteConfigValue done"); +#endif + return CHIP_NO_ERROR; +} + +template +inline CHIP_ERROR ReadSimpleConfigValue(const NXPConfig::Key key, T & value) +{ + CHIP_ERROR result; + T tempValue; + size_t configSize; + + result = ReadConfigValueImpl(key, &tempValue, sizeof(T), configSize); + SuccessOrExit(result); + + // For simple types require that size of the output variable matches size of the configuration value + VerifyOrExit(configSize == sizeof(T), result = CHIP_ERROR_INVALID_ARGUMENT); + value = tempValue; +exit: + return result; +} + +int DeleteSubtreeCallback(const char * name, size_t /* entrySize */, settings_read_cb /* readCb */, void * /* cbArg */, + void * param) +{ + + DeleteSubtreeEntry & entry = *static_cast(param); + char fullKey[SETTINGS_MAX_NAME_LEN + 1]; + (void) snprintf(fullKey, sizeof(fullKey), CHIP_DEVICE_STRING_SETTINGS_KEY "/%s", StringOrNullMarker(name)); + const int result = settings_delete(fullKey); + + // Return the first error, but continue removing remaining keys anyway. + if (entry.result == 0) + { + entry.result = result; + } + + return 0; +} +} // namespace + +CHIP_ERROR NXPConfig::Init() +{ + /* Only for flash init, to be move to sdk framework */ + /* Initialize flash components */ + const struct flash_area * fa; + + ReturnErrorCodeIf(flash_area_open(SETTINGS_PARTITION, &fa), CHIP_ERROR_PERSISTED_STORAGE_FAILED); + ReturnErrorCodeIf(flash_init(fa->fa_dev), CHIP_ERROR_PERSISTED_STORAGE_FAILED); + /* End flash init */ + + ReturnErrorCodeIf(settings_subsys_init(), CHIP_ERROR_PERSISTED_STORAGE_FAILED); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR NXPConfig::ReadConfigValue(Key key, bool & val) +{ + ReturnErrorCodeIf(!ValidConfigKey(key), CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND); // Verify key id. + return ReadSimpleConfigValue(key, val); +} + +CHIP_ERROR NXPConfig::ReadConfigValue(Key key, uint32_t & val) +{ + ReturnErrorCodeIf(!ValidConfigKey(key), CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND); // Verify key id. + return ReadSimpleConfigValue(key, val); +} + +CHIP_ERROR NXPConfig::ReadConfigValue(Key key, uint64_t & val) +{ + ReturnErrorCodeIf(!ValidConfigKey(key), CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND); // Verify key id. + return ReadSimpleConfigValue(key, val); +} + +CHIP_ERROR NXPConfig::ReadConfigValueStr(Key key, char * buf, size_t bufSize, size_t & outLen) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + ReturnErrorCodeIf(!ValidConfigKey(key), err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND); // Verify key id. + // Pretend that the buffer is smaller by 1 to secure space for null-character + err = ReadConfigValueImpl(key, buf, bufSize ? bufSize - 1 : 0, outLen); + + if (err == CHIP_NO_ERROR) + { + if (buf[outLen - 1]) // CHIP_NO_ERROR implies outLen > 0 + buf[outLen] = 0; + else + outLen--; + } + return err; +} + +CHIP_ERROR NXPConfig::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen) +{ + return ReadConfigValueImpl(key, buf, bufSize, outLen); +} + +CHIP_ERROR NXPConfig::ReadConfigValueBin(const char * keyString, uint8_t * buf, size_t bufSize, size_t & outLen) +{ + ReadRequest request{ buf, bufSize, CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND, 0 }; + char key_name[SETTINGS_MAX_NAME_LEN + 1]; + unsigned key_name_len; + + // to be able to concat CHIP_DEVICE_STRING_SETTINGS_KEY"/" and keyString, + 1 for end char + key_name_len = strlen(keyString) + strlen(CHIP_DEVICE_STRING_SETTINGS_KEY) + 1; + ReturnErrorCodeIf(key_name_len > (SETTINGS_MAX_NAME_LEN + 1), CHIP_ERROR_PERSISTED_STORAGE_FAILED); + + sprintf(key_name, CHIP_DEVICE_STRING_SETTINGS_KEY "/%s", keyString); + settings_load_subtree_direct(key_name, ConfigValueCallback, &request); + outLen = request.configSize; + return request.result; +} + +CHIP_ERROR NXPConfig::ReadConfigValueCounter(uint8_t counterIdx, uint32_t & val) +{ + Key key = kMinConfigKey_ChipCounter + counterIdx; + return ReadConfigValue(key, val); +} + +CHIP_ERROR NXPConfig::WriteConfigValue(Key key, bool val) +{ + return WriteConfigValueImpl(key, &val, sizeof(bool)); +} + +CHIP_ERROR NXPConfig::WriteConfigValue(Key key, uint32_t val) +{ + return WriteConfigValueImpl(key, &val, sizeof(uint32_t)); +} + +CHIP_ERROR NXPConfig::WriteConfigValue(Key key, uint64_t val) +{ + return WriteConfigValueImpl(key, &val, sizeof(uint64_t)); +} + +CHIP_ERROR NXPConfig::WriteConfigValueStr(Key key, const char * str) +{ + return WriteConfigValueStr(key, str, str ? strlen(str) : 0); +} + +CHIP_ERROR NXPConfig::WriteConfigValueStr(Key key, const char * str, size_t strLen) +{ + ReturnErrorCodeIf(!ValidConfigKey(key), CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND); // Verify key id. + return WriteConfigValueImpl(key, str, strLen); +} + +CHIP_ERROR NXPConfig::WriteConfigValueBin(Key key, const uint8_t * data, size_t dataLen) +{ + return WriteConfigValueStr(key, (char *) data, dataLen); +} + +CHIP_ERROR NXPConfig::WriteConfigValueBin(const char * keyString, const uint8_t * data, size_t dataLen) +{ + char key_name[SETTINGS_MAX_NAME_LEN + 1]; + unsigned key_name_len; + + // to be able to concat CHIP_DEVICE_STRING_SETTINGS_KEY"/" and keyString, + 1 for end char + key_name_len = strlen(keyString) + strlen(CHIP_DEVICE_STRING_SETTINGS_KEY) + 1; + ReturnErrorCodeIf(key_name_len > (SETTINGS_MAX_NAME_LEN + 1), CHIP_ERROR_PERSISTED_STORAGE_FAILED); + + sprintf(key_name, CHIP_DEVICE_STRING_SETTINGS_KEY "/%s", keyString); + if (settings_save_one(key_name, data, dataLen) != 0) + return CHIP_ERROR_PERSISTED_STORAGE_FAILED; + + return CHIP_NO_ERROR; +} + +CHIP_ERROR NXPConfig::WriteConfigValueCounter(uint8_t counterIdx, uint32_t val) +{ + Key key = kMinConfigKey_ChipCounter + counterIdx; + return WriteConfigValue(key, val); +} + +CHIP_ERROR NXPConfig::ClearConfigValue(Key key) +{ + char key_name[SETTINGS_MAX_NAME_LEN + 1]; + sprintf(key_name, CHIP_DEVICE_INTEGER_SETTINGS_KEY "/%04x", key); + return ClearConfigValue(key_name); +} + +CHIP_ERROR NXPConfig::ClearConfigValue(const char * keyString) +{ + char key_name[SETTINGS_MAX_NAME_LEN]; + unsigned key_name_len; + + // to be able to concat CHIP_DEVICE_STRING_SETTINGS_KEY"/" and keyString, + 1 for end char + key_name_len = strlen(keyString) + strlen(CHIP_DEVICE_STRING_SETTINGS_KEY) + 1; + ReturnErrorCodeIf(key_name_len > (SETTINGS_MAX_NAME_LEN + 1), CHIP_ERROR_PERSISTED_STORAGE_FAILED); + + sprintf(key_name, CHIP_DEVICE_STRING_SETTINGS_KEY "/%s", keyString); + if (settings_delete(key_name) != 0) + return CHIP_ERROR_PERSISTED_STORAGE_FAILED; + + return CHIP_NO_ERROR; +} + +bool NXPConfig::ConfigValueExists(Key key) +{ + bool err = false; + if (ValidConfigKey(key)) + { + size_t configSize; + err = ReadConfigValueImpl(key, nullptr, 0, configSize) == CHIP_ERROR_BUFFER_TOO_SMALL; + } + return err; +} + +CHIP_ERROR NXPConfig::FactoryResetConfig(void) +{ + DeleteSubtreeEntry entry{ /* success */ 0 }; + // Clear CHIP_DEVICE_STRING_SETTINGS_KEY/* keys + int result = settings_load_subtree_direct(CHIP_DEVICE_STRING_SETTINGS_KEY, DeleteSubtreeCallback, &entry); + + if (result == 0) + { + result = entry.result; + } + + char key_name[SETTINGS_MAX_NAME_LEN + 1]; + for (Key key = kMinConfigKey_ChipConfig; key <= kMaxConfigKey_ChipConfig; key++) + { + sprintf(key_name, CHIP_DEVICE_INTEGER_SETTINGS_KEY "/%04x", key); + if (settings_delete(key_name) != 0) + return CHIP_ERROR_PERSISTED_STORAGE_FAILED; + } + + // Clear RebootCount, TotalOperationalHours, UpTime counters during factory reset + for (Key key = kMinConfigKey_ChipCounter; key <= (kMinConfigKey_ChipCounter + 3); key++) + { + sprintf(key_name, CHIP_DEVICE_INTEGER_SETTINGS_KEY "/%04x", key); + if (settings_delete(key_name) != 0) + return CHIP_ERROR_PERSISTED_STORAGE_FAILED; + } + return CHIP_NO_ERROR; +} + +bool NXPConfig::ValidConfigKey(Key key) +{ + // Returns true if the key is in the valid CHIP Config PDM key range. + return (key >= kMinConfigKey_ChipFactory) && (key <= kMaxConfigKey_KVS); +} + +void NXPConfig::RunConfigUnitTest(void) {} + +void NXPConfig::RunSystemIdleTask(void) {} + +} // namespace Internal +} // namespace DeviceLayer +} // namespace chip diff --git a/src/platform/nxp/k32w/common/BLEManagerCommon.cpp b/src/platform/nxp/k32w/common/BLEManagerCommon.cpp deleted file mode 100644 index d9dbde88f3a614..00000000000000 --- a/src/platform/nxp/k32w/common/BLEManagerCommon.cpp +++ /dev/null @@ -1,1435 +0,0 @@ -/* - * - * Copyright (c) 2020-2021 Project CHIP Authors - * Copyright (c) 2020 Nest Labs, Inc. - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * Provides an implementation of the BLEManager singleton object - * for the K32W platforms. - */ - -/* this file behaves like a config.h, comes first */ -#include - -#include - -#include - -#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE - -#include - -#include "board.h" -#include "gatt_db_app_interface.h" -#include "gatt_db_handles.h" -#include "stdio.h" -#include "timers.h" - -#if defined(CPU_JN518X) && defined(chip_with_low_power) && (chip_with_low_power == 1) -#include "PWR_Configuration.h" -#endif - -#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING -#include -#include -#endif - -/******************************************************************************* - * Local data types - *******************************************************************************/ -extern "C" bool_t Ble_ConfigureHostStackConfig(void); - -#if defined(chip_with_low_power) && (chip_with_low_power == 1) -extern "C" void PWR_DisallowDeviceToSleep(void); -extern "C" void PWR_AllowDeviceToSleep(void); -#endif - -using namespace ::chip; -using namespace ::chip::Ble; - -namespace chip { -namespace DeviceLayer { -namespace Internal { - -namespace { -/******************************************************************************* - * Macros & Constants definitions - *******************************************************************************/ -/* Timeout of BLE commands */ -#define CHIP_BLE_KW_EVNT_TIMEOUT 1000 / portTICK_PERIOD_MS - -/** BLE advertisement state changed */ -#define CHIP_BLE_KW_EVNT_ADV_CHANGED 0x0001 -/** BLE advertisement command failed */ -#define CHIP_BLE_KW_EVNT_ADV_FAILED 0x0002 -/** BLE advertisement setup failed */ -#define CHIP_BLE_KW_EVNT_ADV_SETUP_FAILED 0x0004 -/** BLE advertisement parameters setup complete */ -#define CHIP_BLE_KW_EVNT_ADV_PAR_SETUP_COMPLETE 0x0008 -/** BLE advertisement data setup complete */ -#define CHIP_BLE_KW_EVNT_ADV_DAT_SETUP_COMPLETE 0x0010 -/** BLE random address set */ -#define CHIP_BLE_KW_EVNT_RND_ADDR_SET 0x0020 -/** BLE Initialization complete */ -#define CHIP_BLE_KW_EVNT_INIT_COMPLETE 0x0040 -/** BLE Received a handle value confirmation from the client */ -#define CHIP_BLE_KW_EVNT_INDICATION_CONFIRMED 0x0080 -/** BLE send indication failed */ -#define CHIP_BLE_KW_EVNT_INDICATION_FAILED 0x0100 -/** TX Power Level Set */ -#define CHIP_BLE_KW_EVNT_POWER_LEVEL_SET 0x0200 -/** Maximal time of connection without activity */ -#define CHIP_BLE_KW_CONN_TIMEOUT 60000 -/** Maximum number of pending BLE events */ -#define CHIP_BLE_EVENT_QUEUE_MAX_ENTRIES 10 - -#define LOOP_EV_BLE (0x08) - -/* controller task configuration */ -#define CONTROLLER_TASK_PRIORITY (6U) -#define CONTROLLER_TASK_STACK_SIZE (gControllerTaskStackSize_c / sizeof(StackType_t)) - -/* host task configuration */ -#define HOST_TASK_PRIORITY (4U) -#define HOST_TASK_STACK_SIZE (gHost_TaskStackSize_c / sizeof(StackType_t)) - -/* advertising configuration */ -#define BLEKW_ADV_MAX_NO (2) -#define BLEKW_SCAN_RSP_MAX_NO (2) -#define BLEKW_MAX_ADV_DATA_LEN (31) -#define CHIP_ADV_SHORT_UUID_LEN (2) - -/* FreeRTOS sw timer */ -TimerHandle_t sbleAdvTimeoutTimer; - -/* Queue used to synchronize asynchronous messages from the KW BLE tasks */ -QueueHandle_t sBleEventQueue; - -/* Used to manage asynchronous events from BLE Stack: e.g.: GAP setup finished */ -EventGroupHandle_t sEventGroup; - -TimerHandle_t connectionTimeout; - -const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF }; - -#if defined(chip_with_low_power) && (chip_with_low_power == 1) -static bool bleAppStopInProgress; -#endif - -BLEManagerCommon * sImplInstance = nullptr; - -} // namespace - -CHIP_ERROR BLEManagerCommon::_Init() -{ - CHIP_ERROR err = CHIP_NO_ERROR; - EventBits_t eventBits; - uint16_t attChipRxHandle[1] = { (uint16_t) value_chipoble_rx }; - -#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING - uint16_t attChipC3Handle[1] = { (uint16_t) value_chipoble_c3 }; -#endif - - mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Enabled; - - // Check if BLE stack is initialized - VerifyOrExit(!mFlags.Has(Flags::kK32WBLEStackInitialized), err = CHIP_ERROR_INCORRECT_STATE); - - // Initialize the Chip BleLayer. - err = BleLayer::Init(this, this, &DeviceLayer::SystemLayer()); - SuccessOrExit(err); - - /* Initialization of message wait events - - * used for receiving BLE Stack events */ - sEventGroup = xEventGroupCreate(); - VerifyOrExit(sEventGroup != NULL, err = CHIP_ERROR_INCORRECT_STATE); - - /* Prepare callback input queue.*/ - sBleEventQueue = xQueueCreate(CHIP_BLE_EVENT_QUEUE_MAX_ENTRIES, sizeof(blekw_msg_t *)); - VerifyOrExit(sBleEventQueue != NULL, err = CHIP_ERROR_INCORRECT_STATE); - - /* Create the connection timeout timer. */ - connectionTimeout = - xTimerCreate("bleTimeoutTmr", pdMS_TO_TICKS(CHIP_BLE_KW_CONN_TIMEOUT), pdFALSE, (void *) 0, blekw_connection_timeout_cb); - VerifyOrExit(connectionTimeout != NULL, err = CHIP_ERROR_INCORRECT_STATE); - - sImplInstance = GetImplInstance(); - - /* BLE platform code initialization */ - SuccessOrExit(err = InitHostController(&blekw_generic_cb)); - - /* Register the GATT server callback */ - VerifyOrExit(GattServer_RegisterCallback(blekw_gatt_server_cb) == gBleSuccess_c, err = CHIP_ERROR_INCORRECT_STATE); - - /* Wait until BLE Stack is ready */ - eventBits = xEventGroupWaitBits(sEventGroup, CHIP_BLE_KW_EVNT_INIT_COMPLETE, pdTRUE, pdTRUE, CHIP_BLE_KW_EVNT_TIMEOUT); - VerifyOrExit(eventBits & CHIP_BLE_KW_EVNT_INIT_COMPLETE, err = CHIP_ERROR_INCORRECT_STATE); - -#if BLE_HIGH_TX_POWER - /* Set Adv Power */ - Gap_SetTxPowerLevel(gAdvertisingPowerLeveldBm_c, gTxPowerAdvChannel_c); - eventBits = xEventGroupWaitBits(sEventGroup, CHIP_BLE_KW_EVNT_POWER_LEVEL_SET, pdTRUE, pdTRUE, CHIP_BLE_KW_EVNT_TIMEOUT); - VerifyOrExit(eventBits & CHIP_BLE_KW_EVNT_POWER_LEVEL_SET, err = CHIP_ERROR_INCORRECT_STATE); - - /* Set Connect Power */ - Gap_SetTxPowerLevel(gConnectPowerLeveldBm_c, gTxPowerConnChannel_c); - eventBits = xEventGroupWaitBits(sEventGroup, CHIP_BLE_KW_EVNT_POWER_LEVEL_SET, pdTRUE, pdTRUE, CHIP_BLE_KW_EVNT_TIMEOUT); - VerifyOrExit(eventBits & CHIP_BLE_KW_EVNT_POWER_LEVEL_SET, err = CHIP_ERROR_INCORRECT_STATE); -#endif - -#if defined(CPU_JN518X) && defined(chip_with_low_power) && (chip_with_low_power == 1) - PWR_ChangeDeepSleepMode(cPWR_PowerDown_RamRet); -#endif - - GattServer_RegisterHandlesForWriteNotifications(1, attChipRxHandle); -#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING - VerifyOrExit(GattServer_RegisterHandlesForReadNotifications(1, attChipC3Handle) == gBleSuccess_c, - err = CHIP_ERROR_INCORRECT_STATE); -#endif - - mFlags.Set(Flags::kK32WBLEStackInitialized); - mFlags.Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART ? true : false); - mFlags.Set(Flags::kFastAdvertisingEnabled); - - // Create FreeRTOS sw timer for BLE timeouts and interval change. - sbleAdvTimeoutTimer = xTimerCreate("BleAdvTimer", // Just a text name, not used by the RTOS kernel - pdMS_TO_TICKS(100), // == default timer period (mS) - false, // no timer reload (==one-shot) - (void *) this, // init timer id = ble obj context - BleAdvTimeoutHandler // timer callback handler - ); - VerifyOrExit(sbleAdvTimeoutTimer != NULL, err = CHIP_ERROR_INCORRECT_STATE); - -exit: - return err; -} - -uint16_t BLEManagerCommon::_NumConnections(void) -{ - return static_cast(mDeviceConnected == true); -} - -bool BLEManagerCommon::_IsAdvertisingEnabled(void) -{ - return mFlags.Has(Flags::kAdvertisingEnabled); -} - -bool BLEManagerCommon::_IsAdvertising(void) -{ - return mFlags.Has(Flags::kAdvertising); -} - -CHIP_ERROR BLEManagerCommon::_SetAdvertisingEnabled(bool val) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - VerifyOrExit(mServiceMode != ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE); - - if (mFlags.Has(Flags::kAdvertisingEnabled) != val) - { - mFlags.Set(Flags::kAdvertisingEnabled, val); - PlatformMgr().ScheduleWork(DriveBLEState, 0); - } - -exit: - return err; -} - -CHIP_ERROR BLEManagerCommon::_SetAdvertisingMode(BLEAdvertisingMode mode) -{ - switch (mode) - { - case BLEAdvertisingMode::kFastAdvertising: - mFlags.Set(Flags::kFastAdvertisingEnabled); - break; - case BLEAdvertisingMode::kSlowAdvertising: { - // We are in FreeRTOS timer service context, which is a default daemon task and has - // the highest priority. Stop advertising should be scheduled to run from Matter task. - mFlags.Clear(Flags::kFastAdvertisingEnabled); - PlatformMgr().ScheduleWork(StopAdvertisingPriorToSwitchingMode, 0); - break; - } - default: - return CHIP_ERROR_INVALID_ARGUMENT; - } - mFlags.Set(Flags::kRestartAdvertising); - PlatformMgr().ScheduleWork(DriveBLEState, 0); - return CHIP_NO_ERROR; -} - -CHIP_ERROR BLEManagerCommon::_GetDeviceName(char * buf, size_t bufSize) -{ - if (strlen(mDeviceName) >= bufSize) - { - return CHIP_ERROR_BUFFER_TOO_SMALL; - } - strcpy(buf, mDeviceName); - return CHIP_NO_ERROR; -} - -CHIP_ERROR BLEManagerCommon::_SetDeviceName(const char * deviceName) -{ - if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_NotSupported) - { - return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; - } - if (deviceName != NULL && deviceName[0] != 0) - { - if (strlen(deviceName) >= kMaxDeviceNameLength) - { - return CHIP_ERROR_INVALID_ARGUMENT; - } - memset(mDeviceName, 0, kMaxDeviceNameLength); - strcpy(mDeviceName, deviceName); - mFlags.Set(Flags::kDeviceNameSet); - ChipLogProgress(DeviceLayer, "Setting device name to : \"%s\"", deviceName); - } - else - { - mDeviceName[0] = 0; - mFlags.Clear(Flags::kDeviceNameSet); - } - - return CHIP_NO_ERROR; -} - -void BLEManagerCommon::_OnPlatformEvent(const ChipDeviceEvent * event) -{ - switch (event->Type) - { - case DeviceEventType::kCHIPoBLESubscribe: - ChipDeviceEvent connEstEvent; - - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); - connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; - PlatformMgr().PostEventOrDie(&connEstEvent); - break; - - case DeviceEventType::kCHIPoBLEUnsubscribe: - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); - break; - - case DeviceEventType::kCHIPoBLEWriteReceived: - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_1_UUID, - PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); - break; - - case DeviceEventType::kCHIPoBLEConnectionError: - HandleConnectionError(event->CHIPoBLEConnectionError.ConId, event->CHIPoBLEConnectionError.Reason); - break; - - case DeviceEventType::kCHIPoBLEIndicateConfirm: - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &Ble::CHIP_BLE_CHAR_2_UUID); - break; - - default: - break; - } -} - -CHIP_ERROR BLEManagerCommon::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, - const ChipBleUUID * charId) -{ - ChipLogProgress(DeviceLayer, "BLEManagerCommon::SubscribeCharacteristic() not supported"); - return CHIP_ERROR_NOT_IMPLEMENTED; -} - -CHIP_ERROR BLEManagerCommon::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, - const ChipBleUUID * charId) -{ - ChipLogProgress(DeviceLayer, "BLEManagerCommon::UnsubscribeCharacteristic() not supported"); - return CHIP_ERROR_NOT_IMPLEMENTED; -} - -CHIP_ERROR BLEManagerCommon::CloseConnection(BLE_CONNECTION_OBJECT conId) -{ - return blekw_stop_connection_internal(conId); -} - -uint16_t BLEManagerCommon::GetMTU(BLE_CONNECTION_OBJECT conId) const -{ - uint16_t tempMtu = 0; - (void) Gatt_GetMtu(conId, &tempMtu); - - return tempMtu; -} - -CHIP_ERROR BLEManagerCommon::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) -{ - ChipLogProgress(DeviceLayer, "BLEManagerCommon::SendWriteRequest() not supported"); - return CHIP_ERROR_NOT_IMPLEMENTED; -} - -void BLEManagerCommon::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) -{ - BLEMgrImpl().CloseConnection(conId); -} - -CHIP_ERROR BLEManagerCommon::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle data) -{ - VerifyOrReturnError(UUIDsMatch(&Ble::CHIP_BLE_CHAR_2_UUID, charId), BLE_ERROR_GATT_WRITE_FAILED); - - CHIP_ERROR err = CHIP_NO_ERROR; - - if (blekw_send_event(conId, value_chipoble_tx, data->Start(), data->DataLength()) != BLE_OK) - { - err = CHIP_ERROR_SENDING_BLOCKED; - } - else - { - ChipDeviceEvent event; - event.Type = DeviceEventType::kCHIPoBLEIndicateConfirm; - event.CHIPoBLEIndicateConfirm.ConId = conId; - err = PlatformMgr().PostEvent(&event); - } - - return err; -} - -BLEManagerCommon::ble_err_t BLEManagerCommon::blekw_send_event(int8_t connection_handle, uint16_t handle, uint8_t * data, - uint32_t len) -{ - EventBits_t eventBits; - -#if CHIP_DEVICE_CHIP0BLE_DEBUG - ChipLogProgress(DeviceLayer, "Trying to send event."); -#endif - - if (connection_handle < 0 || handle <= 0) - { - ChipLogProgress(DeviceLayer, "BLE Event - Bad Handle"); - return BLE_E_FAIL; - } - - if (len > 0 && data == NULL) - { - ChipLogProgress(DeviceLayer, "BLE Event - Invalid Data"); - return BLE_E_FAIL; - } - - /************* Send the indication *************/ - xEventGroupClearBits(sEventGroup, CHIP_BLE_KW_EVNT_INDICATION_CONFIRMED | CHIP_BLE_KW_EVNT_INDICATION_FAILED); - - if (GattServer_SendInstantValueIndication(connection_handle, handle, len, data) != gBleSuccess_c) - { - ChipLogProgress(DeviceLayer, "BLE Event - Can't sent indication"); - return BLE_E_FAIL; - } - - /* Wait until BLE Stack is ready */ - eventBits = xEventGroupWaitBits(sEventGroup, CHIP_BLE_KW_EVNT_INDICATION_CONFIRMED | CHIP_BLE_KW_EVNT_INDICATION_FAILED, pdTRUE, - pdFALSE, CHIP_BLE_KW_EVNT_TIMEOUT); - - if (eventBits & CHIP_BLE_KW_EVNT_INDICATION_FAILED) - { - ChipLogProgress(DeviceLayer, "BLE Event - Sent Failed"); - return BLE_E_FAIL; - } - -#if CHIP_DEVICE_CHIP0BLE_DEBUG - ChipLogProgress(DeviceLayer, "BLE Event - Sent :-) "); -#endif - - return BLE_OK; -} -/******************************************************************************* - * Private functions - *******************************************************************************/ - -BLEManagerCommon::ble_err_t BLEManagerCommon::blekw_start_advertising(gapAdvertisingParameters_t * adv_params, - gapAdvertisingData_t * adv, gapScanResponseData_t * scnrsp) -{ - EventBits_t eventBits; - - /************* Set the advertising parameters *************/ - xEventGroupClearBits(sEventGroup, CHIP_BLE_KW_EVNT_ADV_SETUP_FAILED | CHIP_BLE_KW_EVNT_ADV_PAR_SETUP_COMPLETE); - - /* Set the advertising parameters */ - if (Gap_SetAdvertisingParameters(adv_params) != gBleSuccess_c) - { - vTaskDelay(1); - - /* Retry, just to make sure before giving up and sending an error. */ - if (Gap_SetAdvertisingParameters(adv_params) != gBleSuccess_c) - { - return BLE_E_SET_ADV_PARAMS; - } - } - - eventBits = xEventGroupWaitBits(sEventGroup, CHIP_BLE_KW_EVNT_ADV_SETUP_FAILED | CHIP_BLE_KW_EVNT_ADV_PAR_SETUP_COMPLETE, - pdTRUE, pdFALSE, CHIP_BLE_KW_EVNT_TIMEOUT); - - if (!(eventBits & CHIP_BLE_KW_EVNT_ADV_PAR_SETUP_COMPLETE)) - { - return BLE_E_ADV_PARAMS_FAILED; - } - - /************* Set the advertising data *************/ - xEventGroupClearBits(sEventGroup, CHIP_BLE_KW_EVNT_ADV_SETUP_FAILED | CHIP_BLE_KW_EVNT_ADV_DAT_SETUP_COMPLETE); - - /* Set the advertising data */ - if (Gap_SetAdvertisingData(adv, scnrsp) != gBleSuccess_c) - { - return BLE_E_SET_ADV_DATA; - } - - eventBits = xEventGroupWaitBits(sEventGroup, CHIP_BLE_KW_EVNT_ADV_SETUP_FAILED | CHIP_BLE_KW_EVNT_ADV_DAT_SETUP_COMPLETE, - pdTRUE, pdFALSE, CHIP_BLE_KW_EVNT_TIMEOUT); - - if (!(eventBits & CHIP_BLE_KW_EVNT_ADV_DAT_SETUP_COMPLETE)) - { - return BLE_E_ADV_SETUP_FAILED; - } - - /************* Start the advertising *************/ - xEventGroupClearBits(sEventGroup, CHIP_BLE_KW_EVNT_ADV_CHANGED | CHIP_BLE_KW_EVNT_ADV_FAILED); - - if (gBleSuccess_c != Gap_CreateRandomDeviceAddress(NULL, NULL)) - { - return BLE_E_SET_ADV_PARAMS; - } - - eventBits = xEventGroupWaitBits(sEventGroup, CHIP_BLE_KW_EVNT_RND_ADDR_SET, pdTRUE, pdTRUE, CHIP_BLE_KW_EVNT_TIMEOUT); - - if (!(eventBits & CHIP_BLE_KW_EVNT_RND_ADDR_SET)) - { - return BLE_E_ADV_PARAMS_FAILED; - } - - /* Start the advertising */ - if (Gap_StartAdvertising(blekw_gap_advertising_cb, blekw_gap_connection_cb) != gBleSuccess_c) - { - return BLE_E_START_ADV; - } - -#if defined(chip_with_low_power) && (chip_with_low_power == 1) - PWR_DisallowDeviceToSleep(); -#endif - - eventBits = xEventGroupWaitBits(sEventGroup, CHIP_BLE_KW_EVNT_ADV_CHANGED | CHIP_BLE_KW_EVNT_ADV_FAILED, pdTRUE, pdFALSE, - CHIP_BLE_KW_EVNT_TIMEOUT); - if (!(eventBits & CHIP_BLE_KW_EVNT_ADV_CHANGED)) - { -#if defined(chip_with_low_power) && (chip_with_low_power == 1) - PWR_AllowDeviceToSleep(); -#endif - return BLE_E_START_ADV_FAILED; - } - -#if defined(chip_with_low_power) && (chip_with_low_power == 1) - PWR_AllowDeviceToSleep(); -#endif - - return BLE_OK; -} - -BLEManagerCommon::ble_err_t BLEManagerCommon::blekw_stop_advertising(void) -{ - EventBits_t eventBits; - bleResult_t res; - - xEventGroupClearBits(sEventGroup, CHIP_BLE_KW_EVNT_ADV_CHANGED | CHIP_BLE_KW_EVNT_ADV_FAILED); - - /* Stop the advertising data */ - res = Gap_StopAdvertising(); - if (res != gBleSuccess_c) - { - ChipLogProgress(DeviceLayer, "Failed to stop advertising %d", res); - return BLE_E_STOP; - } - - eventBits = xEventGroupWaitBits(sEventGroup, CHIP_BLE_KW_EVNT_ADV_CHANGED | CHIP_BLE_KW_EVNT_ADV_FAILED, pdTRUE, pdFALSE, - CHIP_BLE_KW_EVNT_TIMEOUT); - - if (eventBits & CHIP_BLE_KW_EVNT_ADV_FAILED) - { - ChipLogProgress(DeviceLayer, "Stop advertising flat out failed."); - return BLE_E_ADV_FAILED; - } - else if (!(eventBits & CHIP_BLE_KW_EVNT_ADV_CHANGED)) - { - ChipLogProgress(DeviceLayer, "Stop advertising event timeout."); - return BLE_E_ADV_CHANGED; - } - - return BLE_OK; -} - -CHIP_ERROR BLEManagerCommon::ConfigureAdvertisingData(void) -{ - ble_err_t err; - CHIP_ERROR chipErr; - uint16_t discriminator; - uint16_t advInterval = 0; - gapAdvertisingData_t adv = { 0 }; - gapAdStructure_t adv_data[BLEKW_ADV_MAX_NO] = { { 0 } }; - gapAdStructure_t scan_rsp_data[BLEKW_SCAN_RSP_MAX_NO] = { { 0 } }; - uint8_t advPayload[BLEKW_MAX_ADV_DATA_LEN] = { 0 }; - gapScanResponseData_t scanRsp = { 0 }; - gapAdvertisingParameters_t adv_params = { 0 }; - uint8_t chipAdvDataFlags = (gLeGeneralDiscoverableMode_c | gBrEdrNotSupported_c); - uint8_t chipOverBleService[2]; - ChipBLEDeviceIdentificationInfo mDeviceIdInfo = { 0 }; - uint8_t mDeviceIdInfoLength = 0; - - chipErr = GetCommissionableDataProvider()->GetSetupDiscriminator(discriminator); - if (chipErr != CHIP_NO_ERROR) - { - return chipErr; - } - - if (!mFlags.Has(Flags::kDeviceNameSet)) - { - memset(mDeviceName, 0, kMaxDeviceNameLength); - snprintf(mDeviceName, kMaxDeviceNameLength, "%s%04u", CHIP_DEVICE_CONFIG_BLE_DEVICE_NAME_PREFIX, discriminator); - } - - /**************** Prepare advertising data *******************************************/ - adv.cNumAdStructures = BLEKW_ADV_MAX_NO; - - chipErr = ConfigurationMgr().GetBLEDeviceIdentificationInfo(mDeviceIdInfo); - SuccessOrExit(chipErr); - mDeviceIdInfoLength = sizeof(mDeviceIdInfo); - - if ((mDeviceIdInfoLength + CHIP_ADV_SHORT_UUID_LEN + 1) > BLEKW_MAX_ADV_DATA_LEN) - { - return CHIP_ERROR_INCORRECT_STATE; - } - - adv_data[0].length = 0x02; - adv_data[0].adType = gAdFlags_c; - adv_data[0].aData = (uint8_t *) (&chipAdvDataFlags); - - adv_data[1].length = static_cast(mDeviceIdInfoLength + CHIP_ADV_SHORT_UUID_LEN + 1); - adv_data[1].adType = gAdServiceData16bit_c; - memcpy(advPayload, ShortUUID_CHIPoBLEService, CHIP_ADV_SHORT_UUID_LEN); - memcpy(&advPayload[CHIP_ADV_SHORT_UUID_LEN], (void *) &mDeviceIdInfo, mDeviceIdInfoLength); - adv_data[1].aData = advPayload; - - adv.aAdStructures = adv_data; - -#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING - ReturnErrorOnFailure(EncodeAdditionalDataTlv()); -#endif - - /**************** Prepare scan response data *******************************************/ - scanRsp.cNumAdStructures = BLEKW_SCAN_RSP_MAX_NO; - - scan_rsp_data[0].length = static_cast(strlen(mDeviceName) + 1); - scan_rsp_data[0].adType = gAdCompleteLocalName_c; - scan_rsp_data[0].aData = (uint8_t *) mDeviceName; - - scan_rsp_data[1].length = sizeof(chipOverBleService) + 1; - scan_rsp_data[1].adType = gAdComplete16bitServiceList_c; - chipOverBleService[0] = ShortUUID_CHIPoBLEService[0]; - chipOverBleService[1] = ShortUUID_CHIPoBLEService[1]; - scan_rsp_data[1].aData = (uint8_t *) chipOverBleService; - - scanRsp.aAdStructures = scan_rsp_data; - - /**************** Prepare advertising parameters *************************************/ - if (mFlags.Has(Flags::kFastAdvertisingEnabled)) - { - advInterval = CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL_MAX; - } - else - { - advInterval = CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL_MAX; - } - advInterval = (uint16_t) (advInterval * 0.625F); - - adv_params.minInterval = adv_params.maxInterval = advInterval; - adv_params.advertisingType = gAdvConnectableUndirected_c; - adv_params.ownAddressType = gBleAddrTypeRandom_c; - adv_params.peerAddressType = gBleAddrTypePublic_c; - memset(adv_params.peerAddress, 0, gcBleDeviceAddressSize_c); - adv_params.channelMap = (gapAdvertisingChannelMapFlags_t) (gAdvChanMapFlag37_c | gAdvChanMapFlag38_c | gAdvChanMapFlag39_c); - adv_params.filterPolicy = gProcessAll_c; - - err = blekw_start_advertising(&adv_params, &adv, &scanRsp); - if (err == BLE_OK) - { - ChipLogProgress(DeviceLayer, "Started Advertising at %d ms", advInterval); - } - else - { - ChipLogProgress(DeviceLayer, "Advertising error 0x%x!", err); - mFlags.Clear(Flags::kAdvertising); - return CHIP_ERROR_INCORRECT_STATE; - } - -exit: - return chipErr; -} - -#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING -CHIP_ERROR BLEManagerCommon::EncodeAdditionalDataTlv() -{ - CHIP_ERROR err = CHIP_NO_ERROR; - BitFlags dataFields; - AdditionalDataPayloadGeneratorParams params; - -#if CHIP_ENABLE_ROTATING_DEVICE_ID && defined(CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID) - uint8_t rotatingDeviceIdUniqueId[ConfigurationManager::kRotatingDeviceIDUniqueIDLength] = {}; - MutableByteSpan rotatingDeviceIdUniqueIdSpan(rotatingDeviceIdUniqueId); - - err = DeviceLayer::GetDeviceInstanceInfoProvider()->GetRotatingDeviceIdUniqueId(rotatingDeviceIdUniqueIdSpan); - SuccessOrExit(err); - err = ConfigurationMgr().GetLifetimeCounter(params.rotatingDeviceIdLifetimeCounter); - SuccessOrExit(err); - params.rotatingDeviceIdUniqueId = rotatingDeviceIdUniqueIdSpan; - dataFields.Set(AdditionalDataFields::RotatingDeviceId); -#endif /* CHIP_ENABLE_ROTATING_DEVICE_ID && defined(CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID) */ - err = AdditionalDataPayloadGenerator().generateAdditionalDataPayload(params, sImplInstance->c3AdditionalDataBufferHandle, - dataFields); - -exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "Failed to generate TLV encoded Additional Data (%s)", __func__); - } - - return err; -} - -void BLEManagerCommon::HandleC3ReadRequest(blekw_msg_t * msg) -{ - bleResult_t result; - blekw_att_read_data_t * att_rd_data = (blekw_att_read_data_t *) msg->data.data; - deviceId_t deviceId = att_rd_data->device_id; - uint16_t handle = att_rd_data->handle; - uint16_t length = sImplInstance->c3AdditionalDataBufferHandle->DataLength(); - const uint8_t * data = (const uint8_t *) sImplInstance->c3AdditionalDataBufferHandle->Start(); - - result = GattDb_WriteAttribute(handle, length, data); - if (result != gBleSuccess_c) - { - ChipLogError(DeviceLayer, "Failed to write C3 characteristic: %d", result); - } - - result = GattServer_SendAttributeReadStatus(deviceId, handle, gAttErrCodeNoError_c); - if (result != gBleSuccess_c) - { - ChipLogError(DeviceLayer, "Failed to send response to C3 read request: %d", result); - } -} -#endif /* CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING */ - -CHIP_ERROR BLEManagerCommon::StartAdvertising(void) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - mFlags.Set(Flags::kAdvertising); - mFlags.Clear(Flags::kRestartAdvertising); - - if (mFlags.Has(Flags::kFastAdvertisingEnabled)) - { - StartBleAdvTimeoutTimer(CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_TIMEOUT); - } - - err = ConfigureAdvertisingData(); - - if (err == CHIP_NO_ERROR) - /* schedule NFC emulation stop */ - { - ChipDeviceEvent advChange; - advChange.Type = DeviceEventType::kCHIPoBLEAdvertisingChange; - advChange.CHIPoBLEAdvertisingChange.Result = kActivity_Started; - err = PlatformMgr().PostEvent(&advChange); - } - - return err; -} - -CHIP_ERROR BLEManagerCommon::StopAdvertising(void) -{ - CHIP_ERROR error = CHIP_NO_ERROR; - - if (mFlags.Has(Flags::kAdvertising)) - { - mFlags.Clear(Flags::kAdvertising); - mFlags.Clear(Flags::kRestartAdvertising); - - if (!mDeviceConnected) - { - ble_err_t err = blekw_stop_advertising(); - VerifyOrReturnError(err == BLE_OK, CHIP_ERROR_INCORRECT_STATE); - CancelBleAdvTimeoutTimer(); - } - -#if CONFIG_CHIP_NFC_COMMISSIONING - /* schedule NFC emulation stop */ - ChipDeviceEvent advChange; - advChange.Type = DeviceEventType::kCHIPoBLEAdvertisingChange; - advChange.CHIPoBLEAdvertisingChange.Result = kActivity_Stopped; - error = PlatformMgr().PostEvent(&advChange); -#endif - } - - return error; -} - -void BLEManagerCommon::DriveBLEState(void) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - // Check if BLE stack is initialized - VerifyOrExit(mFlags.Has(Flags::kK32WBLEStackInitialized), err = CHIP_ERROR_INCORRECT_STATE); - - // Start advertising if needed... - if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && mFlags.Has(Flags::kAdvertisingEnabled)) - { - // Start/re-start advertising if not already started, or if there is a pending change - // to the advertising configuration. - if (!mFlags.Has(Flags::kAdvertising) || mFlags.Has(Flags::kRestartAdvertising)) - { - err = StartAdvertising(); - SuccessOrExit(err); - } - } - // Otherwise, stop advertising if it is enabled. - else if (mFlags.Has(Flags::kAdvertising)) - { - err = StopAdvertising(); - SuccessOrExit(err); - // Reset to fast advertising mode only if SetBLEAdvertisingEnabled(false) was called (usually from app). - mFlags.Set(Flags::kFastAdvertisingEnabled); - } - -exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "Disabling CHIPoBLE service due to error: %s", ErrorStr(err)); - mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Disabled; - } -} - -void BLEManagerCommon::DriveBLEState(intptr_t arg) -{ - sImplInstance->DriveBLEState(); -} - -void BLEManagerCommon::StopAdvertisingPriorToSwitchingMode(intptr_t arg) -{ - if (CHIP_NO_ERROR != sImplInstance->StopAdvertising()) - { - ChipLogProgress(DeviceLayer, "Failed to stop advertising"); - } -} - -void BLEManagerCommon::DoBleProcessing(void) -{ - blekw_msg_t * msg = NULL; - - while ((xQueueReceive(sBleEventQueue, &msg, 0) == pdTRUE) && msg) - { - if (msg->type == BLE_KW_MSG_ERROR) - { - if (msg->data.u8 == BLE_KW_MSG_2M_UPGRADE_ERROR) - { - ChipLogProgress(DeviceLayer, - "Warning. BLE is using 1Mbps. Couldn't upgrade to 2Mbps, " - "maybe the peer is missing 2Mbps support."); - } - else - { - ChipLogProgress(DeviceLayer, "BLE Error: %d.\n", msg->data.u8); - } - } - else if (msg->type == BLE_KW_MSG_CONNECTED) - { - sImplInstance->HandleConnectEvent(msg); - } - else if (msg->type == BLE_KW_MSG_DISCONNECTED) - { - sImplInstance->HandleConnectionCloseEvent(msg); - } - else if (msg->type == BLE_KW_MSG_MTU_CHANGED) - { - blekw_start_connection_timeout(); - ChipLogProgress(DeviceLayer, "BLE MTU size has been changed to %d.", msg->data.u16); - } - else if (msg->type == BLE_KW_MSG_ATT_WRITTEN || msg->type == BLE_KW_MSG_ATT_LONG_WRITTEN || - msg->type == BLE_KW_MSG_ATT_CCCD_WRITTEN) - { - sImplInstance->HandleWriteEvent(msg); - } - else if (msg->type == BLE_KW_MSG_ATT_READ) - { -#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING - blekw_att_read_data_t * att_rd_data = (blekw_att_read_data_t *) msg->data.data; - if (value_chipoble_c3 == att_rd_data->handle) - sImplInstance->HandleC3ReadRequest(msg); -#endif - } - else if (msg->type == BLE_KW_MSG_FORCE_DISCONNECT) - { - sImplInstance->HandleForceDisconnect(); - } - - /* Free the message from the queue */ - free(msg); - msg = NULL; - } -} - -void BLEManagerCommon::RegisterAppCallbacks(BLECallbackDelegate::GapGenericCallback gapCallback, - BLECallbackDelegate::GattServerCallback gattCallback) -{ - callbackDelegate.gapCallback = gapCallback; - callbackDelegate.gattCallback = gattCallback; -} - -void BLEManagerCommon::HandleConnectEvent(blekw_msg_t * msg) -{ - uint8_t deviceId = msg->data.u8; - ChipLogProgress(DeviceLayer, "BLE is connected with device: %d.\n", deviceId); - -#if gClkUseFro32K && defined(chip_with_low_power) && (chip_with_low_power == 1) - PWR_DisallowDeviceToSleep(); -#endif - - mDeviceId = deviceId; - mDeviceConnected = true; - - blekw_start_connection_timeout(); - PlatformMgr().ScheduleWork(DriveBLEState, 0); -} - -void BLEManagerCommon::HandleConnectionCloseEvent(blekw_msg_t * msg) -{ - uint8_t deviceId = msg->data.u8; - ChipLogProgress(DeviceLayer, "BLE is disconnected with device: %d.\n", deviceId); - -#if gClkUseFro32K && defined(chip_with_low_power) && (chip_with_low_power == 1) - PWR_AllowDeviceToSleep(); -#endif - - mDeviceConnected = false; - - ChipDeviceEvent event; - event.Type = DeviceEventType::kCHIPoBLEConnectionClosed; - event.CHIPoBLEConnectionError.ConId = deviceId; - event.CHIPoBLEConnectionError.Reason = BLE_ERROR_REMOTE_DEVICE_DISCONNECTED; - - CancelBleAdvTimeoutTimer(); - - PlatformMgr().PostEventOrDie(&event); - mFlags.Set(Flags::kRestartAdvertising); - mFlags.Set(Flags::kFastAdvertisingEnabled); - PlatformMgr().ScheduleWork(DriveBLEState, 0); -} - -void BLEManagerCommon::HandleWriteEvent(blekw_msg_t * msg) -{ - blekw_att_written_data_t * att_wr_data = (blekw_att_written_data_t *) msg->data.data; - attErrorCode_t status = gAttErrCodeNoError_c; - -#if CHIP_DEVICE_CHIP0BLE_DEBUG - ChipLogProgress(DeviceLayer, "Attribute write request(device: %d,handle: %d).", att_wr_data->device_id, att_wr_data->handle); -#endif - - blekw_start_connection_timeout(); - - if (value_chipoble_rx == att_wr_data->handle) - { - sImplInstance->HandleRXCharWrite(msg); - } - else if (cccd_chipoble_tx == att_wr_data->handle) - { - sImplInstance->HandleTXCharCCCDWrite(msg); - } - - /* TODO: do we need to send the status also for CCCD_WRITTEN? */ - if (msg->type != BLE_KW_MSG_ATT_CCCD_WRITTEN) - { - bleResult_t res = GattServer_SendAttributeWrittenStatus(att_wr_data->device_id, att_wr_data->handle, status); - - if (res != gBleSuccess_c) - { - ChipLogProgress(DeviceLayer, "GattServer_SendAttributeWrittenStatus returned %d", res); - } - } -} - -void BLEManagerCommon::HandleTXCharCCCDWrite(blekw_msg_t * msg) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - blekw_att_written_data_t * att_wr_data = (blekw_att_written_data_t *) msg->data.data; - ChipDeviceEvent event; - - VerifyOrExit(att_wr_data->length != 0, err = CHIP_ERROR_INCORRECT_STATE); - VerifyOrExit(att_wr_data->data != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - -#if CHIP_DEVICE_CHIP0BLE_DEBUG - ChipLogProgress(DeviceLayer, "CHIPoBLE %s received", *att_wr_data->data ? "subscribe" : "unsubscribe"); -#endif - - if (*att_wr_data->data) - { - if (!mDeviceSubscribed) - { - mDeviceSubscribed = true; - event.Type = DeviceEventType::kCHIPoBLESubscribe; - event.CHIPoBLESubscribe.ConId = att_wr_data->device_id; - err = PlatformMgr().PostEvent(&event); - } - } - else - { - mDeviceSubscribed = false; - event.Type = DeviceEventType::kCHIPoBLEUnsubscribe; - event.CHIPoBLESubscribe.ConId = att_wr_data->device_id; - err = PlatformMgr().PostEvent(&event); - } - -exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "HandleTXCharCCCDWrite() failed: %s", ErrorStr(err)); - } -} - -void BLEManagerCommon::HandleRXCharWrite(blekw_msg_t * msg) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - System::PacketBufferHandle buf; - blekw_att_written_data_t * att_wr_data = (blekw_att_written_data_t *) msg->data.data; - - VerifyOrExit(att_wr_data->length != 0, err = CHIP_ERROR_INCORRECT_STATE); - VerifyOrExit(att_wr_data->data != nullptr, err = CHIP_ERROR_INCORRECT_STATE); - - // Copy the data to a PacketBuffer. - buf = System::PacketBufferHandle::NewWithData(att_wr_data->data, att_wr_data->length); - VerifyOrExit(!buf.IsNull(), err = CHIP_ERROR_NO_MEMORY); - -#if CHIP_DEVICE_CHIP0BLE_DEBUG - ChipLogDetail(DeviceLayer, - "Write request/command received for" - "CHIPoBLE RX characteristic (con %u, len %u)", - att_wr_data->device_id, buf->DataLength()); -#endif - - // Post an event to the CHIP queue to deliver the data into the CHIP stack. - { - ChipDeviceEvent event; - event.Type = DeviceEventType::kCHIPoBLEWriteReceived; - event.CHIPoBLEWriteReceived.ConId = att_wr_data->device_id; - event.CHIPoBLEWriteReceived.Data = std::move(buf).UnsafeRelease(); - err = PlatformMgr().PostEvent(&event); - } -exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "HandleRXCharWrite() failed: %s", ErrorStr(err)); - } -} - -void BLEManagerCommon::HandleForceDisconnect() -{ - ChipLogProgress(DeviceLayer, "BLE connection timeout: Forcing disconnection."); - - /* Set the advertising parameters */ - if (Gap_Disconnect(mDeviceId) != gBleSuccess_c) - { - ChipLogProgress(DeviceLayer, "Gap_Disconnect() failed."); - } - -#if defined(chip_with_low_power) && (chip_with_low_power == 1) - PWR_AllowDeviceToSleep(); -#endif -} - -/******************************************************************************* - * BLE stack callbacks - *******************************************************************************/ -void BLEManagerCommon::blekw_generic_cb(gapGenericEvent_t * pGenericEvent) -{ - /* Call BLE Conn Manager */ - BleConnManager_GenericEvent(pGenericEvent); - - if (sImplInstance && sImplInstance->callbackDelegate.gapCallback) - { - sImplInstance->callbackDelegate.gapCallback(pGenericEvent); - } - - switch (pGenericEvent->eventType) - { - case gInternalError_c: - /* Notify the CHIP that the BLE hardware report fail */ - ChipLogProgress(DeviceLayer, "BLE Internal Error: Code 0x%04X, Source 0x%08X, HCI OpCode %d.\n", - pGenericEvent->eventData.internalError.errorCode, pGenericEvent->eventData.internalError.errorSource, - pGenericEvent->eventData.internalError.hciCommandOpcode); - if ((gHciUnsupportedRemoteFeature_c == pGenericEvent->eventData.internalError.errorCode) && - (gLeSetPhy_c == pGenericEvent->eventData.internalError.errorSource)) - { - (void) blekw_msg_add_u8(BLE_KW_MSG_ERROR, BLE_KW_MSG_2M_UPGRADE_ERROR); - } - else - { - (void) blekw_msg_add_u8(BLE_KW_MSG_ERROR, BLE_INTERNAL_ERROR); - } - break; - - case gAdvertisingSetupFailed_c: - xEventGroupSetBits(sEventGroup, CHIP_BLE_KW_EVNT_ADV_SETUP_FAILED); - break; - - case gAdvertisingParametersSetupComplete_c: - xEventGroupSetBits(sEventGroup, CHIP_BLE_KW_EVNT_ADV_PAR_SETUP_COMPLETE); - break; - - case gAdvertisingDataSetupComplete_c: - xEventGroupSetBits(sEventGroup, CHIP_BLE_KW_EVNT_ADV_DAT_SETUP_COMPLETE); - break; - - case gRandomAddressReady_c: - Gap_SetRandomAddress(pGenericEvent->eventData.addrReady.aAddress); - break; - - case gRandomAddressSet_c: - xEventGroupSetBits(sEventGroup, CHIP_BLE_KW_EVNT_RND_ADDR_SET); - break; - -#if BLE_HIGH_TX_POWER - case gTxPowerLevelSetComplete_c: - if (gBleSuccess_c == pGenericEvent->eventData.txPowerLevelSetStatus) - { - xEventGroupSetBits(sEventGroup, CHIP_BLE_KW_EVNT_POWER_LEVEL_SET); - } - break; -#endif - - case gInitializationComplete_c: - /* Common GAP configuration */ - BleConnManager_GapCommonConfig(); - - /* Set the local synchronization event */ - xEventGroupSetBits(sEventGroup, CHIP_BLE_KW_EVNT_INIT_COMPLETE); - break; - default: - break; - } -} - -void BLEManagerCommon::blekw_gap_advertising_cb(gapAdvertisingEvent_t * pAdvertisingEvent) -{ - if (pAdvertisingEvent->eventType == gAdvertisingStateChanged_c) - { - /* Set the local synchronization event */ - xEventGroupSetBits(sEventGroup, CHIP_BLE_KW_EVNT_ADV_CHANGED); - } - else - { - /* The advertisement start failed */ - ChipLogProgress(DeviceLayer, "Advertising failed: event=%d reason=0x%04X\n", pAdvertisingEvent->eventType, - pAdvertisingEvent->eventData.failReason); - - /* Set the local synchronization event */ - xEventGroupSetBits(sEventGroup, CHIP_BLE_KW_EVNT_ADV_FAILED); - } -} - -void BLEManagerCommon::blekw_gap_connection_cb(deviceId_t deviceId, gapConnectionEvent_t * pConnectionEvent) -{ - /* Call BLE Conn Manager */ - BleConnManager_GapPeripheralEvent(deviceId, pConnectionEvent); - - if (pConnectionEvent->eventType == gConnEvtConnected_c) - { -#if CHIP_DEVICE_K32W1 -#if defined(chip_with_low_power) && (chip_with_low_power == 1) - /* Disallow must be called here for K32W1, otherwise an assert will be reached. - * Disclaimer: this is a workaround until a better cross platform solution is found. */ - PWR_DisallowDeviceToSleep(); -#endif -#endif - -#if CHIP_DEVICE_CONFIG_BLE_SET_PHY_2M_REQ - ChipLogProgress(DeviceLayer, "BLE K32W: Trying to set the PHY to 2M"); - - (void) Gap_LeSetPhy(FALSE, deviceId, 0, gConnPhyUpdateReqTxPhySettings_c, gConnPhyUpdateReqRxPhySettings_c, - (uint16_t) gConnPhyUpdateReqPhyOptions_c); -#endif - - /* Notify App Task that the BLE is connected now */ - (void) blekw_msg_add_u8(BLE_KW_MSG_CONNECTED, (uint8_t) deviceId); -#if defined(chip_with_low_power) && (chip_with_low_power == 1) - PWR_AllowDeviceToSleep(); -#endif - } - else if (pConnectionEvent->eventType == gConnEvtDisconnected_c) - { - blekw_stop_connection_timeout(); - - /* Notify App Task that the BLE is disconnected now */ - (void) blekw_msg_add_u8(BLE_KW_MSG_DISCONNECTED, (uint8_t) deviceId); - -#if defined(chip_with_low_power) && (chip_with_low_power == 1) - if (bleAppStopInProgress == TRUE) - { - bleAppStopInProgress = FALSE; - PWR_AllowDeviceToSleep(); - } -#endif - } - else if (pConnectionEvent->eventType == gConnEvtPairingRequest_c) - { - /* Reject request for pairing */ - Gap_RejectPairing(deviceId, gPairingNotSupported_c); - } - else if (pConnectionEvent->eventType == gConnEvtAuthenticationRejected_c) - { - ChipLogProgress(DeviceLayer, "BLE Authentication rejected (reason:%d).\n", - pConnectionEvent->eventData.authenticationRejectedEvent.rejectReason); - } -} - -void BLEManagerCommon::blekw_connection_timeout_cb(TimerHandle_t timer) -{ - (void) blekw_msg_add_u8(BLE_KW_MSG_FORCE_DISCONNECT, 0); -} - -void BLEManagerCommon::blekw_start_connection_timeout(void) -{ - xTimerReset(connectionTimeout, 0); -} - -void BLEManagerCommon::blekw_stop_connection_timeout(void) -{ - ChipLogProgress(DeviceLayer, "Stopped connectionTimeout timer."); - xTimerStop(connectionTimeout, 0); -} - -void BLEManagerCommon::blekw_gatt_server_cb(deviceId_t deviceId, gattServerEvent_t * pServerEvent) -{ - if (sImplInstance && sImplInstance->callbackDelegate.gattCallback) - { - sImplInstance->callbackDelegate.gattCallback(deviceId, pServerEvent); - } - - switch (pServerEvent->eventType) - { - case gEvtMtuChanged_c: { - uint16_t tempMtu = 0; - - (void) Gatt_GetMtu(deviceId, &tempMtu); - blekw_msg_add_u16(BLE_KW_MSG_MTU_CHANGED, tempMtu); - break; - } - - case gEvtAttributeWritten_c: - blekw_msg_add_att_written(BLE_KW_MSG_ATT_WRITTEN, deviceId, pServerEvent->eventData.attributeWrittenEvent.handle, - pServerEvent->eventData.attributeWrittenEvent.aValue, - pServerEvent->eventData.attributeWrittenEvent.cValueLength); - break; - - case gEvtLongCharacteristicWritten_c: - blekw_msg_add_att_written(BLE_KW_MSG_ATT_LONG_WRITTEN, deviceId, pServerEvent->eventData.longCharWrittenEvent.handle, - pServerEvent->eventData.longCharWrittenEvent.aValue, - pServerEvent->eventData.longCharWrittenEvent.cValueLength); - break; - - case gEvtAttributeRead_c: - blekw_msg_add_att_read(BLE_KW_MSG_ATT_READ, deviceId, pServerEvent->eventData.attributeReadEvent.handle); - break; - - case gEvtCharacteristicCccdWritten_c: { - uint16_t cccd_val = pServerEvent->eventData.charCccdWrittenEvent.newCccd; - - blekw_msg_add_att_written(BLE_KW_MSG_ATT_CCCD_WRITTEN, deviceId, pServerEvent->eventData.charCccdWrittenEvent.handle, - (uint8_t *) &cccd_val, 2); - break; - } - - case gEvtHandleValueConfirmation_c: - /* Set the local synchronization event */ - xEventGroupSetBits(sEventGroup, CHIP_BLE_KW_EVNT_INDICATION_CONFIRMED); - break; - - case gEvtError_c: - if (pServerEvent->eventData.procedureError.procedureType == gSendIndication_c) - { - /* Set the local synchronization event */ - xEventGroupSetBits(sEventGroup, CHIP_BLE_KW_EVNT_INDICATION_FAILED); - } - else - { - ChipLogProgress(DeviceLayer, "BLE Gatt Server Error: Code 0x%04X, Source %d.\n", - pServerEvent->eventData.procedureError.error, pServerEvent->eventData.procedureError.procedureType); - - /* Notify CHIP BLE App Task that the BLE hardware report fail */ - (void) blekw_msg_add_u8(BLE_KW_MSG_ERROR, BLE_INTERNAL_GATT_ERROR); - } - break; - - default: - break; - } -} -/******************************************************************************* - * Add to message queue functions - *******************************************************************************/ -CHIP_ERROR BLEManagerCommon::blekw_msg_add_att_written(blekw_msg_type_t type, uint8_t device_id, uint16_t handle, uint8_t * data, - uint16_t length) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - blekw_msg_t * msg = NULL; - blekw_att_written_data_t * att_wr_data; - - /* Allocate a buffer with enough space to store the packet */ - msg = (blekw_msg_t *) malloc(sizeof(blekw_msg_t) + sizeof(blekw_att_written_data_t) + length); - VerifyOrExit(msg, err = CHIP_ERROR_NO_MEMORY); - - msg->type = type; - msg->length = sizeof(blekw_att_written_data_t) + length; - att_wr_data = (blekw_att_written_data_t *) msg->data.data; - att_wr_data->device_id = device_id; - att_wr_data->handle = handle; - att_wr_data->length = length; - FLib_MemCpy(att_wr_data->data, data, length); - - VerifyOrExit(xQueueSend(sBleEventQueue, &msg, 0) == pdTRUE, err = CHIP_ERROR_NO_MEMORY); - otTaskletsSignalPending(NULL); - -exit: - return err; -} - -CHIP_ERROR BLEManagerCommon::blekw_msg_add_att_read(blekw_msg_type_t type, uint8_t device_id, uint16_t handle) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - blekw_msg_t * msg = NULL; - blekw_att_read_data_t * att_rd_data; - - /* Allocate a buffer with enough space to store the packet */ - msg = (blekw_msg_t *) malloc(sizeof(blekw_msg_t) + sizeof(blekw_att_read_data_t)); - VerifyOrExit(msg, err = CHIP_ERROR_NO_MEMORY); - - msg->type = type; - msg->length = sizeof(blekw_att_read_data_t); - att_rd_data = (blekw_att_read_data_t *) msg->data.data; - att_rd_data->device_id = device_id; - att_rd_data->handle = handle; - - VerifyOrExit(xQueueSend(sBleEventQueue, &msg, 0) == pdTRUE, err = CHIP_ERROR_NO_MEMORY); - otTaskletsSignalPending(NULL); - -exit: - return err; -} - -CHIP_ERROR BLEManagerCommon::blekw_msg_add_u8(blekw_msg_type_t type, uint8_t data) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - blekw_msg_t * msg = NULL; - - /* Allocate a buffer with enough space to store the packet */ - msg = (blekw_msg_t *) malloc(sizeof(blekw_msg_t)); - VerifyOrExit(msg, err = CHIP_ERROR_NO_MEMORY); - - msg->type = type; - msg->length = 0; - msg->data.u8 = data; - - VerifyOrExit(xQueueSend(sBleEventQueue, &msg, 0) == pdTRUE, err = CHIP_ERROR_NO_MEMORY); - otTaskletsSignalPending(NULL); - -exit: - return err; -} - -CHIP_ERROR BLEManagerCommon::blekw_msg_add_u16(blekw_msg_type_t type, uint16_t data) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - blekw_msg_t * msg = NULL; - - /* Allocate a buffer with enough space to store the packet */ - msg = (blekw_msg_t *) malloc(sizeof(blekw_msg_t)); - VerifyOrExit(msg, err = CHIP_ERROR_NO_MEMORY); - - msg->type = type; - msg->length = 0; - msg->data.u16 = data; - - VerifyOrExit(xQueueSend(sBleEventQueue, &msg, 0) == pdTRUE, err = CHIP_ERROR_NO_MEMORY); - otTaskletsSignalPending(NULL); - -exit: - return err; -} - -void BLEManagerCommon::BleAdvTimeoutHandler(TimerHandle_t xTimer) -{ - if (BLEMgrImpl().mFlags.Has(Flags::kFastAdvertisingEnabled)) - { - ChipLogDetail(DeviceLayer, "Start slow advertisement"); - BLEMgr().SetAdvertisingMode(BLEAdvertisingMode::kSlowAdvertising); - } -} - -void BLEManagerCommon::CancelBleAdvTimeoutTimer(void) -{ - if (xTimerStop(sbleAdvTimeoutTimer, 0) == pdFAIL) - { - ChipLogError(DeviceLayer, "Failed to stop BledAdv timeout timer"); - } -} - -void BLEManagerCommon::StartBleAdvTimeoutTimer(uint32_t aTimeoutInMs) -{ - if (xTimerIsTimerActive(sbleAdvTimeoutTimer)) - { - CancelBleAdvTimeoutTimer(); - } - - // timer is not active, change its period to required value (== restart). - // FreeRTOS- Block for a maximum of 100 ticks if the change period command - // cannot immediately be sent to the timer command queue. - if (xTimerChangePeriod(sbleAdvTimeoutTimer, aTimeoutInMs / portTICK_PERIOD_MS, 100) != pdPASS) - { - ChipLogError(DeviceLayer, "Failed to start BledAdv timeout timer"); - } -} - -CHIP_ERROR BLEManagerCommon::blekw_stop_connection_internal(BLE_CONNECTION_OBJECT conId) -{ - ChipLogProgress(DeviceLayer, "Closing BLE GATT connection (con %u)", conId); - - if (Gap_Disconnect(conId) != gBleSuccess_c) - { - ChipLogProgress(DeviceLayer, "Gap_Disconnect() failed."); - return CHIP_ERROR_INTERNAL; - } -#if defined(chip_with_low_power) && (chip_with_low_power == 1) - else - { - bleAppStopInProgress = TRUE; - PWR_DisallowDeviceToSleep(); - } -#endif - - return CHIP_NO_ERROR; -} - -} // namespace Internal -} // namespace DeviceLayer -} // namespace chip -#endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE diff --git a/src/platform/nxp/k32w/common/BLEManagerCommon.h b/src/platform/nxp/k32w/common/BLEManagerCommon.h deleted file mode 100644 index b7fc1275d2501f..00000000000000 --- a/src/platform/nxp/k32w/common/BLEManagerCommon.h +++ /dev/null @@ -1,249 +0,0 @@ -/* - * - * Copyright (c) 2020-2021 Project CHIP Authors - * Copyright (c) 2020 Nest Labs, Inc. - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * Provides an implementation of the BLEManager singleton object - * for the K32W platforms. - */ - -#pragma once - -#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE - -#include "fsl_os_abstraction.h" - -#include "ble_conn_manager.h" -#include "ble_general.h" -#include "ble_host_task_config.h" -#include "ble_host_tasks.h" -#include "gap_interface.h" -#include "gatt_db_dynamic.h" -#include "gatt_server_interface.h" - -#include "FreeRTOS.h" -#include "event_groups.h" -#include "timers.h" - -namespace chip { -namespace DeviceLayer { -namespace Internal { - -using namespace chip::Ble; - -/** - * A delegate class that can be used by the application to subscribe to BLE events. - */ -struct BLECallbackDelegate -{ - using GapGenericCallback = void (*)(gapGenericEvent_t * event); - using GattServerCallback = void (*)(deviceId_t id, gattServerEvent_t * event); - - GapGenericCallback gapCallback = nullptr; - GattServerCallback gattCallback = nullptr; -}; - -/** - * Base class for different platform implementations (K32W0 and K32W1 for now). - */ -class BLEManagerCommon : public BLEManager, protected BleLayer, private BlePlatformDelegate, private BleApplicationDelegate -{ -protected: - // ===== Members that implement the BLEManager internal interface. - - CHIP_ERROR _Init(void); - CHIP_ERROR _Shutdown() { return CHIP_NO_ERROR; } - CHIPoBLEServiceMode _GetCHIPoBLEServiceMode(void); - CHIP_ERROR _SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val); - bool _IsAdvertisingEnabled(void); - CHIP_ERROR _SetAdvertisingEnabled(bool val); - bool _IsAdvertising(void); - CHIP_ERROR _SetAdvertisingMode(BLEAdvertisingMode mode); - CHIP_ERROR _GetDeviceName(char * buf, size_t bufSize); - CHIP_ERROR _SetDeviceName(const char * deviceName); - uint16_t _NumConnections(void); - void _OnPlatformEvent(const ChipDeviceEvent * event); - - // ===== Members that implement virtual methods on BlePlatformDelegate. - - CHIP_ERROR SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - CHIP_ERROR UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, - const Ble::ChipBleUUID * charId) override; - CHIP_ERROR CloseConnection(BLE_CONNECTION_OBJECT conId) override; - uint16_t GetMTU(BLE_CONNECTION_OBJECT conId) const override; - CHIP_ERROR SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; - CHIP_ERROR SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, - System::PacketBufferHandle pBuf) override; - - // ===== Members that implement virtual methods on BleApplicationDelegate. - - void NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) override; - - // ===== Private members reserved for use by this class only. - - enum class Flags : uint8_t - { - kAdvertisingEnabled = 0x0001, - kFastAdvertisingEnabled = 0x0002, - kAdvertising = 0x0004, - kRestartAdvertising = 0x0008, - kK32WBLEStackInitialized = 0x0010, - kDeviceNameSet = 0x0020, - }; - BitFlags mFlags; - - enum - { - kMaxDeviceNameLength = 16, - kUnusedIndex = 0xFF, - }; - - typedef enum - { - BLE_KW_MSG_ERROR = 0x01, - BLE_KW_MSG_CONNECTED, - BLE_KW_MSG_DISCONNECTED, - BLE_KW_MSG_MTU_CHANGED, - BLE_KW_MSG_ATT_WRITTEN, - BLE_KW_MSG_ATT_LONG_WRITTEN, - BLE_KW_MSG_ATT_READ, - BLE_KW_MSG_ATT_CCCD_WRITTEN, - BLE_KW_MSG_FORCE_DISCONNECT, - } blekw_msg_type_t; - - typedef struct hk_ble_kw_msg_s - { - blekw_msg_type_t type; - uint16_t length; - union - { - uint8_t u8; - uint16_t u16; - uint32_t u32; - uint8_t data[1]; - char * str; - } data; - } blekw_msg_t; - - typedef enum ble_err_t - { - BLE_OK = 0, - BLE_INTERNAL_GATT_ERROR, - BLE_E_SET_ADV_PARAMS, - BLE_E_ADV_PARAMS_FAILED, - BLE_E_SET_ADV_DATA, - BLE_E_ADV_CHANGED, - BLE_E_ADV_FAILED, - BLE_E_ADV_SETUP_FAILED, - BLE_E_START_ADV, - BLE_E_STOP, - BLE_E_FAIL, - BLE_E_START_ADV_FAILED, - BLE_KW_MSG_2M_UPGRADE_ERROR, - BLE_INTERNAL_ERROR, - } ble_err_t; - - typedef struct ble_att_written_data_s - { - uint8_t device_id; - uint16_t handle; - uint16_t length; - uint8_t data[1]; - } blekw_att_written_data_t; - - typedef struct hk_ble_att_read_data_s - { - uint8_t device_id; - uint16_t handle; - } blekw_att_read_data_t; - - CHIPoBLEServiceMode mServiceMode; - char mDeviceName[kMaxDeviceNameLength + 1]; -#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING - chip::System::PacketBufferHandle c3AdditionalDataBufferHandle; -#endif - uint8_t mDeviceId; - bool mDeviceSubscribed = false; - bool mDeviceConnected = false; - - void DriveBLEState(void); - CHIP_ERROR ConfigureAdvertising(void); - CHIP_ERROR ConfigureAdvertisingData(void); - CHIP_ERROR StartAdvertising(void); - CHIP_ERROR StopAdvertising(void); - - void HandleConnectEvent(blekw_msg_t * msg); - void HandleConnectionCloseEvent(blekw_msg_t * msg); - void HandleWriteEvent(blekw_msg_t * msg); - void HandleRXCharWrite(blekw_msg_t * msg); - void HandleTXCharCCCDWrite(blekw_msg_t * msg); - void HandleForceDisconnect(); - -#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING - CHIP_ERROR EncodeAdditionalDataTlv(); - void HandleC3ReadRequest(blekw_msg_t * msg); -#endif - BLEManagerCommon::ble_err_t blekw_send_event(int8_t connection_handle, uint16_t handle, uint8_t * data, uint32_t len); - - static void DriveBLEState(intptr_t arg); - static void StopAdvertisingPriorToSwitchingMode(intptr_t arg); - static void BleAdvTimeoutHandler(TimerHandle_t xTimer); - static void CancelBleAdvTimeoutTimer(void); - static void StartBleAdvTimeoutTimer(uint32_t aTimeoutInMs); - - static void blekw_connection_timeout_cb(TimerHandle_t timer); - static void blekw_generic_cb(gapGenericEvent_t * pGenericEvent); - static void blekw_gatt_server_cb(deviceId_t deviceId, gattServerEvent_t * pServerEvent); - static CHIP_ERROR blekw_msg_add_u8(blekw_msg_type_t type, uint8_t data); - static CHIP_ERROR blekw_msg_add_u16(blekw_msg_type_t type, uint16_t data); - static CHIP_ERROR blekw_msg_add_att_written(blekw_msg_type_t type, uint8_t device_id, uint16_t handle, uint8_t * data, - uint16_t length); - static CHIP_ERROR blekw_msg_add_att_read(blekw_msg_type_t type, uint8_t device_id, uint16_t handle); - static BLEManagerCommon::ble_err_t blekw_start_advertising(gapAdvertisingParameters_t * adv_params, gapAdvertisingData_t * adv, - gapScanResponseData_t * scnrsp); - static BLEManagerCommon::ble_err_t blekw_stop_advertising(void); - static void blekw_gap_advertising_cb(gapAdvertisingEvent_t * pAdvertisingEvent); - static void blekw_gap_connection_cb(deviceId_t deviceId, gapConnectionEvent_t * pConnectionEvent); - static void blekw_start_connection_timeout(void); - static void blekw_stop_connection_timeout(void); - static CHIP_ERROR blekw_stop_connection_internal(BLE_CONNECTION_OBJECT conId); - -public: - virtual CHIP_ERROR InitHostController(BLECallbackDelegate::GapGenericCallback cb_fp) = 0; - virtual BLEManagerCommon * GetImplInstance() = 0; - virtual CHIP_ERROR ResetController() { return CHIP_NO_ERROR; } - void DoBleProcessing(void); - - BLECallbackDelegate callbackDelegate; - void RegisterAppCallbacks(BLECallbackDelegate::GapGenericCallback gapCallback, - BLECallbackDelegate::GattServerCallback gattCallback); -}; - -inline BLEManager::CHIPoBLEServiceMode BLEManagerCommon::_GetCHIPoBLEServiceMode(void) -{ - return mServiceMode; -} - -} // namespace Internal -} // namespace DeviceLayer -} // namespace chip - -#endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE diff --git a/src/platform/nxp/k32w/common/CHIPDevicePlatformRamStorageConfig.h b/src/platform/nxp/k32w/common/CHIPDevicePlatformRamStorageConfig.h deleted file mode 100644 index bcb9ecdd82d58c..00000000000000 --- a/src/platform/nxp/k32w/common/CHIPDevicePlatformRamStorageConfig.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * - * Copyright (c) 2022 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * Configuration of RAM storage metadata: key IDs and NVM IDs. - */ - -#pragma once - -/* Base key IDs used when creating new keys for RAM storage instances. */ -/** - * @def kKeyId_Factory - * - * Base key id used for factory RAM storage. - */ -#ifndef kKeyId_Factory -#define kKeyId_Factory (uint8_t) 0x01 -#endif - -/** - * @def kKeyId_Config - * - * Base key id used for config RAM storage. - */ -#ifndef kKeyId_Config -#define kKeyId_Config (uint8_t) 0x02 -#endif - -/** - * @def kKeyId_Counter - * - * Base key id used for counter RAM storage. - */ -#ifndef kKeyId_Counter -#define kKeyId_Counter (uint8_t) 0x03 -#endif - -/** - * @def kKeyId_KvsKeys - * - * Base key id used for KVS keys RAM storage. - */ -#ifndef kKeyId_KvsKeys -#define kKeyId_KvsKeys (uint8_t) 0x04 -#endif - -/** - * @def kKeyId_KvsValues - * - * Base key id used for KVS values RAM storage. - */ -#ifndef kKeyId_KvsValues -#define kKeyId_KvsValues (uint8_t) 0x05 -#endif - -/* PDM IDs used when defining RAM storage instances or RAM buffers (OT). */ -/** - * @def kNvmId_Factory - * - * PDM ID used for factory RAM storage. - */ -#ifndef kNvmId_Factory -#define kNvmId_Factory (uint16_t) 0x5001 -#endif - -/** - * @def kNvmId_Config - * - * PDM ID used for config RAM storage. - */ -#ifndef kNvmId_Config -#define kNvmId_Config (uint16_t) 0x5002 -#endif - -/** - * @def kNvmId_Counter - * - * PDM ID used for counter RAM storage. - */ -#ifndef kNvmId_Counter -#define kNvmId_Counter (uint16_t) 0x5003 -#endif - -/** - * @def kNvmId_KvsKeys - * - * PDM ID used for KVS keys RAM storage. - */ -#ifndef kNvmId_KvsKeys -#define kNvmId_KvsKeys (uint16_t) 0x6000 -#endif - -/** - * @def kNvmId_KvsValues - * - * PDM ID used for KVS values RAM storage. - * KVS buffer can become quite big, so this PDM - * id is used as base id for subsequent PDM ids - * used to store data in chunks of PDM page size. - * This will use the extended search feature, so - * subsequent PDM ids should not be used. - */ -#ifndef kNvmId_KvsValues -#define kNvmId_KvsValues (uint16_t) 0x6001 -#endif - -/** - * @def kNvmId_KvsSubscription - * - * PDM ID used for KVS subscription RAM storage. - * It will store both keys and values for those keys. - */ -#ifndef kNvmId_KvsSubscription -#define kNvmId_KvsSubscription (uint16_t) 0x6100 -#endif - -/** - * @def kNvmId_KvsGroups - * - * PDM ID used for KVS groups RAM storage. - * It will store both keys and values for those keys. - * This will use the extended search feature, so - * subsequent PDM ids should not be used. - */ -#ifndef kNvmId_KvsGroups -#define kNvmId_KvsGroups (uint16_t) 0x6200 -#endif - -/** - * @def kNvmId_OTConfigData - * - * PDM ID used for OT RAM buffer. - */ -#ifndef kNvmId_OTConfigData -#define kNvmId_OTConfigData (uint16_t) 0x4F00 -#endif - -/** - * @def kNvmId_ApplicationBase - * - * Base PDM ID to be used by applications to define their own - * PDM IDs by using an offset. - */ -#ifndef kNvmId_ApplicationBase -#define kNvmId_ApplicationBase (uint16_t) 0xA000 -#endif - -#if CONFIG_CHIP_LOAD_REAL_FACTORY_DATA -/** - * @def kNvmId_FactoryDataBackup - * - * PDM ID used for factory data backup in FactoryDataProvider. - */ -#ifndef kNvmId_FactoryDataBackup -#define kNvmId_FactoryDataBackup (uint16_t) 0x7000 -#endif -#endif // CONFIG_CHIP_LOAD_REAL_FACTORY_DATA diff --git a/src/platform/nxp/k32w/common/FactoryDataProvider.cpp b/src/platform/nxp/k32w/common/FactoryDataProvider.cpp deleted file mode 100644 index dd79b020c881ea..00000000000000 --- a/src/platform/nxp/k32w/common/FactoryDataProvider.cpp +++ /dev/null @@ -1,368 +0,0 @@ -/* - * - * Copyright (c) 2022 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. - */ - -#if (!CONFIG_CHIP_LOAD_REAL_FACTORY_DATA || !(defined CONFIG_CHIP_LOAD_REAL_FACTORY_DATA)) -#include -#include -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace chip { -namespace DeviceLayer { - -static constexpr size_t kSpake2pSerializedVerifier_MaxBase64Len = - BASE64_ENCODED_LEN(chip::Crypto::kSpake2p_VerifierSerialized_Length) + 1; -static constexpr size_t kSpake2pSalt_MaxBase64Len = BASE64_ENCODED_LEN(chip::Crypto::kSpake2p_Max_PBKDF_Salt_Length) + 1; -/* Secure subsystem private key blob size is 32 + 24 = 56. - * DAC private key may be used to store an SSS exported blob instead of the private key. - */ -static constexpr size_t kDacPrivateKey_MaxLen = Crypto::kP256_PrivateKey_Length + 24; - -uint32_t FactoryDataProvider::kFactoryDataStart = (uint32_t) __MATTER_FACTORY_DATA_START; -uint32_t FactoryDataProvider::kFactoryDataSize = (uint32_t) __MATTER_FACTORY_DATA_SIZE; -uint32_t FactoryDataProvider::kFactoryDataPayloadStart = kFactoryDataStart + sizeof(FactoryDataProvider::Header); - -FactoryDataProvider::~FactoryDataProvider() {} - -CHIP_ERROR FactoryDataProvider::Validate() -{ - uint8_t output[Crypto::kSHA256_Hash_Length] = { 0 }; - - memcpy(&mHeader, (void *) kFactoryDataStart, sizeof(Header)); - ReturnErrorCodeIf(mHeader.hashId != kHashId, CHIP_FACTORY_DATA_HASH_ID); - - ReturnErrorOnFailure(Crypto::Hash_SHA256((uint8_t *) kFactoryDataPayloadStart, mHeader.size, output)); - ReturnErrorCodeIf(memcmp(output, mHeader.hash, kHashLen) != 0, CHIP_FACTORY_DATA_SHA_CHECK); - - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::SearchForId(uint8_t searchedType, uint8_t * pBuf, size_t bufLength, uint16_t & length, - uint32_t * offset) -{ - uint32_t addr = kFactoryDataPayloadStart; - uint8_t type = 0; - - while (addr < (kFactoryDataPayloadStart + mHeader.size)) - { - memcpy(&type, (void *) addr, sizeof(type)); - memcpy(&length, (void *) (addr + 1), sizeof(length)); - - if (searchedType == type) - { - ReturnErrorCodeIf(bufLength < length, CHIP_ERROR_BUFFER_TOO_SMALL); - memcpy(pBuf, (void *) (addr + kValueOffset), length); - - if (offset) - *offset = (addr - kFactoryDataPayloadStart); - - return CHIP_NO_ERROR; - } - else - { - /* Jump past 3 bytes of length and then use length to jump to next data */ - addr = addr + kValueOffset + length; - } - } - - return CHIP_ERROR_NOT_FOUND; -} - -CHIP_ERROR FactoryDataProvider::GetCertificationDeclaration(MutableByteSpan & outBuffer) -{ -#if CHIP_USE_DEVICE_CONFIG_CERTIFICATION_DECLARATION - constexpr uint8_t kCdForAllExamples[] = CHIP_DEVICE_CONFIG_CERTIFICATION_DECLARATION; - - return CopySpanToMutableSpan(ByteSpan{ kCdForAllExamples }, outBuffer); -#else - uint16_t declarationSize = 0; - ReturnErrorOnFailure(SearchForId(FactoryDataId::kCertDeclarationId, outBuffer.data(), outBuffer.size(), declarationSize)); - outBuffer.reduce_size(declarationSize); - - return CHIP_NO_ERROR; -#endif -} - -CHIP_ERROR FactoryDataProvider::GetFirmwareInformation(MutableByteSpan & out_firmware_info_buffer) -{ - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::GetDeviceAttestationCert(MutableByteSpan & outBuffer) -{ - uint16_t certificateSize = 0; - ReturnErrorOnFailure(SearchForId(FactoryDataId::kDacCertificateId, outBuffer.data(), outBuffer.size(), certificateSize)); - outBuffer.reduce_size(certificateSize); - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::GetProductAttestationIntermediateCert(MutableByteSpan & outBuffer) -{ - uint16_t certificateSize = 0; - ReturnErrorOnFailure(SearchForId(FactoryDataId::kPaiCertificateId, outBuffer.data(), outBuffer.size(), certificateSize)); - outBuffer.reduce_size(certificateSize); - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::SignWithDeviceAttestationKey(const ByteSpan & messageToSign, MutableByteSpan & outSignBuffer) -{ - return SignWithDacKey(messageToSign, outSignBuffer); -} - -CHIP_ERROR FactoryDataProvider::GetSetupDiscriminator(uint16_t & setupDiscriminator) -{ - uint32_t discriminator = 0; - uint16_t temp = 0; - - ReturnErrorOnFailure(SearchForId(FactoryDataId::kDiscriminatorId, (uint8_t *) &discriminator, sizeof(discriminator), temp)); - setupDiscriminator = (uint16_t) (discriminator & 0x0000FFFF); - - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::SetSetupDiscriminator(uint16_t setupDiscriminator) -{ - return CHIP_ERROR_NOT_IMPLEMENTED; -} - -CHIP_ERROR FactoryDataProvider::GetSpake2pIterationCount(uint32_t & iterationCount) -{ - uint16_t temp = 0; - ReturnErrorOnFailure(SearchForId(FactoryDataId::kIcId, (uint8_t *) &iterationCount, sizeof(iterationCount), temp)); - - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::GetSpake2pSalt(MutableByteSpan & saltBuf) -{ - char saltB64[kSpake2pSalt_MaxBase64Len] = { 0 }; - uint16_t saltB64Len = 0; - - ReturnErrorOnFailure(SearchForId(FactoryDataId::kSaltId, (uint8_t *) (&saltB64[0]), sizeof(saltB64), saltB64Len)); - size_t saltLen = chip::Base64Decode32(saltB64, saltB64Len, reinterpret_cast(saltB64)); - - ReturnErrorCodeIf(saltLen > saltBuf.size(), CHIP_ERROR_BUFFER_TOO_SMALL); - memcpy(saltBuf.data(), saltB64, saltLen); - saltBuf.reduce_size(saltLen); - - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::GetSpake2pVerifier(MutableByteSpan & verifierBuf, size_t & verifierLen) -{ - char verifierB64[kSpake2pSerializedVerifier_MaxBase64Len] = { 0 }; - uint16_t verifierB64Len = 0; - ReturnErrorOnFailure(SearchForId(FactoryDataId::kVerifierId, (uint8_t *) &verifierB64[0], sizeof(verifierB64), verifierB64Len)); - - verifierLen = chip::Base64Decode32(verifierB64, verifierB64Len, reinterpret_cast(verifierB64)); - ReturnErrorCodeIf(verifierLen > verifierBuf.size(), CHIP_ERROR_BUFFER_TOO_SMALL); - memcpy(verifierBuf.data(), verifierB64, verifierLen); - verifierBuf.reduce_size(verifierLen); - - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::GetSetupPasscode(uint32_t & setupPasscode) -{ - uint16_t length = 0; - ReturnErrorOnFailure(SearchForId(FactoryDataId::kSetupPasscodeId, (uint8_t *) &setupPasscode, sizeof(setupPasscode), length)); - - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::SetSetupPasscode(uint32_t setupPasscode) -{ - return CHIP_ERROR_NOT_IMPLEMENTED; -} - -CHIP_ERROR FactoryDataProvider::GetVendorName(char * buf, size_t bufSize) -{ - uint16_t length = 0; - ReturnErrorOnFailure(SearchForId(FactoryDataId::kVendorNameId, (uint8_t *) buf, bufSize, length)); - buf[length] = '\0'; - - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::GetVendorId(uint16_t & vendorId) -{ - uint16_t length = 0; - ReturnErrorOnFailure(SearchForId(FactoryDataId::kVidId, (uint8_t *) &vendorId, sizeof(vendorId), length)); - - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::GetProductName(char * buf, size_t bufSize) -{ - uint16_t length = 0; - ReturnErrorOnFailure(SearchForId(FactoryDataId::kProductNameId, (uint8_t *) buf, bufSize, length)); - buf[length] = '\0'; - - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::GetProductId(uint16_t & productId) -{ - uint16_t length = 0; - ReturnErrorOnFailure(SearchForId(FactoryDataId::kPidId, (uint8_t *) &productId, sizeof(productId), length)); - - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::GetPartNumber(char * buf, size_t bufSize) -{ - uint16_t length = 0; - ReturnErrorOnFailure(SearchForId(FactoryDataId::kPartNumber, (uint8_t *) buf, bufSize, length)); - buf[length] = '\0'; - - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::GetProductURL(char * buf, size_t bufSize) -{ - uint16_t length = 0; - ReturnErrorOnFailure(SearchForId(FactoryDataId::kProductURL, (uint8_t *) buf, bufSize, length)); - buf[length] = '\0'; - - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::GetProductLabel(char * buf, size_t bufSize) -{ - uint16_t length = 0; - ReturnErrorOnFailure(SearchForId(FactoryDataId::kProductLabel, (uint8_t *) buf, bufSize, length)); - buf[length] = '\0'; - - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::GetSerialNumber(char * buf, size_t bufSize) -{ - uint16_t length = 0; - ReturnErrorOnFailure(SearchForId(FactoryDataId::kSerialNumberId, (uint8_t *) buf, bufSize, length)); - buf[length] = '\0'; - - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::GetManufacturingDate(uint16_t & year, uint8_t & month, uint8_t & day) -{ - uint16_t length = 0; - uint8_t date[ConfigurationManager::kMaxManufacturingDateLength]; - - ReturnErrorOnFailure( - SearchForId(FactoryDataId::kManufacturingDateId, date, ConfigurationManager::kMaxManufacturingDateLength, length)); - date[length] = '\0'; - - if (length == 10 && isdigit(date[0]) && isdigit(date[1]) && isdigit(date[2]) && isdigit(date[3]) && date[4] == '-' && - isdigit(date[5]) && isdigit(date[6]) && date[7] == '-' && isdigit(date[8]) && isdigit(date[9])) - { - year = 1000 * (date[0] - '0') + 100 * (date[1] - '0') + 10 * (date[2] - '0') + date[3] - '0'; - month = 10 * (date[5] - '0') + date[6] - '0'; - day = 10 * (date[8] - '0') + date[9] - '0'; - } - else - { - ChipLogError(DeviceLayer, "Manufacturing date is not formatted correctly: YYYY-MM-DD."); - return CHIP_ERROR_INVALID_ARGUMENT; - } - - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::GetHardwareVersion(uint16_t & hardwareVersion) -{ - uint16_t length = 0; - ReturnErrorOnFailure( - SearchForId(FactoryDataId::kHardwareVersionId, (uint8_t *) &hardwareVersion, sizeof(hardwareVersion), length)); - - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::GetHardwareVersionString(char * buf, size_t bufSize) -{ - uint16_t length = 0; - ReturnErrorOnFailure(SearchForId(FactoryDataId::kHardwareVersionStrId, (uint8_t *) buf, bufSize, length)); - buf[length] = '\0'; - - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::GetRotatingDeviceIdUniqueId(MutableByteSpan & uniqueIdSpan) -{ - CHIP_ERROR err = CHIP_ERROR_NOT_IMPLEMENTED; -#if CHIP_ENABLE_ROTATING_DEVICE_ID - static_assert(ConfigurationManager::kRotatingDeviceIDUniqueIDLength >= ConfigurationManager::kMinRotatingDeviceIDUniqueIDLength, - "Length of unique ID for rotating device ID is smaller than minimum."); - uint16_t uniqueIdLen = 0; - err = SearchForId(FactoryDataId::kUniqueId, (uint8_t *) uniqueIdSpan.data(), uniqueIdSpan.size(), uniqueIdLen); -#if defined(CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID) - if (err != CHIP_NO_ERROR) - { - constexpr uint8_t uniqueId[] = CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID; - - ReturnErrorCodeIf(sizeof(uniqueId) > uniqueIdSpan.size(), CHIP_ERROR_BUFFER_TOO_SMALL); - memcpy(uniqueIdSpan.data(), uniqueId, sizeof(uniqueId)); - uniqueIdLen = sizeof(uniqueId); - err = CHIP_NO_ERROR; - } -#endif // CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID - ReturnErrorOnFailure(err); - uniqueIdSpan.reduce_size(uniqueIdLen); -#endif - - return err; -} - -CHIP_ERROR FactoryDataProvider::GetProductFinish(app::Clusters::BasicInformation::ProductFinishEnum * finish) -{ - uint8_t productFinish; - uint16_t length = 0; - auto err = SearchForId(FactoryDataId::kProductFinish, &productFinish, sizeof(productFinish), length); - ReturnErrorCodeIf(err != CHIP_NO_ERROR, CHIP_ERROR_NOT_IMPLEMENTED); - - *finish = static_cast(productFinish); - - return CHIP_NO_ERROR; -} - -CHIP_ERROR FactoryDataProvider::GetProductPrimaryColor(app::Clusters::BasicInformation::ColorEnum * primaryColor) -{ - uint8_t color; - uint16_t length = 0; - auto err = SearchForId(FactoryDataId::kProductPrimaryColor, &color, sizeof(color), length); - ReturnErrorCodeIf(err != CHIP_NO_ERROR, CHIP_ERROR_NOT_IMPLEMENTED); - - *primaryColor = static_cast(color); - - return CHIP_NO_ERROR; -} - -} // namespace DeviceLayer -} // namespace chip diff --git a/src/platform/nxp/k32w/common/FactoryDataProvider.h b/src/platform/nxp/k32w/common/FactoryDataProvider.h deleted file mode 100644 index 03ccf370f7641c..00000000000000 --- a/src/platform/nxp/k32w/common/FactoryDataProvider.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * - * Copyright (c) 2022 Project CHIP Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#pragma once - -#include -#include -#include -#include - -#include - -#include "CHIPPlatformConfig.h" - -#include - -/* Grab symbol for the base address from the linker file. */ -extern uint32_t __MATTER_FACTORY_DATA_START[]; -extern uint32_t __MATTER_FACTORY_DATA_SIZE[]; - -namespace chip { -namespace DeviceLayer { - -#define CHIP_FACTORY_DATA_ERROR(e) \ - ChipError(ChipError::Range::kLastRange, ((uint8_t) ChipError::Range::kLastRange << 2) | e, __FILE__, __LINE__) - -#define CHIP_FACTORY_DATA_SHA_CHECK CHIP_FACTORY_DATA_ERROR(0x01) -#define CHIP_FACTORY_DATA_HEADER_READ CHIP_FACTORY_DATA_ERROR(0x02) -#define CHIP_FACTORY_DATA_HASH_ID CHIP_FACTORY_DATA_ERROR(0x03) -#define CHIP_FACTORY_DATA_PDM_RESTORE CHIP_FACTORY_DATA_ERROR(0x04) -#define CHIP_FACTORY_DATA_NULL CHIP_FACTORY_DATA_ERROR(0x05) -#define CHIP_FACTORY_DATA_FLASH_ERASE CHIP_FACTORY_DATA_ERROR(0x06) -#define CHIP_FACTORY_DATA_FLASH_PROGRAM CHIP_FACTORY_DATA_ERROR(0x07) -#define CHIP_FACTORY_DATA_INTERNAL_FLASH_READ CHIP_FACTORY_DATA_ERROR(0x08) -#define CHIP_FACTORY_DATA_PDM_SAVE_RECORD CHIP_FACTORY_DATA_ERROR(0x09) -#define CHIP_FACTORY_DATA_PDM_READ_RECORD CHIP_FACTORY_DATA_ERROR(0x0A) -#define CHIP_FACTORY_DATA_RESTORE_MECHANISM CHIP_FACTORY_DATA_ERROR(0x0B) - -/** - * @brief This class provides Commissionable data, Device Attestation Credentials, - * and Device Instance Info. - */ - -class FactoryDataProvider : public DeviceInstanceInfoProvider, - public CommissionableDataProvider, - public Credentials::DeviceAttestationCredentialsProvider -{ -public: - struct Header - { - uint32_t hashId; - uint32_t size; - uint8_t hash[4]; - }; - - // Default factory data IDs - enum FactoryDataId - { - kVerifierId = 1, - kSaltId, - kIcId, - kDacPrivateKeyId, - kDacCertificateId, - kPaiCertificateId, - kDiscriminatorId, - kSetupPasscodeId, - kVidId, - kPidId, - kCertDeclarationId, - kVendorNameId, - kProductNameId, - kSerialNumberId, - kManufacturingDateId, - kHardwareVersionId, - kHardwareVersionStrId, - kUniqueId, - kPartNumber, - kProductURL, - kProductLabel, - kProductFinish, - kProductPrimaryColor, - kMaxId - }; - - static uint32_t kFactoryDataStart; - static uint32_t kFactoryDataSize; - static uint32_t kFactoryDataPayloadStart; - static constexpr uint32_t kLengthOffset = 1; - static constexpr uint32_t kValueOffset = 3; - static constexpr uint32_t kHashLen = 4; - static constexpr size_t kHashId = 0xCE47BA5E; - - virtual ~FactoryDataProvider(); - - virtual CHIP_ERROR Init() = 0; - virtual CHIP_ERROR SignWithDacKey(const ByteSpan & messageToSign, MutableByteSpan & outSignBuffer) = 0; - CHIP_ERROR Validate(); - - CHIP_ERROR SearchForId(uint8_t searchedType, uint8_t * pBuf, size_t bufLength, uint16_t & length, uint32_t * offset = nullptr); - - // ===== Members functions that implement the CommissionableDataProvider - CHIP_ERROR GetSetupDiscriminator(uint16_t & setupDiscriminator) override; - CHIP_ERROR SetSetupDiscriminator(uint16_t setupDiscriminator) override; - CHIP_ERROR GetSpake2pIterationCount(uint32_t & iterationCount) override; - CHIP_ERROR GetSpake2pSalt(MutableByteSpan & saltBuf) override; - CHIP_ERROR GetSpake2pVerifier(MutableByteSpan & verifierBuf, size_t & verifierLen) override; - CHIP_ERROR GetSetupPasscode(uint32_t & setupPasscode) override; - CHIP_ERROR SetSetupPasscode(uint32_t setupPasscode) override; - - // ===== Members functions that implement the DeviceAttestationCredentialsProvider - CHIP_ERROR GetCertificationDeclaration(MutableByteSpan & outBuffer) override; - CHIP_ERROR GetFirmwareInformation(MutableByteSpan & out_firmware_info_buffer) override; - CHIP_ERROR GetDeviceAttestationCert(MutableByteSpan & outBuffer) override; - CHIP_ERROR GetProductAttestationIntermediateCert(MutableByteSpan & outBuffer) override; - CHIP_ERROR SignWithDeviceAttestationKey(const ByteSpan & messageToSign, MutableByteSpan & outSignBuffer) override; - - // ===== Members functions that implement the GenericDeviceInstanceInfoProvider - CHIP_ERROR GetVendorName(char * buf, size_t bufSize) override; - CHIP_ERROR GetVendorId(uint16_t & vendorId) override; - CHIP_ERROR GetProductName(char * buf, size_t bufSize) override; - CHIP_ERROR GetProductId(uint16_t & productId) override; - CHIP_ERROR GetPartNumber(char * buf, size_t bufSize) override; - CHIP_ERROR GetProductURL(char * buf, size_t bufSize) override; - CHIP_ERROR GetProductLabel(char * buf, size_t bufSize) override; - CHIP_ERROR GetHardwareVersionString(char * buf, size_t bufSize) override; - CHIP_ERROR GetSerialNumber(char * buf, size_t bufSize) override; - CHIP_ERROR GetManufacturingDate(uint16_t & year, uint8_t & month, uint8_t & day) override; - CHIP_ERROR GetHardwareVersion(uint16_t & hardwareVersion) override; - CHIP_ERROR GetRotatingDeviceIdUniqueId(MutableByteSpan & uniqueIdSpan) override; - CHIP_ERROR GetProductFinish(app::Clusters::BasicInformation::ProductFinishEnum * finish) override; - CHIP_ERROR GetProductPrimaryColor(app::Clusters::BasicInformation::ColorEnum * primaryColor) override; - -protected: - Header mHeader; -}; - -} // namespace DeviceLayer -} // namespace chip diff --git a/src/platform/nxp/k32w/common/K32W_OTA_README.md b/src/platform/nxp/k32w/common/K32W_OTA_README.md deleted file mode 100644 index 0c9715b4610ff8..00000000000000 --- a/src/platform/nxp/k32w/common/K32W_OTA_README.md +++ /dev/null @@ -1,149 +0,0 @@ -# K32W OTA - -The OTA processing is now delegated to instances of `OTATlvProcessor` derived -classes. These instances are registered with the `OTAImageProcessorImpl` -instance, which manages the selection of processors that should process the next -blocks, until a full TLV block was transferred. - -The application is able to define its own processors, thus extending the default -OTA functionality. The application can also opt to disable the default -processors (application, SSBL and factory data). - -Please note that if an OTA image containing multiple TLV is transferred, then -the action for each TLV is applied sequentially, If one of the actions fails, -the remaining actions will not be applied and OTA abort is called. TBD: should -all actions be applied only if there is no error? Or should each action be -applied separately? - -## Default processors - -The default processors for K32W0 are already implemented in: - -- `OTAFirmwareProcessor` for application/SSBL update. Enabled by default. -- `OTAFactoryDataProcessor` for factory data update. Disabled by default, user - has to specify `chip_ota_enable_factory_data_processor=1` in the build args. - -Some SDK OTA module flags are defined to support additional features: - -- `gOTAAllowCustomStartAddress=1` - enable `EEPROM` offset value. Used - internally by SDK OTA module. -- `gOTAUseCustomOtaEntry=1` - support custom OTA entry for multi-image. -- `gOTACustomOtaEntryMemory=1` - K32W0 uses `OTACustomStorage_ExtFlash` (1) by - default. - -## Implementing custom processors - -A custom processor should implement the abstract interface defined in -`OTATlvProcessor.h`. Below is a compact version: - -``` -class OTATlvProcessor -{ -public: - virtual CHIP_ERROR Init() = 0; - virtual CHIP_ERROR Clear() = 0; - virtual CHIP_ERROR ApplyAction() = 0; - virtual CHIP_ERROR AbortAction() = 0; - virtual CHIP_ERROR ExitAction(); - - CHIP_ERROR Process(ByteSpan & block); - void RegisterDescriptorCallback(ProcessDescriptor callback); -protected: - virtual CHIP_ERROR ProcessInternal(ByteSpan & block) = 0; -}; - -``` - -Some details regarding the interface: - -- `Init` will be called whenever the processor is selected. -- `Clear` will be called when abort occurs or after the apply action takes - place. -- `ApplyAction` will be called in `OTAImageProcessorImpl::HandleApply`, before - the board is reset. -- `AbortAction` will be called in `OTAImageProcessorImpl::HandleAbort`. - Processors should reset state here. -- `ExitAction` is optional and should be implemented by the processors that - want to execute an action after all data has been transferred, but before - `HandleApply` is called. It's called before the new processor selection - takes place. This is useful in the context of multiple TLV transferred in a - single OTA process. -- `Process` is the public API used inside `OTAImageProcessorImpl` for data - processing. This is a wrapper over `ProcessInternal`, which can return - `CHIP_OTA_CHANGE_PROCESSOR` to notify a new processor should be selected for - the remaining data. -- `RegisterDescriptorCallback` can be used to register a callback for - processing the descriptor. It's optional. -- `ProcessInternal` should return: _ `CHIP_NO_ERROR` if block was processed - successfully. _ `CHIP_ERROR_BUFFER_TOO_SMALL` if current block doesn't - contain all necessary data. This can happen when a TLV value field has a - header, but it is split across two blocks. \* - `CHIP_OTA_FETCH_ALREADY_SCHEDULED` if block was processed successfully and - the fetching is already scheduled by the processor. This happens in the - default application processor, because the next data fetching is scheduled - through a callback (called when enough external flash was erased). - -Furthermore, a processor can use an instance of `OTADataAccumulator` to -accumulate data until a given threshold. This is useful when a custom payload -contains metadata that need parsing: accumulate data until the threshold is -reached or return `CHIP_ERROR_BUFFER_TOO_SMALL` to signal -`OTAImageProcessorImpl` more data is needed. - -``` -/** - * This class can be used to accumulate data until a given threshold. - * Should be used by OTATlvProcessor derived classes if they need - * metadata accumulation (e.g. for custom header decoding). - */ -class OTADataAccumulator -{ -public: - void Init(uint32_t threshold); - void Clear(); - CHIP_ERROR Accumulate(ByteSpan & block); - - inline uint8_t* data() { return mBuffer.Get(); } - -private: - uint32_t mThreshold; - uint32_t mBufferOffset; - Platform::ScopedMemoryBuffer mBuffer; -}; -``` - -## SSBL max entries example - -`CONFIG_CHIP_K32W0_MAX_ENTRIES_TEST` can be set to 1 to enable max entries test. -There will be 8 additional processors registered in default `OtaHooks` -implementation. The OTA image should be generated with the -`create_ota_images.sh` script from `./scripts/tools/nxp/ota/examples`. - -## Factory data restore mechanism - -Prior to factory data update, the old factory data is backed up in external -flash. If anything interrupts the update (e.g. power loss), there is a slight -chance the internal flash factory data section is erased and has to be restored -at next boot. The `FactoryDataProvider` offers a default restore mechanism and -support for registering additional restore mechanisms or overwriting the default -one. - -Prior to factory data update, the old factory data is backed up in external -flash. If anything interrupts the update (e.g. power loss), there is a slight -chance the internal flash factory data section is erased and has to be restored -at next boot. The `FactoryDataProvider` offers a default restore mechanism and -support for registering additional restore mechanisms or overwriting the default -one. - -Restore mechanisms are just functions that have this signature: -`CHIP_ERROR (*)(void)`. Any such function can be registered through -`FactoryDataProvider::RegisterRestoreMechanism`. - -The default restore mechanism is implemented as a weak function: -`FactoryDataDefaultRestoreMechanism`. It is registered in -`FactoryDataProvider::Init`, before factory data validation, and it can be -overwritten at application level. When doing the actual restore, the mechanisms -are called in the order they were registered. - -Please note that the restore mechanisms registration order matters. Once a -restore mechanism is successful (`CHIP_NO_ERROR` is returned), the restore -process has finished and subsequent restore mechanisms will not be called. diff --git a/src/platform/nxp/k32w/common/OTAImageProcessorImpl.cpp b/src/platform/nxp/k32w/common/OTAImageProcessorImpl.cpp deleted file mode 100644 index e972550c536d58..00000000000000 --- a/src/platform/nxp/k32w/common/OTAImageProcessorImpl.cpp +++ /dev/null @@ -1,424 +0,0 @@ -/* - * - * Copyright (c) 2021-2023 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include -#include -#include -#include - -#include - -using namespace chip::DeviceLayer; -using namespace ::chip::DeviceLayer::Internal; - -#if USE_SMU2_STATIC -// The attribute specifier should not be changed. -static chip::OTAImageProcessorImpl gImageProcessor __attribute__((section(".smu2"))); -#else -static chip::OTAImageProcessorImpl gImageProcessor; -#endif - -namespace chip { - -CHIP_ERROR OTAImageProcessorImpl::Init(OTADownloader * downloader) -{ - ReturnErrorCodeIf(downloader == nullptr, CHIP_ERROR_INVALID_ARGUMENT); - mDownloader = downloader; - - OtaHookInit(); - - return CHIP_NO_ERROR; -} - -void OTAImageProcessorImpl::Clear() -{ - mHeaderParser.Clear(); - mAccumulator.Clear(); - mParams.totalFileBytes = 0; - mParams.downloadedBytes = 0; - mCurrentProcessor = nullptr; - - ReleaseBlock(); -} - -CHIP_ERROR OTAImageProcessorImpl::PrepareDownload() -{ - DeviceLayer::PlatformMgr().ScheduleWork(HandlePrepareDownload, reinterpret_cast(this)); - return CHIP_NO_ERROR; -} - -CHIP_ERROR OTAImageProcessorImpl::Finalize() -{ - DeviceLayer::PlatformMgr().ScheduleWork(HandleFinalize, reinterpret_cast(this)); - return CHIP_NO_ERROR; -} - -CHIP_ERROR OTAImageProcessorImpl::Apply() -{ - DeviceLayer::PlatformMgr().ScheduleWork(HandleApply, reinterpret_cast(this)); - return CHIP_NO_ERROR; -} - -CHIP_ERROR OTAImageProcessorImpl::Abort() -{ - DeviceLayer::PlatformMgr().ScheduleWork(HandleAbort, reinterpret_cast(this)); - return CHIP_NO_ERROR; -} - -CHIP_ERROR OTAImageProcessorImpl::ProcessBlock(ByteSpan & block) -{ - if ((block.data() == nullptr) || block.empty()) - { - return CHIP_ERROR_INVALID_ARGUMENT; - } - - // Store block data for HandleProcessBlock to access - CHIP_ERROR err = SetBlock(block); - if (err != CHIP_NO_ERROR) - { - ChipLogError(SoftwareUpdate, "Cannot set block data: %" CHIP_ERROR_FORMAT, err.Format()); - } - - DeviceLayer::PlatformMgr().ScheduleWork(HandleProcessBlock, reinterpret_cast(this)); - return CHIP_NO_ERROR; -} - -void OTAImageProcessorImpl::HandlePrepareDownload(intptr_t context) -{ - auto * imageProcessor = reinterpret_cast(context); - - VerifyOrReturn(imageProcessor != nullptr, ChipLogError(SoftwareUpdate, "ImageProcessor context is null")); - - VerifyOrReturn(imageProcessor->mDownloader != nullptr, ChipLogError(SoftwareUpdate, "mDownloader is null")); - - GetRequestorInstance()->GetProviderLocation(imageProcessor->mBackupProviderLocation); - - imageProcessor->mHeaderParser.Init(); - imageProcessor->mAccumulator.Init(sizeof(OTATlvHeader)); - imageProcessor->mDownloader->OnPreparedForDownload(CHIP_NO_ERROR); -} - -CHIP_ERROR OTAImageProcessorImpl::ProcessHeader(ByteSpan & block) -{ - OTAImageHeader header; - ReturnErrorOnFailure(mHeaderParser.AccumulateAndDecode(block, header)); - - mParams.totalFileBytes = header.mPayloadSize; - mHeaderParser.Clear(); - ChipLogError(SoftwareUpdate, "Processed header successfully"); - - return CHIP_NO_ERROR; -} - -CHIP_ERROR OTAImageProcessorImpl::ProcessPayload(ByteSpan & block) -{ - CHIP_ERROR status = CHIP_NO_ERROR; - - while (true) - { - if (!mCurrentProcessor) - { - ReturnErrorOnFailure(mAccumulator.Accumulate(block)); - ByteSpan tlvHeader{ mAccumulator.data(), sizeof(OTATlvHeader) }; - ReturnErrorOnFailure(SelectProcessor(tlvHeader)); - ReturnErrorOnFailure(mCurrentProcessor->Init()); - } - - status = mCurrentProcessor->Process(block); - if (status == CHIP_ERROR_OTA_CHANGE_PROCESSOR) - { - mAccumulator.Clear(); - mAccumulator.Init(sizeof(OTATlvHeader)); - - mCurrentProcessor = nullptr; - - // If the block size is 0, it means that the processed data was a multiple of - // received BDX block size (e.g. 8 blocks of 1024 bytes were transferred). - // After state for selecting next processor is reset, a request for fetching next - // data must be sent. - if (block.size() == 0) - { - status = CHIP_NO_ERROR; - break; - } - } - else - { - break; - } - } - - return status; -} - -CHIP_ERROR OTAImageProcessorImpl::SelectProcessor(ByteSpan & block) -{ - OTATlvHeader header; - Encoding::LittleEndian::Reader reader(block.data(), sizeof(header)); - - ReturnErrorOnFailure(reader.Read32(&header.tag).StatusCode()); - ReturnErrorOnFailure(reader.Read32(&header.length).StatusCode()); - - auto pair = mProcessorMap.find(header.tag); - if (pair == mProcessorMap.end()) - { - ChipLogError(SoftwareUpdate, "There is no registered processor for tag: %" PRIu32, header.tag); - return CHIP_ERROR_OTA_PROCESSOR_NOT_REGISTERED; - } - - ChipLogDetail(SoftwareUpdate, "Selected processor with tag: %ld", pair->first); - mCurrentProcessor = pair->second; - mCurrentProcessor->SetLength(header.length); - mCurrentProcessor->SetWasSelected(true); - - return CHIP_NO_ERROR; -} - -CHIP_ERROR OTAImageProcessorImpl::RegisterProcessor(uint32_t tag, OTATlvProcessor * processor) -{ - auto pair = mProcessorMap.find(tag); - if (pair != mProcessorMap.end()) - { - ChipLogError(SoftwareUpdate, "A processor for tag %" PRIu32 " is already registered.", tag); - return CHIP_ERROR_OTA_PROCESSOR_ALREADY_REGISTERED; - } - - mProcessorMap.insert({ tag, processor }); - - return CHIP_NO_ERROR; -} - -void OTAImageProcessorImpl::HandleAbort(intptr_t context) -{ - ChipLogError(SoftwareUpdate, "OTA was aborted"); - auto * imageProcessor = reinterpret_cast(context); - if (imageProcessor != nullptr) - { - imageProcessor->AbortAllProcessors(); - } - imageProcessor->Clear(); - - OtaHookAbort(); -} - -void OTAImageProcessorImpl::HandleProcessBlock(intptr_t context) -{ - auto * imageProcessor = reinterpret_cast(context); - - VerifyOrReturn(imageProcessor != nullptr, ChipLogError(SoftwareUpdate, "ImageProcessor context is null")); - - VerifyOrReturn(imageProcessor->mDownloader != nullptr, ChipLogError(SoftwareUpdate, "mDownloader is null")); - - CHIP_ERROR status; - auto block = ByteSpan(imageProcessor->mBlock.data(), imageProcessor->mBlock.size()); - - if (imageProcessor->mHeaderParser.IsInitialized()) - { - status = imageProcessor->ProcessHeader(block); - if (status != CHIP_NO_ERROR) - { - imageProcessor->HandleStatus(status); - } - } - - status = imageProcessor->ProcessPayload(block); - imageProcessor->HandleStatus(status); -} - -void OTAImageProcessorImpl::HandleStatus(CHIP_ERROR status) -{ - if (status == CHIP_NO_ERROR || status == CHIP_ERROR_BUFFER_TOO_SMALL) - { - mParams.downloadedBytes += mBlock.size(); - FetchNextData(0); - } - else if (status == CHIP_ERROR_OTA_FETCH_ALREADY_SCHEDULED) - { - mParams.downloadedBytes += mBlock.size(); - } - else - { - ChipLogError(SoftwareUpdate, "Image update canceled. Failed to process OTA block: %s", ErrorStr(status)); - GetRequestorInstance()->CancelImageUpdate(); - } -} - -void OTAImageProcessorImpl::AbortAllProcessors() -{ - ChipLogError(SoftwareUpdate, "All selected processors will call abort action"); - - for (auto const & pair : mProcessorMap) - { - if (pair.second->WasSelected()) - { - pair.second->AbortAction(); - pair.second->Clear(); - pair.second->SetWasSelected(false); - } - } -} - -bool OTAImageProcessorImpl::IsFirstImageRun() -{ - OTARequestorInterface * requestor = chip::GetRequestorInstance(); - if (requestor == nullptr) - { - return false; - } - - return requestor->GetCurrentUpdateState() == OTARequestorInterface::OTAUpdateStateEnum::kApplying; -} - -CHIP_ERROR OTAImageProcessorImpl::ConfirmCurrentImage() -{ - uint32_t currentVersion; - uint32_t targetVersion; - - OTARequestorInterface * requestor = chip::GetRequestorInstance(); - ReturnErrorCodeIf(requestor == nullptr, CHIP_ERROR_INTERNAL); - - targetVersion = requestor->GetTargetVersion(); - ReturnErrorOnFailure(DeviceLayer::ConfigurationMgr().GetSoftwareVersion(currentVersion)); - if (currentVersion != targetVersion) - { - ChipLogError(SoftwareUpdate, "Current sw version %" PRIu32 " is different than the expected sw version = %" PRIu32, - currentVersion, targetVersion); - return CHIP_ERROR_INCORRECT_STATE; - } - - return CHIP_NO_ERROR; -} - -CHIP_ERROR OTAImageProcessorImpl::SetBlock(ByteSpan & block) -{ - if (!IsSpanUsable(block)) - { - return CHIP_NO_ERROR; - } - - if (mBlock.size() < block.size()) - { - if (!mBlock.empty()) - { - ReleaseBlock(); - } - uint8_t * mBlock_ptr = static_cast(chip::Platform::MemoryAlloc(block.size())); - if (mBlock_ptr == nullptr) - { - return CHIP_ERROR_NO_MEMORY; - } - mBlock = MutableByteSpan(mBlock_ptr, block.size()); - } - - CHIP_ERROR err = CopySpanToMutableSpan(block, mBlock); - if (err != CHIP_NO_ERROR) - { - ChipLogError(SoftwareUpdate, "Cannot copy block data: %" CHIP_ERROR_FORMAT, err.Format()); - return err; - } - return CHIP_NO_ERROR; -} - -void OTAImageProcessorImpl::HandleFinalize(intptr_t context) -{ - auto * imageProcessor = reinterpret_cast(context); - if (imageProcessor == nullptr) - { - return; - } - - imageProcessor->ReleaseBlock(); -} - -void OTAImageProcessorImpl::HandleApply(intptr_t context) -{ - CHIP_ERROR error = CHIP_NO_ERROR; - auto * imageProcessor = reinterpret_cast(context); - if (imageProcessor == nullptr) - { - return; - } - - for (auto const & pair : imageProcessor->mProcessorMap) - { - if (pair.second->WasSelected()) - { - error = pair.second->ApplyAction(); - if (error != CHIP_NO_ERROR) - { - ChipLogError(SoftwareUpdate, "Apply action for tag %d processor failed.", (uint8_t) pair.first); - // Revert all previously applied actions if current apply action fails. - // Reset image processor and requestor states. - imageProcessor->AbortAllProcessors(); - imageProcessor->Clear(); - GetRequestorInstance()->Reset(); - - return; - } - } - } - - for (auto const & pair : imageProcessor->mProcessorMap) - { - pair.second->Clear(); - pair.second->SetWasSelected(false); - } - - imageProcessor->mAccumulator.Clear(); - - ConfigurationManagerImpl().StoreSoftwareUpdateCompleted(); - PlatformMgr().HandleServerShuttingDown(); - - // Set the necessary information to inform the SSBL that a new image is available - // and trigger the actual device reboot after some time, to take into account - // queued actions, e.g. sending events to a subscription - SystemLayer().StartTimer( - chip::System::Clock::Milliseconds32(CHIP_DEVICE_LAYER_OTA_REBOOT_DELAY), - [](chip::System::Layer *, void *) { OtaHookReset(); }, nullptr); -} - -CHIP_ERROR OTAImageProcessorImpl::ReleaseBlock() -{ - if (mBlock.data() != nullptr) - { - chip::Platform::MemoryFree(mBlock.data()); - } - - mBlock = MutableByteSpan(); - return CHIP_NO_ERROR; -} - -void OTAImageProcessorImpl::FetchNextData(uint32_t context) -{ - auto * imageProcessor = &OTAImageProcessorImpl::GetDefaultInstance(); - SystemLayer().ScheduleLambda([imageProcessor] { - if (imageProcessor->mDownloader) - { - imageProcessor->mDownloader->FetchNextData(); - } - }); -} - -OTAImageProcessorImpl & OTAImageProcessorImpl::GetDefaultInstance() -{ - return gImageProcessor; -} - -} // namespace chip diff --git a/src/platform/nxp/k32w/common/OTAImageProcessorImpl.h b/src/platform/nxp/k32w/common/OTAImageProcessorImpl.h deleted file mode 100644 index 4eea088891109f..00000000000000 --- a/src/platform/nxp/k32w/common/OTAImageProcessorImpl.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * - * Copyright (c) 2021-2023 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include - -/* - * OTA hooks that can be overwritten by application. - * Default behavior is implemented as WEAK symbols in platform OtaHooks.cpp. - */ - -/* - * This hook is called at the end of OTAImageProcessorImpl::Init. - * It should generally register the OTATlvProcessor instances. - */ -extern "C" CHIP_ERROR OtaHookInit(); - -/* - * This hook is called at the end of OTAImageProcessorImpl::HandleApply. - * The default implementation saves the internal OTA entry structure and resets the device. - */ -extern "C" void OtaHookReset(); - -/* - * This hook is called at the end of OTAImageProcessorImpl::HandleAbort. - * For example, it can be used to schedule a retry. - */ -extern "C" void OtaHookAbort(); - -namespace chip { - -class OTAImageProcessorImpl : public OTAImageProcessorInterface -{ -public: - using ProviderLocation = chip::OTARequestorInterface::ProviderLocationType; - - CHIP_ERROR Init(OTADownloader * downloader); - void Clear(); - - //////////// OTAImageProcessorInterface Implementation /////////////// - CHIP_ERROR PrepareDownload() override; - CHIP_ERROR Finalize() override; - CHIP_ERROR Apply() override; - CHIP_ERROR Abort() override; - CHIP_ERROR ProcessBlock(ByteSpan & block) override; - bool IsFirstImageRun() override; - CHIP_ERROR ConfirmCurrentImage() override; - - CHIP_ERROR ProcessHeader(ByteSpan & block); - CHIP_ERROR ProcessPayload(ByteSpan & block); - CHIP_ERROR SelectProcessor(ByteSpan & block); - CHIP_ERROR RegisterProcessor(uint32_t tag, OTATlvProcessor * processor); - Optional & GetBackupProvider() { return mBackupProviderLocation; } - - static void FetchNextData(uint32_t context); - static OTAImageProcessorImpl & GetDefaultInstance(); - -private: - //////////// Actual handlers for the OTAImageProcessorInterface /////////////// - static void HandlePrepareDownload(intptr_t context); - static void HandleFinalize(intptr_t context); - static void HandleApply(intptr_t context); - static void HandleAbort(intptr_t context); - static void HandleProcessBlock(intptr_t context); - - void HandleStatus(CHIP_ERROR status); - - /** - * Called to allocate memory for mBlock if necessary and set it to block - */ - CHIP_ERROR SetBlock(ByteSpan & block); - - /** - * Called to release allocated memory for mBlock - */ - CHIP_ERROR ReleaseBlock(); - - /** - * Call AbortAction for all processors that were used - */ - void AbortAllProcessors(); - - MutableByteSpan mBlock; - OTADownloader * mDownloader; - OTAImageHeaderParser mHeaderParser; - OTATlvProcessor * mCurrentProcessor = nullptr; - OTADataAccumulator mAccumulator; - std::map mProcessorMap; - Optional mBackupProviderLocation; -}; - -} // namespace chip diff --git a/src/platform/nxp/k32w/common/OTATlvProcessor.cpp b/src/platform/nxp/k32w/common/OTATlvProcessor.cpp deleted file mode 100644 index 5dc0eaebd83627..00000000000000 --- a/src/platform/nxp/k32w/common/OTATlvProcessor.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include - -#include -#include -#if OTA_ENCRYPTION_ENABLE -#include "OtaUtils.h" -#include "rom_aes.h" -#endif -namespace chip { - -#if OTA_ENCRYPTION_ENABLE -constexpr uint8_t au8Iv[] = { 0x00, 0x00, 0x00, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x00, 0x00, 0x00, 0x00 }; -#endif - -CHIP_ERROR OTATlvProcessor::ApplyAction() -{ - return mApplyState == ApplyState::kApply ? CHIP_NO_ERROR : CHIP_ERROR_OTA_PROCESSOR_DO_NOT_APPLY; -} - -CHIP_ERROR OTATlvProcessor::Process(ByteSpan & block) -{ - CHIP_ERROR status = CHIP_NO_ERROR; - uint32_t bytes = chip::min(mLength - mProcessedLength, static_cast(block.size())); - ByteSpan relevantData = block.SubSpan(0, bytes); - - status = ProcessInternal(relevantData); - if (!IsError(status)) - { - mProcessedLength += bytes; - block = block.SubSpan(bytes); - if (mProcessedLength == mLength) - { - status = ExitAction(); - if (!IsError(status)) - { - // If current block was processed fully and the block still contains data, it - // means that the block contains another TLV's data and the current processor - // should be changed by OTAImageProcessorImpl. - return CHIP_ERROR_OTA_CHANGE_PROCESSOR; - } - } - } - - return status; -} - -void OTATlvProcessor::ClearInternal() -{ - mLength = 0; - mProcessedLength = 0; - mWasSelected = false; - mApplyState = ApplyState::kApply; -#if OTA_ENCRYPTION_ENABLE - mIVOffset = 0; -#endif -} - -bool OTATlvProcessor::IsError(CHIP_ERROR & status) -{ - return status != CHIP_NO_ERROR && status != CHIP_ERROR_BUFFER_TOO_SMALL && status != CHIP_ERROR_OTA_FETCH_ALREADY_SCHEDULED; -} - -void OTADataAccumulator::Init(uint32_t threshold) -{ - mThreshold = threshold; - mBufferOffset = 0; - mBuffer.Alloc(mThreshold); -} - -void OTADataAccumulator::Clear() -{ - mThreshold = 0; - mBufferOffset = 0; - mBuffer.Free(); -} - -CHIP_ERROR OTADataAccumulator::Accumulate(ByteSpan & block) -{ - uint32_t numBytes = chip::min(mThreshold - mBufferOffset, static_cast(block.size())); - memcpy(&mBuffer[mBufferOffset], block.data(), numBytes); - mBufferOffset += numBytes; - block = block.SubSpan(numBytes); - - if (mBufferOffset < mThreshold) - { - return CHIP_ERROR_BUFFER_TOO_SMALL; - } - - return CHIP_NO_ERROR; -} - -#if OTA_ENCRYPTION_ENABLE -CHIP_ERROR OTATlvProcessor::vOtaProcessInternalEncryption(MutableByteSpan & block) -{ - uint8_t iv[16]; - uint8_t key[kOTAEncryptionKeyLength]; - uint8_t dataOut[16] = { 0 }; - uint32_t u32IVCount; - uint32_t Offset = 0; - uint8_t data; - tsReg128 sKey; - aesContext_t Context; - - memcpy(iv, au8Iv, sizeof(au8Iv)); - - u32IVCount = (((uint32_t) iv[12]) << 24) | (((uint32_t) iv[13]) << 16) | (((uint32_t) iv[14]) << 8) | (iv[15]); - u32IVCount += (mIVOffset >> 4); - - iv[12] = (uint8_t) ((u32IVCount >> 24) & 0xff); - iv[13] = (uint8_t) ((u32IVCount >> 16) & 0xff); - iv[14] = (uint8_t) ((u32IVCount >> 8) & 0xff); - iv[15] = (uint8_t) (u32IVCount & 0xff); - - if (Encoding::HexToBytes(OTA_ENCRYPTION_KEY, strlen(OTA_ENCRYPTION_KEY), key, kOTAEncryptionKeyLength) != - kOTAEncryptionKeyLength) - { - // Failed to convert the OTAEncryptionKey string to octstr type value - return CHIP_ERROR_INVALID_STRING_LENGTH; - } - - ByteSpan KEY = ByteSpan(key); - Encoding::LittleEndian::Reader reader_key(KEY.data(), KEY.size()); - ReturnErrorOnFailure(reader_key.Read32(&sKey.u32register0) - .Read32(&sKey.u32register1) - .Read32(&sKey.u32register2) - .Read32(&sKey.u32register3) - .StatusCode()); - - while (Offset + 16 <= block.size()) - { - /*Encrypt the IV*/ - Context.mode = AES_MODE_ECB_ENCRYPT; - Context.pSoftwareKey = (uint32_t *) &sKey; - AES_128_ProcessBlocks(&Context, (uint32_t *) &iv[0], (uint32_t *) &dataOut[0], 1); - - /* Decrypt a block of the buffer */ - for (uint8_t i = 0; i < 16; i++) - { - data = block[Offset + i] ^ dataOut[i]; - memcpy(&block[Offset + i], &data, sizeof(uint8_t)); - } - - /* increment the IV for the next block */ - u32IVCount++; - - iv[12] = (uint8_t) ((u32IVCount >> 24) & 0xff); - iv[13] = (uint8_t) ((u32IVCount >> 16) & 0xff); - iv[14] = (uint8_t) ((u32IVCount >> 8) & 0xff); - iv[15] = (uint8_t) (u32IVCount & 0xff); - - Offset += 16; /* increment the buffer offset */ - mIVOffset += 16; - } - - return CHIP_NO_ERROR; -} -#endif -} // namespace chip diff --git a/src/platform/nxp/k32w/common/OTATlvProcessor.h b/src/platform/nxp/k32w/common/OTATlvProcessor.h deleted file mode 100644 index f1faef7e8eecf9..00000000000000 --- a/src/platform/nxp/k32w/common/OTATlvProcessor.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include - -namespace chip { - -#define CHIP_ERROR_TLV_PROCESSOR(e) \ - ChipError(ChipError::Range::kLastRange, ((uint8_t) ChipError::Range::kLastRange << 3) | e, __FILE__, __LINE__) - -#define CHIP_ERROR_OTA_CHANGE_PROCESSOR CHIP_ERROR_TLV_PROCESSOR(0x02) -#define CHIP_ERROR_OTA_PROCESSOR_NOT_REGISTERED CHIP_ERROR_TLV_PROCESSOR(0x03) -#define CHIP_ERROR_OTA_PROCESSOR_ALREADY_REGISTERED CHIP_ERROR_TLV_PROCESSOR(0x04) -#define CHIP_ERROR_OTA_PROCESSOR_CLIENT_INIT CHIP_ERROR_TLV_PROCESSOR(0x05) -#define CHIP_ERROR_OTA_PROCESSOR_MAKE_ROOM CHIP_ERROR_TLV_PROCESSOR(0x06) -#define CHIP_ERROR_OTA_PROCESSOR_PUSH_CHUNK CHIP_ERROR_TLV_PROCESSOR(0x07) -#define CHIP_ERROR_OTA_PROCESSOR_IMG_AUTH CHIP_ERROR_TLV_PROCESSOR(0x08) -#define CHIP_ERROR_OTA_FETCH_ALREADY_SCHEDULED CHIP_ERROR_TLV_PROCESSOR(0x09) -#define CHIP_ERROR_OTA_PROCESSOR_IMG_COMMIT CHIP_ERROR_TLV_PROCESSOR(0x0A) -#define CHIP_ERROR_OTA_PROCESSOR_CB_NOT_REGISTERED CHIP_ERROR_TLV_PROCESSOR(0x0B) -#define CHIP_ERROR_OTA_PROCESSOR_EEPROM_OFFSET CHIP_ERROR_TLV_PROCESSOR(0x0C) -#define CHIP_ERROR_OTA_PROCESSOR_EXTERNAL_STORAGE CHIP_ERROR_TLV_PROCESSOR(0x0D) -#define CHIP_ERROR_OTA_PROCESSOR_START_IMAGE CHIP_ERROR_TLV_PROCESSOR(0x0E) -#define CHIP_ERROR_OTA_PROCESSOR_DO_NOT_APPLY CHIP_ERROR_TLV_PROCESSOR(0x0F) - -// Descriptor constants -constexpr size_t kVersionStringSize = 64; -constexpr size_t kBuildDateSize = 64; - -constexpr uint16_t requestedOtaMaxBlockSize = 1024; - -/** - * Used alongside RegisterDescriptorCallback to register - * a custom descriptor processing function with a certain - * TLV processor. - */ -typedef CHIP_ERROR (*ProcessDescriptor)(void * descriptor); - -struct OTATlvHeader -{ - uint32_t tag; - uint32_t length; -}; - -/** - * This class defines an interface for a Matter TLV processor. - * Instances of derived classes can be registered as processors - * in OTAImageProcessorImpl. Based on the TLV type, a certain - * processor is used to process subsequent blocks until the number - * of bytes found in the metadata is processed. In case a block contains - * data from two different TLVs, the processor should ensure the remaining - * data is returned in the block passed as input. - * The default processors: application, SSBL and factory data are registered - * in OTAImageProcessorImpl::Init through OtaHookInit. - * Applications should use OTAImageProcessorImpl::RegisterProcessor - * to register additional processors. - */ -class OTATlvProcessor -{ -public: - enum class ApplyState : uint8_t - { - kApply = 0, - kDoNotApply - }; - - virtual ~OTATlvProcessor() {} - - virtual CHIP_ERROR Init() = 0; - virtual CHIP_ERROR Clear() = 0; - virtual CHIP_ERROR AbortAction() = 0; - virtual CHIP_ERROR ExitAction() { return CHIP_NO_ERROR; } - virtual CHIP_ERROR ApplyAction(); - - CHIP_ERROR Process(ByteSpan & block); - void RegisterDescriptorCallback(ProcessDescriptor callback) { mCallbackProcessDescriptor = callback; } - void SetLength(uint32_t length) { mLength = length; } - void SetWasSelected(bool selected) { mWasSelected = selected; } - bool WasSelected() { return mWasSelected; } -#if OTA_ENCRYPTION_ENABLE - CHIP_ERROR vOtaProcessInternalEncryption(MutableByteSpan & block); -#endif - -protected: - /** - * @brief Process custom TLV payload - * - * The method takes subsequent chunks of the Matter OTA image file and processes them. - * If more image chunks are needed, CHIP_ERROR_BUFFER_TOO_SMALL error is returned. - * Other error codes indicate that an error occurred during processing. Fetching - * next data is scheduled automatically by OTAImageProcessorImpl if the return value - * is neither an error code, nor CHIP_ERROR_OTA_FETCH_ALREADY_SCHEDULED (which implies the - * scheduling is done inside ProcessInternal or will be done in the future, through a - * callback). - * - * @param block Byte span containing a subsequent Matter OTA image chunk. When the method - * returns CHIP_NO_ERROR, the byte span is used to return a remaining part - * of the chunk, not used by current TLV processor. - * - * @retval CHIP_NO_ERROR Block was processed successfully. - * @retval CHIP_ERROR_BUFFER_TOO_SMALL Provided buffers are insufficient to decode some - * metadata (e.g. a descriptor). - * @retval CHIP_ERROR_OTA_FETCH_ALREADY_SCHEDULED Should be returned if ProcessInternal schedules - * fetching next data (e.g. through a callback). - * @retval Error code Something went wrong. Current OTA process will be - * canceled. - */ - virtual CHIP_ERROR ProcessInternal(ByteSpan & block) = 0; - - void ClearInternal(); - - bool IsError(CHIP_ERROR & status); - -#if OTA_ENCRYPTION_ENABLE - /*ota decryption*/ - uint32_t mIVOffset = 0; - /* Expected byte size of the OTAEncryptionKeyLength */ - static constexpr size_t kOTAEncryptionKeyLength = 16; -#endif - uint32_t mLength = 0; - uint32_t mProcessedLength = 0; - bool mWasSelected = false; - - /** - * @brief A flag to account for corner cases during OTA apply - * - * Used by the default ApplyAction implementation. - * - * If something goes wrong during ExitAction of the TLV processor, - * then mApplyState should be set to kDoNotApply and the image processor - * should abort. In this case, the BDX transfer was already finished - * and calling CancelImageUpdate will not abort the transfer, hence - * the device will reboot even though it should not have. If ApplyAction - * fails during HandleApply, then the process will be aborted. - */ - ApplyState mApplyState = ApplyState::kApply; - ProcessDescriptor mCallbackProcessDescriptor = nullptr; -}; - -/** - * This class can be used to accumulate data until a given threshold. - * Should be used by OTATlvProcessor derived classes if they need - * metadata accumulation (e.g. for custom header decoding). - */ -class OTADataAccumulator -{ -public: - void Init(uint32_t threshold); - void Clear(); - CHIP_ERROR Accumulate(ByteSpan & block); - - inline uint8_t * data() { return mBuffer.Get(); } - inline uint32_t GetThreshold() { return mThreshold; } - -private: - uint32_t mThreshold; - uint32_t mBufferOffset; - Platform::ScopedMemoryBuffer mBuffer; -}; - -} // namespace chip diff --git a/src/platform/nxp/k32w/k32w1/BUILD.gn b/src/platform/nxp/k32w/k32w1/BUILD.gn deleted file mode 100644 index 028bd2a1cde4a1..00000000000000 --- a/src/platform/nxp/k32w/k32w1/BUILD.gn +++ /dev/null @@ -1,153 +0,0 @@ -# Copyright (c) 2021 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build_overrides/chip.gni") -import("//build_overrides/nxp_sdk.gni") -import("${chip_root}/src/crypto/crypto.gni") -import("${chip_root}/src/platform/device.gni") -import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni") - -assert(chip_device_platform == "nxp") -assert(nxp_platform == "k32w/k32w1") - -if (chip_enable_openthread) { - import("//build_overrides/openthread.gni") -} - -if (chip_crypto == "platform") { - import("//build_overrides/mbedtls.gni") -} - -static_library("nxp_platform") { - defines = [ "CHIP_DEVICE_K32W1=1" ] - - sources = [ - "../../../SingletonConfigurationManager.cpp", - "../common/BLEManagerCommon.cpp", - "../common/BLEManagerCommon.h", - "BLEManagerImpl.cpp", - "BLEManagerImpl.h", - "CHIPDevicePlatformConfig.h", - "CHIPDevicePlatformEvent.h", - "ConfigurationManagerImpl.cpp", - "ConfigurationManagerImpl.h", - "ConnectivityManagerImpl.cpp", - "ConnectivityManagerImpl.h", - "DefaultTestEventTriggerDelegate.cpp", - "DefaultTestEventTriggerDelegate.h", - "DiagnosticDataProviderImpl.cpp", - "DiagnosticDataProviderImpl.h", - "K32W1Config.cpp", - "K32W1Config.h", - "KeyValueStoreManagerImpl.cpp", - "KeyValueStoreManagerImpl.h", - "PlatformManagerImpl.cpp", - "PlatformManagerImpl.h", - "SystemTimeSupport.cpp", - "ble_function_mux.c", - "ram_storage.c", - "ram_storage.h", - ] - - if (chip_use_plain_dac_key) { - defines += [ "CHIP_USE_PLAIN_DAC_KEY=1" ] - } else { - defines += [ "CHIP_USE_PLAIN_DAC_KEY=0" ] - } - - public = [ - "${chip_root}/src/credentials/DeviceAttestationCredsProvider.h", - "${chip_root}/src/credentials/examples/DeviceAttestationCredsExample.h", - "${chip_root}/src/credentials/examples/ExampleDACs.h", - "${chip_root}/src/credentials/examples/ExamplePAI.h", - "${chip_root}/src/platform/nxp/k32w/k32w1/BLEManagerImpl.h", - "${chip_root}/src/platform/nxp/k32w/k32w1/DefaultTestEventTriggerDelegate.h", - "${chip_root}/src/platform/nxp/k32w/k32w1/SMU2Manager.h", - ] - - public_deps = [ - "${chip_root}/src/app:test-event-trigger", - "${chip_root}/src/platform:platform_base", - ] - - if (chip_with_low_power != 0) { - sources += [ "LowPowerHooks.cpp" ] - } - - if (chip_enable_ota_requestor) { - public += [ "../common/OTAImageProcessorImpl.h" ] - - sources += [ - "../common/OTAImageProcessorImpl.cpp", - "../common/OTAImageProcessorImpl.h", - "../common/OTATlvProcessor.cpp", - "../common/OTATlvProcessor.h", - "OTAFirmwareProcessor.cpp", - "OTAFirmwareProcessor.h", - "OTAHooks.cpp", - ] - } - - if (chip_crypto == "platform") { - sources += [ - "CHIPCryptoPalK32W1.cpp", - "K32W1PersistentStorageOpKeystore.cpp", - "K32W1PersistentStorageOpKeystore.h", - ] - - if (chip_with_factory_data == 1) { - sources += [ - "../common/FactoryDataProvider.cpp", - "FactoryDataProviderImpl.cpp", - ] - public += [ - "${chip_root}/src/credentials/CHIPCert.h", - "${chip_root}/src/credentials/CertificationDeclaration.h", - ] - } - - public_deps += [ "${mbedtls_root}:mbedtls" ] - } - - deps = [] - - if (chip_enable_openthread) { - sources += [ - "../../../OpenThread/OpenThreadUtils.cpp", - "ThreadStackManagerImpl.cpp", - "ThreadStackManagerImpl.h", - ] - - if (chip_mdns == "platform") { - sources += [ - "../../../OpenThread/DnssdImpl.cpp", - "../../../OpenThread/OpenThreadDnssdImpl.cpp", - "../../../OpenThread/OpenThreadDnssdImpl.h", - ] - deps += [ "${chip_root}/src/lib/dnssd:platform_header" ] - } - - if (use_smu2_dynamic) { - sources += [ - "SMU2Manager.cpp", - "SMU2Manager.h", - ] - } - } - - public_deps += [ - "${chip_root}/src/crypto", - "${chip_root}/src/platform/logging:headers", - ] -} diff --git a/src/platform/nxp/k32w/k32w1/SoftwareUpdateManagerImpl.cpp b/src/platform/nxp/k32w/k32w1/SoftwareUpdateManagerImpl.cpp deleted file mode 100644 index c464bb327c24a6..00000000000000 --- a/src/platform/nxp/k32w/k32w1/SoftwareUpdateManagerImpl.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2020 Google LLC. - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* this file behaves like a config.h, comes first */ -#include - -#if CHIP_DEVICE_CONFIG_ENABLE_SOFTWARE_UPDATE_MANAGER - -#include -#include - -#include -#include - -namespace chip { -namespace DeviceLayer { - -SoftwareUpdateManagerImpl SoftwareUpdateManagerImpl::sInstance; - -CHIP_ERROR SoftwareUpdateManagerImpl::_Init(void) -{ - Internal::GenericSoftwareUpdateManagerImpl_BDX::DoInit(); - Internal::GenericSoftwareUpdateManagerImpl::DoInit(); - - return CHIP_NO_ERROR; -} - -} // namespace DeviceLayer -} // namespace chip - -#endif // CHIP_DEVICE_CONFIG_ENABLE_SOFTWARE_UPDATE_MANAGER diff --git a/src/platform/nxp/k32w/k32w1/SoftwareUpdateManagerImpl.h b/src/platform/nxp/k32w/k32w1/SoftwareUpdateManagerImpl.h deleted file mode 100644 index f04025435928d5..00000000000000 --- a/src/platform/nxp/k32w/k32w1/SoftwareUpdateManagerImpl.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * - * Copyright (c) 2020 Project CHIP Authors - * Copyright (c) 2020 Google LLC. - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#if CHIP_DEVICE_CONFIG_ENABLE_SOFTWARE_UPDATE_MANAGER - -#include -#include - -namespace chip { -namespace DeviceLayer { - -/** - * Concrete implementation of the SoftwareUpdateManager singleton object for the - * NXP K32W platforms. - */ -class SoftwareUpdateManagerImpl final : public SoftwareUpdateManager, - public Internal::GenericSoftwareUpdateManagerImpl, - public Internal::GenericSoftwareUpdateManagerImpl_BDX -{ - // Allow the SoftwareUpdateManager interface class to delegate method calls to - // the implementation methods provided by this class. - friend class SoftwareUpdateManager; - - // Allow the GenericSoftwareUpdateManagerImpl base class to access helper methods - // and types defined on this class. - friend class Internal::GenericSoftwareUpdateManagerImpl; - - // Allow the GenericSoftwareUpdateManagerImpl_BDX base class to access helper methods - // and types defined on this class. - friend class Internal::GenericSoftwareUpdateManagerImpl_BDX; - -public: - // ===== Members for internal use by the following friends. - - friend ::chip::DeviceLayer::SoftwareUpdateManager & SoftwareUpdateMgr(void); - friend SoftwareUpdateManagerImpl & SoftwareUpdateMgrImpl(void); - - static SoftwareUpdateManagerImpl sInstance; - -private: - // ===== Members that implement the SoftwareUpdateManager abstract interface. - - CHIP_ERROR _Init(void); -}; - -/** - * Returns a reference to the public interface of the SoftwareUpdateManager singleton object. - * - * Internal components should use this to access features of the SoftwareUpdateManager object - * that are common to all platforms. - */ -inline SoftwareUpdateManager & SoftwareUpdateMgr(void) -{ - return SoftwareUpdateManagerImpl::sInstance; -} - -/** - * Returns the platform-specific implementation of the SoftwareUpdateManager singleton object. - * - * Internal components can use this to gain access to features of the SoftwareUpdateManager - * that are specific to the K32W platform. - */ -inline SoftwareUpdateManagerImpl & SoftwareUpdateMgrImpl(void) -{ - return SoftwareUpdateManagerImpl::sInstance; -} - -} // namespace DeviceLayer -} // namespace chip - -#endif // CHIP_DEVICE_CONFIG_ENABLE_SOFTWARE_UPDATE_MANAGER diff --git a/src/platform/nxp/k32w0/BUILD.gn b/src/platform/nxp/k32w0/BUILD.gn index 41a80a77a7aa53..a1b40506d6cd6a 100644 --- a/src/platform/nxp/k32w0/BUILD.gn +++ b/src/platform/nxp/k32w0/BUILD.gn @@ -25,6 +25,11 @@ if (chip_enable_openthread) { import("//build_overrides/openthread.gni") } +source_set("nxp_factory_data") { +} +source_set("nxp_ota") { +} + static_library("nxp_platform") { defines = [] sources = [ diff --git a/src/platform/nxp/k32w/k32w1/BLEManagerImpl.cpp b/src/platform/nxp/k32w1/BLEManagerImpl.cpp similarity index 97% rename from src/platform/nxp/k32w/k32w1/BLEManagerImpl.cpp rename to src/platform/nxp/k32w1/BLEManagerImpl.cpp index 88d5c00400193c..fe3ebd0c0b5027 100644 --- a/src/platform/nxp/k32w/k32w1/BLEManagerImpl.cpp +++ b/src/platform/nxp/k32w1/BLEManagerImpl.cpp @@ -28,7 +28,7 @@ messaging_t gHci2Host_TaskQueue; /*! Event for the Host Task Queue */ OSA_EVENT_HANDLE_DEFINE(gHost_TaskEvent); -#include +#include extern "C" bleResult_t Hci_Reset(void); @@ -52,7 +52,6 @@ CHIP_ERROR BLEManagerImpl::InitHostController(BLECallbackDelegate::GapGenericCal PLATFORM_InitBle(); (void) RNG_Init(); - RNG_SetPseudoRandomNoSeed(NULL); /* Has to be called after RNG_Init(), once seed is generated. */ (void) Controller_SetRandomSeed(); diff --git a/src/platform/nxp/k32w/k32w1/BLEManagerImpl.h b/src/platform/nxp/k32w1/BLEManagerImpl.h similarity index 97% rename from src/platform/nxp/k32w/k32w1/BLEManagerImpl.h rename to src/platform/nxp/k32w1/BLEManagerImpl.h index 59bda33db0051f..d2b38cdeda1619 100644 --- a/src/platform/nxp/k32w/k32w1/BLEManagerImpl.h +++ b/src/platform/nxp/k32w1/BLEManagerImpl.h @@ -31,7 +31,7 @@ #include "controller_api.h" #include "controller_interface.h" -#include +#include /* host task configuration */ #define HOST_TASK_PRIORITY (4U) diff --git a/src/platform/nxp/k32w1/BUILD.gn b/src/platform/nxp/k32w1/BUILD.gn new file mode 100644 index 00000000000000..89e9ad06e918f4 --- /dev/null +++ b/src/platform/nxp/k32w1/BUILD.gn @@ -0,0 +1,211 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build_overrides/chip.gni") +import("//build_overrides/nxp_sdk.gni") +import("//build_overrides/openthread.gni") + +import("${chip_root}/src/crypto/crypto.gni") +import("${chip_root}/src/platform/device.gni") + +import("${nxp_sdk_build_root}/nxp_sdk.gni") + +import("${nxp_sdk_build_root}/${nxp_sdk_name}/${nxp_sdk_name}.gni") + +assert(chip_device_platform == "nxp") +assert(nxp_platform == "k32w1") + +assert(chip_with_low_power == 0 || + (chip_with_low_power == 1 && chip_with_ot_cli == 0), + "Please disable low power if openthread CLI is needed!") + +source_set("nxp_factory_data") { + sources = [ + "../common/legacy/FactoryDataDriver.cpp", + "../common/legacy/FactoryDataProvider.cpp", + "FactoryDataDriverImpl.cpp", + "FactoryDataProviderImpl.cpp", + ] + + public = [ + "${chip_root}/src/credentials/CHIPCert.h", + "${chip_root}/src/credentials/CertificationDeclaration.h", + ] + + defines = [ "PLATFORM_FACTORY_DATA_PROVIDER_IMPL_HEADER=\"platform/nxp/k32w1/FactoryDataProviderImpl.h\"" ] + + deps = [ + ":nxp_platform", + "${chip_root}/src/credentials:credentials", + ] +} + +source_set("nxp_ota") { + public = [ "../common/legacy/OTAImageProcessorImpl.h" ] + + sources = [ + "../common/legacy/OTAImageProcessorImpl.cpp", + "../common/legacy/OTAImageProcessorImpl.h", + "../common/legacy/OTATlvProcessor.cpp", + "../common/legacy/OTATlvProcessor.h", + "OTAFirmwareProcessor.cpp", + "OTAFirmwareProcessor.h", + "OTAHooks.cpp", + ] + + if (chip_with_factory_data == 1 && + chip_enable_ota_factory_data_processor == 1) { + sources += [ + "../common/legacy/OTAFactoryDataProcessor.cpp", + "../common/legacy/OTAFactoryDataProcessor.h", + ] + } + + deps = [ + ":nxp_platform", + "${chip_root}/src/platform:platform", + ] +} + +static_library("nxp_platform") { + deps = [] + defines = [ "CHIP_DEVICE_K32W1=1" ] + + sources = [ + "../../SingletonConfigurationManager.cpp", + "../common/legacy/BLEManagerCommon.cpp", + "../common/legacy/BLEManagerCommon.h", + "BLEManagerImpl.cpp", + "BLEManagerImpl.h", + "CHIPDevicePlatformConfig.h", + "CHIPDevicePlatformEvent.h", + "ConfigurationManagerImpl.cpp", + "ConfigurationManagerImpl.h", + "ConnectivityManagerImpl.cpp", + "ConnectivityManagerImpl.h", + "DiagnosticDataProviderImpl.cpp", + "DiagnosticDataProviderImpl.h", + "PlatformManagerImpl.cpp", + "PlatformManagerImpl.h", + "SystemTimeSupport.cpp", + "ble_function_mux.c", + ] + + if (chip_key_storage == "fwk_nvm") { + defines += [ "CHIP_PLAT_NVM_SUPPORT=1" ] + + sources += [ + "K32W1Config.cpp", + "K32W1Config.h", + "KeyValueStoreManagerImpl.cpp", + "KeyValueStoreManagerImpl.h", + "ram_storage.c", + "ram_storage.h", + ] + } else if (chip_key_storage == "littlefs") { + defines += [ + "CHIP_PLAT_NVM_SUPPORT=3", + "EXTERNAL_KEYVALUESTOREMANAGERIMPL_HEADER=\"platform/nxp/common/KeyValueStoreManagerImpl.h\"", + ] + + sources += [ + "../common/KeyValueStoreManagerImpl.cpp", + "../common/KeyValueStoreManagerImpl.h", + "../common/NXPConfig.h", + "../common/NXPConfigKS.cpp", + ] + } else if (chip_key_storage == "nvs") { + defines += [ + "gAppNvsExternalFlash_c=0", + "gAppNvsInternalFlash_c=1", + "CONFIG_SETTINGS_RUNTIME=1", + ] + + sources += [ + "../common/KeyValueStoreManagerImpl.cpp", + "../common/KeyValueStoreManagerImpl.h", + "../common/NXPConfig.h", + "../common/NXPConfigNVS.cpp", + ] + } + + if (chip_use_plain_dac_key) { + defines += [ "CHIP_USE_PLAIN_DAC_KEY=1" ] + } else { + defines += [ "CHIP_USE_PLAIN_DAC_KEY=0" ] + } + + public = [ + "${chip_root}/src/credentials/DeviceAttestationCredsProvider.h", + "${chip_root}/src/credentials/examples/DeviceAttestationCredsExample.h", + "${chip_root}/src/credentials/examples/ExampleDACs.h", + "${chip_root}/src/credentials/examples/ExamplePAI.h", + "${chip_root}/src/platform/nxp/k32w1/BLEManagerImpl.h", + "${chip_root}/src/platform/nxp/k32w1/SMU2Manager.h", + ] + + public_deps = [ "${chip_root}/src/platform:platform_base" ] + + if (chip_with_low_power != 0) { + sources += [ "LowPowerHooks.cpp" ] + } + + if (chip_crypto == "platform") { + sources += [ + "CHIPCryptoPalK32W1.cpp", + "K32W1PersistentStorageOpKeystore.cpp", + "K32W1PersistentStorageOpKeystore.h", + ] + + if (chip_with_ot_cli == 1) { + defines += [ "CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI=1" ] + } + } + + if (chip_enable_openthread) { + sources += [ + "../../OpenThread/OpenThreadUtils.cpp", + "ThreadStackManagerImpl.cpp", + "ThreadStackManagerImpl.h", + ] + + deps += [ "${chip_root}/third_party/openthread:openthread" ] + public_deps += [ "${chip_root}/third_party/openthread:openthread-platform" ] + + if (chip_mdns == "platform") { + sources += [ + "../../OpenThread/DnssdImpl.cpp", + "../../OpenThread/OpenThreadDnssdImpl.cpp", + "../../OpenThread/OpenThreadDnssdImpl.h", + ] + deps += [ "${chip_root}/src/lib/dnssd:platform_header" ] + } + + if (use_smu2_dynamic) { + sources += [ + "SMU2Manager.cpp", + "SMU2Manager.h", + ] + } + } + + deps += [ "${nxp_sdk_build_root}:nxp_sdk" ] + + public_deps += [ + "${chip_root}/examples/platform/nxp/${nxp_platform}/app/support:freertos_memory_utils", + "${chip_root}/src/crypto", + "${chip_root}/src/platform:syscalls_stub", + "${chip_root}/src/platform/logging:headers", + ] +} diff --git a/src/platform/nxp/k32w/k32w1/BlePlatformConfig.h b/src/platform/nxp/k32w1/BlePlatformConfig.h similarity index 100% rename from src/platform/nxp/k32w/k32w1/BlePlatformConfig.h rename to src/platform/nxp/k32w1/BlePlatformConfig.h diff --git a/src/platform/nxp/k32w/k32w1/CHIPCryptoPalK32W1.cpp b/src/platform/nxp/k32w1/CHIPCryptoPalK32W1.cpp similarity index 100% rename from src/platform/nxp/k32w/k32w1/CHIPCryptoPalK32W1.cpp rename to src/platform/nxp/k32w1/CHIPCryptoPalK32W1.cpp diff --git a/src/platform/nxp/k32w/k32w1/CHIPDevicePlatformConfig.h b/src/platform/nxp/k32w1/CHIPDevicePlatformConfig.h similarity index 94% rename from src/platform/nxp/k32w/k32w1/CHIPDevicePlatformConfig.h rename to src/platform/nxp/k32w1/CHIPDevicePlatformConfig.h index 52dec0809f618d..13dbd99290ea68 100644 --- a/src/platform/nxp/k32w/k32w1/CHIPDevicePlatformConfig.h +++ b/src/platform/nxp/k32w1/CHIPDevicePlatformConfig.h @@ -61,6 +61,16 @@ // These are configuration options that are unique to the K32W platform. // These can be overridden by the application as needed. +/** + * @def CONFIG_CHIP_OTA_FACTORY_DATA_PROCESSOR + * + * Enables default OTA TLV factory data processor. + * Disabled by default. + */ +#ifndef CONFIG_CHIP_OTA_FACTORY_DATA_PROCESSOR +#define CONFIG_CHIP_OTA_FACTORY_DATA_PROCESSOR 0 +#endif // CONFIG_CHIP_OTA_FACTORY_DATA_PROCESSOR + /** * @def CHIP_DEVICE_LAYER_BLE_OBSERVER_PRIORITY * diff --git a/src/platform/nxp/k32w/k32w1/CHIPDevicePlatformEvent.h b/src/platform/nxp/k32w1/CHIPDevicePlatformEvent.h similarity index 100% rename from src/platform/nxp/k32w/k32w1/CHIPDevicePlatformEvent.h rename to src/platform/nxp/k32w1/CHIPDevicePlatformEvent.h diff --git a/src/platform/nxp/k32w/k32w1/CHIPPlatformConfig.h b/src/platform/nxp/k32w1/CHIPPlatformConfig.h similarity index 100% rename from src/platform/nxp/k32w/k32w1/CHIPPlatformConfig.h rename to src/platform/nxp/k32w1/CHIPPlatformConfig.h diff --git a/src/platform/nxp/k32w/k32w1/ConfigurationManagerImpl.cpp b/src/platform/nxp/k32w1/ConfigurationManagerImpl.cpp similarity index 80% rename from src/platform/nxp/k32w/k32w1/ConfigurationManagerImpl.cpp rename to src/platform/nxp/k32w1/ConfigurationManagerImpl.cpp index 68a1a4196ed39c..fc6815d20fd157 100644 --- a/src/platform/nxp/k32w/k32w1/ConfigurationManagerImpl.cpp +++ b/src/platform/nxp/k32w1/ConfigurationManagerImpl.cpp @@ -29,9 +29,8 @@ #include #include #include -#include #if defined(USE_SMU2_DYNAMIC) -#include +#include #endif // #include @@ -56,7 +55,7 @@ CHIP_ERROR ConfigurationManagerImpl::Init() CHIP_ERROR err; uint32_t rebootCount = 0; - if (K32WConfig::ConfigValueExists(K32WConfig::kCounterKey_RebootCount)) + if (NXPConfig::ConfigValueExists(NXPConfig::kCounterKey_RebootCount)) { err = GetRebootCount(rebootCount); SuccessOrExit(err); @@ -71,20 +70,20 @@ CHIP_ERROR ConfigurationManagerImpl::Init() SuccessOrExit(err); } - if (!K32WConfig::ConfigValueExists(K32WConfig::kCounterKey_TotalOperationalHours)) + if (!NXPConfig::ConfigValueExists(NXPConfig::kCounterKey_TotalOperationalHours)) { err = StoreTotalOperationalHours(0); SuccessOrExit(err); } - if (!K32WConfig::ConfigValueExists(K32WConfig::kCounterKey_BootReason)) + if (!NXPConfig::ConfigValueExists(NXPConfig::kCounterKey_BootReason)) { err = StoreBootReason(to_underlying(BootReasonType::kUnspecified)); SuccessOrExit(err); } // Initialize the generic implementation base class. - err = Internal::GenericConfigurationManagerImpl::Init(); + err = Internal::GenericConfigurationManagerImpl::Init(); SuccessOrExit(err); // TODO: Initialize the global GroupKeyStore object here @@ -103,22 +102,22 @@ CHIP_ERROR ConfigurationManagerImpl::StoreSoftwareUpdateCompleted() CHIP_ERROR ConfigurationManagerImpl::GetRebootCount(uint32_t & rebootCount) { - return ReadConfigValue(K32WConfig::kCounterKey_RebootCount, rebootCount); + return ReadConfigValue(NXPConfig::kCounterKey_RebootCount, rebootCount); } CHIP_ERROR ConfigurationManagerImpl::StoreRebootCount(uint32_t rebootCount) { - return WriteConfigValue(K32WConfig::kCounterKey_RebootCount, rebootCount); + return WriteConfigValue(NXPConfig::kCounterKey_RebootCount, rebootCount); } CHIP_ERROR ConfigurationManagerImpl::GetTotalOperationalHours(uint32_t & totalOperationalHours) { - return ReadConfigValue(K32WConfig::kCounterKey_TotalOperationalHours, totalOperationalHours); + return ReadConfigValue(NXPConfig::kCounterKey_TotalOperationalHours, totalOperationalHours); } CHIP_ERROR ConfigurationManagerImpl::StoreTotalOperationalHours(uint32_t totalOperationalHours) { - return WriteConfigValue(K32WConfig::kCounterKey_TotalOperationalHours, totalOperationalHours); + return WriteConfigValue(NXPConfig::kCounterKey_TotalOperationalHours, totalOperationalHours); } CHIP_ERROR ConfigurationManagerImpl::GetBootReason(uint32_t & bootReason) @@ -149,7 +148,7 @@ CHIP_ERROR ConfigurationManagerImpl::GetBootReason(uint32_t & bootReason) CHIP_ERROR ConfigurationManagerImpl::StoreBootReason(uint32_t bootReason) { - return WriteConfigValue(K32WConfig::kCounterKey_BootReason, bootReason); + return WriteConfigValue(NXPConfig::kCounterKey_BootReason, bootReason); } bool ConfigurationManagerImpl::CanFactoryReset() @@ -168,7 +167,7 @@ CHIP_ERROR ConfigurationManagerImpl::ReadPersistedStorageValue(::chip::Platform: { CHIP_ERROR err; - err = K32WConfig::ReadConfigValueCounter(persistedStorageKey, value); + err = NXPConfig::ReadConfigValueCounter(persistedStorageKey, value); if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) { err = CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND; @@ -186,7 +185,7 @@ CHIP_ERROR ConfigurationManagerImpl::WritePersistedStorageValue(::chip::Platform // (where persistedStorageKey represents an index to the counter). CHIP_ERROR err; - err = K32WConfig::WriteConfigValueCounter(persistedStorageKey, value); + err = NXPConfig::WriteConfigValueCounter(persistedStorageKey, value); if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) { err = CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND; @@ -199,62 +198,62 @@ CHIP_ERROR ConfigurationManagerImpl::WritePersistedStorageValue(::chip::Platform CHIP_ERROR ConfigurationManagerImpl::ReadConfigValue(Key key, bool & val) { - return K32WConfig::ReadConfigValue(key, val); + return NXPConfig::ReadConfigValue(key, val); } CHIP_ERROR ConfigurationManagerImpl::ReadConfigValue(Key key, uint32_t & val) { - return K32WConfig::ReadConfigValue(key, val); + return NXPConfig::ReadConfigValue(key, val); } CHIP_ERROR ConfigurationManagerImpl::ReadConfigValue(Key key, uint64_t & val) { - return K32WConfig::ReadConfigValue(key, val); + return NXPConfig::ReadConfigValue(key, val); } CHIP_ERROR ConfigurationManagerImpl::ReadConfigValueStr(Key key, char * buf, size_t bufSize, size_t & outLen) { - return K32WConfig::ReadConfigValueStr(key, buf, bufSize, outLen); + return NXPConfig::ReadConfigValueStr(key, buf, bufSize, outLen); } CHIP_ERROR ConfigurationManagerImpl::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen) { - return K32WConfig::ReadConfigValueBin(key, buf, bufSize, outLen); + return NXPConfig::ReadConfigValueBin(key, buf, bufSize, outLen); } CHIP_ERROR ConfigurationManagerImpl::WriteConfigValue(Key key, bool val) { - return K32WConfig::WriteConfigValue(key, val); + return NXPConfig::WriteConfigValue(key, val); } CHIP_ERROR ConfigurationManagerImpl::WriteConfigValue(Key key, uint32_t val) { - return K32WConfig::WriteConfigValue(key, val); + return NXPConfig::WriteConfigValue(key, val); } CHIP_ERROR ConfigurationManagerImpl::WriteConfigValue(Key key, uint64_t val) { - return K32WConfig::WriteConfigValue(key, val); + return NXPConfig::WriteConfigValue(key, val); } CHIP_ERROR ConfigurationManagerImpl::WriteConfigValueStr(Key key, const char * str) { - return K32WConfig::WriteConfigValueStr(key, str); + return NXPConfig::WriteConfigValueStr(key, str); } CHIP_ERROR ConfigurationManagerImpl::WriteConfigValueStr(Key key, const char * str, size_t strLen) { - return K32WConfig::WriteConfigValueStr(key, str, strLen); + return NXPConfig::WriteConfigValueStr(key, str, strLen); } CHIP_ERROR ConfigurationManagerImpl::WriteConfigValueBin(Key key, const uint8_t * data, size_t dataLen) { - return K32WConfig::WriteConfigValueBin(key, data, dataLen); + return NXPConfig::WriteConfigValueBin(key, data, dataLen); } void ConfigurationManagerImpl::RunConfigUnitTest(void) { - K32WConfig::RunConfigUnitTest(); + NXPConfig::RunConfigUnitTest(); } void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) @@ -263,7 +262,7 @@ void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) ChipLogProgress(DeviceLayer, "Performing factory reset"); - err = K32WConfig::FactoryResetConfig(); + err = NXPConfig::FactoryResetConfig(); if (err != CHIP_NO_ERROR) { ChipLogError(DeviceLayer, "FactoryResetConfig() failed: %s", ErrorStr(err)); diff --git a/src/platform/nxp/k32w/k32w1/ConfigurationManagerImpl.h b/src/platform/nxp/k32w1/ConfigurationManagerImpl.h similarity index 95% rename from src/platform/nxp/k32w/k32w1/ConfigurationManagerImpl.h rename to src/platform/nxp/k32w1/ConfigurationManagerImpl.h index 26201d85f58a52..ba6dd2e721340b 100644 --- a/src/platform/nxp/k32w/k32w1/ConfigurationManagerImpl.h +++ b/src/platform/nxp/k32w1/ConfigurationManagerImpl.h @@ -25,7 +25,11 @@ #pragma once -#include "K32W1Config.h" +#if (CHIP_PLAT_NVM_SUPPORT == 1) +#include +#else +#include +#endif #include namespace chip { @@ -34,7 +38,7 @@ namespace DeviceLayer { /** * Concrete implementation of the ConfigurationManager singleton object for the K32W platform. */ -class ConfigurationManagerImpl final : public Internal::GenericConfigurationManagerImpl +class ConfigurationManagerImpl final : public Internal::GenericConfigurationManagerImpl { public: // This returns an instance of this class. diff --git a/src/platform/nxp/k32w/k32w1/ConnectivityManagerImpl.cpp b/src/platform/nxp/k32w1/ConnectivityManagerImpl.cpp similarity index 100% rename from src/platform/nxp/k32w/k32w1/ConnectivityManagerImpl.cpp rename to src/platform/nxp/k32w1/ConnectivityManagerImpl.cpp diff --git a/src/platform/nxp/k32w/k32w1/ConnectivityManagerImpl.h b/src/platform/nxp/k32w1/ConnectivityManagerImpl.h similarity index 100% rename from src/platform/nxp/k32w/k32w1/ConnectivityManagerImpl.h rename to src/platform/nxp/k32w1/ConnectivityManagerImpl.h diff --git a/src/platform/nxp/k32w/k32w1/DiagnosticDataProviderImpl.cpp b/src/platform/nxp/k32w1/DiagnosticDataProviderImpl.cpp similarity index 99% rename from src/platform/nxp/k32w/k32w1/DiagnosticDataProviderImpl.cpp rename to src/platform/nxp/k32w1/DiagnosticDataProviderImpl.cpp index 3a3412eb031d36..090feb53adde4a 100644 --- a/src/platform/nxp/k32w/k32w1/DiagnosticDataProviderImpl.cpp +++ b/src/platform/nxp/k32w1/DiagnosticDataProviderImpl.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #if CHIP_SYSTEM_CONFIG_USE_LWIP #include diff --git a/src/platform/nxp/k32w/k32w1/DiagnosticDataProviderImpl.h b/src/platform/nxp/k32w1/DiagnosticDataProviderImpl.h similarity index 100% rename from src/platform/nxp/k32w/k32w1/DiagnosticDataProviderImpl.h rename to src/platform/nxp/k32w1/DiagnosticDataProviderImpl.h diff --git a/src/platform/nxp/k32w1/FactoryDataDriverImpl.cpp b/src/platform/nxp/k32w1/FactoryDataDriverImpl.cpp new file mode 100644 index 00000000000000..ae50e2361b8257 --- /dev/null +++ b/src/platform/nxp/k32w1/FactoryDataDriverImpl.cpp @@ -0,0 +1,147 @@ +/* + * + * Copyright (c) 2024 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include + +using namespace chip::DeviceLayer::PersistedStorage; + +namespace chip { +namespace DeviceLayer { + +FactoryDataDriverImpl FactoryDataDriverImpl::sInstance; + +FactoryDataDriver & FactoryDataDrv() +{ + return FactoryDataDriverImpl::sInstance; +} + +FactoryDataDriverImpl & FactoryDataDrvImpl() +{ + return FactoryDataDriverImpl::sInstance; +} + +CHIP_ERROR FactoryDataDriverImpl::Init(void) +{ + mFactoryData = Nv_GetAppFactoryData(); + VerifyOrReturnError(mFactoryData != nullptr, CHIP_ERROR_INTERNAL); + + mSize = mFactoryData->extendedDataLength; + mMaxSize = FactoryDataProvider::kFactoryDataMaxSize; + + return CHIP_NO_ERROR; +} + +bool FactoryDataDriverImpl::DoesBackupExist(uint16_t * size) +{ + return false; +} + +CHIP_ERROR FactoryDataDriverImpl::DeleteBackup() +{ + CHIP_ERROR error = CHIP_NO_ERROR; + + error = KeyValueStoreMgr().Delete(FactoryDataDriverImpl::GetFactoryBackupKey().KeyName()); + ReturnErrorOnFailure(error); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR FactoryDataDriverImpl::InitRamBackup(void) +{ + CHIP_ERROR error = CHIP_NO_ERROR; + + VerifyOrReturnError(mFactoryData != nullptr, CHIP_ERROR_INTERNAL); + VerifyOrReturnError(mFactoryDataRamBuff == nullptr, CHIP_ERROR_INTERNAL); + + mFactoryDataRamBuff = static_cast(chip::Platform::MemoryAlloc(mMaxSize)); + ReturnErrorCodeIf(mFactoryDataRamBuff == nullptr, CHIP_ERROR_INTERNAL); + + memset(mFactoryDataRamBuff, 0, mMaxSize); + memcpy(mFactoryDataRamBuff, (void *) &mFactoryData->app_factory_data[0], mSize); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR FactoryDataDriverImpl::ClearRamBackup() +{ + VerifyOrReturnError(mFactoryDataRamBuff != nullptr, CHIP_ERROR_NO_MEMORY); + memset(mFactoryDataRamBuff, 0, mMaxSize); + chip::Platform::MemoryFree(mFactoryDataRamBuff); + + mFactoryDataRamBuff = nullptr; + + return CHIP_NO_ERROR; +} + +CHIP_ERROR FactoryDataDriverImpl::ReadBackupInRam() +{ + CHIP_ERROR error = CHIP_NO_ERROR; + size_t bytesRead = 0; + + if (mFactoryDataRamBuff == nullptr) + { + mFactoryDataRamBuff = static_cast(chip::Platform::MemoryAlloc(mMaxSize)); + ReturnErrorCodeIf(mFactoryDataRamBuff == nullptr, CHIP_ERROR_NO_MEMORY); + memset(mFactoryDataRamBuff, 0, mMaxSize); + } + + error = + KeyValueStoreMgr().Get(FactoryDataDriverImpl::GetFactoryBackupKey().KeyName(), mFactoryDataRamBuff, mMaxSize, &bytesRead); + ReturnErrorOnFailure(error); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR FactoryDataDriverImpl::BackupFactoryData() +{ + CHIP_ERROR error = CHIP_NO_ERROR; + ReturnErrorCodeIf(mFactoryData == nullptr, CHIP_ERROR_INTERNAL); + + error = KeyValueStoreMgr().Put(FactoryDataDriverImpl::GetFactoryBackupKey().KeyName(), &mFactoryData->app_factory_data[0], + mMaxSize); + ReturnErrorOnFailure(error); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR FactoryDataDriverImpl::UpdateFactoryData(void) +{ + FactoryDataProvider::Header * header; + extendedAppFactoryData_t * data; + VerifyOrReturnError(mFactoryDataRamBuff != nullptr, CHIP_ERROR_INTERNAL); + + header = (FactoryDataProvider::Header *) mFactoryDataRamBuff; + size_t size = offsetof(extendedAppFactoryData_t, app_factory_data) + sizeof(FactoryDataProvider::Header) + header->size; + data = static_cast(chip::Platform::MemoryAlloc(size)); + + memcpy(data->identificationWord, "APP_FACT_DATA: ", APP_FACTORY_DATA_ID_STRING_SZ); + + data->extendedDataLength = sizeof(FactoryDataProvider::Header) + header->size; + mSize = data->extendedDataLength; + memcpy(&data->app_factory_data[0], mFactoryDataRamBuff, mSize); + uint8_t status = Nv_WriteAppFactoryData(data, mSize); + VerifyOrReturnError(status == 0, CHIP_ERROR_INTERNAL); + + chip::Platform::MemoryFree(data); + + return CHIP_NO_ERROR; +} + +} // namespace DeviceLayer +} // namespace chip diff --git a/src/platform/nxp/k32w1/FactoryDataDriverImpl.h b/src/platform/nxp/k32w1/FactoryDataDriverImpl.h new file mode 100644 index 00000000000000..8b3e77358c6d47 --- /dev/null +++ b/src/platform/nxp/k32w1/FactoryDataDriverImpl.h @@ -0,0 +1,59 @@ +/* + * + * 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. + */ +#pragma once + +#include +#include +#include +#include + +extern "C" { +#include "HWParameter.h" +} + +namespace chip { +namespace DeviceLayer { + +/** + * This class implements the FactoryDataDriver with K32W1 specific functions + */ + +class FactoryDataDriverImpl : public FactoryDataDriver +{ +public: + static FactoryDataDriverImpl sInstance; + + FactoryDataDriverImpl() = default; + ~FactoryDataDriverImpl() = default; + + bool DoesBackupExist(uint16_t *) override; + CHIP_ERROR Init() override; + CHIP_ERROR DeleteBackup(void) override; + CHIP_ERROR InitRamBackup(void) override; + CHIP_ERROR ClearRamBackup(void) override; + CHIP_ERROR ReadBackupInRam(void) override; + CHIP_ERROR BackupFactoryData(void) override; + CHIP_ERROR UpdateFactoryData(void) override; + + static StorageKeyName GetFactoryBackupKey() { return StorageKeyName::FromConst("nxp/fact-bkp"); } + +private: + extendedAppFactoryData_t * mFactoryData = nullptr; +}; + +} // namespace DeviceLayer +} // namespace chip diff --git a/src/platform/nxp/k32w/k32w1/FactoryDataProviderImpl.cpp b/src/platform/nxp/k32w1/FactoryDataProviderImpl.cpp similarity index 70% rename from src/platform/nxp/k32w/k32w1/FactoryDataProviderImpl.cpp rename to src/platform/nxp/k32w1/FactoryDataProviderImpl.cpp index 764e3f6ac48300..f3af97803b13d0 100644 --- a/src/platform/nxp/k32w/k32w1/FactoryDataProviderImpl.cpp +++ b/src/platform/nxp/k32w1/FactoryDataProviderImpl.cpp @@ -14,9 +14,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include +#include +#include #include "fsl_adapter_flash.h" -#include + +#if CONFIG_CHIP_OTA_FACTORY_DATA_PROCESSOR +extern "C" WEAK CHIP_ERROR FactoryDataDefaultRestoreMechanism(); +#endif + +using namespace chip::DeviceLayer::PersistedStorage; namespace chip { namespace DeviceLayer { @@ -27,6 +35,27 @@ static constexpr size_t kSssBlobMetadataLength = 24; static constexpr size_t kPrivateKeyBlobLength = Crypto::kP256_PrivateKey_Length + kSssBlobMetadataLength; #endif +uint32_t FactoryDataProvider::kFactoryDataMaxSize = 0x800; + +FactoryDataProviderImpl FactoryDataProviderImpl::sInstance; + +FactoryDataProvider & FactoryDataPrvd() +{ + return FactoryDataProviderImpl::sInstance; +} + +FactoryDataProviderImpl & FactoryDataPrvdImpl() +{ + return FactoryDataProviderImpl::sInstance; +} + +FactoryDataProviderImpl::FactoryDataProviderImpl() +{ +#if CONFIG_CHIP_OTA_FACTORY_DATA_PROCESSOR + RegisterRestoreMechanism(FactoryDataDefaultRestoreMechanism); +#endif +} + FactoryDataProviderImpl::~FactoryDataProviderImpl() { #if !CHIP_USE_PLAIN_DAC_KEY @@ -38,11 +67,27 @@ CHIP_ERROR FactoryDataProviderImpl::Init() { CHIP_ERROR error = CHIP_NO_ERROR; + mFactoryData = Nv_GetAppFactoryData(); + VerifyOrReturnError(mFactoryData != nullptr, CHIP_ERROR_INTERNAL); + + mConfig.start = (uint32_t) &mFactoryData->app_factory_data[0]; + mConfig.size = mFactoryData->extendedDataLength; + mConfig.payload = mConfig.start + sizeof(FactoryDataProvider::Header); + +#if CONFIG_CHIP_OTA_FACTORY_DATA_PROCESSOR + mFactoryDataDriver = &FactoryDataDrv(); + ReturnErrorOnFailure(PostResetCheck()); +#endif + #if CHIP_DEVICE_CONFIG_ENABLE_SSS_API_TEST && !CHIP_USE_PLAIN_DAC_KEY SSS_RunApiTest(); #endif +#if CONFIG_CHIP_OTA_FACTORY_DATA_PROCESSOR + error = ValidateWithRestore(); +#else error = Validate(); +#endif if (error != CHIP_NO_ERROR) { ChipLogError(DeviceLayer, "Factory data init failed with: %s", ErrorStr(error)); @@ -60,41 +105,7 @@ CHIP_ERROR FactoryDataProviderImpl::Init() #if CHIP_USE_PLAIN_DAC_KEY CHIP_ERROR FactoryDataProviderImpl::SignWithDacKey(const ByteSpan & messageToSign, MutableByteSpan & outSignBuffer) { - CHIP_ERROR error = CHIP_NO_ERROR; - Crypto::P256ECDSASignature signature; - Crypto::P256Keypair keypair; - Crypto::P256SerializedKeypair serializedKeypair; - uint8_t keyBuf[Crypto::kP256_PrivateKey_Length]; - MutableByteSpan dacPrivateKeySpan(keyBuf); - uint16_t keySize = 0; - - VerifyOrExit(!outSignBuffer.empty(), error = CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrExit(!messageToSign.empty(), error = CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrExit(outSignBuffer.size() >= signature.Capacity(), error = CHIP_ERROR_BUFFER_TOO_SMALL); - - /* Get private key of DAC certificate from reserved section */ - error = SearchForId(FactoryDataId::kDacPrivateKeyId, dacPrivateKeySpan.data(), dacPrivateKeySpan.size(), keySize); - SuccessOrExit(error); - dacPrivateKeySpan.reduce_size(keySize); - VerifyOrExit(keySize == Crypto::kP256_PrivateKey_Length, error = CHIP_ERROR_WRONG_KEY_TYPE); - - /* Only the private key is used when signing */ - error = serializedKeypair.SetLength(Crypto::kP256_PublicKey_Length + dacPrivateKeySpan.size()); - SuccessOrExit(error); - memcpy(serializedKeypair.Bytes() + Crypto::kP256_PublicKey_Length, dacPrivateKeySpan.data(), dacPrivateKeySpan.size()); - - error = keypair.Deserialize(serializedKeypair); - SuccessOrExit(error); - - error = keypair.ECDSA_sign_msg(messageToSign.data(), messageToSign.size(), signature); - SuccessOrExit(error); - - error = CopySpanToMutableSpan(ByteSpan{ signature.ConstBytes(), signature.Length() }, outSignBuffer); - -exit: - /* Sanitize temporary buffer */ - memset(keyBuf, 0, Crypto::kP256_PrivateKey_Length); - return error; + return FactoryDataProvider::SignWithDacKey(messageToSign, outSignBuffer); } #else @@ -164,11 +175,14 @@ CHIP_ERROR FactoryDataProviderImpl::SSS_ConvertDacKey() size_t blobSize = kPrivateKeyBlobLength; size_t newSize = sizeof(FactoryDataProvider::Header) + mHeader.size + kSssBlobMetadataLength; uint8_t blob[kPrivateKeyBlobLength] = { 0 }; - uint8_t * data = static_cast(chip::Platform::MemoryAlloc(newSize)); - uint32_t offset = 0; - bool convNeeded = true; + extendedAppFactoryData_t * data = static_cast( + chip::Platform::MemoryAlloc(offsetof(extendedAppFactoryData_t, app_factory_data) + newSize)); + uint32_t offset = 0; + bool convNeeded = true; + uint8_t status = 0; VerifyOrReturnError(data != nullptr, CHIP_ERROR_INTERNAL); + VerifyOrReturnError(mFactoryData != nullptr, CHIP_ERROR_INTERNAL); ReturnErrorOnFailure(SSS_ExportBlob(blob, &blobSize, offset, convNeeded)); if (!convNeeded) @@ -177,20 +191,17 @@ CHIP_ERROR FactoryDataProviderImpl::SSS_ConvertDacKey() chip::Platform::MemoryFree(data); return CHIP_NO_ERROR; } - ChipLogError(DeviceLayer, "SSS: extracted blob from DAC private key"); - hal_flash_status_t status = HAL_FlashRead(kFactoryDataStart, newSize - kSssBlobMetadataLength, data); - VerifyOrReturnError(status == kStatus_HAL_Flash_Success, CHIP_ERROR_INTERNAL); + memcpy(data, mFactoryData, offsetof(extendedAppFactoryData_t, app_factory_data) + mFactoryData->extendedDataLength); ChipLogError(DeviceLayer, "SSS: cached factory data in RAM"); - ReturnErrorOnFailure(ReplaceWithBlob(data, blob, blobSize, offset)); + ReturnErrorOnFailure(ReplaceWithBlob(&data->app_factory_data[0], blob, blobSize, offset)); ChipLogError(DeviceLayer, "SSS: replaced DAC private key with secured blob"); - status = HAL_FlashEraseSector(kFactoryDataStart, kFactoryDataSize); - VerifyOrReturnError(status == kStatus_HAL_Flash_Success, CHIP_ERROR_INTERNAL); - status = HAL_FlashProgramUnaligned(kFactoryDataStart, newSize, data); - VerifyOrReturnError(status == kStatus_HAL_Flash_Success, CHIP_ERROR_INTERNAL); + data->extendedDataLength = newSize; + status = Nv_WriteAppFactoryData(data, newSize); + VerifyOrReturnError(status == 0, CHIP_ERROR_INTERNAL); ChipLogError(DeviceLayer, "SSS: updated factory data"); memset(data, 0, newSize); @@ -255,6 +266,107 @@ CHIP_ERROR FactoryDataProviderImpl::ReplaceWithBlob(uint8_t * data, uint8_t * bl return CHIP_NO_ERROR; } +#if CONFIG_CHIP_OTA_FACTORY_DATA_PROCESSOR + +extern "C" WEAK CHIP_ERROR FactoryDataDefaultRestoreMechanism() +{ + CHIP_ERROR error = CHIP_NO_ERROR; + FactoryDataDriver * driver = &FactoryDataDrv(); + + ReturnErrorCodeIf(driver == nullptr, CHIP_ERROR_INTERNAL); + + // Check if key related to factory data backup exists. + // If it does, it means an external event (such as a power loss) + // interrupted the factory data update process and the section + // from internal flash is most likely erased and should be restored. + error = driver->ReadBackupInRam(); + + if (error == CHIP_NO_ERROR) + { + error = driver->UpdateFactoryData(); + if (error == CHIP_NO_ERROR) + { + ChipLogProgress(DeviceLayer, "Factory data was restored successfully"); + } + } + + ReturnErrorOnFailure(driver->ClearRamBackup()); + + if (error == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND) + return CHIP_NO_ERROR; + + return error; +} + +CHIP_ERROR FactoryDataProviderImpl::PreResetCheck() +{ + OTARequestorInterface * requestor = nullptr; + uint32_t targetVersion; + /* Check integrity of freshly copied data. If validation fails, OTA will be aborted + * and factory data will be restored to the previous version. Use device instance info + * provider getter to access the factory data provider instance. The instance is created + * by the application, so it's easier to access it this way.*/ + ReturnErrorOnFailure(Validate()); + + requestor = GetRequestorInstance(); + VerifyOrReturnError(requestor != nullptr, CHIP_ERROR_INVALID_ADDRESS); + + targetVersion = requestor->GetTargetVersion(); + ReturnErrorOnFailure(FactoryDataProviderImpl::SaveTargetVersion(targetVersion)); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR FactoryDataProviderImpl::PostResetCheck() +{ + CHIP_ERROR err = CHIP_NO_ERROR; + uint32_t targetVersion, currentVersion; + + err = FactoryDataProviderImpl::GetTargetVersion(targetVersion); + if (err != CHIP_NO_ERROR) + ChipLogProgress(DeviceLayer, "Could not get target version"); + + err = DeviceLayer::ConfigurationMgr().GetSoftwareVersion(currentVersion); + if (err != CHIP_NO_ERROR) + ChipLogProgress(DeviceLayer, "Could not get current version"); + + if (targetVersion == currentVersion) + { + ChipLogProgress(DeviceLayer, "OTA successfully applied"); + // If this point is reached, it means the new image successfully booted. + // Delete the factory data backup to stop doing a restore. + // This ensures that both the factory data and app were updated, otherwise + // revert to the backed up factory data. + mFactoryDataDriver->DeleteBackup(); + } + + return CHIP_NO_ERROR; +} + +CHIP_ERROR FactoryDataProviderImpl::GetTargetVersion(uint32_t & version) +{ + CHIP_ERROR error = CHIP_NO_ERROR; + uint16_t len = sizeof(uint32_t); + size_t bytesRead = 0; + + error = KeyValueStoreMgr().Get(FactoryDataProviderImpl::GetTargetVersionKey().KeyName(), (uint8_t *) &version, len, &bytesRead); + ReturnErrorOnFailure(error); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR FactoryDataProviderImpl::SaveTargetVersion(uint32_t & version) +{ + CHIP_ERROR error = CHIP_NO_ERROR; + + error = + KeyValueStoreMgr().Put(FactoryDataProviderImpl::GetTargetVersionKey().KeyName(), (uint8_t *) &version, sizeof(uint32_t)); + ReturnErrorOnFailure(error); + + return CHIP_NO_ERROR; +} +#endif // CONFIG_CHIP_OTA_FACTORY_DATA_PROCESSOR + #if CHIP_DEVICE_CONFIG_ENABLE_SSS_API_TEST #define _assert(condition) \ diff --git a/src/platform/nxp/k32w/k32w1/FactoryDataProviderImpl.h b/src/platform/nxp/k32w1/FactoryDataProviderImpl.h similarity index 81% rename from src/platform/nxp/k32w/k32w1/FactoryDataProviderImpl.h rename to src/platform/nxp/k32w1/FactoryDataProviderImpl.h index f81b5d141837df..d7f15bba4ed422 100644 --- a/src/platform/nxp/k32w/k32w1/FactoryDataProviderImpl.h +++ b/src/platform/nxp/k32w1/FactoryDataProviderImpl.h @@ -17,12 +17,18 @@ #pragma once #include -#include +#include +#include +#include #if !CHIP_USE_PLAIN_DAC_KEY #include "sss_crypto.h" #endif +extern "C" { +#include "HWParameter.h" +} + /* This flag should be defined to run SSS_RunApiTest tests. */ #ifndef CHIP_DEVICE_CONFIG_ENABLE_SSS_API_TEST @@ -35,16 +41,31 @@ namespace DeviceLayer { /** * This class extends the default FactoryDataProvider functionality * by leveraging the secure subsystem for signing messages. + * CONFIG_CHIP_OTA_FACTORY_DATA_PROCESSOR - enables factory data OTA */ class FactoryDataProviderImpl : public FactoryDataProvider { public: + static FactoryDataProviderImpl sInstance; + + FactoryDataProviderImpl(); ~FactoryDataProviderImpl(); CHIP_ERROR Init() override; CHIP_ERROR SignWithDacKey(const ByteSpan & messageToSign, MutableByteSpan & outSignBuffer) override; +#if CONFIG_CHIP_OTA_FACTORY_DATA_PROCESSOR + + CHIP_ERROR PreResetCheck() override; + CHIP_ERROR PostResetCheck() override; + + static StorageKeyName GetTargetVersionKey() { return StorageKeyName::FromConst("nxp/tgt-sw-ver"); } + + static CHIP_ERROR GetTargetVersion(uint32_t & version); + static CHIP_ERROR SaveTargetVersion(uint32_t & version); +#endif + private: #if !CHIP_USE_PLAIN_DAC_KEY @@ -90,9 +111,13 @@ class FactoryDataProviderImpl : public FactoryDataProvider #if CHIP_DEVICE_CONFIG_ENABLE_SSS_API_TEST void SSS_RunApiTest(); #endif +#endif // CHIP_USE_PLAIN_DAC_KEY +private: + extendedAppFactoryData_t * mFactoryData = nullptr; +#if !CHIP_USE_PLAIN_DAC_KEY sss_sscp_object_t mContext; -#endif // CHIP_USE_PLAIN_DAC_KEY +#endif }; } // namespace DeviceLayer diff --git a/src/platform/nxp/k32w/k32w1/InetPlatformConfig.h b/src/platform/nxp/k32w1/InetPlatformConfig.h similarity index 100% rename from src/platform/nxp/k32w/k32w1/InetPlatformConfig.h rename to src/platform/nxp/k32w1/InetPlatformConfig.h diff --git a/src/platform/nxp/k32w/k32w1/K32W1Config.cpp b/src/platform/nxp/k32w1/K32W1Config.cpp similarity index 87% rename from src/platform/nxp/k32w/k32w1/K32W1Config.cpp rename to src/platform/nxp/k32w1/K32W1Config.cpp index 2019fce5811eba..6f578f8ed01624 100644 --- a/src/platform/nxp/k32w/k32w1/K32W1Config.cpp +++ b/src/platform/nxp/k32w1/K32W1Config.cpp @@ -25,7 +25,7 @@ /* this file behaves like a config.h, comes first */ #include -#include +#include #include #include @@ -110,7 +110,7 @@ static rsError AddToRamStorage(ramBufferDescriptor * pBuffer, uint16_t aKey, con return err; } -CHIP_ERROR K32WConfig::Init() +CHIP_ERROR NXPConfig::Init() { CHIP_ERROR err = CHIP_NO_ERROR; bool bLoadDataFromNvm = true; @@ -148,7 +148,7 @@ CHIP_ERROR K32WConfig::Init() return err; } -CHIP_ERROR K32WConfig::ReadConfigValue(Key key, bool & val) +CHIP_ERROR NXPConfig::ReadConfigValue(Key key, bool & val) { CHIP_ERROR err; bool tempVal; @@ -164,7 +164,7 @@ CHIP_ERROR K32WConfig::ReadConfigValue(Key key, bool & val) return err; } -CHIP_ERROR K32WConfig::ReadConfigValue(Key key, uint32_t & val) +CHIP_ERROR NXPConfig::ReadConfigValue(Key key, uint32_t & val) { CHIP_ERROR err; uint32_t tempVal; @@ -180,7 +180,7 @@ CHIP_ERROR K32WConfig::ReadConfigValue(Key key, uint32_t & val) return err; } -CHIP_ERROR K32WConfig::ReadConfigValue(Key key, uint64_t & val) +CHIP_ERROR NXPConfig::ReadConfigValue(Key key, uint64_t & val) { CHIP_ERROR err; uint32_t tempVal; @@ -196,7 +196,7 @@ CHIP_ERROR K32WConfig::ReadConfigValue(Key key, uint64_t & val) return err; } -CHIP_ERROR K32WConfig::ReadConfigValueStr(Key key, char * buf, size_t bufSize, size_t & outLen) +CHIP_ERROR NXPConfig::ReadConfigValueStr(Key key, char * buf, size_t bufSize, size_t & outLen) { CHIP_ERROR err; rsError status; @@ -213,18 +213,18 @@ CHIP_ERROR K32WConfig::ReadConfigValueStr(Key key, char * buf, size_t bufSize, s return err; } -CHIP_ERROR K32WConfig::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen) +CHIP_ERROR NXPConfig::ReadConfigValueBin(Key key, uint8_t * buf, size_t bufSize, size_t & outLen) { return ReadConfigValueStr(key, (char *) buf, bufSize, outLen); } -CHIP_ERROR K32WConfig::ReadConfigValueCounter(uint8_t counterIdx, uint32_t & val) +CHIP_ERROR NXPConfig::ReadConfigValueCounter(uint8_t counterIdx, uint32_t & val) { Key key = kMinConfigKey_ChipCounter + counterIdx; return ReadConfigValue(key, val); } -CHIP_ERROR K32WConfig::WriteConfigValue(Key key, bool val) +CHIP_ERROR NXPConfig::WriteConfigValue(Key key, bool val) { CHIP_ERROR err; rsError status; @@ -242,7 +242,7 @@ CHIP_ERROR K32WConfig::WriteConfigValue(Key key, bool val) return err; } -CHIP_ERROR K32WConfig::WriteConfigValueSync(Key key, bool val) +CHIP_ERROR NXPConfig::WriteConfigValueSync(Key key, bool val) { CHIP_ERROR err; rsError status; @@ -260,7 +260,7 @@ CHIP_ERROR K32WConfig::WriteConfigValueSync(Key key, bool val) return err; } -CHIP_ERROR K32WConfig::WriteConfigValue(Key key, uint32_t val) +CHIP_ERROR NXPConfig::WriteConfigValue(Key key, uint32_t val) { CHIP_ERROR err; rsError status; @@ -278,7 +278,7 @@ CHIP_ERROR K32WConfig::WriteConfigValue(Key key, uint32_t val) return err; } -CHIP_ERROR K32WConfig::WriteConfigValue(Key key, uint64_t val) +CHIP_ERROR NXPConfig::WriteConfigValue(Key key, uint64_t val) { CHIP_ERROR err; rsError status; @@ -296,12 +296,12 @@ CHIP_ERROR K32WConfig::WriteConfigValue(Key key, uint64_t val) return err; } -CHIP_ERROR K32WConfig::WriteConfigValueStr(Key key, const char * str) +CHIP_ERROR NXPConfig::WriteConfigValueStr(Key key, const char * str) { return WriteConfigValueStr(key, str, (str != NULL) ? strlen(str) : 0); } -CHIP_ERROR K32WConfig::WriteConfigValueStr(Key key, const char * str, size_t strLen) +CHIP_ERROR NXPConfig::WriteConfigValueStr(Key key, const char * str, size_t strLen) { CHIP_ERROR err; rsError status; @@ -327,18 +327,18 @@ CHIP_ERROR K32WConfig::WriteConfigValueStr(Key key, const char * str, size_t str return err; } -CHIP_ERROR K32WConfig::WriteConfigValueBin(Key key, const uint8_t * data, size_t dataLen) +CHIP_ERROR NXPConfig::WriteConfigValueBin(Key key, const uint8_t * data, size_t dataLen) { return WriteConfigValueStr(key, (char *) data, dataLen); } -CHIP_ERROR K32WConfig::WriteConfigValueCounter(uint8_t counterIdx, uint32_t val) +CHIP_ERROR NXPConfig::WriteConfigValueCounter(uint8_t counterIdx, uint32_t val) { Key key = kMinConfigKey_ChipCounter + counterIdx; return WriteConfigValue(key, val); } -CHIP_ERROR K32WConfig::ClearConfigValue(Key key) +CHIP_ERROR NXPConfig::ClearConfigValue(Key key) { CHIP_ERROR err = CHIP_NO_ERROR; rsError status; @@ -355,7 +355,7 @@ CHIP_ERROR K32WConfig::ClearConfigValue(Key key) return err; } -bool K32WConfig::ConfigValueExists(Key key) +bool NXPConfig::ConfigValueExists(Key key) { rsError status; uint16_t sizeToRead; @@ -369,7 +369,7 @@ bool K32WConfig::ConfigValueExists(Key key) return found; } -CHIP_ERROR K32WConfig::FactoryResetConfig(void) +CHIP_ERROR NXPConfig::FactoryResetConfig(void) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -386,7 +386,7 @@ CHIP_ERROR K32WConfig::FactoryResetConfig(void) return err; } -void K32WConfig::FactoryResetConfigInternal(Key firstKey, Key lastKey) +void NXPConfig::FactoryResetConfigInternal(Key firstKey, Key lastKey) { for (Key key = firstKey; key <= lastKey; key++) { @@ -394,7 +394,7 @@ void K32WConfig::FactoryResetConfigInternal(Key firstKey, Key lastKey) } } -CHIP_ERROR K32WConfig::MapRamStorageStatus(rsError rsStatus) +CHIP_ERROR NXPConfig::MapRamStorageStatus(rsError rsStatus) { CHIP_ERROR err; @@ -414,7 +414,7 @@ CHIP_ERROR K32WConfig::MapRamStorageStatus(rsError rsStatus) return err; } -bool K32WConfig::ValidConfigKey(Key key) +bool NXPConfig::ValidConfigKey(Key key) { // Returns true if the key is in the valid CHIP Config PDM key range. if ((key >= kMinConfigKey_ChipFactory) && (key <= kMaxConfigKey_KVSValue)) @@ -425,7 +425,7 @@ bool K32WConfig::ValidConfigKey(Key key) return false; } -void K32WConfig::RunConfigUnitTest() {} +void NXPConfig::RunConfigUnitTest() {} } // namespace Internal } // namespace DeviceLayer diff --git a/src/platform/nxp/k32w/k32w1/K32W1Config.h b/src/platform/nxp/k32w1/K32W1Config.h similarity index 99% rename from src/platform/nxp/k32w/k32w1/K32W1Config.h rename to src/platform/nxp/k32w1/K32W1Config.h index a14b4d5cd10fdd..ceeae82a8dc273 100644 --- a/src/platform/nxp/k32w/k32w1/K32W1Config.h +++ b/src/platform/nxp/k32w1/K32W1Config.h @@ -49,7 +49,7 @@ constexpr inline uint16_t K32WConfigKey(uint8_t chipId, uint8_t nvmId) * naturally provides implementations for the delegated members referenced by * the template class (e.g. the ReadConfigValue() method). */ -class K32WConfig +class NXPConfig { public: // Category ids used by the CHIP Device Layer diff --git a/src/platform/nxp/k32w/k32w1/K32W1PersistentStorageOpKeystore.cpp b/src/platform/nxp/k32w1/K32W1PersistentStorageOpKeystore.cpp similarity index 100% rename from src/platform/nxp/k32w/k32w1/K32W1PersistentStorageOpKeystore.cpp rename to src/platform/nxp/k32w1/K32W1PersistentStorageOpKeystore.cpp diff --git a/src/platform/nxp/k32w/k32w1/K32W1PersistentStorageOpKeystore.h b/src/platform/nxp/k32w1/K32W1PersistentStorageOpKeystore.h similarity index 100% rename from src/platform/nxp/k32w/k32w1/K32W1PersistentStorageOpKeystore.h rename to src/platform/nxp/k32w1/K32W1PersistentStorageOpKeystore.h diff --git a/src/platform/nxp/k32w/k32w1/KeyValueStoreManagerImpl.cpp b/src/platform/nxp/k32w1/KeyValueStoreManagerImpl.cpp similarity index 85% rename from src/platform/nxp/k32w/k32w1/KeyValueStoreManagerImpl.cpp rename to src/platform/nxp/k32w1/KeyValueStoreManagerImpl.cpp index 6af22df6781d3b..f70c6abb6c9e83 100644 --- a/src/platform/nxp/k32w/k32w1/KeyValueStoreManagerImpl.cpp +++ b/src/platform/nxp/k32w1/KeyValueStoreManagerImpl.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include @@ -45,7 +45,7 @@ uint16_t GetStringKeyId(const char * key, uint16_t * freeId) { CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND; uint8_t keyId = 0; - uint8_t nvmIdKvsKey = chip::DeviceLayer::Internal::K32WConfig::kFileId_KVSKey; + uint8_t nvmIdKvsKey = chip::DeviceLayer::Internal::NXPConfig::kFileId_KVSKey; bool bFreeIdxFound = false; char keyString[kMaxKeyValueBytes] = { 0 }; size_t keyStringSize = 0; @@ -55,7 +55,7 @@ uint16_t GetStringKeyId(const char * key, uint16_t * freeId) { nvmInternalId = chip::DeviceLayer::Internal::K32WConfigKey(nvmIdKvsKey, keyId); err = - chip::DeviceLayer::Internal::K32WConfig::ReadConfigValueStr(nvmInternalId, keyString, kMaxKeyValueBytes, keyStringSize); + chip::DeviceLayer::Internal::NXPConfig::ReadConfigValueStr(nvmInternalId, keyString, kMaxKeyValueBytes, keyStringSize); if (err == CHIP_NO_ERROR) { @@ -78,7 +78,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t size_t offset_bytes) { CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND; - uint8_t nvmIdKvsValue = chip::DeviceLayer::Internal::K32WConfig::kFileId_KVSValue; + uint8_t nvmIdKvsValue = chip::DeviceLayer::Internal::NXPConfig::kFileId_KVSValue; size_t read_bytes = 0; uint8_t keyId = 0; uint16_t nvmInternalId = 0; @@ -92,7 +92,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t // This is the ID of the actual data nvmInternalId = chip::DeviceLayer::Internal::K32WConfigKey(nvmIdKvsValue, keyId); ChipLogProgress(DeviceLayer, "KVS, get the value of Matter key [%s] with NVM id: %i", key, nvmInternalId); - err = chip::DeviceLayer::Internal::K32WConfig::ReadConfigValueBin(nvmInternalId, (uint8_t *) value, value_size, read_bytes); + err = chip::DeviceLayer::Internal::NXPConfig::ReadConfigValueBin(nvmInternalId, (uint8_t *) value, value_size, read_bytes); // According to Get api read_bytes_size can be null if (read_bytes_size) @@ -115,8 +115,8 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Put(const char * key, const void * value, { CHIP_ERROR err = CHIP_ERROR_INVALID_ARGUMENT; bool_t putKey = false; - uint8_t nvmIdKvsKey = chip::DeviceLayer::Internal::K32WConfig::kFileId_KVSKey; - uint8_t nvmIdKvsValue = chip::DeviceLayer::Internal::K32WConfig::kFileId_KVSValue; + uint8_t nvmIdKvsKey = chip::DeviceLayer::Internal::NXPConfig::kFileId_KVSKey; + uint8_t nvmIdKvsValue = chip::DeviceLayer::Internal::NXPConfig::kFileId_KVSValue; uint16_t nvmInternalId = 0; uint16_t freeKeyId; uint8_t keyId; @@ -135,7 +135,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Put(const char * key, const void * value, nvmInternalId = chip::DeviceLayer::Internal::K32WConfigKey(nvmIdKvsValue, keyId); ChipLogProgress(DeviceLayer, "KVS, save in flash the value of the Matter key [%s] with NVM id: %i", key, nvmInternalId); - err = chip::DeviceLayer::Internal::K32WConfig::WriteConfigValueBin(nvmInternalId, (uint8_t *) value, value_size); + err = chip::DeviceLayer::Internal::NXPConfig::WriteConfigValueBin(nvmInternalId, (uint8_t *) value, value_size); /* save the 'key' in flash such that it can be retrieved later on */ if (err == CHIP_NO_ERROR) @@ -145,7 +145,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Put(const char * key, const void * value, nvmInternalId = chip::DeviceLayer::Internal::K32WConfigKey(nvmIdKvsKey, keyId); ChipLogProgress(DeviceLayer, "KVS, save in flash the Matter key [%s] with NVM id: %i", key, nvmInternalId); - err = chip::DeviceLayer::Internal::K32WConfig::WriteConfigValueStr(nvmInternalId, key, strlen(key) + 1); + err = chip::DeviceLayer::Internal::NXPConfig::WriteConfigValueStr(nvmInternalId, key, strlen(key) + 1); if (err != CHIP_NO_ERROR) { @@ -168,8 +168,8 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Put(const char * key, const void * value, CHIP_ERROR KeyValueStoreManagerImpl::_Delete(const char * key) { CHIP_ERROR err = CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND; - uint8_t nvmIdKvsKey = chip::DeviceLayer::Internal::K32WConfig::kFileId_KVSKey; - uint8_t nvmIdKvsValue = chip::DeviceLayer::Internal::K32WConfig::kFileId_KVSValue; + uint8_t nvmIdKvsKey = chip::DeviceLayer::Internal::NXPConfig::kFileId_KVSKey; + uint8_t nvmIdKvsValue = chip::DeviceLayer::Internal::NXPConfig::kFileId_KVSValue; uint8_t keyId = 0; uint16_t nvmInternalId = 0; @@ -183,7 +183,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Delete(const char * key) nvmInternalId = chip::DeviceLayer::Internal::K32WConfigKey(nvmIdKvsKey, keyId); ChipLogProgress(DeviceLayer, "KVS, delete from flash the Matter key [%s] with NVM id: %i", key, nvmInternalId); - err = chip::DeviceLayer::Internal::K32WConfig::ClearConfigValue(nvmInternalId); + err = chip::DeviceLayer::Internal::NXPConfig::ClearConfigValue(nvmInternalId); /* also delete the 'key string' from flash */ if (err == CHIP_NO_ERROR) @@ -192,7 +192,7 @@ CHIP_ERROR KeyValueStoreManagerImpl::_Delete(const char * key) ChipLogProgress(DeviceLayer, "KVS, delete from flash the value of the Matter key [%s] with NVM id: %i", key, nvmInternalId); - err = chip::DeviceLayer::Internal::K32WConfig::ClearConfigValue(nvmInternalId); + err = chip::DeviceLayer::Internal::NXPConfig::ClearConfigValue(nvmInternalId); if (err != CHIP_NO_ERROR) { diff --git a/src/platform/nxp/k32w/k32w1/KeyValueStoreManagerImpl.h b/src/platform/nxp/k32w1/KeyValueStoreManagerImpl.h similarity index 100% rename from src/platform/nxp/k32w/k32w1/KeyValueStoreManagerImpl.h rename to src/platform/nxp/k32w1/KeyValueStoreManagerImpl.h diff --git a/src/platform/nxp/k32w/k32w1/Logging.cpp b/src/platform/nxp/k32w1/Logging.cpp similarity index 98% rename from src/platform/nxp/k32w/k32w1/Logging.cpp rename to src/platform/nxp/k32w1/Logging.cpp index 8f8aedd66741f8..8efa4539fdaa84 100644 --- a/src/platform/nxp/k32w/k32w1/Logging.cpp +++ b/src/platform/nxp/k32w1/Logging.cpp @@ -12,7 +12,7 @@ #include "fsl_debug_console.h" #include -#ifdef PW_RPC_ENABLED +#ifdef CONFIG_ENABLE_PW_RPC #include #endif @@ -113,7 +113,7 @@ void ENFORCE_FORMAT(1, 0) GenericLog(const char * format, va_list arg, const cha if (!isLogInitialized) { isLogInitialized = true; -#ifndef PW_RPC_ENABLED +#ifndef CONFIG_ENABLE_PW_RPC otPlatUartEnable(); #endif } @@ -127,7 +127,7 @@ void ENFORCE_FORMAT(1, 0) GenericLog(const char * format, va_list arg, const cha VerifyOrDie(writtenLen > 0); memcpy(formattedMsg + prefixLen + writtenLen, EOL_CHARS, EOL_CHARS_LEN); -#ifndef PW_RPC_ENABLED +#ifndef CONFIG_ENABLE_PW_RPC otPlatUartSendBlocking((const uint8_t *) formattedMsg, strlen(formattedMsg)); #else PigweedLogger::PutString((const char *) formattedMsg, strlen(formattedMsg)); diff --git a/src/platform/nxp/k32w/k32w1/LowPowerHooks.cpp b/src/platform/nxp/k32w1/LowPowerHooks.cpp similarity index 100% rename from src/platform/nxp/k32w/k32w1/LowPowerHooks.cpp rename to src/platform/nxp/k32w1/LowPowerHooks.cpp diff --git a/src/platform/nxp/k32w/k32w1/OTAFirmwareProcessor.cpp b/src/platform/nxp/k32w1/OTAFirmwareProcessor.cpp similarity index 96% rename from src/platform/nxp/k32w/k32w1/OTAFirmwareProcessor.cpp rename to src/platform/nxp/k32w1/OTAFirmwareProcessor.cpp index ee3ff9b655c504..33eed513ba033c 100644 --- a/src/platform/nxp/k32w/k32w1/OTAFirmwareProcessor.cpp +++ b/src/platform/nxp/k32w1/OTAFirmwareProcessor.cpp @@ -17,8 +17,8 @@ */ #include -#include -#include +#include +#include #include "OtaSupport.h" diff --git a/src/platform/nxp/k32w/k32w1/OTAFirmwareProcessor.h b/src/platform/nxp/k32w1/OTAFirmwareProcessor.h similarity index 96% rename from src/platform/nxp/k32w/k32w1/OTAFirmwareProcessor.h rename to src/platform/nxp/k32w1/OTAFirmwareProcessor.h index c06a2342ba08d6..b8bb3abd008e7a 100644 --- a/src/platform/nxp/k32w/k32w1/OTAFirmwareProcessor.h +++ b/src/platform/nxp/k32w1/OTAFirmwareProcessor.h @@ -20,7 +20,7 @@ #include "OtaPrivate.h" #include -#include +#include /* Posted Operations Size Info */ #define NB_PENDING_TRANSACTIONS 12 diff --git a/src/platform/nxp/k32w/k32w1/OTAHooks.cpp b/src/platform/nxp/k32w1/OTAHooks.cpp similarity index 82% rename from src/platform/nxp/k32w/k32w1/OTAHooks.cpp rename to src/platform/nxp/k32w1/OTAHooks.cpp index c045a111618e49..3bbabaa274fba4 100644 --- a/src/platform/nxp/k32w/k32w1/OTAHooks.cpp +++ b/src/platform/nxp/k32w1/OTAHooks.cpp @@ -16,12 +16,16 @@ * limitations under the License. */ -#include +#include #include #include -#include +#include +#if CONFIG_CHIP_OTA_FACTORY_DATA_PROCESSOR +#include +#include +#endif // CONFIG_CHIP_OTA_FACTORY_DATA_PROCESSOR #include "OtaSupport.h" @@ -34,6 +38,7 @@ #endif #define APPLICATION_PROCESSOR_TAG 1 +#define FACTORY_DATA_PROCESSOR_TAG 3 extern "C" void HAL_ResetMCU(void); @@ -60,10 +65,17 @@ extern "C" WEAK CHIP_ERROR OtaHookInit() static chip::OTAFirmwareProcessor processors[8]; #endif +#if CONFIG_CHIP_OTA_FACTORY_DATA_PROCESSOR + static chip::OTAFactoryDataProcessor sFactoryDataProcessor; +#endif // CONFIG_CHIP_OTA_FACTORY_DATA_PROCESSOR + gApplicationProcessor.RegisterDescriptorCallback(ProcessDescriptor); auto & imageProcessor = chip::OTAImageProcessorImpl::GetDefaultInstance(); ReturnErrorOnFailure(imageProcessor.RegisterProcessor(APPLICATION_PROCESSOR_TAG, &gApplicationProcessor)); +#if CONFIG_CHIP_OTA_FACTORY_DATA_PROCESSOR + ReturnErrorOnFailure(imageProcessor.RegisterProcessor(FACTORY_DATA_PROCESSOR_TAG, &sFactoryDataProcessor)); +#endif // CONFIG_CHIP_OTA_FACTORY_DATA_PROCESSOR #if CONFIG_CHIP_K32W1_MAX_ENTRIES_TEST for (auto i = 0; i < 8; i++) @@ -78,8 +90,11 @@ extern "C" WEAK CHIP_ERROR OtaHookInit() extern "C" WEAK void OtaHookReset() { +#if (CHIP_PLAT_NVM_SUPPORT == 1) // Process all idle saves NvShutdown(); +#endif + // Set the bootloader flags OTA_SetNewImageFlag(); ResetMCU(); diff --git a/src/platform/nxp/k32w/k32w1/PlatformManagerImpl.cpp b/src/platform/nxp/k32w1/PlatformManagerImpl.cpp similarity index 80% rename from src/platform/nxp/k32w/k32w1/PlatformManagerImpl.cpp rename to src/platform/nxp/k32w1/PlatformManagerImpl.cpp index 40d747fc8a21d5..964884e77523c6 100644 --- a/src/platform/nxp/k32w/k32w1/PlatformManagerImpl.cpp +++ b/src/platform/nxp/k32w1/PlatformManagerImpl.cpp @@ -26,11 +26,17 @@ #include #include +#include #include #include #include -#include -#include +#ifdef EXTERNAL_CONFIGURATIONMANAGERIMPL_HEADER +#include EXTERNAL_CONFIGURATIONMANAGERIMPL_HEADER +#else +#include +#endif +#include +#include #if CHIP_SYSTEM_CONFIG_USE_LWIP #include @@ -40,7 +46,10 @@ #include "fwk_platform.h" #include +#include + extern "C" void HAL_ResetMCU(void); +extern "C" void freertos_mbedtls_mutex_init(void); extern uint8_t __data_end__[], m_data0_end[]; memAreaCfg_t data0Heap = { .start_address = (void *) __data_end__, .end_address = (void *) m_data0_end }; @@ -60,7 +69,19 @@ namespace DeviceLayer { PlatformManagerImpl PlatformManagerImpl::sInstance; -CHIP_ERROR PlatformManagerImpl::InitBoardFwk(void) +void PlatformManagerImpl::HardwareInit(void) +{ + mbedtls_platform_set_calloc_free(CHIPPlatformMemoryCalloc, CHIPPlatformMemoryFree); + + /* Used for HW initializations */ + otSysInit(0, NULL); + + /* Mbedtls Threading support is needed because both + * Thread and Matter tasks are using it */ + freertos_mbedtls_mutex_init(); +} + +CHIP_ERROR PlatformManagerImpl::ServiceInit(void) { mem_status_t memSt = kStatus_MemSuccess; @@ -71,11 +92,12 @@ CHIP_ERROR PlatformManagerImpl::InitBoardFwk(void) return CHIP_NO_ERROR; } + void PlatformManagerImpl::CleanReset() { StopEventLoopTask(); Shutdown(); -#if CHIP_PLAT_NVM_SUPPORT +#if (CHIP_PLAT_NVM_SUPPORT == 1) NvCompletePendingOperations(); #endif HAL_ResetMCU(); @@ -99,7 +121,10 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) CHIP_ERROR err = CHIP_NO_ERROR; // Initialize the configuration system. - err = Internal::K32WConfig::Init(); + err = Internal::NXPConfig::Init(); + SuccessOrExit(err); + + err = ServiceInit(); SuccessOrExit(err); SetConfigurationMgr(&ConfigurationManagerImpl::GetDefaultInstance()); @@ -119,6 +144,10 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void) err = Internal::GenericPlatformManagerImpl_FreeRTOS::_InitChipStack(); SuccessOrExit(err); +#if USE_SMU2_DYNAMIC + ReturnErrorOnFailure(SMU2::Init()); +#endif + exit: return err; } diff --git a/src/platform/nxp/k32w/k32w1/PlatformManagerImpl.h b/src/platform/nxp/k32w1/PlatformManagerImpl.h similarity index 96% rename from src/platform/nxp/k32w/k32w1/PlatformManagerImpl.h rename to src/platform/nxp/k32w1/PlatformManagerImpl.h index 6798cb911ee377..ae1ef0ad3eb25f 100644 --- a/src/platform/nxp/k32w/k32w1/PlatformManagerImpl.h +++ b/src/platform/nxp/k32w1/PlatformManagerImpl.h @@ -49,8 +49,10 @@ class PlatformManagerImpl final : public PlatformManager, public Internal::Gener // ===== Platform-specific members that may be accessed directly by the application. System::Clock::Timestamp GetStartTime() { return mStartTime; } - CHIP_ERROR InitBoardFwk(void); + void HardwareInit(void); + CHIP_ERROR ServiceInit(void); void CleanReset(); + void StopBLEConnectivity() {} private: // ===== Methods that implement the PlatformManager abstract interface. diff --git a/src/platform/nxp/k32w/k32w1/SMU2Manager.cpp b/src/platform/nxp/k32w1/SMU2Manager.cpp similarity index 99% rename from src/platform/nxp/k32w/k32w1/SMU2Manager.cpp rename to src/platform/nxp/k32w1/SMU2Manager.cpp index f7c54ea7c796b7..6f941b3f10d28b 100644 --- a/src/platform/nxp/k32w/k32w1/SMU2Manager.cpp +++ b/src/platform/nxp/k32w1/SMU2Manager.cpp @@ -123,6 +123,7 @@ CHIP_ERROR Init() if (mUseAllocator) { + ResetBLEController(); RegisterArea(); } diff --git a/src/platform/nxp/k32w/k32w1/SMU2Manager.h b/src/platform/nxp/k32w1/SMU2Manager.h similarity index 100% rename from src/platform/nxp/k32w/k32w1/SMU2Manager.h rename to src/platform/nxp/k32w1/SMU2Manager.h diff --git a/src/platform/nxp/k32w/k32w1/SystemPlatformConfig.h b/src/platform/nxp/k32w1/SystemPlatformConfig.h similarity index 100% rename from src/platform/nxp/k32w/k32w1/SystemPlatformConfig.h rename to src/platform/nxp/k32w1/SystemPlatformConfig.h diff --git a/src/platform/nxp/k32w/k32w1/SystemTimeSupport.cpp b/src/platform/nxp/k32w1/SystemTimeSupport.cpp similarity index 100% rename from src/platform/nxp/k32w/k32w1/SystemTimeSupport.cpp rename to src/platform/nxp/k32w1/SystemTimeSupport.cpp diff --git a/src/platform/nxp/k32w/k32w1/ThreadStackManagerImpl.cpp b/src/platform/nxp/k32w1/ThreadStackManagerImpl.cpp similarity index 90% rename from src/platform/nxp/k32w/k32w1/ThreadStackManagerImpl.cpp rename to src/platform/nxp/k32w1/ThreadStackManagerImpl.cpp index 89c63694fed168..c7b16ffd3e5c6a 100644 --- a/src/platform/nxp/k32w/k32w1/ThreadStackManagerImpl.cpp +++ b/src/platform/nxp/k32w1/ThreadStackManagerImpl.cpp @@ -35,7 +35,7 @@ #include #if defined(USE_SMU2_DYNAMIC) -#include +#include #endif #include @@ -89,6 +89,18 @@ bool ThreadStackManagerImpl::IsInitialized() using namespace ::chip; using namespace ::chip::DeviceLayer; +/** + * Glue function called directly by the OpenThread stack + * when system event processing work is pending. + */ +extern "C" void otSysEventSignalPending(void) +{ + { + BaseType_t yieldRequired = chip::DeviceLayer::ThreadStackMgrImpl().SignalThreadActivityPendingFromISR(); + portYIELD_FROM_ISR(yieldRequired); + } +} + /** * Glue function called directly by the OpenThread stack when tasklet processing work * is pending. diff --git a/src/platform/nxp/k32w/k32w1/ThreadStackManagerImpl.h b/src/platform/nxp/k32w1/ThreadStackManagerImpl.h similarity index 100% rename from src/platform/nxp/k32w/k32w1/ThreadStackManagerImpl.h rename to src/platform/nxp/k32w1/ThreadStackManagerImpl.h diff --git a/src/platform/nxp/k32w/k32w1/args.gni b/src/platform/nxp/k32w1/args.gni similarity index 72% rename from src/platform/nxp/k32w/k32w1/args.gni rename to src/platform/nxp/k32w1/args.gni index 8b90982be93ca3..1c984c386ea086 100644 --- a/src/platform/nxp/k32w/k32w1/args.gni +++ b/src/platform/nxp/k32w1/args.gni @@ -19,15 +19,28 @@ import("//build_overrides/openthread.gni") declare_args() { chip_with_ot_cli = 0 chip_with_low_power = 0 - sdk_release = 1 + sdk_release = false + k32w1_sdk_root = "" + + # The key storage solution. Developers can select between "littlefs", "nvs" + # and the older "fwk_nvm". + chip_key_storage = "nvs" + chip_use_plain_dac_key = false + + k32w1_sdk_root = "${nxp_sdk_matter_support_root}/github_sdk/common_sdk/repo" +} + +if (sdk_release || getenv("NXP_SDK_ROOT") != "") { + k32w1_sdk_root = getenv("NXP_SDK_ROOT") } -nxp_platform = "k32w/k32w1" +openthread_root = + "//third_party/connectedhomeip/third_party/openthread/ot-nxp/openthread" +nxp_platform = "k32w1" nxp_sdk_name = "k32w1_sdk" nxp_device_layer = "nxp/${nxp_platform}" nxp_use_lwip = false -nxp_use_mbedtls_port = false # ARM architecture flags will be set based on NXP board. arm_platform_config = "${nxp_sdk_build_root}/${nxp_sdk_name}/nxp_arm.gni" @@ -39,8 +52,6 @@ chip_project_config_include = "" chip_inet_project_config_include = "" chip_system_project_config_include = "" chip_ble_project_config_include = "" -chip_project_config_include_dirs = - [ "${chip_root}/examples/platform/${nxp_platform}/app/project_include" ] chip_enable_openthread = true @@ -57,12 +68,12 @@ chip_mdns = "platform" chip_system_config_use_open_thread_inet_endpoints = true chip_with_lwip = false -mbedtls_target = "${nxp_sdk_build_root}/${nxp_sdk_name}:mbedtls" +mbedtls_target = "${nxp_sdk_build_root}:nxp_mbedtls" openthread_external_mbedtls = mbedtls_target openthread_project_core_config_file = "OpenThreadConfig.h" openthread_core_config_platform_check_file = "openthread-core-k32w1-config-check.h" -openthread_core_config_deps = [ "${chip_root}/examples/platform/nxp/k32w/k32w1:openthread_core_config_k32w1_chip_examples" ] +openthread_core_config_deps = [ "${chip_root}/third_party/openthread/platforms/nxp/${nxp_platform}:openthread_core_config_k32w1" ] -openthread_external_platform = "${chip_root}/third_party/openthread/platforms/nxp/k32w/k32w1:libopenthread-k32w1" +openthread_external_platform = "${chip_root}/third_party/openthread/platforms/nxp/${nxp_platform}:libopenthread-k32w1" diff --git a/src/platform/nxp/k32w/k32w1/ble_function_mux.c b/src/platform/nxp/k32w1/ble_function_mux.c similarity index 100% rename from src/platform/nxp/k32w/k32w1/ble_function_mux.c rename to src/platform/nxp/k32w1/ble_function_mux.c diff --git a/src/platform/nxp/k32w/k32w1/ble_function_mux.h b/src/platform/nxp/k32w1/ble_function_mux.h similarity index 100% rename from src/platform/nxp/k32w/k32w1/ble_function_mux.h rename to src/platform/nxp/k32w1/ble_function_mux.h diff --git a/src/platform/nxp/k32w/k32w1/gatt_db.h b/src/platform/nxp/k32w1/gatt_db.h similarity index 100% rename from src/platform/nxp/k32w/k32w1/gatt_db.h rename to src/platform/nxp/k32w1/gatt_db.h diff --git a/src/platform/nxp/k32w/k32w1/gatt_uuid128.h b/src/platform/nxp/k32w1/gatt_uuid128.h similarity index 100% rename from src/platform/nxp/k32w/k32w1/gatt_uuid128.h rename to src/platform/nxp/k32w1/gatt_uuid128.h diff --git a/src/platform/nxp/k32w/k32w1/k32w1-chip-mbedtls-config.h b/src/platform/nxp/k32w1/k32w1-chip-mbedtls-config.h similarity index 100% rename from src/platform/nxp/k32w/k32w1/k32w1-chip-mbedtls-config.h rename to src/platform/nxp/k32w1/k32w1-chip-mbedtls-config.h diff --git a/src/platform/nxp/k32w/k32w1/ram_storage.c b/src/platform/nxp/k32w1/ram_storage.c similarity index 100% rename from src/platform/nxp/k32w/k32w1/ram_storage.c rename to src/platform/nxp/k32w1/ram_storage.c diff --git a/src/platform/nxp/k32w/k32w1/ram_storage.h b/src/platform/nxp/k32w1/ram_storage.h similarity index 100% rename from src/platform/nxp/k32w/k32w1/ram_storage.h rename to src/platform/nxp/k32w1/ram_storage.h diff --git a/src/platform/nxp/rt/rw61x/BUILD.gn b/src/platform/nxp/rt/rw61x/BUILD.gn index 7337f896c8ddcc..1793b50884dd30 100644 --- a/src/platform/nxp/rt/rw61x/BUILD.gn +++ b/src/platform/nxp/rt/rw61x/BUILD.gn @@ -22,6 +22,11 @@ import("${nxp_sdk_build_root}/nxp_sdk.gni") assert(chip_device_platform == "nxp") +source_set("nxp_factory_data") { +} +source_set("nxp_ota") { +} + config("nxp_platform_config") { defines = [ "EXTERNAL_BLEMANAGERIMPL_HEADER=\"platform/nxp/common/ble_zephyr/BLEManagerImpl.h\"" ] include_dirs = [ diff --git a/third_party/nxp/nxp_matter_support b/third_party/nxp/nxp_matter_support index e6deaf56001387..2aad9239944047 160000 --- a/third_party/nxp/nxp_matter_support +++ b/third_party/nxp/nxp_matter_support @@ -1 +1 @@ -Subproject commit e6deaf5600138763ea68418e34bc62a02d1aef0d +Subproject commit 2aad9239944047012e525caf52119a5c84b704d3 diff --git a/third_party/openthread/platforms/nxp/k32w/k32w1/BUILD.gn b/third_party/openthread/platforms/nxp/k32w1/BUILD.gn similarity index 73% rename from third_party/openthread/platforms/nxp/k32w/k32w1/BUILD.gn rename to third_party/openthread/platforms/nxp/k32w1/BUILD.gn index b004389a09fa64..38a2f231cb811c 100644 --- a/third_party/openthread/platforms/nxp/k32w/k32w1/BUILD.gn +++ b/third_party/openthread/platforms/nxp/k32w1/BUILD.gn @@ -24,7 +24,6 @@ openthread_nxp_root = "${chip_root}/third_party/openthread/ot-nxp" config("openthread_k32w1_config") { include_dirs = [ "${openthread_nxp_root}/src/k32w1/k32w1" ] - include_dirs += [ "${chip_root}/examples/platform/nxp/k32w/k32w1" ] defines = [ "OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE=1", @@ -34,12 +33,27 @@ config("openthread_k32w1_config") { "MBEDTLS_THREADING_ALT=1", ] + if (chip_mdns == "platform") { + defines += [ + "OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE=1", + "OPENTHREAD_CONFIG_ECDSA_ENABLE=1", + "OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE=1", + "OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1", + ] + } + if (use_smu2_dynamic) { defines += [ "OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE=1", "OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=0", ] } + + if (chip_key_storage == "littlefs") { + defines += [ "OT_PLAT_SAVE_NVM_DATA_ON_IDLE=0" ] + } else if (chip_key_storage == "nvs") { + defines += [ "CONFIG_SETTINGS_RUNTIME=1" ] + } } source_set("openthread_core_config_k32w1") { @@ -49,16 +63,12 @@ source_set("openthread_core_config_k32w1") { ] public_configs = [ ":openthread_k32w1_config" ] -} - -source_set("openthread_mbedtls_config_k32w1") { - sources = [ "${openthread_nxp_root}/src/k32w1/k32w1/k32w1-mbedtls-config.h" ] + public_deps = [ nxp_sdk_target ] } source_set("libopenthread-k32w1") { sources = [ "${openthread_nxp_root}/src/common/crypto.c", - "${openthread_nxp_root}/src/common/flash_nvm.c", "${openthread_nxp_root}/src/k32w1/k32w1/alarm.c", "${openthread_nxp_root}/src/k32w1/k32w1/diag.c", "${openthread_nxp_root}/src/k32w1/k32w1/entropy.c", @@ -79,6 +89,14 @@ source_set("libopenthread-k32w1") { if (use_hw_aes) { sources += [ "${openthread_nxp_root}/src/k32w1/k32w1/aes_sss.cpp" ] } + + if (chip_key_storage == "fwk_nvm") { + sources += [ "${openthread_nxp_root}/src/common/flash_nvm.c" ] + } else if (chip_key_storage == "littlefs") { + sources += [ "${openthread_nxp_root}/src/common/flash_fsa.c" ] + } else if (chip_key_storage == "nvs") { + sources += [ "${openthread_nxp_root}/src/common/flash_nvs.c" ] + } } if (chip_with_ot_cli == 1) { @@ -86,10 +104,9 @@ source_set("libopenthread-k32w1") { } public_deps = [ - ":openthread_core_config_k32w1", - "${nxp_sdk_build_root}:nxp_sdk", - "${openthread_root}/src/core:libopenthread_core_headers", - "../../..:libopenthread-platform", - "../../..:libopenthread-platform-utils", + "${nxp_sdk_build_root}:nxp_mbedtls", + "../..:libopenthread-platform", + "../..:libopenthread-platform-utils", + nxp_sdk_target, ] } From d95acb48a5debaaa78f75537119d2dc0f2dff5bc Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Thu, 15 Aug 2024 07:58:59 -0700 Subject: [PATCH 30/59] [Fabric-Sync] Simplify and update the fabric sync guide (#34993) * [Fabric-Sync] Symplify and update the fabric sync guide * Restyled by prettier-markdown * Update docs/guides/fabric_synchronization_guide.md Co-authored-by: Terence Hampson * Update docs/guides/fabric_synchronization_guide.md Co-authored-by: saurabhst * Address review comments --------- Co-authored-by: Restyled.io Co-authored-by: Terence Hampson Co-authored-by: saurabhst --- docs/guides/fabric_synchronization_guide.md | 108 ++++++++++++------ .../fabric-sync/FabricSyncCommand.cpp | 2 + .../device_manager/DeviceManager.cpp | 3 +- .../fabric-admin/scripts/run_fabric_sink.sh | 78 ------------- ...un_fabric_source.sh => run_fabric_sync.sh} | 14 +-- ...p_fabric_source.sh => stop_fabric_sync.sh} | 0 6 files changed, 84 insertions(+), 121 deletions(-) delete mode 100755 examples/fabric-admin/scripts/run_fabric_sink.sh rename examples/fabric-admin/scripts/{run_fabric_source.sh => run_fabric_sync.sh} (85%) rename examples/fabric-admin/scripts/{stop_fabric_source.sh => stop_fabric_sync.sh} (100%) diff --git a/docs/guides/fabric_synchronization_guide.md b/docs/guides/fabric_synchronization_guide.md index 1b545ce36ead27..b2cfd26d9f439e 100644 --- a/docs/guides/fabric_synchronization_guide.md +++ b/docs/guides/fabric_synchronization_guide.md @@ -2,7 +2,9 @@ - [Fabric Synchronization Guide](#fabric-synchronization-guide) - [Fabric Sync Example Applications](#fabric-sync-example-applications) - - [Run Fabric Sync Demo on RP4](#run-fabric-sync-demo-on-rp4) + - [Bootstrap Fabric Sync Demo on Linux](#bootstrap-fabric-sync-demo-on-linux) + - [Bootstrap Fabric Sync Demo on RP4](#bootstrap-fabric-sync-demo-on-rp4) + - [Run Fabric Sync Demo](#run-fabric-sync-demo) ## Fabric Sync Example Applications @@ -38,27 +40,29 @@ enables a seamless and efficient synchronization process. [Fabric-Bridge](https://github.com/project-chip/connectedhomeip/tree/master/examples/fabric-bridge-app/linux/README.md) -## Run Fabric Sync Demo on RP4 +## Bootstrap Fabric Sync Demo on Linux -### Setup Fabric Source +### Start Fabric Synchronization on Ecosystem 1 -Connect to the Fabric Source server: +Run the Fabric Synchronization script: ``` -ssh ubuntu@xxx.xxx.xxx.xxx +./examples/fabric-admin/scripts/run_fabric_sync.sh ``` -Password: +### Start Fabric Synchronization on Ecosystem 2 -Run the Fabric Source script: +Run the Fabric Synchronization script: ``` -./run_fabric_source.sh +./examples/fabric-admin/scripts/run_fabric_sync.sh ``` -### Setup Fabric Sink +## Bootstrap Fabric Sync Demo on RP4 -Connect to the Fabric Sink server: +### Start Fabric Synchronization on Ecosystem 1 + +Connect to the Ecosystem 1 server: ``` ssh ubuntu@xxx.xxx.xxx.xxx @@ -66,29 +70,41 @@ ssh ubuntu@xxx.xxx.xxx.xxx Password: -Run the Fabric Sink script: +Run the Fabric Synchronization script: ``` -./run_fabric_sink.sh +./run_fabric_sync.sh ``` -### Fabric Sync Setup +### Start Fabric Synchronization on Ecosystem 2 + +Connect to the Ecosystem 2 server: + +``` +ssh ubuntu@xxx.xxx.xxx.xxx +``` -Enable Fabric Auto Sync: +Password: -In Fabric-Sync console: +Run the Fabric Synchronization script: ``` -fabricsync enable-auto-sync 1 +./run_fabric_sync.sh ``` -Pair the Fabric-Source bridge to Fabric-Sync with node ID 1: +## Run Fabric Sync Demo + +### Fabric Sync Setup + +In Ecosystem 1 Fabric-Admin console: + +Pair the Ecosystem 2 bridge to Ecosystem 1 with node ID 2: ``` -fabricsync add-bridge 1 +fabricsync add-bridge 2 ``` -### Pair Light Example to Fabric-Source +### Pair Light Example to Ecosystem 2 Since Fabric-Bridge also functions as a Matter server, running it alongside the Light Example app on the same machine would cause conflicts. Therefore, you need @@ -114,26 +130,47 @@ Pair the Light Example with node ID 3 using its payload number: pairing already-discovered 3 20202021 5540 ``` -After the Light Example is successfully paired in Fabric-Source, it will be -synced to Fabric-Sink with a new assigned node ID. +After the device is successfully added, you will observe the following on +Ecosystem 2 with the newly assigned Node ID: + +``` +>>> New device with Node ID: 0x3 has been successfully added. +``` + +Additionally, you should also get notified when a new device is added to +Ecosystem 2 from the Ecosystem 1: + +``` +>>> A new device is added on Endpoint 3. +``` + +### Synchronize Light Example to Ecosystem 1 + +After the Light Example is successfully paired in Ecosystem 2, we can start to +synchronize the light device to Ecosystem 1 using the new assigned dynamic +endpointid on Ecosystem 2. + +``` +fabricsync sync-device +``` Toggle the Light Example: -From Fabric-Source: +From Ecosystem 1: ``` onoff on 1 onoff off 1 ``` -From Fabric-Sink: (Use the node ID assigned) +From Ecosystem 2: (Use the node ID assigned) ``` onoff on x 1 onoff off x 1 ``` -### Remove Light Example from Fabric-Source +### Remove Light Example from Ecosystem Unpair the Light Example: @@ -141,9 +178,6 @@ Unpair the Light Example: pairing unpair ``` -After the Light Example is successfully unpaired from Fabric-Source, it will -also be removed from the Fabric-Sink. - ### Pair Commercial Switch to Fabric-Source Pair the switch using its payload number: @@ -154,32 +188,36 @@ In Fabric-Source console: pairing code-wifi ``` -After the switch is successfully paired in Fabric-Source, it will be synced to -Fabric-Sink with a new assigned node ID. +### Synchronize Switch to Ecosystem 1 + +After the switch is successfully paired in Ecosystem 2, we can start to +synchronize it to Ecosystem 1 using the new assigned dynamic endpointid on +Ecosystem 2.. + +``` +fabricsync sync-device +``` Toggle the switch: -From Fabric-Source: +From Ecosystem 1: ``` onoff on 1 onoff off 1 ``` -From Fabric-Sink: (Use the node ID assigned) +From Ecosystem 2: (Use the node ID assigned) ``` onoff on 1 onoff off 1 ``` -### Remove Switch from Fabric-Source +### Remove Switch from Ecosystem Unpair the switch: ``` pairing unpair ``` - -After the switch is successfully unpaired from Fabric-Source, it will also be -removed from the Fabric-Sink. diff --git a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp index dade5932fba758..f62d85ce5afd40 100644 --- a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp +++ b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp @@ -252,6 +252,8 @@ CHIP_ERROR FabricAutoSyncCommand::RunCommand(bool enableAutoSync) // print to console fprintf(stderr, "Auto Fabric Sync is %s.\n", enableAutoSync ? "enabled" : "disabled"); + fprintf(stderr, + "WARNING: The auto-sync command is currently under development and may contain bugs. Use it at your own risk.\n"); return CHIP_NO_ERROR; } diff --git a/examples/fabric-admin/device_manager/DeviceManager.cpp b/examples/fabric-admin/device_manager/DeviceManager.cpp index 4207378670f44e..7204e153d2807f 100644 --- a/examples/fabric-admin/device_manager/DeviceManager.cpp +++ b/examples/fabric-admin/device_manager/DeviceManager.cpp @@ -331,7 +331,8 @@ void DeviceManager::HandleAttributeData(const app::ConcreteDataAttributePath & p // Process added endpoints for (const auto & endpoint : addedEndpoints) { - ChipLogProgress(NotSpecified, "Endpoint added: %u", endpoint); + // print to console + fprintf(stderr, "A new devie is added on Endpoint: %u\n", endpoint); if (mAutoSyncEnabled) { diff --git a/examples/fabric-admin/scripts/run_fabric_sink.sh b/examples/fabric-admin/scripts/run_fabric_sink.sh deleted file mode 100755 index 3013965479268a..00000000000000 --- a/examples/fabric-admin/scripts/run_fabric_sink.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash - -# Default paths -DEFAULT_CHOICES=( - "./fabric-admin" - "out/debug/standalone/fabric-admin" - "out/linux-x64-fabric-admin/fabric-admin" - "out/darwin-arm64-fabric-admin/fabric-admin" -) -FABRIC_ADMIN_LOG="/tmp/fabric_admin.log" -FABRIC_ADMIN_PATH="" - -# Function to find fabric-admin binary -find_fabric_admin() { - local choices=("$@") - for path in "${choices[@]}"; do - if [[ -e "$path" ]]; then - echo "$path" - return 0 - fi - done - return 1 -} - -# Parse arguments -VERBOSE=false -SPECIFIED_PATH="" - -for arg in "$@"; do - case $arg in - --verbose) - VERBOSE=true - ;; - --path=*) - SPECIFIED_PATH="${arg#*=}" - ;; - esac -done - -# Use specified path if provided -if [[ -n "$SPECIFIED_PATH" ]]; then - if [[ -e "$SPECIFIED_PATH" ]]; then - FABRIC_ADMIN_PATH="$SPECIFIED_PATH" - else - echo >&2 "Specified path does not exist: $SPECIFIED_PATH" - exit 1 - fi -else - FABRIC_ADMIN_PATH=$(find_fabric_admin "${DEFAULT_CHOICES[@]}") - if [[ $? -ne 0 ]]; then - echo >&2 "Could not find the fabric-admin binary" - exit 1 - fi -fi - -echo "PATH IS: $FABRIC_ADMIN_PATH" - -# Kill fabric-admin if it is running -echo "Checking for running fabric-admin process..." -fabric_admin_pid=$(pgrep -f "$FABRIC_ADMIN_PATH") -if [[ -n "$fabric_admin_pid" ]]; then - echo "Found fabric-admin with PID $fabric_admin_pid, attempting to kill..." - kill -9 "$fabric_admin_pid" - echo "Killed fabric-admin with PID $fabric_admin_pid" -fi - -# Remove /tmp/chip_* files and directories -echo "Removing /tmp/chip_* files and directories..." -sudo rm -rf /tmp/chip_* -echo "Removed /tmp/chip_* files and directories" - -# Start fabric-admin with or without log file path based on --verbose option -echo "Starting fabric-admin..." -if [ "$VERBOSE" = true ]; then - "$FABRIC_ADMIN_PATH" -else - "$FABRIC_ADMIN_PATH" --log-file-path "$FABRIC_ADMIN_LOG" -fi diff --git a/examples/fabric-admin/scripts/run_fabric_source.sh b/examples/fabric-admin/scripts/run_fabric_sync.sh similarity index 85% rename from examples/fabric-admin/scripts/run_fabric_source.sh rename to examples/fabric-admin/scripts/run_fabric_sync.sh index 95df7a135bb596..8c820d111c37c1 100755 --- a/examples/fabric-admin/scripts/run_fabric_source.sh +++ b/examples/fabric-admin/scripts/run_fabric_sync.sh @@ -86,19 +86,19 @@ fi echo "Admin path: $FABRIC_ADMIN_PATH" echo "Bridge path: $FABRIC_BRIDGE_APP_PATH" -# Determine the path to stop_fabric_source.sh based on the location of run_fabric_source.sh -RUN_FABRIC_SOURCE_PATH=$(find_binary "$SCRIPT_DIR/run_fabric_source.sh") +# Determine the path to stop_fabric_sync.sh based on the location of run_fabric_sync.sh +RUN_FABRIC_SOURCE_PATH=$(find_binary "$SCRIPT_DIR/run_fabric_sync.sh") if [[ $? -ne 0 ]]; then - echo >&2 "Could not find the run_fabric_source.sh script" + echo >&2 "Could not find the run_fabric_sync.sh script" exit 1 fi -STOP_FABRIC_SOURCE_PATH="${RUN_FABRIC_SOURCE_PATH/run_fabric_source/stop_fabric_source}" +STOP_FABRIC_SYNC_PATH="${RUN_FABRIC_SOURCE_PATH/run_fabric_sync/stop_fabric_sync}" # Stop any running instances and clean up -if [[ -e "$STOP_FABRIC_SOURCE_PATH" ]]; then - "$STOP_FABRIC_SOURCE_PATH" +if [[ -e "$STOP_FABRIC_SYNC_PATH" ]]; then + "$STOP_FABRIC_SYNC_PATH" else - echo >&2 "Could not find the stop_fabric_source.sh script" + echo >&2 "Could not find the stop_fabric_sync.sh script" exit 1 fi diff --git a/examples/fabric-admin/scripts/stop_fabric_source.sh b/examples/fabric-admin/scripts/stop_fabric_sync.sh similarity index 100% rename from examples/fabric-admin/scripts/stop_fabric_source.sh rename to examples/fabric-admin/scripts/stop_fabric_sync.sh From 78ce5b0ad922ffb12b9c91cca282eb1a6613f88d Mon Sep 17 00:00:00 2001 From: Kiel Oleson Date: Thu, 15 Aug 2024 08:04:12 -0700 Subject: [PATCH 31/59] [Darwin] Duplicate / begin raising `MTRDeviceController` (#34832) * Keep MTRDeviceController.mm * Copy MTRDeviceController.mm into MTRDeviceController_Concrete.mm * Set back MTRDeviceController.mm file * Keep MTRDeviceController.h * Copy MTRDeviceController.h into MTRDeviceController_Concrete.h * Set back MTRDeviceController.h file * add `MTRDeviceController_Concrete` files * WIP: bring up `MTRDeviceController_Concrete` * temporary init implementation * only vend `MTRDeviceController` pointers not concrete class (`instancetype`) pointers * add `storedFabricIndex` (currently broken) * reduce access of internal properties * move C++-style fabric index and keypairs to protected ivars * return base class pointer from constructors rather than `instancetype` * clean up property synthesis/ivars in concrete * update merged code * WIP: get us building again, plus plan comments * remove superfluous comments * Update src/darwin/Framework/CHIP/MTRDeviceControllerFactory.h * Restyled by clang-format * move MTRDeviceController protected ivars to standard `MTRDeviceController.h` header * `MTRDeviceController_Concrete` isn't public API thus no `MTR_AVAILABLE` * remove commented code * move ivar extension back to internal header * Fixing TAPI * Restyled by whitespace * Restyled by clang-format --------- Co-authored-by: Justin Wood Co-authored-by: Restyled.io --- .../Framework/CHIP/MTRDeviceController.h | 4 +- .../Framework/CHIP/MTRDeviceController.mm | 30 +- .../CHIP/MTRDeviceControllerFactory.h | 2 +- .../CHIP/MTRDeviceControllerFactory.mm | 6 +- .../CHIP/MTRDeviceController_Concrete.h | 17 +- .../CHIP/MTRDeviceController_Concrete.mm | 292 +++++++----------- .../CHIP/MTRDeviceController_Internal.h | 38 +++ .../Matter.xcodeproj/project.pbxproj | 8 + 8 files changed, 176 insertions(+), 221 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.h b/src/darwin/Framework/CHIP/MTRDeviceController.h index eaae1fcf7d4c6a..9e2c833f6ef93b 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.h +++ b/src/darwin/Framework/CHIP/MTRDeviceController.h @@ -57,8 +57,8 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) * Once this returns non-nil, it's the caller's responsibility to call shutdown * on the controller to avoid leaking it. */ -- (nullable instancetype)initWithParameters:(MTRDeviceControllerAbstractParameters *)parameters - error:(NSError * __autoreleasing *)error MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)); +- (nullable MTRDeviceController *)initWithParameters:(MTRDeviceControllerAbstractParameters *)parameters + error:(NSError * __autoreleasing *)error MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)); /** * If true, the controller has not been shut down yet. diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.mm b/src/darwin/Framework/CHIP/MTRDeviceController.mm index 25a0e7d4dcd4c1..ee8cc2b7549190 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController.mm @@ -108,10 +108,6 @@ using namespace chip::Tracing::DarwinFramework; @implementation MTRDeviceController { - // Atomic because they can be touched from multiple threads. - std::atomic _storedFabricIndex; - std::atomic> _storedCompressedFabricID; - // queue used to serialize all work performed by the MTRDeviceController dispatch_queue_t _chipWorkQueue; @@ -120,8 +116,6 @@ @implementation MTRDeviceController { chip::Credentials::DefaultDACVerifier * _defaultDACVerifier; MTRDeviceControllerDelegateBridge * _deviceControllerDelegateBridge; MTROperationalCredentialsDelegate * _operationalCredentialsDelegate; - MTRP256KeypairBridge _signingKeypairBridge; - MTRP256KeypairBridge _operationalKeypairBridge; MTRDeviceAttestationDelegateBridge * _deviceAttestationDelegateBridge; MTRDeviceControllerFactory * _factory; NSMapTable * _nodeIDToDeviceMap; @@ -133,9 +127,22 @@ @implementation MTRDeviceController { NSMutableArray * _serverEndpoints; MTRDeviceStorageBehaviorConfiguration * _storageBehaviorConfiguration; + std::atomic _storedFabricIndex; + std::atomic> _storedCompressedFabricID; + MTRP256KeypairBridge _signingKeypairBridge; + MTRP256KeypairBridge _operationalKeypairBridge; +} + +- (instancetype)initForSubclasses +{ + if (self = [super init]) { + // nothing, as superclass of MTRDeviceController is NSObject + } + + return self; } -- (nullable instancetype)initWithParameters:(MTRDeviceControllerAbstractParameters *)parameters error:(NSError * __autoreleasing *)error +- (nullable MTRDeviceController *)initWithParameters:(MTRDeviceControllerAbstractParameters *)parameters error:(NSError * __autoreleasing *)error { if (![parameters isKindOfClass:MTRDeviceControllerParameters.class]) { MTR_LOG_ERROR("Unsupported type of MTRDeviceControllerAbstractParameters: %@", parameters); @@ -1575,15 +1582,6 @@ + (void)forceLocalhostAdvertisingOnly @end -/** - * Shim to allow us to treat an MTRDevicePairingDelegate as an - * MTRDeviceControllerDelegate. - */ -@interface MTRDevicePairingDelegateShim : NSObject -@property (nonatomic, readonly) id delegate; -- (instancetype)initWithDelegate:(id)delegate; -@end - @implementation MTRDevicePairingDelegateShim - (instancetype)initWithDelegate:(id)delegate { diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.h b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.h index 0f9de90363f821..5d1fc4c1809874 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.h @@ -23,6 +23,7 @@ #import #import #import +#import NS_ASSUME_NONNULL_BEGIN @@ -31,7 +32,6 @@ NS_ASSUME_NONNULL_BEGIN @protocol MTROTAProviderDelegate; @protocol MTRKeypair; -@class MTRDeviceController; @class MTRDeviceControllerStartupParams; @class MTRFabricInfo; diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm index 18128249376e21..5b089b392074e6 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm @@ -1133,9 +1133,9 @@ - (void)operationalInstanceAdded:(chip::PeerId &)operationalID } } -- (MTRDeviceController * _Nullable)initializeController:(MTRDeviceController *)controller - withParameters:(MTRDeviceControllerParameters *)parameters - error:(NSError * __autoreleasing *)error +- (nullable MTRDeviceController *)initializeController:(MTRDeviceController *)controller + withParameters:(MTRDeviceControllerParameters *)parameters + error:(NSError * __autoreleasing *)error { [self _assertCurrentQueueIsNotMatterQueue]; diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.h b/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.h index eaae1fcf7d4c6a..c9587e910d3b1a 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.h +++ b/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.h @@ -19,6 +19,7 @@ #import #import +#import #import @class MTRBaseDevice; @@ -37,15 +38,7 @@ typedef void (^MTRDeviceConnectionCallback)(MTRBaseDevice * _Nullable device, NS @protocol MTRDevicePairingDelegate; @protocol MTRDeviceControllerDelegate; -MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) -@interface MTRDeviceController : NSObject - -/** - * Controllers are created via the MTRDeviceControllerFactory object or - * initialized via initWithParameters:error:. - */ -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)new NS_UNAVAILABLE; +@interface MTRDeviceController_Concrete : MTRDeviceController /** * Initialize a device controller with the provided parameters. This will: @@ -57,8 +50,8 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) * Once this returns non-nil, it's the caller's responsibility to call shutdown * on the controller to avoid leaking it. */ -- (nullable instancetype)initWithParameters:(MTRDeviceControllerAbstractParameters *)parameters - error:(NSError * __autoreleasing *)error MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)); +- (nullable MTRDeviceController *)initWithParameters:(MTRDeviceControllerAbstractParameters *)parameters + error:(NSError * __autoreleasing *)error MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)); /** * If true, the controller has not been shut down yet. @@ -262,7 +255,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @end -@interface MTRDeviceController (Deprecated) +@interface MTRDeviceController_Concrete (Deprecated) @property (readonly, nonatomic, nullable) NSNumber * controllerNodeId MTR_DEPRECATED( "Please use controllerNodeID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)); diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm b/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm index 6c312d510a93a7..c7ccab25e1cdc4 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm @@ -26,11 +26,13 @@ #import "MTRCommissionableBrowserResult_Internal.h" #import "MTRCommissioningParameters.h" #import "MTRConversion.h" +#import "MTRDeviceController.h" #import "MTRDeviceControllerDelegateBridge.h" #import "MTRDeviceControllerFactory_Internal.h" #import "MTRDeviceControllerLocalTestStorage.h" #import "MTRDeviceControllerStartupParams.h" #import "MTRDeviceControllerStartupParams_Internal.h" +#import "MTRDeviceController_Concrete.h" #import "MTRDevice_Concrete.h" #import "MTRDevice_Internal.h" #import "MTRError_Internal.h" @@ -79,61 +81,81 @@ #import -static NSString * const kErrorCommissionerInit = @"Init failure while initializing a commissioner"; -static NSString * const kErrorIPKInit = @"Init failure while initializing IPK"; -static NSString * const kErrorSigningKeypairInit = @"Init failure while creating signing keypair bridge"; -static NSString * const kErrorOperationalCredentialsInit = @"Init failure while creating operational credentials delegate"; -static NSString * const kErrorOperationalKeypairInit = @"Init failure while creating operational keypair bridge"; -static NSString * const kErrorPairingInit = @"Init failure while creating a pairing delegate"; -static NSString * const kErrorPartialDacVerifierInit = @"Init failure while creating a partial DAC verifier"; -static NSString * const kErrorPairDevice = @"Failure while pairing the device"; -static NSString * const kErrorStopPairing = @"Failure while trying to stop the pairing process"; -static NSString * const kErrorOpenPairingWindow = @"Open Pairing Window failed"; -static NSString * const kErrorNotRunning = @"Controller is not running. Call startup first."; -static NSString * const kErrorSetupCodeGen = @"Generating Manual Pairing Code failed"; -static NSString * const kErrorGenerateNOC = @"Generating operational certificate failed"; -static NSString * const kErrorKeyAllocation = @"Generating new operational key failed"; -static NSString * const kErrorCSRValidation = @"Extracting public key from CSR failed"; -static NSString * const kErrorGetCommissionee = @"Failure obtaining device being commissioned"; -static NSString * const kErrorGetAttestationChallenge = @"Failure getting attestation challenge"; -static NSString * const kErrorSpake2pVerifierGenerationFailed = @"PASE verifier generation failed"; -static NSString * const kErrorSpake2pVerifierSerializationFailed = @"PASE verifier serialization failed"; -static NSString * const kErrorCDCertStoreInit = @"Init failure while initializing Certificate Declaration Signing Keys store"; - typedef void (^SyncWorkQueueBlock)(void); typedef id (^SyncWorkQueueBlockWithReturnValue)(void); typedef BOOL (^SyncWorkQueueBlockWithBoolReturnValue)(void); using namespace chip::Tracing::DarwinFramework; -@implementation MTRDeviceController { - // Atomic because it can be touched from multiple threads. - std::atomic _storedFabricIndex; +@interface MTRDeviceController_Concrete () - // queue used to serialize all work performed by the MTRDeviceController - dispatch_queue_t _chipWorkQueue; +// MTRDeviceController ivar internal access + +@property (nonatomic, readonly) chip::Controller::DeviceCommissioner * cppCommissioner; +@property (nonatomic, readonly) chip::Credentials::PartialDACVerifier * partialDACVerifier; +@property (nonatomic, readonly) chip::Credentials::DefaultDACVerifier * defaultDACVerifier; +@property (nonatomic, readonly) MTRDeviceControllerDelegateBridge * deviceControllerDelegateBridge; +@property (nonatomic, readonly) MTROperationalCredentialsDelegate * operationalCredentialsDelegate; +@property (nonatomic, readonly) MTRDeviceAttestationDelegateBridge * deviceAttestationDelegateBridge; +@property (nonatomic, readwrite) NSUUID * uniqueIdentifier; +@property (nonatomic, readonly) dispatch_queue_t chipWorkQueue; +@property (nonatomic, readonly, nullable) MTRDeviceControllerFactory * factory; +@property (nonatomic, readonly, nullable) NSMapTable * nodeIDToDeviceMap; +@property (nonatomic, readonly) os_unfair_lock deviceMapLock; +@property (nonatomic, readonly, nullable) id otaProviderDelegate; +@property (nonatomic, readonly, nullable) dispatch_queue_t otaProviderDelegateQueue; +@property (nonatomic, readonly, nullable) MTRCommissionableBrowser * commissionableBrowser; +@property (nonatomic, readonly, nullable) MTRAttestationTrustStoreBridge * attestationTrustStoreBridge; +@property (nonatomic, readonly, nullable) NSMutableArray * serverEndpoints; + +@property (nonatomic, readonly) MTRAsyncWorkQueue * concurrentSubscriptionPool; - chip::Controller::DeviceCommissioner * _cppCommissioner; - chip::Credentials::PartialDACVerifier * _partialDACVerifier; - chip::Credentials::DefaultDACVerifier * _defaultDACVerifier; - MTRDeviceControllerDelegateBridge * _deviceControllerDelegateBridge; - MTROperationalCredentialsDelegate * _operationalCredentialsDelegate; +@property (nonatomic, readonly) MTRDeviceStorageBehaviorConfiguration * storageBehaviorConfiguration; + +@end + +@implementation MTRDeviceController_Concrete { + // queue used to serialize all work performed by the MTRDeviceController + std::atomic _storedFabricIndex; + std::atomic> _storedCompressedFabricID; MTRP256KeypairBridge _signingKeypairBridge; MTRP256KeypairBridge _operationalKeypairBridge; - MTRDeviceAttestationDelegateBridge * _deviceAttestationDelegateBridge; - MTRDeviceControllerFactory * _factory; - NSMapTable * _nodeIDToDeviceMap; - os_unfair_lock _deviceMapLock; // protects nodeIDToDeviceMap - MTRCommissionableBrowser * _commissionableBrowser; - MTRAttestationTrustStoreBridge * _attestationTrustStoreBridge; +} - // _serverEndpoints is only touched on the Matter queue. - NSMutableArray * _serverEndpoints; +// MTRDeviceController ivar internal access +@synthesize uniqueIdentifier = _uniqueIdentifier; +@synthesize chipWorkQueue = _chipWorkQueue; +@synthesize controllerDataStore = _controllerDataStore; +@synthesize factory = _factory; +@synthesize deviceMapLock = _deviceMapLock; +@synthesize otaProviderDelegate = _otaProviderDelegate; +@synthesize otaProviderDelegateQueue = _otaProviderDelegateQueue; +@synthesize commissionableBrowser = _commissionableBrowser; +@synthesize concurrentSubscriptionPool = _concurrentSubscriptionPool; +@synthesize storageBehaviorConfiguration = _storageBehaviorConfiguration; + +- (nullable MTRDeviceController_Concrete *)initWithParameters:(MTRDeviceControllerAbstractParameters *)parameters + error:(NSError * __autoreleasing *)error +{ + if (![parameters isKindOfClass:MTRDeviceControllerParameters.class]) { + MTR_LOG_ERROR("Unsupported type of MTRDeviceControllerAbstractParameters: %@", parameters); + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INVALID_ARGUMENT]; + } + return nil; + } + auto * controllerParameters = static_cast(parameters); - MTRDeviceStorageBehaviorConfiguration * _storageBehaviorConfiguration; + // or, if necessary, MTRDeviceControllerFactory will auto-start in per-controller-storage mode if necessary + MTRDeviceControllerFactory * factory = MTRDeviceControllerFactory.sharedInstance; + id controller = [factory initializeController:self + withParameters:controllerParameters + error:error]; + return controller; } -- (nullable instancetype)initWithParameters:(MTRDeviceControllerAbstractParameters *)parameters error:(NSError * __autoreleasing *)error +- (nullable MTRDeviceController *)bogusWithParameters:(MTRDeviceControllerAbstractParameters *)parameters + error:(NSError * __autoreleasing *)error { if (![parameters isKindOfClass:MTRDeviceControllerParameters.class]) { MTR_LOG_ERROR("Unsupported type of MTRDeviceControllerAbstractParameters: %@", parameters); @@ -145,7 +167,11 @@ - (nullable instancetype)initWithParameters:(MTRDeviceControllerAbstractParamete auto * controllerParameters = static_cast(parameters); // MTRDeviceControllerFactory will auto-start in per-controller-storage mode if necessary - return [MTRDeviceControllerFactory.sharedInstance initializeController:self withParameters:controllerParameters error:error]; + MTRDeviceControllerFactory * factory = MTRDeviceControllerFactory.sharedInstance; + MTRDeviceController * controller = [factory initializeController:self + withParameters:controllerParameters + error:error]; + return controller; } - (instancetype)initWithFactory:(MTRDeviceControllerFactory *)factory @@ -158,7 +184,7 @@ - (instancetype)initWithFactory:(MTRDeviceControllerFactory *)factory concurrentSubscriptionPoolSize:(NSUInteger)concurrentSubscriptionPoolSize storageBehaviorConfiguration:(MTRDeviceStorageBehaviorConfiguration *)storageBehaviorConfiguration { - if (self = [super init]) { + if (self = [super initForSubclasses]) { // Make sure our storage is all set up to work as early as possible, // before we start doing anything else with the controller. _uniqueIdentifier = uniqueIdentifier; @@ -242,17 +268,17 @@ - (instancetype)initWithFactory:(MTRDeviceControllerFactory *)factory _commissionableBrowser = nil; _deviceControllerDelegateBridge = new MTRDeviceControllerDelegateBridge(); - if ([self checkForInitError:(_deviceControllerDelegateBridge != nullptr) logMsg:kErrorPairingInit]) { + if ([self checkForInitError:(_deviceControllerDelegateBridge != nullptr) logMsg:kDeviceControllerErrorPairingInit]) { return nil; } _partialDACVerifier = new chip::Credentials::PartialDACVerifier(); - if ([self checkForInitError:(_partialDACVerifier != nullptr) logMsg:kErrorPartialDacVerifierInit]) { + if ([self checkForInitError:(_partialDACVerifier != nullptr) logMsg:kDeviceControllerErrorPartialDacVerifierInit]) { return nil; } _operationalCredentialsDelegate = new MTROperationalCredentialsDelegate(self); - if ([self checkForInitError:(_operationalCredentialsDelegate != nullptr) logMsg:kErrorOperationalCredentialsInit]) { + if ([self checkForInitError:(_operationalCredentialsDelegate != nullptr) logMsg:kDeviceControllerErrorOperationalCredentialsInit]) { return nil; } @@ -438,14 +464,14 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams chip::Crypto::P256Keypair * signingKeypair = nullptr; if (startupParams.nocSigner) { errorCode = _signingKeypairBridge.Init(startupParams.nocSigner); - if ([self checkForStartError:errorCode logMsg:kErrorSigningKeypairInit]) { + if ([self checkForStartError:errorCode logMsg:kDeviceControllerErrorSigningKeypairInit]) { return; } signingKeypair = &_signingKeypairBridge; } errorCode = _operationalCredentialsDelegate->Init( signingKeypair, startupParams.ipk, startupParams.rootCertificate, startupParams.intermediateCertificate); - if ([self checkForStartError:errorCode logMsg:kErrorOperationalCredentialsInit]) { + if ([self checkForStartError:errorCode logMsg:kDeviceControllerErrorOperationalCredentialsInit]) { return; } @@ -469,7 +495,7 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams if (startupParams.operationalKeypair != nil) { errorCode = _operationalKeypairBridge.Init(startupParams.operationalKeypair); - if ([self checkForStartError:errorCode logMsg:kErrorOperationalKeypairInit]) { + if ([self checkForStartError:errorCode logMsg:kDeviceControllerErrorOperationalKeypairInit]) { return; } commissionerParams.operationalKeypair = &_operationalKeypairBridge; @@ -494,7 +520,7 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams errorCode = _operationalCredentialsDelegate->GenerateNOC(startupParams.nodeID.unsignedLongLongValue, startupParams.fabricID.unsignedLongLongValue, cats, commissionerParams.operationalKeypair->Pubkey(), noc); - if ([self checkForStartError:errorCode logMsg:kErrorGenerateNOC]) { + if ([self checkForStartError:errorCode logMsg:kDeviceControllerErrorGenerateNOC]) { return; } } else { @@ -502,20 +528,20 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams uint8_t csrBuffer[chip::Crypto::kMIN_CSR_Buffer_Size]; chip::MutableByteSpan csr(csrBuffer); errorCode = startupParams.fabricTable->AllocatePendingOperationalKey(startupParams.fabricIndex, csr); - if ([self checkForStartError:errorCode logMsg:kErrorKeyAllocation]) { + if ([self checkForStartError:errorCode logMsg:kDeviceControllerErrorKeyAllocation]) { return; } chip::Crypto::P256PublicKey pubKey; errorCode = VerifyCertificateSigningRequest(csr.data(), csr.size(), pubKey); - if ([self checkForStartError:errorCode logMsg:kErrorCSRValidation]) { + if ([self checkForStartError:errorCode logMsg:kDeviceControllerErrorCSRValidation]) { return; } errorCode = _operationalCredentialsDelegate->GenerateNOC( startupParams.nodeID.unsignedLongLongValue, startupParams.fabricID.unsignedLongLongValue, cats, pubKey, noc); - if ([self checkForStartError:errorCode logMsg:kErrorGenerateNOC]) { + if ([self checkForStartError:errorCode logMsg:kDeviceControllerErrorGenerateNOC]) { return; } } @@ -553,13 +579,13 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams if (cdTrustStore == nullptr) { errorCode = CHIP_ERROR_INCORRECT_STATE; } - if ([self checkForStartError:errorCode logMsg:kErrorCDCertStoreInit]) { + if ([self checkForStartError:errorCode logMsg:kDeviceControllerErrorCDCertStoreInit]) { return; } for (NSData * cdSigningCert in startupParams.certificationDeclarationCertificates) { errorCode = cdTrustStore->AddTrustedKey(AsByteSpan(cdSigningCert)); - if ([self checkForStartError:errorCode logMsg:kErrorCDCertStoreInit]) { + if ([self checkForStartError:errorCode logMsg:kDeviceControllerErrorCDCertStoreInit]) { return; } } @@ -570,7 +596,7 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams auto & factory = chip::Controller::DeviceControllerFactory::GetInstance(); errorCode = factory.SetupCommissioner(commissionerParams, *_cppCommissioner); - if ([self checkForStartError:errorCode logMsg:kErrorCommissionerInit]) { + if ([self checkForStartError:errorCode logMsg:kDeviceControllerErrorCommissionerInit]) { return; } @@ -579,13 +605,13 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams uint8_t compressedIdBuffer[sizeof(uint64_t)]; chip::MutableByteSpan compressedId(compressedIdBuffer); errorCode = _cppCommissioner->GetCompressedFabricIdBytes(compressedId); - if ([self checkForStartError:errorCode logMsg:kErrorIPKInit]) { + if ([self checkForStartError:errorCode logMsg:kDeviceControllerErrorIPKInit]) { return; } errorCode = chip::Credentials::SetSingleIpkEpochKey( _factory.groupDataProvider, fabricIdx, _operationalCredentialsDelegate->GetIPK(), compressedId); - if ([self checkForStartError:errorCode logMsg:kErrorIPKInit]) { + if ([self checkForStartError:errorCode logMsg:kDeviceControllerErrorIPKInit]) { return; } @@ -688,7 +714,7 @@ - (BOOL)setupCommissioningSessionWithPayload:(MTRSetupPayload *)payload } if (pairingCode == nil) { errorCode = CHIP_ERROR_INVALID_ARGUMENT; - return ![MTRDeviceController checkForError:errorCode logMsg:kErrorSetupCodeGen error:error]; + return ![MTRDeviceController_Concrete checkForError:errorCode logMsg:kDeviceControllerErrorSetupCodeGen error:error]; } chip::NodeId nodeId = [newNodeID unsignedLongLongValue]; @@ -702,7 +728,7 @@ - (BOOL)setupCommissioningSessionWithPayload:(MTRSetupPayload *)payload MATTER_LOG_METRIC_END(kMetricSetupPASESession, errorCode); } - return ![MTRDeviceController checkForError:errorCode logMsg:kErrorPairDevice error:error]; + return ![MTRDeviceController_Concrete checkForError:errorCode logMsg:kDeviceControllerErrorPairDevice error:error]; }; auto success = [self syncRunOnWorkQueueWithBoolReturnValue:block error:error]; @@ -758,7 +784,7 @@ - (BOOL)setupCommissioningSessionWithDiscoveredDevice:(MTRCommissionableBrowserR } if (pairingCode == nil) { errorCode = CHIP_ERROR_INVALID_ARGUMENT; - return ![MTRDeviceController checkForError:errorCode logMsg:kErrorSetupCodeGen error:error]; + return ![MTRDeviceController_Concrete checkForError:errorCode logMsg:kDeviceControllerErrorSetupCodeGen error:error]; } for (id key in discoveredDevice.interfaces) { @@ -779,7 +805,7 @@ - (BOOL)setupCommissioningSessionWithDiscoveredDevice:(MTRCommissionableBrowserR } } - return ![MTRDeviceController checkForError:errorCode logMsg:kErrorPairDevice error:error]; + return ![MTRDeviceController_Concrete checkForError:errorCode logMsg:kDeviceControllerErrorPairDevice error:error]; }; auto success = [self syncRunOnWorkQueueWithBoolReturnValue:block error:error]; @@ -886,7 +912,7 @@ - (BOOL)commissionNodeWithID:(NSNumber *)nodeID self->_operationalCredentialsDelegate->SetDeviceID(deviceId); auto errorCode = self->_cppCommissioner->Commission(deviceId, params); MATTER_LOG_METRIC(kMetricCommissionNode, errorCode); - return ![MTRDeviceController checkForError:errorCode logMsg:kErrorPairDevice error:error]; + return ![MTRDeviceController_Concrete checkForError:errorCode logMsg:kDeviceControllerErrorPairDevice error:error]; }; return [self syncRunOnWorkQueueWithBoolReturnValue:block error:error]; @@ -906,7 +932,7 @@ - (BOOL)continueCommissioningDevice:(void *)device ignoreAttestationFailure ? chip::Credentials::AttestationVerificationResult::kSuccess : lastAttestationResult); // Emit metric on stage after continuing post attestation MATTER_LOG_METRIC(kMetricContinueCommissioningAfterAttestation, errorCode); - return ![MTRDeviceController checkForError:errorCode logMsg:kErrorPairDevice error:error]; + return ![MTRDeviceController_Concrete checkForError:errorCode logMsg:kDeviceControllerErrorPairDevice error:error]; }; return [self syncRunOnWorkQueueWithBoolReturnValue:block error:error]; @@ -919,7 +945,7 @@ - (BOOL)cancelCommissioningForNodeID:(NSNumber *)nodeID error:(NSError * __autor auto errorCode = self->_cppCommissioner->StopPairing([nodeID unsignedLongLongValue]); // Emit metric on status of cancel MATTER_LOG_METRIC(kMetricCancelCommissioning, errorCode); - return ![MTRDeviceController checkForError:errorCode logMsg:kErrorStopPairing error:error]; + return ![MTRDeviceController_Concrete checkForError:errorCode logMsg:kDeviceControllerErrorStopPairing error:error]; }; return [self syncRunOnWorkQueueWithBoolReturnValue:block error:error]; @@ -969,7 +995,7 @@ - (MTRBaseDevice *)deviceBeingCommissionedWithNodeID:(NSNumber *)nodeID error:(N auto errorCode = self->_cppCommissioner->GetDeviceBeingCommissioned(nodeID.unsignedLongLongValue, &deviceProxy); MATTER_LOG_METRIC(kMetricDeviceBeingCommissioned, errorCode); - VerifyOrReturnValue(![MTRDeviceController checkForError:errorCode logMsg:kErrorGetCommissionee error:error], nil); + VerifyOrReturnValue(![MTRDeviceController_Concrete checkForError:errorCode logMsg:kDeviceControllerErrorGetCommissionee error:error], nil); return [[MTRBaseDevice alloc] initWithPASEDevice:deviceProxy controller:self]; }; @@ -989,7 +1015,7 @@ - (MTRDevice *)_setupDeviceForNodeID:(NSNumber *)nodeID prefetchedClusterData:(N { os_unfair_lock_assert_owner(&_deviceMapLock); - MTRDevice * deviceToReturn = [[MTRDevice_Concrete alloc] initWithNodeID:nodeID controller:self]; + MTRDevice * deviceToReturn = [[MTRDevice alloc] initWithNodeID:nodeID controller:self]; // If we're not running, don't add the device to our map. That would // create a cycle that nothing would break. Just return the device, // which will be in exactly the state it would be in if it were created @@ -1105,14 +1131,14 @@ + (nullable NSData *)computePASEVerifierForSetupPasscode:(NSNumber *)setupPassco MATTER_LOG_METRIC_SCOPE(kMetricPASEVerifierForSetupCode, err); - if ([MTRDeviceController checkForError:err logMsg:kErrorSpake2pVerifierGenerationFailed error:error]) { + if ([MTRDeviceController_Concrete checkForError:err logMsg:kDeviceControllerErrorSpake2pVerifierGenerationFailed error:error]) { return nil; } uint8_t serializedBuffer[chip::Crypto::kSpake2p_VerifierSerialized_Length]; chip::MutableByteSpan serializedBytes(serializedBuffer); err = verifier.Serialize(serializedBytes); - if ([MTRDeviceController checkForError:err logMsg:kErrorSpake2pVerifierSerializationFailed error:error]) { + if ([MTRDeviceController_Concrete checkForError:err logMsg:kDeviceControllerErrorSpake2pVerifierSerializationFailed error:error]) { return nil; } @@ -1129,13 +1155,13 @@ - (NSData * _Nullable)attestationChallengeForDeviceID:(NSNumber *)deviceID MATTER_LOG_METRIC_SCOPE(kMetricAttestationChallengeForDevice, errorCode); errorCode = self->_cppCommissioner->GetDeviceBeingCommissioned([deviceID unsignedLongLongValue], &deviceProxy); - VerifyOrReturnValue(![MTRDeviceController checkForError:errorCode logMsg:kErrorGetCommissionee error:nil], nil); + VerifyOrReturnValue(![MTRDeviceController_Concrete checkForError:errorCode logMsg:kDeviceControllerErrorGetCommissionee error:nil], nil); uint8_t challengeBuffer[chip::Crypto::kAES_CCM128_Key_Length]; chip::ByteSpan challenge(challengeBuffer); errorCode = deviceProxy->GetAttestationChallenge(challenge); - VerifyOrReturnValue(![MTRDeviceController checkForError:errorCode logMsg:kErrorGetAttestationChallenge error:nil], nil); + VerifyOrReturnValue(![MTRDeviceController_Concrete checkForError:errorCode logMsg:kDeviceControllerErrorGetAttestationChallenge error:nil], nil); return AsData(challenge); }; @@ -1272,7 +1298,7 @@ - (BOOL)checkIsRunning:(NSError * __autoreleasing *)error return YES; } - MTR_LOG_ERROR("MTRDeviceController: %@ Error: %s", self, [kErrorNotRunning UTF8String]); + MTR_LOG_ERROR("MTRDeviceController: %@ Error: %s", self, [kDeviceControllerErrorNotRunning UTF8String]); if (error) { *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]; } @@ -1582,63 +1608,6 @@ + (void)forceLocalhostAdvertisingOnly @end -/** - * Shim to allow us to treat an MTRDevicePairingDelegate as an - * MTRDeviceControllerDelegate. - */ -@interface MTRDevicePairingDelegateShim : NSObject -@property (nonatomic, readonly) id delegate; -- (instancetype)initWithDelegate:(id)delegate; -@end - -@implementation MTRDevicePairingDelegateShim -- (instancetype)initWithDelegate:(id)delegate -{ - if (self = [super init]) { - _delegate = delegate; - } - return self; -} - -- (BOOL)respondsToSelector:(SEL)selector -{ - if (selector == @selector(controller:statusUpdate:)) { - return [self.delegate respondsToSelector:@selector(onStatusUpdate:)]; - } - - if (selector == @selector(controller:commissioningSessionEstablishmentDone:)) { - return [self.delegate respondsToSelector:@selector(onPairingComplete:)]; - } - - if (selector == @selector(controller:commissioningComplete:)) { - return [self.delegate respondsToSelector:@selector(onCommissioningComplete:)]; - } - - return [super respondsToSelector:selector]; -} - -- (void)controller:(MTRDeviceController *)controller statusUpdate:(MTRCommissioningStatus)status -{ - [self.delegate onStatusUpdate:static_cast(status)]; -} - -- (void)controller:(MTRDeviceController *)controller commissioningSessionEstablishmentDone:(NSError * _Nullable)error -{ - [self.delegate onPairingComplete:error]; -} - -- (void)controller:(MTRDeviceController *)controller commissioningComplete:(NSError * _Nullable)error -{ - [self.delegate onCommissioningComplete:error]; -} - -- (void)onPairingDeleted:(NSError * _Nullable)error -{ - [self.delegate onPairingDeleted:error]; -} - -@end - /** * Shim to allow us to treat an MTRNOCChainIssuer as an * MTROperationalCertificateIssuer. @@ -1649,58 +1618,7 @@ @interface MTROperationalCertificateChainIssuerShim : NSObject )nocChainIssuer; @end -@implementation MTROperationalCertificateChainIssuerShim -- (instancetype)initWithIssuer:(id)nocChainIssuer -{ - if (self = [super init]) { - _nocChainIssuer = nocChainIssuer; - _shouldSkipAttestationCertificateValidation = YES; - } - return self; -} - -- (void)issueOperationalCertificateForRequest:(MTROperationalCSRInfo *)csrInfo - attestationInfo:(MTRDeviceAttestationInfo *)attestationInfo - controller:(MTRDeviceController *)controller - completion:(void (^)(MTROperationalCertificateChain * _Nullable info, - NSError * _Nullable error))completion -{ - CSRInfo * oldCSRInfo = [[CSRInfo alloc] initWithNonce:csrInfo.csrNonce - elements:csrInfo.csrElementsTLV - elementsSignature:csrInfo.attestationSignature - csr:csrInfo.csr]; - NSData * _Nullable firmwareInfo = attestationInfo.firmwareInfo; - if (firmwareInfo == nil) { - firmwareInfo = [NSData data]; - } - AttestationInfo * oldAttestationInfo = - [[AttestationInfo alloc] initWithChallenge:attestationInfo.challenge - nonce:attestationInfo.nonce - elements:attestationInfo.elementsTLV - elementsSignature:attestationInfo.elementsSignature - dac:attestationInfo.deviceAttestationCertificate - pai:attestationInfo.productAttestationIntermediateCertificate - certificationDeclaration:attestationInfo.certificationDeclaration - firmwareInfo:firmwareInfo]; - [self.nocChainIssuer - onNOCChainGenerationNeeded:oldCSRInfo - attestationInfo:oldAttestationInfo - onNOCChainGenerationComplete:^(NSData * operationalCertificate, NSData * intermediateCertificate, NSData * rootCertificate, - NSData * _Nullable ipk, NSNumber * _Nullable adminSubject, NSError * __autoreleasing * error) { - auto * chain = [[MTROperationalCertificateChain alloc] initWithOperationalCertificate:operationalCertificate - intermediateCertificate:intermediateCertificate - rootCertificate:rootCertificate - adminSubject:adminSubject]; - completion(chain, nil); - if (error != nil) { - *error = nil; - } - }]; -} - -@end - -@implementation MTRDeviceController (Deprecated) +@implementation MTRDeviceController_Concrete (Deprecated) - (NSNumber *)controllerNodeId { @@ -1768,7 +1686,7 @@ - (BOOL)pairDevice:(uint64_t)deviceID payload.setUpPINCode = setupPINCode; errorCode = chip::ManualSetupPayloadGenerator(payload).payloadDecimalStringRepresentation(manualPairingCode); - VerifyOrReturnValue(![MTRDeviceController checkForError:errorCode logMsg:kErrorSetupCodeGen error:error], NO); + VerifyOrReturnValue(![MTRDeviceController_Concrete checkForError:errorCode logMsg:kDeviceControllerErrorSetupCodeGen error:error], NO); self->_operationalCredentialsDelegate->SetDeviceID(deviceID); @@ -1780,7 +1698,7 @@ - (BOOL)pairDevice:(uint64_t)deviceID MATTER_LOG_METRIC_END(kMetricSetupPASESession, errorCode); } - return ![MTRDeviceController checkForError:errorCode logMsg:kErrorPairDevice error:error]; + return ![MTRDeviceController_Concrete checkForError:errorCode logMsg:kDeviceControllerErrorPairDevice error:error]; }; auto success = [self syncRunOnWorkQueueWithBoolReturnValue:block error:error]; @@ -1825,7 +1743,7 @@ - (BOOL)pairDevice:(uint64_t)deviceID MATTER_LOG_METRIC_END(kMetricSetupPASESession, errorCode); } - return ![MTRDeviceController checkForError:errorCode logMsg:kErrorPairDevice error:error]; + return ![MTRDeviceController_Concrete checkForError:errorCode logMsg:kDeviceControllerErrorPairDevice error:error]; }; auto success = [self syncRunOnWorkQueueWithBoolReturnValue:block error:error]; @@ -1861,7 +1779,7 @@ - (BOOL)pairDevice:(uint64_t)deviceID onboardingPayload:(NSString *)onboardingPa MATTER_LOG_METRIC_END(kMetricSetupPASESession, errorCode); } - return ![MTRDeviceController checkForError:errorCode logMsg:kErrorPairDevice error:error]; + return ![MTRDeviceController_Concrete checkForError:errorCode logMsg:kDeviceControllerErrorPairDevice error:error]; }; auto success = [self syncRunOnWorkQueueWithBoolReturnValue:block error:error]; @@ -1904,7 +1822,7 @@ - (BOOL)openPairingWindow:(uint64_t)deviceID duration:(NSUInteger)duration error errorCode = chip::Controller::AutoCommissioningWindowOpener::OpenBasicCommissioningWindow( self->_cppCommissioner, deviceID, chip::System::Clock::Seconds16(static_cast(duration))); - return ![MTRDeviceController checkForError:errorCode logMsg:kErrorOpenPairingWindow error:error]; + return ![MTRDeviceController_Concrete checkForError:errorCode logMsg:kDeviceControllerErrorOpenPairingWindow error:error]; }; return [self syncRunOnWorkQueueWithBoolReturnValue:block error:error]; @@ -1952,7 +1870,7 @@ - (NSString *)openPairingWindowWithPIN:(uint64_t)deviceID static_cast(discriminator), chip::MakeOptional(static_cast(setupPIN)), chip::NullOptional, setupPayload); - VerifyOrReturnValue(![MTRDeviceController checkForError:errorCode logMsg:kErrorOpenPairingWindow error:error], nil); + VerifyOrReturnValue(![MTRDeviceController_Concrete checkForError:errorCode logMsg:kDeviceControllerErrorOpenPairingWindow error:error], nil); chip::ManualSetupPayloadGenerator generator(setupPayload); std::string outCode; diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h b/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h index 479dd8518d069f..d943775d43475d 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h @@ -32,8 +32,11 @@ #import "MTRBaseDevice.h" #import "MTRDeviceController.h" #import "MTRDeviceControllerDataStore.h" +#import "MTRDeviceControllerDelegate.h" #import "MTRDeviceStorageBehaviorConfiguration.h" +#import + #import #import #import @@ -44,6 +47,9 @@ @class MTRDeviceControllerFactory; @class MTRDevice; @class MTRAsyncWorkQueue; +@protocol MTRDevicePairingDelegate; +@protocol MTRDeviceControllerDelegate; +@class MTRDevice_Concrete; namespace chip { class FabricTable; @@ -57,6 +63,8 @@ NS_ASSUME_NONNULL_BEGIN @interface MTRDeviceController () +- (instancetype)initForSubclasses; + #pragma mark - MTRDeviceControllerFactory methods /** @@ -273,4 +281,34 @@ NS_ASSUME_NONNULL_BEGIN @end +/** + * Shim to allow us to treat an MTRDevicePairingDelegate as an + * MTRDeviceControllerDelegate. + */ +@interface MTRDevicePairingDelegateShim : NSObject +@property (nonatomic, readonly) id delegate; +- (instancetype)initWithDelegate:(id)delegate; +@end + +static NSString * const kDeviceControllerErrorCommissionerInit = @"Init failure while initializing a commissioner"; +static NSString * const kDeviceControllerErrorIPKInit = @"Init failure while initializing IPK"; +static NSString * const kDeviceControllerErrorSigningKeypairInit = @"Init failure while creating signing keypair bridge"; +static NSString * const kDeviceControllerErrorOperationalCredentialsInit = @"Init failure while creating operational credentials delegate"; +static NSString * const kDeviceControllerErrorOperationalKeypairInit = @"Init failure while creating operational keypair bridge"; +static NSString * const kDeviceControllerErrorPairingInit = @"Init failure while creating a pairing delegate"; +static NSString * const kDeviceControllerErrorPartialDacVerifierInit = @"Init failure while creating a partial DAC verifier"; +static NSString * const kDeviceControllerErrorPairDevice = @"Failure while pairing the device"; +static NSString * const kDeviceControllerErrorStopPairing = @"Failure while trying to stop the pairing process"; +static NSString * const kDeviceControllerErrorOpenPairingWindow = @"Open Pairing Window failed"; +static NSString * const kDeviceControllerErrorNotRunning = @"Controller is not running. Call startup first."; +static NSString * const kDeviceControllerErrorSetupCodeGen = @"Generating Manual Pairing Code failed"; +static NSString * const kDeviceControllerErrorGenerateNOC = @"Generating operational certificate failed"; +static NSString * const kDeviceControllerErrorKeyAllocation = @"Generating new operational key failed"; +static NSString * const kDeviceControllerErrorCSRValidation = @"Extracting public key from CSR failed"; +static NSString * const kDeviceControllerErrorGetCommissionee = @"Failure obtaining device being commissioned"; +static NSString * const kDeviceControllerErrorGetAttestationChallenge = @"Failure getting attestation challenge"; +static NSString * const kDeviceControllerErrorSpake2pVerifierGenerationFailed = @"PASE verifier generation failed"; +static NSString * const kDeviceControllerErrorSpake2pVerifierSerializationFailed = @"PASE verifier serialization failed"; +static NSString * const kDeviceControllerErrorCDCertStoreInit = @"Init failure while initializing Certificate Declaration Signing Keys store"; + NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index bb5a8ce1801631..2dc7bd266a4335 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -302,6 +302,8 @@ 99AECC802798A57F00B6355B /* MTRCommissioningParameters.mm in Sources */ = {isa = PBXBuildFile; fileRef = 99AECC7F2798A57E00B6355B /* MTRCommissioningParameters.mm */; }; 99C65E10267282F1003402F6 /* MTRControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 99C65E0F267282F1003402F6 /* MTRControllerTests.m */; }; 99D466E12798936D0089A18F /* MTRCommissioningParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 99D466E02798936D0089A18F /* MTRCommissioningParameters.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9B231B042C62EF650030EB37 /* MTRDeviceController_Concrete.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B231B022C62EF650030EB37 /* MTRDeviceController_Concrete.h */; }; + 9B231B052C62EF650030EB37 /* MTRDeviceController_Concrete.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9B231B032C62EF650030EB37 /* MTRDeviceController_Concrete.mm */; }; 9BDA2A062C5D9AF800A32BDD /* MTRDevice_Concrete.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9BDA2A052C5D9AF800A32BDD /* MTRDevice_Concrete.mm */; }; 9BDA2A082C5D9AFB00A32BDD /* MTRDevice_Concrete.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BDA2A072C5D9AFB00A32BDD /* MTRDevice_Concrete.h */; }; AF1CB86E2874B03B00865A96 /* MTROTAProviderDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = AF1CB86D2874B03B00865A96 /* MTROTAProviderDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -731,6 +733,8 @@ 99AECC7F2798A57E00B6355B /* MTRCommissioningParameters.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRCommissioningParameters.mm; sourceTree = ""; }; 99C65E0F267282F1003402F6 /* MTRControllerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MTRControllerTests.m; sourceTree = ""; }; 99D466E02798936D0089A18F /* MTRCommissioningParameters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRCommissioningParameters.h; sourceTree = ""; }; + 9B231B022C62EF650030EB37 /* MTRDeviceController_Concrete.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRDeviceController_Concrete.h; sourceTree = ""; }; + 9B231B032C62EF650030EB37 /* MTRDeviceController_Concrete.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRDeviceController_Concrete.mm; sourceTree = ""; }; 9BDA2A052C5D9AF800A32BDD /* MTRDevice_Concrete.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRDevice_Concrete.mm; sourceTree = ""; }; 9BDA2A072C5D9AFB00A32BDD /* MTRDevice_Concrete.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRDevice_Concrete.h; sourceTree = ""; }; AF1CB86D2874B03B00865A96 /* MTROTAProviderDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTROTAProviderDelegate.h; sourceTree = ""; }; @@ -1242,6 +1246,8 @@ B202528F2459E34F00F97062 /* CHIP */ = { isa = PBXGroup; children = ( + 9B231B022C62EF650030EB37 /* MTRDeviceController_Concrete.h */, + 9B231B032C62EF650030EB37 /* MTRDeviceController_Concrete.mm */, 88E07D602B9A89A4005FD53E /* MTRMetricKeys.h */, 88FA798B2B7B257100CD4B6F /* MTRMetricsCollector.h */, 88FA798C2B7B257100CD4B6F /* MTRMetricsCollector.mm */, @@ -1676,6 +1682,7 @@ 51E51FC0282AD37A00FC978D /* MTRDeviceControllerStartupParams_Internal.h in Headers */, 3DECCB702934AECD00585AEC /* MTRLogging.h in Headers */, 1E4D654E29C208DD00BC3478 /* MTRCommissionableBrowserResult.h in Headers */, + 9B231B042C62EF650030EB37 /* MTRDeviceController_Concrete.h in Headers */, 515BE4ED2B72C0C5000BC1FD /* MTRUnfairLock.h in Headers */, 998F286F26D55EC5001846C6 /* MTRP256KeypairBridge.h in Headers */, 2C222ADF255C811800E446B9 /* MTRBaseDevice_Internal.h in Headers */, @@ -1986,6 +1993,7 @@ 511913FB28C100EF009235E9 /* MTRBaseSubscriptionCallback.mm in Sources */, 510470FB2A2F7DF60053EA7E /* MTRBackwardsCompatShims.mm in Sources */, 5173A47629C0E2ED00F67F48 /* MTRFabricInfo.mm in Sources */, + 9B231B052C62EF650030EB37 /* MTRDeviceController_Concrete.mm in Sources */, 5ACDDD7D27CD16D200EFD68A /* MTRClusterStateCacheContainer.mm in Sources */, 75B3269E2BCDB9EA00E17C4E /* MTRDeviceConnectivityMonitor.mm in Sources */, 513DDB8A2761F6F900DAA01A /* MTRAttributeTLVValueDecoder.mm in Sources */, From 05671a16871800eb0b0338b583759d6aff7a65d8 Mon Sep 17 00:00:00 2001 From: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com> Date: Thu, 15 Aug 2024 14:51:44 -0400 Subject: [PATCH 32/59] Update silabs docker image (#35011) Co-authored-by: Andrei Litvin --- integrations/docker/images/base/chip-build/version | 2 +- .../images/stage-2/chip-build-efr32/Dockerfile | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/integrations/docker/images/base/chip-build/version b/integrations/docker/images/base/chip-build/version index dfc4231a8e7a46..0ca6f37e4e236e 100644 --- a/integrations/docker/images/base/chip-build/version +++ b/integrations/docker/images/base/chip-build/version @@ -1 +1 @@ -73 : [Telink] Update Docker image (Zephyr update) +74 : Update Silabs docker SiSDK 2024.06.1 WiseConnect 3.3.1 Wiseconnect Wifi bt sdk 2.10.0 diff --git a/integrations/docker/images/stage-2/chip-build-efr32/Dockerfile b/integrations/docker/images/stage-2/chip-build-efr32/Dockerfile index 7927c5ef1ed4fc..4de8beb62a81be 100644 --- a/integrations/docker/images/stage-2/chip-build-efr32/Dockerfile +++ b/integrations/docker/images/stage-2/chip-build-efr32/Dockerfile @@ -13,8 +13,8 @@ RUN set -x \ && : # last line -# Download Simplicity SDK v2024.6.0 (a1a37fa) -RUN wget https://github.com/SiliconLabs/simplicity_sdk/releases/download/v2024.6.0/sisdk-sdk.zip -O /tmp/simplicity_sdk.zip \ +# Download Simplicity SDK v2024.6.1 (a1a37fa) +RUN wget https://github.com/SiliconLabs/simplicity_sdk/releases/download/v2024.6.1-0/sisdk-sdk.zip -O /tmp/simplicity_sdk.zip \ && unzip /tmp/simplicity_sdk.zip -d /tmp/simplicity_sdk \ && rm -rf /tmp/simplicity_sdk.zip \ # Deleting files that are not needed to save space @@ -23,14 +23,14 @@ RUN wget https://github.com/SiliconLabs/simplicity_sdk/releases/download/v2024.6 && find /tmp/simplicity_sdk/protocol/openthread -name "*efr32mg21*" -delete \ && : # last line -# Clone WiSeConnect Wi-Fi and Bluetooth Software 2.8.2 (4fa5c5f) -RUN git clone --depth=1 --single-branch --branch=2.8.2 https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk.git /tmp/wiseconnect-wifi-bt-sdk && \ +# Clone WiSeConnect Wi-Fi and Bluetooth Software 2.10.0 (f94b83d) +RUN git clone --depth=1 --single-branch --branch=2.10.0 https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk.git /tmp/wiseconnect-wifi-bt-sdk && \ cd /tmp/wiseconnect-wifi-bt-sdk && \ rm -rf .git \ && : # last line -# Clone WiSeConnect SDK v3.3.0 (e97a0ed) -RUN git clone --depth=1 --single-branch --branch=v3.3.0 https://github.com/SiliconLabs/wiseconnect.git /tmp/wifi_sdk && \ +# Clone WiSeConnect SDK v3.3.1 (841ea3f) +RUN git clone --depth=1 --single-branch --branch=v3.3.1 https://github.com/SiliconLabs/wiseconnect.git /tmp/wifi_sdk && \ cd /tmp/wifi_sdk && \ rm -rf .git \ && : # last line From ede44b33a4b1153c4c31410321d7b6097bae26aa Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 15 Aug 2024 15:22:34 -0400 Subject: [PATCH 33/59] Make BRBINFO_4_1 require commissioning (#35017) * Make BRVINFO_4_1 require commissioning * Also add icd registration --------- Co-authored-by: Andrei Litvin --- src/python_testing/TC_BRBINFO_4_1.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/python_testing/TC_BRBINFO_4_1.py b/src/python_testing/TC_BRBINFO_4_1.py index 18e478c872fe2f..922a6cb555448c 100644 --- a/src/python_testing/TC_BRBINFO_4_1.py +++ b/src/python_testing/TC_BRBINFO_4_1.py @@ -57,7 +57,8 @@ def desc_TC_BRBINFO_4_1(self) -> str: def steps_TC_BRBINFO_4_1(self) -> list[TestStep]: steps = [ - TestStep("0", "Preconditions"), + TestStep("0", "DUT commissioned", is_commissioning=True), + TestStep("0a", "Preconditions"), TestStep("1a", "TH reads from the ICD the A_IDLE_MODE_DURATION, A_ACTIVE_MODE_DURATION, and ACTIVE_MODE_THRESHOLD attributes"), TestStep("1b", "Simple KeepActive command w/ subscription. ActiveChanged event received by TH contains PromisedActiveDuration"), TestStep("2", "Sends 3x KeepActive commands w/ subscription. ActiveChanged event received ONCE and contains PromisedActiveDuration"), @@ -73,7 +74,7 @@ def _ask_for_vendor_commissioniong_ux_operation(self, discriminator, setupPinCod f"- setupQRCode: {setupQRCode}\n" f"- setupManualcode: {setupManualCode}\n" f"If using FabricSync Admin test app, you may type:\n" - f">>> pairing onnetwork 111 {setupPinCode}") + f">>> pairing onnetwork 111 {setupPinCode} --icd-registration true") async def _send_keep_active_command(self, duration, endpoint_id) -> int: logging.info("Sending keep active command") @@ -164,9 +165,11 @@ async def test_TC_BRBINFO_4_1(self): dynamic_endpoint_id = await self._get_dynamic_endpoint() logging.info(f"Dynamic endpoint is {dynamic_endpoint_id}") - # Preconditions self.step("0") + # Preconditions + self.step("0a") + logging.info("Ensuring DUT is commissioned to TH") # Confirms commissioning of DUT on TH as it reads its fature map From 50ede86c4947543d2f990bd41904ab4ab4932b79 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 15 Aug 2024 15:31:20 -0400 Subject: [PATCH 34/59] Disable TI builds from CI (#35024) Co-authored-by: Andrei Litvin --- .github/workflows/examples-cc13xx_26xx.yaml | 14 +++++++++----- .github/workflows/examples-cc32xx.yaml | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/examples-cc13xx_26xx.yaml b/.github/workflows/examples-cc13xx_26xx.yaml index d462d9f2725bbb..9d1ba6aa6ccc7e 100644 --- a/.github/workflows/examples-cc13xx_26xx.yaml +++ b/.github/workflows/examples-cc13xx_26xx.yaml @@ -15,11 +15,15 @@ name: Build example - TI CC13XX_26XX on: - push: - branches-ignore: - - "dependabot/**" - pull_request: - merge_group: + workflow_dispatch: + # Temporarely disabled: + # - TI CI runs out of disk space + # - Image should be updated to an Ubuntu 24.04 or higher based one (move from :54 version) + # push: + # branches-ignore: + # - 'dependabot/**' + # pull_request: + # merge_group: concurrency: group: diff --git a/.github/workflows/examples-cc32xx.yaml b/.github/workflows/examples-cc32xx.yaml index 564cd34dddd5b2..dedf9e9c79df23 100644 --- a/.github/workflows/examples-cc32xx.yaml +++ b/.github/workflows/examples-cc32xx.yaml @@ -15,11 +15,15 @@ name: Build example - TI CC32XX on: - push: - branches-ignore: - - 'dependabot/**' - pull_request: - merge_group: + workflow_dispatch: + # Temporarely disabled: + # - TI CI runs out of disk space + # - Image should be updated to an Ubuntu 24.04 or higher based one (move from :54 version) + # push: + # branches-ignore: + # - 'dependabot/**' + # pull_request: + # merge_group: concurrency: group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} From 6cdd2747904e631c10bd2f52102d83bd2638e02c Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 15 Aug 2024 15:56:03 -0400 Subject: [PATCH 35/59] Fix header usage in rvc (#35025) Co-authored-by: Andrei Litvin --- examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h b/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h index 4c13fcd493d7eb..fdad4f83f0666a 100644 --- a/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h +++ b/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include namespace chip { namespace app { From e8e9fc5a21d825b1b5b718dc328a11e486e2f6fa Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Thu, 15 Aug 2024 14:25:38 -0700 Subject: [PATCH 36/59] [Fabric-Admin] Add API to commission local bridge within its own fabric (#35020) * Add local bridge handle API * Update examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp Co-authored-by: saurabhst * Update examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp Co-authored-by: saurabhst * Use VerifyOrDie to check pairingCommand --------- Co-authored-by: saurabhst --- .../commands/fabric-sync/Commands.h | 2 + .../fabric-sync/FabricSyncCommand.cpp | 121 ++++++++++++++++-- .../commands/fabric-sync/FabricSyncCommand.h | 47 ++++++- .../device_manager/DeviceManager.cpp | 25 +++- .../device_manager/DeviceManager.h | 30 ++++- 5 files changed, 210 insertions(+), 15 deletions(-) diff --git a/examples/fabric-admin/commands/fabric-sync/Commands.h b/examples/fabric-admin/commands/fabric-sync/Commands.h index 94de1d31d8ba09..a6bf1c258f9475 100644 --- a/examples/fabric-admin/commands/fabric-sync/Commands.h +++ b/examples/fabric-admin/commands/fabric-sync/Commands.h @@ -28,6 +28,8 @@ void registerCommandsFabricSync(Commands & commands, CredentialIssuerCommands * commands_list clusterCommands = { make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), }; diff --git a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp index f62d85ce5afd40..704996d189d9c2 100644 --- a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp +++ b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp @@ -32,10 +32,6 @@ using namespace ::chip; namespace { -// Constants -constexpr uint32_t kCommissionPrepareTimeMs = 500; -constexpr uint16_t kMaxManaulCodeLength = 21; - void CheckFabricBridgeSynchronizationSupport(intptr_t ignored) { DeviceMgr().ReadSupportedDeviceCategories(); @@ -43,7 +39,7 @@ void CheckFabricBridgeSynchronizationSupport(intptr_t ignored) } // namespace -void FabricSyncAddBridgeCommand::OnCommissioningComplete(chip::NodeId deviceId, CHIP_ERROR err) +void FabricSyncAddBridgeCommand::OnCommissioningComplete(NodeId deviceId, CHIP_ERROR err) { if (mBridgeNodeId != deviceId) { @@ -90,7 +86,7 @@ CHIP_ERROR FabricSyncAddBridgeCommand::RunCommand(NodeId remoteId) if (DeviceMgr().IsFabricSyncReady()) { // print to console - fprintf(stderr, "Remote Fabric Bridge has been alread configured."); + fprintf(stderr, "Remote Fabric Bridge has already been configured."); return CHIP_NO_ERROR; } @@ -98,7 +94,7 @@ CHIP_ERROR FabricSyncAddBridgeCommand::RunCommand(NodeId remoteId) if (pairingCommand == nullptr) { - ChipLogError(NotSpecified, "Pairing onnetwork command is not available"); + ChipLogError(NotSpecified, "Pairing already-discovered command is not available"); return CHIP_ERROR_NOT_IMPLEMENTED; } @@ -110,7 +106,7 @@ CHIP_ERROR FabricSyncAddBridgeCommand::RunCommand(NodeId remoteId) return CHIP_NO_ERROR; } -void FabricSyncRemoveBridgeCommand::OnDeviceRemoved(chip::NodeId deviceId, CHIP_ERROR err) +void FabricSyncRemoveBridgeCommand::OnDeviceRemoved(NodeId deviceId, CHIP_ERROR err) { if (mBridgeNodeId != deviceId) { @@ -150,7 +146,7 @@ CHIP_ERROR FabricSyncRemoveBridgeCommand::RunCommand() if (pairingCommand == nullptr) { - ChipLogError(NotSpecified, "Pairing code command is not available"); + ChipLogError(NotSpecified, "Pairing unpair command is not available"); return CHIP_ERROR_NOT_IMPLEMENTED; } @@ -161,13 +157,116 @@ CHIP_ERROR FabricSyncRemoveBridgeCommand::RunCommand() return CHIP_NO_ERROR; } +void FabricSyncAddLocalBridgeCommand::OnCommissioningComplete(NodeId deviceId, CHIP_ERROR err) +{ + if (mLocalBridgeNodeId != deviceId) + { + if (err != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to pair non-bridge device (0x:" ChipLogFormatX64 ") with error: %" CHIP_ERROR_FORMAT, + ChipLogValueX64(deviceId), err.Format()); + } + else + { + ChipLogProgress(NotSpecified, "Commissioning complete for non-bridge device: NodeId: " ChipLogFormatX64, + ChipLogValueX64(deviceId)); + } + return; + } + + if (err == CHIP_NO_ERROR) + { + DeviceMgr().SetLocalBridgeNodeId(mLocalBridgeNodeId); + ChipLogProgress(NotSpecified, "Successfully paired local bridge device: NodeId: " ChipLogFormatX64, + ChipLogValueX64(mLocalBridgeNodeId)); + } + else + { + ChipLogError(NotSpecified, "Failed to pair local bridge device (0x:" ChipLogFormatX64 ") with error: %" CHIP_ERROR_FORMAT, + ChipLogValueX64(deviceId), err.Format()); + } + + mLocalBridgeNodeId = kUndefinedNodeId; +} + +CHIP_ERROR FabricSyncAddLocalBridgeCommand::RunCommand(NodeId deviceId) +{ + if (DeviceMgr().IsLocalBridgeReady()) + { + // print to console + fprintf(stderr, "Local Fabric Bridge has already been configured."); + return CHIP_NO_ERROR; + } + + PairingCommand * pairingCommand = static_cast(CommandMgr().GetCommandByName("pairing", "already-discovered")); + VerifyOrDie(pairingCommand != nullptr); + + pairingCommand->RegisterCommissioningDelegate(this); + mLocalBridgeNodeId = deviceId; + + DeviceMgr().PairLocalFabricBridge(deviceId); + + return CHIP_NO_ERROR; +} + +void FabricSyncRemoveLocalBridgeCommand::OnDeviceRemoved(NodeId deviceId, CHIP_ERROR err) +{ + if (mLocalBridgeNodeId != deviceId) + { + ChipLogProgress(NotSpecified, "A non-bridge device: NodeId: " ChipLogFormatX64 " is removed.", ChipLogValueX64(deviceId)); + return; + } + + if (err == CHIP_NO_ERROR) + { + DeviceMgr().SetLocalBridgeNodeId(kUndefinedNodeId); + ChipLogProgress(NotSpecified, "Successfully removed local bridge device: NodeId: " ChipLogFormatX64, + ChipLogValueX64(mLocalBridgeNodeId)); + } + else + { + ChipLogError(NotSpecified, "Failed to remove local bridge device (0x:" ChipLogFormatX64 ") with error: %" CHIP_ERROR_FORMAT, + ChipLogValueX64(deviceId), err.Format()); + } + + mLocalBridgeNodeId = kUndefinedNodeId; +} + +CHIP_ERROR FabricSyncRemoveLocalBridgeCommand::RunCommand() +{ + NodeId bridgeNodeId = DeviceMgr().GetLocalBridgeNodeId(); + + if (bridgeNodeId == kUndefinedNodeId) + { + // print to console + fprintf(stderr, "Local Fabric Bridge is not configured yet, nothing to remove."); + return CHIP_NO_ERROR; + } + + mLocalBridgeNodeId = bridgeNodeId; + + PairingCommand * pairingCommand = static_cast(CommandMgr().GetCommandByName("pairing", "unpair")); + + if (pairingCommand == nullptr) + { + ChipLogError(NotSpecified, "Pairing unpair command is not available"); + return CHIP_ERROR_NOT_IMPLEMENTED; + } + + pairingCommand->RegisterPairingDelegate(this); + + DeviceMgr().UnpairLocalFabricBridge(); + + return CHIP_NO_ERROR; +} + void FabricSyncDeviceCommand::OnCommissioningWindowOpened(NodeId deviceId, CHIP_ERROR err, chip::SetupPayload payload) { ChipLogProgress(NotSpecified, "FabricSyncDeviceCommand::OnCommissioningWindowOpened"); if (err == CHIP_NO_ERROR) { - char payloadBuffer[kMaxManaulCodeLength + 1]; + char payloadBuffer[kMaxManualCodeLength + 1]; MutableCharSpan manualCode(payloadBuffer); CHIP_ERROR error = ManualSetupPayloadGenerator(payload).payloadDecimalStringRepresentation(manualCode); if (error == CHIP_NO_ERROR) @@ -202,7 +301,7 @@ void FabricSyncDeviceCommand::OnCommissioningWindowOpened(NodeId deviceId, CHIP_ } } -void FabricSyncDeviceCommand::OnCommissioningComplete(chip::NodeId deviceId, CHIP_ERROR err) +void FabricSyncDeviceCommand::OnCommissioningComplete(NodeId deviceId, CHIP_ERROR err) { if (mAssignedNodeId != deviceId) { diff --git a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.h b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.h index ca1b105207f832..1bbd22d293f39d 100644 --- a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.h +++ b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.h @@ -22,6 +22,10 @@ #include #include +// Constants +constexpr uint32_t kCommissionPrepareTimeMs = 500; +constexpr uint16_t kMaxManualCodeLength = 21; + class FabricSyncAddBridgeCommand : public CHIPCommand, public CommissioningDelegate { public: @@ -31,7 +35,7 @@ class FabricSyncAddBridgeCommand : public CHIPCommand, public CommissioningDeleg AddArgument("device-remote-ip", &mRemoteAddr); } - void OnCommissioningComplete(NodeId deviceId, CHIP_ERROR err) override; + void OnCommissioningComplete(chip::NodeId deviceId, CHIP_ERROR err) override; /////////// CHIPCommand Interface ///////// CHIP_ERROR RunCommand() override { return RunCommand(mNodeId); } @@ -63,6 +67,47 @@ class FabricSyncRemoveBridgeCommand : public CHIPCommand, public PairingDelegate chip::NodeId mBridgeNodeId; }; +class FabricSyncAddLocalBridgeCommand : public CHIPCommand, public CommissioningDelegate +{ +public: + FabricSyncAddLocalBridgeCommand(CredentialIssuerCommands * credIssuerCommands) : + CHIPCommand("add-local-bridge", credIssuerCommands) + { + AddArgument("nodeid", 0, UINT64_MAX, &mNodeId); + } + + void OnCommissioningComplete(NodeId deviceId, CHIP_ERROR err) override; + + /////////// CHIPCommand Interface ///////// + CHIP_ERROR RunCommand() override { return RunCommand(mNodeId); } + + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(1); } + +private: + chip::NodeId mNodeId; + chip::NodeId mLocalBridgeNodeId; + + CHIP_ERROR RunCommand(chip::NodeId deviceId); +}; + +class FabricSyncRemoveLocalBridgeCommand : public CHIPCommand, public PairingDelegate +{ +public: + FabricSyncRemoveLocalBridgeCommand(CredentialIssuerCommands * credIssuerCommands) : + CHIPCommand("remove-local-bridge", credIssuerCommands) + {} + + void OnDeviceRemoved(chip::NodeId deviceId, CHIP_ERROR err) override; + + /////////// CHIPCommand Interface ///////// + CHIP_ERROR RunCommand() override; + + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(1); } + +private: + chip::NodeId mLocalBridgeNodeId; +}; + class FabricSyncDeviceCommand : public CHIPCommand, public CommissioningWindowDelegate, public CommissioningDelegate { public: diff --git a/examples/fabric-admin/device_manager/DeviceManager.cpp b/examples/fabric-admin/device_manager/DeviceManager.cpp index 7204e153d2807f..17adcc2427f9c6 100644 --- a/examples/fabric-admin/device_manager/DeviceManager.cpp +++ b/examples/fabric-admin/device_manager/DeviceManager.cpp @@ -33,6 +33,7 @@ namespace { // Constants constexpr uint32_t kSetupPinCode = 20202021; constexpr uint16_t kRemoteBridgePort = 5540; +constexpr uint16_t kLocalBridgePort = 5540; constexpr uint16_t kWindowTimeout = 300; constexpr uint16_t kIteration = 1000; constexpr uint16_t kSubscribeMinInterval = 0; @@ -117,6 +118,8 @@ void DeviceManager::RemoveSyncedDevice(NodeId nodeId) void DeviceManager::OpenDeviceCommissioningWindow(NodeId nodeId, uint32_t commissioningTimeout, uint32_t iterations, uint32_t discriminator, const char * saltHex, const char * verifierHex) { + ChipLogProgress(NotSpecified, "Open the commissioning window of device with NodeId:" ChipLogFormatX64, ChipLogValueX64(nodeId)); + // Open the commissioning window of a device within its own fabric. StringBuilder commandBuilder; @@ -132,7 +135,7 @@ void DeviceManager::OpenRemoteDeviceCommissioningWindow(EndpointId remoteEndpoin // Open the commissioning window of a device from another fabric via its fabric bridge. // This method constructs and sends a command to open the commissioning window for a device // that is part of a different fabric, accessed through a fabric bridge. - StringBuilder<512> commandBuilder; + StringBuilder commandBuilder; // Use random discriminator to have less chance of collission. uint16_t discriminator = @@ -166,6 +169,16 @@ void DeviceManager::PairRemoteDevice(chip::NodeId nodeId, const char * payload) PushCommand(commandBuilder.c_str()); } +void DeviceManager::PairLocalFabricBridge(NodeId nodeId) +{ + StringBuilder commandBuilder; + + commandBuilder.Add("pairing already-discovered "); + commandBuilder.AddFormat("%lu %d ::1 %d", nodeId, kSetupPinCode, kLocalBridgePort); + + PushCommand(commandBuilder.c_str()); +} + void DeviceManager::UnpairRemoteFabricBridge() { StringBuilder commandBuilder; @@ -176,6 +189,16 @@ void DeviceManager::UnpairRemoteFabricBridge() PushCommand(commandBuilder.c_str()); } +void DeviceManager::UnpairLocalFabricBridge() +{ + StringBuilder commandBuilder; + + commandBuilder.Add("pairing unpair "); + commandBuilder.AddFormat("%lu", mLocalBridgeNodeId); + + PushCommand(commandBuilder.c_str()); +} + void DeviceManager::SubscribeRemoteFabricBridge() { // Listen to the state changes of the remote fabric bridge. diff --git a/examples/fabric-admin/device_manager/DeviceManager.h b/examples/fabric-admin/device_manager/DeviceManager.h index cad573a9311421..454986bd7a40f0 100644 --- a/examples/fabric-admin/device_manager/DeviceManager.h +++ b/examples/fabric-admin/device_manager/DeviceManager.h @@ -55,14 +55,20 @@ class DeviceManager : public PairingDelegate chip::NodeId GetRemoteBridgeNodeId() const { return mRemoteBridgeNodeId; } + chip::NodeId GetLocalBridgeNodeId() const { return mLocalBridgeNodeId; } + void UpdateLastUsedNodeId(chip::NodeId nodeId); - void SetRemoteBridgeNodeId(chip::NodeId remoteBridgeNodeId) { mRemoteBridgeNodeId = remoteBridgeNodeId; } + void SetRemoteBridgeNodeId(chip::NodeId nodeId) { mRemoteBridgeNodeId = nodeId; } + + void SetLocalBridgeNodeId(chip::NodeId nodeId) { mLocalBridgeNodeId = nodeId; } bool IsAutoSyncEnabled() const { return mAutoSyncEnabled; } bool IsFabricSyncReady() const { return mRemoteBridgeNodeId != chip::kUndefinedNodeId; } + bool IsLocalBridgeReady() const { return mLocalBridgeNodeId != chip::kUndefinedNodeId; } + void EnableAutoSync(bool state) { mAutoSyncEnabled = state; } void AddSyncedDevice(const Device & device); @@ -126,8 +132,20 @@ class DeviceManager : public PairingDelegate */ void PairRemoteDevice(chip::NodeId nodeId, const char * payload); + /** + * @brief Pair a local fabric bridge with a given node ID. + * + * This function initiates the pairing process for the local fabric bridge using the specified parameters. + + * @param nodeId The user-defined ID for the node being commissioned. It doesn’t need to be the same ID, + * as for the first fabric. + */ + void PairLocalFabricBridge(chip::NodeId nodeId); + void UnpairRemoteFabricBridge(); + void UnpairLocalFabricBridge(); + void SubscribeRemoteFabricBridge(); void StartReverseCommissioning(); @@ -147,8 +165,16 @@ class DeviceManager : public PairingDelegate static DeviceManager sInstance; - chip::NodeId mLastUsedNodeId = 0; + chip::NodeId mLastUsedNodeId = 0; + + // The Node ID of the remote bridge used for Fabric-Sync + // This represents the bridge on the other ecosystem. chip::NodeId mRemoteBridgeNodeId = chip::kUndefinedNodeId; + + // The Node ID of the local bridge used for Fabric-Sync + // This represents the bridge within its own ecosystem. + chip::NodeId mLocalBridgeNodeId = chip::kUndefinedNodeId; + std::set mSyncedDevices; bool mAutoSyncEnabled = false; bool mInitialized = false; From 2dc166f86130a635ea46fde4e78ab353a926f663 Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Fri, 16 Aug 2024 10:25:07 +0900 Subject: [PATCH 37/59] [Android] Fix mDNS discover ANR issue (#34968) * Fix mDNS discover ANR issue * Restyled by google-java-format --------- Co-authored-by: Restyled.io --- .../platform/NsdManagerServiceBrowser.java | 6 ++- .../platform/NsdManagerServiceResolver.java | 40 ++++++++++--------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/src/platform/android/java/chip/platform/NsdManagerServiceBrowser.java b/src/platform/android/java/chip/platform/NsdManagerServiceBrowser.java index e4ac8a673b5db2..1df91c6830e171 100644 --- a/src/platform/android/java/chip/platform/NsdManagerServiceBrowser.java +++ b/src/platform/android/java/chip/platform/NsdManagerServiceBrowser.java @@ -161,7 +161,11 @@ public void onServiceFound(NsdServiceInfo serviceInfo) { @Override public void onServiceLost(NsdServiceInfo serviceInfo) { - Log.i(TAG, "Lost service '" + serviceType + "'"); + Log.i( + TAG, + "Lost service '" + (serviceInfo != null ? serviceInfo.getServiceName() : "null") + "'"); + boolean ret = serviceNameList.remove(serviceInfo.getServiceName()); + Log.i(TAG, "Remove List: " + ret); } @Override diff --git a/src/platform/android/java/chip/platform/NsdManagerServiceResolver.java b/src/platform/android/java/chip/platform/NsdManagerServiceResolver.java index 11b53537bf7d71..40595263cb8214 100644 --- a/src/platform/android/java/chip/platform/NsdManagerServiceResolver.java +++ b/src/platform/android/java/chip/platform/NsdManagerServiceResolver.java @@ -98,10 +98,6 @@ public void resolve( + serviceType + "'"); - if (nsdManagerResolverAvailState != null) { - nsdManagerResolverAvailState.acquireResolver(); - } - Runnable timeoutRunnable = new Runnable() { @Override @@ -120,21 +116,29 @@ public void run() { } }; - ScheduledFuture resolveTimeoutExecutor = - Executors.newSingleThreadScheduledExecutor() - .schedule(timeoutRunnable, timeout, TimeUnit.MILLISECONDS); + new Thread( + () -> { + if (nsdManagerResolverAvailState != null) { + nsdManagerResolverAvailState.acquireResolver(); + } + + ScheduledFuture resolveTimeoutExecutor = + Executors.newSingleThreadScheduledExecutor() + .schedule(timeoutRunnable, timeout, TimeUnit.MILLISECONDS); - NsdServiceFinderAndResolver serviceFinderResolver = - new NsdServiceFinderAndResolver( - this.nsdManager, - serviceInfo, - callbackHandle, - contextHandle, - chipMdnsCallback, - multicastLock, - resolveTimeoutExecutor, - nsdManagerResolverAvailState); - serviceFinderResolver.start(); + NsdServiceFinderAndResolver serviceFinderResolver = + new NsdServiceFinderAndResolver( + this.nsdManager, + serviceInfo, + callbackHandle, + contextHandle, + chipMdnsCallback, + multicastLock, + resolveTimeoutExecutor, + nsdManagerResolverAvailState); + serviceFinderResolver.start(); + }) + .start(); } @Override From 3ecfb6c9dd07a2b98472e99543e0856a5f2310bc Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Fri, 16 Aug 2024 10:25:43 +0900 Subject: [PATCH 38/59] [Android] Implement Establish PASE Connection for SetupCode (#34971) * Implement Establish PASE Connection for SetupCode * Restyled by google-java-format * Restyled by clang-format --------- Co-authored-by: Restyled.io --- .../java/CHIPDeviceController-JNI.cpp | 25 +++++++++++++++++++ .../ChipDeviceController.java | 18 +++++++++++++ 2 files changed, 43 insertions(+) diff --git a/src/controller/java/CHIPDeviceController-JNI.cpp b/src/controller/java/CHIPDeviceController-JNI.cpp index 93ab5ccd0a1012..a0482b41db65b8 100644 --- a/src/controller/java/CHIPDeviceController-JNI.cpp +++ b/src/controller/java/CHIPDeviceController-JNI.cpp @@ -852,6 +852,31 @@ JNI_METHOD(void, establishPaseConnectionByAddress) } } +JNI_METHOD(void, establishPaseConnectionByCode) +(JNIEnv * env, jobject self, jlong handle, jlong deviceId, jstring setUpCode, jboolean useOnlyOnNetworkDiscovery) +{ + chip::DeviceLayer::StackLock lock; + CHIP_ERROR err = CHIP_NO_ERROR; + AndroidDeviceControllerWrapper * wrapper = AndroidDeviceControllerWrapper::FromJNIHandle(handle); + + auto discoveryType = DiscoveryType::kAll; + if (useOnlyOnNetworkDiscovery) + { + discoveryType = DiscoveryType::kDiscoveryNetworkOnly; + } + + JniUtfString setUpCodeJniString(env, setUpCode); + + err = wrapper->Controller()->EstablishPASEConnection(static_cast(deviceId), setUpCodeJniString.c_str(), + discoveryType); + + if (err != CHIP_NO_ERROR) + { + ChipLogError(Controller, "Failed to establish PASE connection."); + JniReferences::GetInstance().ThrowError(env, sChipDeviceControllerExceptionCls, err); + } +} + JNI_METHOD(void, continueCommissioning) (JNIEnv * env, jobject self, jlong handle, jlong devicePtr, jboolean ignoreAttestationFailure) { diff --git a/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java b/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java index 37e9e7093a1afc..4a59b178f85ef6 100644 --- a/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java +++ b/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java @@ -470,6 +470,21 @@ public void establishPaseConnection(long deviceId, String address, int port, lon establishPaseConnectionByAddress(deviceControllerPtr, deviceId, address, port, setupPincode); } + /** + * Establish a secure PASE connection using the scanned QR code or manual entry code. + * + * @param deviceId the ID of the node to connect to + * @param setupCode the scanned QR code or manual entry code + * @param useOnlyOnNetworkDiscovery the flag to indicate the commissionable device is available on + * the network + */ + public void establishPaseConnection( + long deviceId, String setupCode, boolean useOnlyOnNetworkDiscovery) { + Log.d(TAG, "Establishing PASE connection using Code: " + setupCode); + establishPaseConnectionByCode( + deviceControllerPtr, deviceId, setupCode, useOnlyOnNetworkDiscovery); + } + /** * Initiates the automatic commissioning flow using the specified network credentials. It is * expected that a secure session has already been established via {@link @@ -1624,6 +1639,9 @@ private native void establishPaseConnection( private native void establishPaseConnectionByAddress( long deviceControllerPtr, long deviceId, String address, int port, long setupPincode); + private native void establishPaseConnectionByCode( + long deviceControllerPtr, long deviceId, String setupCode, boolean useOnlyOnNetworkDiscovery); + private native void commissionDevice( long deviceControllerPtr, long deviceId, From 6adca647bed45109f9a0bbf96214f57efa22d187 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Thu, 15 Aug 2024 20:18:22 -0700 Subject: [PATCH 39/59] Adding XPC protocols for darwin (#35029) * Initial checkin * Cleaning up protocol * Restyled by whitespace * Restyled by clang-format * Adding nodeID and controllerID for simple routing * Moving to implied Non-null * Removing these --------- Co-authored-by: Restyled.io --- src/darwin/Framework/CHIP/Matter.h | 3 + .../CHIP/XPC Protocol/MTRXPCClientProtocol.h | 39 ++++++++++ .../CHIP/XPC Protocol/MTRXPCServerProtocol.h | 76 +++++++++++++++++++ .../Matter.xcodeproj/project.pbxproj | 16 ++++ 4 files changed, 134 insertions(+) create mode 100644 src/darwin/Framework/CHIP/XPC Protocol/MTRXPCClientProtocol.h create mode 100644 src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h diff --git a/src/darwin/Framework/CHIP/Matter.h b/src/darwin/Framework/CHIP/Matter.h index 3c0ec41443303c..109f4a20a9a5f1 100644 --- a/src/darwin/Framework/CHIP/Matter.h +++ b/src/darwin/Framework/CHIP/Matter.h @@ -69,4 +69,7 @@ #import #import +#import +#import + #undef MTR_INCLUDED_FROM_UMBRELLA_HEADER diff --git a/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCClientProtocol.h b/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCClientProtocol.h new file mode 100644 index 00000000000000..0d518f525f7118 --- /dev/null +++ b/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCClientProtocol.h @@ -0,0 +1,39 @@ +// +/** + * 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. + */ +NS_ASSUME_NONNULL_BEGIN + +@protocol MTRXPCClientProtocol_MTRDevice +- (oneway void)device:(NSNumber *)nodeID stateChanged:(MTRDeviceState)state; +- (oneway void)device:(NSNumber *)nodeID receivedAttributeReport:(NSArray *> *)attributeReport; +- (oneway void)device:(NSNumber *)nodeID receivedEventReport:(NSArray *> *)eventReport; +- (oneway void)deviceBecameActive:(NSNumber *)nodeID; +- (oneway void)deviceCachePrimed:(NSNumber *)nodeID; +- (oneway void)deviceConfigurationChanged:(NSNumber *)nodeID; +@end + +@protocol MTRXPCClientProtocol_MTRDeviceController +// Not Supported via XPC +//- (oneway void)controller:(NSUUID *)controller statusUpdate:(MTRCommissioningStatus)status; +//- (oneway void)controller:(NSUUID *)controller commissioningSessionEstablishmentDone:(NSError * _Nullable)error; +//- (oneway void)controller:(NSUUID *)controller commissioningComplete:(NSError * _Nullable)error nodeID:(NSNumber * _Nullable)nodeID metrics:(MTRMetrics * _Nullable)metrics; +//- (oneway void)controller:(NSUUID *)controller readCommissioningInfo:(MTRProductIdentity *)info; +@end + +@protocol MTRXPCClientProtocol +@end + +NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h b/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h new file mode 100644 index 00000000000000..56077897a9e45a --- /dev/null +++ b/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h @@ -0,0 +1,76 @@ +// +/** + * 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. + */ + +NS_ASSUME_NONNULL_BEGIN + +@protocol MTRXPCServerProtocol_MTRDevice + +- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID getStateWithReply:(void (^)(MTRDeviceState state))reply; +- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID getDeviceCachePrimedWithReply:(void (^)(BOOL primed))reply; +- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID getEstimatedStartTimeWithReply:(void (^)(NSDate * _Nullable estimatedStartTime))reply; +- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID getEstimatedSubscriptionLatencyWithReply:(void (^)(NSNumber * _Nullable estimatedSubscriptionLatency))reply; + +- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID readAttributeWithEndpointID:(NSNumber *)endpointID clusterID:(NSNumber *)clusterID attributeID:(NSNumber *)attributeID params:(MTRReadParams * _Nullable)params withReply:(void (^)(NSDictionary * _Nullable))reply; +- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID writeAttributeWithEndpointID:(NSNumber *)endpointID clusterID:(NSNumber *)clusterID attributeID:(NSNumber *)attributeID value:(id _Nullable)value expectedValueInterval:(NSNumber * _Nullable)expectedValueInterval timedWriteTimeout:(NSNumber * _Nullable)timeout; + +- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID invokeCommandWithEndpointID:(NSNumber *)endpointID clusterID:(NSNumber *)clusterID commandID:(NSNumber *)commandID commandFields:(id)commandFields expectedValues:(NSArray *> * _Nullable)expectedValues expectedValueInterval:(NSNumber * _Nullable)expectedValueInterval timedInvokeTimeout:(NSNumber * _Nullable)timeout completion:(MTRDeviceResponseHandler)completion; + +// Not Supported via XPC +//- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID openCommissioningWindowWithSetupPasscode:(NSNumber *)setupPasscode discriminator:(NSNumber *)discriminator duration:(NSNumber *)duration completion:(MTRDeviceOpenCommissioningWindowHandler)completion; + +- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID getClientDataKeysWithReply:(void (^)(NSArray * _Nullable))reply; +- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID clientDataForKey:(NSString *)key withReply:(void (^)(id _Nullable))reply; +- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID setClientDataForKey:(NSString *)key value:(id)value; +- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID removeClientDataForKey:(NSString *)key; +- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID clientDataKeysForEndpointID:(NSNumber *)endpointID withReply:(void (^)(NSArray * _Nullable))reply; +- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID clientDataForKey:(NSString *)key endpointID:(NSNumber *)endpointID withReply:(void (^)(id _Nullable))reply; +- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID setClientDataForKey:(NSString *)key endpointID:(NSNumber *)endpointID value:(id _Nullable)value; +- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID removeClientDataForKey:(NSString *)key endpointID:(NSNumber *)endpointID; + +// Not Supported via XPC +// - (oneway void)downloadLogOfType:(MTRDiagnosticLogType)type nodeID:(NSNumber *)nodeID timeout:(NSTimeInterval)timeout completion:(void (^)(NSURL * _Nullable url, NSError * _Nullable error))completion; +@end + +@protocol MTRXPCServerProtocol_MTRDeviceController + +- (oneway void)deviceController:(NSUUID *)controller getIsRunningWithReply:(void (^)(BOOL response))reply; +- (oneway void)deviceController:(NSUUID *)controller getUniqueIdentifierWithReply:(void (^)(NSUUID *))reply; +- (oneway void)deviceController:(NSUUID *)controller controllerNodeIDWithReply:(void (^)(NSNumber * nodeID))reply; + +// Not Supported via XPC +// - (oneway void)deviceController:(NSUUID *)controller setupCommissioningSessionWithPayload:(MTRSetupPayload *)payload newNodeID:(NSNumber *)newNodeID withReply:(void(^)(BOOL success, NSError * _Nullable error))reply; +// - (oneway void)deviceController:(NSUUID *)controller setupCommissioningSessionWithDiscoveredDevice:(MTRCommissionableBrowserResult *)discoveredDevice payload:(MTRSetupPayload *)payload newNodeID:(NSNumber *)newNodeID withReply:(void(^)(BOOL success, NSError * _Nullable error))reply; +// - (oneway void)deviceController:(NSUUID *)controller commissionNodeWithID:(NSNumber *)nodeID commissioningParams:(MTRCommissioningParameters *)commissioningParams withReply:(void(^)(BOOL success, NSError * _Nullable error))reply; +// - (oneway void)deviceController:(NSUUID *)controller continueCommissioningDevice:(void *)opaqueDeviceHandle ignoreAttestationFailure:(BOOL)ignoreAttestationFailure withReply:(void(^)(BOOL success, NSError * _Nullable error))reply; +// - (oneway void)deviceController:(NSUUID *)controller cancelCommissioningForNodeID:(NSNumber *)nodeID withReply:(void(^)(BOOL success, NSError * _Nullable error))reply; +// - (nullable MTRBaseDevice *)deviceController:(NSUUID *)controller deviceBeingCommissionedWithNodeID:(NSNumber *)nodeID error:(NSError * __autoreleasing *)error; +// - (oneway void)deviceController:(NSUUID *)controller startBrowseForCommissionables:(id)delegate withReply:(void(^)(BOOL success))reply; +// - (oneway void)deviceController:(NSUUID *)controller stopBrowseForCommissionablesWithReply:(void(^)(BOOL success))reply; +// - (oneway void)deviceController:(NSUUID *)controller attestationChallengeForDeviceID:(NSNumber *)deviceID withReply:(void(^)(NSData * _Nullable))reply; + +//- (oneway void)deviceController:(NSUUID *)controller addServerEndpoint:(MTRServerEndpoint *)endpoint withReply:(void(^)(BOOL success))reply; +//- (oneway void)deviceController:(NSUUID *)controller removeServerEndpoint:(MTRServerEndpoint *)endpoint; + +- (oneway void)shutdownDeviceController:(NSUUID *)controller; + +@end + +@protocol MTRXPCServerProtocol +- (oneway void)deviceController:(NSUUID *)controller checkInWithContext:(NSDictionary *)context; +@end + +NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index 2dc7bd266a4335..69ef3bdc71d81b 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -371,6 +371,8 @@ B4FCD5722B603A6300832859 /* DownloadLogCommand.mm in Sources */ = {isa = PBXBuildFile; fileRef = B4FCD56F2B603A6300832859 /* DownloadLogCommand.mm */; }; B4FCD5732B611EB300832859 /* MTRDiagnosticLogsDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = B4C8E6B32B3453AD00FCD54D /* MTRDiagnosticLogsDownloader.h */; }; BA09EB43247477BA00605257 /* libCHIP.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BA09EB3F2474762900605257 /* libCHIP.a */; }; + D444F9A72C6E8F9D007761E5 /* MTRXPCServerProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D444F9A62C6E8F9D007761E5 /* MTRXPCServerProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D444F9AA2C6E9A08007761E5 /* MTRXPCClientProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D444F9A82C6E99CA007761E5 /* MTRXPCClientProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; D4772A46285AE98400383630 /* MTRClusterConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = D4772A45285AE98300383630 /* MTRClusterConstants.h */; settings = {ATTRIBUTES = (Public, ); }; }; E04AC67D2BEEA17F00BA409B /* ember-io-storage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E04AC67B2BEEA17F00BA409B /* ember-io-storage.cpp */; }; E04AC67E2BEEA17F00BA409B /* ember-io-storage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E04AC67B2BEEA17F00BA409B /* ember-io-storage.cpp */; }; @@ -809,6 +811,8 @@ D437613E285BDC0D0051FEA2 /* MTRErrorTestUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRErrorTestUtils.h; sourceTree = ""; }; D437613F285BDC0D0051FEA2 /* MTRTestKeys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRTestKeys.h; sourceTree = ""; }; D4376140285BDC0D0051FEA2 /* MTRTestStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRTestStorage.h; sourceTree = ""; }; + D444F9A62C6E8F9D007761E5 /* MTRXPCServerProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRXPCServerProtocol.h; sourceTree = ""; }; + D444F9A82C6E99CA007761E5 /* MTRXPCClientProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRXPCClientProtocol.h; sourceTree = ""; }; D4772A45285AE98300383630 /* MTRClusterConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRClusterConstants.h; sourceTree = ""; }; E04AC67B2BEEA17F00BA409B /* ember-io-storage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "ember-io-storage.cpp"; path = "util/ember-io-storage.cpp"; sourceTree = ""; }; E04AC67C2BEEA17F00BA409B /* ember-global-attribute-access-interface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "ember-global-attribute-access-interface.cpp"; path = "util/ember-global-attribute-access-interface.cpp"; sourceTree = ""; }; @@ -1246,6 +1250,7 @@ B202528F2459E34F00F97062 /* CHIP */ = { isa = PBXGroup; children = ( + D444F9A12C6E8058007761E5 /* XPC Protocol */, 9B231B022C62EF650030EB37 /* MTRDeviceController_Concrete.h */, 9B231B032C62EF650030EB37 /* MTRDeviceController_Concrete.mm */, 88E07D602B9A89A4005FD53E /* MTRMetricKeys.h */, @@ -1539,6 +1544,15 @@ name = Frameworks; sourceTree = ""; }; + D444F9A12C6E8058007761E5 /* XPC Protocol */ = { + isa = PBXGroup; + children = ( + D444F9A82C6E99CA007761E5 /* MTRXPCClientProtocol.h */, + D444F9A62C6E8F9D007761E5 /* MTRXPCServerProtocol.h */, + ); + path = "XPC Protocol"; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -1609,6 +1623,7 @@ 75B765C12A1D71BC0014719B /* MTRAttributeSpecifiedCheck.h in Headers */, 5ACDDD7A27CD129700EFD68A /* MTRClusterStateCacheContainer.h in Headers */, 5A6FEC9227B5669C00F25F42 /* MTRDeviceControllerOverXPC.h in Headers */, + D444F9AA2C6E9A08007761E5 /* MTRXPCClientProtocol.h in Headers */, 5117DD3929A931AE00FFA1AA /* MTROperationalBrowser.h in Headers */, 2C1B027B2641DB4E00780EF1 /* MTROperationalCredentialsDelegate.h in Headers */, 5173A47529C0E2ED00F67F48 /* MTRFabricInfo_Internal.h in Headers */, @@ -1698,6 +1713,7 @@ 5A7947E527C0129F00434CF2 /* MTRDeviceController+XPC.h in Headers */, 51E95DFB2A78443C00A434F0 /* MTRSessionResumptionStorageBridge.h in Headers */, B2E0D7B4245B0B5C003C5B48 /* MTRError_Internal.h in Headers */, + D444F9A72C6E8F9D007761E5 /* MTRXPCServerProtocol.h in Headers */, 51F5226A2AE70761000C4050 /* MTRDeviceTypeMetadata.h in Headers */, 5146544B2A72F9F500904E61 /* MTRDemuxingStorage.h in Headers */, 1EDCE545289049A100E41EC9 /* MTROTAHeader.h in Headers */, From 7ae51991a95f615e7aff306b257fefc69c062312 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 15 Aug 2024 23:49:28 -0400 Subject: [PATCH 40/59] Set FabricFiltered to True when reading Fabrics. (#35023) Otherwise we get a fabric view on the list of fabrics which does not change over time. Co-authored-by: Andrei Litvin --- src/python_testing/TC_CCTRL_2_2.py | 6 +++--- src/python_testing/TC_MCORE_FS_1_1.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/python_testing/TC_CCTRL_2_2.py b/src/python_testing/TC_CCTRL_2_2.py index 5204352b8b66a5..53c196113d36bc 100644 --- a/src/python_testing/TC_CCTRL_2_2.py +++ b/src/python_testing/TC_CCTRL_2_2.py @@ -123,7 +123,7 @@ async def test_TC_CCTRL_2_2(self): self.is_ci = self.check_pics('PICS_SDK_CI_ONLY') self.step(1) - th_server_fabrics = await self.read_single_attribute_check_success(cluster=Clusters.OperationalCredentials, attribute=Clusters.OperationalCredentials.Attributes.Fabrics, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, endpoint=0) + th_server_fabrics = await self.read_single_attribute_check_success(cluster=Clusters.OperationalCredentials, attribute=Clusters.OperationalCredentials.Attributes.Fabrics, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, endpoint=0, fabric_filtered=False) self.step(2) th_server_vid = await self.read_single_attribute_check_success(cluster=Clusters.BasicInformation, attribute=Clusters.BasicInformation.Attributes.VendorID, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, endpoint=0) self.step(3) @@ -248,7 +248,7 @@ async def test_TC_CCTRL_2_2(self): self.step(20) print(f'server node id {self.server_nodeid}') - th_server_fabrics_new = await self.read_single_attribute_check_success(cluster=Clusters.OperationalCredentials, attribute=Clusters.OperationalCredentials.Attributes.Fabrics, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, endpoint=0) + th_server_fabrics_new = await self.read_single_attribute_check_success(cluster=Clusters.OperationalCredentials, attribute=Clusters.OperationalCredentials.Attributes.Fabrics, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, endpoint=0, fabric_filtered=False) asserts.assert_equal(len(th_server_fabrics), len(th_server_fabrics_new), "Unexpected number of fabrics on TH_SERVER") self.step(21) @@ -294,7 +294,7 @@ async def test_TC_CCTRL_2_2(self): time.sleep(30) self.step(28) - th_server_fabrics_new = await self.read_single_attribute_check_success(cluster=Clusters.OperationalCredentials, attribute=Clusters.OperationalCredentials.Attributes.Fabrics, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, endpoint=0) + th_server_fabrics_new = await self.read_single_attribute_check_success(cluster=Clusters.OperationalCredentials, attribute=Clusters.OperationalCredentials.Attributes.Fabrics, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, endpoint=0, fabric_filtered=False) # TODO: this should be mocked too. if not self.is_ci: asserts.assert_equal(len(th_server_fabrics) + 1, len(th_server_fabrics_new), diff --git a/src/python_testing/TC_MCORE_FS_1_1.py b/src/python_testing/TC_MCORE_FS_1_1.py index 0680210babd191..6753db81a3a4cf 100755 --- a/src/python_testing/TC_MCORE_FS_1_1.py +++ b/src/python_testing/TC_MCORE_FS_1_1.py @@ -93,7 +93,7 @@ async def test_TC_MCORE_FS_1_1(self): self.step(1) self.step(2) self.step(3) - th_fsa_server_fabrics = await self.read_single_attribute_check_success(cluster=Clusters.OperationalCredentials, attribute=Clusters.OperationalCredentials.Attributes.Fabrics, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, endpoint=0) + th_fsa_server_fabrics = await self.read_single_attribute_check_success(cluster=Clusters.OperationalCredentials, attribute=Clusters.OperationalCredentials.Attributes.Fabrics, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, endpoint=0, fabric_filtered=False) th_fsa_server_vid = await self.read_single_attribute_check_success(cluster=Clusters.BasicInformation, attribute=Clusters.BasicInformation.Attributes.VendorID, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, endpoint=0) th_fsa_server_pid = await self.read_single_attribute_check_success(cluster=Clusters.BasicInformation, attribute=Clusters.BasicInformation.Attributes.ProductID, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, endpoint=0) @@ -138,7 +138,7 @@ async def test_TC_MCORE_FS_1_1(self): if not self.is_ci: time.sleep(30) - th_fsa_server_fabrics_new = await self.read_single_attribute_check_success(cluster=Clusters.OperationalCredentials, attribute=Clusters.OperationalCredentials.Attributes.Fabrics, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, endpoint=0) + th_fsa_server_fabrics_new = await self.read_single_attribute_check_success(cluster=Clusters.OperationalCredentials, attribute=Clusters.OperationalCredentials.Attributes.Fabrics, dev_ctrl=self.TH_server_controller, node_id=self.server_nodeid, endpoint=0, fabric_filtered=False) # TODO: this should be mocked too. if not self.is_ci: asserts.assert_equal(len(th_fsa_server_fabrics) + 1, len(th_fsa_server_fabrics_new), From e9f1f1eb2e7df8ea1e080341d4855b6305616eea Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Fri, 16 Aug 2024 10:34:40 -0400 Subject: [PATCH 41/59] Fix BRBINFO_4_1 to run further (#35026) * Fix BRBINFO_4_1 to run further * Restyled by autopep8 --------- Co-authored-by: Restyled.io --- src/python_testing/TC_BRBINFO_4_1.py | 71 +++++++++++++++------------- 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/src/python_testing/TC_BRBINFO_4_1.py b/src/python_testing/TC_BRBINFO_4_1.py index 922a6cb555448c..8e920d8bc6013e 100644 --- a/src/python_testing/TC_BRBINFO_4_1.py +++ b/src/python_testing/TC_BRBINFO_4_1.py @@ -81,11 +81,12 @@ async def _send_keep_active_command(self, duration, endpoint_id) -> int: keep_active = await self.default_controller.SendCommand(nodeid=self.dut_node_id, endpoint=endpoint_id, payload=Clusters.Objects.BridgedDeviceBasicInformation.Commands.KeepActive(stayActiveDuration=duration)) return keep_active - async def _wait_for_active_changed_event(self, timeout) -> int: + async def _wait_for_active_changed_event(self, timeout_s) -> int: try: - promised_active_duration = self.q.get(block=True, timeout=timeout) - logging.info(f"PromisedActiveDuration: {promised_active_duration}") - return promised_active_duration + promised_active_duration_event = self.q.get(block=True, timeout=timeout_s) + logging.info(f"PromisedActiveDurationEvent: {promised_active_duration_event}") + promised_active_duration_ms = promised_active_duration_event.Data.promisedActiveDuration + return promised_active_duration_ms except queue.Empty: asserts.fail("Timeout on event ActiveChanged") @@ -192,21 +193,21 @@ async def test_TC_BRBINFO_4_1(self): self.step("1a") - idle_mode_duration = await self._read_attribute_expect_success( + idle_mode_duration_s = await self._read_attribute_expect_success( _ROOT_ENDPOINT_ID, icdm_cluster, icdm_attributes.IdleModeDuration, self.icd_nodeid ) - logging.info(f"IdleModeDuration: {idle_mode_duration}") + logging.info(f"IdleModeDurationS: {idle_mode_duration_s}") - active_mode_duration = await self._read_attribute_expect_success( + active_mode_duration_ms = await self._read_attribute_expect_success( _ROOT_ENDPOINT_ID, icdm_cluster, icdm_attributes.ActiveModeDuration, self.icd_nodeid ) - logging.info(f"ActiveModeDuration: {active_mode_duration}") + logging.info(f"ActiveModeDurationMs: {active_mode_duration_ms}") self.step("1b") @@ -218,49 +219,53 @@ async def test_TC_BRBINFO_4_1(self): subscription = await self.default_controller.ReadEvent(nodeid=self.dut_node_id, events=[(dynamic_endpoint_id, event, urgent)], reportInterval=[1, 3]) subscription.SetEventUpdateCallback(callback=cb) - stay_active_duration = 1000 - logging.info(f"Sending KeepActiveCommand({stay_active_duration}ms)") - self._send_keep_active_command(stay_active_duration, dynamic_endpoint_id) + stay_active_duration_ms = 1000 + logging.info(f"Sending KeepActiveCommand({stay_active_duration_ms}ms)") + await self._send_keep_active_command(stay_active_duration_ms, dynamic_endpoint_id) logging.info("Waiting for ActiveChanged from DUT...") - promised_active_duration = await self._wait_for_active_changed_event((idle_mode_duration + max(active_mode_duration, stay_active_duration))/1000) + timeout_s = idle_mode_duration_s + max(active_mode_duration_ms, stay_active_duration_ms)/1000 + promised_active_duration_ms = await self._wait_for_active_changed_event(timeout_s) - asserts.assert_greater_equal(promised_active_duration, stay_active_duration, "PromisedActiveDuration < StayActiveDuration") + asserts.assert_greater_equal(promised_active_duration_ms, stay_active_duration_ms, + "PromisedActiveDuration < StayActiveDuration") self.step("2") - stay_active_duration = 1500 - logging.info(f"Sending KeepActiveCommand({stay_active_duration}ms)") - self._send_keep_active_command(stay_active_duration) + stay_active_duration_ms = 1500 + logging.info(f"Sending KeepActiveCommand({stay_active_duration_ms}ms)") + await self._send_keep_active_command(stay_active_duration_ms, dynamic_endpoint_id) logging.info("Waiting for ActiveChanged from DUT...") - promised_active_duration = await self._wait_for_active_changed_event((idle_mode_duration + max(active_mode_duration, stay_active_duration))/1000) + timeout_s = idle_mode_duration_s + max(active_mode_duration_ms, stay_active_duration_ms)/1000 + promised_active_duration_ms = await self._wait_for_active_changed_event(timeout_s) # wait for active time duration - time.sleep(max(stay_active_duration/1000, promised_active_duration)) + sleep_time_s = max(stay_active_duration_ms, promised_active_duration_ms)/1000 + time.sleep(sleep_time_s) # ICD now should be in idle mode # sends 3x keep active commands - logging.info(f"Sending KeepActiveCommand({stay_active_duration})") - self._send_keep_active_command(stay_active_duration, dynamic_endpoint_id) - time.sleep(100) - logging.info(f"Sending KeepActiveCommand({stay_active_duration})") - self._send_keep_active_command(stay_active_duration, dynamic_endpoint_id) - time.sleep(100) - logging.info(f"Sending KeepActiveCommand({stay_active_duration})") - self._send_keep_active_command(stay_active_duration, dynamic_endpoint_id) - time.sleep(100) + logging.info(f"Step3 Sending first KeepActiveCommand({stay_active_duration_ms})") + await self._send_keep_active_command(stay_active_duration_ms, dynamic_endpoint_id) + time.sleep(0.1) + logging.info(f"Step3 Sending second KeepActiveCommand({stay_active_duration_ms})") + await self._send_keep_active_command(stay_active_duration_ms, dynamic_endpoint_id) + time.sleep(0.1) + logging.info(f"Step3 Sending third KeepActiveCommand({stay_active_duration_ms})") + await self._send_keep_active_command(stay_active_duration_ms, dynamic_endpoint_id) + time.sleep(0.1) logging.info("Waiting for ActiveChanged from DUT...") - promised_active_duration = await self._wait_for_active_changed_event((idle_mode_duration + max(active_mode_duration, stay_active_duration))/1000) + promised_active_duration_ms = await self._wait_for_active_changed_event((idle_mode_duration_s + max(active_mode_duration_ms, stay_active_duration_ms))/1000) asserts.assert_equal(self.q.qSize(), 0, "More than one event received from DUT") self.step("3") - stay_active_duration = 10000 - logging.info(f"Sending KeepActiveCommand({stay_active_duration})") - self._send_keep_active_command(stay_active_duration, dynamic_endpoint_id) + stay_active_duration_ms = 10000 + logging.info(f"Sending KeepActiveCommand({stay_active_duration_ms})") + await self._send_keep_active_command(stay_active_duration_ms, dynamic_endpoint_id) # stops (halts) the ICD server process by sending a SIGTOP signal self.app_process.send_signal(signal.SIGSTOP.value) @@ -274,9 +279,9 @@ async def test_TC_BRBINFO_4_1(self): self.app_process.send_signal(signal.SIGCONT.value) # wait for active changed event, expect no event will be sent - event_timeout = (idle_mode_duration + max(active_mode_duration, stay_active_duration))/1000 + event_timeout = (idle_mode_duration_s + max(active_mode_duration_ms, stay_active_duration_ms))/1000 try: - promised_active_duration = self.q.get(block=True, timeout=event_timeout) + promised_active_duration_ms = self.q.get(block=True, timeout=event_timeout) finally: asserts.assert_true(queue.Empty(), "ActiveChanged event received when not expected") From ab5fbebee03553029491637a9d1b33c987d2e18b Mon Sep 17 00:00:00 2001 From: doru91 Date: Fri, 16 Aug 2024 17:35:48 +0300 Subject: [PATCH 42/59] fabric sync guide: fix device-remote-port (#35035) Signed-off-by: Doru Gucea --- docs/guides/fabric_synchronization_guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guides/fabric_synchronization_guide.md b/docs/guides/fabric_synchronization_guide.md index b2cfd26d9f439e..5944105512776d 100644 --- a/docs/guides/fabric_synchronization_guide.md +++ b/docs/guides/fabric_synchronization_guide.md @@ -127,7 +127,7 @@ KVS Pair the Light Example with node ID 3 using its payload number: ``` -pairing already-discovered 3 20202021 5540 +pairing already-discovered 3 20202021 5543 ``` After the device is successfully added, you will observe the following on From 5a1949c705c0e82b5ae89c33f67ca6e2886fbe13 Mon Sep 17 00:00:00 2001 From: adabreuti <76965454+adabreuti@users.noreply.github.com> Date: Fri, 16 Aug 2024 09:35:55 -0500 Subject: [PATCH 43/59] [TI] Update TI BLE Manager Task priority (#34852) * Update TI BLE Manager task priority for initialization sequence * Restyled by clang-format --------- Co-authored-by: Restyled.io --- src/platform/cc13xx_26xx/BLEManagerImpl.cpp | 4 +- src/platform/cc13xx_26xx/icall_FreeRTOS.c | 3926 +++++++++++++++++ .../ti_simplelink_sdk/ti_simplelink_sdk.gni | 4 +- 3 files changed, 3931 insertions(+), 3 deletions(-) create mode 100644 src/platform/cc13xx_26xx/icall_FreeRTOS.c diff --git a/src/platform/cc13xx_26xx/BLEManagerImpl.cpp b/src/platform/cc13xx_26xx/BLEManagerImpl.cpp index fc0a6af0beea94..f1d179c4b39310 100644 --- a/src/platform/cc13xx_26xx/BLEManagerImpl.cpp +++ b/src/platform/cc13xx_26xx/BLEManagerImpl.cpp @@ -521,7 +521,7 @@ void BLEManagerImpl::EventHandler_init(void) /* set the stacks in default states */ DMMPolicy_updateStackState(DMMPolicy_StackRole_BlePeripheral, DMMPOLICY_BLE_IDLE); - vTaskPrioritySet(xTaskGetCurrentTaskHandle(), 3); + vTaskPrioritySet(xTaskGetCurrentTaskHandle(), BLE_MANAGER_TASK_PRIORITY); // ****************************************************************** // N0 STACK API CALLS CAN OCCUR BEFORE THIS CALL TO ICall_registerApp @@ -634,7 +634,7 @@ CHIP_ERROR BLEManagerImpl::CreateEventHandler(void) "ble_hndlr", /* Text name for the task. */ BLEMANAGER_EVENT_HANDLER_STACK_SIZE, /* Stack size in words, not bytes. */ this, /* Parameter passed into the task. */ - ICALL_TASK_PRIORITIES, /* Keep priority the same as ICALL until init is complete */ + BLE_STACK_TASK_PRIORITY, /* Keep priority the same as ICALL until init is complete */ NULL); /* Used to pass out the created task's handle. */ if (xReturned == errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY) diff --git a/src/platform/cc13xx_26xx/icall_FreeRTOS.c b/src/platform/cc13xx_26xx/icall_FreeRTOS.c new file mode 100644 index 00000000000000..469ef9b3e0074c --- /dev/null +++ b/src/platform/cc13xx_26xx/icall_FreeRTOS.c @@ -0,0 +1,3926 @@ +/****************************************************************************** + @file icall_FreeRTOS.c + + @brief Indirect function Call dispatcher implementation on top of OS. + + This implementation uses heapmgr.h to implement a simple heap with low + memory overhead but large processing overhead.
+ The size of the heap is determined with HEAPMGR_SIZE macro, which can + be overridden with a compile option. + Note: The ICall layer (e.g. this file) is using TI internal implementation of POSIX. + For now, the ICall layer is not supports using outer POSIX on the application layer. + + Group: WCS, LPC, BTS + Target Device: cc13xx_cc26xx + + ****************************************************************************** + + Copyright (c) 2013-2024, Texas Instruments Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Texas Instruments Incorporated nor the names of + its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + ****************************************************************************** + + + *****************************************************************************/ + +#ifdef FREERTOS +#include "bget.h" +#include +#include +#endif + +#ifdef FREERTOS +#include +#include +#include +#endif + +#include +#include +#define Hwi_disable HwiP_disable +#define Hwi_restore HwiP_restore +#define Hwi_disableinterrupt HwiP_disableInterrupt +#define Hwi_enableinterrupt HwiP_enableInterrupt +#define Swi_restore SwiP_restore +#define Swi_disable SwiP_disable +#define BIOS_WAIT_FOREVER (~(0U)) +#define BIOS_NO_WAIT (0U) + +#include "icall.h" +#include "icall_platform.h" +#include "osal.h" +#include +#include + +#ifndef ICALL_FEATURE_SEPARATE_IMGINFO +#include +#endif /* ICALL_FEATURE_SEPARATE_IMGINFO */ + +#ifndef Task_self +#define Task_self ICall_taskSelf +#endif + +#ifndef ICALL_MAX_NUM_ENTITIES +/** + * Maximum number of entities that use ICall, including service entities + * and application entities. + * The value may be overridden by a compile option. + * Note that there are at least, + * Primitive service, Stack services along with potentially generic + * framework service for the stack thread. + */ +#define ICALL_MAX_NUM_ENTITIES 6 +#endif + +#ifndef ICALL_MAX_NUM_TASKS +/** + * Maximum number of threads which include entities. + * The value may be overridden by a compile option. + */ +#define ICALL_MAX_NUM_TASKS 2 +#endif + +/** + * @internal + * Service class value used to indicate an invalid (unused) entry + */ +#define ICALL_SERVICE_CLASS_INVALID_ENTRY 0x0000 + +/** + * @internal + * Service class value used to indicate an entry for an application entity + */ +#define ICALL_SERVICE_CLASS_APPLICATION ICALL_SERVICE_CLASS_MASK + +/** + * @internal + * Primitive service entity ID + */ +#define ICALL_PRIMITIVE_ENTITY_ID 0 + +/** + * @internal + * Accessor macro to get a header field (next) from a message pointer + */ +#define ICALL_MSG_NEXT(_p) (((ICall_MsgHdr *) (_p) -1)->next) + +/** + * @internal + * Accessor macro to get a header field (dest_id) from a message pointer + */ +#define ICALL_MSG_DEST_ID(_p) (((ICall_MsgHdr *) (_p) -1)->dest_id) + +#ifndef ICALL_TIMER_TASK_STACK_SIZE +/** + * @internal + * Timer thread stack size + */ +#define ICALL_TIMER_TASK_STACK_SIZE (512) +#endif // ICALL_TIMER_TASK_STACK_SIZE + +/** + * @internal + * Creation of the synchronous object between application and service + */ + +#ifdef ICALL_EVENTS +#define ICALL_SYNC_HANDLE_CREATE() (Event_create(NULL, NULL)) +#else /* ICALL_EVENTS */ +#define ICALL_SYNC_HANDLE_CREATE() (Semaphore_create(0, NULL, NULL)) +#endif /* ICALL_EVENTS */ + +/** + * @internal + * post the synchronous object between application and service + */ +#ifdef ICALL_EVENTS +#define ICALL_SYNC_HANDLE_POST(x) (Event_post(x, ICALL_MSG_EVENT_ID)) +#define ICALL_SYNC_HANDLE_POST_WM(x) (Event_post(x, ICALL_WAITMATCH_EVENT_ID)) +#else /* ICALL_EVENTS */ +#define ICALL_SYNC_HANDLE_POST(x) (Semaphore_post(x)) +#define ICALL_SYNC_HANDLE_POST_WM(x) (Semaphore_post(x)) /* Semaphore does not have event ID */ +#endif /* ICALL_EVENTS */ + +/** + * @internal + * pend for the synchronous object between application and service + */ +#ifdef ICALL_EVENTS +#define ICALL_SYNC_HANDLE_PEND(x, t) (Event_pend(x, 0, ICALL_MSG_EVENT_ID, t)) +#define ICALL_SYNC_HANDLE_PEND_WM(x, t) (Event_pend(x, 0, ICALL_WAITMATCH_EVENT_ID, t)) +#else /* ICALL_EVENTS */ +#define ICALL_SYNC_HANDLE_PEND(x, t) (Semaphore_pend(x, t)) +#define ICALL_SYNC_HANDLE_PEND_WM(x, t) (Semaphore_pend(x, t)) /* Semaphore does not have event ID */ +#endif /* ICALL_EVENTS */ + +/** + * @internal + * ticks + */ +#define CLOCK_TICKS_PERIOD (10) + +/** + * @internal + * Data structure used to access critical section + * state variable. + * Without this data structure, C code will violate + * C89 or C99 strict aliasing rule. + */ +typedef union _icall_cs_state_union_t +{ + /** critical section variable as declared in the interface */ + ICall_CSState state; + /** @internal field used to access internal data */ + struct _icall_cs_state_aggr_t + { + /** field to store Swi_disable() return value */ + uint_least16_t swikey; + /** field to store Hwi_disable() return value */ + uint_least16_t hwikey; + } each; +} ICall_CSStateUnion; + +/** + * @internal Primitive service handler function type + */ +typedef ICall_Errno (*ICall_PrimSvcFunc)(ICall_FuncArgsHdr *); + +#ifdef ICALL_FEATURE_SEPARATE_IMGINFO +/* Image information shall be in separate module */ + +/** + * Array of entry function addresses of external images. + * + * Note that function address must be odd number for Thumb mode functions. + */ +extern const ICall_RemoteTaskEntry ICall_imgEntries[]; +/** + * Array of task priorities of external images. + * One task is created per image to start off the image entry function. + * Each element of this array correspond to the task priority of + * each entry function defined in @ref ICall_imgEntries. + */ +extern const int ICall_imgTaskPriorities[]; + +/** + * Array of task stack sizes of external images. + * One task is created per image to start off the image entry function. + * Each element of this array correspond to the task stack size of + * each entry function defined in @ref ICall_imgEntries. + */ +extern const size_t ICall_imgTaskStackSizes[]; + +/** + * Array of custom initialization parameters (pointers). + * Each initialization parameter (pointer) is passed to each corresponding + * image entry function defined in @ref ICall_imgEntries; + */ +extern const void * ICall_imgInitParams[]; + +/** + * Number of external images. + */ +extern const uint_least8_t ICall_numImages; + +#define icall_threadEntries ICall_imgEntries +#define ICall_threadPriorities ICall_imgTaskPriorities +#define ICall_threadStackSizes ICall_imgTaskStackSizes +#define ICall_getInitParams(_i) (ICall_imgInitParams[i]) +#define ICALL_REMOTE_THREAD_COUNT ICall_numImages +#else /* ICALL_FEATURE_SEPARATE_IMGINFO */ +/** + * @internal + * Array of entry function of external images. + */ +static const ICall_RemoteTaskEntry icall_threadEntries[] = ICALL_ADDR_MAPS; + +/** @internal external image count */ +#define ICALL_REMOTE_THREAD_COUNT (sizeof(icall_threadEntries) / sizeof(icall_threadEntries[0])) + +/** @internal thread priorities to be assigned to each remote thread */ +#ifndef BLE_STACK_TASK_PRIORITY +static const int ICall_threadPriorities[] = { ICALL_TASK_PRIORITIES }; +#else +static const int ICall_threadPriorities[] = { BLE_STACK_TASK_PRIORITY }; +#endif + +/** @internal thread stack max depth for each remote thread */ +static const size_t ICall_threadStackSizes[] = ICALL_TASK_STACK_SIZES; + +/** @internal initialization parameter (pointer) for each remote thread */ +#ifdef ICALL_CUSTOM_INIT_PARAMS +static const void * ICall_initParams[] = ICALL_CUSTOM_INIT_PARAMS; +#define ICall_getInitParams(_i) (ICall_initParams[i]) +#else /* ICALL_CUSTOM_INIT_PARAMS */ +#define ICall_getInitParams(_i) NULL +#endif /* ICALL_CUSTOM_INIT_PARAMS */ + +#endif /* ICALL_FEATURE_SEPARATE_IMGINFO */ + +/** @internal message queue */ +typedef void * ICall_MsgQueue; + +/** @internal data structure about a task using ICall module */ +typedef struct _icall_task_entry_t +{ + TaskHandle_t task; + ICall_SyncHandle syncHandle; + ICall_MsgQueue queue; +} ICall_TaskEntry; + +/** @internal data structure about an entity using ICall module */ +typedef struct _icall_entity_entry_t +{ + ICall_ServiceEnum service; + ICall_TaskEntry * task; + ICall_ServiceFunc fn; +} ICall_entityEntry; + +/** @internal storage to track all tasks using ICall module */ +static ICall_TaskEntry ICall_tasks[ICALL_MAX_NUM_TASKS]; + +/** @internal storage to track all entities using ICall module */ +static ICall_entityEntry ICall_entities[ICALL_MAX_NUM_ENTITIES]; + +#ifndef FREERTOS +extern mqd_t g_EventsQueueID; +#endif +/** + * @internal + * Wakeup schedule data structure definition + */ + +#ifdef FREERTOS +void ICALL_Task_restore(UBaseType_t * OriginalParam); +void ICALL_Task_disable(UBaseType_t * OriginalParam); +#else + +void ICALL_Task_restore(struct sched_param * OriginalParam); +void ICALL_Task_disable(struct sched_param * OriginalParam); +#endif +typedef struct _icall_schedule_t +{ + ClockP_Handle clockP; + ICall_TimerCback cback; + void * arg; +} ICall_ScheduleEntry; + +/* For now critical sections completely disable hardware interrupts + * because they are used from ISRs in MAC layer implementation. + * If MAC layer implementation changes, critical section + * implementation may change to reduce overall interrupt latency. + */ +/* Enter critical section implementation. See header file for comment. */ +ICall_CSState ICall_enterCSImpl(void) +{ + + ICall_CSStateUnion cu; + cu.each.swikey = (uint_least16_t) Swi_disable(); + cu.each.hwikey = (uint_least16_t) Hwi_disable(); + return cu.state; +} +#ifdef FREERTOS +TaskHandle_t ICall_taskSelf(void) +#else +Task_Handle ICall_taskSelf(void) +#endif +{ + + TaskHandle_t task = NULL; +#ifdef FREERTOS + task = (TaskHandle_t) xTaskGetCurrentTaskHandle(); +#else + task = ; +#endif // FREERTOS + return (task); +} + +/* See header file for comment */ +ICall_EnterCS ICall_enterCriticalSection = ICall_enterCSImpl; + +/* leave critical section implementation. See header file for comment */ +void ICall_leaveCSImpl(ICall_CSState key) +{ + ICall_CSStateUnion * cu = (ICall_CSStateUnion *) &key; + Hwi_restore((uint32_t) cu->each.hwikey); + Swi_restore((uint32_t) cu->each.swikey); +} + +/* See header file for comment */ +ICall_LeaveCS ICall_leaveCriticalSection = ICall_leaveCSImpl; + +/* Implementing a simple heap using heapmgr.h template. + * This simple heap depends on critical section implementation + * and hence the template is used after critical section definition. */ +void * ICall_heapMalloc(uint32_t size); +void * ICall_heapRealloc(void * blk, uint32_t size); +void ICall_heapFree(void * blk); + +#define HEAPMGR_INIT ICall_heapInit +#define HEAPMGR_MALLOC ICall_heapMalloc +#define HEAPMGR_FREE ICall_heapFree +#define HEAPMGR_REALLOC ICall_heapRealloc +#define HEAPMGR_GETSTATS ICall_heapGetStats +#define HEAPMGR_MALLOC_LIMITED ICall_heapMallocLimited + +void ICall_heapMgrGetMetrics(uint32_t * pBlkMax, uint32_t * pBlkCnt, uint32_t * pBlkFree, uint32_t * pMemAlo, uint32_t * pMemMax, + uint32_t * pMemUB); +#ifdef HEAPMGR_METRICS +#define HEAPMGR_GETMETRICS ICall_heapMgrGetMetrics +#endif + +#define HEAPMGR_LOCK() \ + do \ + { \ + ICall_heapCSState = ICall_enterCSImpl(); \ + } while (0) +#define HEAPMGR_UNLOCK() \ + do \ + { \ + ICall_leaveCSImpl(ICall_heapCSState); \ + } while (0) +#define HEAPMGR_IMPL_INIT() +/* Note that a static variable can be used to contain critical section + * state since heapmgr.h template ensures that there is no nested + * lock call. */ + +#if defined(HEAPMGR_CONFIG) && ((HEAPMGR_CONFIG == 0) || (HEAPMGR_CONFIG == 0x80)) +#include +#elif defined(HEAPMGR_CONFIG) && ((HEAPMGR_CONFIG == 1) || (HEAPMGR_CONFIG == 0x81)) +#include +#elif defined(HEAPMGR_CONFIG) && ((HEAPMGR_CONFIG == 2) || (HEAPMGR_CONFIG == 0x82)) +#include +#elif defined(FREERTOS) +#include "TI_heap_wrapper.h" +#else +static ICall_CSState ICall_heapCSState; +#include +#endif + +/** + * @internal Searches for a task entry within @ref ICall_tasks. + * @param taskhandle OS task handle + * @return Pointer to task entry when found, or NULL. + */ +static ICall_TaskEntry * ICall_searchTask(TaskHandle_t taskhandle) +{ + size_t i; + ICall_CSState key; + + key = ICall_enterCSImpl(); + for (i = 0; i < ICALL_MAX_NUM_TASKS; i++) + { + if (!ICall_tasks[i].task) + { + /* Empty slot */ + break; + } + if ((TaskHandle_t) taskhandle == (TaskHandle_t) ICall_tasks[i].task) + { + ICall_leaveCSImpl(key); + return &ICall_tasks[i]; + } + } + ICall_leaveCSImpl(key); + return NULL; +} + +/** + * @internal Searches for a task entry within @ref ICall_tasks or + * build an entry if the entry table is empty. + * @param taskhandle OS task handle + * @return Pointer to task entry when found, or NULL. + */ + +static ICall_TaskEntry * ICall_newTask(TaskHandle_t taskhandle) +{ + size_t i; + ICall_CSState key; + + key = ICall_enterCSImpl(); + for (i = 0; i < ICALL_MAX_NUM_TASKS; i++) + { + if (!ICall_tasks[i].task) + { + /* Empty slot */ + ICall_TaskEntry * taskentry = &ICall_tasks[i]; + taskentry->task = taskhandle; + taskentry->queue = NULL; + +#ifdef FREERTOS + taskentry->syncHandle = xQueueCreate(20, sizeof(uint32_t)); +#endif + + if (taskentry->syncHandle == 0) + { + /* abort */ + ICALL_HOOK_ABORT_FUNC(); + } + + ICall_leaveCSImpl(key); + return taskentry; + } + if (taskhandle == (TaskHandle_t) ICall_tasks[i].task) + { + ICall_leaveCSImpl(key); + return &ICall_tasks[i]; + } + } + ICall_leaveCSImpl(key); + return NULL; +} + +/* See header file for comments. */ +ICall_EntityID ICall_searchServiceEntity(ICall_ServiceEnum service) +{ + size_t i; + ICall_CSState key; + + key = ICall_enterCSImpl(); + for (i = 0; i < ICALL_MAX_NUM_ENTITIES; i++) + { + if (ICall_entities[i].service == ICALL_SERVICE_CLASS_INVALID_ENTRY) + { + /* Empty slot */ + break; + } + if (service == ICall_entities[i].service) + { + ICall_leaveCSImpl(key); + return (ICall_EntityID) i; + } + } + ICall_leaveCSImpl(key); + return ICALL_INVALID_ENTITY_ID; +} + +/** + * @internal Searches for a service entity entry. + * @param service service id + * @return Pointer to entity entry of the service or + * NULL when none found. + */ +static ICall_entityEntry * ICall_searchService(ICall_ServiceEnum service) +{ + ICall_EntityID entity = ICall_searchServiceEntity(service); + if (entity == ICALL_INVALID_ENTITY_ID) + { + return NULL; + } + return &ICall_entities[entity]; +} + +/* Dispatcher implementation. See ICall_dispatcher declaration + * for comment. */ +static ICall_Errno ICall_dispatch(ICall_FuncArgsHdr * args) +{ + ICall_entityEntry * entity; + + entity = ICall_searchService(args->service); + if (!entity) + { + return ICALL_ERRNO_INVALID_SERVICE; + } + if (!entity->fn) + { + return ICALL_ERRNO_INVALID_FUNCTION; + } + + return entity->fn(args); +} + +/* See header file for comments */ +ICall_Dispatcher ICall_dispatcher = ICall_dispatch; + +/* Static instance of ICall_RemoteTaskArg to pass to + * remote task entry function. + * See header file for comments */ +static const ICall_RemoteTaskArg ICall_taskEntryFuncs = { ICall_dispatch, ICall_enterCSImpl, ICall_leaveCSImpl }; + +/** + * @internal Thread entry function wrapper that complies with + * OS. + * @param arg0 actual entry function + * @param arg1 ignored + */ +TaskHandle_t RemoteTask = NULL; + +// pthread_t RemoteTask; + +struct argsForPosixTaskStart +{ + void * arg0; + void * arg1; +}; +struct argsForPosixTaskStart POSIX_args; + +typedef void (*TaskFunction_t)(void *); + +static void ICall_taskEntry(void * arg) + +{ + void * arg0 = ((struct argsForPosixTaskStart *) (arg))->arg0; + void * arg1 = ((struct argsForPosixTaskStart *) (arg))->arg1; + + ICall_CSState key; + key = ICall_enterCSImpl(); + if (ICall_newTask(ICall_taskSelf()) == NULL) + { + /* abort */ + ICALL_HOOK_ABORT_FUNC(); + } + ICall_leaveCSImpl(key); + + /* Attempt to yield prior to running task */ + taskYIELD(); + + ICall_RemoteTaskEntry entryfn = (ICall_RemoteTaskEntry) arg0; + + entryfn(&ICall_taskEntryFuncs, (void *) arg1); + + // return NULL; +} + +#ifndef ICALL_JT +/* forward reference */ +static void ICall_initPrim(void); +#endif /* ICALL_JT */ + +/* See header file for comments. */ +void ICall_init(void) +{ + size_t i; + + for (i = 0; i < ICALL_MAX_NUM_TASKS; i++) + { + ICall_tasks[i].task = NULL; + ICall_tasks[i].queue = NULL; + } + for (i = 0; i < ICALL_MAX_NUM_ENTITIES; i++) + { + ICall_entities[i].service = ICALL_SERVICE_CLASS_INVALID_ENTRY; + } + +#ifndef ICALL_JT + /* Initialize primitive service */ + ICall_initPrim(); +#else + /* Initialize heap */ +#ifndef FREERTOS + ICall_heapInit(); +#endif // FREERTOS +#endif +} + +/* See header file for comments */ +void ICall_createRemoteTasksAtRuntime(ICall_RemoteTask_t * remoteTaskTable, uint8_t nbElems) +{ + size_t i; + /* ICALL_Task_disable is a cheap locking mechanism to lock tasks + * which may attempt to access the service call dispatcher + * till all services are registered. + */ + UBaseType_t OriginalParam; + ICALL_Task_disable(&OriginalParam); + for (i = 0; i < nbElems; i++) + { +#ifdef FREERTOS + BaseType_t xReturned; + + /* Pass the args via external sturct (POSIX use only single arg) */ + POSIX_args.arg0 = (void *) remoteTaskTable[i].startupEntry; + POSIX_args.arg1 = (void *) remoteTaskTable[i].ICall_imgInitParam; + + xReturned = xTaskCreate(ICall_taskEntry, /* Function that implements the task. */ + "x", /* Text name for the task. */ + remoteTaskTable[i].imgTaskStackSize / sizeof(uint32_t), /* Stack size in words, not bytes. */ + (void *) &POSIX_args, /* Parameter passed into the task. */ + remoteTaskTable[i].imgTaskPriority, /* Priority at which the task is created. */ + &RemoteTask); /* Used to pass out the created task's handle. */ + + if (xReturned == errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY) + { + /* Creation of FreeRTOS task failed */ + while (1) + ; + } + } + ICALL_Task_restore(&OriginalParam); +#endif +} + +/* See header file for comments */ +void ICall_createRemoteTasks(void) +{ + size_t i; + ICall_RemoteTask_t remoteTaskTable[ICALL_REMOTE_THREAD_COUNT]; + + for (i = 0; i < ICALL_REMOTE_THREAD_COUNT; i++) + { + remoteTaskTable[i].imgTaskPriority = ICall_threadPriorities[i]; + remoteTaskTable[i].imgTaskStackSize = ICall_threadStackSizes[i]; + remoteTaskTable[i].startupEntry = icall_threadEntries[i]; + remoteTaskTable[i].ICall_imgInitParam = (void *) ICall_getInitParams(i); + } + ICall_createRemoteTasksAtRuntime(remoteTaskTable, ICALL_REMOTE_THREAD_COUNT); +} + +#ifdef FREERTOS +void ICALL_Task_disable(UBaseType_t * OriginalParam) + +#else + void ICALL_Task_disable(struct sched_param * OriginalParam) +#endif +{ + +#ifdef FREERTOS + TaskStatus_t pxTaskStatus; + vTaskGetInfo(ICall_taskSelf(), &pxTaskStatus, pdFALSE, eInvalid); + *OriginalParam = pxTaskStatus.uxCurrentPriority; + + vTaskPrioritySet(ICall_taskSelf(), configMAX_PRIORITIES - 1); +#endif +} +#ifdef FREERTOS +void ICALL_Task_restore(UBaseType_t * OriginalParam) +#else + void ICALL_Task_restore(struct sched_param * OriginalParam) +#endif +{ + +#ifdef FREERTOS + vTaskPrioritySet(ICall_taskSelf(), *OriginalParam); + +#else + pthread_t pthreadID = pthread_self(); + pthread_setschedparam(pthreadID, 0, OriginalParam); +#endif +} + +/* See header file for comments */ +ICall_TaskHandle ICall_getRemoteTaskHandle(uint8 index) +{ + TaskHandle_t * task = NULL; + + UBaseType_t OriginalParam; + ICALL_Task_disable(&OriginalParam); + + if (index < ICALL_MAX_NUM_TASKS) + { + task = &ICall_tasks[index].task; + } + + ICALL_Task_restore(&OriginalParam); + + return ((ICall_TaskHandle) task); +} + +/* Primitive service implementation follows */ + +#ifndef ICALL_JT +/** + * @internal Enrolls a service + * @param args arguments + * @return @ref ICALL_ERRNO_SUCCESS when successful.
+ * @ref ICALL_ERRNO_INVALID_PARAMETER when service id is already + * registered by another entity.
+ * @ref ICALL_ERRNO_NO_RESOURCE when maximum number of services + * are already registered. + */ +static ICall_Errno ICall_primEnroll(ICall_EnrollServiceArgs * args) +{ + size_t i; + ICall_TaskEntry * taskentry = ICall_newTask(Task_self()); + ICall_CSState key; + + /* Note that certain service does not handle a message + * and hence, taskentry might be NULL. + */ + if (taskentry == NULL) + { + return ICALL_ERRNO_INVALID_PARAMETER; + } + + key = ICall_enterCSImpl(); + for (i = 0; i < ICALL_MAX_NUM_ENTITIES; i++) + { + if (ICall_entities[i].service == ICALL_SERVICE_CLASS_INVALID_ENTRY) + { + /* Use this entry */ + ICall_entities[i].service = args->service; + ICall_entities[i].task = taskentry; + ICall_entities[i].fn = args->fn; + args->entity = (ICall_EntityID) i; + args->msgSyncHdl = taskentry->syncHandle; + ICall_leaveCSImpl(key); + return ICALL_ERRNO_SUCCESS; + } + else if (args->service == ICall_entities[i].service) + { + /* Duplicate service enrollment */ + ICall_leaveCSImpl(key); + return ICALL_ERRNO_INVALID_PARAMETER; + } + } + /* abort */ + ICALL_HOOK_ABORT_FUNC(); + ICall_leaveCSImpl(key); + return ICALL_ERRNO_NO_RESOURCE; +} + +/** + * @internal Registers an application + * @param args arguments + * @return @ref ICALL_ERRNO_SUCCESS when successful.
+ * @ref ICALL_ERRNO_NO_RESOURCE when ran out of resource. + */ +static ICall_Errno ICall_primRegisterApp(ICall_RegisterAppArgs * args) +{ + size_t i; + ICall_TaskEntry * taskentry = ICall_newTask(Task_self()); + ICall_CSState key; + + if (!taskentry) + { + /* abort */ + ICALL_HOOK_ABORT_FUNC(); + return ICALL_ERRNO_NO_RESOURCE; + } + + key = ICall_enterCSImpl(); + for (i = 0; i < ICALL_MAX_NUM_ENTITIES; i++) + { + if (ICall_entities[i].service == ICALL_SERVICE_CLASS_INVALID_ENTRY) + { + /* Use this entry */ + ICall_entities[i].service = ICALL_SERVICE_CLASS_APPLICATION; + ICall_entities[i].task = taskentry; + ICall_entities[i].fn = NULL; + args->entity = (ICall_EntityID) i; + args->msgSyncHdl = taskentry->syncHandle; + ICall_leaveCSImpl(key); + return ICALL_ERRNO_SUCCESS; + } + } + /* abort */ + ICALL_HOOK_ABORT_FUNC(); + ICall_leaveCSImpl(key); + return ICALL_ERRNO_NO_RESOURCE; +} + +/** + * @internal Allocates memory block for a message. + * @param args arguments + */ +static ICall_Errno ICall_primAllocMsg(ICall_AllocArgs * args) +{ + ICall_MsgHdr * hdr = (ICall_MsgHdr *) ICall_heapMalloc(sizeof(ICall_MsgHdr) + args->size); + + if (!hdr) + { + return ICALL_ERRNO_NO_RESOURCE; + } + hdr->len = args->size; + hdr->next = NULL; + hdr->dest_id = ICALL_UNDEF_DEST_ID; + args->ptr = (void *) (hdr + 1); + return ICALL_ERRNO_SUCCESS; +} + +/** + * @internal Frees the memory block allocated for a message. + * @param args arguments + * @return @ref ICALL_ERRNO_SUCCESS + */ +static ICall_Errno ICall_primFreeMsg(ICall_FreeArgs * args) +{ + ICall_MsgHdr * hdr = (ICall_MsgHdr *) args->ptr - 1; + ICall_heapFree(hdr); + return ICALL_ERRNO_SUCCESS; +} + +/** + * Allocates a memory block. + * Note that this function is for use by ICall implementation. + * + * @param size size in bytes + * @return pointer to the allocated memory block or NULL + */ +void * ICall_mallocImpl(uint_fast16_t size) +{ + return ICall_heapMalloc(size); +} + +/** + * Frees a memory block. + * Note that this function is for use by ICall implementation. + * + * @param ptr pointer to the memory block + */ +void ICall_freeImpl(void * ptr) +{ + ICall_heapFree(ptr); +} + +/** + * @internal Allocates a memory block + * @param args arguments + * @return @ref ICALL_ERRNO_SUCCESS when successful.
+ * @ref ICALL_ERRNO_NO_RESOURCE when memory block cannot + * be allocated. + */ +static ICall_Errno ICall_primMalloc(ICall_AllocArgs * args) +{ + args->ptr = ICall_heapMalloc(args->size); + if (args->ptr == NULL) + { + return ICALL_ERRNO_NO_RESOURCE; + } + return ICALL_ERRNO_SUCCESS; +} + +/** + * @internal Frees a memory block + * @param args arguments + * @return @ref ICALL_ERRNO_SUCCESS + */ +static ICall_Errno ICall_primFree(ICall_FreeArgs * args) +{ + ICall_heapFree(args->ptr); + return ICALL_ERRNO_SUCCESS; +} +#endif /* ICALL_JT */ + +/** + * @internal Queues a message to a message queue. + * @param q_ptr message queue + * @param msg_ptr message pointer + */ +static void ICall_msgEnqueue(ICall_MsgQueue * q_ptr, void * msg_ptr) +{ + void * list; + ICall_CSState key; + + // Hold off interrupts + key = ICall_enterCSImpl(); + + ICALL_MSG_NEXT(msg_ptr) = NULL; + // If first message in queue + if (*q_ptr == NULL) + { + *q_ptr = msg_ptr; + } + else + { + // Find end of queue + for (list = *q_ptr; ICALL_MSG_NEXT(list) != NULL; list = ICALL_MSG_NEXT(list)) + ; + + // Add message to end of queue + ICALL_MSG_NEXT(list) = msg_ptr; + } + + // Re-enable interrupts + ICall_leaveCSImpl(key); +} + +/** + * @internal Dequeues a message from a message queue + * @param q_ptr message queue pointer + * @return Dequeued message pointer or NULL if none. + */ +static void * ICall_msgDequeue(ICall_MsgQueue * q_ptr) +{ + void * msg_ptr = NULL; + ICall_CSState key; + + // Hold off interrupts + key = ICall_enterCSImpl(); + + if (*q_ptr != NULL) + { + // Dequeue message + msg_ptr = *q_ptr; + *q_ptr = ICALL_MSG_NEXT(msg_ptr); + ICALL_MSG_NEXT(msg_ptr) = NULL; + ICALL_MSG_DEST_ID(msg_ptr) = ICALL_UNDEF_DEST_ID; + } + + // Re-enable interrupts + ICall_leaveCSImpl(key); + + return msg_ptr; +} + +/** + * @internal Prepends a list of messages to a message queue + * @param q_ptr message queue pointer + * @param head message list to prepend + */ +static void ICall_msgPrepend(ICall_MsgQueue * q_ptr, ICall_MsgQueue head) +{ + void * msg_ptr = NULL; + ICall_CSState key; + + // Hold off interrupts + key = ICall_enterCSImpl(); + + if (head != NULL) + { + /* Find the end of the queue */ + msg_ptr = head; + while (ICALL_MSG_NEXT(msg_ptr) != NULL) + { + msg_ptr = ICALL_MSG_NEXT(msg_ptr); + } + ICALL_MSG_NEXT(msg_ptr) = *q_ptr; + *q_ptr = head; + } + + // Re-enable interrupts + ICall_leaveCSImpl(key); +} + +#ifndef ICALL_JT +/** + * @internal Sends a message to an entity. + * @param args arguments + * @return @ref ICALL_ERRNO_SUCCESS when successful.
+ * @ref ICALL_ERRNO_INVALID_PARAMETER when either src + * or dest is not a valid entity id or when + * dest is an entity id of an entity that does + * not receive a message + * (e.g., ICall primitive service entity). + */ +static ICall_Errno ICall_primSend(ICall_SendArgs * args) +{ + ICall_CSState key; + ICall_MsgHdr * hdr = (ICall_MsgHdr *) args->msg - 1; + + if (args->dest.entityId >= ICALL_MAX_NUM_ENTITIES || args->src >= ICALL_MAX_NUM_ENTITIES) + { + return ICALL_ERRNO_INVALID_PARAMETER; + } + key = ICall_enterCSImpl(); + if (!ICall_entities[args->dest.entityId].task) + { + ICall_leaveCSImpl(key); + return ICALL_ERRNO_INVALID_PARAMETER; + } + + ICall_leaveCSImpl(key); + /* Note that once the entry is valid, + * the value does not change and hence it is OK + * to leave the critical section. + */ + + hdr->srcentity = args->src; + hdr->dstentity = args->dest.entityId; + hdr->format = args->format; + ICall_msgEnqueue(&ICall_entities[args->dest.entityId].task->queue, args->msg); + ICALL_SYNC_HANDLE_POST(ICall_entities[args->dest.entityId].task->syncHandle); + + return ICALL_ERRNO_SUCCESS; +} + +/** + * @internal Retrieves a message, queued to receive queue of the calling thread. + * + * @param args arguments + * @return @ref ICALL_ERRNO_SUCCESS when a message was successfully + * retrieved.
+ * @ref ICALL_ERRNO_NOMSG when no message was queued to + * the receive queue at the moment.
+ * @ref ICALL_ERRNO_UNKNOWN_THREAD when the calling thread + * does not have a received queue associated with it. + * This happens when neither ICall_enrollService() nor + * ICall_registerApp() was ever called from the calling + * thread. + */ +static ICall_Errno ICall_primFetchMsg(ICall_FetchMsgArgs * args) +{ + Task_Handle taskhandle = Task_self(); + ICall_TaskEntry * taskentry = ICall_searchTask(taskhandle); + ICall_MsgHdr * hdr; + + if (!taskentry) + { + return ICALL_ERRNO_UNKNOWN_THREAD; + } + /* Successful */ + args->msg = ICall_msgDequeue(&taskentry->queue); + + if (args->msg == NULL) + { + return ICALL_ERRNO_NOMSG; + } + hdr = (ICall_MsgHdr *) args->msg - 1; + args->src.entityId = hdr->srcentity; + args->dest = hdr->dstentity; + return ICALL_ERRNO_SUCCESS; +} +#endif /* ICALL_JT */ + +/** + * @internal + * Transforms and entityId into a serviceId. + * @param entityId entity id + * @param servId pointer to a variable to store + * the resultant service id + * @return @ICALL_ERRNO_SUCCESS if the transformation was successful. + * @ICALL_ERRNO_INVALID_SERVICE if no matching service + * is found for the entity id. + */ +static ICall_Errno ICall_primEntityId2ServiceId(ICall_EntityID entityId, ICall_ServiceEnum * servId) +{ + if (entityId >= ICALL_MAX_NUM_ENTITIES || ICall_entities[entityId].service == ICALL_SERVICE_CLASS_INVALID_ENTRY || + ICall_entities[entityId].service == ICALL_SERVICE_CLASS_APPLICATION) + { + return ICALL_ERRNO_INVALID_SERVICE; + } + *servId = ICall_entities[entityId].service; + return ICALL_ERRNO_SUCCESS; +} + +#ifndef ICALL_JT +/** + * @internal Transforms and entityId into a serviceId. + * @param args arguments + * @return return values corresponding to those of ICall_entityId2ServiceId() + */ +static ICall_Errno ICall_primE2S(ICall_EntityId2ServiceIdArgs * args) +{ + return ICall_primEntityId2ServiceId(args->entityId, &args->servId); +} + +/** + * @internal Sends a message to a registered server. + * @param args arguments corresponding to those of ICall_sendServiceMsg(). + * @return @ref ICALL_ERRNO_SUCCESS when successful.
+ * @ref ICALL_ERRNO_INVALID_SERVICE when the 'dest' + * is unregistered service.
+ * @ref ICALL_ERRNO_INVALID_PARAMETER when the 'src' + * is not a valid entity id or when 'dest' is + * is a service that does not receive a message + * (such as ICall primitive service). + */ +static ICall_Errno ICall_primSendServiceMsg(ICall_SendArgs * args) +{ + ICall_EntityID dstentity = ICall_searchServiceEntity(args->dest.servId); + + if (dstentity == ICALL_INVALID_ENTITY_ID) + { + return ICALL_ERRNO_INVALID_SERVICE; + } + args->dest.entityId = dstentity; + return ICall_primSend(args); +} + +/** + * @internal Retrieves a message received at the message queue + * associated with the calling thread. + * + * Note that this function should be used by an application + * which does not expect any message from non-server entity. + * + * @param args arguments corresponding to those of ICall_fetchServiceMsg() + * @return @ref ICALL_ERRNO_SUCCESS when the operation was successful + * and a message was retrieved.
+ * @ref ICALL_ERRNO_NOMSG when there is no queued message + * at the moment.
+ * @ref ICALL_ERRNO_CORRUPT_MSG when a message queued in + * front of the thread's receive queue was not sent by + * a server. Note that in this case, the message is + * not retrieved but thrown away.
+ * @ref ICALL_ERRNO_UNKNOWN_THREAD when this function is + * called from a thread which has not registered + * an entity, either through ICall_enrollService() + * or through ICall_registerApp(). + */ +static ICall_Errno ICall_primFetchServiceMsg(ICall_FetchMsgArgs * args) +{ + ICall_ServiceEnum servId; + ICall_Errno errno = ICall_primFetchMsg(args); + if (errno == ICALL_ERRNO_SUCCESS) + { + if (ICall_primEntityId2ServiceId(args->src.entityId, &servId) != ICALL_ERRNO_SUCCESS) + { + /* Source entity ID cannot be translated to service id */ + ICall_freeMsg(args->msg); + return ICALL_ERRNO_CORRUPT_MSG; + } + args->src.servId = servId; + +#ifdef ICALL_EVENTS + /* + * Because Events are binary flags, the task's queue must be checked for + * any remaining messages. If there are the ICall event flag must be + * re-posted due to it being cleared on the last pend. + */ + ICall_primRepostSync(); +#endif // ICALL_EVENTS + } + return errno; +} +#endif /* ICALL_JT */ +/** + * @internal + * Converts milliseconds to number of ticks. + * @param msecs milliseconds + * @param ticks pointer to a variable to store the resultant number of ticks + * @return @ref ICALL_ERRNO_SUCCESS when successful
+ * @ref ICALL_ERRNO_INVALID_PARAMETER when conversion failed + * as the input goes out of range for the output data type. + */ +static ICall_Errno ICall_msecs2Ticks(uint_fast32_t msecs, uint32_t * ticks) +{ + uint_fast64_t intermediate = msecs; + + /*convert to microSec*/ + intermediate *= 1000; + /*divide with the ticks perios*/ + intermediate /= ICall_getTickPeriod(); + if (intermediate >= ((uint_fast64_t) 1 << (sizeof(uint32_t) * 8 - 1))) + { + /* Out of range. + * Note that we use only half of the range so that client can + * determine whether the time has passed or time has yet to come. + */ + return ICALL_ERRNO_INVALID_PARAMETER; + } + *ticks = (uint32_t) intermediate; + return ICALL_ERRNO_SUCCESS; +} + +#ifndef ICALL_JT +/** + * @internal + * Waits for a signal to the synchronization object associated with the calling + * thread. + * + * Note that the synchronization object associated with a thread is signaled + * when a message is queued to the message receive queue of the thread + * or when ICall_signal() function is called onto the synchronization object. + * + * @param args arguments corresponding to those of ICall_wait(). + * @return @ref ICALL_ERRNO_SUCCESS when the synchronization object is + * signaled.
+ * @ref ICALL_ERRNO_TIMEOUT when designated timeout period + * has passed since the call of the function without + * the synchronization object being signaled.
+ * @ref ICALL_ERRNO_INVALID_PARAMETER when the milliseconds + * is greater than the value of ICall_getMaxMSecs(). + */ +static ICall_Errno ICall_primWait(ICall_WaitArgs * args) +{ + Task_Handle taskhandle = Task_self(); + ICall_TaskEntry * taskentry = ICall_searchTask(taskhandle); + uint32_t timeout; + + { + BIOS_ThreadType threadtype = BIOS_getThreadType(); + + if (threadtype == BIOS_ThreadType_Hwi || threadtype == BIOS_ThreadType_Swi) + { + /* Blocking call is not allowed from Hwi or Swi. + * Note that though theoretically, Swi or lower priority Hwi may block + * on an event to be generated by a higher priority Hwi, it is not a + * safe practice and hence it is disabled. + */ + return ICALL_ERRNO_UNKNOWN_THREAD; + } + } + + if (!taskentry) + { + return ICALL_ERRNO_UNKNOWN_THREAD; + } + /* Successful */ + if (args->milliseconds == 0) + { + timeout = BIOS_NO_WAIT; + } + else if (args->milliseconds == ICALL_TIMEOUT_FOREVER) + { + timeout = BIOS_WAIT_FOREVER; + } + else + { + /* Convert milliseconds to number of ticks */ + ICall_Errno errno = ICall_msecs2Ticks(args->milliseconds, &timeout); + if (errno != ICALL_ERRNO_SUCCESS) + { + return errno; + } + } + + if (ICALL_SYNC_HANDLE_PEND(taskentry->syncHandle, timeout)) + { + return ICALL_ERRNO_SUCCESS; + } + + return ICALL_ERRNO_TIMEOUT; +} + +/** + * @internal signals a synchronziation object. + * @param args arguments corresponding to those of ICall_signal() + * @return return value corresponding to those of ICall_signal() + */ +static ICall_Errno ICall_primSignal(ICall_SignalArgs * args) +{ + ICALL_SYNC_HANDLE_POST(args->syncHandle); + return ICALL_ERRNO_SUCCESS; +} + +/** + * @internal aborts program + * @param args arguments corresponding to those of ICall_abort() + * @return return value corresponding to those of ICall_abort() + */ +static ICall_Errno ICall_primAbort(ICall_FuncArgsHdr * args) +{ + ICALL_HOOK_ABORT_FUNC(); + return ICALL_ERRNO_SUCCESS; +} + +/** + * @internal Enables an interrupt. + * @param args arguments corresponding to those of ICall_enableint() + * @return return values corresponding to those of ICall_enableint() + */ +static ICall_Errno ICall_primEnableint(ICall_intNumArgs * args) +{ + Hwi_enableinterrupt(args->intnum); + return ICALL_ERRNO_SUCCESS; +} + +/** + * @internal Disables an interrupt. + * @param args arguments corresponding to those of ICall_disableint() + * @return return values corresponding to those of ICall_disableint() + */ +static ICall_Errno ICall_primDisableint(ICall_intNumArgs * args) +{ + Hwi_disableinterrupt(args->intnum); + return ICALL_ERRNO_SUCCESS; +} + +/** + * @internal Enables master interrupt and context switching. + * @param args arguments corresponding to those of ICall_enableMint() + * @return return values corresponding to those of ICall_enableMint() + */ +static ICall_Errno ICall_primEnableMint(ICall_FuncArgsHdr * args) +{ + Hwi_enable(); + Swi_enable(); + return ICALL_ERRNO_SUCCESS; +} + +/** + * @internal Disables master interrupt and context switching. + * @param args arguments corresponding to those of ICall_disableMint() + * @return return values corresponding to those of ICall_disableMint() + */ +static ICall_Errno ICall_primDisableMint(ICall_FuncArgsHdr * args) +{ + Swi_disable(); + Hwi_disable(); + return ICALL_ERRNO_SUCCESS; +} + +/** + * @internal registers an interrupt service routine + * @param args arguments corresponding to those of ICall_registerISR() + * @return return values corresponding to those of ICall_registerISR() + */ +static ICall_Errno ICall_primRegisterISR(ICall_RegisterISRArgs * args) +{ + Hwi_Params hwiParams; + + Hwi_Params_init(&hwiParams); + hwiParams.priority = 0xE0; // default all registered ints to lowest priority + + if (Hwi_create(args->intnum, (void (*)((void *) )) args->isrfunc, &hwiParams, NULL) == NULL) + { + ICALL_HOOK_ABORT_FUNC(); + return ICALL_ERRNO_NO_RESOURCE; + } + return ICALL_ERRNO_SUCCESS; +} + +/** + * @internal registers an interrupt service routine + * @param args arguments corresponding to those of ICall_registerISR_Ext() + * @return return values corresponding to those of ICall_registerISR_ext() + */ +static ICall_Errno ICall_primRegisterISR_Ext(ICall_RegisterISRArgs_Ext * args) +{ + Hwi_Params hwiParams; + + Hwi_Params_init(&hwiParams); + hwiParams.priority = args->intPriority; + + if (Hwi_create(args->intnum, (void (*)((void *) )) args->isrfunc, &hwiParams, NULL) == NULL) + { + ICALL_HOOK_ABORT_FUNC(); + return ICALL_ERRNO_NO_RESOURCE; + } + return ICALL_ERRNO_SUCCESS; +} + +/** + * @internal Gets tick counter value + * @param args arguments corresponding to those of ICall_getTicks() + * @return return values corresponding to those of ICall_getTicks() + */ +static ICall_Errno ICall_primGetTicks(ICall_Getuint32_tArgs * args) +{ + args->value = Clock_getTicks(); + return ICALL_ERRNO_SUCCESS; +} +#endif /* ICALL_JT */ + +/** + * @internal + * Clock event handler function. + * This function is used to implement the wakeup scheduler. + * + * @param arg an @ref ICall_ScheduleEntry + */ + +static void ICall_clockFunc(uintptr_t arg) +{ + ICall_ScheduleEntry * entry = (ICall_ScheduleEntry *) arg; + + entry->cback(entry->arg); +} + +#ifndef ICALL_JT +/** + * @internal + * Set up or restart a timer. + * + * @param args arguments corresponding to those of ICall_setTimer() + * @return @ref ICALL_ERRNO_SUCCESS when successful;
+ * @ref ICALL_ERRNO_INVALID_PARAMETER if timer designated by the + * timer ID value was not set up before. + * @ref ICALL_ERRNO_NO_RESOURCE when ran out of resource. + * Check ICall heap size and OS heap size if this happens. + */ +static ICall_Errno ICall_primSetTimer(ICall_SetTimerArgs * args) +{ + ICall_ScheduleEntry * entry; + + if (args->timerid == ICALL_INVALID_TIMER_ID) + { + Clock_Params params; + + /* Create a new timer */ + entry = ICall_heapMalloc(sizeof(ICall_ScheduleEntry)); + if (entry == NULL) + { + /* allocation failed */ + return ICALL_ERRNO_NO_RESOURCE; + } + Clock_Params_init(¶ms); + params.startFlag = FALSE; + params.period = 0; + params.arg = ((void *) ) entry; + entry->clock = Clock_create(ICall_clockFunc, args->timeout, ¶ms, NULL); + if (!entry->clock) + { + /* abort */ + ICall_abort(); + ICall_heapFree(entry); + return ICALL_ERRNO_NO_RESOURCE; + } + entry->cback = args->cback; + entry->arg = args->arg; + args->timerid = (ICall_TimerID) entry; + } + else + { + ICall_CSState key; + + entry = (ICall_ScheduleEntry *) args->timerid; + + /* Critical section is entered to disable interrupts that might cause call + * to callback due to race condition */ + key = ICall_enterCriticalSection(); + Clock_stop(entry->clock); + entry->arg = args->arg; + ICall_leaveCriticalSection(key); + } + + Clock_setTimeout(entry->clock, args->timeout); + Clock_start(entry->clock); + + return ICALL_ERRNO_SUCCESS; +} + +/** + * @internal + * Set up or restart a timer. + * + * @param args arguments corresponding to those of ICall_setTimerMSecs() + * @return @ref ICALL_ERRNO_SUCCESS when successful;
+ * @ref ICALL_ERRNO_INVALID_PARAMETER when msecs is greater than + * maximum value supported. + * @ref ICALL_ERRNO_NO_RESOURCE when ran out of resource. + * Check ICall heap size and OS heap size if this happens. + */ +static ICall_Errno ICall_primSetTimerMSecs(ICall_SetTimerArgs * args) +{ + uint32_t ticks; + /* Convert to tick time */ + ICall_Errno errno = ICall_msecs2Ticks(args->timeout, &ticks); + + if (errno != ICALL_ERRNO_SUCCESS) + { + return errno; + } + args->timeout = ticks; + return ICall_primSetTimer(args); +} + +/** + * @internal + * Stops a timer. + * + * @param args arguments corresponding to those of ICall_stopTimer() + * + * @return @ref ICALL_ERRNO_SUCCESS when successful;
+ * @ref ICALL_ERRNO_INVALID_PARAMETER + * if id is @ref ICALL_INVALID_TIMER_ID. + */ +static ICall_Errno ICall_primStopTimer(ICall_StopTimerArgs * args) +{ + ICall_ScheduleEntry * entry = (ICall_ScheduleEntry *) args->timerid; + + if (args->timerid == ICALL_INVALID_TIMER_ID) + { + return ICALL_ERRNO_INVALID_PARAMETER; + } + + Clock_stop(entry->clock); + return ICALL_ERRNO_SUCCESS; +} + +/** + * @internal Gets tick period + * @param args arguments corresponding to those of ICall_getTickPeriod() + * @return return values corresponding to those of ICall_getTickPeriod() + */ +static ICall_Errno ICall_primGetTickPeriod(ICall_Getuint32_tArgs * args) +{ + args->value = Clock_tickPeriod; + return ICALL_ERRNO_SUCCESS; +} + +/** + * @internal Gets maximum period supported + * @param args arguments corresponding to those of ICall_getMaxMSecs() + * @return return values corresponding to those of ICall_getMaxMSecs() + */ +static ICall_Errno ICall_primGetMaxMSecs(ICall_Getuint32_tArgs * args) +{ + uint_fast64_t tmp = ((uint_fast64_t) 0x7ffffffful) * Clock_tickPeriod; + tmp /= 1000; + if (tmp >= 0x80000000ul) + { + tmp = 0x7ffffffful; + } + args->value = (uint_least32_t) tmp; + return ICALL_ERRNO_SUCCESS; +} + +/** + * @internal + * Waits for a message that matches comparison + * + * @param args arguments corresponding to those of ICall_waitMatch(). + * @return @ref ICALL_ERRNO_SUCCESS when the synchronization object is + * signaled.
+ * @ref ICALL_ERRNO_TIMEOUT when designated timeout period + * has passed since the call of the function without + * the semaphore being signaled.
+ * @ref ICALL_ERRNO_INVALID_PARAMETER when the milliseconds + * is greater than the value of ICall_getMaxMSecs(). + */ +static ICall_Errno ICall_primWaitMatch(ICall_WaitMatchArgs * args) +{ + Task_Handle taskhandle = Task_self(); + ICall_TaskEntry * taskentry = ICall_searchTask(taskhandle); + ICall_MsgQueue prependQueue = NULL; +#ifndef ICALL_EVENTS + uint_fast16_t consumedCount = 0; +#endif + uint32_t timeout; + uint_fast32_t timeoutStamp; + ICall_Errno errno; + + { + BIOS_ThreadType threadtype = BIOS_getThreadType(); + + if (threadtype == BIOS_ThreadType_Hwi || threadtype == BIOS_ThreadType_Swi) + { + /* Blocking call is not allowed from Hwi or Swi. + * Note that though theoretically, Swi or lower priority Hwi may block + * on an event to be generated by a higher priority Hwi, it is not a + * safe practice and hence it is disabled. + */ + return ICALL_ERRNO_UNKNOWN_THREAD; + } + } + + if (!taskentry) + { + return ICALL_ERRNO_UNKNOWN_THREAD; + } + /* Successful */ + if (args->milliseconds == 0) + { + timeout = BIOS_NO_WAIT; + } + else if (args->milliseconds == ICALL_TIMEOUT_FOREVER) + { + timeout = BIOS_WAIT_FOREVER; + } + else + { + /* Convert milliseconds to number of ticks */ + errno = ICall_msecs2Ticks(args->milliseconds, &timeout); + if (errno != ICALL_ERRNO_SUCCESS) + { + return errno; + } + } + + errno = ICALL_ERRNO_TIMEOUT; + timeoutStamp = Clock_getTicks() + timeout; + while (ICALL_SYNC_HANDLE_PEND(taskentry->syncHandle, timeout)) + { + ICall_FetchMsgArgs fetchArgs; + ICall_ServiceEnum servId; + errno = ICall_primFetchMsg(&fetchArgs); + if (errno == ICALL_ERRNO_SUCCESS) + { + if (ICall_primEntityId2ServiceId(fetchArgs.src.entityId, &servId) == ICALL_ERRNO_SUCCESS) + { + if (args->matchFn(servId, fetchArgs.dest, fetchArgs.msg)) + { + /* Matching message found*/ + args->servId = servId; + args->dest = fetchArgs.dest; + args->msg = fetchArgs.msg; + errno = ICALL_ERRNO_SUCCESS; + break; + } + } + /* Message was received but it wasn't expected one. + * Add to the prepend queue */ + ICall_msgEnqueue(&prependQueue, fetchArgs.msg); +#ifdef ICALL_EVENTS + /* Event are binary semaphore, so if several messsages are posted while + * we are processing one, it's possible that some of them are 'missed' and + * not processed. Sending a event to ourself force this loop to run until + * all the messages in the queue are processed. + */ + ICALL_SYNC_HANDLE_POST(taskentry->syncHandle); +#endif + } + + /* Prepare for timeout exit */ + errno = ICALL_ERRNO_TIMEOUT; + +#ifndef ICALL_EVENTS + /* Keep the decremented semaphore count */ + consumedCount++; +#endif /* ICALL_EVENTS */ + if (timeout != BIOS_WAIT_FOREVER && timeout != BIOS_NO_WAIT) + { + /* Readjust timeout */ + uint32_t newTimeout = timeoutStamp - Clock_getTicks(); + if (newTimeout == 0 || newTimeout > timeout) + { + break; + } + timeout = newTimeout; + } + } + +#ifdef ICALL_EVENTS + /* + * Because Events are binary semaphores, the task's queue must be checked for + * any remaining messages. If there are, the ICall event flag must be + * re-posted due to it being cleared on the last pend. + */ + ICall_primRepostSync(); +#endif // ICALL_EVENTS + + /* Prepend retrieved irrelevant messages */ + ICall_msgPrepend(&taskentry->queue, prependQueue); +#ifndef ICALL_EVENTS + /* Re-increment the consumed semaphores */ + for (; consumedCount > 0; consumedCount--) + { + Semaphore_post(taskentry->syncHandle); + } +#endif /* ICALL_EVENTS */ + return errno; +} + +/** + * @internal + * Retrieves an entity ID of an entity associated with the calling thread. + * + * @param args arguments corresponding to those of ICall_getEntityId(). + * @return @ref ICALL_ERRNO_SUCCESS when successful.
+ * @ref ICALL_ERRNO_UNKNOWN_THREAD when no entity was associated + * with the calling thread. + */ +static ICall_Errno ICall_primGetEntityId(ICall_GetEntityIdArgs * args) +{ + Task_Handle taskhandle = Task_self(); + ICall_CSState key; + size_t i; + + { + BIOS_ThreadType threadtype = BIOS_getThreadType(); + + if (threadtype == BIOS_ThreadType_Hwi || threadtype == BIOS_ThreadType_Swi) + { + return ICALL_ERRNO_UNKNOWN_THREAD; + } + } + + key = ICall_enterCSImpl(); + for (i = 0; i < ICALL_MAX_NUM_ENTITIES; i++) + { + if (ICall_entities[i].service == ICALL_SERVICE_CLASS_INVALID_ENTRY) + { + /* Not found */ + break; + } + if (ICall_entities[i].task->task == taskhandle) + { + /* Found */ + args->entity = i; + ICall_leaveCSImpl(key); + return ICALL_ERRNO_SUCCESS; + } + } + ICall_leaveCSImpl(key); + return ICALL_ERRNO_UNKNOWN_THREAD; +} + +/** + * @internal + * Checks whether the calling thread provides the designated service. + * + * @param args arguments corresponding to those of ICall_threadServes(). + * @return @ref ICALL_ERRNO_SUCCESS when successful.
+ * @ref ICALL_ERRNO_UNKNOWN_THREAD when the calling thread is + * unrecognized. + * @ref ICALL_ERRNO_INVALID_SERVICE if the service id is not enrolled + * by any thread. + */ +static ICall_Errno ICall_primThreadServes(ICall_ThreadServesArgs * args) +{ + Task_Handle taskhandle; + ICall_CSState key; + size_t i; + + { + BIOS_ThreadType threadtype = BIOS_getThreadType(); + + if (threadtype == BIOS_ThreadType_Hwi || threadtype == BIOS_ThreadType_Swi) + { + return ICALL_ERRNO_UNKNOWN_THREAD; + } + } + + taskhandle = Task_self(); + + key = ICall_enterCSImpl(); + for (i = 0; i < ICALL_MAX_NUM_ENTITIES; i++) + { + if (ICall_entities[i].service == ICALL_SERVICE_CLASS_INVALID_ENTRY) + { + /* Not found */ + break; + } + else if (ICall_entities[i].service == args->servId) + { + args->result = (uint_fast8_t) (ICall_entities[i].task->task == taskhandle); + ICall_leaveCSImpl(key); + return ICALL_ERRNO_SUCCESS; + } + } + ICall_leaveCSImpl(key); + return ICALL_ERRNO_INVALID_SERVICE; +} + +/** + * @internal + * Creates an RTOS task. + * + * @param args arguments corresponding to those of ICall_createTask(). + * @return @ref ICALL_ERRNO_SUCCESS when successful.
+ * @ref ICALL_ERRNO_NO_RESOURCE when task creation failed. + */ +static ICall_Errno ICall_primCreateTask(ICall_CreateTaskArgs * args) +{ + /* Task_Params is a huge structure. + * To reduce stack usage, heap is used instead. + * This implies that ICall_createTask() must be called before heap + * space may be exhausted. + */ + Task_Params * params = (Task_Params *) ICall_heapMalloc(sizeof(Task_Params)); + Task_Handle task; + + if (params == NULL) + { + return ICALL_ERRNO_NO_RESOURCE; + } + + Task_Params_init(params); + params->priority = args->priority; + params->stackSize = args->stacksize; + params->arg0 = args->arg; + + task = Task_create((Task_FuncPtr) args->entryfn, params, NULL); + ICall_heapFree(params); + + if (task == NULL) + { + return ICALL_ERRNO_NO_RESOURCE; + } + return ICALL_ERRNO_SUCCESS; +} +#endif /* ICALL_JT */ + +#ifdef ICALL_RTOS_EVENT_API +/** + * @internal + * Creates an event. + * + * @param args arguments corresponding to those of ICall_createEvent(). + * @return @ref ICALL_ERRNO_SUCCESS when successful.
+ * @ref ICALL_ERRNO_NO_RESOURCE when task creation failed. + */ +static ICall_Errno ICall_primCreateEvent(ICall_CreateEventArgs * args) +{ + args->event = Event_create(NULL, NULL); + + if (args->event == NULL) + { + return ICALL_ERRNO_NO_RESOURCE; + } + return ICALL_ERRNO_SUCCESS; +} +#endif /* ICALL_RTOS_EVENT_API */ +#ifdef ICALL_RTOS_SEMAPHORE_API +/** + * @internal + * Creates a semaphore. + * + * @param args arguments corresponding to those of ICall_createSemaphore(). + * @return @ref ICALL_ERRNO_SUCCESS when successful.
+ * @ref ICALL_ERRNO_NO_RESOURCE when task creation failed. + */ +static ICall_Errno ICall_primCreateSemaphore(ICall_CreateSemaphoreArgs * args) +{ + /* Semaphore_Params is a huge structure. + * To reduce stack usage, heap is used instead. + * This implies that ICall_createSemaphore() must be called before heap + * space may be exhausted. + */ + Semaphore_Params * semParams = (Semaphore_Params *) ICall_heapMalloc(sizeof(Semaphore_Params)); + + if (semParams == NULL) + { + return ICALL_ERRNO_NO_RESOURCE; + } + + Semaphore_Params_init(semParams); + if (args->mode == ICALL_SEMAPHORE_MODE_BINARY) + { + semParams->mode = Semaphore_Mode_BINARY; + } + + args->sem = Semaphore_create(args->initcount, semParams, NULL); + ICall_heapFree(semParams); + + if (args->sem == NULL) + { + return ICALL_ERRNO_NO_RESOURCE; + } + return ICALL_ERRNO_SUCCESS; +} +#endif /* ICALL_RTOS_SEMAPHORE_API */ +#ifdef ICALL_RTOS_EVENT_API +/** + * @internal + * Waits on a ICALL_MSG_EVENT_ID. + * + * @param args arguments corresponding to those of ICall_waitEvent(). + * @return @ref ICALL_ERRNO_SUCCESS when successful.
+ * @ref ICALL_ERRNO_TIMEOUT when timeout occurred. + */ +static ICall_Errno ICall_primWaitEvent(ICall_WaitEventArgs * args) +{ + uint32_t timeout; + + if (args->milliseconds == 0) + { + timeout = BIOS_NO_WAIT; + } + else if (args->milliseconds == ICALL_TIMEOUT_FOREVER) + { + timeout = BIOS_WAIT_FOREVER; + } + else + { + ICall_Errno errno = ICall_msecs2Ticks(args->milliseconds, &timeout); + if (errno != ICALL_ERRNO_SUCCESS) + { + return errno; + } + } + + if (Event_pend(args->event, 0, ICALL_MSG_EVENT_ID, timeout)) + { + return ICALL_ERRNO_SUCCESS; + } + return ICALL_ERRNO_TIMEOUT; +} +#endif /* ICALL_RTOS_EVENT_API */ + +#ifdef ICALL_RTOS_SEMAPHORE_API +/** + * @internal + * Waits on a semaphore. + * + * @param args arguments corresponding to those of ICall_waitSemaphore(). + * @return @ref ICALL_ERRNO_SUCCESS when successful.
+ * @ref ICALL_ERRNO_TIMEOUT when timeout occurred. + */ +static ICall_Errno ICall_primWaitSemaphore(ICall_WaitSemaphoreArgs * args) +{ + uint32_t timeout; + + if (args->milliseconds == 0) + { + timeout = BIOS_NO_WAIT; + } + else if (args->milliseconds == ICALL_TIMEOUT_FOREVER) + { + timeout = BIOS_WAIT_FOREVER; + } + else + { + ICall_Errno errno = ICall_msecs2Ticks(args->milliseconds, &timeout); + if (errno != ICALL_ERRNO_SUCCESS) + { + return errno; + } + } + if (Semaphore_pend(args->sem, timeout)) + { + return ICALL_ERRNO_SUCCESS; + } + return ICALL_ERRNO_TIMEOUT; +} +#endif /* ICALL_RTOS_SEMAPHORE_API */ + +#ifdef ICALL_RTOS_SEMAPHORE_API +/** + * @internal signals a semaphore + * @param args arguments corresponding to those of ICall_signal() + * @return return value corresponding to those of ICall_signal() + */ +static ICall_Errno ICall_primPostSemaphore(ICall_SignalArgs * args) +{ + Semaphore_post(args->syncHandle); + return ICALL_ERRNO_SUCCESS; +} +#endif /* ICALL_RTOS_EVENT_API */ +#ifdef ICALL_RTOS_EVENT_API +/** + * @internal signals an event + * @param args arguments corresponding to those of ICall_signal() + * @return return value corresponding to those of ICall_signal() + */ +static ICall_Errno ICall_primPostEvent(ICall_SignalEventsArgs * args) +{ + Event_post(args->syncHandle, args->events); + return ICALL_ERRNO_SUCCESS; +} +#endif /* ICALL_RTOS_EVENT_API */ +/** + * @internal Primitive service function ID to handler function map + */ +#ifndef ICALL_JT +static const struct _icall_primsvcfunc_map_entry_t +{ +#ifdef COVERAGE_TEST + size_t id; +#endif /* COVERAGE_TEST */ + ICall_PrimSvcFunc func; +} ICall_primSvcFuncs[] = { + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_ENROLL, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primEnroll }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_REGISTER_APP, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primRegisterApp }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_MSG_ALLOC, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primAllocMsg }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_MSG_FREE, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primFreeMsg }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_MALLOC, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primMalloc }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_FREE, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primFree }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_SEND_MSG, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primSend }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_FETCH_MSG, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primFetchMsg }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_SEND_SERV_MSG, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primSendServiceMsg }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_FETCH_SERV_MSG, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primFetchServiceMsg }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_WAIT, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primWait }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_SIGNAL, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primSignal }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_ABORT, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primAbort }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_ENABLE_int, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primEnableint }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_DISABLE_int, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primDisableint }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_ENABLE_Mint, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primEnableMint }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_DISABLE_Mint, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primDisableMint }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_REGISTER_ISR, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primRegisterISR }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_GET_TICKS, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primGetTicks }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_SET_TIMER_MSECS, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primSetTimerMSecs }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_GET_TICK_PERIOD, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primGetTickPeriod }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_GET_MAX_MILLISECONDS, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primGetMaxMSecs }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_ENTITY2SERVICE, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primE2S }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_PWR_UPD_ACTIVITY_COUNTER, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICallPlatform_pwrUpdActivityCounter }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_PWR_REGISTER_NOTIFY, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICallPlatform_pwrRegisterNotify }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_WAIT_MATCH, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primWaitMatch }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_GET_ENTITY_ID, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primGetEntityId }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_SET_TIMER, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primSetTimer }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_STOP_TIMER, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primStopTimer }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_PWR_CONFIG_AC_ACTION, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICallPlatform_pwrConfigACAction }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_PWR_REQUIRE, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICallPlatform_pwrRequire }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_PWR_DISPENSE, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICallPlatform_pwrDispense }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_THREAD_SERVES, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primThreadServes }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_PWR_IS_STABLE_XOSC_HF, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICallPlatform_pwrIsStableXOSCHF }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_PWR_GET_TRANSITION_STATE, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICallPlatform_pwrGetTransitionState }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_CREATE_TASK, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primCreateTask }, + +#ifdef ICALL_RTOS_SEMAPHORE_API + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_CREATE_SEMAPHORE, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primCreateSemaphore }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_WAIT_SEMAPHORE, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primWaitSemaphore }, + +#else /* ICALL_RTOS_SEMAPHORE_API */ + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_WAIT_SEMAPHORE, +#endif /* COVERAGE_TEST */ + NULL }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_WAIT_SEMAPHORE, +#endif /* COVERAGE_TEST */ + NULL }, +#endif /* ICALL_RTOS_SEMAPHORE_API */ + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_SWITCH_XOSC_HF, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICallPlatform_pwrSwitchXOSCHF }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_PWR_GET_XOSC_STARTUP_TIME, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICallPlatform_pwrGetXOSCStartupTime }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_REGISTER_ISR_EXT, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primRegisterISR_Ext }, + +#ifdef ICALL_RTOS_SEMAPHORE_API + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_POST_SEMAPHORE, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primPostSemaphore }, +#else /*ICALL_RTOS_SEMAPHORE_API */ + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_POST_SEMAPHORE, +#endif /* COVERAGE_TEST */ + NULL }, /* ICALL_RTOS_SEMAPHORE_API */ +#endif + +#ifdef ICALL_RTOS_EVENT_API + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_CREATE_EVENT, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primCreateEvent }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_WAIT_EVENT, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primWaitEvent }, + + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_POST_EVENT, +#endif /* COVERAGE_TEST */ + (ICall_PrimSvcFunc) ICall_primPostEvent }, +#else /*ICALL_RTOS_EVENT_API */ + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_CREATE_EVENT, +#endif /* COVERAGE_TEST */ + NULL }, + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_WAIT_EVENT, +#endif /* COVERAGE_TEST */ + NULL }, /* ICALL_RTOS_EVENT_API */ + { +#ifdef COVERAGE_TEST + ICALL_PRIMITIVE_FUNC_POST_EVENT, +#endif /* COVERAGE_TEST */ + NULL }, /* ICALL_RTOS_EVENT_API */ +#endif /* ICALL_RTOS_EVENT_API */ +}; +/** + * @internal + * Primitive service registered handler function + * @param args arguments + * @return error code + */ +static ICall_Errno ICall_primService(ICall_FuncArgsHdr * args) +{ + if (args->func >= sizeof(ICall_primSvcFuncs) / sizeof(ICall_primSvcFuncs[0])) + { + return ICALL_ERRNO_INVALID_FUNCTION; + } + return ICall_primSvcFuncs[args->func].func(args); +} + +/** + * @internal Enrolls primitive service + */ +static void ICall_initPrim(void) +{ + ICall_entities[0].service = ICALL_SERVICE_CLASS_PRIMITIVE; + ICall_entities[0].fn = ICall_primService; + + /* Initialize heap */ + ICall_heapInit(); + + /* TODO: Think about freezing permanently allocated memory blocks + * for optimization. + * Now that multiple stack images may share the same heap. + * kick cannot be triggered by a single stack image. + * Hence, maybe there should be an alternative API to + * permanently allocate memory blocks, such as + * by allocating the blocks at the end of the heap space. */ +} +#endif /* ICALL_JT */ + +#ifdef COVERAGE_TEST +/** + * @internal + * Verification function for ICall implementation + */ +void ICall_verify(void) +{ + size_t i; + for (i = 0; i < sizeof(ICall_primSvcFuncs) / sizeof(ICall_primSvcFuncs[0]); i++) + { + if (i != ICall_primSvcFuncs[i].id) + { + ICall_abort(); + } + } +} +#endif /* COVERAGE_TEST */ + +#ifdef ICALL_JT +/** + * Registers an application. + * Note that this function must be called from the thread + * from which ICall_wait() function will be called. + * + * @param entity pointer to a variable to store entity id assigned + * to the application. + * @param msgsem pointer to a variable to store the synchronous object handle + * associated with the calling thread. + * @return @ref ICALL_ERRNO_SUCCESS when successful.
+ * @ref ICALL_ERRNO_NO_RESOURCE when ran out of resource. + */ +ICall_Errno ICall_registerApp(ICall_EntityID * entity, ICall_SyncHandle * msgSyncHdl) +{ + + size_t i; + ICall_TaskEntry * taskentry = ICall_newTask(Task_self()); + ICall_CSState key; + + if (!taskentry) + { + /* abort */ + ICALL_HOOK_ABORT_FUNC(); + return ICALL_ERRNO_NO_RESOURCE; + } + + key = ICall_enterCSImpl(); + for (i = 0; i < ICALL_MAX_NUM_ENTITIES; i++) + { + if (ICall_entities[i].service == ICALL_SERVICE_CLASS_INVALID_ENTRY) + { + /* Use this entry */ + ICall_entities[i].service = ICALL_SERVICE_CLASS_APPLICATION; + ICall_entities[i].task = taskentry; + ICall_entities[i].fn = NULL; + *entity = (ICall_EntityID) i; + *msgSyncHdl = taskentry->syncHandle; + ICall_leaveCSImpl(key); + return ICALL_ERRNO_SUCCESS; + } + } + /* abort */ + ICALL_HOOK_ABORT_FUNC(); + ICall_leaveCSImpl(key); + return (ICALL_ERRNO_NO_RESOURCE); +} + +/** + * Allocates memory block for a message. + * @param size size of the message body in bytes. + * @return pointer to the start of the message body of the newly + * allocated memory block, or NULL if the allocation + * failed. + */ +void * ICall_allocMsg(size_t size) +{ + ICall_MsgHdr * hdr = (ICall_MsgHdr *) ICall_heapMalloc(sizeof(ICall_MsgHdr) + size); + + if (!hdr) + { + return NULL; + } + hdr->len = size; + hdr->next = NULL; + hdr->dest_id = ICALL_UNDEF_DEST_ID; + return ((void *) (hdr + 1)); +} + +/** + * Frees the memory block allocated for a message. + * @param msg pointer to the start of the message body + * which was returned from ICall_allocMsg(). + */ +void ICall_freeMsg(void * msg) +{ + ICall_MsgHdr * hdr = (ICall_MsgHdr *) msg - 1; + ICall_heapFree(hdr); +} + +/** + * Sends a message to a registered server. + * @param src Entity id of the sender of the message + * @param dest Service id + * @param format Message format: + * @ref ICALL_MSG_FORMAT_KEEP, + * @ref ICALL_MSG_FORMAT_1ST_CHAR_TASK_ID or + * @ref ICALL_MSG_FORMAT_3RD_CHAR_TASK_ID. + * Message format indicates whether and which + * field of the message must be transformed + * into a implementation specific sender + * identity for an external image.
+ * When a service message interface is defined, + * it may contain a field that is not understood + * by the client but only understood by + * the system on the server's side. + * The format provides an information to the + * messaging system on such a server + * so that it can generically tag necessary + * information to the message. + * @param msg pointer to the message body to send.
+ * Note that if message is successfully sent, + * the caller should not reference the message any + * longer.
+ * However, if the function fails, the caller + * still owns the reference to the message. + * That is, caller may attempt another send, + * or may free the memory block, etc. + * @return @ref ICALL_ERRNO_SUCCESS when successful.
+ * @ref ICALL_ERRNO_INVALID_SERVICE when the 'dest' + * is unregistered service.
+ * @ref ICALL_ERRNO_INVALID_PARAMETER when the 'src' + * is an out of range entity id or when 'dest' is + * is a service that does not receive a message + * (such as ICall primitive service).
+ * Note that as far as 'src' is within the range, + * this function won't notice the 'src' entity id + * as invalid. + */ + +ICall_Errno ICall_sendServiceMsg(ICall_EntityID src, ICall_ServiceEnum dest, ICall_MSGFormat format, void * msg) +{ + ICall_EntityID dstentity = ICall_searchServiceEntity(dest); + + if (dstentity == ICALL_INVALID_ENTITY_ID) + { + return ICALL_ERRNO_INVALID_SERVICE; + } + return (ICall_send(src, dstentity, format, msg)); +} + +/** + * Retrieves a message received at the message queue + * associated with the calling thread. + * + * Note that this function should be used by an application + * which does not expect any message from non-server entity. + * + * @param src pointer to a variable to store the service id + * of the registered server which sent the retrieved + * message + * @param dest pointer to a variable to store the entity id + * of the destination of the message. + * @param msg pointer to a pointer variable to store the + * starting address of the message body being + * retrieved. + * @return @ref ICALL_ERRNO_SUCCESS when the operation was successful + * and a message was retrieved.
+ * @ref ICALL_ERRNO_NOMSG when there is no queued message + * at the moment.
+ * @ref ICALL_ERRNO_CORRUPT_MSG when a message queued in + * front of the thread's receive queue was not sent by + * a server. Note that in this case, the message is + * not retrieved but thrown away.
+ * @ref ICALL_ERRNO_UNKNOWN_THREAD when this function is + * called from a thread which has not registered + * an entity, either through ICall_enrollService() + * or through ICall_registerApp(). + */ +ICall_Errno ICall_fetchServiceMsg(ICall_ServiceEnum * src, ICall_EntityID * dest, void ** msg) +{ + ICall_ServiceEnum servId; + ICall_Errno errno = ICall_fetchMsg((ICall_EntityID *) src, dest, msg); + + if (errno == ICALL_ERRNO_SUCCESS) + { + if (ICall_primEntityId2ServiceId(*src, &servId) != ICALL_ERRNO_SUCCESS) + { + /* Source entity ID cannot be translated to service id */ + ICall_freeMsg(*msg); + return ICALL_ERRNO_CORRUPT_MSG; + } + *src = servId; + } + return (errno); +} +#if 0 +void convertMilliToTimepec(struct timespec *timeoutPosix,uint32_t timeout) +{ + timeoutPosix->tv_sec = (timeout / 1000); + timeout = timeout % 1000; + + /* 1 millisecond = 1 000 000 nanoseconds */ + timeoutPosix->tv_nsec = timeout * 1000000; +} +#endif + +/** + * Waits for a signal to the semaphore associated with the calling thread. + * + * Note that the semaphore associated with a thread is signaled + * when a message is queued to the message receive queue of the thread + * or when ICall_signal() function is called onto the semaphore. + * + * @param milliseconds timeout period in milliseconds. + * @return @ref ICALL_ERRNO_SUCCESS when the semaphore is signaled.
+ * @ref ICALL_ERRNO_TIMEOUT when designated timeout period + * has passed since the call of the function without + * the semaphore being signaled. + */ +ICall_Errno ICall_wait(uint_fast32_t milliseconds) +{ + TaskHandle_t taskhandle = Task_self(); + ICall_TaskEntry * taskentry = ICall_searchTask(taskhandle); + uint32_t timeout; + uint32_t event; + + int16_t retVal = 0; + + if (!taskentry) + { + return (ICALL_ERRNO_UNKNOWN_THREAD); + } + /* Successful */ + if (milliseconds == 0) + { + timeout = BIOS_NO_WAIT; + } + else if (milliseconds == ICALL_TIMEOUT_FOREVER) + { + timeout = BIOS_WAIT_FOREVER; + } + else + { + /* Convert milliseconds to number of ticks */ + ICall_Errno errno = ICall_msecs2Ticks(milliseconds, &timeout); + if (errno != ICALL_ERRNO_SUCCESS) + { + return (errno); + } + } + +#ifdef FREERTOS + if (HwiP_inISR()) + { + xQueueReceiveFromISR(taskentry->syncHandle, (char *) &event, NULL); + } + else + { + xQueueReceive(taskentry->syncHandle, (char *) &event, milliseconds * 100); + } +#endif + if (retVal != (-1)) + { + return (ICALL_ERRNO_SUCCESS); + } + + return (ICALL_ERRNO_TIMEOUT); +} + +/** + * Signals a semaphore. + * @param msgsem handle of a synchronous object to signal + * @return @ref ICALL_ERRNO_SUCCESS + */ +ICall_Errno ICall_signal(ICall_SyncHandle msgSyncHdl) +{ + /* 0x80000000 is an internal Event_ID */ + uint32_t msg_ptr = 0x80000000; + ICall_Errno status = ICALL_ERRNO_NO_RESOURCE; + +#ifdef FREERTOS + uint8_t statusQ; + if (HwiP_inISR()) + { + statusQ = xQueueSendFromISR(msgSyncHdl, (char *) &msg_ptr, NULL); + } + else + { + statusQ = xQueueSend(msgSyncHdl, (char *) &msg_ptr, 0); + } + + if (statusQ == pdTRUE) + { + status = ICALL_ERRNO_SUCCESS; + } +#endif + return (status); +} + +/** + * Registers a service entity + * @param service service id of the enrolling service + * @param fn handler function which handles function + * calls to the service. + * @param entity pointer to a variable to store the assigned entity id + * @param msgsem pointer to a variable to store the synchronous object handle + * associated with the calling thread. + * @return @ref ICALL_ERRNO_SUCCESS when successful.
+ * @ref ICALL_ERRNO_INVALID_PARAMETER when service id is already + * registered by another entity.
+ * @ref ICALL_ERRNO_NO_RESOURCE when maximum number of services + * are already registered. + */ +ICall_Errno ICall_enrollService(ICall_ServiceEnum service, ICall_ServiceFunc fn, ICall_EntityID * entity, + ICall_SyncHandle * msgSyncHdl) +{ + size_t i; + ICall_TaskEntry * taskentry = ICall_newTask(Task_self()); + ICall_CSState key; + + /* Note that certain service does not handle a message + * and hence, taskentry might be NULL. + */ + if (taskentry == NULL) + { + return (ICALL_ERRNO_INVALID_PARAMETER); + } + + key = ICall_enterCSImpl(); + for (i = 0; i < ICALL_MAX_NUM_ENTITIES; i++) + { + if (ICall_entities[i].service == ICALL_SERVICE_CLASS_INVALID_ENTRY) + { + /* Use this entry */ + ICall_entities[i].service = service; + ICall_entities[i].task = taskentry; + ICall_entities[i].fn = fn; + *entity = (ICall_EntityID) i; + *msgSyncHdl = taskentry->syncHandle; + + ICall_leaveCSImpl(key); + return (ICALL_ERRNO_SUCCESS); + } + else if (service == ICall_entities[i].service) + { + /* Duplicate service enrollment */ + ICall_leaveCSImpl(key); + return (ICALL_ERRNO_INVALID_PARAMETER); + } + } + /* abort */ + ICALL_HOOK_ABORT_FUNC(); + ICall_leaveCSImpl(key); + return (ICALL_ERRNO_NO_RESOURCE); +} +#ifdef FREERTOS + +/** + * Allocates a memory block. + * @param size size of the block in bytes. + * @return address of the allocated memory block or NULL + * if allocation fails. + */ + +void * ICall_heapMalloc(uint32_t size) +{ + void * ret = NULL; + ret = malloc(size); + return ret; +} + +/** + * Frees an allocated memory block. + * @param msg pointer to a memory block to free. + */ +void ICall_heapFree(void * msg) +{ + free(msg); +} + +/** + * Allocates a memory block, but check if enough memory will be left after the allocation. + * @param size size of the block in bytes. + * @return address of the allocated memory block or NULL + * if allocation fails. + */ + +void * ICall_heapMallocLimited(uint_least16_t size) +{ + return malloc(size); +} + +/** + * Get Statistic on Heap. + * @param stats pointer to a heapStats_t structure. + */ + +/* Statistics currently are not supported via ICall apis. + * Please consider to use bget statistics (or any of your internal heap statistics) */ +void ICall_heapGetStats(ICall_heapStats_t * pStats) {} + +#endif // FREERTOS +/** + * Allocates a memory block. + * @param size size of the block in bytes. + * @return address of the allocated memory block or NULL + * if allocation fails. + */ +void * ICall_malloc(uint_least16_t size) +{ + return (ICall_heapMalloc(size)); +} + +/** + * Frees an allocated memory block. + * @param msg pointer to a memory block to free. + */ +void ICall_free(void * msg) +{ + ICall_heapFree(msg); +} + +/** + * Allocates a memory block, but check if enough memory will be left after the allocation. + * @param size size of the block in bytes. + * @return address of the allocated memory block or NULL + * if allocation fails. + */ + +void * ICall_mallocLimited(uint_least16_t size) +{ + return (ICall_heapMallocLimited(size)); +} + +/** + * Get Statistic on Heap. + * @param stats pointer to a heapStats_t structure. + */ +void ICall_getHeapStats(ICall_heapStats_t * pStats) +{ + ICall_heapGetStats(pStats); +} + +#ifdef HEAPMGR_METRICS +/** + * @brief obtain heap usage metrics + * @param pBlkMax pointer to a variable to store max cnt of all blocks ever seen at once + * @param pBlkCnt pointer to a variable to store current cnt of all blocks + * @param pBlkFree pointer to a variable to store current cnt of free blocks + * @param pMemAlo pointer to a variable to store current total memory allocated + * @param pMemMax pointer to a variable to store max total memory ever allocated at once + * @param pMemUB pointer to a variable to store the upper bound of memory usage + */ +void ICall_getHeapMgrGetMetrics(uint32_t * pBlkMax, uint32_t * pBlkCnt, uint32_t * pBlkFree, uint32_t * pMemAlo, uint32_t * pMemMax, + uint32_t * pMemUB) +{ + ICall_heapMgrGetMetrics(pBlkMax, pBlkCnt, pBlkFree, pMemAlo, pMemMax, pMemUB); +} + +#endif +/** + * Sends a message to an entity. + * @param src entity id of the sender + * @param dest entity id of the destination of the message. + * @param format message format. See ICall_sendServiceMsg(). + * @param msg pointer to the message body. + * @return @ref ICALL_ERRNO_SUCCESS when successful.
+ * @ref ICALL_ERRNO_INVALID_PARAMETER when either src + * or dest is not a valid entity id or when + * dest is an entity id of an entity that does + * not receive a message + * (e.g., ICall primitive service entity). + */ +ICall_Errno ICall_send(ICall_EntityID src, ICall_EntityID dest, ICall_MSGFormat format, void * msg) +{ + ICall_CSState key; + ICall_MsgHdr * hdr = (ICall_MsgHdr *) msg - 1; + + if (dest >= ICALL_MAX_NUM_ENTITIES || src >= ICALL_MAX_NUM_ENTITIES) + { + return (ICALL_ERRNO_INVALID_PARAMETER); + } + key = ICall_enterCSImpl(); + if (!ICall_entities[dest].task) + { + ICall_leaveCSImpl(key); + return (ICALL_ERRNO_INVALID_PARAMETER); + } + + ICall_leaveCSImpl(key); + /* Note that once the entry is valid, + * the value does not change and hence it is OK + * to leave the critical section. + */ + + hdr->srcentity = src; + hdr->dstentity = dest; + hdr->format = format; + + ICall_msgEnqueue(&ICall_entities[dest].task->queue, msg); + /* 0x80000000 is an internal event number */ + uint32_t msg_ptr = 0x80000000; +#ifdef FREERTOS + uint8_t status; + + if (HwiP_inISR()) + { + status = xQueueSendFromISR(ICall_entities[dest].task->syncHandle, (char *) &msg_ptr, NULL); + } + else + { + status = xQueueSend(ICall_entities[dest].task->syncHandle, (char *) &msg_ptr, 0); + } + + if (status != pdPASS) + { + return status; + } +#endif + return (ICALL_ERRNO_SUCCESS); +} + +/** + * Retrieves a message, queued to receive queue of the calling thread. + * + * @param src pointer to a variable to store the sender entity id + * of the received message. + * @param dest pointer to a variable to store the destination entity id + * of the received message. + * @param msg pointer to a pointer variable to store the starting + * address of a received message body. + * @return @ref ICALL_ERRNO_SUCCESS when a message was successfully + * retrieved.
+ * @ref ICALL_ERRNO_NOMSG when no message was queued to + * the receive queue at the moment.
+ * @ref ICALL_ERRNO_UNKNOWN_THREAD when the calling thread + * does not have a received queue associated with it. + * This happens when neither ICall_enrollService() nor + * ICall_registerApp() was ever called from the calling + * thread. + */ +ICall_Errno ICall_fetchMsg(ICall_EntityID * src, ICall_EntityID * dest, void ** msg) +{ + void * msgTemp; + TaskHandle_t taskhandle = Task_self(); + ICall_TaskEntry * taskentry = ICall_searchTask(taskhandle); + ICall_MsgHdr * hdr; + + if (!taskentry) + { + return (ICALL_ERRNO_UNKNOWN_THREAD); + } + /* Successful */ + msgTemp = ICall_msgDequeue(&taskentry->queue); + + if (msgTemp == NULL) + { + return (ICALL_ERRNO_NOMSG); + } + hdr = (ICall_MsgHdr *) msgTemp - 1; + *src = hdr->srcentity; + *dest = hdr->dstentity; + *msg = msgTemp; + return (ICALL_ERRNO_SUCCESS); +} + +/** + * Transforms and entityId into a serviceId. + * Note that this function is useful in case an application + * waits for messages from both a server and another application, + * in which case, the application can only use ICall_fetchMsg(), + * not ICall_fetchServiceMsg() because the latter will return + * @ref ICALL_ERRNO_CORRUPT_MSG when a message sent by the other + * application is about to be fetched.
+ * This function, then, is useful to retrieve service id + * matching the source entity id in case the source entity + * id is not that of the other application. + * + * @param entityId entity id + * @param servId pointer to a variable to store + * the resultant service id + * @return @ref ICALL_ERRNO_SUCCESS if the transformation was successful.
+ * @ref ICALL_ERRNO_INVALID_SERVICE if no matching service + * is found for the entity id. + */ +ICall_Errno ICall_entityId2ServiceId(ICall_EntityID entityId, ICall_ServiceEnum * servId) +{ + return ICall_primEntityId2ServiceId(entityId, servId); +} + +/** + * Aborts. + * + * This is preferred over C runtime abort() function, + * in an external image since the C runtime abort() is only + * guaranteed in a root image which contains the C runtime + * entry function that is executed upon startup. + */ +ICall_Errno ICall_abort(void) +{ +#ifdef HALNODEBUG +#elif defined(EXT_HAL_ASSERT) + HAL_ASSERT(HAL_ASSERT_CAUSE_ICALL_ABORT); +#else + { + volatile uint8_t j = 1; + while (j) + ; + } +#endif /* EXT_HAL_ASSERT */ + ICALL_HOOK_ABORT_FUNC(); + return (ICALL_ERRNO_SUCCESS); +} + +/** + * Enables interrupt. + * @param intnum interrupt number + * @return @ref ICALL_ERRNO_SUCCESS. + */ +ICall_Errno ICall_enableint(int intnum) +{ + Hwi_enableinterrupt(intnum); + return (ICALL_ERRNO_SUCCESS); +} + +/** + * Disables interrupt + * @param intnum interrupt number + * @return @ref ICALL_ERRNO_SUCCESS + */ +ICall_Errno ICall_disableint(int intnum) +{ + Hwi_disableinterrupt(intnum); + return (ICALL_ERRNO_SUCCESS); +} + +/** + * Gets the current tick counter value. + * @return current tick counter value + */ +uint_fast32_t ICall_getTicks(void) +{ + return (ClockP_getSystemTicks()); +} + +/** + * Gets the tick period. + * @return tick period in microseconds. + */ +uint_fast32_t ICall_getTickPeriod(void) +{ + return CLOCK_TICKS_PERIOD; +} + +/** + * Gets the maximum timeout period supported by + * ICall_setTimerMSecs() function. + * + * @return maximum timeout period in milliseconds + */ +uint_fast32_t ICall_getMaxMSecs(void) +{ + + uint_fast64_t tmp = ((uint_fast64_t) 0x7ffffffful) * (ICall_getTickPeriod()); + tmp /= 1000; + if (tmp >= 0x80000000ul) + { + tmp = 0x7ffffffful; + } + return ((uint_least32_t) tmp); +} + +/** + * Set up or restart a timer. + * Note that the timer setup initially by this function may be restarted + * using ICall_setTimer() function as well. + * + * @param msecs timeout period in milliseconds after which callback function + * shall be called. + * @param cback callback function pointer + * @param arg argument to pass to the callback function + * @param id pointer to the timer ID. + * If a new timer must be set up, the value of the timer ID + * must be set to @ref ICALL_INVALID_TIMER_ID when making this + * call and when the function returns successfully, the variable + * will be assigned a new timer ID value. + * The value other than @ref ICALL_INVALID_TIMER_ID shall be + * regarded as a request to restart the earlier set timer. + * @return @ref ICALL_ERRNO_SUCCESS when successful;
+ * @ref ICALL_ERRNO_INVALID_PARAMETER when msecs is greater than + * maximum value supported;
+ * @ref ICALL_ERRNO_NO_RESOURCE when ran out of resource. + * Check ICall heap size and OS heap size if this happens. + * + * @see ICall_getMaxMSecs() + */ +ICall_Errno ICall_setTimerMSecs(uint_fast32_t msecs, ICall_TimerCback cback, void * arg, ICall_TimerID * id) +{ + uint32_t ticks; + uint32_t timeout; + /* Convert to tick time */ + ICall_Errno errno = ICall_msecs2Ticks(msecs, &ticks); + + if (errno != ICALL_ERRNO_SUCCESS) + { + return (errno); + } + timeout = ticks; + ICall_setTimer(timeout, cback, arg, id); + + return (errno); +} + +/** + * Set up or restart a timer. + * Note that the timer setup initially by this function may be restarted + * using ICall_setTimerMSecs() function as well. + * + * @param ticks timeout period in ticks after which the callback function + * shall be called. + * @param cback callback function pointer + * @param arg argument to pass to the callback function + * @param id pointer to the timer ID. + * If a new timer must be set up, the value of the timer ID + * must be set to @ref ICALL_INVALID_TIMER_ID when making this + * call and when the function returns successfully, the variable + * will be assigned a new timer ID value. + * The value other than @ref ICALL_INVALID_TIMER_ID shall be + * regarded as a request to restart the earlier set timer. + * @return @ref ICALL_ERRNO_SUCCESS when successful;
+ * @ref ICALL_ERRNO_NO_RESOURCE when ran out of resource. + * Check ICall heap size and OS heap size if this happens. + * + * @see ICall_getTickPeriod() + */ + +ICall_Errno ICall_setTimer(uint32_t ticks, ICall_TimerCback cback, void * arg, ICall_TimerID * id) +{ + + ICall_ScheduleEntry * entry; + + if (*id == ICALL_INVALID_TIMER_ID) + { + ClockP_Params params; + + /* Create a new timer */ + entry = ICall_heapMalloc(sizeof(ICall_ScheduleEntry)); + if (entry == NULL) + { + /* allocation failed */ + return (ICALL_ERRNO_NO_RESOURCE); + } + ClockP_Params_init(¶ms); + params.startFlag = FALSE; + params.period = 0; + params.arg = (uintptr_t) entry; + + entry->clockP = ClockP_create(ICall_clockFunc, ticks, ¶ms); + if (!entry->clockP) + { + /* abort */ + ICall_abort(); + ICall_heapFree(entry); + return (ICALL_ERRNO_NO_RESOURCE); + } + entry->cback = cback; + entry->arg = arg; + *id = (ICall_TimerID) entry; + } + else + { + ICall_CSState key; + + entry = (ICall_ScheduleEntry *) *id; + + /* Critical section is entered to disable interrupts that might cause call + * to callback due to race condition */ + key = ICall_enterCriticalSection(); + ClockP_stop(entry->clockP); + entry->arg = arg; + ICall_leaveCriticalSection(key); + } + ClockP_setTimeout(entry->clockP, ticks); + + ClockP_start(entry->clockP); + + return (ICALL_ERRNO_SUCCESS); +} + +/** + * Stops a timer. + * + * @param id timer ID. + */ +void ICall_stopTimer(ICall_TimerID id) +{ + ICall_ScheduleEntry * entry = (ICall_ScheduleEntry *) id; + + if (id == ICALL_INVALID_TIMER_ID) + { + return; + } + + ClockP_stop(entry->clockP); +} + +/** + * Increments or decrements power activity counter. + * + * When power activity counter is greater than zero, + * the device shall stay in the active power state. + * The caller has to make sure that it decrements the counter + * as many times as it has incremented the counter + * when there is no activity that requires the active power state. + * It is recommended that each client increments the counter by just one, + * but it is not mandated to be so. + * + * @param incFlag TRUE to indicate incrementing the counter.
+ * FALSE to indicate decrementing the counter. + * @return @ref TRUE if power is required.
+ * @ref FALSE if power is not required.
+ */ +bool ICall_pwrUpdActivityCounter(bool incFlag) +{ + ICall_PwrUpdActivityCounterArgs args; + args.incFlag = incFlag; + ICallPlatform_pwrUpdActivityCounter(&args); + return (args.pwrRequired); +} + +/** + * Configures power constraint/dependency set/release actions upon + * activity counter change. + * + * When activity counter value drops to zero, all constraints and + * dependencies configured by this function shall be released.
+ * When activity counter value increments to one, all constraints + * and dependencies configured by this function shall be set. + * + * @param bitmap a bitmap of constraint or dependency flags.
+ * The flag definition is specific to each platform. + * For instance, see ICallCC26xxDefs.h. + * + * @return @ref ICALL_ERRNO_SUCCESS when successful
+ * @ref ICALL_ERRNO_INVALID_PARAMETER when an invalid + * flag in the bitmap is detected.
+ */ +ICall_Errno ICall_pwrConfigACAction(ICall_PwrBitmap_t bitmap) +{ + ICall_PwrBitmapArgs args; + args.bitmap = bitmap; + return (ICallPlatform_pwrConfigACAction(&args)); +} + +/** + * Sets power constraints and dependencies. + * + * @param bitmap a bitmap of constraint or dependency flags.
+ * The flag definition is specific to each platform. + * For instance, see ICallCC26xxDefs.h. + * + * @return @ref ICALL_ERRNO_SUCCESS when successful
+ * @ref ICALL_ERRNO_INVALID_PARAMETER when an invalid + * flag in the bitmap is detected.
+ */ +ICall_Errno ICall_pwrRequire(ICall_PwrBitmap_t bitmap) +{ + ICall_PwrBitmapArgs args; + args.bitmap = bitmap; + return (ICallPlatform_pwrRequire(&args)); +} + +/** + * Releases power constraints and dependencies. + * + * @param bitmap a bitmap of constraint or dependency flags.
+ * The flag definition is specific to each platform. + * For instance, see ICallCC26xxDefs.h. + * + * @return @ref ICALL_ERRNO_SUCCESS when successful
+ * @ref ICALL_ERRNO_INVALID_PARAMETER when an invalid + * flag in the bitmap is detected.
+ */ +ICall_Errno ICall_pwrDispense(ICall_PwrBitmap_t bitmap) +{ + ICall_PwrBitmapArgs args; + args.bitmap = bitmap; + return (ICallPlatform_pwrDispense(&args)); +} + +/** + * Checks whether HF XOSC is stable. + * This function must be called after HF XOSC is turned on + * (through power dependency). + * + * @return TRUE when HF XOSC is stable.
+ * FALSE when HF XOSC is not stable.
+ */ +bool ICall_pwrIsStableXOSCHF(void) +{ + ICall_GetBoolArgs args; + (void) ICallPlatform_pwrIsStableXOSCHF(&args); + return (args.value); +} + +/** + * Switch clock source to HF XOSC. + * This function must be called after HF XOSC is stable. + * + * @return @ref ICALL_ERRNO_SUCCESS + */ +ICall_Errno ICall_pwrSwitchXOSCHF(void) +{ + ICall_FuncArgsHdr args; + return (ICallPlatform_pwrSwitchXOSCHF(&args)); +} + +/** + * Gets the estimated crystal oscillator startup time. + * + * @return estimated crystal oscillator startup time + */ +uint32_t ICall_pwrGetXOSCStartupTime(uint_fast32_t timeUntilWakeupInMs) +{ + ICall_PwrGetXOSCStartupTimeArgs args; + args.timeUntilWakeupInMs = timeUntilWakeupInMs; + (void) ICallPlatform_pwrGetXOSCStartupTime(&args); + return (args.value); +} + +/** + * Registers a power state transition notify function. + * + * The registered notify function shall be called when the power state + * changes. + * + * @param fn notify function pointer + * @param obj pointer to data object to be passed to notify function.
+ * This pointer must not be NULL and can point to an aggregate type + * containing the @ref ICall_PwrNotifyData. + * The object must not be released. + * @return @ref ICALL_ERRNO_SUCCESS when successful
+ * @ref ICALL_ERRNO_NO_RESOURCE when registration failed
+ */ +ICall_Errno ICall_pwrRegisterNotify(ICall_PwrNotifyFn fn, ICall_PwrNotifyData * obj) +{ + ICall_PwrRegisterNotifyArgs args; + args.hdr.service = ICALL_SERVICE_CLASS_PRIMITIVE; + args.hdr.func = ICALL_PRIMITIVE_FUNC_PWR_REGISTER_NOTIFY; + args.fn = fn; + args.obj = obj; + return (ICallPlatform_pwrRegisterNotify(&args)); +} + +/** + * Retrieves power transition state. + * + * @return Implementation specific transition state when successful
+ * Zero when the function is not implemented.
+ */ +uint_fast8_t ICall_pwrGetTransitionState(void) +{ + ICall_PwrGetTransitionStateArgs args; + ICall_Errno errno; + + errno = ICallPlatform_pwrGetTransitionState(&args); + + if (errno == ICALL_ERRNO_SUCCESS) + { + return (args.state); + } + return (0); +} + +/** + * Creates a new RTOS task. + * + * @param entryfn task entry function. + * @param priority task priority as understood by the underlying RTOS + * @param stacksize stack size as understood by the underlying RTOS + * @param arg argument to pass to the task entry function + * + * @return @ref ICALL_ERRNO_SUCCESS when successful
+ * @ref ICALL_ERRNO_NO_RESOURCE when creation failed
+ */ + +#ifdef ICALL_RTOS_SEMAPHORE_API +/** + * Creates a semaphore. + * + * @param mode Semaphore mode
+ * @ref ICALL_SEMAPHORE_MODE_COUNTING, or
+ * @ref ICALL_SEMAPHORE_MODE_BINARY + * @param initcount initial count value + * @return created semaphore when successful
+ * NULL when creation failed
+ */ +ICall_Semaphore ICall_createSemaphore(uint_fast8_t mode, int initcount) +{ + /* Semaphore_Params is a huge structure. + * To reduce stack usage, heap is used instead. + * This implies that ICall_createSemaphore() must be called before heap + * space may be exhausted. + */ + ICall_Semaphore sem; + Semaphore_Params * semParams = (Semaphore_Params *) ICall_heapMalloc(sizeof(Semaphore_Params)); + + if (semParams == NULL) + { + return (NULL); + } + + Semaphore_Params_init(semParams); + if (mode == ICALL_SEMAPHORE_MODE_BINARY) + { + semParams->mode = Semaphore_Mode_BINARY; + } + + sem = Semaphore_create(args->initcount, semParams, NULL); + ICall_heapFree(semParams); + + return (sem); +} +#endif + +#ifdef ICALL_RTOS_SEMAPHORE_API +/** + * Post on a semaphore + * + * @param sem semaphore. + * + * @return @ref ICALL_ERRNO_SUCCESS when the operation was successful + */ +ICall_Errno ICall_postSemaphore(ICall_Semaphore sem) +{ + Semaphore_post(sem); + return (ICALL_ERRNO_SUCCESS); +} +#endif /* ICALL_RTOS_SEMAPHORE_API */ + +#ifdef ICALL_RTOS_EVENTS_API +/** + * Creates a event. + * + * @return created event when successful
+ * NULL when creation failed
+ */ +ICall_Event ICall_createEvent(void) +{ + ICall_Event event = Event_create(NULL, NULL); + return (event); + + ICall_CreateEventArgs args; + ICall_Errno errno; + + args.hdr.service = ICALL_SERVICE_CLASS_PRIMITIVE; + args.hdr.func = ICALL_PRIMITIVE_FUNC_CREATE_EVENT; + errno = ICall_dispatcher(&args.hdr); + if (errno == ICALL_ERRNO_SUCCESS) + { + return (args.event); + } + return (NULL); +} + +/** + * Post on an event + * + * @param event event. + * + * @return @ref ICALL_ERRNO_SUCCESS when the operation was successful + */ +ICall_Errno ICall_postEvent(ICall_Event event, uint32_t events) +{ + Event_post(event, events); + return (ICALL_ERRNO_SUCCESS); +} +/** + * Waits on a event for ICALL_MSG_EVENT_ID + * + * @param event event. + * @param milliseconds timeout in milliseconds + * or @ref ICALL_TIMEOUT_FOREVER to wait forever + * + * @return @ref ICALL_ERRNO_SUCCESS when the operation was successful + * and event was received.
+ * @ref ICALL_ERRNO_TIMEOUT when designated timeout period + * has passed since the call of the function without + * the event being signaled. + */ +ICall_Errno ICall_waitEvent(ICall_Event event, uint_fast32_t milliseconds) +{ + uint32_t timeout; + + if (milliseconds == 0) + { + timeout = BIOS_NO_WAIT; + } + else if (milliseconds == ICALL_TIMEOUT_FOREVER) + { + timeout = BIOS_WAIT_FOREVER; + } + else + { + ICall_Errno errno = ICall_msecs2Ticks(milliseconds, &timeout); + if (errno != ICALL_ERRNO_SUCCESS) + { + return (errno); + } + } + + if (Event_pend(event, 0, ICALL_MSG_EVENT_ID, timeout)) + { + return (ICALL_ERRNO_SUCCESS); + } + return (ICALL_ERRNO_TIMEOUT); +} +#endif /* ICALL_RTOS_EVENTS_API */ + +#ifdef ICALL_RTOS_SEMAPHORE_API +/** + * Waits on a semaphore + * + * @param sem semaphore. + * @param milliseconds timeout in milliseconds + * or @ref ICALL_TIMEOUT_FOREVER to wait forever + * + * @return @ref ICALL_ERRNO_SUCCESS when the operation was successful + * and semaphore was acquired.
+ * @ref ICALL_ERRNO_TIMEOUT when designated timeout period + * has passed since the call of the function without + * the semaphore being signaled. + */ +ICall_Errno ICall_waitSemaphore(ICall_Semaphore sem, uint_fast32_t milliseconds) +{ + uint32_t timeout; + + if (milliseconds == 0) + { + timeout = BIOS_NO_WAIT; + } + else if (milliseconds == ICALL_TIMEOUT_FOREVER) + { + timeout = BIOS_WAIT_FOREVER; + } + else + { + ICall_Errno errno = ICall_msecs2Ticks(milliseconds, &timeout); + if (errno != ICALL_ERRNO_SUCCESS) + { + return (errno); + } + } + if (Semaphore_pend(sem, timeout)) + { + return (ICALL_ERRNO_SUCCESS); + } + return (ICALL_ERRNO_TIMEOUT); +} +#endif /* ICALL_RTOS_SEMAPHORE_API */ + +#if 0 +/* Util function that take time in ticks and convert it into ms - relate to system clock (returns system clock + converted ms) */ +static void AbsoluteTimeInMilliPlusTimer(uint_least32_t timeout,struct timespec *tsTimer) +{ + + clock_gettime(CLOCK_REALTIME, tsTimer); + + tsTimer->tv_sec += (timeout / 1000); + tsTimer->tv_nsec += (timeout % 1000) * 1000000; +} +#endif + +/** + * Waits for and retrieves a message received at the message queue + * associated with the calling thread, which matches a certain condition. + * + * @param milliseconds timeout period in milliseconds. + * @param matchFn pointer to a function that would return TRUE when + * the message matches its condition. + * @param src pointer to a variable to store the service id + * of the registered server which sent the retrieved + * message, or NULL if not interested in storing service id. + * @param dest pointer to a variable to store the entity id + * of the destination of the message, + * of NULL if not interested in storing the destination entity id. + * @param msg pointer to a pointer variable to store the + * starting address of the message body being + * retrieved. The pointer must not be NULL. + * @return @ref ICALL_ERRNO_SUCCESS when the operation was successful + * and a message was retrieved.
+ * @ref ICALL_ERRNO_TIMEOUT when designated timeout period + * has passed since the call of the function without + * the semaphore being signaled. + * @ref ICALL_ERRNO_UNKNOWN_THREAD when this function is + * called from a thread which has not registered + * an entity, either through ICall_enrollService() + * or through ICall_registerApp(). + */ +ICall_Errno ICall_waitMatch(uint_least32_t milliseconds, ICall_MsgMatchFn matchFn, ICall_ServiceEnum * src, ICall_EntityID * dest, + void ** msg) +{ + TaskHandle_t taskhandle = Task_self(); + ICall_TaskEntry * taskentry = ICall_searchTask(taskhandle); + ICall_MsgQueue prependQueue = NULL; +#ifndef ICALL_EVENTS + uint_fast16_t consumedCount = 0; +#endif + uint32_t timeout; + uint_fast32_t timeoutStamp; + ICall_Errno errno; + + if (!taskentry) + { + return (ICALL_ERRNO_UNKNOWN_THREAD); + } + /* Successful */ + if (milliseconds == 0) + { + timeout = BIOS_NO_WAIT; + } + else if (milliseconds == ICALL_TIMEOUT_FOREVER) + { + timeout = BIOS_WAIT_FOREVER; + } + else + { + /* Convert milliseconds to number of ticks */ + errno = ICall_msecs2Ticks(milliseconds, &timeout); + if (errno != ICALL_ERRNO_SUCCESS) + { + return (errno); + } + } + + errno = ICALL_ERRNO_TIMEOUT; + + timeoutStamp = ICall_getTicks() + timeout; + +#ifdef ICALL_LITE + + uint32_t events; + +#ifdef FREERTOS + // TODO: Investigate ICALL Wait tick period (Last parameter) + while (xQueueReceive(taskentry->syncHandle, (char *) &events, milliseconds * 1000) == pdPASS) +#endif +#else /* !ICALL_LITE */ + while (ICALL_SYNC_HANDLE_PEND(taskentry->syncHandle, timeout)) +#endif /* ICALL_LITE */ + { + ICall_EntityID fetchSrc; + ICall_EntityID fetchDst; + ICall_ServiceEnum servId; + void * fetchMsg; + errno = ICall_fetchMsg(&fetchSrc, &fetchDst, &fetchMsg); + if (errno == ICALL_ERRNO_SUCCESS) + { + if (ICall_primEntityId2ServiceId(fetchSrc, &servId) == ICALL_ERRNO_SUCCESS) + { + if (matchFn(servId, fetchDst, fetchMsg)) + { + /* Matching message found*/ + if (src != NULL) + { + *src = servId; + } + if (dest != NULL) + { + *dest = fetchDst; + } + *msg = fetchMsg; + errno = ICALL_ERRNO_SUCCESS; + break; + } + } + /* Message was received but it wasn't expected one. + * Add to the prepend queue */ + ICall_msgEnqueue(&prependQueue, fetchMsg); +#ifdef ICALL_EVENTS + /* Event are binary semaphore, so if several messsages are posted while + * we are processing one, it's possible that some of them are 'missed' and + * not processed. Sending a event to ourself force this loop to run until + * all the messages in the queue are processed. + */ +#ifdef ICALL_LITE + /* 0x20000000 is an internal Event_ID */ + uint32_t msg_ptr = (0x20000000); // Event_Id_29; + +#ifdef FREERTOS + + uint8_t status; + if (HwiP_inISR()) + { + status = xQueueSendFromISR(taskentry->syncHandle, (char *) &msg_ptr, NULL); + } + else + { + status = xQueueSend(taskentry->syncHandle, (char *) &msg_ptr, 0); + } + + if (status != pdTRUE) + { + return status; + } +#endif + +#else /* !ICALL_LITE */ + ICALL_SYNC_HANDLE_POST(taskentry->syncHandle); +#endif /* ICALL_LITE*/ +#endif /* ICALL_EVENTS */ + } + + /* Prepare for timeout exit */ + errno = ICALL_ERRNO_TIMEOUT; + +#ifndef ICALL_EVENTS + /* Keep the decremented semaphore count */ + consumedCount++; +#endif /* ICALL_EVENTS */ + if (timeout != BIOS_WAIT_FOREVER && timeout != BIOS_NO_WAIT) + { + /* Readjust timeout */ + uint32_t newTimeout = timeoutStamp - ICall_getTicks(); + + if (newTimeout == 0 || newTimeout > timeout) + { + break; + } + timeout = newTimeout; + } + } + + /* Prepend retrieved irrelevant messages */ + ICall_msgPrepend(&taskentry->queue, prependQueue); +#ifndef ICALL_EVENTS + /* Re-increment the consumed semaphores */ + for (; consumedCount > 0; consumedCount--) + { + Semaphore_post(taskentry->syncHandle); + } +#endif /* ICALL_EVENTS */ + return (errno); +} + +/** + * Retrieves an entity ID of (arbitrary) one of the entities registered + * from the calling thread. + * + * Note that, if multiple entities were registered from the same thread, + * this function shall arbitrarily pick one of the entities. + * + * @return A valid entity ID or @ref ICALL_INVALID_ENTITY_ID + * when no entity was registered from the calling thread. + */ +ICall_EntityID ICall_getEntityId(void) +{ + ICall_EntityID id; + TaskHandle_t taskhandle = Task_self(); + ICall_CSState key; + size_t i; + key = ICall_enterCSImpl(); + for (i = 0; i < ICALL_MAX_NUM_ENTITIES; i++) + { + if (ICall_entities[i].service == ICALL_SERVICE_CLASS_INVALID_ENTRY) + { + /* Not found */ + break; + } + if (ICall_entities[i].task->task == (TaskHandle_t) taskhandle) + { + /* Found */ + id = i; + ICall_leaveCSImpl(key); + return (id); + } + } + ICall_leaveCSImpl(key); + return ICALL_INVALID_ENTITY_ID; +} + +/** + * Checks whether the calling thread provides the designated service. + * + * @param service Service enumeration value for the service. + * + * @return Non-zero if the current thread provides the designated service. + * Zero, otherwise. + */ +uint_fast8_t ICall_threadServes(ICall_ServiceEnum service) +{ + uint_fast8_t res = 0; + TaskHandle_t taskhandle; + ICall_CSState key; + size_t i; + taskhandle = Task_self(); + + key = ICall_enterCSImpl(); + for (i = 0; i < ICALL_MAX_NUM_ENTITIES; i++) + { + if (ICall_entities[i].service == ICALL_SERVICE_CLASS_INVALID_ENTRY) + { + /* Not found */ + break; + } + else if (ICall_entities[i].service == service) + { + res = (uint_fast8_t) (ICall_entities[i].task->task == taskhandle); + } + } + ICall_leaveCSImpl(key); + return (res); +} + +/** + * Retrieves an internal ID understood only by a service entity, + * corresponding to an ICall entity ID. + * + * This function is used when a message body includes a field indicating a + * software entity and the destination of the message has its own internal + * message routing mechanism with its own entity enumeration system. + * + * @param service Service enumeration value for the service. + * Currently @ref ICALL_SERVICE_CLASS_BLE_MSG is supported. + * @param entity ICall entity ID. + * + * @return Stack specific 8 bit ID or 0xFF when failed. + */ +uint_fast8_t ICall_getLocalMsgEntityId(ICall_ServiceEnum service, ICall_EntityID entity) +{ + ICall_GetLocalMsgEntityIdArgs args; + ICall_Errno errno; + args.hdr.service = service; + args.hdr.func = ICALL_MSG_FUNC_GET_LOCAL_MSG_ENTITY_ID; + args.entity = entity; + errno = ICall_dispatcher(&args.hdr); + if (errno == ICALL_ERRNO_SUCCESS) + { + return (args.localId); + } + return (0xFF); +} + +#endif /* ICALL_JT */ + +#ifdef ICALL_LITE +/******************************************************************************* + * @fn matchLiteCS + */ +static bool matchLiteCS(ICall_ServiceEnum src, ICall_EntityID dest, const void * msg) +{ + (void) src; + (void) dest; + ICall_LiteCmdStatus * pMsg = (ICall_LiteCmdStatus *) msg; + return (pMsg->cmdId == ICALL_LITE_DIRECT_API_DONE_CMD_ID); +} +/******************************************************************************* + * @fn icall_directAPI + * see headers for details. + */ +uint32_t icall_directAPI(uint8_t service, icall_lite_id_t id, ...) +{ + va_list argp; + uint32_t res; + icallLiteMsg_t liteMsg; + + // The following will push all parameter in the runtime stack. + // This need to be call before any other local declaration of variable.... + va_start(argp, id); + + // Todo - add string for every icall API function, instead of printing function address + BLE_LOG_INT_INT(0, BLE_LOG_MODULE_APP, "APP : icall_directAPI to BLE func=0x%x, status=%d\n", id, 0); + // Create the message that will be send to the requested service.. + liteMsg.hdr.len = sizeof(icallLiteMsg_t); + liteMsg.hdr.next = NULL; + liteMsg.hdr.dest_id = ICALL_UNDEF_DEST_ID; + liteMsg.msg.directAPI = id; + liteMsg.msg.pointerStack = (uint32_t *) (*((uint32_t *) (&argp))); + ICall_sendServiceMsg(ICall_getEntityId(), service, ICALL_MSG_FORMAT_DIRECT_API_ID, &(liteMsg.msg)); + + // Since stack needs to always have a higher priority than the thread calling + // the API, when we reach this point the API has been executed by the stack. + // This implies the following: + // - API are not called in critical section or in section where task + // switching is disabled + // It is possible that the stack is blocking on this API, in this case a + // sync object needs to be used in order for this call to resume only when + // the API has been process in full. + { + ICall_Errno errno; + void * pCmdStatus = NULL; + + errno = ICall_waitMatch(ICALL_TIMEOUT_PREDEFINE, matchLiteCS, NULL, NULL, (void **) &pCmdStatus); + if (errno == ICALL_ERRNO_TIMEOUT) + { +#ifdef HALNODEBUG +#elif defined(EXT_HAL_ASSERT) + HAL_ASSERT(HAL_ASSERT_CAUSE_ICALL_TIMEOUT); +#else /* !EXT_HAL_ASSERT */ + ICall_abort(); +#endif /* EXT_HAL_ASSERT */ + } + else if (errno == ICALL_ERRNO_SUCCESS) + { + if (pCmdStatus) + { + ICall_freeMsg(pCmdStatus); + } + } + else + { +#ifdef HALNODEBUG +#else /* ! HALNODEBUG */ + ICall_abort(); +#endif /* HALNODEBUG */ + } + } + + // The return parameter is set in the runtime stack, at the location of the + // first parameter. + res = liteMsg.msg.pointerStack[0]; + + va_end(argp); + + return (res); +} + +/******************************************************************************* + * @fn ICall_sendServiceComplete + * see headers for details. + */ +ICall_Errno ICall_sendServiceComplete(ICall_EntityID src, ICall_EntityID dest, ICall_MSGFormat format, void * msg) +{ + ICall_CSState key; + ICall_MsgHdr * hdr = (ICall_MsgHdr *) msg - 1; + + if (dest >= ICALL_MAX_NUM_ENTITIES || src >= ICALL_MAX_NUM_ENTITIES) + { + return (ICALL_ERRNO_INVALID_PARAMETER); + } + key = ICall_enterCSImpl(); + if (!ICall_entities[dest].task) + { + ICall_leaveCSImpl(key); + return (ICALL_ERRNO_INVALID_PARAMETER); + } + + ICall_leaveCSImpl(key); + /* Note that once the entry is valid, + * the value does not change and hence it is OK + * to leave the critical section. + */ + + hdr->srcentity = src; + hdr->dstentity = dest; + hdr->format = format; + ICall_msgEnqueue(&ICall_entities[dest].task->queue, msg); + + /* 0x20000000 is an internal Event_ID */ + uint32_t msg_ptr = (0x20000000); // Event_Id_29; +#ifdef FREERTOS + uint8_t status; + if (HwiP_inISR()) + { + status = xQueueSendFromISR(ICall_entities[dest].task->syncHandle, (char *) &msg_ptr, NULL); + } + else + { + status = xQueueSend(ICall_entities[dest].task->syncHandle, (char *) &msg_ptr, 0); + } + + if (status != pdTRUE) + { + return status; + } +#endif + return (ICALL_ERRNO_SUCCESS); +} +#endif /* ICALL_LITE*/ diff --git a/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni b/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni index b3aae392cfb39d..2bae18ab2a5db7 100644 --- a/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni +++ b/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni @@ -360,6 +360,8 @@ template("ti_simplelink_sdk") { libs = [] defines = [ + "BLE_MANAGER_TASK_PRIORITY=5", + "BLE_STACK_TASK_PRIORITY=6", "INCLUDE_BGET_STATS", "USE_DMM", "NVOCMP_FREERTOS_MUTEX=1", @@ -523,10 +525,10 @@ template("ti_simplelink_sdk") { sources = [ "${chip_root}/src/platform/cc13xx_26xx/TI_heap_wrapper.c", "${chip_root}/src/platform/cc13xx_26xx/chipOBleProfile.c", + "${chip_root}/src/platform/cc13xx_26xx/icall_FreeRTOS.c", "${ti_simplelink_sdk_root}/source/ti/ble5stack/common/cc26xx/freertos/bget.c", "${ti_simplelink_sdk_root}/source/ti/ble5stack/common/cc26xx/rcosc/rcosc_calibration.c", "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/ble_remote_display/stack/osal_icall_ble.c", - "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/freertos/icall_FreeRTOS.c", "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/freertos/util.c", "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/thread/source/activity/dmm_thread_activity.c", "${ti_simplelink_sdk_root}/source/ti/dmm/dmm_priority_ble_thread.c", From d055e38c15e8bd0083e7b568641608993a2e8e3b Mon Sep 17 00:00:00 2001 From: cdj <45139296+DejinChen@users.noreply.github.com> Date: Fri, 16 Aug 2024 22:36:09 +0800 Subject: [PATCH 44/59] Use RootEndponId for reading SupportsConcurrentConnection in CNET_1_4 (#34972) --- src/python_testing/TC_CNET_1_4.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/python_testing/TC_CNET_1_4.py b/src/python_testing/TC_CNET_1_4.py index d7560c4fd03942..58f885c9d512aa 100644 --- a/src/python_testing/TC_CNET_1_4.py +++ b/src/python_testing/TC_CNET_1_4.py @@ -98,7 +98,8 @@ async def test_TC_CNET_1_4(self): self.step(6) concurrent_connection = await self.read_single_attribute_check_success(cluster=Clusters.GeneralCommissioning, - attribute=Clusters.GeneralCommissioning.Attributes.SupportsConcurrentConnection) + attribute=Clusters.GeneralCommissioning.Attributes.SupportsConcurrentConnection, + endpoint=kRootEndpointId) asserts.assert_true(concurrent_connection, "The device does not support concurrent connection commissioning") From 7b32747d52c73ef5ab5ceae8f6bc76eabe416edf Mon Sep 17 00:00:00 2001 From: Alex Tsitsiura Date: Fri, 16 Aug 2024 18:02:22 +0300 Subject: [PATCH 45/59] [Telink] Disable Wi-Fi LPM during the OTA (#35006) * [Telink] Add OTAImageProcessorImplWiFi.h * [Telink] remove IPv4 temporarry debug configs --- config/telink/chip-module/Kconfig.defaults | 3 - src/platform/telink/BUILD.gn | 1 + .../telink/OTAImageProcessorImplWiFi.h | 63 +++++++++++++++++++ 3 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 src/platform/telink/OTAImageProcessorImplWiFi.h diff --git a/config/telink/chip-module/Kconfig.defaults b/config/telink/chip-module/Kconfig.defaults index 9c27fe1059451f..45c8894722eeea 100644 --- a/config/telink/chip-module/Kconfig.defaults +++ b/config/telink/chip-module/Kconfig.defaults @@ -304,9 +304,6 @@ config CHIP_WIFI select NET_IPV6_ND # enable Neighbor Discovery to handle Router Advertisements select NET_IPV6_NBR_CACHE select NET_STATISTICS_USER_API -# select NET_IPV4 # TODO: remove IPv4 when IPv6 will be ready (see CHIP_IPV4) -# select NET_CONFIG_NEED_IPV4 -# select NET_DHCPV4 if CHIP_WIFI diff --git a/src/platform/telink/BUILD.gn b/src/platform/telink/BUILD.gn index 4857c048afc178..93f6aaef5ed94e 100644 --- a/src/platform/telink/BUILD.gn +++ b/src/platform/telink/BUILD.gn @@ -93,6 +93,7 @@ static_library("telink") { if (chip_enable_wifi) { sources += [ + "OTAImageProcessorImplWiFi.h", "wifi/ConnectivityManagerImplWiFi.cpp", "wifi/ConnectivityManagerImplWiFi.h", "wifi/TelinkWiFiDriver.cpp", diff --git a/src/platform/telink/OTAImageProcessorImplWiFi.h b/src/platform/telink/OTAImageProcessorImplWiFi.h new file mode 100644 index 00000000000000..29f1db87f67a54 --- /dev/null +++ b/src/platform/telink/OTAImageProcessorImplWiFi.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2024 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "OTAImageProcessorImpl.h" +#include "wifi/WiFiManager.h" + +namespace chip { + +namespace DeviceLayer { + +class OTAImageProcessorImplWiFi : public OTAImageProcessorImpl +{ +public: + explicit OTAImageProcessorImplWiFi(ExternalFlashManager * flashHandler = nullptr) : OTAImageProcessorImpl(flashHandler) {} + + CHIP_ERROR PrepareDownload() override + { + CHIP_ERROR err = WiFiManager::Instance().SetLowPowerMode(false); + if (err == CHIP_NO_ERROR) + { + return OTAImageProcessorImpl::PrepareDownload(); + } + return err; + }; + + CHIP_ERROR Abort() override + { + CHIP_ERROR err = OTAImageProcessorImpl::Abort(); + if (err == CHIP_NO_ERROR) + { + return WiFiManager::Instance().SetLowPowerMode(true); + } + return err; + }; + + CHIP_ERROR Apply() override + { + CHIP_ERROR err = OTAImageProcessorImpl::Apply(); + if (err == CHIP_NO_ERROR) + { + return WiFiManager::Instance().SetLowPowerMode(true); + } + return err; + }; +}; + +} // namespace DeviceLayer +} // namespace chip From 2b0b1d8de1fd701115d75d60a7779dfd0fae1bfc Mon Sep 17 00:00:00 2001 From: Alex Tsitsiura Date: Fri, 16 Aug 2024 18:02:57 +0300 Subject: [PATCH 46/59] [Telink] w91 remove not connected PWM channels (#35005) * telink: w91 remowe PWM channels Signed-off-by: Dmytro Kashkarov * Restyled by whitespace --------- Signed-off-by: Dmytro Kashkarov Co-authored-by: Dmytro Kashkarov Co-authored-by: Restyled.io --- examples/platform/telink/common/src/AppTaskCommon.cpp | 5 +++-- src/platform/telink/tlsr9118bdk40d.overlay | 11 +---------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/examples/platform/telink/common/src/AppTaskCommon.cpp b/examples/platform/telink/common/src/AppTaskCommon.cpp index 59ad41b3c45bde..d2ad2a6fd83a00 100644 --- a/examples/platform/telink/common/src/AppTaskCommon.cpp +++ b/examples/platform/telink/common/src/AppTaskCommon.cpp @@ -414,8 +414,9 @@ void AppTaskCommon::InitPwms() void AppTaskCommon::LinkPwms(PwmManager & pwmManager) { -#if CONFIG_WS2812_STRIP || \ - CONFIG_BOARD_TLSR9118BDK40D // TLSR9118BDK40D EVK buttons located on 4th PWM channel (see tlsr9118bdk40d.overlay) +#if CONFIG_BOARD_TLSR9118BDK40D // TLSR9118BDK40D EVK supports only 1 PWM channel connected to LED + pwmManager.linkPwm(PwmManager::EAppPwm_Red, 0); +#elif CONFIG_WS2812_STRIP pwmManager.linkPwm(PwmManager::EAppPwm_Red, 0); pwmManager.linkPwm(PwmManager::EAppPwm_Green, 1); pwmManager.linkPwm(PwmManager::EAppPwm_Blue, 2); diff --git a/src/platform/telink/tlsr9118bdk40d.overlay b/src/platform/telink/tlsr9118bdk40d.overlay index 6dddbe61c95a38..3c44668724d796 100644 --- a/src/platform/telink/tlsr9118bdk40d.overlay +++ b/src/platform/telink/tlsr9118bdk40d.overlay @@ -33,16 +33,7 @@ pwm_pool { compatible = "pwm-leds"; out { - pwms = <&pwm0 4 PWM_MSEC(1) PWM_POLARITY_NORMAL>, - <&pwm0 2 PWM_MSEC(1) PWM_POLARITY_NORMAL>, - <&pwm0 3 PWM_MSEC(1) PWM_POLARITY_NORMAL>; + pwms = <&pwm0 4 PWM_MSEC(1) PWM_POLARITY_NORMAL>; }; }; -}; - -&pwm0 { - /* On board RGB LEDs */ - pinctrl-ch4 = <&pwm_ch4_p20_default>; - pinctrl-ch2 = <&pwm_ch2_p17_default>; - pinctrl-ch3 = <&pwm_ch3_p18_default>; }; \ No newline at end of file From 081598e6d811fe0a4f6384263e96f24e15986b3c Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 16 Aug 2024 11:03:42 -0400 Subject: [PATCH 47/59] Optimize RAM utilization for WriteHandler (#34992) * Pull RAM usage reduction from write impl * remove some extra added includes * Apply review comment from previous PR --- src/app/WriteHandler.cpp | 66 ++++++++++++++++++++++++---------------- src/app/WriteHandler.h | 50 +++++++++++++++++++----------- 2 files changed, 71 insertions(+), 45 deletions(-) diff --git a/src/app/WriteHandler.cpp b/src/app/WriteHandler.cpp index 8d4a82d11630c4..15776eb545fc21 100644 --- a/src/app/WriteHandler.cpp +++ b/src/app/WriteHandler.cpp @@ -16,7 +16,6 @@ * limitations under the License. */ -#include "messaging/ExchangeContext.h" #include #include #include @@ -28,6 +27,7 @@ #include #include #include +#include #include #include @@ -62,7 +62,7 @@ void WriteHandler::Close() // successful. DeliverFinalListWriteEnd(false /* wasSuccessful */); mExchangeCtx.Release(); - mSuppressResponse = false; + mStateFlags.Clear(StateBits::kSuppressResponse); MoveToState(State::Uninitialized); } @@ -106,7 +106,7 @@ Status WriteHandler::OnWriteRequest(Messaging::ExchangeContext * apExchangeConte Status status = HandleWriteRequestMessage(apExchangeContext, std::move(aPayload), aIsTimedWrite); // The write transaction will be alive only when the message was handled successfully and there are more chunks. - if (!(status == Status::Success && mHasMoreChunks)) + if (!(status == Status::Success && mStateFlags.Has(StateBits::kHasMoreChunks))) { Close(); } @@ -142,7 +142,7 @@ CHIP_ERROR WriteHandler::OnMessageReceived(Messaging::ExchangeContext * apExchan if (status == Status::Success) { // We have no more chunks, the write response has been sent in HandleWriteRequestMessage, so close directly. - if (!mHasMoreChunks) + if (!mStateFlags.Has(StateBits::kHasMoreChunks)) { Close(); } @@ -184,8 +184,8 @@ CHIP_ERROR WriteHandler::SendWriteResponse(System::PacketBufferTLVWriter && aMes VerifyOrExit(mExchangeCtx, err = CHIP_ERROR_INCORRECT_STATE); mExchangeCtx->UseSuggestedResponseTimeout(app::kExpectedIMProcessingTime); err = mExchangeCtx->SendMessage(Protocols::InteractionModel::MsgType::WriteResponse, std::move(packet), - mHasMoreChunks ? Messaging::SendMessageFlags::kExpectResponse - : Messaging::SendMessageFlags::kNone); + mStateFlags.Has(StateBits::kHasMoreChunks) ? Messaging::SendMessageFlags::kExpectResponse + : Messaging::SendMessageFlags::kNone); SuccessOrExit(err); MoveToState(State::Sending); @@ -212,7 +212,7 @@ void WriteHandler::DeliverListWriteEnd(const ConcreteAttributePath & aPath, bool void WriteHandler::DeliverFinalListWriteEnd(bool writeWasSuccessful) { - if (mProcessingAttributePath.HasValue() && mProcessingAttributeIsList) + if (mProcessingAttributePath.HasValue() && mStateFlags.Has(StateBits::kProcessingAttributeIsList)) { DeliverListWriteEnd(mProcessingAttributePath.Value(), writeWasSuccessful); } @@ -221,7 +221,8 @@ void WriteHandler::DeliverFinalListWriteEnd(bool writeWasSuccessful) CHIP_ERROR WriteHandler::DeliverFinalListWriteEndForGroupWrite(bool writeWasSuccessful) { - VerifyOrReturnError(mProcessingAttributePath.HasValue() && mProcessingAttributeIsList, CHIP_NO_ERROR); + VerifyOrReturnError(mProcessingAttributePath.HasValue() && mStateFlags.Has(StateBits::kProcessingAttributeIsList), + CHIP_NO_ERROR); Credentials::GroupDataProvider::GroupEndpoint mapping; Credentials::GroupDataProvider * groupDataProvider = Credentials::GetGroupDataProvider(); @@ -321,18 +322,20 @@ CHIP_ERROR WriteHandler::ProcessAttributeDataIBs(TLV::TLVReader & aAttributeData continue; } - if (ShouldReportListWriteEnd(mProcessingAttributePath, mProcessingAttributeIsList, dataAttributePath)) + if (ShouldReportListWriteEnd(mProcessingAttributePath, mStateFlags.Has(StateBits::kProcessingAttributeIsList), + dataAttributePath)) { - DeliverListWriteEnd(mProcessingAttributePath.Value(), mAttributeWriteSuccessful); + DeliverListWriteEnd(mProcessingAttributePath.Value(), mStateFlags.Has(StateBits::kAttributeWriteSuccessful)); } - if (ShouldReportListWriteBegin(mProcessingAttributePath, mProcessingAttributeIsList, dataAttributePath)) + if (ShouldReportListWriteBegin(mProcessingAttributePath, mStateFlags.Has(StateBits::kProcessingAttributeIsList), + dataAttributePath)) { DeliverListWriteBegin(dataAttributePath); - mAttributeWriteSuccessful = true; + mStateFlags.Set(StateBits::kAttributeWriteSuccessful); } - mProcessingAttributeIsList = dataAttributePath.IsListOperation(); + mStateFlags.Set(StateBits::kProcessingAttributeIsList, dataAttributePath.IsListOperation()); mProcessingAttributePath.SetValue(dataAttributePath); DataModelCallbacks::GetInstance()->AttributeOperation(DataModelCallbacks::OperationType::Write, @@ -370,9 +373,9 @@ CHIP_ERROR WriteHandler::ProcessAttributeDataIBs(TLV::TLVReader & aAttributeData SuccessOrExit(err); - if (!mHasMoreChunks) + if (!mStateFlags.Has(StateBits::kHasMoreChunks)) { - DeliverFinalListWriteEnd(mAttributeWriteSuccessful); + DeliverFinalListWriteEnd(mStateFlags.Has(StateBits::kAttributeWriteSuccessful)); } exit: @@ -426,8 +429,8 @@ CHIP_ERROR WriteHandler::ProcessGroupAttributeDataIBs(TLV::TLVReader & aAttribut iterator = groupDataProvider->IterateEndpoints(fabric); VerifyOrExit(iterator != nullptr, err = CHIP_ERROR_NO_MEMORY); - bool shouldReportListWriteEnd = - ShouldReportListWriteEnd(mProcessingAttributePath, mProcessingAttributeIsList, dataAttributePath); + bool shouldReportListWriteEnd = ShouldReportListWriteEnd( + mProcessingAttributePath, mStateFlags.Has(StateBits::kProcessingAttributeIsList), dataAttributePath); bool shouldReportListWriteBegin = false; // This will be set below. const EmberAfAttributeMetadata * attributeMetadata = nullptr; @@ -457,7 +460,8 @@ CHIP_ERROR WriteHandler::ProcessGroupAttributeDataIBs(TLV::TLVReader & aAttribut dataAttributePath.mEndpointId, dataAttributePath.mListOp, dataAttributePath.mListIndex); shouldReportListWriteBegin = - ShouldReportListWriteBegin(mProcessingAttributePath, mProcessingAttributeIsList, pathForCheckingListWriteBegin); + ShouldReportListWriteBegin(mProcessingAttributePath, mStateFlags.Has(StateBits::kProcessingAttributeIsList), + pathForCheckingListWriteBegin); } if (shouldReportListWriteEnd) @@ -498,11 +502,10 @@ CHIP_ERROR WriteHandler::ProcessGroupAttributeDataIBs(TLV::TLVReader & aAttribut DataModelCallbacks::GetInstance()->AttributeOperation(DataModelCallbacks::OperationType::Write, DataModelCallbacks::OperationOrder::Pre, dataAttributePath); err = WriteSingleClusterData(subjectDescriptor, dataAttributePath, tmpDataReader, this); - if (err != CHIP_NO_ERROR) { ChipLogError(DataManagement, - "WriteSingleClusterData Endpoint=%u Cluster=" ChipLogFormatMEI " Attribute =" ChipLogFormatMEI + "WriteClusterData Endpoint=%u Cluster=" ChipLogFormatMEI " Attribute =" ChipLogFormatMEI " failed: %" CHIP_ERROR_FORMAT, mapping.endpoint_id, ChipLogValueMEI(dataAttributePath.mClusterId), ChipLogValueMEI(dataAttributePath.mAttributeId), err.Format()); @@ -512,7 +515,7 @@ CHIP_ERROR WriteHandler::ProcessGroupAttributeDataIBs(TLV::TLVReader & aAttribut } dataAttributePath.mEndpointId = kInvalidEndpointId; - mProcessingAttributeIsList = dataAttributePath.IsListOperation(); + mStateFlags.Set(StateBits::kProcessingAttributeIsList, dataAttributePath.IsListOperation()); mProcessingAttributePath.SetValue(dataAttributePath); iterator->Release(); } @@ -557,24 +560,33 @@ Status WriteHandler::ProcessWriteRequest(System::PacketBufferHandle && aPayload, #if CHIP_CONFIG_IM_PRETTY_PRINT writeRequestParser.PrettyPrint(); #endif - err = writeRequestParser.GetSuppressResponse(&mSuppressResponse); + bool boolValue; + + boolValue = mStateFlags.Has(StateBits::kSuppressResponse); + err = writeRequestParser.GetSuppressResponse(&boolValue); if (err == CHIP_END_OF_TLV) { err = CHIP_NO_ERROR; } SuccessOrExit(err); + mStateFlags.Set(StateBits::kSuppressResponse, boolValue); - err = writeRequestParser.GetTimedRequest(&mIsTimedRequest); + boolValue = mStateFlags.Has(StateBits::kIsTimedRequest); + err = writeRequestParser.GetTimedRequest(&boolValue); SuccessOrExit(err); + mStateFlags.Set(StateBits::kIsTimedRequest, boolValue); - err = writeRequestParser.GetMoreChunkedMessages(&mHasMoreChunks); + boolValue = mStateFlags.Has(StateBits::kHasMoreChunks); + err = writeRequestParser.GetMoreChunkedMessages(&boolValue); if (err == CHIP_ERROR_END_OF_TLV) { err = CHIP_NO_ERROR; } SuccessOrExit(err); + mStateFlags.Set(StateBits::kHasMoreChunks, boolValue); - if (mHasMoreChunks && (mExchangeCtx->IsGroupExchangeContext() || mIsTimedRequest)) + if (mStateFlags.Has(StateBits::kHasMoreChunks) && + (mExchangeCtx->IsGroupExchangeContext() || mStateFlags.Has(StateBits::kIsTimedRequest))) { // Sanity check: group exchange context should only have one chunk. // Also, timed requests should not have more than one chunk. @@ -584,7 +596,7 @@ Status WriteHandler::ProcessWriteRequest(System::PacketBufferHandle && aPayload, err = writeRequestParser.GetWriteRequests(&AttributeDataIBsParser); SuccessOrExit(err); - if (mIsTimedRequest != aIsTimedWrite) + if (mStateFlags.Has(StateBits::kIsTimedRequest) != aIsTimedWrite) { // The message thinks it should be part of a timed interaction but it's // not, or vice versa. @@ -641,7 +653,7 @@ CHIP_ERROR WriteHandler::AddStatusInternal(const ConcreteDataAttributePath & aPa if (!aStatus.IsSuccess()) { - mAttributeWriteSuccessful = false; + mStateFlags.Clear(StateBits::kAttributeWriteSuccessful); } ReturnErrorOnFailure(writeResponses.GetError()); diff --git a/src/app/WriteHandler.h b/src/app/WriteHandler.h index 1884654f070710..0723a316738498 100644 --- a/src/app/WriteHandler.h +++ b/src/app/WriteHandler.h @@ -17,12 +17,15 @@ */ #pragma once + +#include #include #include #include #include #include #include +#include #include #include #include @@ -68,9 +71,11 @@ class WriteHandler : public Messaging::ExchangeDelegate * * @param[in] apWriteHandlerDelegate A Valid pointer to the WriteHandlerDelegate. * + * @retval #CHIP_ERROR_INVALID_ARGUMENT on invalid pointers * @retval #CHIP_ERROR_INCORRECT_STATE If the state is not equal to * kState_NotInitialized. * @retval #CHIP_NO_ERROR On success. + * */ CHIP_ERROR Init(WriteHandlerDelegate * apWriteHandlerDelegate); @@ -115,7 +120,7 @@ class WriteHandler : public Messaging::ExchangeDelegate /** * Check whether the WriteRequest we are handling is a timed write. */ - bool IsTimedWrite() const { return mIsTimedRequest; } + bool IsTimedWrite() const { return mStateFlags.Has(StateBits::kIsTimedRequest); } bool MatchesExchangeContext(Messaging::ExchangeContext * apExchangeContext) const { @@ -136,7 +141,7 @@ class WriteHandler : public Messaging::ExchangeDelegate private: friend class TestWriteInteraction; - enum class State + enum class State : uint8_t { Uninitialized = 0, // The handler has not been initialized Initialized, // The handler has been initialized and is ready @@ -172,7 +177,6 @@ class WriteHandler : public Messaging::ExchangeDelegate CHIP_ERROR AddStatusInternal(const ConcreteDataAttributePath & aPath, const StatusIB & aStatus); -private: // ExchangeDelegate CHIP_ERROR OnMessageReceived(Messaging::ExchangeContext * apExchangeContext, const PayloadHeader & aPayloadHeader, System::PacketBufferHandle && aPayload) override; @@ -180,22 +184,7 @@ class WriteHandler : public Messaging::ExchangeDelegate Messaging::ExchangeHolder mExchangeCtx; WriteResponseMessage::Builder mWriteResponseBuilder; - State mState = State::Uninitialized; - bool mIsTimedRequest = false; - bool mSuppressResponse = false; - bool mHasMoreChunks = false; Optional mProcessingAttributePath; - bool mProcessingAttributeIsList = false; - // We record the Status when AddStatus is called to determine whether all data of a list write is accepted. - // This value will be used by DeliverListWriteEnd and DeliverFinalListWriteEnd but it won't be used by group writes based on the - // fact that the errors that won't be delivered to AttributeAccessInterface are: - // (1) Attribute not found - // (2) Access control failed - // (3) Write request to a read-only attribute - // (4) Data version mismatch - // (5) Not using timed write. - // Where (1)-(3) will be consistent among the whole list write request, while (4) and (5) are not appliable to group writes. - bool mAttributeWriteSuccessful = false; Optional mACLCheckCache = NullOptional; // This may be a "fake" pointer or a real delegate pointer, depending @@ -205,6 +194,31 @@ class WriteHandler : public Messaging::ExchangeDelegate // set to the global InteractionModelEngine and the size of this // member is 1 byte. InteractionModelDelegatePointer mDelegate; + + // bit level enums to save storage for this object. InteractionModelEngine maintains + // several of these objects, so every bit of storage multiplies storage usage. + enum class StateBits : uint8_t + { + kIsTimedRequest = 0x01, + kSuppressResponse = 0x02, + kHasMoreChunks = 0x04, + kProcessingAttributeIsList = 0x08, + // We record the Status when AddStatus is called to determine whether all data of a list write is accepted. + // This value will be used by DeliverListWriteEnd and DeliverFinalListWriteEnd but it won't be used by group writes based on + // the fact that the errors that won't be delivered to AttributeAccessInterface are: + // (1) Attribute not found + // (2) Access control failed + // (3) Write request to a read-only attribute + // (4) Data version mismatch + // (5) Not using timed write. + // Where (1)-(3) will be consistent among the whole list write request, while (4) and (5) are not appliable to group + // writes. + kAttributeWriteSuccessful = 0x10, + }; + + BitFlags mStateFlags; + State mState = State::Uninitialized; }; + } // namespace app } // namespace chip From 0da50e96245d312967fd2b720ac0c76af29af0a6 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Fri, 16 Aug 2024 17:04:48 +0200 Subject: [PATCH 48/59] [Tizen] Implement GetThreadVersion() for Thread driver (#34976) * [Tizen] Implement GetThreadVersion in thread stack manager * Move otThreadGetVersion() usage to Thread stack manager class * Update C++ style * Make GetThreadVersion public interface * Implement mock _GetThreadVersion() for Linux, NuttX and WebOS --- src/include/platform/ThreadStackManager.h | 6 +++ .../NetworkCommissioningThreadDriver.cpp | 6 +-- src/platform/Linux/ThreadStackManagerImpl.cpp | 7 ++++ src/platform/Linux/ThreadStackManagerImpl.h | 2 +- .../NetworkCommissioningThreadDriver.cpp | 6 +-- src/platform/NuttX/ThreadStackManagerImpl.cpp | 7 ++++ src/platform/NuttX/ThreadStackManagerImpl.h | 2 +- ...enericNetworkCommissioningThreadDriver.cpp | 4 +- ...GenericThreadStackManagerImpl_OpenThread.h | 41 ++++++++++--------- ...nericThreadStackManagerImpl_OpenThread.hpp | 35 +++++++++------- src/platform/OpenThread/OpenThreadUtils.cpp | 2 +- src/platform/OpenThread/OpenThreadUtils.h | 2 +- .../NetworkCommissioningThreadDriver.cpp | 14 +++---- src/platform/Tizen/ThreadStackManagerImpl.cpp | 15 +++++++ src/platform/Tizen/ThreadStackManagerImpl.h | 6 +-- .../NetworkCommissioningThreadDriver.cpp | 6 +-- src/platform/webos/ThreadStackManagerImpl.cpp | 7 ++++ src/platform/webos/ThreadStackManagerImpl.h | 2 +- 18 files changed, 109 insertions(+), 61 deletions(-) diff --git a/src/include/platform/ThreadStackManager.h b/src/include/platform/ThreadStackManager.h index a28aea640ba46e..f9f7aed04e4253 100644 --- a/src/include/platform/ThreadStackManager.h +++ b/src/include/platform/ThreadStackManager.h @@ -105,6 +105,7 @@ class ThreadStackManager CHIP_ERROR GetAndLogThreadTopologyFull(); CHIP_ERROR GetPrimary802154MACAddress(uint8_t * buf); CHIP_ERROR GetExternalIPv6Address(chip::Inet::IPAddress & addr); + CHIP_ERROR GetThreadVersion(uint16_t & version); CHIP_ERROR GetPollPeriod(uint32_t & buf); CHIP_ERROR SetThreadProvision(ByteSpan aDataset); @@ -444,6 +445,11 @@ inline CHIP_ERROR ThreadStackManager::GetExternalIPv6Address(chip::Inet::IPAddre return static_cast(this)->_GetExternalIPv6Address(addr); } +inline CHIP_ERROR ThreadStackManager::GetThreadVersion(uint16_t & version) +{ + return static_cast(this)->_GetThreadVersion(version); +} + inline CHIP_ERROR ThreadStackManager::GetPollPeriod(uint32_t & buf) { return static_cast(this)->_GetPollPeriod(buf); diff --git a/src/platform/Linux/NetworkCommissioningThreadDriver.cpp b/src/platform/Linux/NetworkCommissioningThreadDriver.cpp index 9bb6015809fc9a..6792e9c04439e8 100644 --- a/src/platform/Linux/NetworkCommissioningThreadDriver.cpp +++ b/src/platform/Linux/NetworkCommissioningThreadDriver.cpp @@ -211,9 +211,9 @@ ThreadCapabilities LinuxThreadDriver::GetSupportedThreadFeatures() uint16_t LinuxThreadDriver::GetThreadVersion() { - // TODO https://github.com/project-chip/connectedhomeip/issues/30602 - // Needs to be implemented with DBUS io.openthread.BorderRouter Thread API - return 0; + uint16_t version = 0; + ThreadStackMgrImpl().GetThreadVersion(version); + return version; } #endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD diff --git a/src/platform/Linux/ThreadStackManagerImpl.cpp b/src/platform/Linux/ThreadStackManagerImpl.cpp index 126d30164492fe..76fd478a050f89 100644 --- a/src/platform/Linux/ThreadStackManagerImpl.cpp +++ b/src/platform/Linux/ThreadStackManagerImpl.cpp @@ -563,6 +563,13 @@ CHIP_ERROR ThreadStackManagerImpl::_GetExternalIPv6Address(chip::Inet::IPAddress return CHIP_ERROR_NOT_IMPLEMENTED; } +CHIP_ERROR ThreadStackManagerImpl::_GetThreadVersion(uint16_t & version) +{ + // TODO https://github.com/project-chip/connectedhomeip/issues/30602 + // Needs to be implemented with DBUS io.openthread.BorderRouter Thread API + return CHIP_ERROR_NOT_IMPLEMENTED; +} + CHIP_ERROR ThreadStackManagerImpl::_GetPollPeriod(uint32_t & buf) { // TODO: Remove Weave legacy APIs diff --git a/src/platform/Linux/ThreadStackManagerImpl.h b/src/platform/Linux/ThreadStackManagerImpl.h index e9c1a825d35a91..685348a4ae4a72 100755 --- a/src/platform/Linux/ThreadStackManagerImpl.h +++ b/src/platform/Linux/ThreadStackManagerImpl.h @@ -113,7 +113,7 @@ class ThreadStackManagerImpl : public ThreadStackManager CHIP_ERROR _GetPrimary802154MACAddress(uint8_t * buf); CHIP_ERROR _GetExternalIPv6Address(chip::Inet::IPAddress & addr); - + CHIP_ERROR _GetThreadVersion(uint16_t & version); CHIP_ERROR _GetPollPeriod(uint32_t & buf); void _ResetThreadNetworkDiagnosticsCounts(); diff --git a/src/platform/NuttX/NetworkCommissioningThreadDriver.cpp b/src/platform/NuttX/NetworkCommissioningThreadDriver.cpp index 79da48d49c0419..27c410400421a8 100644 --- a/src/platform/NuttX/NetworkCommissioningThreadDriver.cpp +++ b/src/platform/NuttX/NetworkCommissioningThreadDriver.cpp @@ -211,9 +211,9 @@ ThreadCapabilities LinuxThreadDriver::GetSupportedThreadFeatures() uint16_t LinuxThreadDriver::GetThreadVersion() { - // TODO https://github.com/project-chip/connectedhomeip/issues/30602 - // Needs to be implemented with DBUS io.openthread.BorderRouter Thread API - return 0; + uint16_t version = 0; + ThreadStackMgrImpl().GetThreadVersion(version); + return version; } #endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD diff --git a/src/platform/NuttX/ThreadStackManagerImpl.cpp b/src/platform/NuttX/ThreadStackManagerImpl.cpp index cb717324fc989d..8eb1538128108b 100644 --- a/src/platform/NuttX/ThreadStackManagerImpl.cpp +++ b/src/platform/NuttX/ThreadStackManagerImpl.cpp @@ -568,6 +568,13 @@ CHIP_ERROR ThreadStackManagerImpl::_GetExternalIPv6Address(chip::Inet::IPAddress return CHIP_ERROR_NOT_IMPLEMENTED; } +CHIP_ERROR ThreadStackManagerImpl::_GetThreadVersion(uint16_t & version) +{ + // TODO https://github.com/project-chip/connectedhomeip/issues/30602 + // Needs to be implemented with DBUS io.openthread.BorderRouter Thread API + return CHIP_ERROR_NOT_IMPLEMENTED; +} + CHIP_ERROR ThreadStackManagerImpl::_GetPollPeriod(uint32_t & buf) { // TODO: Remove Weave legacy APIs diff --git a/src/platform/NuttX/ThreadStackManagerImpl.h b/src/platform/NuttX/ThreadStackManagerImpl.h index 5ef3d8ed36555f..ce66d51c2201a2 100644 --- a/src/platform/NuttX/ThreadStackManagerImpl.h +++ b/src/platform/NuttX/ThreadStackManagerImpl.h @@ -114,7 +114,7 @@ class ThreadStackManagerImpl : public ThreadStackManager CHIP_ERROR _GetPrimary802154MACAddress(uint8_t * buf); CHIP_ERROR _GetExternalIPv6Address(chip::Inet::IPAddress & addr); - + CHIP_ERROR _GetThreadVersion(uint16_t & version); CHIP_ERROR _GetPollPeriod(uint32_t & buf); CHIP_ERROR _JoinerStart(); diff --git a/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp b/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp index 711ad4930f96d4..0e7701ec481add 100644 --- a/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp +++ b/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp @@ -325,7 +325,9 @@ ThreadCapabilities GenericThreadDriver::GetSupportedThreadFeatures() uint16_t GenericThreadDriver::GetThreadVersion() { - return otThreadGetVersion(); + uint16_t version = 0; + ThreadStackMgrImpl().GetThreadVersion(version); + return version; } } // namespace NetworkCommissioning diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h index c45ff84bb0f26e..169820c103e828 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.h @@ -70,7 +70,7 @@ class GenericThreadStackManagerImpl_OpenThread otInstance * OTInstance() const; static void OnOpenThreadStateChange(uint32_t flags, void * context); - inline void OverrunErrorTally(void); + inline void OverrunErrorTally(); void SetNetworkStatusChangeCallback(NetworkCommissioning::Internal::BaseDriver::NetworkStatusChangeCallback * statusChangeCallback) { @@ -80,21 +80,21 @@ class GenericThreadStackManagerImpl_OpenThread protected: // ===== Methods that implement the ThreadStackManager abstract interface. - void _ProcessThreadActivity(void); + void _ProcessThreadActivity(); bool _HaveRouteToAddress(const Inet::IPAddress & destAddr); void _OnPlatformEvent(const ChipDeviceEvent * event); - bool _IsThreadEnabled(void); + bool _IsThreadEnabled(); CHIP_ERROR _SetThreadEnabled(bool val); - bool _IsThreadProvisioned(void); - bool _IsThreadAttached(void); + bool _IsThreadProvisioned(); + bool _IsThreadAttached(); CHIP_ERROR _GetThreadProvision(Thread::OperationalDataset & dataset); CHIP_ERROR _SetThreadProvision(ByteSpan netInfo); CHIP_ERROR _AttachToThreadNetwork(const Thread::OperationalDataset & dataset, NetworkCommissioning::Internal::WirelessDriver::ConnectCallback * callback); - void _OnThreadAttachFinished(void); - void _ErasePersistentInfo(void); - ConnectivityManager::ThreadDeviceType _GetThreadDeviceType(void); + void _OnThreadAttachFinished(); + void _ErasePersistentInfo(); + ConnectivityManager::ThreadDeviceType _GetThreadDeviceType(); CHIP_ERROR _SetThreadDeviceType(ConnectivityManager::ThreadDeviceType deviceType); CHIP_ERROR _StartThreadScan(NetworkCommissioning::ThreadDriver::ScanCallback * callback); static void _OnNetworkScanFinished(otActiveScanResult * aResult, void * aContext); @@ -105,16 +105,17 @@ class GenericThreadStackManagerImpl_OpenThread CHIP_ERROR _SetPollingInterval(System::Clock::Milliseconds32 pollingInterval); #endif // CHIP_CONFIG_ENABLE_ICD_SERVER - bool _HaveMeshConnectivity(void); - CHIP_ERROR _GetAndLogThreadStatsCounters(void); - CHIP_ERROR _GetAndLogThreadTopologyMinimal(void); - CHIP_ERROR _GetAndLogThreadTopologyFull(void); + bool _HaveMeshConnectivity(); + CHIP_ERROR _GetAndLogThreadStatsCounters(); + CHIP_ERROR _GetAndLogThreadTopologyMinimal(); + CHIP_ERROR _GetAndLogThreadTopologyFull(); CHIP_ERROR _GetPrimary802154MACAddress(uint8_t * buf); CHIP_ERROR _GetExternalIPv6Address(chip::Inet::IPAddress & addr); - void _ResetThreadNetworkDiagnosticsCounts(void); + CHIP_ERROR _GetThreadVersion(uint16_t & version); + void _ResetThreadNetworkDiagnosticsCounts(); CHIP_ERROR _GetPollPeriod(uint32_t & buf); - void _OnWoBLEAdvertisingStart(void); - void _OnWoBLEAdvertisingStop(void); + void _OnWoBLEAdvertisingStart(); + void _OnWoBLEAdvertisingStop(); #if CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT CHIP_ERROR _AddSrpService(const char * aInstanceName, const char * aName, uint16_t aPort, @@ -144,8 +145,8 @@ class GenericThreadStackManagerImpl_OpenThread CHIP_ERROR ConfigureThreadStack(otInstance * otInst); CHIP_ERROR DoInit(otInstance * otInst); - bool IsThreadAttachedNoLock(void); - bool IsThreadInterfaceUpNoLock(void); + bool IsThreadAttachedNoLock(); + bool IsThreadInterfaceUpNoLock(); private: // ===== Private members for use by this class only. @@ -282,19 +283,19 @@ inline otInstance * GenericThreadStackManagerImpl_OpenThread::OTInsta } template -inline void GenericThreadStackManagerImpl_OpenThread::OverrunErrorTally(void) +inline void GenericThreadStackManagerImpl_OpenThread::OverrunErrorTally() { mOverrunCount++; } template -inline void GenericThreadStackManagerImpl_OpenThread::_OnWoBLEAdvertisingStart(void) +inline void GenericThreadStackManagerImpl_OpenThread::_OnWoBLEAdvertisingStart() { // Do nothing by default. } template -inline void GenericThreadStackManagerImpl_OpenThread::_OnWoBLEAdvertisingStop(void) +inline void GenericThreadStackManagerImpl_OpenThread::_OnWoBLEAdvertisingStop() { // Do nothing by default. } diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp index 61452f5ff0ec90..6916c096c9ce50 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp @@ -27,6 +27,7 @@ #define GENERIC_THREAD_STACK_MANAGER_IMPL_OPENTHREAD_IPP #include +#include #include #include @@ -59,7 +60,6 @@ #include #include -#include extern "C" void otSysProcessDrivers(otInstance * aInstance); #if CHIP_DEVICE_CONFIG_THREAD_ENABLE_CLI @@ -80,7 +80,7 @@ app::Clusters::NetworkCommissioning::Instance sThreadNetworkCommissioningInstance(CHIP_DEVICE_CONFIG_THREAD_NETWORK_ENDPOINT_ID /* Endpoint Id */, &sGenericThreadDriver); #endif -void initNetworkCommissioningThreadDriver(void) +void initNetworkCommissioningThreadDriver() { #ifndef _NO_GENERIC_THREAD_NETWORK_COMMISSIONING_DRIVER_ sThreadNetworkCommissioningInstance.Init(); @@ -143,7 +143,7 @@ void GenericThreadStackManagerImpl_OpenThread::OnOpenThreadStateChang } template -void GenericThreadStackManagerImpl_OpenThread::_ProcessThreadActivity(void) +void GenericThreadStackManagerImpl_OpenThread::_ProcessThreadActivity() { otTaskletsProcess(mOTInst); otSysProcessDrivers(mOTInst); @@ -256,7 +256,7 @@ void GenericThreadStackManagerImpl_OpenThread::_OnPlatformEvent(const } template -bool GenericThreadStackManagerImpl_OpenThread::_IsThreadEnabled(void) +bool GenericThreadStackManagerImpl_OpenThread::_IsThreadEnabled() { VerifyOrReturnValue(mOTInst, false); otDeviceRole curRole; @@ -330,7 +330,7 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_SetThreadProvis } template -bool GenericThreadStackManagerImpl_OpenThread::_IsThreadProvisioned(void) +bool GenericThreadStackManagerImpl_OpenThread::_IsThreadProvisioned() { VerifyOrReturnValue(mOTInst, false); bool provisioned; @@ -363,7 +363,7 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_GetThreadProvis } template -bool GenericThreadStackManagerImpl_OpenThread::_IsThreadAttached(void) +bool GenericThreadStackManagerImpl_OpenThread::_IsThreadAttached() { VerifyOrReturnValue(mOTInst, false); otDeviceRole curRole; @@ -525,7 +525,7 @@ void GenericThreadStackManagerImpl_OpenThread::_OnNetworkScanFinished } template -ConnectivityManager::ThreadDeviceType GenericThreadStackManagerImpl_OpenThread::_GetThreadDeviceType(void) +ConnectivityManager::ThreadDeviceType GenericThreadStackManagerImpl_OpenThread::_GetThreadDeviceType() { VerifyOrReturnValue(mOTInst, ConnectivityManager::kThreadDeviceType_NotSupported); ConnectivityManager::ThreadDeviceType deviceType; @@ -651,7 +651,7 @@ GenericThreadStackManagerImpl_OpenThread::_SetThreadDeviceType(Connec } template -bool GenericThreadStackManagerImpl_OpenThread::_HaveMeshConnectivity(void) +bool GenericThreadStackManagerImpl_OpenThread::_HaveMeshConnectivity() { VerifyOrReturnValue(mOTInst, false); bool res; @@ -700,7 +700,7 @@ bool GenericThreadStackManagerImpl_OpenThread::_HaveMeshConnectivity( } template -CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_GetAndLogThreadStatsCounters(void) +CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_GetAndLogThreadStatsCounters() { VerifyOrReturnError(mOTInst, CHIP_ERROR_INCORRECT_STATE); CHIP_ERROR err = CHIP_NO_ERROR; @@ -795,7 +795,7 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_GetAndLogThread } template -CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_GetAndLogThreadTopologyMinimal(void) +CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_GetAndLogThreadTopologyMinimal() { VerifyOrReturnError(mOTInst, CHIP_ERROR_INCORRECT_STATE); CHIP_ERROR err = CHIP_NO_ERROR; @@ -1072,7 +1072,14 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_GetExternalIPv6 } template -void GenericThreadStackManagerImpl_OpenThread::_ResetThreadNetworkDiagnosticsCounts(void) +CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_GetThreadVersion(uint16_t & version) +{ + version = otThreadGetVersion(); + return CHIP_NO_ERROR; +} + +template +void GenericThreadStackManagerImpl_OpenThread::_ResetThreadNetworkDiagnosticsCounts() { // Based on the spec, only OverrunCount should be resetted. mOverrunCount = 0; @@ -1175,14 +1182,14 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::DoInit(otInstanc } template -bool GenericThreadStackManagerImpl_OpenThread::IsThreadAttachedNoLock(void) +bool GenericThreadStackManagerImpl_OpenThread::IsThreadAttachedNoLock() { otDeviceRole curRole = otThreadGetDeviceRole(mOTInst); return (curRole != OT_DEVICE_ROLE_DISABLED && curRole != OT_DEVICE_ROLE_DETACHED); } template -bool GenericThreadStackManagerImpl_OpenThread::IsThreadInterfaceUpNoLock(void) +bool GenericThreadStackManagerImpl_OpenThread::IsThreadInterfaceUpNoLock() { return otIp6IsEnabled(mOTInst); } @@ -1242,7 +1249,7 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_SetPollingInter #endif // CHIP_CONFIG_ENABLE_ICD_SERVER template -void GenericThreadStackManagerImpl_OpenThread::_ErasePersistentInfo(void) +void GenericThreadStackManagerImpl_OpenThread::_ErasePersistentInfo() { VerifyOrReturn(mOTInst); ChipLogProgress(DeviceLayer, "Erasing Thread persistent info..."); diff --git a/src/platform/OpenThread/OpenThreadUtils.cpp b/src/platform/OpenThread/OpenThreadUtils.cpp index 093997c66fb789..f2470b38ce4821 100644 --- a/src/platform/OpenThread/OpenThreadUtils.cpp +++ b/src/platform/OpenThread/OpenThreadUtils.cpp @@ -80,7 +80,7 @@ bool FormatOpenThreadError(char * buf, uint16_t bufSize, CHIP_ERROR err) /** * Register a text error formatter for OpenThread errors. */ -void RegisterOpenThreadErrorFormatter(void) +void RegisterOpenThreadErrorFormatter() { static ErrorFormatter sOpenThreadErrorFormatter = { FormatOpenThreadError, NULL }; diff --git a/src/platform/OpenThread/OpenThreadUtils.h b/src/platform/OpenThread/OpenThreadUtils.h index f9609e8d8728af..ab0cdd06a8aa6f 100644 --- a/src/platform/OpenThread/OpenThreadUtils.h +++ b/src/platform/OpenThread/OpenThreadUtils.h @@ -59,7 +59,7 @@ namespace Internal { #endif // CHIP_CONFIG_OPENTHREAD_ERROR_MAX extern CHIP_ERROR MapOpenThreadError(otError otErr); -extern void RegisterOpenThreadErrorFormatter(void); +extern void RegisterOpenThreadErrorFormatter(); /** * Log information related to a state change in the OpenThread stack. diff --git a/src/platform/Tizen/NetworkCommissioningThreadDriver.cpp b/src/platform/Tizen/NetworkCommissioningThreadDriver.cpp index 003564b4c90f0f..f954e6c2fc67e0 100644 --- a/src/platform/Tizen/NetworkCommissioningThreadDriver.cpp +++ b/src/platform/Tizen/NetworkCommissioningThreadDriver.cpp @@ -28,7 +28,6 @@ #include #include "NetworkCommissioningDriver.h" -#include "ThreadStackManagerImpl.h" namespace chip { namespace DeviceLayer { @@ -38,8 +37,8 @@ namespace NetworkCommissioning { CHIP_ERROR TizenThreadDriver::Init(BaseDriver::NetworkStatusChangeCallback * networkStatusChangeCallback) { - VerifyOrReturnError(ConnectivityMgrImpl().IsThreadAttached(), CHIP_NO_ERROR); - VerifyOrReturnError(ThreadStackMgrImpl().GetThreadProvision(mStagingNetwork) == CHIP_NO_ERROR, CHIP_NO_ERROR); + VerifyOrReturnError(ConnectivityMgr().IsThreadAttached(), CHIP_NO_ERROR); + VerifyOrReturnError(ThreadStackMgr().GetThreadProvision(mStagingNetwork) == CHIP_NO_ERROR, CHIP_NO_ERROR); mSavedNetwork.Init(mStagingNetwork.AsByteSpan()); @@ -133,7 +132,7 @@ void TizenThreadDriver::ConnectNetwork(ByteSpan networkId, ConnectCallback * cal (networkId.size() == Thread::kSizeExtendedPanId && memcmp(networkId.data(), extpanid, Thread::kSizeExtendedPanId) == 0), status = Status::kNetworkNotFound); - VerifyOrExit(DeviceLayer::ThreadStackMgrImpl().AttachToThreadNetwork(mStagingNetwork, callback) == CHIP_NO_ERROR, + VerifyOrExit(DeviceLayer::ThreadStackMgr().AttachToThreadNetwork(mStagingNetwork, callback) == CHIP_NO_ERROR, status = Status::kUnknownError); exit: @@ -145,7 +144,7 @@ void TizenThreadDriver::ConnectNetwork(ByteSpan networkId, ConnectCallback * cal void TizenThreadDriver::ScanNetworks(ThreadDriver::ScanCallback * callback) { - CHIP_ERROR err = DeviceLayer::ThreadStackMgrImpl().StartThreadScan(callback); + CHIP_ERROR err = DeviceLayer::ThreadStackMgr().StartThreadScan(callback); if (err != CHIP_NO_ERROR) { callback->OnFinished(Status::kUnknownError, CharSpan(), nullptr); @@ -179,8 +178,9 @@ ThreadCapabilities TizenThreadDriver::GetSupportedThreadFeatures() uint16_t TizenThreadDriver::GetThreadVersion() { - // TODO Needs to be implemented with Tizen Thread stack api - return 0; + uint16_t version = 0; + DeviceLayer::ThreadStackMgr().GetThreadVersion(version); + return version; } #endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD diff --git a/src/platform/Tizen/ThreadStackManagerImpl.cpp b/src/platform/Tizen/ThreadStackManagerImpl.cpp index 950b6ec300292c..0ae0f8f84ad7c8 100644 --- a/src/platform/Tizen/ThreadStackManagerImpl.cpp +++ b/src/platform/Tizen/ThreadStackManagerImpl.cpp @@ -54,9 +54,12 @@ #include #include +#include #include #include +using chip::DeviceLayer::Internal::TizenToChipError; + namespace chip { namespace DeviceLayer { @@ -514,6 +517,18 @@ CHIP_ERROR ThreadStackManagerImpl::_GetExternalIPv6Address(chip::Inet::IPAddress return CHIP_ERROR_NOT_IMPLEMENTED; } +CHIP_ERROR ThreadStackManagerImpl::_GetThreadVersion(uint16_t & version) +{ + VerifyOrReturnError(mIsInitialized, CHIP_ERROR_UNINITIALIZED); + + int threadErr = thread_get_version(mThreadInstance, &version); + VerifyOrReturnError(threadErr == THREAD_ERROR_NONE, TizenToChipError(threadErr), + ChipLogError(DeviceLayer, "FAIL: Get thread version: %s", get_error_message(threadErr))); + + ChipLogProgress(DeviceLayer, "Thread version [%u]", version); + return CHIP_NO_ERROR; +} + CHIP_ERROR ThreadStackManagerImpl::_GetPollPeriod(uint32_t & buf) { ChipLogError(DeviceLayer, "Not implemented"); diff --git a/src/platform/Tizen/ThreadStackManagerImpl.h b/src/platform/Tizen/ThreadStackManagerImpl.h index 3c0206cfd525fe..2bb0954bc8d25c 100644 --- a/src/platform/Tizen/ThreadStackManagerImpl.h +++ b/src/platform/Tizen/ThreadStackManagerImpl.h @@ -91,15 +91,11 @@ class ThreadStackManagerImpl : public ThreadStackManager bool _HaveMeshConnectivity(); CHIP_ERROR _GetAndLogThreadStatsCounters(); - CHIP_ERROR _GetAndLogThreadTopologyMinimal(); - CHIP_ERROR _GetAndLogThreadTopologyFull(); - CHIP_ERROR _GetPrimary802154MACAddress(uint8_t * buf); - CHIP_ERROR _GetExternalIPv6Address(chip::Inet::IPAddress & addr); - + CHIP_ERROR _GetThreadVersion(uint16_t & version); CHIP_ERROR _GetPollPeriod(uint32_t & buf); void _ResetThreadNetworkDiagnosticsCounts(); diff --git a/src/platform/webos/NetworkCommissioningThreadDriver.cpp b/src/platform/webos/NetworkCommissioningThreadDriver.cpp index 557d3f6f7f7cf7..7a9f5873d57e9c 100644 --- a/src/platform/webos/NetworkCommissioningThreadDriver.cpp +++ b/src/platform/webos/NetworkCommissioningThreadDriver.cpp @@ -211,9 +211,9 @@ ThreadCapabilities LinuxThreadDriver::GetSupportedThreadFeatures() uint16_t LinuxThreadDriver::GetThreadVersion() { - // TODO https://github.com/project-chip/connectedhomeip/issues/30602 - // Needs to be implemented with DBUS io.openthread.BorderRouter Thread API - return 0; + uint16_t version = 0; + ThreadStackMgrImpl().GetThreadVersion(version); + return version; } #endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD diff --git a/src/platform/webos/ThreadStackManagerImpl.cpp b/src/platform/webos/ThreadStackManagerImpl.cpp index cb538fa34ec618..cda82e673ac275 100644 --- a/src/platform/webos/ThreadStackManagerImpl.cpp +++ b/src/platform/webos/ThreadStackManagerImpl.cpp @@ -525,6 +525,13 @@ CHIP_ERROR ThreadStackManagerImpl::_GetExternalIPv6Address(chip::Inet::IPAddress return CHIP_ERROR_NOT_IMPLEMENTED; } +CHIP_ERROR ThreadStackManagerImpl::_GetThreadVersion(uint16_t & version) +{ + // TODO https://github.com/project-chip/connectedhomeip/issues/30602 + // Needs to be implemented with DBUS io.openthread.BorderRouter Thread API + return CHIP_ERROR_NOT_IMPLEMENTED; +} + CHIP_ERROR ThreadStackManagerImpl::_GetPollPeriod(uint32_t & buf) { // TODO: Remove Weave legacy APIs diff --git a/src/platform/webos/ThreadStackManagerImpl.h b/src/platform/webos/ThreadStackManagerImpl.h index b102e16ab568f7..64c3b8f6200bb8 100644 --- a/src/platform/webos/ThreadStackManagerImpl.h +++ b/src/platform/webos/ThreadStackManagerImpl.h @@ -101,7 +101,7 @@ class ThreadStackManagerImpl : public ThreadStackManager CHIP_ERROR _GetPrimary802154MACAddress(uint8_t * buf); CHIP_ERROR _GetExternalIPv6Address(chip::Inet::IPAddress & addr); - + CHIP_ERROR _GetThreadVersion(uint16_t & version); CHIP_ERROR _GetPollPeriod(uint32_t & buf); void _ResetThreadNetworkDiagnosticsCounts(); From eaddbe33b21a5ec0cca0f8a9b25a08d7c53d41cf Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 16 Aug 2024 11:32:18 -0400 Subject: [PATCH 49/59] Copy over data model flags (#34995) --- scripts/build/build/targets.py | 10 ++++++---- scripts/build/builders/host.py | 10 +++++----- scripts/build/testdata/all_targets_linux_x64.txt | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index bf21adf48e22d1..8ab6e2ca4e0d58 100755 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -110,10 +110,9 @@ def BuildHostTarget(): TargetPart('all-clusters-minimal', app=HostApp.ALL_CLUSTERS_MINIMAL), TargetPart('chip-tool', app=HostApp.CHIP_TOOL), TargetPart('thermostat', app=HostApp.THERMOSTAT), - TargetPart('java-matter-controller', - app=HostApp.JAVA_MATTER_CONTROLLER), - TargetPart('kotlin-matter-controller', - app=HostApp.KOTLIN_MATTER_CONTROLLER), + # TODO: controllers depending on a datamodel is odd. For now fix compile dependencies on ember. + TargetPart('java-matter-controller', app=HostApp.JAVA_MATTER_CONTROLLER, data_model_interface="disabled"), + TargetPart('kotlin-matter-controller', app=HostApp.KOTLIN_MATTER_CONTROLLER, data_model_interface="disabled"), TargetPart('minmdns', app=HostApp.MIN_MDNS), TargetPart('light', app=HostApp.LIGHT), TargetPart('lock', app=HostApp.LOCK), @@ -189,6 +188,9 @@ def BuildHostTarget(): target.AppendModifier('enable-dnssd-tests', enable_dnssd_tests=True).OnlyIfRe('-tests') target.AppendModifier('disable-dnssd-tests', enable_dnssd_tests=False).OnlyIfRe('-tests') target.AppendModifier('chip-casting-simplified', chip_casting_simplified=True).OnlyIfRe('-tv-casting-app') + target.AppendModifier('data-model-check', data_model_interface="check").ExceptIfRe('-data-model-(enabled|disabled)') + target.AppendModifier('data-model-disabled', data_model_interface="disabled").ExceptIfRe('-data-model-(check|enabled)') + target.AppendModifier('data-model-enabled', data_model_interface="enabled").ExceptIfRe('-data-model-(check|disabled)') return target diff --git a/scripts/build/builders/host.py b/scripts/build/builders/host.py index 4ea5a9aae0f836..8c03ac7b133501 100644 --- a/scripts/build/builders/host.py +++ b/scripts/build/builders/host.py @@ -317,7 +317,8 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, minmdns_high_verbosity=False, imgui_ui=False, crypto_library: HostCryptoLibrary = None, enable_test_event_triggers=None, enable_dnssd_tests: Optional[bool] = None, - chip_casting_simplified: Optional[bool] = None + chip_casting_simplified: Optional[bool] = None, + data_model_interface: Optional[bool] = None, ): super(HostBuilder, self).__init__( root=os.path.join(root, 'examples', app.ExamplePath()), @@ -352,6 +353,9 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, if use_ubsan: self.extra_gn_options.append('is_ubsan=true') + if data_model_interface is not None: + self.extra_gn_options.append(f'chip_use_data_model_interface="{data_model_interface}"') + if use_dmalloc: self.extra_gn_options.append('chip_config_memory_debug_checks=true') self.extra_gn_options.append('chip_config_memory_debug_dmalloc=true') @@ -457,10 +461,6 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, if self.app == HostApp.SIMULATED_APP2: self.extra_gn_options.append('chip_tests_zap_config="app2"') - if self.app in {HostApp.JAVA_MATTER_CONTROLLER, HostApp.KOTLIN_MATTER_CONTROLLER}: - # TODO: controllers depending on a datamodel is odd. For now fix compile dependencies on ember. - self.extra_gn_options.append('chip_use_data_model_interface="disabled"') - if self.app == HostApp.TESTS and fuzzing_type != HostFuzzingType.NONE: self.build_command = 'fuzz_tests' diff --git a/scripts/build/testdata/all_targets_linux_x64.txt b/scripts/build/testdata/all_targets_linux_x64.txt index a8e5b8770caa63..d202b8aea3c8fb 100644 --- a/scripts/build/testdata/all_targets_linux_x64.txt +++ b/scripts/build/testdata/all_targets_linux_x64.txt @@ -9,7 +9,7 @@ efr32-{brd2704b,brd4316a,brd4317a,brd4318a,brd4319a,brd4186a,brd4187a,brd2601b,b esp32-{m5stack,c3devkit,devkitc,qemu}-{all-clusters,all-clusters-minimal,energy-management,ota-provider,ota-requestor,shell,light,lock,bridge,temperature-measurement,ota-requestor,tests}[-rpc][-ipv6only][-tracing] genio-lighting-app linux-fake-tests[-mbedtls][-boringssl][-asan][-tsan][-ubsan][-libfuzzer][-ossfuzz][-coverage][-dmalloc][-clang] -linux-{x64,arm64}-{rpc-console,all-clusters,all-clusters-minimal,chip-tool,thermostat,java-matter-controller,kotlin-matter-controller,minmdns,light,lock,shell,ota-provider,ota-requestor,simulated-app1,simulated-app2,python-bindings,tv-app,tv-casting-app,bridge,fabric-admin,fabric-bridge,tests,chip-cert,address-resolve-tool,contact-sensor,dishwasher,microwave-oven,refrigerator,rvc,air-purifier,lit-icd,air-quality-sensor,network-manager,energy-management}[-nodeps][-nlfaultinject][-platform-mdns][-minmdns-verbose][-libnl][-same-event-loop][-no-interactive][-ipv6only][-no-ble][-no-wifi][-no-thread][-mbedtls][-boringssl][-asan][-tsan][-ubsan][-libfuzzer][-ossfuzz][-coverage][-dmalloc][-clang][-test][-rpc][-with-ui][-evse-test-event][-enable-dnssd-tests][-disable-dnssd-tests][-chip-casting-simplified] +linux-{x64,arm64}-{rpc-console,all-clusters,all-clusters-minimal,chip-tool,thermostat,java-matter-controller,kotlin-matter-controller,minmdns,light,lock,shell,ota-provider,ota-requestor,simulated-app1,simulated-app2,python-bindings,tv-app,tv-casting-app,bridge,fabric-admin,fabric-bridge,tests,chip-cert,address-resolve-tool,contact-sensor,dishwasher,microwave-oven,refrigerator,rvc,air-purifier,lit-icd,air-quality-sensor,network-manager,energy-management}[-nodeps][-nlfaultinject][-platform-mdns][-minmdns-verbose][-libnl][-same-event-loop][-no-interactive][-ipv6only][-no-ble][-no-wifi][-no-thread][-mbedtls][-boringssl][-asan][-tsan][-ubsan][-libfuzzer][-ossfuzz][-coverage][-dmalloc][-clang][-test][-rpc][-with-ui][-evse-test-event][-enable-dnssd-tests][-disable-dnssd-tests][-chip-casting-simplified][-data-model-check][-data-model-disabled][-data-model-enabled] linux-x64-efr32-test-runner[-clang] imx-{chip-tool,lighting-app,thermostat,all-clusters-app,all-clusters-minimal-app,ota-provider-app}[-release] infineon-psoc6-{lock,light,all-clusters,all-clusters-minimal}[-ota][-updateimage][-trustm] From 18fefb1d2cf5ea23dc38595db7a109e21a664b25 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Fri, 16 Aug 2024 12:44:35 -0400 Subject: [PATCH 50/59] TC-IDM-10.5: Plumb through allow_provisional flag (#35037) --- src/python_testing/TC_DeviceConformance.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/python_testing/TC_DeviceConformance.py b/src/python_testing/TC_DeviceConformance.py index 2a0fe309f20a4c..d847ef6aeb95ec 100644 --- a/src/python_testing/TC_DeviceConformance.py +++ b/src/python_testing/TC_DeviceConformance.py @@ -354,7 +354,8 @@ def test_TC_IDM_10_3(self): def test_TC_IDM_10_5(self): fail_on_extra_clusters = self.user_params.get("fail_on_extra_clusters", True) - success, problems = self.check_device_type(fail_on_extra_clusters) + allow_provisional = self.user_params.get("allow_provisional", False) + success, problems = self.check_device_type(fail_on_extra_clusters, allow_provisional) self.problems.extend(problems) if not success: self.fail_current_test("Problems with Device type conformance on one or more endpoints") From bbc773a07f0953fe19760ac9c8375a2f23ffbac7 Mon Sep 17 00:00:00 2001 From: William Date: Fri, 16 Aug 2024 18:11:05 +0100 Subject: [PATCH 51/59] Fixes the Service Area server's `SkipArea` handling (#35019) * Updated the rvc-example PICS XML files. * update the handling of the SkipArea command to match the latest spec. * Updated the name of SkipCurrentArea to SkipArea in the Instance and Delegate classes. * Refactored SkipCurrentArea names to SkipArea in the RVC example app. * Restyled by clang-format --------- Co-authored-by: Restyled.io --- .../rvc-app/rvc-common/include/rvc-device.h | 4 +- .../include/rvc-service-area-delegate.h | 14 +- .../pics/RVC Clean Mode Cluster Test Plan.xml | 66 +++-- ...VC Operational State Cluster Test Plan.xml | 92 ++++--- .../pics/RVC Run Mode Cluster Test Plan.xml | 83 +++--- .../pics/Service Area Cluster Test Plan.xml | 243 ++++++++++++++++++ .../rvc-app/rvc-common/src/rvc-device.cpp | 2 +- .../src/rvc-service-area-delegate.cpp | 4 +- .../service-area-delegate.h | 2 +- .../service-area-server.cpp | 16 +- .../service-area-server/service-area-server.h | 2 +- 11 files changed, 399 insertions(+), 129 deletions(-) create mode 100644 examples/rvc-app/rvc-common/pics/Service Area Cluster Test Plan.xml diff --git a/examples/rvc-app/rvc-common/include/rvc-device.h b/examples/rvc-app/rvc-common/include/rvc-device.h index b66ce3251feba6..e2011f6c83e196 100644 --- a/examples/rvc-app/rvc-common/include/rvc-device.h +++ b/examples/rvc-app/rvc-common/include/rvc-device.h @@ -61,7 +61,7 @@ class RvcDevice mOperationalStateDelegate.SetGoHomeCallback(&RvcDevice::HandleOpStateGoHomeCallback, this); mServiceAreaDelegate.SetIsSetSelectedAreasAllowedCallback(&RvcDevice::SaIsSetSelectedAreasAllowed, this); - mServiceAreaDelegate.SetHandleSkipCurrentAreaCallback(&RvcDevice::SaHandleSkipCurrentArea, this); + mServiceAreaDelegate.SetHandleSkipAreaCallback(&RvcDevice::SaHandleSkipArea, this); mServiceAreaDelegate.SetIsSupportedAreasChangeAllowedCallback(&RvcDevice::SaIsSupportedAreasChangeAllowed, this); mServiceAreaDelegate.SetIsSupportedMapChangeAllowedCallback(&RvcDevice::SaIsSupportedMapChangeAllowed, this); } @@ -104,7 +104,7 @@ class RvcDevice bool SaIsSetSelectedAreasAllowed(MutableCharSpan & statusText); - bool SaHandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan & skipStatusText); + bool SaHandleSkipArea(uint32_t skippedArea, MutableCharSpan & skipStatusText); bool SaIsSupportedAreasChangeAllowed(); diff --git a/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h b/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h index fdad4f83f0666a..c6be8aa5bb55f0 100644 --- a/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h +++ b/examples/rvc-app/rvc-common/include/rvc-service-area-delegate.h @@ -30,7 +30,7 @@ namespace Clusters { class RvcDevice; typedef bool (RvcDevice::*IsSetSelectedAreasAllowedCallback)(MutableCharSpan & statusText); -typedef bool (RvcDevice::*HandleSkipCurrentAreaCallback)(uint32_t skippedArea, MutableCharSpan & skipStatusText); +typedef bool (RvcDevice::*HandleSkipAreaCallback)(uint32_t skippedArea, MutableCharSpan & skipStatusText); typedef bool (RvcDevice::*IsChangeAllowedSimpleCallback)(); namespace ServiceArea { @@ -46,8 +46,8 @@ class RvcServiceAreaDelegate : public Delegate RvcDevice * mIsSetSelectedAreasAllowedDeviceInstance; IsSetSelectedAreasAllowedCallback mIsSetSelectedAreasAllowedCallback; - RvcDevice * mHandleSkipCurrentAreaDeviceInstance; - HandleSkipCurrentAreaCallback mHandleSkipCurrentAreaCallback; + RvcDevice * mHandleSkipAreaDeviceInstance; + HandleSkipAreaCallback mHandleSkipAreaCallback; RvcDevice * mIsSupportedAreasChangeAllowedDeviceInstance; IsChangeAllowedSimpleCallback mIsSupportedAreasChangeAllowedCallback; RvcDevice * mIsSupportedMapChangeAllowedDeviceInstance; @@ -82,7 +82,7 @@ class RvcServiceAreaDelegate : public Delegate bool IsValidSelectAreasSet(const ServiceArea::Commands::SelectAreas::DecodableType & req, ServiceArea::SelectAreasStatus & areaStatus, MutableCharSpan & statusText) override; - bool HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan & skipStatusText) override; + bool HandleSkipArea(uint32_t skippedArea, MutableCharSpan & skipStatusText) override; //************************************************************************* // Supported Areas accessors @@ -169,10 +169,10 @@ class RvcServiceAreaDelegate : public Delegate mIsSetSelectedAreasAllowedDeviceInstance = instance; } - void SetHandleSkipCurrentAreaCallback(HandleSkipCurrentAreaCallback callback, RvcDevice * instance) + void SetHandleSkipAreaCallback(HandleSkipAreaCallback callback, RvcDevice * instance) { - mHandleSkipCurrentAreaCallback = callback; - mHandleSkipCurrentAreaDeviceInstance = instance; + mHandleSkipAreaCallback = callback; + mHandleSkipAreaDeviceInstance = instance; } void SetIsSupportedAreasChangeAllowedCallback(IsChangeAllowedSimpleCallback callback, RvcDevice * instance) diff --git a/examples/rvc-app/rvc-common/pics/RVC Clean Mode Cluster Test Plan.xml b/examples/rvc-app/rvc-common/pics/RVC Clean Mode Cluster Test Plan.xml index ce0ddaa38b5307..fa0b258557745c 100644 --- a/examples/rvc-app/rvc-common/pics/RVC Clean Mode Cluster Test Plan.xml +++ b/examples/rvc-app/rvc-common/pics/RVC Clean Mode Cluster Test Plan.xml @@ -1,13 +1,20 @@ - + RVC Clean Mode Cluster Test Plan @@ -16,7 +23,7 @@ Draft RVCCLEANM.S Does the device implement the RVCCLEANM cluster as a server? - 89.1. Role - allclusters.html[pdf] + 99.1. Role - allclusters.html[pdf] O true @@ -26,16 +33,14 @@ Draft PIXIT.RVCCLEANM.MODE_CHANGE_FAIL Id of mode the device will fail to transition to, given its current state - 90. PIXIT Definition - allclusters.html[pdf] - O - 0x01 + 100. PIXIT Definition - allclusters.html[pdf] + On/a PIXIT.RVCCLEANM.MODE_CHANGE_OK Id of mode the device will successfully transition to, given its current state - 90. PIXIT Definition - allclusters.html[pdf] - O - 0x01 + 100. PIXIT Definition - allclusters.html[pdf] + On/a @@ -45,31 +50,17 @@ Draft RVCCLEANM.S.A0000 Does the device implement the SupportedModes attribute? - 89.2.2. Attributes - allclusters.html[pdf] + 99.2.1. Attributes - allclusters.html[pdf] M true RVCCLEANM.S.A0001 Does the device implement the CurrentMode attribute? - 89.2.2. Attributes - allclusters.html[pdf] + 99.2.1. Attributes - allclusters.html[pdf] M true - - RVCCLEANM.S.A0002 - Does the device implement the StartUpMode attribute? - 89.2.2. Attributes - allclusters.html[pdf] - O - false - - - RVCCLEANM.S.A0003 - Does the device implement the OnMode attribute? - 89.2.2. Attributes - allclusters.html[pdf] - M - false - @@ -78,7 +69,7 @@ Draft RVCCLEANM.S.C01.Tx Does the device implement sending the ChangeToModeResponse command? - 89.2.4. Commands generated - allclusters.html[pdf] + 99.2.3. Commands generated - allclusters.html[pdf] M true @@ -88,7 +79,7 @@ Draft RVCCLEANM.S.C00.Rsp Does the device implement receiving the ChangeToMode command? - 89.2.3. Commands received - allclusters.html[pdf] + 99.2.2. Commands received - allclusters.html[pdf] M true @@ -96,9 +87,9 @@ Draft - RVCCLEANM.S.F00 - Does the device support depending on an On/Off cluster implemented on the same endpoint? - 89.2.1. Features - allclusters.html[pdf] + RVCCLEANM.S.F16 + Does the device support changing clean modes from non-Idle states? + 101.1. Features - allclusters.html[pdf] O false @@ -108,10 +99,17 @@ Draft RVCCLEANM.S.M.CAN_TEST_MODE_FAILURE Does the DUT support testing the failed ChangeToMode command? - 89.2.5. Manual controllable - allclusters.html[pdf] + 99.2.4. Manual controllable - allclusters.html[pdf] O true + + RVCCLEANM.S.M.CAN_MANUALLY_CONTROLLED + Can the mode change be manually controlled? + 99.2.4. Manual controllable - allclusters.html[pdf] + O + false + diff --git a/examples/rvc-app/rvc-common/pics/RVC Operational State Cluster Test Plan.xml b/examples/rvc-app/rvc-common/pics/RVC Operational State Cluster Test Plan.xml index c600445a35964a..59028fa95e2822 100644 --- a/examples/rvc-app/rvc-common/pics/RVC Operational State Cluster Test Plan.xml +++ b/examples/rvc-app/rvc-common/pics/RVC Operational State Cluster Test Plan.xml @@ -1,11 +1,11 @@ RVC Operational State Cluster Test Plan @@ -15,8 +15,8 @@ Draft RVCOPSTATE.S - Does the device implement the RVC Operational State cluster as a server? - 223.1. Role - allclusters.html[pdf] + Does the device implement the RVC Operational State Cluster as a server? + 238.1. Role - allclusters.html[pdf] O true @@ -30,42 +30,42 @@ Draft RVCOPSTATE.S.A0000 Does the device implement the PhaseList attribute? - 223.2.1. Attributes - allclusters.html[pdf] + 238.2.1. Attributes - allclusters.html[pdf] M true RVCOPSTATE.S.A0001 Does the device implement the CurrentPhase attribute? - 223.2.1. Attributes - allclusters.html[pdf] + 238.2.1. Attributes - allclusters.html[pdf] M true RVCOPSTATE.S.A0002 Does the device implement the CountdownTime attribute? - 223.2.1. Attributes - allclusters.html[pdf] + 238.2.1. Attributes - allclusters.html[pdf] O false RVCOPSTATE.S.A0003 Does the device implement the OperationalStateList attribute? - 223.2.1. Attributes - allclusters.html[pdf] + 238.2.1. Attributes - allclusters.html[pdf] M true RVCOPSTATE.S.A0004 Does the device implement the OperationalState attribute? - 223.2.1. Attributes - allclusters.html[pdf] + 238.2.1. Attributes - allclusters.html[pdf] M true RVCOPSTATE.S.A0005 Does the device implement the OperationalError attribute? - 223.2.1. Attributes - allclusters.html[pdf] + 238.2.1. Attributes - allclusters.html[pdf] M true @@ -75,14 +75,14 @@ Draft RVCOPSTATE.S.E00 Does the device implement the OperationalError Event ? - 223.2.4. Events - allclusters.html[pdf] + 238.2.4. Events - allclusters.html[pdf] M true RVCOPSTATE.S.E01 Does the device implement the OperationCompletion Event ? - 223.2.4. Events - allclusters.html[pdf] + 238.2.4. Events - allclusters.html[pdf] O true @@ -92,8 +92,8 @@ Draft RVCOPSTATE.S.C04.Tx Does the device implement generating the OperationalCommandResponse command? - 223.2.3. Commands generated - allclusters.html[pdf] - M + 238.2.3. Commands generated - allclusters.html[pdf] + M true @@ -102,28 +102,35 @@ Draft RVCOPSTATE.S.C00.Rsp Does the device implement receiving the Pause command? - 223.2.2. Commands received - allclusters.html[pdf] + 238.2.2. Commands received - allclusters.html[pdf] O true RVCOPSTATE.S.C01.Rsp Does the device implement receiving the Stop command? - 223.2.2. Commands received - allclusters.html[pdf] + 238.2.2. Commands received - allclusters.html[pdf] O false RVCOPSTATE.S.C02.Rsp Does the device implement receiving the Start command? - 223.2.2. Commands received - allclusters.html[pdf] + 238.2.2. Commands received - allclusters.html[pdf] O false RVCOPSTATE.S.C03.Rsp Does the device implement receiving the Resume command? - 223.2.2. Commands received - allclusters.html[pdf] + 238.2.2. Commands received - allclusters.html[pdf] + O + true + + + RVCOPSTATE.S.C80.Rsp + Does the device implement receiving the GoHome command? + 238.2.2. Commands received - allclusters.html[pdf] O true @@ -135,136 +142,143 @@ Draft RVCOPSTATE.S.M.ST_STOPPED Does the DUT support testing the Stopped(0x00) operational state? - 223.2.5. Manual controllable - allclusters.html[pdf] + 238.2.5. Manual controllable - allclusters.html[pdf] O true RVCOPSTATE.S.M.ST_RUNNING Does the DUT support testing the Running(0x01) operational state? - 223.2.5. Manual controllable - allclusters.html[pdf] + 238.2.5. Manual controllable - allclusters.html[pdf] O true RVCOPSTATE.S.M.ST_PAUSED Does the DUT support testing the Paused(0x02) operational state? - 223.2.5. Manual controllable - allclusters.html[pdf] + 238.2.5. Manual controllable - allclusters.html[pdf] O true RVCOPSTATE.S.M.ST_ERROR Does the DUT support testing the Error(0x03) operational state? - 223.2.5. Manual controllable - allclusters.html[pdf] + 238.2.5. Manual controllable - allclusters.html[pdf] O true RVCOPSTATE.S.M.ST_SEEKING_CHARGER Does the DUT support testing the SeekingCharger(0x40) operational state? - 223.2.5. Manual controllable - allclusters.html[pdf] + 238.2.5. Manual controllable - allclusters.html[pdf] O true RVCOPSTATE.S.M.ST_CHARGING Does the DUT support testing the Charging(0x41) operational state? - 223.2.5. Manual controllable - allclusters.html[pdf] + 238.2.5. Manual controllable - allclusters.html[pdf] O true RVCOPSTATE.S.M.ST_DOCKED Does the DUT support testing the Docked(0x42) operational state? - 223.2.5. Manual controllable - allclusters.html[pdf] + 238.2.5. Manual controllable - allclusters.html[pdf] O true RVCOPSTATE.S.M.ERR_NO_ERROR Does the DUT support testing the NoError(0x00) error state? - 223.2.5. Manual controllable - allclusters.html[pdf] + 238.2.5. Manual controllable - allclusters.html[pdf] O true RVCOPSTATE.S.M.ERR_UNABLE_TO_START_OR_RESUME Does the DUT support testing the UnableToStartOrResume(0x01) error state? - 223.2.5. Manual controllable - allclusters.html[pdf] + 238.2.5. Manual controllable - allclusters.html[pdf] O true RVCOPSTATE.S.M.ERR_UNABLE_TO_COMPLETE_OPERATION Does the DUT support testing the UnableToCompleteOperation(0x02) error state? - 223.2.5. Manual controllable - allclusters.html[pdf] + 238.2.5. Manual controllable - allclusters.html[pdf] O true RVCOPSTATE.S.M.ERR_COMMAND_INVALID_IN_STATE Does the DUT support testing the CommandInvalidInState(0x03) error state? - 223.2.5. Manual controllable - allclusters.html[pdf] + 238.2.5. Manual controllable - allclusters.html[pdf] O true RVCOPSTATE.S.M.ERR_FAILED_TO_FIND_CHARGING_DOCK Does the DUT support testing the FailedToFindChargingDock(0x40) error state? - 223.2.5. Manual controllable - allclusters.html[pdf] + 238.2.5. Manual controllable - allclusters.html[pdf] O true RVCOPSTATE.S.M.ERR_STUCK Does the DUT support testing the Stuck(0x41) error state? - 223.2.5. Manual controllable - allclusters.html[pdf] + 238.2.5. Manual controllable - allclusters.html[pdf] O true RVCOPSTATE.S.M.ERR_DUST_BIN_MISSING Does the DUT support testing the DustBinMissing(0x42) error state? - 223.2.5. Manual controllable - allclusters.html[pdf] + 238.2.5. Manual controllable - allclusters.html[pdf] O true RVCOPSTATE.S.M.ERR_DUST_BIN_FULL Does the DUT support testing the DustBinFull(0x43) error state? - 223.2.5. Manual controllable - allclusters.html[pdf] + 238.2.5. Manual controllable - allclusters.html[pdf] O true RVCOPSTATE.S.M.ERR_WATER_TANK_EMPTY Does the DUT support testing the WaterTankEmpty(0x44) error state? - 223.2.5. Manual controllable - allclusters.html[pdf] + 238.2.5. Manual controllable - allclusters.html[pdf] O true RVCOPSTATE.S.M.ERR_WATER_TANK_MISSING Does the DUT support testing the WaterTankMissing(0x45) error state? - 223.2.5. Manual controllable - allclusters.html[pdf] + 238.2.5. Manual controllable - allclusters.html[pdf] O true RVCOPSTATE.S.M.ERR_WATER_TANK_LID_OPEN Does the DUT support testing the WaterTankLidOpen(0x46) error state? - 223.2.5. Manual controllable - allclusters.html[pdf] + 238.2.5. Manual controllable - allclusters.html[pdf] O true RVCOPSTATE.S.M.ERR_MOP_CLEANING_PAD_MISSING Does the DUT support testing the MopCleaningPadMissing(0x47) error state? - 223.2.5. Manual controllable - allclusters.html[pdf] + 238.2.5. Manual controllable - allclusters.html[pdf] O true + + RVCOPSTATE.S.M.RESUME_AFTER_ERR + Does the DUT support testing the Resume command after cleared error? + 238.2.5. Manual controllable - allclusters.html[pdf] + O + false + diff --git a/examples/rvc-app/rvc-common/pics/RVC Run Mode Cluster Test Plan.xml b/examples/rvc-app/rvc-common/pics/RVC Run Mode Cluster Test Plan.xml index 0bdd95322e213b..a3305b8b92de51 100644 --- a/examples/rvc-app/rvc-common/pics/RVC Run Mode Cluster Test Plan.xml +++ b/examples/rvc-app/rvc-common/pics/RVC Run Mode Cluster Test Plan.xml @@ -1,13 +1,19 @@ - + RVC Run Mode Cluster Test Plan @@ -16,7 +22,7 @@ Draft RVCRUNM.S Does the device implement the RVCRUNM cluster as a server? - 84.1. Role - allclusters.html[pdf] + 93.1. Role - allclusters.html[pdf] O true @@ -26,16 +32,26 @@ Draft PIXIT.RVCRUNM.MODE_CHANGE_FAIL Id of mode the device will fail to transition to, given its current state - 85. PIXIT Definition - allclusters.html[pdf] - O - 0x02 + 95. PIXIT Definition - allclusters.html[pdf] + O PIXIT.RVCRUNM.MODE_CHANGE_OK Id of mode the device will successfully transition to, given its current state - 85. PIXIT Definition - allclusters.html[pdf] - O - 0x00 + 95. PIXIT Definition - allclusters.html[pdf] + O + + + PIXIT.RVCRUNM.MODE_A + Id of non-Idle mode the device can successfully switch to, given its current state + 95. PIXIT Definition - allclusters.html[pdf] + O0x01 + + + PIXIT.RVCRUNM.MODE_B + Id of non-Idle mode the device can successfully switch to, given its current state + 95. PIXIT Definition - allclusters.html[pdf] + O0x02 @@ -45,31 +61,17 @@ Draft RVCRUNM.S.A0000 Does the device implement the SupportedModes attribute? - 84.2.2. Attributes - allclusters.html[pdf] + 93.2.1. Attributes - allclusters.html[pdf] M true RVCRUNM.S.A0001 Does the device implement the CurrentMode attribute? - 84.2.2. Attributes - allclusters.html[pdf] + 93.2.1. Attributes - allclusters.html[pdf] M true - - RVCRUNM.S.A0002 - Does the device implement the StartUpMode attribute? - 84.2.2. Attributes - allclusters.html[pdf] - O - false - - - RVCRUNM.S.A0003 - Does the device implement the OnMode attribute? - 84.2.2. Attributes - allclusters.html[pdf] - M - false - @@ -78,7 +80,7 @@ Draft RVCRUNM.S.C01.Tx Does the device implement sending the ChangeToModeResponse command? - 84.2.4. Commands generated - allclusters.html[pdf] + 93.2.3. Commands generated - allclusters.html[pdf] M true @@ -88,7 +90,7 @@ Draft RVCRUNM.S.C00.Rsp Does the device implement receiving the ChangeToMode command? - 84.2.3. Commands received - allclusters.html[pdf] + 93.2.2. Commands received - allclusters.html[pdf] M true @@ -96,9 +98,9 @@ Draft - RVCRUNM.S.F00 - Does the device support depending on an On/Off cluster implemented on the same endpoint? - 84.2.1. Features - allclusters.html[pdf] + RVCRUNM.S.F16 + Does the device support support changing run modes from non-Idle states? + 94.1. Features - allclusters.html[pdf] O false @@ -108,10 +110,23 @@ Draft RVCRUNM.S.M.CAN_TEST_MODE_FAILURE Does the DUT support testing the failed ChangeToMode command? - 84.2.5. Manual controllable - allclusters.html[pdf] + 93.2.4. Manual controllable - allclusters.html[pdf] O true + + RVCRUNM.S.M.CAN_MANUALLY_CONTROLLED + Can the mode change be manually controlled? + 93.2.4. Manual controllable - allclusters.html[pdf] + O + true + + + RVCOPSTATE.M.ST_STOPPED | RVCOPSTATE.M.ST_PAUSED | RVCOPSTATE.M.ST_CHARGING | RVCOPSTATE.M.ST_DOCKED + 97.2.2. [TC-RVCRUNM-2.2] Change to Mode restrictions with DUT as Server - allclusters.html[pdf] + O + true + diff --git a/examples/rvc-app/rvc-common/pics/Service Area Cluster Test Plan.xml b/examples/rvc-app/rvc-common/pics/Service Area Cluster Test Plan.xml new file mode 100644 index 00000000000000..665504f1a2a6bb --- /dev/null +++ b/examples/rvc-app/rvc-common/pics/Service Area Cluster Test Plan.xml @@ -0,0 +1,243 @@ + + + Service Area Cluster Test Plan + + + + + + SEAR.S + Does the device implement the Service Area cluster as a server? + 306.1. Role - allclusters.html[pdf] + O + true + + + + + + + + + + SEAR.S.A0000 + Does the device implement the SupportedAreas attribute? + 306.2.2. Attributes - allclusters.html[pdf] + M + true + + + SEAR.S.A0001 + Does the device implement the SupportedMaps attribute? + 306.2.2. Attributes - allclusters.html[pdf] + M + true + + + SEAR.S.A0002 + Does the device implement the SelectedAreas attribute? + 306.2.2. Attributes - allclusters.html[pdf] + M + true + + + SEAR.S.A0003 + Does the device implement the CurrentArea attribute? + 306.2.2. Attributes - allclusters.html[pdf] + O + true + + + SEAR.S.A0004 + Does the device implement the EstimatedEndTime attribute? + 306.2.2. Attributes - allclusters.html[pdf] + O + true + + + SEAR.S.A0005 + Does the device implement the Progress attribute? + 306.2.2. Attributes - allclusters.html[pdf] + M + true + + + + + + + + SEAR.S.C01.Tx + Does the device implement generating the SelectAreasResponse command? + 306.2.4. Commands generated - allclusters.html[pdf] + M + true + + + SEAR.S.C03.Tx + Does the device implement generating the SkipAreaResponse command? + 306.2.4. Commands generated - allclusters.html[pdf] + M + true + + + + + + SEAR.S.C00.Rsp + Does the device implement receiving the SelectAreas command? + 306.2.3. Commands received - allclusters.html[pdf] + M + true + + + SEAR.S.C02.Rsp + Does the device implement receiving the SkipArea command? + 306.2.3. Commands received - allclusters.html[pdf] + O + true + + + + + + SEAR.S.F00 + Does the device support changing the selected areas while running? + 306.2.1. Features - allclusters.html[pdf] + O + false + + + SEAR.S.F01 + Does the device support reporting the progress? + 306.2.1. Features - allclusters.html[pdf] + O + true + + + SEAR.S.F02 + Does the device support the maps feature? + 306.2.1. Features - allclusters.html[pdf] + O + true + + + + + + SEAR.S.M.REMOVE_AREA + Does the DUT support testing the effects of removing a SupportedAreas entry? + 306.2.5. Manual controllable - allclusters.html[pdf] + O + true + + + SEAR.S.M.ADD_AREA + Does the DUT support testing the effects of adding a SupportedAreas entry? + 306.2.5. Manual controllable - allclusters.html[pdf] + O + true + + + SEAR.S.M.REMOVE_MAP + Does the DUT support testing the effects of removing a SupportedMaps entry? + 306.2.5. Manual controllable - allclusters.html[pdf] + O + true + + + SEAR.S.M.ADD_MAP + Does the DUT support testing the effects of adding a SupportedMaps entry? + 306.2.5. Manual controllable - allclusters.html[pdf] + O + true + + + SEAR.S.M.INVALID_STATE_FOR_SELECT_AREAS + Does the DUT support testing the selecting areas while the device doesn’t allow that? + 306.2.5. Manual controllable - allclusters.html[pdf] + O + true + + + SEAR.S.M.VALID_STATE_FOR_SELECT_AREAS + Does the DUT support testing the selecting areas while the device allows that? + 306.2.5. Manual controllable - allclusters.html[pdf] + O + false + + + SEAR.S.M.SELECT_AREAS_WHILE_NON_IDLE + Does the DUT support testing the selecting areas while the device is a non-idle state? + 306.2.5. Manual controllable - allclusters.html[pdf] + O + true + + + SEAR.S.M.HAS_MANUAL_SELAREA_STATE_CONTROL + Can the device state affecting SelectAreas be manually controlled? + 306.2.5. Manual controllable - allclusters.html[pdf] + O + true + + + SEAR.S.M.HAS_MANUAL_SKIP_STATE_CONTROL + Can the device state affecting SkipArea be manually controlled? + 306.2.5. Manual controllable - allclusters.html[pdf] + O + true + + + SEAR.S.M.INVALID_STATE_FOR_SKIP + Does the DUT support testing the SkipArea command while the device doesn’t allow that? + 306.2.5. Manual controllable - allclusters.html[pdf] + O + true + + + SEAR.S.M.NO_SELAREA_FOR_SKIP + Does the DUT support testing the SkipArea command while SelectedAreas is null? + 306.2.5. Manual controllable - allclusters.html[pdf] + O + true + + + SEAR.S.M.VALID_STATE_FOR_SKIP + Does the DUT support testing the SkipArea command while the device allows that? + 306.2.5. Manual controllable - allclusters.html[pdf] + O + true + + + SEAR.S.M.HAS_MANUAL_OPERATING_STATE_CONTROL + Can the device operating state (idle, operating, terminate operating) be manually controlled? + 306.2.5. Manual controllable - allclusters.html[pdf] + O + true + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/rvc-app/rvc-common/src/rvc-device.cpp b/examples/rvc-app/rvc-common/src/rvc-device.cpp index 623c95963f8834..dac7db9e43708e 100644 --- a/examples/rvc-app/rvc-common/src/rvc-device.cpp +++ b/examples/rvc-app/rvc-common/src/rvc-device.cpp @@ -174,7 +174,7 @@ bool RvcDevice::SaIsSetSelectedAreasAllowed(MutableCharSpan & statusText) return true; } -bool RvcDevice::SaHandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan & skipStatusText) +bool RvcDevice::SaHandleSkipArea(uint32_t skippedArea, MutableCharSpan & skipStatusText) { if (mServiceAreaInstance.GetCurrentArea() != skippedArea) { diff --git a/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp b/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp index 984472977a0356..9041efd3d9105b 100644 --- a/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp +++ b/examples/rvc-app/rvc-common/src/rvc-service-area-delegate.cpp @@ -180,9 +180,9 @@ bool RvcServiceAreaDelegate::IsValidSelectAreasSet(const Commands::SelectAreas:: return true; }; -bool RvcServiceAreaDelegate::HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan & skipStatusText) +bool RvcServiceAreaDelegate::HandleSkipArea(uint32_t skippedArea, MutableCharSpan & skipStatusText) { - return (mHandleSkipCurrentAreaDeviceInstance->*mHandleSkipCurrentAreaCallback)(skippedArea, skipStatusText); + return (mHandleSkipAreaDeviceInstance->*mHandleSkipAreaCallback)(skippedArea, skipStatusText); }; //************************************************************************* diff --git a/src/app/clusters/service-area-server/service-area-delegate.h b/src/app/clusters/service-area-server/service-area-delegate.h index 01df2faeb06488..2e9422840aa847 100644 --- a/src/app/clusters/service-area-server/service-area-delegate.h +++ b/src/app/clusters/service-area-server/service-area-delegate.h @@ -120,7 +120,7 @@ class Delegate * InvalidInMode, the StatusText field SHOULD indicate why the request is not allowed, given the current mode of the * device, which may involve other clusters. */ - virtual bool HandleSkipCurrentArea(uint32_t skippedArea, MutableCharSpan & skipStatusText) + virtual bool HandleSkipArea(uint32_t skippedArea, MutableCharSpan & skipStatusText) { // device support of this command is optional CopyCharSpanToMutableCharSpan("Skip Current Area command not supported by device"_span, skipStatusText); diff --git a/src/app/clusters/service-area-server/service-area-server.cpp b/src/app/clusters/service-area-server/service-area-server.cpp index 0e562c78754d5b..a7e81278838ae6 100644 --- a/src/app/clusters/service-area-server/service-area-server.cpp +++ b/src/app/clusters/service-area-server/service-area-server.cpp @@ -123,7 +123,7 @@ void Instance::InvokeCommand(HandlerContext & handlerContext) case Commands::SkipArea::Id: return CommandHandlerInterface::HandleCommand( - handlerContext, [this](HandlerContext & ctx, const auto & req) { HandleSkipCurrentAreaCmd(ctx, req); }); + handlerContext, [this](HandlerContext & ctx, const auto & req) { HandleSkipAreaCmd(ctx, req); }); } } @@ -356,11 +356,11 @@ void Instance::HandleSelectAreasCmd(HandlerContext & ctx, const Commands::Select exitResponse(SelectAreasStatus::kSuccess, ""_span); } -void Instance::HandleSkipCurrentAreaCmd(HandlerContext & ctx, const Commands::SkipArea::DecodableType & req) +void Instance::HandleSkipAreaCmd(HandlerContext & ctx, const Commands::SkipArea::DecodableType & req) { - ChipLogDetail(Zcl, "Service Area: HandleSkipCurrentArea"); + ChipLogDetail(Zcl, "Service Area: HandleSkipArea"); - // On receipt of this command the device SHALL respond with a SkipCurrentAreaResponse command. + // On receipt of this command the device SHALL respond with a SkipAreaResponse command. auto exitResponse = [ctx](SkipAreaStatus status, CharSpan statusText) { Commands::SkipAreaResponse::Type response{ .status = status, @@ -369,11 +369,11 @@ void Instance::HandleSkipCurrentAreaCmd(HandlerContext & ctx, const Commands::Sk ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response); }; - // If the SelectedAreas attribute is null, the response status should be set to InvalidAreaList. + // The SkippedArea field SHALL match an entry in the SupportedAreas list. // If the Status field is set to InvalidAreaList, the StatusText field SHALL be an empty string. - if (mDelegate->GetNumberOfSelectedAreas() == 0) + if (!IsSupportedArea(req.skippedArea)) { - ChipLogError(Zcl, "Selected Areas attribute is null"); + ChipLogError(Zcl, "SkippedArea (%u) is not in the SupportedAreas attribute.", req.skippedArea); exitResponse(SkipAreaStatus::kInvalidAreaList, ""_span); return; } @@ -394,7 +394,7 @@ void Instance::HandleSkipCurrentAreaCmd(HandlerContext & ctx, const Commands::Sk char skipStatusBuffer[kMaxSizeStatusText]; MutableCharSpan skipStatusText(skipStatusBuffer); - if (!mDelegate->HandleSkipCurrentArea(req.skippedArea, skipStatusText)) + if (!mDelegate->HandleSkipArea(req.skippedArea, skipStatusText)) { exitResponse(SkipAreaStatus::kInvalidInMode, skipStatusText); return; diff --git a/src/app/clusters/service-area-server/service-area-server.h b/src/app/clusters/service-area-server/service-area-server.h index 811499f3ff7fb2..e023f24d129261 100644 --- a/src/app/clusters/service-area-server/service-area-server.h +++ b/src/app/clusters/service-area-server/service-area-server.h @@ -124,7 +124,7 @@ class Instance : public AttributeAccessInterface, public CommandHandlerInterface * If the input value is invalid, returns the Interaction Model status code of INVALID_COMMAND. * @param[in] req the command parameters. */ - void HandleSkipCurrentAreaCmd(HandlerContext & ctx, const Commands::SkipArea::DecodableType & req); + void HandleSkipAreaCmd(HandlerContext & ctx, const Commands::SkipArea::DecodableType & req); //************************************************************************* // attribute notifications From 15032f18656d2f95c5e162de721e9f36355cf1e5 Mon Sep 17 00:00:00 2001 From: Tennessee Carmel-Veilleux Date: Fri, 16 Aug 2024 13:15:40 -0400 Subject: [PATCH 52/59] Minimal TC_SWTCH fixes for 1.4-TE2 (#34986) - Fixes only issues raised on script that block success - https://github.com/project-chip/matter-test-scripts/issues/337 - https://github.com/project-chip/matter-test-scripts/issues/338 - Fixes done: - Prompt text improvement/fixes - Fixed crash in 2.5/2.6 --- src/python_testing/TC_SWTCH.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/python_testing/TC_SWTCH.py b/src/python_testing/TC_SWTCH.py index e2ef307973003b..d6c4694560b16d 100644 --- a/src/python_testing/TC_SWTCH.py +++ b/src/python_testing/TC_SWTCH.py @@ -114,7 +114,7 @@ def _ask_for_switch_position(self, endpoint_id: int, new_position: int): def _ask_for_multi_press_short_long(self, endpoint_id: int, pressed_position: int, feature_map: uint, multi_press_max: uint): if not self._use_button_simulator(): msg = f""" - Actuate the switch in the following sequence: + Actuate the switch in the following sequence (read full sequence first): 1. Operate switch (press briefly) associated with position {pressed_position} on the DUT then release switch from DUT 2. Operate switch (keep pressed for long time, e.g. 5 seconds) on the DUT immediately after the previous step 3. Release switch from the DUT @@ -128,7 +128,7 @@ def _ask_for_multi_press_short_long(self, endpoint_id: int, pressed_position: in def _ask_for_multi_press_long_short(self, endpoint_id, pressed_position, feature_map: int): if not self._use_button_simulator(): msg = f""" - Actuate the switch in the following sequence: + Actuate the switch in the following sequence (read full sequence first): 1. Operate switch (keep pressed for long time, e.g. 5 seconds) on the DUT 2. Releases switch from the DUT 3. Immediately after the previous step completes, operate switch (press briefly) associated with position {pressed_position} on the DUT then release switch from DUT @@ -142,7 +142,7 @@ def _ask_for_multi_press_long_short(self, endpoint_id, pressed_position, feature def _ask_for_multi_press(self, endpoint_id: int, number_of_presses: int, pressed_position: int, feature_map: uint, multi_press_max: uint): if not self._use_button_simulator(): self.wait_for_user_input( - f'Operate the switch (press briefly) associated with position {pressed_position} then release {number_of_presses} times') + f'Execute {number_of_presses} separate brief press/release cycles on position {pressed_position}.') else: self._send_multi_press_named_pipe_command(endpoint_id, number_of_presses, pressed_position, feature_map, multi_press_max) @@ -157,7 +157,7 @@ def _ask_for_long_press(self, endpoint_id: int, pressed_position: int, feature_m def _ask_for_keep_pressed(self, endpoint_id: int, pressed_position: int, feature_map: int): if not self._use_button_simulator(): self.wait_for_user_input( - prompt_msg=f"Press switch position {pressed_position} for a long time (around 5 seconds) on the DUT, then release it.") + prompt_msg=f"Press switch position {pressed_position} for a long time (around 5 seconds) on the DUT, keep it pressed, do NOT release it.") else: self._send_long_press_named_pipe_command(endpoint_id, pressed_position, feature_map) @@ -676,7 +676,7 @@ def test_multi_press_sequence(starting_step: str, count: int, short_long: bool = asserts.assert_equal(event.newPosition, pressed_position, "Unexpected NewPosition on LongPress") event = event_listener.wait_for_event_report(cluster.Events.LongRelease) asserts.assert_equal(event.previousPosition, pressed_position, "Unexpected PreviousPosition on LongRelease") - if self._use_button_simulator: + if self._use_button_simulator(): # simulator can't sequence so we need to help it along here self._send_multi_press_named_pipe_command(endpoint_id, number_of_presses=1, pressed_position=1, feature_map=feature_map, multi_press_max=multi_press_max) @@ -839,7 +839,7 @@ def test_multi_press_sequence(starting_step: str, count: int, short_long: bool = asserts.assert_equal(event.newPosition, pressed_position, "Unexpected NewPosition on LongPress") event = event_listener.wait_for_event_report(cluster.Events.LongRelease) asserts.assert_equal(event.previousPosition, pressed_position, "Unexpected PreviousPosition on LongRelease") - if self._use_button_simulator: + if self._use_button_simulator(): # simulator can't sequence so we need to help it along here self._send_multi_press_named_pipe_command(endpoint_id, number_of_presses=1, pressed_position=1, feature_map=feature_map, multi_press_max=multi_press_max) From 4e6847d085c069e31ab0c256b7f03857ae4a7ba0 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 16 Aug 2024 14:30:44 -0400 Subject: [PATCH 53/59] [MCORE.FS 1.3] make "app not found" easier to debug (#35038) * Remove unused method, make missing app error easier to find * Remove more todo for confirm we can run apps: we confirmed we can --------- Co-authored-by: Andrei Litvin --- src/python_testing/TC_CCTRL_2_2.py | 1 - src/python_testing/TC_MCORE_FS_1_1.py | 1 - src/python_testing/TC_MCORE_FS_1_3.py | 36 +++++++++------------------ 3 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/python_testing/TC_CCTRL_2_2.py b/src/python_testing/TC_CCTRL_2_2.py index 53c196113d36bc..4d11692d14ba24 100644 --- a/src/python_testing/TC_CCTRL_2_2.py +++ b/src/python_testing/TC_CCTRL_2_2.py @@ -44,7 +44,6 @@ class TC_CCTRL_2_2(MatterBaseTest): @async_test_body async def setup_class(self): super().setup_class() - # TODO: confirm whether we can open processes like this on the TH self.app_process = None app = self.user_params.get("th_server_app_path", None) if not app: diff --git a/src/python_testing/TC_MCORE_FS_1_1.py b/src/python_testing/TC_MCORE_FS_1_1.py index 6753db81a3a4cf..f64b718e96f2e8 100755 --- a/src/python_testing/TC_MCORE_FS_1_1.py +++ b/src/python_testing/TC_MCORE_FS_1_1.py @@ -36,7 +36,6 @@ class TC_MCORE_FS_1_1(MatterBaseTest): @async_test_body async def setup_class(self): super().setup_class() - # TODO: confirm whether we can open processes like this on the TH self.app_process = None app = self.user_params.get("th_server_app_path", None) if not app: diff --git a/src/python_testing/TC_MCORE_FS_1_3.py b/src/python_testing/TC_MCORE_FS_1_3.py index 791d3785f28395..e707b500a6fba8 100644 --- a/src/python_testing/TC_MCORE_FS_1_3.py +++ b/src/python_testing/TC_MCORE_FS_1_3.py @@ -68,18 +68,25 @@ def teardown_class(self): super().teardown_class() async def create_device_and_commission_to_th_fabric(self, kvs, port, node_id_for_th, device_info): - # TODO: confirm whether we can open processes like this on the TH app = self.user_params.get("th_server_app_path", None) if not app: asserts.fail('This test requires a TH_SERVER app. Specify app path with --string-arg th_server_app_path:') + if not os.path.exists(app): + asserts.fail(f'The path {app} does not exist') + discriminator = random.randint(0, 4095) passcode = 20202021 - app_args = f'--secured-device-port {port} --discriminator {discriminator} --passcode {passcode} --KVS {kvs}' - cmd = f'{app} {app_args}' + + cmd = [app] + cmd.extend(['--secured-device-port', str(port)]) + cmd.extend(['--discriminator', str(discriminator)]) + cmd.extend(['--passcode', str(passcode)]) + cmd.extend(['--KVS', kvs]) + # TODO: Determine if we want these logs cooked or pushed to somewhere else logging.info(f"Starting TH device for {device_info}") - self.app_process_for_dut_eco = subprocess.Popen(cmd, bufsize=0, shell=True) + self.app_process_for_dut_eco = subprocess.Popen(cmd) logging.info(f"Started TH device for {device_info}") time.sleep(3) @@ -87,26 +94,6 @@ async def create_device_and_commission_to_th_fabric(self, kvs, port, node_id_for await self.TH_server_controller.CommissionOnNetwork(nodeId=node_id_for_th, setupPinCode=passcode, filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=discriminator) logging.info("Commissioning device for DUT ecosystem onto TH for managing") - async def create_and_commission_device_for_th_ecosystem(self): - # TODO: confirm whether we can open processes like this on the TH - app = self.user_params.get("th_server_app_path", None) - - self.device_for_th_eco_kvs = f'kvs_{str(uuid.uuid4())}' - discriminator = random.randint(0, 4095) - passcode = 20202021 - app_args = f'--secured-device-port {self.device_for_th_eco_port} --discriminator {discriminator} --passcode {passcode} --KVS {self.device_for_th_eco_kvs}' - cmd = f'{app} {app_args}' - # TODO: Determine if we want these logs cooked or pushed to somewhere else - logging.info("Starting TH device for TH ecosystem") - self.app_process_for_th_eco = subprocess.Popen(cmd, bufsize=0, shell=True) - logging.info("Started TH device for TH ecosystem") - time.sleep(3) - - logging.info("Commissioning from separate fabric") - self.server_nodeid = 1112 - await self.TH_server_controller.CommissionOnNetwork(nodeId=self.server_nodeid, setupPinCode=passcode, filterType=ChipDeviceCtrl.DiscoveryFilterType.LONG_DISCRIMINATOR, filter=discriminator) - logging.info("Commissioning TH device for TH ecosystem") - def steps_TC_MCORE_FS_1_3(self) -> list[TestStep]: steps = [TestStep(1, "DUT_FSA commissions TH_SED_DUT to DUT_FSAs fabric and generates a UniqueID", is_commissioning=True), TestStep(2, "TH_FSA commissions TH_SED_TH onto TH_FSAs fabric and generates a UniqueID."), @@ -127,6 +114,7 @@ async def test_TC_MCORE_FS_1_3(self): kvs = f'kvs_{str(uuid.uuid4())}' device_info = "for DUT ecosystem" await self.create_device_and_commission_to_th_fabric(kvs, self.device_for_dut_eco_port, self.device_for_dut_eco_nodeid, device_info) + self.device_for_dut_eco_kvs = kvs read_result = await self.TH_server_controller.ReadAttribute(self.device_for_dut_eco_nodeid, [(root_node_endpoint, Clusters.BasicInformation.Attributes.UniqueID)]) result = read_result[root_node_endpoint][Clusters.BasicInformation][Clusters.BasicInformation.Attributes.UniqueID] From e0a4e792d03a9e03cbf1b3911a7cc74fb6f99e61 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Fri, 16 Aug 2024 12:55:30 -0700 Subject: [PATCH 54/59] [FS Example] Update the FS Example apps to support fabric sync setup process part II (#34990) * examples/fabric-bridge-app/linux/CommissionerControl.cpp * Implement reverse commissioning * Update function names to align with spec --- .../protos/fabric_admin_service.options | 1 + .../pigweed/protos/fabric_admin_service.proto | 9 ++ .../common/pigweed/rpc_services/FabricAdmin.h | 5 + .../commands/clusters/ClusterCommand.h | 9 +- .../device_manager/DeviceManager.cpp | 107 ++++++++++++------ .../device_manager/DeviceManager.h | 14 ++- examples/fabric-admin/rpc/RpcServer.cpp | 40 +++++++ .../fabric-bridge-common/BUILD.gn | 2 - examples/fabric-bridge-app/linux/BUILD.gn | 1 + .../src => linux}/CommissionerControl.cpp | 51 +++++++-- .../fabric-bridge-app/linux/RpcClient.cpp | 25 ++++ .../include/CommissionerControl.h | 10 +- .../linux/include/RpcClient.h | 11 ++ examples/fabric-bridge-app/linux/main.cpp | 4 +- .../commissioner-control-server.cpp | 6 +- .../commissioner-control-server.h | 13 +-- 16 files changed, 235 insertions(+), 73 deletions(-) rename examples/fabric-bridge-app/{fabric-bridge-common/src => linux}/CommissionerControl.cpp (70%) rename examples/fabric-bridge-app/{fabric-bridge-common => linux}/include/CommissionerControl.h (80%) diff --git a/examples/common/pigweed/protos/fabric_admin_service.options b/examples/common/pigweed/protos/fabric_admin_service.options index 9a65ae8a2b61d1..c7dbc02f1b5a2a 100644 --- a/examples/common/pigweed/protos/fabric_admin_service.options +++ b/examples/common/pigweed/protos/fabric_admin_service.options @@ -1,2 +1,3 @@ chip.rpc.DeviceCommissioningWindowInfo.verifier max_size:97 // kSpake2p_VerifierSerialized_Length chip.rpc.DeviceCommissioningWindowInfo.salt max_size:32 // kSpake2p_Max_PBKDF_Salt_Length +chip.rpc.DeviceCommissioningInfo.salt max_size:32 // kSpake2p_Max_PBKDF_Salt_Length diff --git a/examples/common/pigweed/protos/fabric_admin_service.proto b/examples/common/pigweed/protos/fabric_admin_service.proto index b2c81d5ee0eaae..3c311493d1c6f3 100644 --- a/examples/common/pigweed/protos/fabric_admin_service.proto +++ b/examples/common/pigweed/protos/fabric_admin_service.proto @@ -14,6 +14,14 @@ message DeviceCommissioningWindowInfo { bytes verifier = 6; } +// Define the message for commissioning a device with necessary fields +message DeviceCommissioningInfo { + uint32 discriminator = 1; + uint32 iterations = 2; + uint32 setup_pin = 3; + bytes salt = 4; +} + message KeepActiveParameters { uint64 node_id = 1; uint32 stay_active_duration_ms = 2; @@ -26,5 +34,6 @@ message OperationStatus { service FabricAdmin { rpc OpenCommissioningWindow(DeviceCommissioningWindowInfo) returns (OperationStatus){} + rpc CommissionNode(DeviceCommissioningInfo) returns (pw.protobuf.Empty){} rpc KeepActive(KeepActiveParameters) returns (pw.protobuf.Empty){} } diff --git a/examples/common/pigweed/rpc_services/FabricAdmin.h b/examples/common/pigweed/rpc_services/FabricAdmin.h index 125d322e3ab8bf..256b06c73e4fd5 100644 --- a/examples/common/pigweed/rpc_services/FabricAdmin.h +++ b/examples/common/pigweed/rpc_services/FabricAdmin.h @@ -40,6 +40,11 @@ class FabricAdmin : public pw_rpc::nanopb::FabricAdmin::Service return pw::Status::Unimplemented(); } + virtual pw::Status CommissionNode(const chip_rpc_DeviceCommissioningInfo & request, pw_protobuf_Empty & response) + { + return pw::Status::Unimplemented(); + } + virtual pw::Status KeepActive(const chip_rpc_KeepActiveParameters & request, pw_protobuf_Empty & response) { return pw::Status::Unimplemented(); diff --git a/examples/fabric-admin/commands/clusters/ClusterCommand.h b/examples/fabric-admin/commands/clusters/ClusterCommand.h index 4865f056e135f4..ab2a535da41cc5 100644 --- a/examples/fabric-admin/commands/clusters/ClusterCommand.h +++ b/examples/fabric-admin/commands/clusters/ClusterCommand.h @@ -84,14 +84,7 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub if (data != nullptr) { LogErrorOnFailure(RemoteDataModelLogger::LogCommandAsJSON(path, data)); - - error = DataModelLogger::LogCommand(path, data); - if (CHIP_NO_ERROR != error) - { - ChipLogError(NotSpecified, "Response Failure: Can not decode Data"); - mError = error; - return; - } + DeviceMgr().HandleCommandResponse(path, data); } } diff --git a/examples/fabric-admin/device_manager/DeviceManager.cpp b/examples/fabric-admin/device_manager/DeviceManager.cpp index 17adcc2427f9c6..fe0c8aea4da5cb 100644 --- a/examples/fabric-admin/device_manager/DeviceManager.cpp +++ b/examples/fabric-admin/device_manager/DeviceManager.cpp @@ -56,12 +56,12 @@ void DeviceManager::Init() NodeId DeviceManager::GetNextAvailableNodeId() { mLastUsedNodeId++; - VerifyOrDieWithMsg(mLastUsedNodeId < std::numeric_limits::max(), NotSpecified, "No more available NodeIds."); + VerifyOrDieWithMsg(mLastUsedNodeId < std::numeric_limits::max(), NotSpecified, "No more available NodeIds."); return mLastUsedNodeId; } -void DeviceManager::UpdateLastUsedNodeId(chip::NodeId nodeId) +void DeviceManager::UpdateLastUsedNodeId(NodeId nodeId) { if (nodeId > mLastUsedNodeId) { @@ -159,7 +159,7 @@ void DeviceManager::PairRemoteFabricBridge(NodeId nodeId, const char * deviceRem PushCommand(commandBuilder.c_str()); } -void DeviceManager::PairRemoteDevice(chip::NodeId nodeId, const char * payload) +void DeviceManager::PairRemoteDevice(NodeId nodeId, const char * payload) { StringBuilder commandBuilder; @@ -238,7 +238,7 @@ void DeviceManager::ReadSupportedDeviceCategories() PushCommand(commandBuilder.c_str()); } -void DeviceManager::StartReverseCommissioning() +void DeviceManager::RequestCommissioningApproval() { ChipLogProgress(NotSpecified, "Starting reverse commissioning for bridge device: NodeId: " ChipLogFormatX64, ChipLogValueX64(mRemoteBridgeNodeId)); @@ -255,7 +255,36 @@ void DeviceManager::StartReverseCommissioning() PushCommand(commandBuilder.c_str()); } -void DeviceManager::CommissionApprovedRequest(uint64_t requestId, uint16_t responseTimeoutSeconds) +void DeviceManager::HandleCommissioningRequestResult(TLV::TLVReader * data) +{ + ChipLogProgress(NotSpecified, "CommissioningRequestResult event received."); + + CommissionerControl::Events::CommissioningRequestResult::DecodableType value; + CHIP_ERROR error = app::DataModel::Decode(*data, value); + if (error != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to decode event value. Error: %" CHIP_ERROR_FORMAT, error.Format()); + return; + } + + if (value.requestId != mRequestId) + { + ChipLogError(NotSpecified, "The RequestId does not match the RequestId provided to RequestCommissioningApproval"); + return; + } + + if (value.statusCode != static_cast(Protocols::InteractionModel::Status::Success)) + { + ChipLogError(NotSpecified, "The server is not ready to begin commissioning the requested device"); + return; + } + + // The server is ready to begin commissioning the requested device, request the Commissioner Control Server to begin + // commissioning a previously approved request. + SendCommissionNodeRequest(value.requestId, kResponseTimeoutSeconds); +} + +void DeviceManager::SendCommissionNodeRequest(uint64_t requestId, uint16_t responseTimeoutSeconds) { ChipLogProgress(NotSpecified, "Request the Commissioner Control Server to begin commissioning a previously approved request."); @@ -266,6 +295,35 @@ void DeviceManager::CommissionApprovedRequest(uint64_t requestId, uint16_t respo PushCommand(commandBuilder.c_str()); } +void DeviceManager::HandleReverseOpenCommissioningWindow(TLV::TLVReader * data) +{ + CommissionerControl::Commands::ReverseOpenCommissioningWindow::DecodableType value; + CHIP_ERROR error = app::DataModel::Decode(*data, value); + if (error != CHIP_NO_ERROR) + { + ChipLogError(NotSpecified, "Failed to decode command response value. Error: %" CHIP_ERROR_FORMAT, error.Format()); + return; + } + + // Log all fields + ChipLogProgress(NotSpecified, "DecodableType fields:"); + ChipLogProgress(NotSpecified, " commissioningTimeout: %u", value.commissioningTimeout); + ChipLogProgress(NotSpecified, " discriminator: %u", value.discriminator); + ChipLogProgress(NotSpecified, " iterations: %u", value.iterations); + + char verifierHex[Crypto::kSpake2p_VerifierSerialized_Length * 2 + 1]; + Encoding::BytesToHex(value.PAKEPasscodeVerifier.data(), value.PAKEPasscodeVerifier.size(), verifierHex, sizeof(verifierHex), + Encoding::HexFlags::kNullTerminate); + ChipLogProgress(NotSpecified, " PAKEPasscodeVerifier: %s", verifierHex); + + char saltHex[Crypto::kSpake2p_Max_PBKDF_Salt_Length * 2 + 1]; + Encoding::BytesToHex(value.salt.data(), value.salt.size(), saltHex, sizeof(saltHex), Encoding::HexFlags::kNullTerminate); + ChipLogProgress(NotSpecified, " salt: %s", saltHex); + + OpenDeviceCommissioningWindow(mLocalBridgeNodeId, value.commissioningTimeout, value.iterations, value.discriminator, saltHex, + verifierHex); +} + void DeviceManager::HandleAttributeData(const app::ConcreteDataAttributePath & path, TLV::TLVReader * data) { if (path.mClusterId == CommissionerControl::Id && @@ -284,7 +342,7 @@ void DeviceManager::HandleAttributeData(const app::ConcreteDataAttributePath & p if (value.Has(CommissionerControl::SupportedDeviceCategoryBitmap::kFabricSynchronization)) { ChipLogProgress(NotSpecified, "Remote Fabric-Bridge supports Fabric Synchronization, start reverse commissioning."); - StartReverseCommissioning(); + RequestCommissioningApproval(); } return; @@ -399,39 +457,24 @@ void DeviceManager::HandleAttributeData(const app::ConcreteDataAttributePath & p } } -void DeviceManager::HandleEventData(const chip::app::EventHeader & header, chip::TLV::TLVReader * data) +void DeviceManager::HandleEventData(const app::EventHeader & header, TLV::TLVReader * data) { - if (header.mPath.mClusterId != CommissionerControl::Id || - header.mPath.mEventId != CommissionerControl::Events::CommissioningRequestResult::Id) - { - return; - } - - ChipLogProgress(NotSpecified, "CommissioningRequestResult event received."); - - CommissionerControl::Events::CommissioningRequestResult::DecodableType value; - CHIP_ERROR error = app::DataModel::Decode(*data, value); - if (error != CHIP_NO_ERROR) + if (header.mPath.mClusterId == CommissionerControl::Id && + header.mPath.mEventId == CommissionerControl::Events::CommissioningRequestResult::Id) { - ChipLogError(NotSpecified, "Failed to decode event value. Error: %" CHIP_ERROR_FORMAT, error.Format()); - return; + HandleCommissioningRequestResult(data); } +} - if (value.requestId != mRequestId) - { - ChipLogError(NotSpecified, "The RequestId does not match the RequestId provided to RequestCommissioningApproval"); - return; - } +void DeviceManager::HandleCommandResponse(const app::ConcreteCommandPath & path, TLV::TLVReader * data) +{ + ChipLogProgress(NotSpecified, "Command Response received."); - if (value.statusCode != static_cast(Protocols::InteractionModel::Status::Success)) + if (path.mClusterId == CommissionerControl::Id && + path.mCommandId == CommissionerControl::Commands::ReverseOpenCommissioningWindow::Id) { - ChipLogError(NotSpecified, "The server is not ready to begin commissioning the requested device"); - return; + HandleReverseOpenCommissioningWindow(data); } - - // The server is ready to begin commissioning the requested device, request the Commissioner Control Server to begin - // commissioning a previously approved request. - CommissionApprovedRequest(value.requestId, kResponseTimeoutSeconds); } void DeviceManager::OnDeviceRemoved(NodeId deviceId, CHIP_ERROR err) diff --git a/examples/fabric-admin/device_manager/DeviceManager.h b/examples/fabric-admin/device_manager/DeviceManager.h index 454986bd7a40f0..b6c7dc0e657b51 100644 --- a/examples/fabric-admin/device_manager/DeviceManager.h +++ b/examples/fabric-admin/device_manager/DeviceManager.h @@ -148,21 +148,27 @@ class DeviceManager : public PairingDelegate void SubscribeRemoteFabricBridge(); - void StartReverseCommissioning(); - void ReadSupportedDeviceCategories(); - void CommissionApprovedRequest(uint64_t requestId, uint16_t responseTimeoutSeconds); - void HandleAttributeData(const chip::app::ConcreteDataAttributePath & path, chip::TLV::TLVReader * data); void HandleEventData(const chip::app::EventHeader & header, chip::TLV::TLVReader * data); + void HandleCommandResponse(const chip::app::ConcreteCommandPath & path, chip::TLV::TLVReader * data); + void OnDeviceRemoved(chip::NodeId deviceId, CHIP_ERROR err) override; private: friend DeviceManager & DeviceMgr(); + void RequestCommissioningApproval(); + + void HandleCommissioningRequestResult(chip::TLV::TLVReader * data); + + void SendCommissionNodeRequest(uint64_t requestId, uint16_t responseTimeoutSeconds); + + void HandleReverseOpenCommissioningWindow(chip::TLV::TLVReader * data); + static DeviceManager sInstance; chip::NodeId mLastUsedNodeId = 0; diff --git a/examples/fabric-admin/rpc/RpcServer.cpp b/examples/fabric-admin/rpc/RpcServer.cpp index 86d90ad294beb7..f240feda22a2d4 100644 --- a/examples/fabric-admin/rpc/RpcServer.cpp +++ b/examples/fabric-admin/rpc/RpcServer.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #if defined(PW_RPC_FABRIC_ADMIN_SERVICE) && PW_RPC_FABRIC_ADMIN_SERVICE @@ -91,6 +92,45 @@ class FabricAdmin final : public rpc::FabricAdmin, public IcdManager::Delegate return pw::OkStatus(); } + pw::Status CommissionNode(const chip_rpc_DeviceCommissioningInfo & request, pw_protobuf_Empty & response) override + { + char saltHex[Crypto::kSpake2p_Max_PBKDF_Salt_Length * 2 + 1]; + Encoding::BytesToHex(request.salt.bytes, request.salt.size, saltHex, sizeof(saltHex), Encoding::HexFlags::kNullTerminate); + + ChipLogProgress(NotSpecified, "Received CommissionNode request"); + + SetupPayload setupPayload = SetupPayload(); + + setupPayload.setUpPINCode = request.setup_pin; + setupPayload.version = 0; + setupPayload.rendezvousInformation.SetValue(RendezvousInformationFlag::kOnNetwork); + + SetupDiscriminator discriminator{}; + discriminator.SetLongValue(request.discriminator); + setupPayload.discriminator = discriminator; + + char payloadBuffer[kMaxManualCodeLength + 1]; + MutableCharSpan manualCode(payloadBuffer); + + CHIP_ERROR error = ManualSetupPayloadGenerator(setupPayload).payloadDecimalStringRepresentation(manualCode); + if (error == CHIP_NO_ERROR) + { + NodeId nodeId = DeviceMgr().GetNextAvailableNodeId(); + + // After responding with RequestCommissioningApproval to the node where the client initiated the + // RequestCommissioningApproval, you need to wait for it to open a commissioning window on its bridge. + usleep(kCommissionPrepareTimeMs * 1000); + + DeviceMgr().PairRemoteDevice(nodeId, payloadBuffer); + } + else + { + ChipLogError(NotSpecified, "Unable to generate manual code for setup payload: %" CHIP_ERROR_FORMAT, error.Format()); + } + + return pw::OkStatus(); + } + pw::Status KeepActive(const chip_rpc_KeepActiveParameters & request, pw_protobuf_Empty & response) override { ChipLogProgress(NotSpecified, "Received KeepActive request: 0x%lx, %u", request.node_id, request.stay_active_duration_ms); diff --git a/examples/fabric-bridge-app/fabric-bridge-common/BUILD.gn b/examples/fabric-bridge-app/fabric-bridge-common/BUILD.gn index b7b07d3be37bc3..7f2fbcbbfe0556 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/BUILD.gn +++ b/examples/fabric-bridge-app/fabric-bridge-common/BUILD.gn @@ -45,11 +45,9 @@ source_set("fabric-bridge-lib") { "include/BridgedDeviceBasicInformationImpl.h", "include/BridgedDeviceManager.h", "include/CHIPProjectAppConfig.h", - "include/CommissionerControl.h", "src/BridgedDevice.cpp", "src/BridgedDeviceBasicInformationImpl.cpp", "src/BridgedDeviceManager.cpp", - "src/CommissionerControl.cpp", "src/ZCLCallbacks.cpp", ] diff --git a/examples/fabric-bridge-app/linux/BUILD.gn b/examples/fabric-bridge-app/linux/BUILD.gn index d0f60f30fbb2b9..d0e92a408ee00e 100644 --- a/examples/fabric-bridge-app/linux/BUILD.gn +++ b/examples/fabric-bridge-app/linux/BUILD.gn @@ -33,6 +33,7 @@ if (bridge_enable_pw_rpc) { executable("fabric-bridge-app") { sources = [ "${chip_root}/examples/fabric-bridge-app/fabric-bridge-common/include/CHIPProjectAppConfig.h", + "CommissionerControl.cpp", "main.cpp", ] diff --git a/examples/fabric-bridge-app/fabric-bridge-common/src/CommissionerControl.cpp b/examples/fabric-bridge-app/linux/CommissionerControl.cpp similarity index 70% rename from examples/fabric-bridge-app/fabric-bridge-common/src/CommissionerControl.cpp rename to examples/fabric-bridge-app/linux/CommissionerControl.cpp index 076ced816596d2..9f3180668de42c 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/src/CommissionerControl.cpp +++ b/examples/fabric-bridge-app/linux/CommissionerControl.cpp @@ -17,17 +17,26 @@ */ #include "CommissionerControl.h" +#include "RpcClient.h" #include #include +#include #include #include +#include using namespace chip; using namespace chip::app; namespace { +// Constants +constexpr uint16_t kDiscriminator = 3840; +constexpr uint16_t kWindowTimeout = 300; +constexpr uint16_t kIteration = 1000; +constexpr uint32_t kSetupPinCode = 20202021; + std::unique_ptr sCommissionerControlDelegate; } // namespace @@ -96,23 +105,43 @@ CHIP_ERROR CommissionerControlDelegate::ValidateCommissionNodeCommand(NodeId cli CHIP_ERROR CommissionerControlDelegate::GetCommissioningWindowParams(CommissioningWindowParams & outParams) { - // TODO: Populate outParams with the required details. - // outParams.commissioningWindowParams.iterations = mIterations; - // outParams.commissioningWindowParams.commissioningTimeout = mCommissioningTimeout; - // outParams.commissioningWindowParams.discriminator = mDiscriminator; - // outParams.commissioningWindowParams.PAKEPasscodeVerifier = mPAKEPasscodeVerifier; - // outParams.commissioningWindowParams.salt = mSalt; + // Populate outParams with the required details. + outParams.iterations = kIteration; + outParams.commissioningTimeout = kWindowTimeout; + outParams.discriminator = kDiscriminator; + + ReturnErrorOnFailure(Crypto::DRBG_get_bytes(mPBKDFSaltBuffer, sizeof(mPBKDFSaltBuffer))); + mPBKDFSalt = ByteSpan(mPBKDFSaltBuffer); + outParams.salt = mPBKDFSalt; - // outParams.ipAddress = mIpAddress; - // outParams.port = mPort; + Crypto::Spake2pVerifier verifier; + uint32_t setupPIN = kSetupPinCode; + ReturnErrorOnFailure(PASESession::GeneratePASEVerifier(verifier, kIteration, mPBKDFSalt, false, setupPIN)); + + MutableByteSpan serializedVerifierSpan(mPAKEPasscodeVerifierBuffer); + ReturnErrorOnFailure(verifier.Serialize(serializedVerifierSpan)); + mPAKEPasscodeVerifier = serializedVerifierSpan; + outParams.PAKEPasscodeVerifier = mPAKEPasscodeVerifier; return CHIP_NO_ERROR; } -CHIP_ERROR CommissionerControlDelegate::ReverseCommissionNode(const CommissioningWindowParams & params, - const Optional & ipAddress, const Optional & port) +CHIP_ERROR CommissionerControlDelegate::HandleCommissionNode(const CommissioningWindowParams & params, + const Optional & ipAddress, const Optional & port) { - return CHIP_NO_ERROR; + ChipLogProgress(NotSpecified, "CommissionerControlDelegate::HandleCommissionNode"); + +#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE + return CommissionNode(Controller::CommissioningWindowPasscodeParams() + .SetSetupPIN(kSetupPinCode) + .SetTimeout(params.commissioningTimeout) + .SetDiscriminator(params.discriminator) + .SetIteration(params.iterations) + .SetSalt(params.salt)); +#else + ChipLogProgress(NotSpecified, "Failed to reverse commission bridge: PW_RPC_FABRIC_BRIDGE_SERVICE not defined"); + return CHIP_ERROR_NOT_IMPLEMENTED; +#endif // defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE } } // namespace CommissionerControl diff --git a/examples/fabric-bridge-app/linux/RpcClient.cpp b/examples/fabric-bridge-app/linux/RpcClient.cpp index 1260c8744b67f2..b3c82303beb8f5 100644 --- a/examples/fabric-bridge-app/linux/RpcClient.cpp +++ b/examples/fabric-bridge-app/linux/RpcClient.cpp @@ -162,6 +162,31 @@ OpenCommissioningWindow(chip::Controller::CommissioningWindowVerifierParams para return OpenCommissioningWindow(device); } +CHIP_ERROR +CommissionNode(chip::Controller::CommissioningWindowPasscodeParams params) +{ + chip_rpc_DeviceCommissioningInfo device; + device.setup_pin = params.GetSetupPIN(); + device.discriminator = params.GetDiscriminator(); + device.iterations = params.GetIteration(); + + VerifyOrReturnError(params.GetSalt().size() <= sizeof(device.salt.bytes), CHIP_ERROR_BUFFER_TOO_SMALL); + memcpy(device.salt.bytes, params.GetSalt().data(), params.GetSalt().size()); + device.salt.size = static_cast(params.GetSalt().size()); + + // The RPC call is kept alive until it completes. When a response is received, it will be logged by the handler + // function and the call will complete. + auto call = fabricAdminClient.CommissionNode(device, RpcCompletedWithEmptyResponse); + + if (!call.active()) + { + // The RPC call was not sent. This could occur due to, for example, an invalid channel ID. Handle if necessary. + return CHIP_ERROR_INTERNAL; + } + + return WaitForResponse(call); +} + CHIP_ERROR KeepActive(chip::NodeId nodeId, uint32_t stayActiveDurationMs) { chip_rpc_KeepActiveParameters params; diff --git a/examples/fabric-bridge-app/fabric-bridge-common/include/CommissionerControl.h b/examples/fabric-bridge-app/linux/include/CommissionerControl.h similarity index 80% rename from examples/fabric-bridge-app/fabric-bridge-common/include/CommissionerControl.h rename to examples/fabric-bridge-app/linux/include/CommissionerControl.h index b5caa6a2ce1f3d..633be761ba1004 100644 --- a/examples/fabric-bridge-app/fabric-bridge-common/include/CommissionerControl.h +++ b/examples/fabric-bridge-app/linux/include/CommissionerControl.h @@ -32,8 +32,8 @@ class CommissionerControlDelegate : public Delegate CHIP_ERROR HandleCommissioningApprovalRequest(const CommissioningApprovalRequest & request) override; CHIP_ERROR ValidateCommissionNodeCommand(NodeId clientNodeId, uint64_t requestId) override; CHIP_ERROR GetCommissioningWindowParams(CommissioningWindowParams & outParams) override; - CHIP_ERROR ReverseCommissionNode(const CommissioningWindowParams & params, const Optional & ipAddress, - const Optional & port) override; + CHIP_ERROR HandleCommissionNode(const CommissioningWindowParams & params, const Optional & ipAddress, + const Optional & port) override; ~CommissionerControlDelegate() = default; @@ -46,6 +46,12 @@ class CommissionerControlDelegate : public Delegate uint16_t mProductId = 0; char mLabelBuffer[kLabelBufferSize + 1]; Optional mLabel; + + // Parameters needed for non-basic commissioning. + uint8_t mPBKDFSaltBuffer[Crypto::kSpake2p_Max_PBKDF_Salt_Length]; + ByteSpan mPBKDFSalt; + Crypto::Spake2pVerifierSerialized mPAKEPasscodeVerifierBuffer; + ByteSpan mPAKEPasscodeVerifier; }; } // namespace CommissionerControl diff --git a/examples/fabric-bridge-app/linux/include/RpcClient.h b/examples/fabric-bridge-app/linux/include/RpcClient.h index 6913a66d8c24a1..87ccba24f645dc 100644 --- a/examples/fabric-bridge-app/linux/include/RpcClient.h +++ b/examples/fabric-bridge-app/linux/include/RpcClient.h @@ -57,4 +57,15 @@ OpenCommissioningWindow(chip::Controller::CommissioningWindowPasscodeParams para CHIP_ERROR OpenCommissioningWindow(chip::Controller::CommissioningWindowVerifierParams params); +/** + * Commission a node using the specified parameters. + * + * @param params Params for commissioning the device using passcode. + * @return CHIP_ERROR An error code indicating the success or failure of the operation. + * - CHIP_NO_ERROR: The RPC command was successfully sent. + * - CHIP_ERROR_INTERNAL: An internal error occurred. + */ +CHIP_ERROR +CommissionNode(chip::Controller::CommissioningWindowPasscodeParams params); + CHIP_ERROR KeepActive(chip::NodeId nodeId, uint32_t stayActiveDurationMs); diff --git a/examples/fabric-bridge-app/linux/main.cpp b/examples/fabric-bridge-app/linux/main.cpp index 57907db8872b0a..3b6502421045f8 100644 --- a/examples/fabric-bridge-app/linux/main.cpp +++ b/examples/fabric-bridge-app/linux/main.cpp @@ -82,7 +82,7 @@ void BridgePollingThread() #if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE else if (ch == 'o') { - CHIP_ERROR err = OpenCommissioningWindow(chip::Controller::CommissioningWindowPasscodeParams() + CHIP_ERROR err = OpenCommissioningWindow(Controller::CommissioningWindowPasscodeParams() .SetNodeId(0x1234) .SetTimeout(300) .SetDiscriminator(3840) @@ -157,7 +157,7 @@ void AdministratorCommissioningCommandHandler::InvokeCommand(HandlerContext & ha // TODO: issues:#33784, need to make OpenCommissioningWindow synchronous if (device != nullptr && - OpenCommissioningWindow(chip::Controller::CommissioningWindowVerifierParams() + OpenCommissioningWindow(Controller::CommissioningWindowVerifierParams() .SetNodeId(device->GetNodeId()) .SetTimeout(commandData.commissioningTimeout) .SetDiscriminator(commandData.discriminator) diff --git a/src/app/clusters/commissioner-control-server/commissioner-control-server.cpp b/src/app/clusters/commissioner-control-server/commissioner-control-server.cpp index d8a655f6afb241..4df397326894ed 100644 --- a/src/app/clusters/commissioner-control-server/commissioner-control-server.cpp +++ b/src/app/clusters/commissioner-control-server/commissioner-control-server.cpp @@ -71,15 +71,15 @@ void RunDeferredCommissionNode(intptr_t commandArg) if (delegate != nullptr) { - CHIP_ERROR err = delegate->ReverseCommissionNode(info->params, info->ipAddress.GetIPAddress(), info->port); + CHIP_ERROR err = delegate->HandleCommissionNode(info->params, info->ipAddress.GetIPAddress(), info->port); if (err != CHIP_NO_ERROR) { - ChipLogError(Zcl, "ReverseCommissionNode error: %" CHIP_ERROR_FORMAT, err.Format()); + ChipLogError(Zcl, "HandleCommissionNode error: %" CHIP_ERROR_FORMAT, err.Format()); } } else { - ChipLogError(Zcl, "No delegate available for ReverseCommissionNode"); + ChipLogError(Zcl, "No delegate available for HandleCommissionNode"); } delete info; diff --git a/src/app/clusters/commissioner-control-server/commissioner-control-server.h b/src/app/clusters/commissioner-control-server/commissioner-control-server.h index 5e2422f5ebe018..60a4e81a93c3af 100644 --- a/src/app/clusters/commissioner-control-server/commissioner-control-server.h +++ b/src/app/clusters/commissioner-control-server/commissioner-control-server.h @@ -101,9 +101,6 @@ class Delegate /** * @brief Validate a commission node command. * - * This command is sent by a client to request that the server begins commissioning a previously - * approved request. - * * The server SHALL return FAILURE if the CommissionNode command is not sent from the same * NodeId as the RequestCommissioningApproval or if the provided RequestId to CommissionNode * does not match the value provided to RequestCommissioningApproval. @@ -128,19 +125,17 @@ class Delegate virtual CHIP_ERROR GetCommissioningWindowParams(CommissioningWindowParams & outParams) = 0; /** - * @brief Reverse the commission node process. + * @brief Handle a commission node request. * - * When received within the timeout specified by CommissionNode, the client SHALL open a - * commissioning window on the node which the client called RequestCommissioningApproval to - * have commissioned. + * Commission a node specified by the previously approved request. * * @param params The parameters for the commissioning window. * @param ipAddress Optional IP address for the commissioning window. * @param port Optional port for the commissioning window. * @return CHIP_ERROR indicating the success or failure of the operation. */ - virtual CHIP_ERROR ReverseCommissionNode(const CommissioningWindowParams & params, const Optional & ipAddress, - const Optional & port) = 0; + virtual CHIP_ERROR HandleCommissionNode(const CommissioningWindowParams & params, const Optional & ipAddress, + const Optional & port) = 0; virtual ~Delegate() = default; }; From ae1546a3e4a692edd3c7e7bde3ea3f9bd303ab40 Mon Sep 17 00:00:00 2001 From: Alex Tsitsiura Date: Sat, 17 Aug 2024 01:10:49 +0300 Subject: [PATCH 55/59] Update compatible builds to docker version 74 (#35009) * Check which build can update to latest version * temporarry use docker version 72 * revert image for failed builds * downgrade K32W image * use K32W docker image 69 * Update compatible builds to docker version 74 * use docker version 73 for EFR32 * Prevent cancellation of task with timeout in asyncio runner. I am yet unclear why on new python/os/websocket we do not get a timeout error, however from what I could tell, wait_for would cancel the websocket.recv and that stops instead of throwing a timeout exception, resulting in a full success result. Making this change seems to make the test TestPurposefulFailureExtraReportingOnToggle pass on my machine (well ... fail as expected instead of passing with a successful stop) --------- Co-authored-by: Andrei Litvin --- .github/workflows/bloat_check.yaml | 2 +- .github/workflows/build.yaml | 6 +++--- .github/workflows/chef.yaml | 8 ++++---- .github/workflows/doxygen.yaml | 2 +- .github/workflows/examples-ameba.yaml | 2 +- .github/workflows/examples-asr.yaml | 2 +- .github/workflows/examples-bouffalolab.yaml | 2 +- .github/workflows/examples-cc13xx_26xx.yaml | 2 +- .github/workflows/examples-cc32xx.yaml | 2 +- .github/workflows/examples-efr32.yaml | 2 +- .github/workflows/examples-esp32.yaml | 4 ++-- .github/workflows/examples-linux-arm.yaml | 2 +- .github/workflows/examples-linux-imx.yaml | 2 +- .github/workflows/examples-linux-standalone.yaml | 2 +- .../workflows/examples-linux-tv-casting-app.yaml | 2 +- .github/workflows/examples-mw320.yaml | 2 +- .github/workflows/examples-nrfconnect.yaml | 2 +- .github/workflows/examples-nuttx.yaml | 2 +- .github/workflows/examples-nxp.yaml | 6 +++--- .github/workflows/examples-openiotsdk.yaml | 2 +- .github/workflows/examples-qpg.yaml | 2 +- .github/workflows/examples-stm32.yaml | 2 +- .github/workflows/examples-telink.yaml | 2 +- .github/workflows/examples-tizen.yaml | 2 +- .github/workflows/full-android.yaml | 2 +- .github/workflows/fuzzing-build.yaml | 2 +- .github/workflows/java-tests.yaml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/minimal-build.yaml | 4 ++-- .github/workflows/qemu.yaml | 2 +- .github/workflows/release_artifacts.yaml | 4 ++-- .github/workflows/smoketest-android.yaml | 2 +- .github/workflows/tests.yaml | 4 ++-- .github/workflows/unit_integration_test.yaml | 2 +- .github/workflows/zap_regeneration.yaml | 2 +- .github/workflows/zap_templates.yaml | 2 +- examples/all-clusters-app/ameba/README.md | 4 ++-- examples/all-clusters-minimal-app/ameba/README.md | 4 ++-- examples/light-switch-app/ameba/README.md | 4 ++-- examples/lighting-app/ameba/README.md | 4 ++-- examples/ota-requestor-app/ameba/README.md | 4 ++-- examples/pigweed-app/ameba/README.md | 4 ++-- integrations/cloudbuild/chef.yaml | 8 ++++---- integrations/cloudbuild/smoke-test.yaml | 14 +++++++------- .../py_matter_yamltests/matter_yamltests/runner.py | 3 ++- 45 files changed, 72 insertions(+), 71 deletions(-) diff --git a/.github/workflows/bloat_check.yaml b/.github/workflows/bloat_check.yaml index 12c7ee42e8faf7..870c5f379e5eb8 100644 --- a/.github/workflows/bloat_check.yaml +++ b/.github/workflows/bloat_check.yaml @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:66 + image: ghcr.io/project-chip/chip-build:74 steps: - name: Checkout diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 58e6d14cd8bb0e..3e4f9d57056f63 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -42,7 +42,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:66 + image: ghcr.io/project-chip/chip-build:74 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -138,7 +138,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:65 + image: ghcr.io/project-chip/chip-build:74 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" @@ -455,7 +455,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:66 + image: ghcr.io/project-chip/chip-build:74 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/chef.yaml b/.github/workflows/chef.yaml index efb408f80bfc26..642cdb6cf87e92 100644 --- a/.github/workflows/chef.yaml +++ b/.github/workflows/chef.yaml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:66 + image: ghcr.io/project-chip/chip-build:74 options: --user root steps: @@ -56,7 +56,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:67 + image: ghcr.io/project-chip/chip-build-esp32:74 options: --user root steps: @@ -77,7 +77,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nrf-platform:66 + image: ghcr.io/project-chip/chip-build-nrf-platform:74 options: --user root steps: @@ -98,7 +98,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:66 + image: ghcr.io/project-chip/chip-build-telink:74 options: --user root steps: diff --git a/.github/workflows/doxygen.yaml b/.github/workflows/doxygen.yaml index df53d87c4a9d57..d29b620c374165 100644 --- a/.github/workflows/doxygen.yaml +++ b/.github/workflows/doxygen.yaml @@ -81,7 +81,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-doxygen:66 + image: ghcr.io/project-chip/chip-build-doxygen:74 if: github.actor != 'restyled-io[bot]' diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml index 93ae9ce31ddee1..62a3bf55119b3d 100644 --- a/.github/workflows/examples-ameba.yaml +++ b/.github/workflows/examples-ameba.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ameba:68 + image: ghcr.io/project-chip/chip-build-ameba:74 options: --user root steps: diff --git a/.github/workflows/examples-asr.yaml b/.github/workflows/examples-asr.yaml index b6fdcfd84945a0..840811d13daa6a 100644 --- a/.github/workflows/examples-asr.yaml +++ b/.github/workflows/examples-asr.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-asr:66 + image: ghcr.io/project-chip/chip-build-asr:74 options: --user root steps: diff --git a/.github/workflows/examples-bouffalolab.yaml b/.github/workflows/examples-bouffalolab.yaml index 933a9b60361eb3..af20a4c5b0872f 100644 --- a/.github/workflows/examples-bouffalolab.yaml +++ b/.github/workflows/examples-bouffalolab.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-bouffalolab:68 + image: ghcr.io/project-chip/chip-build-bouffalolab:74 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc13xx_26xx.yaml b/.github/workflows/examples-cc13xx_26xx.yaml index 9d1ba6aa6ccc7e..b486415dbcc1ee 100644 --- a/.github/workflows/examples-cc13xx_26xx.yaml +++ b/.github/workflows/examples-cc13xx_26xx.yaml @@ -45,7 +45,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ti:54 + image: ghcr.io/project-chip/chip-build-ti:74 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc32xx.yaml b/.github/workflows/examples-cc32xx.yaml index dedf9e9c79df23..091a5eeabc4361 100644 --- a/.github/workflows/examples-cc32xx.yaml +++ b/.github/workflows/examples-cc32xx.yaml @@ -43,7 +43,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-ti:54 + image: ghcr.io/project-chip/chip-build-ti:74 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index 5a8f5359358063..ed6f5b45fa0d1b 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-efr32:66 + image: ghcr.io/project-chip/chip-build-efr32:73 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index fb0d2bc29b5b8d..5d84540eda4676 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:67 + image: ghcr.io/project-chip/chip-build-esp32:74 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -126,7 +126,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32:67 + image: ghcr.io/project-chip/chip-build-esp32:74 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml index eec3e41ec875e8..41fe2456518850 100644 --- a/.github/workflows/examples-linux-arm.yaml +++ b/.github/workflows/examples-linux-arm.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-crosscompile:66 + image: ghcr.io/project-chip/chip-build-crosscompile:74 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml index ab32eef0801353..6ad5f4c9d9c31e 100644 --- a/.github/workflows/examples-linux-imx.yaml +++ b/.github/workflows/examples-linux-imx.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-imx:54 + image: ghcr.io/project-chip/chip-build-imx:74 steps: - name: Checkout diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index 5ece2df040e562..aa4051ea308a56 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:66 + image: ghcr.io/project-chip/chip-build:74 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-linux-tv-casting-app.yaml b/.github/workflows/examples-linux-tv-casting-app.yaml index 4ab6bbbb1cf233..e2ff0f9f6697da 100644 --- a/.github/workflows/examples-linux-tv-casting-app.yaml +++ b/.github/workflows/examples-linux-tv-casting-app.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:66 + image: ghcr.io/project-chip/chip-build:74 steps: - name: Checkout diff --git a/.github/workflows/examples-mw320.yaml b/.github/workflows/examples-mw320.yaml index cd4081c51cd164..04664c28cf339e 100644 --- a/.github/workflows/examples-mw320.yaml +++ b/.github/workflows/examples-mw320.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:66 + image: ghcr.io/project-chip/chip-build:74 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index 3e0452b5258dc8..13b0ae9c691d7c 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nrf-platform:66 + image: ghcr.io/project-chip/chip-build-nrf-platform:74 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-nuttx.yaml b/.github/workflows/examples-nuttx.yaml index 3fc296f4a6478a..d1bf7594b0a332 100644 --- a/.github/workflows/examples-nuttx.yaml +++ b/.github/workflows/examples-nuttx.yaml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nuttx:66 + image: ghcr.io/project-chip/chip-build-nuttx:74 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nxp.yaml b/.github/workflows/examples-nxp.yaml index 975d9292a18941..04094f0b20480d 100644 --- a/.github/workflows/examples-nxp.yaml +++ b/.github/workflows/examples-nxp.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-k32w:71 + image: ghcr.io/project-chip/chip-build-k32w:74 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -150,7 +150,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-rw61x:66 + image: ghcr.io/project-chip/chip-build-rw61x:74 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: @@ -212,7 +212,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-nxp-zephyr:66 + image: ghcr.io/project-chip/chip-build-nxp-zephyr:74 steps: - name: Checkout diff --git a/.github/workflows/examples-openiotsdk.yaml b/.github/workflows/examples-openiotsdk.yaml index 57577e02e774c7..d85a789a0bcef7 100644 --- a/.github/workflows/examples-openiotsdk.yaml +++ b/.github/workflows/examples-openiotsdk.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-openiotsdk:66 + image: ghcr.io/project-chip/chip-build-openiotsdk:74 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" options: --privileged diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml index 9c6f300a861429..18d47cf8ef9937 100644 --- a/.github/workflows/examples-qpg.yaml +++ b/.github/workflows/examples-qpg.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:66 + image: ghcr.io/project-chip/chip-build:74 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-stm32.yaml b/.github/workflows/examples-stm32.yaml index 897f0477089151..6c4fa05864efff 100644 --- a/.github/workflows/examples-stm32.yaml +++ b/.github/workflows/examples-stm32.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:66 + image: ghcr.io/project-chip/chip-build:74 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index 22007fb77a3085..904ae98fbcabcc 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-telink:66 + image: ghcr.io/project-chip/chip-build-telink:74 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index 8c1dc592d68676..f6571342a84618 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-tizen:66 + image: ghcr.io/project-chip/chip-build-tizen:74 options: --user root volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/full-android.yaml b/.github/workflows/full-android.yaml index 0acfb215576caa..43aee09a821be9 100644 --- a/.github/workflows/full-android.yaml +++ b/.github/workflows/full-android.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-android:66 + image: ghcr.io/project-chip/chip-build-android:74 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/fuzzing-build.yaml b/.github/workflows/fuzzing-build.yaml index e9f2061a2c033b..d839317bc4248e 100644 --- a/.github/workflows/fuzzing-build.yaml +++ b/.github/workflows/fuzzing-build.yaml @@ -33,7 +33,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:66 + image: ghcr.io/project-chip/chip-build:74 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/java-tests.yaml b/.github/workflows/java-tests.yaml index c70cfa6c37826d..a43fdfb7f49d4d 100644 --- a/.github/workflows/java-tests.yaml +++ b/.github/workflows/java-tests.yaml @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-java:66 + image: ghcr.io/project-chip/chip-build-java:74 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6694decc421372..26e8f939207ebe 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build:66 + image: ghcr.io/project-chip/chip-build:74 steps: - name: Checkout diff --git a/.github/workflows/minimal-build.yaml b/.github/workflows/minimal-build.yaml index 57ccaef312e144..9ba9565b44c25b 100644 --- a/.github/workflows/minimal-build.yaml +++ b/.github/workflows/minimal-build.yaml @@ -33,7 +33,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-minimal:66 + image: ghcr.io/project-chip/chip-build-minimal:74 steps: - name: Checkout @@ -55,7 +55,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-minimal:66 + image: ghcr.io/project-chip/chip-build-minimal:74 steps: - name: Checkout diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index 051af08a2893da..7c8564958d1350 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -40,7 +40,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-esp32-qemu:67 + image: ghcr.io/project-chip/chip-build-esp32-qemu:74 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/release_artifacts.yaml b/.github/workflows/release_artifacts.yaml index 481def01c629c6..9f25dee51324fb 100644 --- a/.github/workflows/release_artifacts.yaml +++ b/.github/workflows/release_artifacts.yaml @@ -32,7 +32,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-esp32:67 + image: ghcr.io/project-chip/chip-build-esp32:74 steps: - name: Checkout @@ -64,7 +64,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build-efr32:56 + image: ghcr.io/project-chip/chip-build-efr32:74 steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/smoketest-android.yaml b/.github/workflows/smoketest-android.yaml index f6e06fc1dbbaac..8ac6cd93131617 100644 --- a/.github/workflows/smoketest-android.yaml +++ b/.github/workflows/smoketest-android.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: ghcr.io/project-chip/chip-build-android:66 + image: ghcr.io/project-chip/chip-build-android:74 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 6974999d0d134f..dbbda0aa36580f 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -49,7 +49,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:54 + image: ghcr.io/project-chip/chip-build:74 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" @@ -455,7 +455,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:66 + image: ghcr.io/project-chip/chip-build:74 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index 33f9cefae684fe..5716df1a5d33af 100644 --- a/.github/workflows/unit_integration_test.yaml +++ b/.github/workflows/unit_integration_test.yaml @@ -39,7 +39,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/project-chip/chip-build:66 + image: ghcr.io/project-chip/chip-build:74 volumes: - "/:/runner-root-volume" - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/zap_regeneration.yaml b/.github/workflows/zap_regeneration.yaml index 68faf6b066e750..dca68cc94e88ad 100644 --- a/.github/workflows/zap_regeneration.yaml +++ b/.github/workflows/zap_regeneration.yaml @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: ghcr.io/project-chip/chip-build:66 + image: ghcr.io/project-chip/chip-build:74 defaults: run: shell: sh diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index 8ffe08e158c611..5ed20b29ada3d6 100644 --- a/.github/workflows/zap_templates.yaml +++ b/.github/workflows/zap_templates.yaml @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: ghcr.io/project-chip/chip-build:66 + image: ghcr.io/project-chip/chip-build:74 defaults: run: shell: sh diff --git a/examples/all-clusters-app/ameba/README.md b/examples/all-clusters-app/ameba/README.md index adf6e590593fd7..4251291f486ef4 100644 --- a/examples/all-clusters-app/ameba/README.md +++ b/examples/all-clusters-app/ameba/README.md @@ -27,11 +27,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:54 + $ docker pull ghcr.io/project-chip/chip-build-ameba:74 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:54 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:74 - Setup build environment: diff --git a/examples/all-clusters-minimal-app/ameba/README.md b/examples/all-clusters-minimal-app/ameba/README.md index b4e72ca32d02b5..31969a2196b343 100644 --- a/examples/all-clusters-minimal-app/ameba/README.md +++ b/examples/all-clusters-minimal-app/ameba/README.md @@ -27,13 +27,13 @@ The CHIP demo application is supported on - Pull docker image: ``` - $ docker pull ghcr.io/project-chip/chip-build-ameba:54 + $ docker pull ghcr.io/project-chip/chip-build-ameba:74 ``` - Run docker container: ``` - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:54 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:74 ``` - Setup build environment: diff --git a/examples/light-switch-app/ameba/README.md b/examples/light-switch-app/ameba/README.md index 3476d6d8cd5317..7d168d3f480d84 100644 --- a/examples/light-switch-app/ameba/README.md +++ b/examples/light-switch-app/ameba/README.md @@ -26,11 +26,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:54 + $ docker pull ghcr.io/project-chip/chip-build-ameba:74 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:54 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:74 - Setup build environment: diff --git a/examples/lighting-app/ameba/README.md b/examples/lighting-app/ameba/README.md index b170e9026325f8..d94d642dbd3934 100644 --- a/examples/lighting-app/ameba/README.md +++ b/examples/lighting-app/ameba/README.md @@ -23,11 +23,11 @@ The CHIP demo application is supported on - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:54 + $ docker pull ghcr.io/project-chip/chip-build-ameba:74 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:54 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:74 - Setup build environment: diff --git a/examples/ota-requestor-app/ameba/README.md b/examples/ota-requestor-app/ameba/README.md index a5de1316eb523c..607a9abd08bee3 100644 --- a/examples/ota-requestor-app/ameba/README.md +++ b/examples/ota-requestor-app/ameba/README.md @@ -6,11 +6,11 @@ A prototype application that demonstrates OTA Requestor capabilities. - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:54 + $ docker pull ghcr.io/project-chip/chip-build-ameba:74 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:54 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:74 - Setup build environment: diff --git a/examples/pigweed-app/ameba/README.md b/examples/pigweed-app/ameba/README.md index 7086f7fe87e7ac..da4dd83ca3f31b 100644 --- a/examples/pigweed-app/ameba/README.md +++ b/examples/pigweed-app/ameba/README.md @@ -31,11 +31,11 @@ following features are available: - Pull docker image: - $ docker pull ghcr.io/project-chip/chip-build-ameba:54 + $ docker pull ghcr.io/project-chip/chip-build-ameba:74 - Run docker container: - $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:54 + $ docker run -it -v ${CHIP_DIR}:/root/chip ghcr.io/project-chip/chip-build-ameba:74 - Setup build environment: diff --git a/integrations/cloudbuild/chef.yaml b/integrations/cloudbuild/chef.yaml index 0c4035fcb60973..7ba0882e0310ac 100644 --- a/integrations/cloudbuild/chef.yaml +++ b/integrations/cloudbuild/chef.yaml @@ -1,5 +1,5 @@ steps: - - name: "ghcr.io/project-chip/chip-build-vscode:66" + - name: "ghcr.io/project-chip/chip-build-vscode:74" entrypoint: "bash" args: - "-c" @@ -7,7 +7,7 @@ steps: git config --global --add safe.directory "*" python scripts/checkout_submodules.py --shallow --recursive --platform esp32 nrfconnect silabs linux android id: Submodules - - name: "ghcr.io/project-chip/chip-build-vscode:66" + - name: "ghcr.io/project-chip/chip-build-vscode:74" # NOTE: silabs boostrap is NOT done with the rest as it requests a conflicting # jinja2 version (asks for 3.1.3 when constraints.txt asks for 3.0.3) env: @@ -23,7 +23,7 @@ steps: - name: pwenv path: /pwenv timeout: 900s - - name: "ghcr.io/project-chip/chip-build-vscode:66" + - name: "ghcr.io/project-chip/chip-build-vscode:74" env: - PW_ENVIRONMENT_ROOT=/pwenv args: @@ -38,7 +38,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:66" + - name: "ghcr.io/project-chip/chip-build-vscode:74" env: - PW_ENVIRONMENT_ROOT=/pwenv args: diff --git a/integrations/cloudbuild/smoke-test.yaml b/integrations/cloudbuild/smoke-test.yaml index ef69af5db73481..af3ed1f3b4c869 100644 --- a/integrations/cloudbuild/smoke-test.yaml +++ b/integrations/cloudbuild/smoke-test.yaml @@ -1,5 +1,5 @@ steps: - - name: "ghcr.io/project-chip/chip-build-vscode:66" + - name: "ghcr.io/project-chip/chip-build-vscode:74" entrypoint: "bash" args: - "-c" @@ -7,7 +7,7 @@ steps: git config --global --add safe.directory "*" python scripts/checkout_submodules.py --shallow --recursive --platform esp32 nrfconnect silabs linux android id: Submodules - - name: "ghcr.io/project-chip/chip-build-vscode:66" + - name: "ghcr.io/project-chip/chip-build-vscode:74" # NOTE: silabs boostrap is NOT done with the rest as it requests a conflicting # jinja2 version (asks for 3.1.3 when constraints.txt asks for 3.0.3) env: @@ -24,7 +24,7 @@ steps: path: /pwenv timeout: 900s - - name: "ghcr.io/project-chip/chip-build-vscode:66" + - name: "ghcr.io/project-chip/chip-build-vscode:74" id: ESP32 env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -45,7 +45,7 @@ steps: volumes: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:66" + - name: "ghcr.io/project-chip/chip-build-vscode:74" id: NRFConnect env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -66,7 +66,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:66" + - name: "ghcr.io/project-chip/chip-build-vscode:74" id: EFR32 env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -88,7 +88,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:66" + - name: "ghcr.io/project-chip/chip-build-vscode:74" id: Linux env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -141,7 +141,7 @@ steps: - name: pwenv path: /pwenv - - name: "ghcr.io/project-chip/chip-build-vscode:66" + - name: "ghcr.io/project-chip/chip-build-vscode:74" id: Android env: - PW_ENVIRONMENT_ROOT=/pwenv diff --git a/scripts/py_matter_yamltests/matter_yamltests/runner.py b/scripts/py_matter_yamltests/matter_yamltests/runner.py index 541a261a43b4b2..05fe8fc54e851c 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/runner.py +++ b/scripts/py_matter_yamltests/matter_yamltests/runner.py @@ -162,7 +162,8 @@ async def _run_with_timeout(self, parser: TestParser, config: TestRunnerConfig): try: if config.auto_start_stop: await self.start() - status = await asyncio.wait_for(self._run(parser, config), parser.timeout) + task = self._run(parser, config) + status = await asyncio.wait_for(asyncio.shield(task), parser.timeout) except (Exception, CancelledError) as exception: status = exception finally: From cd04522004de548373d99e06b61b3af3fd718139 Mon Sep 17 00:00:00 2001 From: Pradip De Date: Fri, 16 Aug 2024 15:27:46 -0700 Subject: [PATCH 56/59] Fix test code build issues when INET_CONFIG_TCP_ENDPOINT is set to false (#35027) --- src/inet/tests/TestInetEndPoint.cpp | 16 +++++- src/inet/tests/inet-layer-test-tool.cpp | 21 ++++++- src/messaging/tests/echo/echo_requester.cpp | 64 ++++++++++++++------- src/messaging/tests/echo/echo_responder.cpp | 10 +++- src/transport/SessionManager.cpp | 12 ++-- 5 files changed, 89 insertions(+), 34 deletions(-) diff --git a/src/inet/tests/TestInetEndPoint.cpp b/src/inet/tests/TestInetEndPoint.cpp index 10209c0ba9b50f..426f749f09de21 100644 --- a/src/inet/tests/TestInetEndPoint.cpp +++ b/src/inet/tests/TestInetEndPoint.cpp @@ -256,9 +256,11 @@ TEST_F(TestInetEndPoint, TestInetEndPointInternal) InterfaceId intId; // EndPoint - UDPEndPoint * testUDPEP = nullptr; + UDPEndPoint * testUDPEP = nullptr; +#if INET_CONFIG_ENABLE_TCP_ENDPOINT TCPEndPoint * testTCPEP1 = nullptr; - PacketBufferHandle buf = PacketBufferHandle::New(PacketBuffer::kMaxSize); +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT + PacketBufferHandle buf = PacketBufferHandle::New(PacketBuffer::kMaxSize); // init all the EndPoints SYSTEM_STATS_RESET(System::Stats::kInetLayer_NumUDPEps); @@ -266,10 +268,12 @@ TEST_F(TestInetEndPoint, TestInetEndPointInternal) ASSERT_EQ(err, CHIP_NO_ERROR); EXPECT_TRUE(SYSTEM_STATS_TEST_IN_USE(System::Stats::kInetLayer_NumUDPEps, 1)); +#if INET_CONFIG_ENABLE_TCP_ENDPOINT SYSTEM_STATS_RESET(System::Stats::kInetLayer_NumTCPEps); err = gTCP.NewEndPoint(&testTCPEP1); ASSERT_EQ(err, CHIP_NO_ERROR); - EXPECT_TRUE(SYSTEM_STATS_TEST_IN_USE(System::Stats::kInetLayer_NumUDPEps, 1)); + EXPECT_TRUE(SYSTEM_STATS_TEST_IN_USE(System::Stats::kInetLayer_NumTCPEps, 1)); +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT err = InterfaceId::Null().GetLinkLocalAddr(&addr); @@ -323,6 +327,7 @@ TEST_F(TestInetEndPoint, TestInetEndPointInternal) testUDPEP->Free(); EXPECT_TRUE(SYSTEM_STATS_TEST_IN_USE(System::Stats::kInetLayer_NumUDPEps, 0)); +#if INET_CONFIG_ENABLE_TCP_ENDPOINT // TcpEndPoint special cases to cover the error branch err = testTCPEP1->GetPeerInfo(nullptr, nullptr); EXPECT_EQ(err, CHIP_ERROR_INCORRECT_STATE); @@ -362,6 +367,7 @@ TEST_F(TestInetEndPoint, TestInetEndPointInternal) testTCPEP1->Free(); EXPECT_TRUE(SYSTEM_STATS_TEST_IN_USE(System::Stats::kInetLayer_NumTCPEps, 0)); EXPECT_TRUE(SYSTEM_STATS_TEST_HIGH_WATER_MARK(System::Stats::kInetLayer_NumTCPEps, 1)); +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT } #if !CHIP_SYSTEM_CONFIG_POOL_USE_HEAP @@ -369,7 +375,9 @@ TEST_F(TestInetEndPoint, TestInetEndPointInternal) TEST_F(TestInetEndPoint, TestInetEndPointLimit) { UDPEndPoint * testUDPEP[INET_CONFIG_NUM_UDP_ENDPOINTS + 1] = { nullptr }; +#if INET_CONFIG_ENABLE_TCP_ENDPOINT TCPEndPoint * testTCPEP[INET_CONFIG_NUM_TCP_ENDPOINTS + 1] = { nullptr }; +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT CHIP_ERROR err = CHIP_NO_ERROR; @@ -388,6 +396,7 @@ TEST_F(TestInetEndPoint, TestInetEndPointLimit) const int udpHighWaterMark = udpCount; EXPECT_TRUE(SYSTEM_STATS_TEST_HIGH_WATER_MARK(System::Stats::kInetLayer_NumUDPEps, udpHighWaterMark)); +#if INET_CONFIG_ENABLE_TCP_ENDPOINT int tcpCount = 0; SYSTEM_STATS_RESET(System::Stats::kInetLayer_NumTCPEps); for (int i = INET_CONFIG_NUM_TCP_ENDPOINTS; i >= 0; --i) @@ -402,6 +411,7 @@ TEST_F(TestInetEndPoint, TestInetEndPointLimit) } const int tcpHighWaterMark = tcpCount; EXPECT_TRUE(SYSTEM_STATS_TEST_HIGH_WATER_MARK(System::Stats::kInetLayer_NumTCPEps, tcpHighWaterMark)); +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT #if CHIP_SYSTEM_CONFIG_NUM_TIMERS // Verify same aComplete and aAppState args do not exhaust timer pool diff --git a/src/inet/tests/inet-layer-test-tool.cpp b/src/inet/tests/inet-layer-test-tool.cpp index e276600fa10108..0c1158a9ed25ed 100644 --- a/src/inet/tests/inet-layer-test-tool.cpp +++ b/src/inet/tests/inet-layer-test-tool.cpp @@ -88,11 +88,14 @@ static const uint32_t kExpectedTxSizeDefault = kExpectedRxSizeDefault; static const uint32_t kOptFlagsDefault = (kOptFlagUseIPv6 | kOptFlagUseUDPIP); +#if INET_CONFIG_ENABLE_TCP_ENDPOINT static TCPEndPoint * sTCPIPEndPoint = nullptr; // Used for connect/send/receive static TCPEndPoint * sTCPIPListenEndPoint = nullptr; // Used for accept/listen -static UDPEndPoint * sUDPIPEndPoint = nullptr; +static const uint16_t kTCPPort = kUDPPort; +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT + +static UDPEndPoint * sUDPIPEndPoint = nullptr; -static const uint16_t kTCPPort = kUDPPort; // clang-format off static TestState sTestState = { @@ -184,6 +187,7 @@ static OptionSet * sToolOptionSets[] = namespace chip { namespace Inet { +#if INET_CONFIG_ENABLE_TCP_ENDPOINT class TCPTest { public: @@ -193,6 +197,7 @@ class TCPTest return endPoint->mState == TCPEndPoint::State::kConnected || endPoint->mState == TCPEndPoint::State::kReceiveShutdown; } }; +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT } // namespace Inet } // namespace chip @@ -502,6 +507,7 @@ static bool HandleDataReceived(const PacketBufferHandle & aBuffer, bool aCheckBu // TCP Endpoint Callbacks +#if INET_CONFIG_ENABLE_TCP_ENDPOINT void HandleTCPConnectionComplete(TCPEndPoint * aEndPoint, CHIP_ERROR aError) { CHIP_ERROR lStatus; @@ -636,6 +642,7 @@ static void HandleTCPConnectionReceived(TCPEndPoint * aListenEndPoint, TCPEndPoi sTCPIPEndPoint = aConnectEndPoint; } +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT // UDP Endpoint Callbacks @@ -673,11 +680,13 @@ static bool IsTransportReadyForSend() return (sUDPIPEndPoint != nullptr); } +#if INET_CONFIG_ENABLE_TCP_ENDPOINT if ((gOptFlags & kOptFlagUseTCPIP) == kOptFlagUseTCPIP) { return (sTCPIPEndPoint != nullptr) && (sTCPIPEndPoint->PendingSendLength() == 0) && TCPTest::StateIsConnectedOrReceiveShutdown(sTCPIPEndPoint); } +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT return false; } @@ -686,6 +695,7 @@ static CHIP_ERROR PrepareTransportForSend() { CHIP_ERROR lStatus = CHIP_NO_ERROR; +#if INET_CONFIG_ENABLE_TCP_ENDPOINT if (gOptFlags & kOptFlagUseTCPIP) { if (sTCPIPEndPoint == nullptr) @@ -702,6 +712,7 @@ static CHIP_ERROR PrepareTransportForSend() INET_FAIL_ERROR(lStatus, "TCPEndPoint::Connect failed"); } } +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT return (lStatus); } @@ -722,6 +733,7 @@ static CHIP_ERROR DriveSendForDestination(const IPAddress & aAddress, uint16_t a ReturnErrorOnFailure(sUDPIPEndPoint->SendTo(aAddress, kUDPPort, std::move(lBuffer))); } +#if INET_CONFIG_ENABLE_TCP_ENDPOINT else if ((gOptFlags & kOptFlagUseTCPIP) == kOptFlagUseTCPIP) { const uint32_t lFirstValue = sTestState.mStats.mTransmit.mActual; @@ -737,6 +749,7 @@ static CHIP_ERROR DriveSendForDestination(const IPAddress & aAddress, uint16_t a ReturnErrorOnFailure(sTCPIPEndPoint->Send(std::move(lBuffer))); } +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT return CHIP_NO_ERROR; } @@ -838,6 +851,7 @@ static void StartTest() lStatus = sUDPIPEndPoint->Listen(HandleUDPMessageReceived, HandleUDPReceiveError); INET_FAIL_ERROR(lStatus, "UDPEndPoint::Listen failed"); } +#if INET_CONFIG_ENABLE_TCP_ENDPOINT else if (gOptFlags & kOptFlagUseTCPIP) { const uint16_t lConnectionBacklogMax = 1; @@ -855,6 +869,7 @@ static void StartTest() lStatus = sTCPIPListenEndPoint->Listen(lConnectionBacklogMax); INET_FAIL_ERROR(lStatus, "TCPEndPoint::Listen failed"); } +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT } if (Common::IsReceiver()) @@ -870,6 +885,7 @@ static void CleanupTest() // Release the resources associated with the allocated end points. +#if INET_CONFIG_ENABLE_TCP_ENDPOINT if (sTCPIPEndPoint != nullptr) { sTCPIPEndPoint->Close(); @@ -881,6 +897,7 @@ static void CleanupTest() sTCPIPListenEndPoint->Shutdown(); sTCPIPListenEndPoint->Free(); } +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT if (sUDPIPEndPoint != nullptr) { diff --git a/src/messaging/tests/echo/echo_requester.cpp b/src/messaging/tests/echo/echo_requester.cpp index b06edb359b989f..c3aa3f6085c6df 100644 --- a/src/messaging/tests/echo/echo_requester.cpp +++ b/src/messaging/tests/echo/echo_requester.cpp @@ -51,9 +51,6 @@ namespace { // Max value for the number of EchoRequests sent. constexpr size_t kMaxEchoCount = 3; -// Max value for the number of tcp connect attempts. -constexpr size_t kMaxTCPConnectAttempts = 3; - // The CHIP Echo interval time. constexpr chip::System::Clock::Timeout gEchoInterval = chip::System::Clock::Seconds16(1); @@ -63,15 +60,17 @@ constexpr chip::FabricIndex gFabricIndex = 0; chip::Protocols::Echo::EchoClient gEchoClient; chip::TransportMgr gUDPManager; +#if INET_CONFIG_ENABLE_TCP_ENDPOINT +// Max value for the number of tcp connect attempts. +constexpr size_t kMaxTCPConnectAttempts = 3; + chip::TransportMgr> gTCPManager; -chip::Inet::IPAddress gDestAddr; -chip::SessionHolder gSession; chip::Transport::AppTCPConnectionCallbackCtxt gAppTCPConnCbCtxt; chip::Transport::ActiveTCPConnectionState * gActiveTCPConnState = nullptr; -// The last time a CHIP Echo was attempted to be sent. -chip::System::Clock::Timestamp gLastEchoTime = chip::System::Clock::kZero; +static void HandleConnectionAttemptComplete(chip::Transport::ActiveTCPConnectionState * conn, CHIP_ERROR conErr); +static void HandleConnectionClosed(chip::Transport::ActiveTCPConnectionState * conn, CHIP_ERROR conErr); // True, if client is still connecting to the server, false otherwise. static bool gClientConInProgress = false; @@ -79,6 +78,16 @@ static bool gClientConInProgress = false; // True, once client connection to server is established. static bool gClientConEstablished = false; +bool gUseTCP = false; +uint64_t gTCPConnAttemptCount = 0; +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT + +chip::Inet::IPAddress gDestAddr; +chip::SessionHolder gSession; + +// The last time a CHIP Echo was attempted to be sent. +chip::System::Clock::Timestamp gLastEchoTime = chip::System::Clock::kZero; + // The handle to the TCP connection to the peer. // static chip::Transport::ActiveTCPConnectionState * gCon = nullptr; @@ -88,16 +97,9 @@ uint64_t gEchoCount = 0; // Count of the number of EchoResponses received. uint64_t gEchoRespCount = 0; -bool gUseTCP = false; - -uint64_t gTCPConnAttemptCount = 0; - CHIP_ERROR SendEchoRequest(); void EchoTimerHandler(chip::System::Layer * systemLayer, void * appState); -static void HandleConnectionAttemptComplete(chip::Transport::ActiveTCPConnectionState * conn, CHIP_ERROR conErr); -static void HandleConnectionClosed(chip::Transport::ActiveTCPConnectionState * conn, CHIP_ERROR conErr); - void Shutdown() { chip::DeviceLayer::SystemLayer().CancelTimer(EchoTimerHandler, nullptr); @@ -170,15 +172,17 @@ CHIP_ERROR SendEchoRequest() return err; } -CHIP_ERROR EstablishSecureSession(chip::Transport::ActiveTCPConnectionState * conn = nullptr) +CHIP_ERROR EstablishSecureSession() { char peerAddrBuf[chip::Transport::PeerAddress::kMaxToStringSize]; chip::Transport::PeerAddress peerAddr; +#if INET_CONFIG_ENABLE_TCP_ENDPOINT if (gUseTCP) { peerAddr = chip::Transport::PeerAddress::TCP(gDestAddr, CHIP_PORT); } else +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT { peerAddr = chip::Transport::PeerAddress::UDP(gDestAddr, CHIP_PORT, chip::Inet::InterfaceId::Null()); } @@ -195,11 +199,13 @@ CHIP_ERROR EstablishSecureSession(chip::Transport::ActiveTCPConnectionState * co } else { +#if INET_CONFIG_ENABLE_TCP_ENDPOINT if (gUseTCP) { - printf("Associating secure session with connection %p\n", conn); - gSession.Get().Value()->AsSecureSession()->SetTCPConnection(conn); + printf("Associating secure session with connection %p\n", gActiveTCPConnState); + gSession.Get().Value()->AsSecureSession()->SetTCPConnection(gActiveTCPConnState); } +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT printf("Successfully established secure session with peer at %s\n", peerAddrBuf); } @@ -207,6 +213,7 @@ CHIP_ERROR EstablishSecureSession(chip::Transport::ActiveTCPConnectionState * co return err; } +#if INET_CONFIG_ENABLE_TCP_ENDPOINT void CloseConnection() { char peerAddrBuf[chip::Transport::PeerAddress::kMaxToStringSize]; @@ -225,7 +232,7 @@ void HandleConnectionAttemptComplete(chip::Transport::ActiveTCPConnectionState * { chip::DeviceLayer::PlatformMgr().StopEventLoopTask(); - if (err != CHIP_NO_ERROR) + if (err != CHIP_NO_ERROR || conn != gActiveTCPConnState) { printf("Connection FAILED with err: %s\n", chip::ErrorStr(err)); @@ -235,7 +242,7 @@ void HandleConnectionAttemptComplete(chip::Transport::ActiveTCPConnectionState * return; } - err = EstablishSecureSession(conn); + err = EstablishSecureSession(); if (err != CHIP_NO_ERROR) { printf("Secure session FAILED with err: %s\n", chip::ErrorStr(err)); @@ -281,6 +288,7 @@ void EstablishTCPConnection() gClientConInProgress = true; } +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT void HandleEchoResponseReceived(chip::Messaging::ExchangeContext * ec, chip::System::PacketBufferHandle && payload) { @@ -313,10 +321,12 @@ int main(int argc, char * argv[]) ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); } +#if INET_CONFIG_ENABLE_TCP_ENDPOINT if ((argc == 3) && (strcmp(argv[2], "--tcp") == 0)) { gUseTCP = true; } +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT if (!chip::Inet::IPAddress::FromString(argv[1], gDestAddr)) { @@ -332,6 +342,7 @@ int main(int argc, char * argv[]) InitializeChip(); +#if INET_CONFIG_ENABLE_TCP_ENDPOINT if (gUseTCP) { err = gTCPManager.Init(chip::Transport::TcpListenParameters(chip::DeviceLayer::TCPEndPointManager()) @@ -348,6 +359,7 @@ int main(int argc, char * argv[]) gAppTCPConnCbCtxt.connClosedCb = HandleConnectionClosed; } else +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT { err = gUDPManager.Init(chip::Transport::UdpListenParameters(chip::DeviceLayer::UDPEndPointManager()) .SetAddressType(chip::Inet::IPAddressType::kIPv6) @@ -365,13 +377,14 @@ int main(int argc, char * argv[]) err = gMessageCounterManager.Init(&gExchangeManager); SuccessOrExit(err); +#if INET_CONFIG_ENABLE_TCP_ENDPOINT if (gUseTCP) { while (!gClientConEstablished) { // For TCP transport, attempt to establish the connection to the CHIP echo responder. - // On Connection completion, call EstablishSecureSession(conn); + // On Connection completion, call EstablishSecureSession(); EstablishTCPConnection(); chip::DeviceLayer::PlatformMgr().RunEventLoop(); @@ -383,9 +396,10 @@ int main(int argc, char * argv[]) } } else +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT { // Start the CHIP session to the CHIP echo responder. - err = EstablishSecureSession(nullptr); + err = EstablishSecureSession(); SuccessOrExit(err); } @@ -402,16 +416,22 @@ int main(int argc, char * argv[]) gUDPManager.Close(); +#if INET_CONFIG_ENABLE_TCP_ENDPOINT if (gUseTCP) { gTCPManager.TCPDisconnect(chip::Transport::PeerAddress::TCP(gDestAddr)); } gTCPManager.Close(); +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT Shutdown(); exit: - if ((err != CHIP_NO_ERROR) || (gEchoRespCount != kMaxEchoCount) || (gTCPConnAttemptCount > kMaxTCPConnectAttempts)) + if ((err != CHIP_NO_ERROR) || (gEchoRespCount != kMaxEchoCount) +#if INET_CONFIG_ENABLE_TCP_ENDPOINT + || (gTCPConnAttemptCount > kMaxTCPConnectAttempts) +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT + ) { printf("ChipEchoClient failed: %s\n", chip::ErrorStr(err)); exit(EXIT_FAILURE); diff --git a/src/messaging/tests/echo/echo_responder.cpp b/src/messaging/tests/echo/echo_responder.cpp index 0cd2366a1f6c2b..46550635845a9b 100644 --- a/src/messaging/tests/echo/echo_responder.cpp +++ b/src/messaging/tests/echo/echo_responder.cpp @@ -45,7 +45,9 @@ namespace { // The EchoServer object. chip::Protocols::Echo::EchoServer gEchoServer; chip::TransportMgr gUDPManager; +#if INET_CONFIG_ENABLE_TCP_ENDPOINT chip::TransportMgr> gTCPManager; +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT chip::SessionHolder gSession; // Callback handler when a CHIP EchoRequest is received. @@ -60,7 +62,9 @@ int main(int argc, char * argv[]) { CHIP_ERROR err = CHIP_NO_ERROR; chip::Transport::PeerAddress peer(chip::Transport::Type::kUndefined); - bool useTCP = false; +#if INET_CONFIG_ENABLE_TCP_ENDPOINT + bool useTCP = false; +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT bool disableEcho = false; const chip::FabricIndex gFabricIndex = 0; @@ -71,10 +75,12 @@ int main(int argc, char * argv[]) ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT); } +#if INET_CONFIG_ENABLE_TCP_ENDPOINT if ((argc == 2) && (strcmp(argv[1], "--tcp") == 0)) { useTCP = true; } +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT if ((argc == 2) && (strcmp(argv[1], "--disable") == 0)) { @@ -83,6 +89,7 @@ int main(int argc, char * argv[]) InitializeChip(); +#if INET_CONFIG_ENABLE_TCP_ENDPOINT if (useTCP) { err = gTCPManager.Init(chip::Transport::TcpListenParameters(chip::DeviceLayer::TCPEndPointManager()) @@ -94,6 +101,7 @@ int main(int argc, char * argv[]) SuccessOrExit(err); } else +#endif // INET_CONFIG_ENABLE_TCP_ENDPOINT { err = gUDPManager.Init(chip::Transport::UdpListenParameters(chip::DeviceLayer::UDPEndPointManager()) .SetAddressType(chip::Inet::IPAddressType::kIPv6)); diff --git a/src/transport/SessionManager.cpp b/src/transport/SessionManager.cpp index 17065e319cf3bd..d9582479458617 100644 --- a/src/transport/SessionManager.cpp +++ b/src/transport/SessionManager.cpp @@ -1269,18 +1269,18 @@ Optional SessionManager::FindSecureSessionForNode(ScopedNodeId pe if (session->IsActiveSession() && session->GetPeer() == peerNodeId && (!type.HasValue() || type.Value() == session->GetSecureSessionType())) { -#if INET_CONFIG_ENABLE_TCP_ENDPOINT - if ((transportPayloadCapability == TransportPayloadCapability::kMRPOrTCPCompatiblePayload || - transportPayloadCapability == TransportPayloadCapability::kLargePayload) && - session->GetTCPConnection() != nullptr) + if (transportPayloadCapability == TransportPayloadCapability::kMRPOrTCPCompatiblePayload || + transportPayloadCapability == TransportPayloadCapability::kLargePayload) { +#if INET_CONFIG_ENABLE_TCP_ENDPOINT // Set up a TCP transport based session as standby - if ((tcpSession == nullptr) || (tcpSession->GetLastActivityTime() < session->GetLastActivityTime())) + if ((tcpSession == nullptr || tcpSession->GetLastActivityTime() < session->GetLastActivityTime()) && + session->GetTCPConnection() != nullptr) { tcpSession = session; } - } #endif // INET_CONFIG_ENABLE_TCP_ENDPOINT + } if ((mrpSession == nullptr) || (mrpSession->GetLastActivityTime() < session->GetLastActivityTime())) { From 44456d77f7176bf590f08fb021d53b7c5741af6a Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 16 Aug 2024 21:35:18 -0400 Subject: [PATCH 57/59] Prevent cancellation of task with timeout in asyncio runner. (#35045) I am yet unclear why on new python/os/websocket we do not get a timeout error, however from what I could tell, wait_for would cancel the websocket.recv and that stops instead of throwing a timeout exception, resulting in a full success result. Making this change seems to make the test TestPurposefulFailureExtraReportingOnToggle pass on my machine (well ... fail as expected instead of passing with a successful stop) Co-authored-by: Andrei Litvin From ebc2576cc6fa5427484be6b3a6e3c0d5802aeff9 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Sat, 17 Aug 2024 16:41:17 -0400 Subject: [PATCH 58/59] TC-IDM-10.2: Fix error message (#35044) --- src/python_testing/TC_DeviceConformance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_testing/TC_DeviceConformance.py b/src/python_testing/TC_DeviceConformance.py index d847ef6aeb95ec..3cc57e2b018ab6 100644 --- a/src/python_testing/TC_DeviceConformance.py +++ b/src/python_testing/TC_DeviceConformance.py @@ -136,7 +136,7 @@ def record_warning(location, problem): conformance_decision_with_choice = xml_feature.conformance(feature_map, attribute_list, all_command_list) if conformance_decision_with_choice.decision == ConformanceDecision.MANDATORY and feature_mask not in feature_masks: record_error( - location=location, problem=f'Required feature with mask 0x{f:02x} is not present in feature map. {conformance_str(xml_feature.conformance, feature_map, self.xml_clusters[cluster_id].features)}') + location=location, problem=f'Required feature with mask 0x{feature_mask:02x} is not present in feature map. {conformance_str(xml_feature.conformance, feature_map, self.xml_clusters[cluster_id].features)}') # Attribute conformance checking for attribute_id, attribute in cluster.items(): From 1e58f964d693cb803be59d67b54b194dff83bc22 Mon Sep 17 00:00:00 2001 From: Kiel Oleson Date: Sat, 17 Aug 2024 15:00:16 -0700 Subject: [PATCH 59/59] [Darwin] New XPC Service (#34961) * empty xpc service files * XPC service needs to be C++ to use MTRLogging * add tests; stub method signature * start configuring test XPC listener * add first test method to XPC service protocol * tests: remove peformance test; add headers * make MTRXPCService testable * more working lines of XPC listener setup * add dummy XPC service for testing * add replying method to service protocol / implementation * remove log - reply contents can be asserted * make test interesting * linty formatty * remove personal development team from pbxproj * fix new file headers * less whitespace * Restyled by whitespace * Restyled by clang-format * add new XPC device controller * sketch out a first XPC method * store WIP for rebase * fix pbxproj merge mistake * make WIP slightly more sensible * WIP: remote proxy obj in `MTRDeviceController_XPC` * more experiments * WIP: return type issue run `MTRXPCServiceTests testMTRXPCServiceSetup` and see selection of proxy object method in `MTRDeviceController_XPC.m`/`initWithXPCListenerEndpointForTesting` around line 44 to see the problem. * add `MTRDevice_XPC` nothing exciting yet * add device controller over XPC parameters stub * add init split for XPC device controllers not yet implemented, but there * rename new XPC parameters class `OverXPC` is already taken / means something else * Restyled by whitespace * Restyled by clang-format * remove failing exploratory test * lintfix * Examples * quickly attempt to fix test unused variable -> warning -> error * Restyled by whitespace * Restyled by clang-format * inevitably the file will need to be obj-C++ * prepare to use mach service name to create XPC connection * allow for other XPC controller connection types for now once mach service is working, i don't expect to need others, but easier to collapse classes than raise. * constant for well-known matter plugin service name * note to self and re-ordering of this code now what `XPCParameters` is a subclass * XPC parameters should support secure coding * don't keep around object proxy; make a new one when needed. try calling the `checkIn` method when connecting. remove old test methods that served their purpose. * that doesn't need to be there. * Restyled by whitespace * Restyled by clang-format * no longer fighting with compiler, have some `instancetype` * extremely normal object construction * somehow this header got thrown out * Restyled by whitespace * Restyled by clang-format * Updating XPC interfaces * hide `initWithMachServiceName:options:` constructor tvOS/iOS compilation issues need a look * make `MTRDeviceController_XPC` an XPC client via `MTRXPCClientProtocol_MTRDeviceController`, which for the moment is empty * remove initial tests they served their purpose well but are no longer relevant * call mach service constructor when appropriate also logging * remove some obsolete test methods * more obsoletes fixed * more obsolete removal and logging tweaks * buildability tweaks * Moving along * Fixing header * Fixing macros and codable * Adding invoke? * Restyled by whitespace * Restyled by clang-format * Actually hooking up to XPCConnection * Actually hooking up to XPCConnection * Adding XPC Parameters * Adding XPC Parameter hookup * Restyled by whitespace * Restyled by clang-format * true => YES --------- Co-authored-by: Restyled.io Co-authored-by: Justin Wood --- src/darwin/Framework/CHIP/MTRCluster.h | 6 +- src/darwin/Framework/CHIP/MTRCluster.mm | 123 ++++++++++ .../Framework/CHIP/MTRDefines_Internal.h | 47 ++++ .../Framework/CHIP/MTRDeviceController.mm | 7 +- .../CHIP/MTRDeviceControllerParameters.h | 22 ++ .../CHIP/MTRDeviceControllerStartupParams.mm | 17 ++ .../CHIP/MTRDeviceControllerXPCParameters.h | 31 +++ .../CHIP/MTRDeviceControllerXPCParameters.mm | 35 +++ .../CHIP/MTRDeviceController_Concrete.mm | 69 +++--- .../Framework/CHIP/MTRDeviceController_XPC.h | 35 +++ .../Framework/CHIP/MTRDeviceController_XPC.mm | 196 +++++++++++++++ .../CHIP/MTRDeviceController_XPC_Internal.h | 23 ++ .../Framework/CHIP/MTRDevice_Internal.h | 2 + src/darwin/Framework/CHIP/MTRDevice_XPC.h | 26 ++ src/darwin/Framework/CHIP/MTRDevice_XPC.mm | 227 ++++++++++++++++++ .../CHIP/XPC Protocol/MTRXPCClientProtocol.h | 3 + .../CHIP/XPC Protocol/MTRXPCServerProtocol.h | 2 +- .../Matter.xcodeproj/project.pbxproj | 39 ++- 18 files changed, 872 insertions(+), 38 deletions(-) create mode 100644 src/darwin/Framework/CHIP/MTRDeviceControllerXPCParameters.h create mode 100644 src/darwin/Framework/CHIP/MTRDeviceControllerXPCParameters.mm create mode 100644 src/darwin/Framework/CHIP/MTRDeviceController_XPC.h create mode 100644 src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm create mode 100644 src/darwin/Framework/CHIP/MTRDeviceController_XPC_Internal.h create mode 100644 src/darwin/Framework/CHIP/MTRDevice_XPC.h create mode 100644 src/darwin/Framework/CHIP/MTRDevice_XPC.mm diff --git a/src/darwin/Framework/CHIP/MTRCluster.h b/src/darwin/Framework/CHIP/MTRCluster.h index b3543d67b30281..8184d3c684839c 100644 --- a/src/darwin/Framework/CHIP/MTRCluster.h +++ b/src/darwin/Framework/CHIP/MTRCluster.h @@ -73,7 +73,7 @@ MTR_AVAILABLE(ios(17.4), macos(14.4), watchos(10.4), tvos(17.4)) * treated as if a default-initialized object was passed in. */ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) -@interface MTRWriteParams : NSObject +@interface MTRWriteParams : NSObject /** * Controls whether the write is a timed write. @@ -109,7 +109,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) * treated as if a default-initialized object was passed in. */ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) -@interface MTRReadParams : NSObject +@interface MTRReadParams : NSObject /** * Whether the read/subscribe is fabric-filtered. The default is YES. @@ -152,7 +152,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) * treated as if a default-initialized object was passed in. */ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) -@interface MTRSubscribeParams : MTRReadParams +@interface MTRSubscribeParams : MTRReadParams /** * Whether the subscribe should replace already-existing diff --git a/src/darwin/Framework/CHIP/MTRCluster.mm b/src/darwin/Framework/CHIP/MTRCluster.mm index 9bcb38e4cbac99..b80c90931669c8 100644 --- a/src/darwin/Framework/CHIP/MTRCluster.mm +++ b/src/darwin/Framework/CHIP/MTRCluster.mm @@ -69,6 +69,8 @@ - (instancetype)init return self; } +#pragma mark - Copying + - (id)copyWithZone:(NSZone * _Nullable)zone { auto other = [[MTRWriteParams alloc] init]; @@ -77,6 +79,38 @@ - (id)copyWithZone:(NSZone * _Nullable)zone return other; } +#pragma mark - Coding + ++ (BOOL)supportsSecureCoding +{ + return YES; +} + +static NSString * sTimedWriteTimeoutCodingKey = @"sTimedWriteTimeoutKey"; +static NSString * sDataVersionCodingKey = @"sDataVersionKey"; + +- (nullable instancetype)initWithCoder:(NSCoder *)decoder +{ + self = [super init]; + + if (self == nil) { + return nil; + } + + self.timedWriteTimeout = [decoder decodeObjectOfClass:[NSNumber class] forKey:sTimedWriteTimeoutCodingKey]; + self.dataVersion = [decoder decodeObjectOfClass:[NSNumber class] forKey:sDataVersionCodingKey]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)coder +{ + if (self.timedWriteTimeout) + [coder encodeObject:self.timedWriteTimeout forKey:sTimedWriteTimeoutCodingKey]; + if (self.dataVersion) + [coder encodeObject:self.dataVersion forKey:sDataVersionCodingKey]; +} + @end @implementation MTRReadParams @@ -89,6 +123,43 @@ - (instancetype)init return self; } +#pragma mark - Coding + ++ (BOOL)supportsSecureCoding +{ + return YES; +} + +static NSString * sFilterByFabricCoderKey = @"sFilterByFabricKey"; +static NSString * sMinEventNumberCoderKey = @"sMinEventNumberKey"; +static NSString * sAssumeUnknownAttributesReportableCoderKey = @"sAssumeUnknownAttributesReportableKey"; + +- (nullable instancetype)initWithCoder:(NSCoder *)decoder +{ + self = [super init]; + + if (self == nil) { + return nil; + } + + self.filterByFabric = [decoder decodeBoolForKey:sFilterByFabricCoderKey]; + self.assumeUnknownAttributesReportable = [decoder decodeBoolForKey:sAssumeUnknownAttributesReportableCoderKey]; + self.minEventNumber = [decoder decodeObjectOfClass:[NSNumber class] forKey:sMinEventNumberCoderKey]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)coder +{ + [coder encodeBool:self.filterByFabric forKey:sFilterByFabricCoderKey]; + [coder encodeBool:self.assumeUnknownAttributesReportable forKey:sAssumeUnknownAttributesReportableCoderKey]; + + if (self.minEventNumber) + [coder encodeObject:self.minEventNumber forKey:sMinEventNumberCoderKey]; +} + +#pragma mark - Copying + - (id)copyWithZone:(NSZone * _Nullable)zone { auto other = [[MTRReadParams alloc] init]; @@ -98,6 +169,8 @@ - (id)copyWithZone:(NSZone * _Nullable)zone return other; } +#pragma mark - Other + - (void)toReadPrepareParams:(chip::app::ReadPrepareParams &)readPrepareParams { readPrepareParams.mIsFabricFiltered = self.filterByFabric; @@ -121,18 +194,68 @@ - (instancetype)initWithMinInterval:(NSNumber *)minInterval maxInterval:(NSNumbe return self; } +#pragma mark - Copying - (id)copyWithZone:(NSZone * _Nullable)zone { auto other = [[MTRSubscribeParams alloc] initWithMinInterval:self.minInterval maxInterval:self.maxInterval]; + other.filterByFabric = self.filterByFabric; other.minEventNumber = self.minEventNumber; other.assumeUnknownAttributesReportable = self.assumeUnknownAttributesReportable; other.replaceExistingSubscriptions = self.replaceExistingSubscriptions; other.reportEventsUrgently = self.reportEventsUrgently; other.resubscribeAutomatically = self.resubscribeAutomatically; + other.minInterval = self.minInterval; + other.maxInterval = self.maxInterval; + return other; } +#pragma mark - Coding ++ (BOOL)supportsSecureCoding +{ + return YES; +} + +static NSString * sReplaceExistingSubscriptionsCoderKey = @"sFilterByFabricKey"; +static NSString * sReportEventsUrgentlyCoderKey = @"sMinEventNumberKey"; +static NSString * sResubscribeAutomaticallyCoderKey = @"sAssumeUnknownAttributesReportableKey"; +static NSString * sMinIntervalKeyCoderKey = @"sMinIntervalKeyKey"; +static NSString * sMaxIntervalKeyCoderKey = @"sMaxIntervalKeyKey"; + +- (nullable instancetype)initWithCoder:(NSCoder *)decoder +{ + self = [super initWithCoder:decoder]; + + if (self == nil) { + return nil; + } + + self.replaceExistingSubscriptions = [decoder decodeBoolForKey:sReplaceExistingSubscriptionsCoderKey]; + self.reportEventsUrgently = [decoder decodeBoolForKey:sReportEventsUrgentlyCoderKey]; + self.resubscribeAutomatically = [decoder decodeBoolForKey:sResubscribeAutomaticallyCoderKey]; + self.minInterval = [decoder decodeObjectOfClass:[NSNumber class] forKey:sMinIntervalKeyCoderKey]; + self.maxInterval = [decoder decodeObjectOfClass:[NSNumber class] forKey:sMaxIntervalKeyCoderKey]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)coder +{ + [super encodeWithCoder:coder]; + + [coder encodeBool:self.replaceExistingSubscriptions forKey:sReplaceExistingSubscriptionsCoderKey]; + [coder encodeBool:self.reportEventsUrgently forKey:sReportEventsUrgentlyCoderKey]; + [coder encodeBool:self.resubscribeAutomatically forKey:sResubscribeAutomaticallyCoderKey]; + + if (self.minInterval) + [coder encodeObject:self.minInterval forKey:sMinIntervalKeyCoderKey]; + if (self.maxInterval) + [coder encodeObject:self.maxInterval forKey:sMaxIntervalKeyCoderKey]; +} + +#pragma mark - Main + - (void)toReadPrepareParams:(chip::app::ReadPrepareParams &)readPrepareParams { [super toReadPrepareParams:readPrepareParams]; diff --git a/src/darwin/Framework/CHIP/MTRDefines_Internal.h b/src/darwin/Framework/CHIP/MTRDefines_Internal.h index da31ce1b54dda7..7894f31835a142 100644 --- a/src/darwin/Framework/CHIP/MTRDefines_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDefines_Internal.h @@ -64,3 +64,50 @@ typedef struct {} variable_hidden_by_mtr_hide; // Default timed interaction timeout, in ms, if another one is not provided. #define MTR_DEFAULT_TIMED_INTERACTION_TIMEOUT_MS 10000 + +#pragma mark - XPC Defines + +#define MTR_SIMPLE_REMOTE_XPC_GETTER(XPC_CONNECTION, NAME, TYPE, DEFAULT_VALUE, GETTER_NAME, PREFIX) \ + \ + -(TYPE) NAME \ + { \ + __block TYPE outValue = DEFAULT_VALUE; \ + \ + NSXPCConnection * xpcConnection = XPC_CONNECTION; \ + \ + [[xpcConnection synchronousRemoteObjectProxyWithErrorHandler:^(NSError * _Nonnull error) { \ + MTR_LOG_ERROR("Error: %@", error); \ + }] PREFIX \ + GETTER_NAME:^(TYPE returnValue) { \ + outValue = returnValue; \ + }]; \ + \ + return outValue; \ + } + +#define MTR_SIMPLE_REMOTE_XPC_COMMAND(XPC_CONNECTION, METHOD_SIGNATURE, ADDITIONAL_ARGUMENTS, PREFIX) \ + \ + -(void) METHOD_SIGNATURE \ + { \ + NSXPCConnection * xpcConnection = XPC_CONNECTION; \ + \ + [[xpcConnection synchronousRemoteObjectProxyWithErrorHandler:^(NSError * _Nonnull error) { \ + MTR_LOG_ERROR("Error: %@", error); \ + }] PREFIX ADDITIONAL_ARGUMENTS]; \ + } + +#define MTR_COMPLEX_REMOTE_XPC_GETTER(XPC_CONNECTION, SIGNATURE, TYPE, DEFAULT_VALUE, ADDITIONAL_ARGUMENTS, PREFIX) \ + -(TYPE) SIGNATURE \ + { \ + __block TYPE outValue = DEFAULT_VALUE; \ + \ + NSXPCConnection * xpcConnection = XPC_CONNECTION; \ + \ + [[xpcConnection synchronousRemoteObjectProxyWithErrorHandler:^(NSError * _Nonnull error) { \ + MTR_LOG_ERROR("Error: %@", error); \ + }] PREFIX ADDITIONAL_ARGUMENTS:^(TYPE returnValue) { \ + outValue = returnValue; \ + }]; \ + \ + return outValue; \ + } diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.mm b/src/darwin/Framework/CHIP/MTRDeviceController.mm index ee8cc2b7549190..3483ff33320c31 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController.mm @@ -31,6 +31,7 @@ #import "MTRDeviceControllerLocalTestStorage.h" #import "MTRDeviceControllerStartupParams.h" #import "MTRDeviceControllerStartupParams_Internal.h" +#import "MTRDeviceController_XPC.h" #import "MTRDevice_Concrete.h" #import "MTRDevice_Internal.h" #import "MTRError_Internal.h" @@ -144,7 +145,11 @@ - (instancetype)initForSubclasses - (nullable MTRDeviceController *)initWithParameters:(MTRDeviceControllerAbstractParameters *)parameters error:(NSError * __autoreleasing *)error { - if (![parameters isKindOfClass:MTRDeviceControllerParameters.class]) { + if ([parameters isKindOfClass:MTRXPCDeviceControllerParameters.class]) { + MTRXPCDeviceControllerParameters * resolvedParameters = (MTRXPCDeviceControllerParameters *) parameters; + MTR_LOG("Starting up with XPC Device Controller Parameters: %@", parameters); + return [[MTRDeviceController_XPC alloc] initWithUniqueIdentifier:resolvedParameters.uniqueIdentifier xpConnectionBlock:resolvedParameters.xpcConnectionBlock]; + } else if (![parameters isKindOfClass:MTRDeviceControllerParameters.class]) { MTR_LOG_ERROR("Unsupported type of MTRDeviceControllerAbstractParameters: %@", parameters); if (error) { *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INVALID_ARGUMENT]; diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h b/src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h index ffccc18b0398a4..caedc20229eb89 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerParameters.h @@ -145,4 +145,26 @@ MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6)) @end +MTR_NEWLY_AVAILABLE +@interface MTRXPCDeviceControllerParameters : MTRDeviceControllerAbstractParameters + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +/** + * A controller created from this way will connect to a remote instance of an MTRDeviceController loaded in an XPC Service + * + * @param xpcConnectionBlock The XPC Connection block that will return an NSXPCConnection to the indended listener. + * + * @param uniqueIdentifier The unique id to assign to the controller. + * + */ +- (instancetype)initWithXPConnectionBlock:(NSXPCConnection * (^)(void) )xpcConnectionBlock + uniqueIdentifier:(NSUUID *)uniqueIdentifier; + +@property (atomic, readonly, retain) NSUUID * uniqueIdentifier MTR_NEWLY_AVAILABLE; +@property (readonly, strong, nonatomic) NSXPCConnection * (^xpcConnectionBlock)(void) MTR_NEWLY_AVAILABLE; + +@end + NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm index f393d48d0a99c1..c5923ad4e54619 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm @@ -331,6 +331,23 @@ - (instancetype)initWithStorageDelegate:(id) } @end +@implementation MTRXPCDeviceControllerParameters + +@synthesize uniqueIdentifier = _uniqueIdentifier; +@synthesize xpcConnectionBlock = _xpcConnectionBlock; + +- (instancetype)initWithXPConnectionBlock:(NSXPCConnection * (^)(void) )xpcConnectionBlock + uniqueIdentifier:(NSUUID *)uniqueIdentifier; +{ + if (self = [super _initInternal]) { + _xpcConnectionBlock = [xpcConnectionBlock copy]; + _uniqueIdentifier = [uniqueIdentifier copy]; + } + + return self; +} +@end + @implementation MTRDeviceControllerStartupParamsInternal - (instancetype)initWithParams:(MTRDeviceControllerStartupParams *)params diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerXPCParameters.h b/src/darwin/Framework/CHIP/MTRDeviceControllerXPCParameters.h new file mode 100644 index 00000000000000..9218ff2a990dcd --- /dev/null +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerXPCParameters.h @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2024 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 + +NS_ASSUME_NONNULL_BEGIN + +@interface MTRDeviceControllerXPCParameters : MTRDeviceControllerParameters +@end + +@interface MTRDeviceControllerMachServiceXPCParameters : MTRDeviceControllerXPCParameters + +@property (atomic, retain) NSString * machServiceName; +@property (atomic, readwrite) NSXPCConnectionOptions connectionOptions; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerXPCParameters.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerXPCParameters.mm new file mode 100644 index 00000000000000..5178873ec27f1e --- /dev/null +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerXPCParameters.mm @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2024 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 "MTRDeviceControllerXPCParameters.h" + +@implementation MTRDeviceControllerXPCParameters + ++ (BOOL)supportsSecureCoding +{ + return YES; +} + +@end + +@implementation MTRDeviceControllerMachServiceXPCParameters + ++ (BOOL)supportsSecureCoding +{ + return YES; +} + +@end diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm b/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm index c7ccab25e1cdc4..d53d94b83db946 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm @@ -32,7 +32,10 @@ #import "MTRDeviceControllerLocalTestStorage.h" #import "MTRDeviceControllerStartupParams.h" #import "MTRDeviceControllerStartupParams_Internal.h" +#import "MTRDeviceControllerXPCParameters.h" #import "MTRDeviceController_Concrete.h" +#import "MTRDeviceController_XPC.h" +#import "MTRDeviceController_XPC_Internal.h" #import "MTRDevice_Concrete.h" #import "MTRDevice_Internal.h" #import "MTRError_Internal.h" @@ -134,44 +137,52 @@ @implementation MTRDeviceController_Concrete { @synthesize concurrentSubscriptionPool = _concurrentSubscriptionPool; @synthesize storageBehaviorConfiguration = _storageBehaviorConfiguration; -- (nullable MTRDeviceController_Concrete *)initWithParameters:(MTRDeviceControllerAbstractParameters *)parameters - error:(NSError * __autoreleasing *)error +- (nullable instancetype)initWithParameters:(MTRDeviceControllerAbstractParameters *)parameters + error:(NSError * __autoreleasing *)error { - if (![parameters isKindOfClass:MTRDeviceControllerParameters.class]) { - MTR_LOG_ERROR("Unsupported type of MTRDeviceControllerAbstractParameters: %@", parameters); - if (error) { - *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INVALID_ARGUMENT]; - } - return nil; - } - auto * controllerParameters = static_cast(parameters); + /// IF YOU ARE ALARMED BY TYPES: You are right to be alarmed, but do not panic. + /// _ORDER MATTERS HERE:_ XPC parameters are a subclass of `MTRDeviceControllerParameters` + /// because of the enormous overlap of params. + if ([parameters isKindOfClass:MTRDeviceControllerXPCParameters.class]) { + if ([parameters isKindOfClass:MTRDeviceControllerMachServiceXPCParameters.class]) { + MTRDeviceControllerMachServiceXPCParameters * xpcParameters = (MTRDeviceControllerMachServiceXPCParameters *) parameters; + MTR_LOG_DEBUG("%s: got XPC parameters, getting XPC device controller", __PRETTY_FUNCTION__); - // or, if necessary, MTRDeviceControllerFactory will auto-start in per-controller-storage mode if necessary - MTRDeviceControllerFactory * factory = MTRDeviceControllerFactory.sharedInstance; - id controller = [factory initializeController:self - withParameters:controllerParameters - error:error]; - return controller; -} + NSString * machServiceName = xpcParameters.machServiceName; + MTR_LOG_DEBUG("%s: machServiceName %@", __PRETTY_FUNCTION__, machServiceName); -- (nullable MTRDeviceController *)bogusWithParameters:(MTRDeviceControllerAbstractParameters *)parameters - error:(NSError * __autoreleasing *)error -{ - if (![parameters isKindOfClass:MTRDeviceControllerParameters.class]) { + MTRDeviceController * xpcDeviceController = [[MTRDeviceController_XPC alloc] initWithMachServiceName:machServiceName options:xpcParameters.connectionOptions]; + + /// Being of sound mind, I willfully and voluntarily make this static cast. + return static_cast(xpcDeviceController); + } else { + MTR_LOG_ERROR("%s: unrecognized XPC parameters class %@", __PRETTY_FUNCTION__, NSStringFromClass(parameters.class)); + + // TODO: there's probably a more appropriate error here. + if (error) { + *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_NOT_IMPLEMENTED]; + } + + return nil; + } + } else if ([parameters isKindOfClass:MTRDeviceControllerParameters.class]) { + MTR_LOG_DEBUG("%s: got standard parameters, getting standard device controller from factory", __PRETTY_FUNCTION__); + auto * controllerParameters = static_cast(parameters); + + // or, if necessary, MTRDeviceControllerFactory will auto-start in per-controller-storage mode if necessary + MTRDeviceControllerFactory * factory = MTRDeviceControllerFactory.sharedInstance; + id controller = [factory initializeController:self + withParameters:controllerParameters + error:error]; + return controller; + } else { + // way out of our league MTR_LOG_ERROR("Unsupported type of MTRDeviceControllerAbstractParameters: %@", parameters); if (error) { *error = [MTRError errorForCHIPErrorCode:CHIP_ERROR_INVALID_ARGUMENT]; } return nil; } - auto * controllerParameters = static_cast(parameters); - - // MTRDeviceControllerFactory will auto-start in per-controller-storage mode if necessary - MTRDeviceControllerFactory * factory = MTRDeviceControllerFactory.sharedInstance; - MTRDeviceController * controller = [factory initializeController:self - withParameters:controllerParameters - error:error]; - return controller; } - (instancetype)initWithFactory:(MTRDeviceControllerFactory *)factory diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_XPC.h b/src/darwin/Framework/CHIP/MTRDeviceController_XPC.h new file mode 100644 index 00000000000000..574d3eac628f3d --- /dev/null +++ b/src/darwin/Framework/CHIP/MTRDeviceController_XPC.h @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2024 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 "MTRDefines_Internal.h" // MTR_TESTABLE +#import "MTRDeviceController.h" +#import "MTRXPCClientProtocol.h" // MTRXPCClientProtocol_MTRDeviceController +#import + +NS_ASSUME_NONNULL_BEGIN + +MTR_TESTABLE +@interface MTRDeviceController_XPC : MTRDeviceController +- (id)initWithUniqueIdentifier:(NSUUID *)UUID xpConnectionBlock:(NSXPCConnection * (^)(void) )connectionBlock; +#ifdef MTR_HAVE_MACH_SERVICE_NAME_CONSTRUCTOR +- (id)initWithUniqueIdentifier:(NSUUID *)UUID machServiceName:(NSString *)machServiceName options:(NSXPCConnectionOptions)options +#endif + + @property(atomic, retain, readwrite)NSXPCConnection * xpcConnection; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm b/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm new file mode 100644 index 00000000000000..1d91ae0d5d5f9a --- /dev/null +++ b/src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm @@ -0,0 +1,196 @@ +/** + * Copyright (c) 2024 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 "MTRDeviceController_XPC.h" +#import "MTRDefines_Internal.h" +#import "MTRDeviceController_Internal.h" +#import "MTRDevice_XPC.h" +#import "MTRLogging_Internal.h" +#import "MTRXPCClientProtocol.h" +#import "MTRXPCServerProtocol.h" + +#define MTR_DEVICECONTROLLER_SIMPLE_REMOTE_XPC_GETTER(NAME, TYPE, DEFAULT_VALUE, GETTER_NAME) \ + MTR_SIMPLE_REMOTE_XPC_GETTER(self.xpcConnection, NAME, TYPE, DEFAULT_VALUE, GETTER_NAME, deviceController \ + : self.uniqueIdentifier) + +#define MTR_DEVICECONTROLLER_SIMPLE_REMOTE_XPC_COMMAND(METHOD_SIGNATURE, ADDITIONAL_ARGUMENTS) \ + MTR_SIMPLE_REMOTE_XPC_COMMAND(self.xpcConnection, METHOD_SIGNATURE, ADDITIONAL_ARGUMENTS, deviceController \ + : self.uniqueIdentifier) + +@interface MTRDeviceController_XPC () + +@property (nonatomic, retain, readwrite) NSUUID * uniqueIdentifier; + +@end + +// #define MTR_HAVE_MACH_SERVICE_NAME_CONSTRUCTOR + +@implementation MTRDeviceController_XPC + +@synthesize uniqueIdentifier = _uniqueIdentifier; + +- (id)initWithUniqueIdentifier:(NSUUID *)UUID xpConnectionBlock:(NSXPCConnection * (^)(void) )connectionBlock +{ + if (self = [super initForSubclasses]) { + MTR_LOG("Setting up XPC Controller for UUID: %@ with connection block: %p", UUID, connectionBlock); + + if (UUID == nil) { + MTR_LOG_ERROR("MTRDeviceController_XPC initWithUniqueIdentifier failed, nil UUID"); + return nil; + } + if (connectionBlock == nil) { + MTR_LOG_ERROR("MTRDeviceController_XPC initWithUniqueIdentifier failed, nil connectionBlock"); + return nil; + } + + self.xpcConnection = connectionBlock(); + self.uniqueIdentifier = UUID; + + MTR_LOG("Set up XPC Connection: %@", self.xpcConnection); + if (self.xpcConnection) { + self.xpcConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(MTRXPCServerProtocol)]; + + self.xpcConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(MTRXPCClientProtocol)]; + self.xpcConnection.exportedObject = self; + + MTR_LOG("Resuming new XPC connection"); + [self.xpcConnection resume]; + } else { + MTR_LOG_ERROR("Failed to set up XPC Connection"); + return nil; + } + } + + return self; +} + +#ifdef MTR_HAVE_MACH_SERVICE_NAME_CONSTRUCTOR +- (id)initWithUniqueIdentifier:(NSUUID *)UUID machServiceName:(NSString *)machServiceName options:(NSXPCConnectionOptions)options +{ + if (self = [super initForSubclasses]) { + MTR_LOG("Setting up XPC Controller for UUID: %@ with machServiceName: %s options: %d", UUID, machServiceName, options); + self.xpcConnection = [[NSXPCConnection alloc] initWithMachServiceName:machServiceName options:options]; + self.uniqueIdentifier = UUID; + + MTR_LOG("Set up XPC Connection: %@", self.xpcConnection); + if (self.xpcConnection) { + self.xpcConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(MTRXPCServerProtocol)]; + + self.xpcConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(MTRXPCClientProtocol)]; + self.xpcConnection.exportedObject = self; + + MTR_LOG("%s: resuming new XPC connection"); + [self.xpcConnection resume]; + } else { + MTR_LOG_ERROR("Failed to set up XPC Connection"); + return nil; + } + } + + return self; +} +#endif // MTR_HAVE_MACH_SERVICE_NAME_CONSTRUCTOR + +- (nullable instancetype)initWithParameters:(MTRDeviceControllerAbstractParameters *)parameters + error:(NSError * __autoreleasing *)error +{ + MTR_LOG_ERROR("%s: unimplemented method called", __PRETTY_FUNCTION__); + return nil; +} + +#pragma mark - XPC Action Overrides + +MTR_DEVICECONTROLLER_SIMPLE_REMOTE_XPC_GETTER(isRunning, BOOL, NO, getIsRunningWithReply) +MTR_DEVICECONTROLLER_SIMPLE_REMOTE_XPC_GETTER(controllerNodeID, NSNumber *, nil, controllerNodeIDWithReply) + +// Not Supported via XPC +// - (oneway void)deviceController:(NSUUID *)controller setupCommissioningSessionWithPayload:(MTRSetupPayload *)payload newNodeID:(NSNumber *)newNodeID withReply:(void(^)(BOOL success, NSError * _Nullable error))reply; +// - (oneway void)deviceController:(NSUUID *)controller setupCommissioningSessionWithDiscoveredDevice:(MTRCommissionableBrowserResult *)discoveredDevice payload:(MTRSetupPayload *)payload newNodeID:(NSNumber *)newNodeID withReply:(void(^)(BOOL success, NSError * _Nullable error))reply; +// - (oneway void)deviceController:(NSUUID *)controller commissionNodeWithID:(NSNumber *)nodeID commissioningParams:(MTRCommissioningParameters *)commissioningParams withReply:(void(^)(BOOL success, NSError * _Nullable error))reply; +// - (oneway void)deviceController:(NSUUID *)controller continueCommissioningDevice:(void *)opaqueDeviceHandle ignoreAttestationFailure:(BOOL)ignoreAttestationFailure withReply:(void(^)(BOOL success, NSError * _Nullable error))reply; +// - (oneway void)deviceController:(NSUUID *)controller cancelCommissioningForNodeID:(NSNumber *)nodeID withReply:(void(^)(BOOL success, NSError * _Nullable error))reply; +// - (nullable MTRBaseDevice *)deviceController:(NSUUID *)controller deviceBeingCommissionedWithNodeID:(NSNumber *)nodeID error:(NSError * __autoreleasing *)error; +// - (oneway void)deviceController:(NSUUID *)controller startBrowseForCommissionables:(id)delegate withReply:(void(^)(BOOL success))reply; +// - (oneway void)deviceController:(NSUUID *)controller stopBrowseForCommissionablesWithReply:(void(^)(BOOL success))reply; +// - (oneway void)deviceController:(NSUUID *)controller attestationChallengeForDeviceID:(NSNumber *)deviceID withReply:(void(^)(NSData * _Nullable))reply; + +//- (oneway void)deviceController:(NSUUID *)controller addServerEndpoint:(MTRServerEndpoint *)endpoint withReply:(void(^)(BOOL success))reply; +//- (oneway void)deviceController:(NSUUID *)controller removeServerEndpoint:(MTRServerEndpoint *)endpoint; + +MTR_DEVICECONTROLLER_SIMPLE_REMOTE_XPC_COMMAND(shutdown, shutdownDeviceController + : self.uniqueIdentifier) + +#pragma mark - MTRDeviceProtocol Client + +// All pass through, we could do some fancy redirection here based on protocol, but that's that for another day +- (oneway void)device:(NSNumber *)nodeID stateChanged:(MTRDeviceState)state +{ + MTRDevice_XPC * device = (MTRDevice_XPC *) [self deviceForNodeID:nodeID]; + MTR_LOG("Received device: %@ stateChanged: %lu found device: %@", nodeID, (unsigned long) state, device); + [device device:nodeID stateChanged:state]; +} +- (oneway void)device:(NSNumber *)nodeID receivedAttributeReport:(NSArray *> *)attributeReport +{ + MTRDevice_XPC * device = (MTRDevice_XPC *) [self deviceForNodeID:nodeID]; + MTR_LOG("Received device: %@ receivedAttributeReport: %@ found device: %@", nodeID, attributeReport, device); + + [device device:nodeID receivedAttributeReport:attributeReport]; +} +- (oneway void)device:(NSNumber *)nodeID receivedEventReport:(NSArray *> *)eventReport +{ + MTRDevice_XPC * device = (MTRDevice_XPC *) [self deviceForNodeID:nodeID]; + MTR_LOG("Received device: %@ receivedEventReport: %@ found device: %@", nodeID, eventReport, device); + + [device device:nodeID receivedEventReport:eventReport]; +} +- (oneway void)deviceBecameActive:(NSNumber *)nodeID +{ + MTRDevice_XPC * device = (MTRDevice_XPC *) [self deviceForNodeID:nodeID]; + MTR_LOG("Received deviceBecameActive: %@ found device: %@", nodeID, device); + + [device deviceBecameActive:nodeID]; +} +- (oneway void)deviceCachePrimed:(NSNumber *)nodeID +{ + MTRDevice_XPC * device = (MTRDevice_XPC *) [self deviceForNodeID:nodeID]; + MTR_LOG("Received deviceCachePrimed: %@ found device: %@", nodeID, device); + + [device deviceCachePrimed:nodeID]; +} +- (oneway void)deviceConfigurationChanged:(NSNumber *)nodeID +{ + MTRDevice_XPC * device = (MTRDevice_XPC *) [self deviceForNodeID:nodeID]; + MTR_LOG("Received deviceConfigurationChanged: %@ found device: %@", nodeID, device); + + [device deviceConfigurationChanged:nodeID]; +} + +#pragma mark - MTRDeviceController Protocol Client + +// Not Supported via XPC +//- (oneway void)controller:(NSUUID *)controller statusUpdate:(MTRCommissioningStatus)status { +// } +//- (oneway void)controller:(NSUUID *)controller commissioningSessionEstablishmentDone:(NSError * _Nullable)error { +// +//} +//- (oneway void)controller:(NSUUID *)controller commissioningComplete:(NSError * _Nullable)error nodeID:(NSNumber * _Nullable)nodeID metrics:(MTRMetrics * _Nullable)metrics { +// +//} +//- (oneway void)controller:(NSUUID *)controller readCommissioningInfo:(MTRProductIdentity *)info { +// +//} + +@end diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_XPC_Internal.h b/src/darwin/Framework/CHIP/MTRDeviceController_XPC_Internal.h new file mode 100644 index 00000000000000..e6c85b1f8de348 --- /dev/null +++ b/src/darwin/Framework/CHIP/MTRDeviceController_XPC_Internal.h @@ -0,0 +1,23 @@ +/** + * Copyright (c) 2024 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 "MTRDeviceController_XPC.h" + +@interface MTRDeviceController_XPC (Internal) + +- (id)initWithMachServiceName:(NSString *)machServiceName options:(NSXPCConnectionOptions)options; + +@end diff --git a/src/darwin/Framework/CHIP/MTRDevice_Internal.h b/src/darwin/Framework/CHIP/MTRDevice_Internal.h index 943e939f47f204..4c1b51f51c0a48 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDevice_Internal.h @@ -81,6 +81,8 @@ MTR_TESTABLE // false-positives, for example due to compressed fabric id collisions. - (void)nodeMayBeAdvertisingOperational; +- (BOOL)_callDelegatesWithBlock:(void (^)(id delegate))block; + /** * Like the public invokeCommandWithEndpointID but: * diff --git a/src/darwin/Framework/CHIP/MTRDevice_XPC.h b/src/darwin/Framework/CHIP/MTRDevice_XPC.h new file mode 100644 index 00000000000000..a2df4a60446aec --- /dev/null +++ b/src/darwin/Framework/CHIP/MTRDevice_XPC.h @@ -0,0 +1,26 @@ +// +/** + * 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 + +NS_ASSUME_NONNULL_BEGIN + +@interface MTRDevice_XPC : MTRDevice + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/MTRDevice_XPC.mm b/src/darwin/Framework/CHIP/MTRDevice_XPC.mm new file mode 100644 index 00000000000000..95f69cb7d4dc90 --- /dev/null +++ b/src/darwin/Framework/CHIP/MTRDevice_XPC.mm @@ -0,0 +1,227 @@ +// +/** + * 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 "MTRDevice_XPC.h" + +// Need to move these to PCHs... +#import +#import + +#import "MTRDeviceController_Internal.h" + +#import "MTRAsyncWorkQueue.h" +#import "MTRAttestationTrustStoreBridge.h" +#import "MTRBaseDevice_Internal.h" +#import "MTRCommissionableBrowser.h" +#import "MTRCommissionableBrowserResult_Internal.h" +#import "MTRCommissioningParameters.h" +#import "MTRConversion.h" +#import "MTRDefines_Internal.h" +#import "MTRDeviceAttestationDelegateBridge.h" +#import "MTRDeviceConnectionBridge.h" +#import "MTRDeviceController.h" +#import "MTRDeviceControllerDelegateBridge.h" +#import "MTRDeviceControllerFactory_Internal.h" +#import "MTRDeviceControllerLocalTestStorage.h" +#import "MTRDeviceControllerStartupParams.h" +#import "MTRDeviceControllerStartupParams_Internal.h" +#import "MTRDeviceControllerXPCParameters.h" +#import "MTRDeviceController_Concrete.h" +#import "MTRDeviceController_XPC.h" +#import "MTRDevice_Concrete.h" +#import "MTRDevice_Internal.h" +#import "MTRError_Internal.h" +#import "MTRKeypair.h" +#import "MTRLogging_Internal.h" +#import "MTRMetricKeys.h" +#import "MTRMetricsCollector.h" +#import "MTROperationalCredentialsDelegate.h" +#import "MTRP256KeypairBridge.h" +#import "MTRPersistentStorageDelegateBridge.h" +#import "MTRServerEndpoint_Internal.h" +#import "MTRSetupPayload.h" +#import "MTRTimeUtils.h" +#import "MTRUnfairLock.h" +#import "NSDataSpanConversion.h" +#import "NSStringSpanConversion.h" + +#include +#include +#include + +#import + +#define MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(NAME, TYPE, DEFAULT_VALUE, GETTER_NAME) \ + MTR_SIMPLE_REMOTE_XPC_GETTER([(MTRDeviceController_XPC *) [self deviceController] xpcConnection], NAME, TYPE, DEFAULT_VALUE, GETTER_NAME, deviceController \ + : [[self deviceController] uniqueIdentifier] nodeID \ + : [self nodeID]) + +#define MTR_DEVICE_COMPLEX_REMOTE_XPC_GETTER(SIGNATURE, TYPE, DEFAULT_VALUE, ADDITIONAL_ARGUMENTS) \ + MTR_COMPLEX_REMOTE_XPC_GETTER([(MTRDeviceController_XPC *) [self deviceController] xpcConnection], SIGNATURE, TYPE, DEFAULT_VALUE, ADDITIONAL_ARGUMENTS, deviceController \ + : [[self deviceController] uniqueIdentifier] nodeID \ + : [self nodeID]) + +#define MTR_DEVICE_SIMPLE_REMOTE_XPC_COMMAND(METHOD_SIGNATURE, ADDITIONAL_ARGUMENTS) \ + MTR_SIMPLE_REMOTE_XPC_COMMAND([(MTRDeviceController_XPC *) [self deviceController] xpcConnection], METHOD_SIGNATURE, ADDITIONAL_ARGUMENTS, deviceController \ + : [[self deviceController] uniqueIdentifier] nodeID \ + : [self nodeID]) + +@implementation MTRDevice_XPC + +#pragma mark - Client Callbacks +- (oneway void)device:(NSNumber *)nodeID stateChanged:(MTRDeviceState)state +{ + [self _callDelegatesWithBlock:^(id delegate) { + [delegate device:self stateChanged:state]; + }]; +} +- (oneway void)device:(NSNumber *)nodeID receivedAttributeReport:(NSArray *> *)attributeReport +{ + [self _callDelegatesWithBlock:^(id delegate) { + [delegate device:self receivedAttributeReport:attributeReport]; + }]; +} +- (oneway void)device:(NSNumber *)nodeID receivedEventReport:(NSArray *> *)eventReport +{ + [self _callDelegatesWithBlock:^(id delegate) { + [delegate device:self receivedEventReport:eventReport]; + }]; +} +- (oneway void)deviceBecameActive:(NSNumber *)nodeID +{ + [self _callDelegatesWithBlock:^(id delegate) { + [delegate deviceBecameActive:self]; + }]; +} +- (oneway void)deviceCachePrimed:(NSNumber *)nodeID +{ + [self _callDelegatesWithBlock:^(id delegate) { + [delegate deviceCachePrimed:self]; + }]; +} +- (oneway void)deviceConfigurationChanged:(NSNumber *)nodeID +{ + [self _callDelegatesWithBlock:^(id delegate) { + [delegate deviceConfigurationChanged:self]; + }]; +} + +#pragma mark - Remote Commands + +MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(state, MTRDeviceState, MTRDeviceStateUnknown, getStateWithReply) +MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(deviceCachePrimed, BOOL, NO, getDeviceCachePrimedWithReply) +MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(estimatedStartTime, NSDate *, nil, getEstimatedStartTimeWithReply) +MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(estimatedSubscriptionLatency, NSNumber *, nil, getEstimatedSubscriptionLatencyWithReply) + +typedef NSDictionary * readAttributeResponseType; +MTR_DEVICE_COMPLEX_REMOTE_XPC_GETTER(readAttributeWithEndpointID + : (NSNumber *) endpointID clusterID + : (NSNumber *) clusterID attributeID + : (NSNumber *) attributeID params + : (MTRReadParams * _Nullable) params, + readAttributeResponseType, + nil, + readAttributeWithEndpointID + : endpointID clusterID + : clusterID attributeID + : attributeID params + : params withReply) + +MTR_DEVICE_SIMPLE_REMOTE_XPC_COMMAND(writeAttributeWithEndpointID + : (NSNumber *) endpointID clusterID + : (NSNumber *) clusterID attributeID + : (NSNumber *) attributeID value + : (id) value expectedValueInterval + : (NSNumber *) expectedValueInterval timedWriteTimeout + : (NSNumber * _Nullable) timeout, writeAttributeWithEndpointID + : endpointID clusterID + : clusterID attributeID + : attributeID value + : value expectedValueInterval + : expectedValueInterval timedWriteTimeout + : timeout) + +- (void)invokeCommandWithEndpointID:(NSNumber *)endpointID + clusterID:(NSNumber *)clusterID + commandID:(NSNumber *)commandID + commandFields:(id)commandFields + expectedValues:(NSArray *> * _Nullable)expectedValues + expectedValueInterval:(NSNumber * _Nullable)expectedValueInterval + timedInvokeTimeout:(NSNumber * _Nullable)timeout + queue:(dispatch_queue_t)queue + completion:(MTRDeviceResponseHandler)completion +{ + NSXPCConnection * xpcConnection = [(MTRDeviceController_XPC *) [self deviceController] xpcConnection]; + + [[xpcConnection synchronousRemoteObjectProxyWithErrorHandler:^(NSError * _Nonnull error) { + MTR_LOG_ERROR("Error: %@", error); + }] deviceController:[[self deviceController] uniqueIdentifier] + nodeID:[self nodeID] + invokeCommandWithEndpointID:endpointID + clusterID:clusterID + commandID:commandID + commandFields:commandFields + expectedValues:expectedValues + expectedValueInterval:expectedValueInterval + timedInvokeTimeout:timeout + completion:completion]; +} + +// Not Supported via XPC +//- (oneway void)deviceController:(NSUUID *)controller nodeID:(NSNumber *)nodeID openCommissioningWindowWithSetupPasscode:(NSNumber *)setupPasscode discriminator:(NSNumber *)discriminator duration:(NSNumber *)duration completion:(MTRDeviceOpenCommissioningWindowHandler)completion; + +MTR_DEVICE_SIMPLE_REMOTE_XPC_GETTER(clientDataKeys, NSArray *, nil, getClientDataKeysWithReply) +MTR_DEVICE_COMPLEX_REMOTE_XPC_GETTER(clientDataForKey + : (NSString *) key, id _Nullable, nil, clientDataForKey + : key withReply) + +MTR_DEVICE_SIMPLE_REMOTE_XPC_COMMAND(setClientDataForKey + : (NSString *) key value + : (id) value, setClientDataForKey + : key value + : value) +MTR_DEVICE_SIMPLE_REMOTE_XPC_COMMAND(removeClientDataForKey + : (NSString *) key, removeClientDataForKey + : key) + +MTR_DEVICE_COMPLEX_REMOTE_XPC_GETTER(clientDataKeysForEndpointID + : (NSNumber *) endpointID, NSArray * _Nullable, nil, clientDataKeysForEndpointID + : (NSNumber *) endpointID withReply) +MTR_DEVICE_COMPLEX_REMOTE_XPC_GETTER(clientDataForKey + : (NSString *) key endpointID + : (NSNumber *) endpointID, id _Nullable, nil, clientDataForKey + : key endpointID + : endpointID withReply) + +MTR_DEVICE_SIMPLE_REMOTE_XPC_COMMAND(setClientDataForKey + : (NSString *) key endpointID + : (NSNumber *) endpointID value + : (id) value, setClientDataForKey + : key endpointID + : endpointID value + : value) +MTR_DEVICE_SIMPLE_REMOTE_XPC_COMMAND(removeClientDataForKey + : (NSString *) key endpointID + : (NSNumber *) endpointID value + : (id) value, removeClientDataForKey + : key endpointID + : endpointID) + +// Not Supported via XPC +// - (oneway void)downloadLogOfType:(MTRDiagnosticLogType)type nodeID:(NSNumber *)nodeID timeout:(NSTimeInterval)timeout completion:(void (^)(NSURL * _Nullable url, NSError * _Nullable error))completion; + +@end diff --git a/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCClientProtocol.h b/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCClientProtocol.h index 0d518f525f7118..a571ebc07a9257 100644 --- a/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCClientProtocol.h +++ b/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCClientProtocol.h @@ -14,6 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#import // for MTRDeviceState + NS_ASSUME_NONNULL_BEGIN @protocol MTRXPCClientProtocol_MTRDevice diff --git a/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h b/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h index 56077897a9e45a..5d619453b5fd93 100644 --- a/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h +++ b/src/darwin/Framework/CHIP/XPC Protocol/MTRXPCServerProtocol.h @@ -65,7 +65,7 @@ NS_ASSUME_NONNULL_BEGIN //- (oneway void)deviceController:(NSUUID *)controller addServerEndpoint:(MTRServerEndpoint *)endpoint withReply:(void(^)(BOOL success))reply; //- (oneway void)deviceController:(NSUUID *)controller removeServerEndpoint:(MTRServerEndpoint *)endpoint; -- (oneway void)shutdownDeviceController:(NSUUID *)controller; +- (oneway void)deviceController:(NSUUID *)controller shutdownDeviceController:(NSUUID *)controller; @end diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index 69ef3bdc71d81b..3a5968072d5a8d 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -302,10 +302,18 @@ 99AECC802798A57F00B6355B /* MTRCommissioningParameters.mm in Sources */ = {isa = PBXBuildFile; fileRef = 99AECC7F2798A57E00B6355B /* MTRCommissioningParameters.mm */; }; 99C65E10267282F1003402F6 /* MTRControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 99C65E0F267282F1003402F6 /* MTRControllerTests.m */; }; 99D466E12798936D0089A18F /* MTRCommissioningParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 99D466E02798936D0089A18F /* MTRCommissioningParameters.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 9B231B042C62EF650030EB37 /* MTRDeviceController_Concrete.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B231B022C62EF650030EB37 /* MTRDeviceController_Concrete.h */; }; + 9B0484F52C701154006C2D5F /* MTRDeviceController_Concrete.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B0484F42C701154006C2D5F /* MTRDeviceController_Concrete.h */; }; + 9B231B042C62EF650030EB37 /* (null) in Headers */ = {isa = PBXBuildFile; }; 9B231B052C62EF650030EB37 /* MTRDeviceController_Concrete.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9B231B032C62EF650030EB37 /* MTRDeviceController_Concrete.mm */; }; + 9B5CCB592C6E6FD3009DD99B /* MTRDeviceController_XPC_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B5CCB582C6E6FD3009DD99B /* MTRDeviceController_XPC_Internal.h */; }; + 9B5CCB5C2C6EC890009DD99B /* MTRDevice_XPC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9B5CCB5B2C6EC890009DD99B /* MTRDevice_XPC.mm */; }; + 9B5CCB5D2C6EC890009DD99B /* MTRDevice_XPC.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B5CCB5A2C6EC890009DD99B /* MTRDevice_XPC.h */; }; + 9B5CCB602C6EE29E009DD99B /* MTRDeviceControllerXPCParameters.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9B5CCB5F2C6EE29E009DD99B /* MTRDeviceControllerXPCParameters.mm */; }; + 9B5CCB612C6EE29E009DD99B /* MTRDeviceControllerXPCParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B5CCB5E2C6EE29E009DD99B /* MTRDeviceControllerXPCParameters.h */; }; 9BDA2A062C5D9AF800A32BDD /* MTRDevice_Concrete.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9BDA2A052C5D9AF800A32BDD /* MTRDevice_Concrete.mm */; }; 9BDA2A082C5D9AFB00A32BDD /* MTRDevice_Concrete.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BDA2A072C5D9AFB00A32BDD /* MTRDevice_Concrete.h */; }; + 9BFE5D502C6D3075007D4319 /* MTRDeviceController_XPC.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BFE5D4E2C6D3075007D4319 /* MTRDeviceController_XPC.h */; }; + 9BFE5D512C6D3075007D4319 /* MTRDeviceController_XPC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9BFE5D4F2C6D3075007D4319 /* MTRDeviceController_XPC.mm */; }; AF1CB86E2874B03B00865A96 /* MTROTAProviderDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = AF1CB86D2874B03B00865A96 /* MTROTAProviderDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; AF1CB8702874B04C00865A96 /* MTROTAProviderDelegateBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = AF1CB86F2874B04C00865A96 /* MTROTAProviderDelegateBridge.h */; }; AF5F90FF2878D351005503FA /* MTROTAProviderDelegateBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = AF5F90FE2878D351005503FA /* MTROTAProviderDelegateBridge.mm */; }; @@ -735,10 +743,17 @@ 99AECC7F2798A57E00B6355B /* MTRCommissioningParameters.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRCommissioningParameters.mm; sourceTree = ""; }; 99C65E0F267282F1003402F6 /* MTRControllerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MTRControllerTests.m; sourceTree = ""; }; 99D466E02798936D0089A18F /* MTRCommissioningParameters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRCommissioningParameters.h; sourceTree = ""; }; - 9B231B022C62EF650030EB37 /* MTRDeviceController_Concrete.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRDeviceController_Concrete.h; sourceTree = ""; }; + 9B0484F42C701154006C2D5F /* MTRDeviceController_Concrete.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRDeviceController_Concrete.h; sourceTree = ""; }; 9B231B032C62EF650030EB37 /* MTRDeviceController_Concrete.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRDeviceController_Concrete.mm; sourceTree = ""; }; + 9B5CCB582C6E6FD3009DD99B /* MTRDeviceController_XPC_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRDeviceController_XPC_Internal.h; sourceTree = ""; }; + 9B5CCB5A2C6EC890009DD99B /* MTRDevice_XPC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRDevice_XPC.h; sourceTree = ""; }; + 9B5CCB5B2C6EC890009DD99B /* MTRDevice_XPC.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRDevice_XPC.mm; sourceTree = ""; }; + 9B5CCB5E2C6EE29E009DD99B /* MTRDeviceControllerXPCParameters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRDeviceControllerXPCParameters.h; sourceTree = ""; }; + 9B5CCB5F2C6EE29E009DD99B /* MTRDeviceControllerXPCParameters.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRDeviceControllerXPCParameters.mm; sourceTree = ""; }; 9BDA2A052C5D9AF800A32BDD /* MTRDevice_Concrete.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRDevice_Concrete.mm; sourceTree = ""; }; 9BDA2A072C5D9AFB00A32BDD /* MTRDevice_Concrete.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRDevice_Concrete.h; sourceTree = ""; }; + 9BFE5D4E2C6D3075007D4319 /* MTRDeviceController_XPC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRDeviceController_XPC.h; sourceTree = ""; }; + 9BFE5D4F2C6D3075007D4319 /* MTRDeviceController_XPC.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRDeviceController_XPC.mm; sourceTree = ""; }; AF1CB86D2874B03B00865A96 /* MTROTAProviderDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTROTAProviderDelegate.h; sourceTree = ""; }; AF1CB86F2874B04C00865A96 /* MTROTAProviderDelegateBridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTROTAProviderDelegateBridge.h; sourceTree = ""; }; AF5F90FE2878D351005503FA /* MTROTAProviderDelegateBridge.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTROTAProviderDelegateBridge.mm; sourceTree = ""; }; @@ -1251,8 +1266,8 @@ isa = PBXGroup; children = ( D444F9A12C6E8058007761E5 /* XPC Protocol */, - 9B231B022C62EF650030EB37 /* MTRDeviceController_Concrete.h */, 9B231B032C62EF650030EB37 /* MTRDeviceController_Concrete.mm */, + 9B0484F42C701154006C2D5F /* MTRDeviceController_Concrete.h */, 88E07D602B9A89A4005FD53E /* MTRMetricKeys.h */, 88FA798B2B7B257100CD4B6F /* MTRMetricsCollector.h */, 88FA798C2B7B257100CD4B6F /* MTRMetricsCollector.mm */, @@ -1316,6 +1331,8 @@ 7596A84A287636C1004DAE0E /* MTRDevice_Internal.h */, 7596A84228762729004DAE0E /* MTRDevice.h */, 7596A84328762729004DAE0E /* MTRDevice.mm */, + 9B5CCB5A2C6EC890009DD99B /* MTRDevice_XPC.h */, + 9B5CCB5B2C6EC890009DD99B /* MTRDevice_XPC.mm */, 9BDA2A072C5D9AFB00A32BDD /* MTRDevice_Concrete.h */, 9BDA2A052C5D9AF800A32BDD /* MTRDevice_Concrete.mm */, 88EBF8CB27FABDD500686BC1 /* MTRDeviceAttestationDelegate.h */, @@ -1328,6 +1345,9 @@ 75B3269B2BCDB9D600E17C4E /* MTRDeviceConnectivityMonitor.h */, 75B3269D2BCDB9EA00E17C4E /* MTRDeviceConnectivityMonitor.mm */, 991DC0822475F45400C13860 /* MTRDeviceController.h */, + 9BFE5D4E2C6D3075007D4319 /* MTRDeviceController_XPC.h */, + 9B5CCB582C6E6FD3009DD99B /* MTRDeviceController_XPC_Internal.h */, + 9BFE5D4F2C6D3075007D4319 /* MTRDeviceController_XPC.mm */, 5136660F28067D540025EDAE /* MTRDeviceController_Internal.h */, 991DC0872475F47D00C13860 /* MTRDeviceController.mm */, 5A7947E227C0101200434CF2 /* MTRDeviceController+XPC.h */, @@ -1349,6 +1369,8 @@ 51E51FBD282AD37A00FC978D /* MTRDeviceControllerStartupParams_Internal.h */, 51E51FBE282AD37A00FC978D /* MTRDeviceControllerStartupParams.mm */, 51565CB52A7B0D6600469F18 /* MTRDeviceControllerParameters.h */, + 9B5CCB5E2C6EE29E009DD99B /* MTRDeviceControllerXPCParameters.h */, + 9B5CCB5F2C6EE29E009DD99B /* MTRDeviceControllerXPCParameters.mm */, 51565CB32A7AD78D00469F18 /* MTRDeviceControllerStorageDelegate.h */, 5A6FEC9427B5976200F25F42 /* MTRDeviceControllerXPCConnection.h */, 5A6FEC9527B5983000F25F42 /* MTRDeviceControllerXPCConnection.mm */, @@ -1611,6 +1633,7 @@ 517BF3F0282B62B800A8B7DB /* MTRCertificates.h in Headers */, 51E51FBF282AD37A00FC978D /* MTRDeviceControllerStartupParams.h in Headers */, 5136661628067D550025EDAE /* MTRDeviceControllerFactory.h in Headers */, + 9B5CCB592C6E6FD3009DD99B /* MTRDeviceController_XPC_Internal.h in Headers */, 5178E6812AE098520069DF72 /* MTRCommandTimedCheck.h in Headers */, 7596A84B287636C1004DAE0E /* MTRDevice_Internal.h in Headers */, 514C7A042B6436D500DD6D7B /* MTRServerCluster_Internal.h in Headers */, @@ -1621,6 +1644,7 @@ 51B22C1E2740CB0A008D5055 /* MTRStructsObjc.h in Headers */, 2CB7163B252E8A7B0026E2BB /* MTRDeviceControllerDelegateBridge.h in Headers */, 75B765C12A1D71BC0014719B /* MTRAttributeSpecifiedCheck.h in Headers */, + 9B0484F52C701154006C2D5F /* MTRDeviceController_Concrete.h in Headers */, 5ACDDD7A27CD129700EFD68A /* MTRClusterStateCacheContainer.h in Headers */, 5A6FEC9227B5669C00F25F42 /* MTRDeviceControllerOverXPC.h in Headers */, D444F9AA2C6E9A08007761E5 /* MTRXPCClientProtocol.h in Headers */, @@ -1644,8 +1668,10 @@ 88EBF8CE27FABDD500686BC1 /* MTRDeviceAttestationDelegate.h in Headers */, 2C222AD0255C620600E446B9 /* MTRBaseDevice.h in Headers */, 7596A84F2877E6A9004DAE0E /* MTRCluster_Internal.h in Headers */, + 9B5CCB612C6EE29E009DD99B /* MTRDeviceControllerXPCParameters.h in Headers */, 991DC0842475F45400C13860 /* MTRDeviceController.h in Headers */, 88FA798D2B7B257100CD4B6F /* MTRMetricsCollector.h in Headers */, + 9BFE5D502C6D3075007D4319 /* MTRDeviceController_XPC.h in Headers */, 88E6C9462B6334ED001A1FE0 /* MTRMetrics.h in Headers */, AF1CB86E2874B03B00865A96 /* MTROTAProviderDelegate.h in Headers */, 51D0B1402B61B3A4006E3511 /* MTRServerCluster.h in Headers */, @@ -1697,7 +1723,7 @@ 51E51FC0282AD37A00FC978D /* MTRDeviceControllerStartupParams_Internal.h in Headers */, 3DECCB702934AECD00585AEC /* MTRLogging.h in Headers */, 1E4D654E29C208DD00BC3478 /* MTRCommissionableBrowserResult.h in Headers */, - 9B231B042C62EF650030EB37 /* MTRDeviceController_Concrete.h in Headers */, + 9B231B042C62EF650030EB37 /* (null) in Headers */, 515BE4ED2B72C0C5000BC1FD /* MTRUnfairLock.h in Headers */, 998F286F26D55EC5001846C6 /* MTRP256KeypairBridge.h in Headers */, 2C222ADF255C811800E446B9 /* MTRBaseDevice_Internal.h in Headers */, @@ -1705,6 +1731,7 @@ 511913FC28C100EF009235E9 /* MTRBaseSubscriptionCallback.h in Headers */, 51565CB12A7AD77600469F18 /* MTRDeviceControllerDataStore.h in Headers */, 3D843713294977000070D20A /* NSDataSpanConversion.h in Headers */, + 9B5CCB5D2C6EC890009DD99B /* MTRDevice_XPC.h in Headers */, 991DC08B247704DC00C13860 /* MTRLogging_Internal.h in Headers */, 51FE723F2ACDEF3E00437032 /* MTRCommandPayloadExtensions_Internal.h in Headers */, 51D0B12E2B6177FD006E3511 /* MTRAccessGrant.h in Headers */, @@ -1974,6 +2001,7 @@ 51D0B1392B618CC6006E3511 /* MTRServerAttribute.mm in Sources */, 51B22C2A2740CB47008D5055 /* MTRCommandPayloadsObjc.mm in Sources */, 51F522682AE70734000C4050 /* MTRDeviceTypeMetadata.mm in Sources */, + 9B5CCB602C6EE29E009DD99B /* MTRDeviceControllerXPCParameters.mm in Sources */, 75B765C32A1D82D30014719B /* MTRAttributeSpecifiedCheck.mm in Sources */, AF5F90FF2878D351005503FA /* MTROTAProviderDelegateBridge.mm in Sources */, 516415FF2B6B132200D5CE11 /* DataModelHandler.cpp in Sources */, @@ -2001,6 +2029,7 @@ 51D0B12F2B617800006E3511 /* MTRAccessGrant.mm in Sources */, 88E6C9482B6334ED001A1FE0 /* MTRMetrics.mm in Sources */, 1ED276E226C5812A00547A89 /* MTRCluster.mm in Sources */, + 9BFE5D512C6D3075007D4319 /* MTRDeviceController_XPC.mm in Sources */, B2E0D7B3245B0B5C003C5B48 /* MTRError.mm in Sources */, 51E51FC1282AD37A00FC978D /* MTRDeviceControllerStartupParams.mm in Sources */, 51565CAE2A79D42100469F18 /* MTRConversion.mm in Sources */, @@ -2012,6 +2041,7 @@ 9B231B052C62EF650030EB37 /* MTRDeviceController_Concrete.mm in Sources */, 5ACDDD7D27CD16D200EFD68A /* MTRClusterStateCacheContainer.mm in Sources */, 75B3269E2BCDB9EA00E17C4E /* MTRDeviceConnectivityMonitor.mm in Sources */, + 9B5CCB5C2C6EC890009DD99B /* MTRDevice_XPC.mm in Sources */, 513DDB8A2761F6F900DAA01A /* MTRAttributeTLVValueDecoder.mm in Sources */, 5117DD3829A931AE00FFA1AA /* MTROperationalBrowser.mm in Sources */, 514C79F02B62ADDA00DD6D7B /* descriptor.cpp in Sources */, @@ -2410,6 +2440,7 @@ buildSettings = { CLANG_ENABLE_MODULES = YES; CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = ""; "HEADER_SEARCH_PATHS[arch=*]" = "$(PROJECT_DIR)/../../../src"; INFOPLIST_FILE = CHIPTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = (