diff --git a/docs/zap_clusters.md b/docs/zap_clusters.md
index 9033fff4101de9..7651e35b784ed1 100644
--- a/docs/zap_clusters.md
+++ b/docs/zap_clusters.md
@@ -90,6 +90,7 @@ Generally regenerate using one of:
| 257 | 0x101 | DoorLock |
| 258 | 0x102 | WindowCovering |
| 259 | 0x103 | BarrierControl |
+| 336 | 0x150 | ServiceArea |
| 512 | 0x200 | PumpConfigurationAndControl |
| 513 | 0x201 | Thermostat |
| 514 | 0x202 | FanControl |
diff --git a/scripts/rules.matterlint b/scripts/rules.matterlint
index 2ea8c5545471ef..335e37436be00c 100644
--- a/scripts/rules.matterlint
+++ b/scripts/rules.matterlint
@@ -81,6 +81,7 @@ load "../src/app/zap-templates/zcl/data-model/chip/refrigerator-and-temperature-
load "../src/app/zap-templates/zcl/data-model/chip/relative-humidity-measurement-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/rvc-clean-mode-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/rvc-run-mode-cluster.xml";
+load "../src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/scene.xml";
load "../src/app/zap-templates/zcl/data-model/chip/smoke-co-alarm-cluster.xml";
load "../src/app/zap-templates/zcl/data-model/chip/software-diagnostics-cluster.xml";
diff --git a/src/app/zap-templates/zcl/data-model/all.xml b/src/app/zap-templates/zcl/data-model/all.xml
index c0067fad34dc90..23709faca1ace5 100644
--- a/src/app/zap-templates/zcl/data-model/all.xml
+++ b/src/app/zap-templates/zcl/data-model/all.xml
@@ -87,6 +87,7 @@
+
diff --git a/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml
new file mode 100644
index 00000000000000..84e9a464336080
--- /dev/null
+++ b/src/app/zap-templates/zcl/data-model/chip/service-area-cluster.xml
@@ -0,0 +1,130 @@
+
+
+
+
+
+ Data types
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ General
+ Service Area
+ The Service Area cluster provides an interface for controlling the locations where a device should operate, and for querying the current location.
+ 0x0150
+ SERVICE_AREA_CLUSTER
+
+
+
+
+
+
+
+
+
+
+
+ SupportedLocations
+ SupportedMaps
+ SelectedLocations
+ CurrentLocation
+ EstimatedEndTime
+ Progress
+
+
+
+
+ Command used to select a set of device locations, where the device is to operate
+
+
+
+
+
+
+ This command is sent by the device on receipt of the SelectLocations command.
+
+
+
+
+
+
+
+ This command is used to skip the current location where the device operates.
+
+
+
+
+
+ This command is sent by the device on receipt of the SelectLocations command.
+
+
+
+
+
+
+
+
diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json
index b480f5d700a883..b253dd55e72831 100644
--- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json
+++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json
@@ -108,6 +108,7 @@
"rvc-run-mode-cluster.xml",
"resource-monitoring-cluster.xml",
"scene.xml",
+ "service-area-cluster.xml",
"smoke-co-alarm-cluster.xml",
"software-diagnostics-cluster.xml",
"switch-cluster.xml",
diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json
index b647b6728f2d56..6b361e507a3cf3 100644
--- a/src/app/zap-templates/zcl/zcl.json
+++ b/src/app/zap-templates/zcl/zcl.json
@@ -105,6 +105,7 @@
"replacable-monitoring-cluster.xml",
"resource-monitoring-cluster.xml",
"scene.xml",
+ "service-area-cluster.xml",
"smoke-co-alarm-cluster.xml",
"software-diagnostics-cluster.xml",
"switch-cluster.xml",
diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter
index 2b21d4b4a4e708..cb858ffdcd8802 100644
--- a/src/controller/data_model/controller-clusters.matter
+++ b/src/controller/data_model/controller-clusters.matter
@@ -5994,6 +5994,296 @@ deprecated cluster BarrierControl = 259 {
command BarrierControlStop(): DefaultSuccess = 1;
}
+/** The Service Area cluster provides an interface for controlling the locations where a device should operate, and for querying the current location. */
+cluster ServiceArea = 336 {
+ revision 1; // NOTE: Default/not specifically set
+
+ enum AreaTypeTag : enum8 {
+ kAisle = 0;
+ kAttic = 1;
+ kBackDoor = 2;
+ kBackYard = 3;
+ kBalcony = 4;
+ kBallroom = 5;
+ kBathroom = 6;
+ kBedroom = 7;
+ kBorder = 8;
+ kBoxroom = 9;
+ kBreakfastRoom = 10;
+ kCarport = 11;
+ kCellar = 12;
+ kCloakroom = 13;
+ kCloset = 14;
+ kConservatory = 15;
+ kCorridor = 16;
+ kCraftRoom = 17;
+ kCupboard = 18;
+ kDeck = 19;
+ kDen = 20;
+ kDining = 21;
+ kDrawingRoom = 22;
+ kDressingRoom = 23;
+ kDriveway = 24;
+ kElevator = 25;
+ kEnsuite = 26;
+ kEntrance = 27;
+ kEntryway = 28;
+ kFamilyRoom = 29;
+ kFoyer = 30;
+ kFrontDoor = 31;
+ kFrontYard = 32;
+ kGameRoom = 33;
+ kGarage = 34;
+ kGarageDoor = 35;
+ kGarden = 36;
+ kGardenDoor = 37;
+ kGuestBathroom = 38;
+ kGuestBedroom = 39;
+ kGuestRestroom = 40;
+ kGuestRoom = 41;
+ kGym = 42;
+ kHallway = 43;
+ kHearthRoom = 44;
+ kKidsRoom = 45;
+ kKidsBedroom = 46;
+ kKitchen = 47;
+ kLarder = 48;
+ kLaundryRoom = 49;
+ kLawn = 50;
+ kLibrary = 51;
+ kLivingRoom = 52;
+ kLounge = 53;
+ kMediaTVRoom = 54;
+ kMudRoom = 55;
+ kMusicRoom = 56;
+ kNursery = 57;
+ kOffice = 58;
+ kOutdoorKitchen = 59;
+ kOutside = 60;
+ kPantry = 61;
+ kParkingLot = 62;
+ kParlor = 63;
+ kPatio = 64;
+ kPlayRoom = 65;
+ kPoolRoom = 66;
+ kPorch = 67;
+ kPrimaryBathroom = 68;
+ kPrimaryBedroom = 69;
+ kRamp = 70;
+ kReceptionRoom = 71;
+ kRecreationRoom = 72;
+ kRestroom = 73;
+ kRoof = 74;
+ kSauna = 75;
+ kScullery = 76;
+ kSewingRoom = 77;
+ kShed = 78;
+ kSideDoor = 79;
+ kSideYard = 80;
+ kSittingRoom = 81;
+ kSnug = 82;
+ kSpa = 83;
+ kStaircase = 84;
+ kSteamRoom = 85;
+ kStorageRoom = 86;
+ kStudio = 87;
+ kStudy = 88;
+ kSunRoom = 89;
+ kSwimmingPool = 90;
+ kTerrace = 91;
+ kUtilityRoom = 92;
+ kWard = 93;
+ kWorkshop = 94;
+ }
+
+ enum FloorSurfaceTag : enum8 {
+ kCarpet = 0;
+ kCeramic = 1;
+ kConcrete = 2;
+ kCork = 3;
+ kDeepCarpet = 4;
+ kDirt = 5;
+ kEngineeredWood = 6;
+ kGlass = 7;
+ kGrass = 8;
+ kHardwood = 9;
+ kLaminate = 10;
+ kLinoleum = 11;
+ kMat = 12;
+ kMetal = 13;
+ kPlastic = 14;
+ kPolishedConcrete = 15;
+ kRubber = 16;
+ kRug = 17;
+ kSand = 18;
+ kStone = 19;
+ kTatami = 20;
+ kTerrazzo = 21;
+ kTile = 22;
+ kVinyl = 23;
+ }
+
+ enum LandmarkTag : enum8 {
+ kAirConditioner = 0;
+ kAirPurifier = 1;
+ kBackDoor = 2;
+ kBarStool = 3;
+ kBathMat = 4;
+ kBathtub = 5;
+ kBed = 6;
+ kBookshelf = 7;
+ kChair = 8;
+ kChristmasTree = 9;
+ kCoatRack = 10;
+ kCoffeeTable = 11;
+ kCookingRange = 12;
+ kCouch = 13;
+ kCountertop = 14;
+ kCradle = 15;
+ kCrib = 16;
+ kDesk = 17;
+ kDiningTable = 18;
+ kDishwasher = 19;
+ kDoor = 20;
+ kDresser = 21;
+ kLaundryDryer = 22;
+ kFan = 23;
+ kFireplace = 24;
+ kFreezer = 25;
+ kFrontDoor = 26;
+ kHighChair = 27;
+ kKitchenIsland = 28;
+ kLamp = 29;
+ kLitterBox = 30;
+ kMirror = 31;
+ kNightstand = 32;
+ kOven = 33;
+ kPetBed = 34;
+ kPetBowl = 35;
+ kPetCrate = 36;
+ kRefrigerator = 37;
+ kScratchingPost = 38;
+ kShoeRack = 39;
+ kShower = 40;
+ kSideDoor = 41;
+ kSink = 42;
+ kSofa = 43;
+ kStove = 44;
+ kTable = 45;
+ kToilet = 46;
+ kTrashCan = 47;
+ kLaundryWasher = 48;
+ kWindow = 49;
+ kWineCooler = 50;
+ }
+
+ enum OperationalStatusEnum : enum8 {
+ kPending = 0;
+ kOperating = 1;
+ kSkipped = 2;
+ kCompleted = 3;
+ }
+
+ enum PositionTag : enum8 {
+ kLeft = 0;
+ kRight = 1;
+ kTop = 2;
+ kBottom = 3;
+ kMiddle = 4;
+ kRow = 5;
+ kColumn = 6;
+ kUnder = 7;
+ kNextTo = 8;
+ kAround = 9;
+ kOn = 10;
+ kAbove = 11;
+ kFrontOf = 12;
+ kBehind = 13;
+ }
+
+ enum SelectLocationsStatus : enum8 {
+ kSuccess = 0;
+ kUnsupportedLocation = 1;
+ kDuplicatedLocations = 2;
+ kInvalidInMode = 3;
+ kInvalidSet = 4;
+ }
+
+ enum SkipCurrentLocationStatus : enum8 {
+ kSuccess = 0;
+ kInvalidLocationList = 1;
+ kInvalidInMode = 2;
+ }
+
+ bitmap Feature : bitmap32 {
+ kListOrder = 0x1;
+ kSelectWhileRunning = 0x2;
+ }
+
+ struct HomeLocationStruct {
+ char_string<128> locationName = 0;
+ nullable int16s floorNumber = 1;
+ nullable AreaTypeTag areaType = 2;
+ }
+
+ struct LocationInfoStruct {
+ nullable HomeLocationStruct locationInfo = 0;
+ nullable LandmarkTag landmarkTag = 1;
+ nullable PositionTag positionTag = 2;
+ nullable FloorSurfaceTag surfaceTag = 3;
+ }
+
+ struct LocationStruct {
+ int32u locationID = 0;
+ nullable int8u mapID = 1;
+ LocationInfoStruct locationInfo = 2;
+ }
+
+ struct MapStruct {
+ int8u mapID = 0;
+ char_string<64> name = 1;
+ }
+
+ struct ProgressStruct {
+ int32u locationID = 0;
+ OperationalStatusEnum status = 1;
+ optional nullable elapsed_s totalOperationalTime = 2;
+ optional nullable elapsed_s estimatedTime = 3;
+ }
+
+ readonly attribute LocationStruct supportedLocations[] = 0;
+ readonly attribute nullable MapStruct supportedMaps[] = 1;
+ readonly attribute nullable int32u selectedLocations[] = 2;
+ readonly attribute optional nullable int32u currentLocation = 3;
+ readonly attribute optional nullable epoch_s estimatedEndTime = 4;
+ readonly attribute optional nullable ProgressStruct progress[] = 5;
+ readonly attribute command_id generatedCommandList[] = 65528;
+ readonly attribute command_id acceptedCommandList[] = 65529;
+ readonly attribute event_id eventList[] = 65530;
+ readonly attribute attrib_id attributeList[] = 65531;
+ readonly attribute bitmap32 featureMap = 65532;
+ readonly attribute int16u clusterRevision = 65533;
+
+ request struct SelectLocationsRequest {
+ nullable int32u newLocations[] = 0;
+ }
+
+ response struct SelectLocationsResponse = 1 {
+ SelectLocationsStatus status = 0;
+ optional char_string<256> statusText = 1;
+ }
+
+ response struct SkipCurrentLocationResponse = 3 {
+ SkipCurrentLocationStatus status = 0;
+ optional char_string<256> statusText = 1;
+ }
+
+ /** Command used to select a set of device locations, where the device is to operate */
+ command SelectLocations(SelectLocationsRequest): SelectLocationsResponse = 0;
+ /** This command is used to skip the current location where the device operates. */
+ command SkipCurrentLocation(): SkipCurrentLocationResponse = 2;
+}
+
/** An interface for configuring and controlling pumps. */
cluster PumpConfigurationAndControl = 512 {
revision 3;
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java
index 40725b1dfba8fe..80491515bc57d3 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java
@@ -37953,6 +37953,463 @@ public void onSuccess(byte[] tlv) {
}
}
+ public static class ServiceAreaCluster extends BaseChipCluster {
+ public static final long CLUSTER_ID = 336L;
+
+ private static final long SUPPORTED_LOCATIONS_ATTRIBUTE_ID = 0L;
+ private static final long SUPPORTED_MAPS_ATTRIBUTE_ID = 1L;
+ private static final long SELECTED_LOCATIONS_ATTRIBUTE_ID = 2L;
+ private static final long CURRENT_LOCATION_ATTRIBUTE_ID = 3L;
+ private static final long ESTIMATED_END_TIME_ATTRIBUTE_ID = 4L;
+ private static final long PROGRESS_ATTRIBUTE_ID = 5L;
+ 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;
+ private static final long ATTRIBUTE_LIST_ATTRIBUTE_ID = 65531L;
+ private static final long FEATURE_MAP_ATTRIBUTE_ID = 65532L;
+ private static final long CLUSTER_REVISION_ATTRIBUTE_ID = 65533L;
+
+ public ServiceAreaCluster(long devicePtr, int endpointId) {
+ super(devicePtr, endpointId, CLUSTER_ID);
+ }
+
+ @Override
+ @Deprecated
+ public long initWithDevice(long devicePtr, int endpointId) {
+ return 0L;
+ }
+
+ public void selectLocations(SelectLocationsResponseCallback callback, @Nullable ArrayList newLocations) {
+ selectLocations(callback, newLocations, 0);
+ }
+
+ public void selectLocations(SelectLocationsResponseCallback callback, @Nullable ArrayList newLocations, int timedInvokeTimeoutMs) {
+ final long commandId = 0L;
+
+ ArrayList elements = new ArrayList<>();
+ final long newLocationsFieldID = 0L;
+ BaseTLVType newLocationstlvValue = newLocations != null ? ArrayType.generateArrayType(newLocations, (elementnewLocations) -> new UIntType(elementnewLocations)) : new NullType();
+ elements.add(new StructElement(newLocationsFieldID, newLocationstlvValue));
+
+ StructType commandArgs = new StructType(elements);
+ invoke(new InvokeCallbackImpl(callback) {
+ @Override
+ public void onResponse(StructType invokeStructValue) {
+ final long statusFieldID = 0L;
+ Integer status = null;
+ final long statusTextFieldID = 1L;
+ Optional statusText = Optional.empty();
+ for (StructElement element: invokeStructValue.value()) {
+ if (element.contextTagNum() == statusFieldID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ status = castingValue.value(Integer.class);
+ }
+ } else if (element.contextTagNum() == statusTextFieldID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.String) {
+ StringType castingValue = element.value(StringType.class);
+ statusText = Optional.of(castingValue.value(String.class));
+ }
+ }
+ }
+ callback.onSuccess(status, statusText);
+ }}, commandId, commandArgs, timedInvokeTimeoutMs);
+ }
+
+ public void skipCurrentLocation(SkipCurrentLocationResponseCallback callback) {
+ skipCurrentLocation(callback, 0);
+ }
+
+ public void skipCurrentLocation(SkipCurrentLocationResponseCallback callback, int timedInvokeTimeoutMs) {
+ final long commandId = 2L;
+
+ ArrayList elements = new ArrayList<>();
+ StructType commandArgs = new StructType(elements);
+ invoke(new InvokeCallbackImpl(callback) {
+ @Override
+ public void onResponse(StructType invokeStructValue) {
+ final long statusFieldID = 0L;
+ Integer status = null;
+ final long statusTextFieldID = 1L;
+ Optional statusText = Optional.empty();
+ for (StructElement element: invokeStructValue.value()) {
+ if (element.contextTagNum() == statusFieldID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ status = castingValue.value(Integer.class);
+ }
+ } else if (element.contextTagNum() == statusTextFieldID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.String) {
+ StringType castingValue = element.value(StringType.class);
+ statusText = Optional.of(castingValue.value(String.class));
+ }
+ }
+ }
+ callback.onSuccess(status, statusText);
+ }}, commandId, commandArgs, timedInvokeTimeoutMs);
+ }
+
+ public interface SelectLocationsResponseCallback extends BaseClusterCallback {
+ void onSuccess(Integer status, Optional statusText);
+ }
+
+ public interface SkipCurrentLocationResponseCallback extends BaseClusterCallback {
+ void onSuccess(Integer status, Optional statusText);
+ }
+
+ public interface SupportedLocationsAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(List value);
+ }
+
+ public interface SupportedMapsAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable List value);
+ }
+
+ public interface SelectedLocationsAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable List value);
+ }
+
+ public interface CurrentLocationAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable Long value);
+ }
+
+ public interface EstimatedEndTimeAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable Long value);
+ }
+
+ public interface ProgressAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(@Nullable List value);
+ }
+
+ public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(List value);
+ }
+
+ public interface AcceptedCommandListAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(List value);
+ }
+
+ public interface EventListAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(List value);
+ }
+
+ public interface AttributeListAttributeCallback extends BaseAttributeCallback {
+ void onSuccess(List value);
+ }
+
+ public void readSupportedLocationsAttribute(
+ SupportedLocationsAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_LOCATIONS_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, SUPPORTED_LOCATIONS_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeSupportedLocationsAttribute(
+ SupportedLocationsAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_LOCATIONS_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, SUPPORTED_LOCATIONS_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readSupportedMapsAttribute(
+ SupportedMapsAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_MAPS_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, SUPPORTED_MAPS_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeSupportedMapsAttribute(
+ SupportedMapsAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SUPPORTED_MAPS_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, SUPPORTED_MAPS_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readSelectedLocationsAttribute(
+ SelectedLocationsAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SELECTED_LOCATIONS_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, SELECTED_LOCATIONS_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeSelectedLocationsAttribute(
+ SelectedLocationsAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SELECTED_LOCATIONS_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, SELECTED_LOCATIONS_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readCurrentLocationAttribute(
+ CurrentLocationAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_LOCATION_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, CURRENT_LOCATION_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeCurrentLocationAttribute(
+ CurrentLocationAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CURRENT_LOCATION_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, CURRENT_LOCATION_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readEstimatedEndTimeAttribute(
+ EstimatedEndTimeAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ESTIMATED_END_TIME_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, ESTIMATED_END_TIME_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeEstimatedEndTimeAttribute(
+ EstimatedEndTimeAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ESTIMATED_END_TIME_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, ESTIMATED_END_TIME_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readProgressAttribute(
+ ProgressAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PROGRESS_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, PROGRESS_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeProgressAttribute(
+ ProgressAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, PROGRESS_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, PROGRESS_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readGeneratedCommandListAttribute(
+ GeneratedCommandListAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeGeneratedCommandListAttribute(
+ GeneratedCommandListAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readAcceptedCommandListAttribute(
+ AcceptedCommandListAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeAcceptedCommandListAttribute(
+ AcceptedCommandListAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readEventListAttribute(
+ EventListAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, EVENT_LIST_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeEventListAttribute(
+ EventListAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, EVENT_LIST_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readAttributeListAttribute(
+ AttributeListAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, ATTRIBUTE_LIST_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeAttributeListAttribute(
+ AttributeListAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, ATTRIBUTE_LIST_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readFeatureMapAttribute(
+ LongAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, FEATURE_MAP_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeFeatureMapAttribute(
+ LongAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, FEATURE_MAP_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+
+ public void readClusterRevisionAttribute(
+ IntegerAttributeCallback callback) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID);
+
+ readAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, CLUSTER_REVISION_ATTRIBUTE_ID, true);
+ }
+
+ public void subscribeClusterRevisionAttribute(
+ IntegerAttributeCallback callback, int minInterval, int maxInterval) {
+ ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, CLUSTER_REVISION_ATTRIBUTE_ID);
+
+ subscribeAttribute(new ReportCallbackImpl(callback, path) {
+ @Override
+ public void onSuccess(byte[] tlv) {
+ Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
+ callback.onSuccess(value);
+ }
+ }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval);
+ }
+ }
+
public static class PumpConfigurationAndControlCluster extends BaseChipCluster {
public static final long CLUSTER_ID = 512L;
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java
index 426e73b9ab524a..c22d3593b9e87e 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ChipStructs.java
@@ -8686,6 +8686,401 @@ public String toString() {
return output.toString();
}
}
+public static class ServiceAreaClusterHomeLocationStruct {
+ public String locationName;
+ public @Nullable Integer floorNumber;
+ public @Nullable Integer areaType;
+ private static final long LOCATION_NAME_ID = 0L;
+ private static final long FLOOR_NUMBER_ID = 1L;
+ private static final long AREA_TYPE_ID = 2L;
+
+ public ServiceAreaClusterHomeLocationStruct(
+ String locationName,
+ @Nullable Integer floorNumber,
+ @Nullable Integer areaType
+ ) {
+ this.locationName = locationName;
+ this.floorNumber = floorNumber;
+ this.areaType = areaType;
+ }
+
+ public StructType encodeTlv() {
+ ArrayList values = new ArrayList<>();
+ values.add(new StructElement(LOCATION_NAME_ID, new StringType(locationName)));
+ values.add(new StructElement(FLOOR_NUMBER_ID, floorNumber != null ? new IntType(floorNumber) : new NullType()));
+ values.add(new StructElement(AREA_TYPE_ID, areaType != null ? new UIntType(areaType) : new NullType()));
+
+ return new StructType(values);
+ }
+
+ public static ServiceAreaClusterHomeLocationStruct decodeTlv(BaseTLVType tlvValue) {
+ if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
+ return null;
+ }
+ String locationName = null;
+ @Nullable Integer floorNumber = null;
+ @Nullable Integer areaType = null;
+ for (StructElement element: ((StructType)tlvValue).value()) {
+ if (element.contextTagNum() == LOCATION_NAME_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.String) {
+ StringType castingValue = element.value(StringType.class);
+ locationName = castingValue.value(String.class);
+ }
+ } else if (element.contextTagNum() == FLOOR_NUMBER_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.Int) {
+ IntType castingValue = element.value(IntType.class);
+ floorNumber = castingValue.value(Integer.class);
+ }
+ } else if (element.contextTagNum() == AREA_TYPE_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ areaType = castingValue.value(Integer.class);
+ }
+ }
+ }
+ return new ServiceAreaClusterHomeLocationStruct(
+ locationName,
+ floorNumber,
+ areaType
+ );
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder output = new StringBuilder();
+ output.append("ServiceAreaClusterHomeLocationStruct {\n");
+ output.append("\tlocationName: ");
+ output.append(locationName);
+ output.append("\n");
+ output.append("\tfloorNumber: ");
+ output.append(floorNumber);
+ output.append("\n");
+ output.append("\tareaType: ");
+ output.append(areaType);
+ output.append("\n");
+ output.append("}\n");
+ return output.toString();
+ }
+}
+public static class ServiceAreaClusterLocationInfoStruct {
+ public @Nullable ChipStructs.ServiceAreaClusterHomeLocationStruct locationInfo;
+ public @Nullable Integer landmarkTag;
+ public @Nullable Integer positionTag;
+ public @Nullable Integer surfaceTag;
+ private static final long LOCATION_INFO_ID = 0L;
+ private static final long LANDMARK_TAG_ID = 1L;
+ private static final long POSITION_TAG_ID = 2L;
+ private static final long SURFACE_TAG_ID = 3L;
+
+ public ServiceAreaClusterLocationInfoStruct(
+ @Nullable ChipStructs.ServiceAreaClusterHomeLocationStruct locationInfo,
+ @Nullable Integer landmarkTag,
+ @Nullable Integer positionTag,
+ @Nullable Integer surfaceTag
+ ) {
+ this.locationInfo = locationInfo;
+ this.landmarkTag = landmarkTag;
+ this.positionTag = positionTag;
+ this.surfaceTag = surfaceTag;
+ }
+
+ public StructType encodeTlv() {
+ ArrayList values = new ArrayList<>();
+ values.add(new StructElement(LOCATION_INFO_ID, locationInfo != null ? locationInfo.encodeTlv() : new NullType()));
+ values.add(new StructElement(LANDMARK_TAG_ID, landmarkTag != null ? new UIntType(landmarkTag) : new NullType()));
+ values.add(new StructElement(POSITION_TAG_ID, positionTag != null ? new UIntType(positionTag) : new NullType()));
+ values.add(new StructElement(SURFACE_TAG_ID, surfaceTag != null ? new UIntType(surfaceTag) : new NullType()));
+
+ return new StructType(values);
+ }
+
+ public static ServiceAreaClusterLocationInfoStruct decodeTlv(BaseTLVType tlvValue) {
+ if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
+ return null;
+ }
+ @Nullable ChipStructs.ServiceAreaClusterHomeLocationStruct locationInfo = null;
+ @Nullable Integer landmarkTag = null;
+ @Nullable Integer positionTag = null;
+ @Nullable Integer surfaceTag = null;
+ for (StructElement element: ((StructType)tlvValue).value()) {
+ if (element.contextTagNum() == LOCATION_INFO_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.Struct) {
+ StructType castingValue = element.value(StructType.class);
+ locationInfo = ChipStructs.ServiceAreaClusterHomeLocationStruct.decodeTlv(castingValue);
+ }
+ } else if (element.contextTagNum() == LANDMARK_TAG_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ landmarkTag = castingValue.value(Integer.class);
+ }
+ } else if (element.contextTagNum() == POSITION_TAG_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ positionTag = castingValue.value(Integer.class);
+ }
+ } else if (element.contextTagNum() == SURFACE_TAG_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ surfaceTag = castingValue.value(Integer.class);
+ }
+ }
+ }
+ return new ServiceAreaClusterLocationInfoStruct(
+ locationInfo,
+ landmarkTag,
+ positionTag,
+ surfaceTag
+ );
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder output = new StringBuilder();
+ output.append("ServiceAreaClusterLocationInfoStruct {\n");
+ output.append("\tlocationInfo: ");
+ output.append(locationInfo);
+ output.append("\n");
+ output.append("\tlandmarkTag: ");
+ output.append(landmarkTag);
+ output.append("\n");
+ output.append("\tpositionTag: ");
+ output.append(positionTag);
+ output.append("\n");
+ output.append("\tsurfaceTag: ");
+ output.append(surfaceTag);
+ output.append("\n");
+ output.append("}\n");
+ return output.toString();
+ }
+}
+public static class ServiceAreaClusterLocationStruct {
+ public Long locationID;
+ public @Nullable Integer mapID;
+ public ChipStructs.ServiceAreaClusterLocationInfoStruct locationInfo;
+ private static final long LOCATION_I_D_ID = 0L;
+ private static final long MAP_I_D_ID = 1L;
+ private static final long LOCATION_INFO_ID = 2L;
+
+ public ServiceAreaClusterLocationStruct(
+ Long locationID,
+ @Nullable Integer mapID,
+ ChipStructs.ServiceAreaClusterLocationInfoStruct locationInfo
+ ) {
+ this.locationID = locationID;
+ this.mapID = mapID;
+ this.locationInfo = locationInfo;
+ }
+
+ public StructType encodeTlv() {
+ ArrayList values = new ArrayList<>();
+ values.add(new StructElement(LOCATION_I_D_ID, new UIntType(locationID)));
+ values.add(new StructElement(MAP_I_D_ID, mapID != null ? new UIntType(mapID) : new NullType()));
+ values.add(new StructElement(LOCATION_INFO_ID, locationInfo.encodeTlv()));
+
+ return new StructType(values);
+ }
+
+ public static ServiceAreaClusterLocationStruct decodeTlv(BaseTLVType tlvValue) {
+ if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
+ return null;
+ }
+ Long locationID = null;
+ @Nullable Integer mapID = null;
+ ChipStructs.ServiceAreaClusterLocationInfoStruct locationInfo = null;
+ for (StructElement element: ((StructType)tlvValue).value()) {
+ if (element.contextTagNum() == LOCATION_I_D_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ locationID = castingValue.value(Long.class);
+ }
+ } else if (element.contextTagNum() == MAP_I_D_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ mapID = castingValue.value(Integer.class);
+ }
+ } else if (element.contextTagNum() == LOCATION_INFO_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.Struct) {
+ StructType castingValue = element.value(StructType.class);
+ locationInfo = ChipStructs.ServiceAreaClusterLocationInfoStruct.decodeTlv(castingValue);
+ }
+ }
+ }
+ return new ServiceAreaClusterLocationStruct(
+ locationID,
+ mapID,
+ locationInfo
+ );
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder output = new StringBuilder();
+ output.append("ServiceAreaClusterLocationStruct {\n");
+ output.append("\tlocationID: ");
+ output.append(locationID);
+ output.append("\n");
+ output.append("\tmapID: ");
+ output.append(mapID);
+ output.append("\n");
+ output.append("\tlocationInfo: ");
+ output.append(locationInfo);
+ output.append("\n");
+ output.append("}\n");
+ return output.toString();
+ }
+}
+public static class ServiceAreaClusterMapStruct {
+ public Integer mapID;
+ public String name;
+ private static final long MAP_I_D_ID = 0L;
+ private static final long NAME_ID = 1L;
+
+ public ServiceAreaClusterMapStruct(
+ Integer mapID,
+ String name
+ ) {
+ this.mapID = mapID;
+ this.name = name;
+ }
+
+ public StructType encodeTlv() {
+ ArrayList values = new ArrayList<>();
+ values.add(new StructElement(MAP_I_D_ID, new UIntType(mapID)));
+ values.add(new StructElement(NAME_ID, new StringType(name)));
+
+ return new StructType(values);
+ }
+
+ public static ServiceAreaClusterMapStruct decodeTlv(BaseTLVType tlvValue) {
+ if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
+ return null;
+ }
+ Integer mapID = null;
+ String name = null;
+ for (StructElement element: ((StructType)tlvValue).value()) {
+ if (element.contextTagNum() == MAP_I_D_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ mapID = castingValue.value(Integer.class);
+ }
+ } else if (element.contextTagNum() == NAME_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.String) {
+ StringType castingValue = element.value(StringType.class);
+ name = castingValue.value(String.class);
+ }
+ }
+ }
+ return new ServiceAreaClusterMapStruct(
+ mapID,
+ name
+ );
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder output = new StringBuilder();
+ output.append("ServiceAreaClusterMapStruct {\n");
+ output.append("\tmapID: ");
+ output.append(mapID);
+ output.append("\n");
+ output.append("\tname: ");
+ output.append(name);
+ output.append("\n");
+ output.append("}\n");
+ return output.toString();
+ }
+}
+public static class ServiceAreaClusterProgressStruct {
+ public Long locationID;
+ public Integer status;
+ public @Nullable Optional totalOperationalTime;
+ public @Nullable Optional estimatedTime;
+ private static final long LOCATION_I_D_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;
+
+ public ServiceAreaClusterProgressStruct(
+ Long locationID,
+ Integer status,
+ @Nullable Optional totalOperationalTime,
+ @Nullable Optional estimatedTime
+ ) {
+ this.locationID = locationID;
+ this.status = status;
+ this.totalOperationalTime = totalOperationalTime;
+ this.estimatedTime = estimatedTime;
+ }
+
+ public StructType encodeTlv() {
+ ArrayList values = new ArrayList<>();
+ values.add(new StructElement(LOCATION_I_D_ID, new UIntType(locationID)));
+ 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()));
+
+ return new StructType(values);
+ }
+
+ public static ServiceAreaClusterProgressStruct decodeTlv(BaseTLVType tlvValue) {
+ if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
+ return null;
+ }
+ Long locationID = null;
+ Integer status = null;
+ @Nullable Optional totalOperationalTime = null;
+ @Nullable Optional estimatedTime = null;
+ for (StructElement element: ((StructType)tlvValue).value()) {
+ if (element.contextTagNum() == LOCATION_I_D_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ locationID = castingValue.value(Long.class);
+ }
+ } else if (element.contextTagNum() == STATUS_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ status = castingValue.value(Integer.class);
+ }
+ } else if (element.contextTagNum() == TOTAL_OPERATIONAL_TIME_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ totalOperationalTime = Optional.of(castingValue.value(Long.class));
+ }
+ } else if (element.contextTagNum() == ESTIMATED_TIME_ID) {
+ if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
+ UIntType castingValue = element.value(UIntType.class);
+ estimatedTime = Optional.of(castingValue.value(Long.class));
+ }
+ }
+ }
+ return new ServiceAreaClusterProgressStruct(
+ locationID,
+ status,
+ totalOperationalTime,
+ estimatedTime
+ );
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder output = new StringBuilder();
+ output.append("ServiceAreaClusterProgressStruct {\n");
+ output.append("\tlocationID: ");
+ output.append(locationID);
+ output.append("\n");
+ output.append("\tstatus: ");
+ output.append(status);
+ output.append("\n");
+ output.append("\ttotalOperationalTime: ");
+ output.append(totalOperationalTime);
+ output.append("\n");
+ output.append("\testimatedTime: ");
+ output.append(estimatedTime);
+ output.append("\n");
+ output.append("}\n");
+ return output.toString();
+ }
+}
public static class ThermostatClusterScheduleTransitionStruct {
public Integer dayOfWeek;
public Integer transitionTime;
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java
index df03516f3e4063..06f9941b772c21 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterIDMapping.java
@@ -262,6 +262,9 @@ public static BaseCluster getCluster(long clusterId) {
if (clusterId == BarrierControl.ID) {
return new BarrierControl();
}
+ if (clusterId == ServiceArea.ID) {
+ return new ServiceArea();
+ }
if (clusterId == PumpConfigurationAndControl.ID) {
return new PumpConfigurationAndControl();
}
@@ -11300,6 +11303,131 @@ public long getCommandID(String name) throws IllegalArgumentException {
return Command.valueOf(name).getID();
}
}
+ public static class ServiceArea implements BaseCluster {
+ public static final long ID = 336L;
+ public long getID() {
+ return ID;
+ }
+
+ public enum Attribute {
+ SupportedLocations(0L),
+ SupportedMaps(1L),
+ SelectedLocations(2L),
+ CurrentLocation(3L),
+ EstimatedEndTime(4L),
+ Progress(5L),
+ GeneratedCommandList(65528L),
+ AcceptedCommandList(65529L),
+ EventList(65530L),
+ AttributeList(65531L),
+ FeatureMap(65532L),
+ ClusterRevision(65533L),;
+ private final long id;
+ Attribute(long id) {
+ this.id = id;
+ }
+
+ public long getID() {
+ return id;
+ }
+
+ public static Attribute value(long id) throws NoSuchFieldError {
+ for (Attribute attribute : Attribute.values()) {
+ if (attribute.getID() == id) {
+ return attribute;
+ }
+ }
+ throw new NoSuchFieldError();
+ }
+ }
+
+ public enum Event {;
+ private final long id;
+ Event(long id) {
+ this.id = id;
+ }
+
+ public long getID() {
+ return id;
+ }
+
+ public static Event value(long id) throws NoSuchFieldError {
+ for (Event event : Event.values()) {
+ if (event.getID() == id) {
+ return event;
+ }
+ }
+ throw new NoSuchFieldError();
+ }
+ }
+
+ public enum Command {
+ SelectLocations(0L),
+ SkipCurrentLocation(2L),;
+ private final long id;
+ Command(long id) {
+ this.id = id;
+ }
+
+ public long getID() {
+ return id;
+ }
+
+ public static Command value(long id) throws NoSuchFieldError {
+ for (Command command : Command.values()) {
+ if (command.getID() == id) {
+ return command;
+ }
+ }
+ throw new NoSuchFieldError();
+ }
+ }public enum SelectLocationsCommandField {NewLocations(0),;
+ private final int id;
+ SelectLocationsCommandField(int id) {
+ this.id = id;
+ }
+
+ public int getID() {
+ return id;
+ }
+ public static SelectLocationsCommandField value(int id) throws NoSuchFieldError {
+ for (SelectLocationsCommandField field : SelectLocationsCommandField.values()) {
+ if (field.getID() == id) {
+ return field;
+ }
+ }
+ throw new NoSuchFieldError();
+ }
+ }@Override
+ public String getAttributeName(long id) throws NoSuchFieldError {
+ return Attribute.value(id).toString();
+ }
+
+ @Override
+ public String getEventName(long id) throws NoSuchFieldError {
+ return Event.value(id).toString();
+ }
+
+ @Override
+ public String getCommandName(long id) throws NoSuchFieldError {
+ return Command.value(id).toString();
+ }
+
+ @Override
+ public long getAttributeID(String name) throws IllegalArgumentException {
+ return Attribute.valueOf(name).getID();
+ }
+
+ @Override
+ public long getEventID(String name) throws IllegalArgumentException {
+ return Event.valueOf(name).getID();
+ }
+
+ @Override
+ public long getCommandID(String name) throws IllegalArgumentException {
+ return Command.valueOf(name).getID();
+ }
+ }
public static class PumpConfigurationAndControl implements BaseCluster {
public static final long ID = 512L;
public long getID() {
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java
index 219baca838f58b..f4830c334b842f 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterInfoMapping.java
@@ -12797,6 +12797,264 @@ public void onError(Exception ex) {
}
}
+
+ public static class DelegatedServiceAreaClusterSelectLocationsResponseCallback implements ChipClusters.ServiceAreaCluster.SelectLocationsResponseCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(Integer status, Optional statusText) {
+ Map responseValues = new LinkedHashMap<>();
+
+ CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer");
+ responseValues.put(statusResponseValue, status);
+ CommandResponseInfo statusTextResponseValue = new CommandResponseInfo("statusText", "Optional");
+ responseValues.put(statusTextResponseValue, statusText);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception error) {
+ callback.onFailure(error);
+ }
+ }
+
+ public static class DelegatedServiceAreaClusterSkipCurrentLocationResponseCallback implements ChipClusters.ServiceAreaCluster.SkipCurrentLocationResponseCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(Integer status, Optional statusText) {
+ Map responseValues = new LinkedHashMap<>();
+
+ CommandResponseInfo statusResponseValue = new CommandResponseInfo("status", "Integer");
+ responseValues.put(statusResponseValue, status);
+ CommandResponseInfo statusTextResponseValue = new CommandResponseInfo("statusText", "Optional");
+ responseValues.put(statusTextResponseValue, statusText);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception error) {
+ callback.onFailure(error);
+ }
+ }
+ public static class DelegatedServiceAreaClusterSupportedLocationsAttributeCallback implements ChipClusters.ServiceAreaCluster.SupportedLocationsAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(List valueList) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List");
+ responseValues.put(commandResponseInfo, valueList);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedServiceAreaClusterSupportedMapsAttributeCallback implements ChipClusters.ServiceAreaCluster.SupportedMapsAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(@Nullable List valueList) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List");
+ responseValues.put(commandResponseInfo, valueList);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedServiceAreaClusterSelectedLocationsAttributeCallback implements ChipClusters.ServiceAreaCluster.SelectedLocationsAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(@Nullable List valueList) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List");
+ responseValues.put(commandResponseInfo, valueList);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedServiceAreaClusterCurrentLocationAttributeCallback implements ChipClusters.ServiceAreaCluster.CurrentLocationAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(@Nullable Long value) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long");
+ responseValues.put(commandResponseInfo, value);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedServiceAreaClusterEstimatedEndTimeAttributeCallback implements ChipClusters.ServiceAreaCluster.EstimatedEndTimeAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(@Nullable Long value) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Long");
+ responseValues.put(commandResponseInfo, value);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedServiceAreaClusterProgressAttributeCallback implements ChipClusters.ServiceAreaCluster.ProgressAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(@Nullable List valueList) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List");
+ responseValues.put(commandResponseInfo, valueList);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedServiceAreaClusterGeneratedCommandListAttributeCallback implements ChipClusters.ServiceAreaCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(List valueList) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List");
+ responseValues.put(commandResponseInfo, valueList);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedServiceAreaClusterAcceptedCommandListAttributeCallback implements ChipClusters.ServiceAreaCluster.AcceptedCommandListAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(List valueList) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List");
+ responseValues.put(commandResponseInfo, valueList);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedServiceAreaClusterEventListAttributeCallback implements ChipClusters.ServiceAreaCluster.EventListAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(List valueList) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List");
+ responseValues.put(commandResponseInfo, valueList);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
+ public static class DelegatedServiceAreaClusterAttributeListAttributeCallback implements ChipClusters.ServiceAreaCluster.AttributeListAttributeCallback, DelegatedClusterCallback {
+ private ClusterCommandCallback callback;
+ @Override
+ public void setCallbackDelegate(ClusterCommandCallback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onSuccess(List valueList) {
+ Map responseValues = new LinkedHashMap<>();
+ CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List");
+ responseValues.put(commandResponseInfo, valueList);
+ callback.onSuccess(responseValues);
+ }
+
+ @Override
+ public void onError(Exception ex) {
+ callback.onFailure(ex);
+ }
+ }
+
public static class DelegatedPumpConfigurationAndControlClusterMaxPressureAttributeCallback implements ChipClusters.PumpConfigurationAndControlCluster.MaxPressureAttributeCallback, DelegatedClusterCallback {
private ClusterCommandCallback callback;
@Override
@@ -21491,6 +21749,10 @@ public Map initializeClusterMap() {
(ptr, endpointId) -> new ChipClusters.BarrierControlCluster(ptr, endpointId), new HashMap<>());
clusterMap.put("barrierControl", barrierControlClusterInfo);
+ ClusterInfo serviceAreaClusterInfo = new ClusterInfo(
+ (ptr, endpointId) -> new ChipClusters.ServiceAreaCluster(ptr, endpointId), new HashMap<>());
+ clusterMap.put("serviceArea", serviceAreaClusterInfo);
+
ClusterInfo pumpConfigurationAndControlClusterInfo = new ClusterInfo(
(ptr, endpointId) -> new ChipClusters.PumpConfigurationAndControlCluster(ptr, endpointId), new HashMap<>());
clusterMap.put("pumpConfigurationAndControl", pumpConfigurationAndControlClusterInfo);
@@ -21745,6 +22007,7 @@ public void combineCommand(Map destination, Map> getCommandMap() {
commandMap.put("barrierControl", barrierControlClusterInteractionInfoMap);
+ Map serviceAreaClusterInteractionInfoMap = new LinkedHashMap<>();
+
+ Map serviceAreaselectLocationsCommandParams = new LinkedHashMap();
+
+ CommandParameterInfo serviceAreaselectLocationsnewLocationsCommandParameterInfo = new CommandParameterInfo("newLocations", ArrayList.class, ArrayList.class);
+ serviceAreaselectLocationsCommandParams.put("newLocations",serviceAreaselectLocationsnewLocationsCommandParameterInfo);
+ InteractionInfo serviceAreaselectLocationsInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.ServiceAreaCluster) cluster)
+ .selectLocations((ChipClusters.ServiceAreaCluster.SelectLocationsResponseCallback) callback
+ , (ArrayList)
+ commandArguments.get("newLocations")
+
+ );
+ },
+ () -> new DelegatedServiceAreaClusterSelectLocationsResponseCallback(),
+ serviceAreaselectLocationsCommandParams
+ );
+ serviceAreaClusterInteractionInfoMap.put("selectLocations", serviceAreaselectLocationsInteractionInfo);
+
+ Map serviceAreaskipCurrentLocationCommandParams = new LinkedHashMap();
+ InteractionInfo serviceAreaskipCurrentLocationInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.ServiceAreaCluster) cluster)
+ .skipCurrentLocation((ChipClusters.ServiceAreaCluster.SkipCurrentLocationResponseCallback) callback
+ );
+ },
+ () -> new DelegatedServiceAreaClusterSkipCurrentLocationResponseCallback(),
+ serviceAreaskipCurrentLocationCommandParams
+ );
+ serviceAreaClusterInteractionInfoMap.put("skipCurrentLocation", serviceAreaskipCurrentLocationInteractionInfo);
+
+ commandMap.put("serviceArea", serviceAreaClusterInteractionInfoMap);
+
Map pumpConfigurationAndControlClusterInteractionInfoMap = new LinkedHashMap<>();
commandMap.put("pumpConfigurationAndControl", pumpConfigurationAndControlClusterInteractionInfoMap);
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java
index 23261b74f09dbf..18cc03aa13a99f 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterReadMapping.java
@@ -11524,6 +11524,142 @@ private static Map readBarrierControlInteractionInfo()
return result;
}
+ private static Map readServiceAreaInteractionInfo() {
+ Map result = new LinkedHashMap<>();Map readServiceAreaSupportedLocationsCommandParams = new LinkedHashMap();
+ InteractionInfo readServiceAreaSupportedLocationsAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.ServiceAreaCluster) cluster).readSupportedLocationsAttribute(
+ (ChipClusters.ServiceAreaCluster.SupportedLocationsAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedServiceAreaClusterSupportedLocationsAttributeCallback(),
+ readServiceAreaSupportedLocationsCommandParams
+ );
+ result.put("readSupportedLocationsAttribute", readServiceAreaSupportedLocationsAttributeInteractionInfo);
+ Map readServiceAreaSupportedMapsCommandParams = new LinkedHashMap();
+ InteractionInfo readServiceAreaSupportedMapsAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.ServiceAreaCluster) cluster).readSupportedMapsAttribute(
+ (ChipClusters.ServiceAreaCluster.SupportedMapsAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedServiceAreaClusterSupportedMapsAttributeCallback(),
+ readServiceAreaSupportedMapsCommandParams
+ );
+ result.put("readSupportedMapsAttribute", readServiceAreaSupportedMapsAttributeInteractionInfo);
+ Map readServiceAreaSelectedLocationsCommandParams = new LinkedHashMap();
+ InteractionInfo readServiceAreaSelectedLocationsAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.ServiceAreaCluster) cluster).readSelectedLocationsAttribute(
+ (ChipClusters.ServiceAreaCluster.SelectedLocationsAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedServiceAreaClusterSelectedLocationsAttributeCallback(),
+ readServiceAreaSelectedLocationsCommandParams
+ );
+ result.put("readSelectedLocationsAttribute", readServiceAreaSelectedLocationsAttributeInteractionInfo);
+ Map readServiceAreaCurrentLocationCommandParams = new LinkedHashMap();
+ InteractionInfo readServiceAreaCurrentLocationAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.ServiceAreaCluster) cluster).readCurrentLocationAttribute(
+ (ChipClusters.ServiceAreaCluster.CurrentLocationAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedServiceAreaClusterCurrentLocationAttributeCallback(),
+ readServiceAreaCurrentLocationCommandParams
+ );
+ result.put("readCurrentLocationAttribute", readServiceAreaCurrentLocationAttributeInteractionInfo);
+ Map readServiceAreaEstimatedEndTimeCommandParams = new LinkedHashMap();
+ InteractionInfo readServiceAreaEstimatedEndTimeAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.ServiceAreaCluster) cluster).readEstimatedEndTimeAttribute(
+ (ChipClusters.ServiceAreaCluster.EstimatedEndTimeAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedServiceAreaClusterEstimatedEndTimeAttributeCallback(),
+ readServiceAreaEstimatedEndTimeCommandParams
+ );
+ result.put("readEstimatedEndTimeAttribute", readServiceAreaEstimatedEndTimeAttributeInteractionInfo);
+ Map readServiceAreaProgressCommandParams = new LinkedHashMap();
+ InteractionInfo readServiceAreaProgressAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.ServiceAreaCluster) cluster).readProgressAttribute(
+ (ChipClusters.ServiceAreaCluster.ProgressAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedServiceAreaClusterProgressAttributeCallback(),
+ readServiceAreaProgressCommandParams
+ );
+ result.put("readProgressAttribute", readServiceAreaProgressAttributeInteractionInfo);
+ Map readServiceAreaGeneratedCommandListCommandParams = new LinkedHashMap();
+ InteractionInfo readServiceAreaGeneratedCommandListAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.ServiceAreaCluster) cluster).readGeneratedCommandListAttribute(
+ (ChipClusters.ServiceAreaCluster.GeneratedCommandListAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedServiceAreaClusterGeneratedCommandListAttributeCallback(),
+ readServiceAreaGeneratedCommandListCommandParams
+ );
+ result.put("readGeneratedCommandListAttribute", readServiceAreaGeneratedCommandListAttributeInteractionInfo);
+ Map readServiceAreaAcceptedCommandListCommandParams = new LinkedHashMap();
+ InteractionInfo readServiceAreaAcceptedCommandListAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.ServiceAreaCluster) cluster).readAcceptedCommandListAttribute(
+ (ChipClusters.ServiceAreaCluster.AcceptedCommandListAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedServiceAreaClusterAcceptedCommandListAttributeCallback(),
+ readServiceAreaAcceptedCommandListCommandParams
+ );
+ result.put("readAcceptedCommandListAttribute", readServiceAreaAcceptedCommandListAttributeInteractionInfo);
+ Map readServiceAreaEventListCommandParams = new LinkedHashMap();
+ InteractionInfo readServiceAreaEventListAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.ServiceAreaCluster) cluster).readEventListAttribute(
+ (ChipClusters.ServiceAreaCluster.EventListAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedServiceAreaClusterEventListAttributeCallback(),
+ readServiceAreaEventListCommandParams
+ );
+ result.put("readEventListAttribute", readServiceAreaEventListAttributeInteractionInfo);
+ Map readServiceAreaAttributeListCommandParams = new LinkedHashMap();
+ InteractionInfo readServiceAreaAttributeListAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.ServiceAreaCluster) cluster).readAttributeListAttribute(
+ (ChipClusters.ServiceAreaCluster.AttributeListAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedServiceAreaClusterAttributeListAttributeCallback(),
+ readServiceAreaAttributeListCommandParams
+ );
+ result.put("readAttributeListAttribute", readServiceAreaAttributeListAttributeInteractionInfo);
+ Map readServiceAreaFeatureMapCommandParams = new LinkedHashMap();
+ InteractionInfo readServiceAreaFeatureMapAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.ServiceAreaCluster) cluster).readFeatureMapAttribute(
+ (ChipClusters.LongAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(),
+ readServiceAreaFeatureMapCommandParams
+ );
+ result.put("readFeatureMapAttribute", readServiceAreaFeatureMapAttributeInteractionInfo);
+ Map readServiceAreaClusterRevisionCommandParams = new LinkedHashMap();
+ InteractionInfo readServiceAreaClusterRevisionAttributeInteractionInfo = new InteractionInfo(
+ (cluster, callback, commandArguments) -> {
+ ((ChipClusters.ServiceAreaCluster) cluster).readClusterRevisionAttribute(
+ (ChipClusters.IntegerAttributeCallback) callback
+ );
+ },
+ () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
+ readServiceAreaClusterRevisionCommandParams
+ );
+ result.put("readClusterRevisionAttribute", readServiceAreaClusterRevisionAttributeInteractionInfo);
+
+ return result;
+ }
private static Map readPumpConfigurationAndControlInteractionInfo() {
Map result = new LinkedHashMap<>();Map readPumpConfigurationAndControlMaxPressureCommandParams = new LinkedHashMap();
InteractionInfo readPumpConfigurationAndControlMaxPressureAttributeInteractionInfo = new InteractionInfo(
@@ -20864,6 +21000,7 @@ public Map> getReadAttributeMap() {
put("doorLock", readDoorLockInteractionInfo());
put("windowCovering", readWindowCoveringInteractionInfo());
put("barrierControl", readBarrierControlInteractionInfo());
+ put("serviceArea", readServiceAreaInteractionInfo());
put("pumpConfigurationAndControl", readPumpConfigurationAndControlInteractionInfo());
put("thermostat", readThermostatInteractionInfo());
put("fanControl", readFanControlInteractionInfo());
diff --git a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java
index 948e665b63da72..bd73d50f14c538 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java
+++ b/src/controller/java/generated/java/chip/devicecontroller/ClusterWriteMapping.java
@@ -2008,6 +2008,8 @@ public Map> getWriteAttributeMap() {
);
writeBarrierControlInteractionInfo.put("writeBarrierClosePeriodAttribute", writeBarrierControlBarrierClosePeriodAttributeInteractionInfo);
writeAttributeMap.put("barrierControl", writeBarrierControlInteractionInfo);
+ Map writeServiceAreaInteractionInfo = new LinkedHashMap<>();
+ writeAttributeMap.put("serviceArea", writeServiceAreaInteractionInfo);
Map writePumpConfigurationAndControlInteractionInfo = new LinkedHashMap<>();
Map writePumpConfigurationAndControlLifetimeRunningHoursCommandParams = new LinkedHashMap();
CommandParameterInfo pumpConfigurationAndControllifetimeRunningHoursCommandParameterInfo =
diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni
index a5f7518b9c8766..c5c5d5e1adbb0d 100644
--- a/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni
+++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/files.gni
@@ -115,6 +115,11 @@ structs_sources = [
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterAttributeValuePair.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ScenesManagementClusterSceneInfoStruct.kt",
+ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterHomeLocationStruct.kt",
+ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationInfoStruct.kt",
+ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationStruct.kt",
+ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterMapStruct.kt",
+ "${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterProgressStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/SoftwareDiagnosticsClusterThreadMetricsStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/TargetNavigatorClusterTargetInfoStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ThermostatClusterPresetStruct.kt",
diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterHomeLocationStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterHomeLocationStruct.kt
new file mode 100644
index 00000000000000..7262fc9102917c
--- /dev/null
+++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterHomeLocationStruct.kt
@@ -0,0 +1,84 @@
+/*
+ *
+ * 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.
+ */
+package chip.devicecontroller.cluster.structs
+
+import chip.devicecontroller.cluster.*
+import matter.tlv.ContextSpecificTag
+import matter.tlv.Tag
+import matter.tlv.TlvReader
+import matter.tlv.TlvWriter
+
+class ServiceAreaClusterHomeLocationStruct(
+ val locationName: String,
+ val floorNumber: Int?,
+ val areaType: UInt?
+) {
+ override fun toString(): String = buildString {
+ append("ServiceAreaClusterHomeLocationStruct {\n")
+ append("\tlocationName : $locationName\n")
+ append("\tfloorNumber : $floorNumber\n")
+ append("\tareaType : $areaType\n")
+ append("}\n")
+ }
+
+ fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
+ tlvWriter.apply {
+ startStructure(tlvTag)
+ put(ContextSpecificTag(TAG_LOCATION_NAME), locationName)
+ if (floorNumber != null) {
+ put(ContextSpecificTag(TAG_FLOOR_NUMBER), floorNumber)
+ } else {
+ putNull(ContextSpecificTag(TAG_FLOOR_NUMBER))
+ }
+ if (areaType != null) {
+ put(ContextSpecificTag(TAG_AREA_TYPE), areaType)
+ } else {
+ putNull(ContextSpecificTag(TAG_AREA_TYPE))
+ }
+ endStructure()
+ }
+ }
+
+ companion object {
+ private const val TAG_LOCATION_NAME = 0
+ private const val TAG_FLOOR_NUMBER = 1
+ private const val TAG_AREA_TYPE = 2
+
+ fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterHomeLocationStruct {
+ tlvReader.enterStructure(tlvTag)
+ val locationName = tlvReader.getString(ContextSpecificTag(TAG_LOCATION_NAME))
+ val floorNumber =
+ if (!tlvReader.isNull()) {
+ tlvReader.getInt(ContextSpecificTag(TAG_FLOOR_NUMBER))
+ } else {
+ tlvReader.getNull(ContextSpecificTag(TAG_FLOOR_NUMBER))
+ null
+ }
+ val areaType =
+ if (!tlvReader.isNull()) {
+ tlvReader.getUInt(ContextSpecificTag(TAG_AREA_TYPE))
+ } else {
+ tlvReader.getNull(ContextSpecificTag(TAG_AREA_TYPE))
+ null
+ }
+
+ tlvReader.exitContainer()
+
+ return ServiceAreaClusterHomeLocationStruct(locationName, floorNumber, areaType)
+ }
+ }
+}
diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationInfoStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationInfoStruct.kt
new file mode 100644
index 00000000000000..4ddb164dd98834
--- /dev/null
+++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationInfoStruct.kt
@@ -0,0 +1,117 @@
+/*
+ *
+ * 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.
+ */
+package chip.devicecontroller.cluster.structs
+
+import chip.devicecontroller.cluster.*
+import matter.tlv.ContextSpecificTag
+import matter.tlv.Tag
+import matter.tlv.TlvReader
+import matter.tlv.TlvWriter
+
+class ServiceAreaClusterLocationInfoStruct(
+ val locationInfo: ServiceAreaClusterHomeLocationStruct?,
+ val landmarkTag: UInt?,
+ val positionTag: UInt?,
+ val surfaceTag: UInt?
+) {
+ override fun toString(): String = buildString {
+ append("ServiceAreaClusterLocationInfoStruct {\n")
+ append("\tlocationInfo : $locationInfo\n")
+ append("\tlandmarkTag : $landmarkTag\n")
+ append("\tpositionTag : $positionTag\n")
+ append("\tsurfaceTag : $surfaceTag\n")
+ append("}\n")
+ }
+
+ fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
+ tlvWriter.apply {
+ startStructure(tlvTag)
+ if (locationInfo != null) {
+ locationInfo.toTlv(ContextSpecificTag(TAG_LOCATION_INFO), this)
+ } else {
+ putNull(ContextSpecificTag(TAG_LOCATION_INFO))
+ }
+ if (landmarkTag != null) {
+ put(ContextSpecificTag(TAG_LANDMARK_TAG), landmarkTag)
+ } else {
+ putNull(ContextSpecificTag(TAG_LANDMARK_TAG))
+ }
+ if (positionTag != null) {
+ put(ContextSpecificTag(TAG_POSITION_TAG), positionTag)
+ } else {
+ putNull(ContextSpecificTag(TAG_POSITION_TAG))
+ }
+ if (surfaceTag != null) {
+ put(ContextSpecificTag(TAG_SURFACE_TAG), surfaceTag)
+ } else {
+ putNull(ContextSpecificTag(TAG_SURFACE_TAG))
+ }
+ endStructure()
+ }
+ }
+
+ companion object {
+ private const val TAG_LOCATION_INFO = 0
+ private const val TAG_LANDMARK_TAG = 1
+ private const val TAG_POSITION_TAG = 2
+ private const val TAG_SURFACE_TAG = 3
+
+ fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterLocationInfoStruct {
+ tlvReader.enterStructure(tlvTag)
+ val locationInfo =
+ if (!tlvReader.isNull()) {
+ ServiceAreaClusterHomeLocationStruct.fromTlv(
+ ContextSpecificTag(TAG_LOCATION_INFO),
+ tlvReader
+ )
+ } else {
+ tlvReader.getNull(ContextSpecificTag(TAG_LOCATION_INFO))
+ null
+ }
+ val landmarkTag =
+ if (!tlvReader.isNull()) {
+ tlvReader.getUInt(ContextSpecificTag(TAG_LANDMARK_TAG))
+ } else {
+ tlvReader.getNull(ContextSpecificTag(TAG_LANDMARK_TAG))
+ null
+ }
+ val positionTag =
+ if (!tlvReader.isNull()) {
+ tlvReader.getUInt(ContextSpecificTag(TAG_POSITION_TAG))
+ } else {
+ tlvReader.getNull(ContextSpecificTag(TAG_POSITION_TAG))
+ null
+ }
+ val surfaceTag =
+ if (!tlvReader.isNull()) {
+ tlvReader.getUInt(ContextSpecificTag(TAG_SURFACE_TAG))
+ } else {
+ tlvReader.getNull(ContextSpecificTag(TAG_SURFACE_TAG))
+ null
+ }
+
+ tlvReader.exitContainer()
+
+ return ServiceAreaClusterLocationInfoStruct(
+ locationInfo,
+ landmarkTag,
+ positionTag,
+ surfaceTag
+ )
+ }
+ }
+}
diff --git a/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationStruct.kt b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationStruct.kt
new file mode 100644
index 00000000000000..1e34a8c330b656
--- /dev/null
+++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterLocationStruct.kt
@@ -0,0 +1,78 @@
+/*
+ *
+ * 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.
+ */
+package chip.devicecontroller.cluster.structs
+
+import chip.devicecontroller.cluster.*
+import matter.tlv.ContextSpecificTag
+import matter.tlv.Tag
+import matter.tlv.TlvReader
+import matter.tlv.TlvWriter
+
+class ServiceAreaClusterLocationStruct(
+ val locationID: ULong,
+ val mapID: UInt?,
+ val locationInfo: ServiceAreaClusterLocationInfoStruct
+) {
+ override fun toString(): String = buildString {
+ append("ServiceAreaClusterLocationStruct {\n")
+ append("\tlocationID : $locationID\n")
+ append("\tmapID : $mapID\n")
+ append("\tlocationInfo : $locationInfo\n")
+ append("}\n")
+ }
+
+ fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
+ tlvWriter.apply {
+ startStructure(tlvTag)
+ put(ContextSpecificTag(TAG_LOCATION_I_D), locationID)
+ if (mapID != null) {
+ put(ContextSpecificTag(TAG_MAP_I_D), mapID)
+ } else {
+ putNull(ContextSpecificTag(TAG_MAP_I_D))
+ }
+ locationInfo.toTlv(ContextSpecificTag(TAG_LOCATION_INFO), this)
+ endStructure()
+ }
+ }
+
+ companion object {
+ private const val TAG_LOCATION_I_D = 0
+ private const val TAG_MAP_I_D = 1
+ private const val TAG_LOCATION_INFO = 2
+
+ fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterLocationStruct {
+ tlvReader.enterStructure(tlvTag)
+ val locationID = tlvReader.getULong(ContextSpecificTag(TAG_LOCATION_I_D))
+ val mapID =
+ if (!tlvReader.isNull()) {
+ tlvReader.getUInt(ContextSpecificTag(TAG_MAP_I_D))
+ } else {
+ tlvReader.getNull(ContextSpecificTag(TAG_MAP_I_D))
+ null
+ }
+ val locationInfo =
+ ServiceAreaClusterLocationInfoStruct.fromTlv(
+ ContextSpecificTag(TAG_LOCATION_INFO),
+ tlvReader
+ )
+
+ tlvReader.exitContainer()
+
+ return ServiceAreaClusterLocationStruct(locationID, mapID, locationInfo)
+ }
+ }
+}
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
new file mode 100644
index 00000000000000..377ab13f0e9130
--- /dev/null
+++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterMapStruct.kt
@@ -0,0 +1,56 @@
+/*
+ *
+ * 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.
+ */
+package chip.devicecontroller.cluster.structs
+
+import chip.devicecontroller.cluster.*
+import matter.tlv.ContextSpecificTag
+import matter.tlv.Tag
+import matter.tlv.TlvReader
+import matter.tlv.TlvWriter
+
+class ServiceAreaClusterMapStruct(val mapID: UInt, val name: String) {
+ override fun toString(): String = buildString {
+ append("ServiceAreaClusterMapStruct {\n")
+ append("\tmapID : $mapID\n")
+ append("\tname : $name\n")
+ append("}\n")
+ }
+
+ fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
+ tlvWriter.apply {
+ startStructure(tlvTag)
+ put(ContextSpecificTag(TAG_MAP_I_D), mapID)
+ put(ContextSpecificTag(TAG_NAME), name)
+ endStructure()
+ }
+ }
+
+ companion object {
+ private const val TAG_MAP_I_D = 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 name = tlvReader.getString(ContextSpecificTag(TAG_NAME))
+
+ tlvReader.exitContainer()
+
+ return ServiceAreaClusterMapStruct(mapID, name)
+ }
+ }
+}
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
new file mode 100644
index 00000000000000..d65a0faa19c1a2
--- /dev/null
+++ b/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ServiceAreaClusterProgressStruct.kt
@@ -0,0 +1,109 @@
+/*
+ *
+ * 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.
+ */
+package chip.devicecontroller.cluster.structs
+
+import chip.devicecontroller.cluster.*
+import java.util.Optional
+import matter.tlv.ContextSpecificTag
+import matter.tlv.Tag
+import matter.tlv.TlvReader
+import matter.tlv.TlvWriter
+
+class ServiceAreaClusterProgressStruct(
+ val locationID: ULong,
+ val status: UInt,
+ val totalOperationalTime: Optional?,
+ val estimatedTime: Optional?
+) {
+ override fun toString(): String = buildString {
+ append("ServiceAreaClusterProgressStruct {\n")
+ append("\tlocationID : $locationID\n")
+ append("\tstatus : $status\n")
+ append("\ttotalOperationalTime : $totalOperationalTime\n")
+ append("\testimatedTime : $estimatedTime\n")
+ append("}\n")
+ }
+
+ fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
+ tlvWriter.apply {
+ startStructure(tlvTag)
+ put(ContextSpecificTag(TAG_LOCATION_I_D), locationID)
+ put(ContextSpecificTag(TAG_STATUS), status)
+ if (totalOperationalTime != null) {
+ if (totalOperationalTime.isPresent) {
+ val opttotalOperationalTime = totalOperationalTime.get()
+ put(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME), opttotalOperationalTime)
+ }
+ } else {
+ putNull(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME))
+ }
+ if (estimatedTime != null) {
+ if (estimatedTime.isPresent) {
+ val optestimatedTime = estimatedTime.get()
+ put(ContextSpecificTag(TAG_ESTIMATED_TIME), optestimatedTime)
+ }
+ } else {
+ putNull(ContextSpecificTag(TAG_ESTIMATED_TIME))
+ }
+ endStructure()
+ }
+ }
+
+ companion object {
+ private const val TAG_LOCATION_I_D = 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 locationID = tlvReader.getULong(ContextSpecificTag(TAG_LOCATION_I_D))
+ val status = tlvReader.getUInt(ContextSpecificTag(TAG_STATUS))
+ val totalOperationalTime =
+ if (!tlvReader.isNull()) {
+ if (tlvReader.isNextTag(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME))) {
+ Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME)))
+ } else {
+ Optional.empty()
+ }
+ } else {
+ tlvReader.getNull(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME))
+ null
+ }
+ val estimatedTime =
+ if (!tlvReader.isNull()) {
+ if (tlvReader.isNextTag(ContextSpecificTag(TAG_ESTIMATED_TIME))) {
+ Optional.of(tlvReader.getULong(ContextSpecificTag(TAG_ESTIMATED_TIME)))
+ } else {
+ Optional.empty()
+ }
+ } else {
+ tlvReader.getNull(ContextSpecificTag(TAG_ESTIMATED_TIME))
+ null
+ }
+
+ tlvReader.exitContainer()
+
+ return ServiceAreaClusterProgressStruct(
+ locationID,
+ status,
+ totalOperationalTime,
+ estimatedTime
+ )
+ }
+ }
+}
diff --git a/src/controller/java/generated/java/matter/controller/cluster/clusters/ServiceAreaCluster.kt b/src/controller/java/generated/java/matter/controller/cluster/clusters/ServiceAreaCluster.kt
new file mode 100644
index 00000000000000..11203b5f2a99b7
--- /dev/null
+++ b/src/controller/java/generated/java/matter/controller/cluster/clusters/ServiceAreaCluster.kt
@@ -0,0 +1,1460 @@
+/*
+ *
+ * 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.
+ */
+
+package matter.controller.cluster.clusters
+
+import java.time.Duration
+import java.util.logging.Level
+import java.util.logging.Logger
+import kotlinx.coroutines.flow.Flow
+import kotlinx.coroutines.flow.transform
+import matter.controller.InvokeRequest
+import matter.controller.InvokeResponse
+import matter.controller.MatterController
+import matter.controller.ReadData
+import matter.controller.ReadRequest
+import matter.controller.SubscribeRequest
+import matter.controller.SubscriptionState
+import matter.controller.UIntSubscriptionState
+import matter.controller.UShortSubscriptionState
+import matter.controller.cluster.structs.*
+import matter.controller.model.AttributePath
+import matter.controller.model.CommandPath
+import matter.tlv.AnonymousTag
+import matter.tlv.ContextSpecificTag
+import matter.tlv.TlvReader
+import matter.tlv.TlvWriter
+
+class ServiceAreaCluster(private val controller: MatterController, private val endpointId: UShort) {
+ class SelectLocationsResponse(val status: UByte, val statusText: String?)
+
+ class SkipCurrentLocationResponse(val status: UByte, val statusText: String?)
+
+ class SupportedLocationsAttribute(val value: List)
+
+ sealed class SupportedLocationsAttributeSubscriptionState {
+ data class Success(val value: List) :
+ SupportedLocationsAttributeSubscriptionState()
+
+ data class Error(val exception: Exception) : SupportedLocationsAttributeSubscriptionState()
+
+ object SubscriptionEstablished : SupportedLocationsAttributeSubscriptionState()
+ }
+
+ class SupportedMapsAttribute(val value: List?)
+
+ sealed class SupportedMapsAttributeSubscriptionState {
+ data class Success(val value: List?) :
+ SupportedMapsAttributeSubscriptionState()
+
+ data class Error(val exception: Exception) : SupportedMapsAttributeSubscriptionState()
+
+ object SubscriptionEstablished : SupportedMapsAttributeSubscriptionState()
+ }
+
+ class SelectedLocationsAttribute(val value: List?)
+
+ sealed class SelectedLocationsAttributeSubscriptionState {
+ data class Success(val value: List?) : SelectedLocationsAttributeSubscriptionState()
+
+ data class Error(val exception: Exception) : SelectedLocationsAttributeSubscriptionState()
+
+ object SubscriptionEstablished : SelectedLocationsAttributeSubscriptionState()
+ }
+
+ class CurrentLocationAttribute(val value: UInt?)
+
+ sealed class CurrentLocationAttributeSubscriptionState {
+ data class Success(val value: UInt?) : CurrentLocationAttributeSubscriptionState()
+
+ data class Error(val exception: Exception) : CurrentLocationAttributeSubscriptionState()
+
+ object SubscriptionEstablished : CurrentLocationAttributeSubscriptionState()
+ }
+
+ class EstimatedEndTimeAttribute(val value: UInt?)
+
+ sealed class EstimatedEndTimeAttributeSubscriptionState {
+ data class Success(val value: UInt?) : EstimatedEndTimeAttributeSubscriptionState()
+
+ data class Error(val exception: Exception) : EstimatedEndTimeAttributeSubscriptionState()
+
+ object SubscriptionEstablished : EstimatedEndTimeAttributeSubscriptionState()
+ }
+
+ class ProgressAttribute(val value: List?)
+
+ sealed class ProgressAttributeSubscriptionState {
+ data class Success(val value: List?) :
+ ProgressAttributeSubscriptionState()
+
+ data class Error(val exception: Exception) : ProgressAttributeSubscriptionState()
+
+ object SubscriptionEstablished : ProgressAttributeSubscriptionState()
+ }
+
+ class GeneratedCommandListAttribute(val value: List)
+
+ sealed class GeneratedCommandListAttributeSubscriptionState {
+ data class Success(val value: List) : GeneratedCommandListAttributeSubscriptionState()
+
+ data class Error(val exception: Exception) : GeneratedCommandListAttributeSubscriptionState()
+
+ object SubscriptionEstablished : GeneratedCommandListAttributeSubscriptionState()
+ }
+
+ class AcceptedCommandListAttribute(val value: List)
+
+ sealed class AcceptedCommandListAttributeSubscriptionState {
+ data class Success(val value: List) : AcceptedCommandListAttributeSubscriptionState()
+
+ data class Error(val exception: Exception) : AcceptedCommandListAttributeSubscriptionState()
+
+ object SubscriptionEstablished : AcceptedCommandListAttributeSubscriptionState()
+ }
+
+ class EventListAttribute(val value: List)
+
+ sealed class EventListAttributeSubscriptionState {
+ data class Success(val value: List) : EventListAttributeSubscriptionState()
+
+ data class Error(val exception: Exception) : EventListAttributeSubscriptionState()
+
+ object SubscriptionEstablished : EventListAttributeSubscriptionState()
+ }
+
+ class AttributeListAttribute(val value: List)
+
+ sealed class AttributeListAttributeSubscriptionState {
+ data class Success(val value: List) : AttributeListAttributeSubscriptionState()
+
+ data class Error(val exception: Exception) : AttributeListAttributeSubscriptionState()
+
+ object SubscriptionEstablished : AttributeListAttributeSubscriptionState()
+ }
+
+ suspend fun selectLocations(
+ newLocations: List?,
+ timedInvokeTimeout: Duration? = null
+ ): SelectLocationsResponse {
+ val commandId: UInt = 0u
+
+ val tlvWriter = TlvWriter()
+ tlvWriter.startStructure(AnonymousTag)
+
+ val TAG_NEW_LOCATIONS_REQ: Int = 0
+ newLocations?.let {
+ tlvWriter.startArray(ContextSpecificTag(TAG_NEW_LOCATIONS_REQ))
+ for (item in newLocations.iterator()) {
+ tlvWriter.put(AnonymousTag, item)
+ }
+ tlvWriter.endArray()
+ }
+ tlvWriter.endStructure()
+
+ val request: InvokeRequest =
+ InvokeRequest(
+ CommandPath(endpointId, clusterId = CLUSTER_ID, commandId),
+ tlvPayload = tlvWriter.getEncoded(),
+ timedRequest = timedInvokeTimeout
+ )
+
+ val response: InvokeResponse = controller.invoke(request)
+ logger.log(Level.FINE, "Invoke command succeeded: ${response}")
+
+ val tlvReader = TlvReader(response.payload)
+ tlvReader.enterStructure(AnonymousTag)
+ val TAG_STATUS: Int = 0
+ var status_decoded: UByte? = null
+
+ val TAG_STATUS_TEXT: Int = 1
+ var statusText_decoded: String? = null
+
+ while (!tlvReader.isEndOfContainer()) {
+ val tag = tlvReader.peekElement().tag
+
+ if (tag == ContextSpecificTag(TAG_STATUS)) {
+ status_decoded = tlvReader.getUByte(tag)
+ }
+
+ if (tag == ContextSpecificTag(TAG_STATUS_TEXT)) {
+ statusText_decoded =
+ if (tlvReader.isNull()) {
+ tlvReader.getNull(tag)
+ null
+ } else {
+ if (tlvReader.isNextTag(tag)) {
+ tlvReader.getString(tag)
+ } else {
+ null
+ }
+ }
+ } else {
+ tlvReader.skipElement()
+ }
+ }
+
+ if (status_decoded == null) {
+ throw IllegalStateException("status not found in TLV")
+ }
+
+ tlvReader.exitContainer()
+
+ return SelectLocationsResponse(status_decoded, statusText_decoded)
+ }
+
+ suspend fun skipCurrentLocation(
+ timedInvokeTimeout: Duration? = null
+ ): SkipCurrentLocationResponse {
+ val commandId: UInt = 2u
+
+ val tlvWriter = TlvWriter()
+ tlvWriter.startStructure(AnonymousTag)
+ tlvWriter.endStructure()
+
+ val request: InvokeRequest =
+ InvokeRequest(
+ CommandPath(endpointId, clusterId = CLUSTER_ID, commandId),
+ tlvPayload = tlvWriter.getEncoded(),
+ timedRequest = timedInvokeTimeout
+ )
+
+ val response: InvokeResponse = controller.invoke(request)
+ logger.log(Level.FINE, "Invoke command succeeded: ${response}")
+
+ val tlvReader = TlvReader(response.payload)
+ tlvReader.enterStructure(AnonymousTag)
+ val TAG_STATUS: Int = 0
+ var status_decoded: UByte? = null
+
+ val TAG_STATUS_TEXT: Int = 1
+ var statusText_decoded: String? = null
+
+ while (!tlvReader.isEndOfContainer()) {
+ val tag = tlvReader.peekElement().tag
+
+ if (tag == ContextSpecificTag(TAG_STATUS)) {
+ status_decoded = tlvReader.getUByte(tag)
+ }
+
+ if (tag == ContextSpecificTag(TAG_STATUS_TEXT)) {
+ statusText_decoded =
+ if (tlvReader.isNull()) {
+ tlvReader.getNull(tag)
+ null
+ } else {
+ if (tlvReader.isNextTag(tag)) {
+ tlvReader.getString(tag)
+ } else {
+ null
+ }
+ }
+ } else {
+ tlvReader.skipElement()
+ }
+ }
+
+ if (status_decoded == null) {
+ throw IllegalStateException("status not found in TLV")
+ }
+
+ tlvReader.exitContainer()
+
+ return SkipCurrentLocationResponse(status_decoded, statusText_decoded)
+ }
+
+ suspend fun readSupportedLocationsAttribute(): SupportedLocationsAttribute {
+ val ATTRIBUTE_ID: UInt = 0u
+
+ val attributePath =
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+
+ val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath))
+
+ val response = controller.read(readRequest)
+
+ if (response.successes.isEmpty()) {
+ logger.log(Level.WARNING, "Read command failed")
+ throw IllegalStateException("Read command failed with failures: ${response.failures}")
+ }
+
+ logger.log(Level.FINE, "Read command succeeded")
+
+ val attributeData =
+ response.successes.filterIsInstance().firstOrNull {
+ it.path.attributeId == ATTRIBUTE_ID
+ }
+
+ requireNotNull(attributeData) { "Supportedlocations attribute not found in response" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: List =
+ buildList {
+ tlvReader.enterArray(AnonymousTag)
+ while (!tlvReader.isEndOfContainer()) {
+ add(ServiceAreaClusterLocationStruct.fromTlv(AnonymousTag, tlvReader))
+ }
+ tlvReader.exitContainer()
+ }
+
+ return SupportedLocationsAttribute(decodedValue)
+ }
+
+ suspend fun subscribeSupportedLocationsAttribute(
+ minInterval: Int,
+ maxInterval: Int
+ ): Flow {
+ val ATTRIBUTE_ID: UInt = 0u
+ val attributePaths =
+ listOf(
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+ )
+
+ val subscribeRequest: SubscribeRequest =
+ SubscribeRequest(
+ eventPaths = emptyList(),
+ attributePaths = attributePaths,
+ minInterval = Duration.ofSeconds(minInterval.toLong()),
+ maxInterval = Duration.ofSeconds(maxInterval.toLong())
+ )
+
+ return controller.subscribe(subscribeRequest).transform { subscriptionState ->
+ when (subscriptionState) {
+ is SubscriptionState.SubscriptionErrorNotification -> {
+ emit(
+ SupportedLocationsAttributeSubscriptionState.Error(
+ Exception(
+ "Subscription terminated with error code: ${subscriptionState.terminationCause}"
+ )
+ )
+ )
+ }
+ is SubscriptionState.NodeStateUpdate -> {
+ val attributeData =
+ subscriptionState.updateState.successes
+ .filterIsInstance()
+ .firstOrNull { it.path.attributeId == ATTRIBUTE_ID }
+
+ requireNotNull(attributeData) {
+ "Supportedlocations attribute not found in Node State update"
+ }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: List =
+ buildList {
+ tlvReader.enterArray(AnonymousTag)
+ while (!tlvReader.isEndOfContainer()) {
+ add(ServiceAreaClusterLocationStruct.fromTlv(AnonymousTag, tlvReader))
+ }
+ tlvReader.exitContainer()
+ }
+
+ emit(SupportedLocationsAttributeSubscriptionState.Success(decodedValue))
+ }
+ SubscriptionState.SubscriptionEstablished -> {
+ emit(SupportedLocationsAttributeSubscriptionState.SubscriptionEstablished)
+ }
+ }
+ }
+ }
+
+ suspend fun readSupportedMapsAttribute(): SupportedMapsAttribute {
+ val ATTRIBUTE_ID: UInt = 1u
+
+ val attributePath =
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+
+ val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath))
+
+ val response = controller.read(readRequest)
+
+ if (response.successes.isEmpty()) {
+ logger.log(Level.WARNING, "Read command failed")
+ throw IllegalStateException("Read command failed with failures: ${response.failures}")
+ }
+
+ logger.log(Level.FINE, "Read command succeeded")
+
+ val attributeData =
+ response.successes.filterIsInstance().firstOrNull {
+ it.path.attributeId == ATTRIBUTE_ID
+ }
+
+ requireNotNull(attributeData) { "Supportedmaps attribute not found in response" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: List? =
+ if (!tlvReader.isNull()) {
+ buildList {
+ tlvReader.enterArray(AnonymousTag)
+ while (!tlvReader.isEndOfContainer()) {
+ add(ServiceAreaClusterMapStruct.fromTlv(AnonymousTag, tlvReader))
+ }
+ tlvReader.exitContainer()
+ }
+ } else {
+ tlvReader.getNull(AnonymousTag)
+ null
+ }
+
+ return SupportedMapsAttribute(decodedValue)
+ }
+
+ suspend fun subscribeSupportedMapsAttribute(
+ minInterval: Int,
+ maxInterval: Int
+ ): Flow {
+ val ATTRIBUTE_ID: UInt = 1u
+ val attributePaths =
+ listOf(
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+ )
+
+ val subscribeRequest: SubscribeRequest =
+ SubscribeRequest(
+ eventPaths = emptyList(),
+ attributePaths = attributePaths,
+ minInterval = Duration.ofSeconds(minInterval.toLong()),
+ maxInterval = Duration.ofSeconds(maxInterval.toLong())
+ )
+
+ return controller.subscribe(subscribeRequest).transform { subscriptionState ->
+ when (subscriptionState) {
+ is SubscriptionState.SubscriptionErrorNotification -> {
+ emit(
+ SupportedMapsAttributeSubscriptionState.Error(
+ Exception(
+ "Subscription terminated with error code: ${subscriptionState.terminationCause}"
+ )
+ )
+ )
+ }
+ is SubscriptionState.NodeStateUpdate -> {
+ val attributeData =
+ subscriptionState.updateState.successes
+ .filterIsInstance()
+ .firstOrNull { it.path.attributeId == ATTRIBUTE_ID }
+
+ requireNotNull(attributeData) { "Supportedmaps attribute not found in Node State update" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: List? =
+ if (!tlvReader.isNull()) {
+ buildList {
+ tlvReader.enterArray(AnonymousTag)
+ while (!tlvReader.isEndOfContainer()) {
+ add(ServiceAreaClusterMapStruct.fromTlv(AnonymousTag, tlvReader))
+ }
+ tlvReader.exitContainer()
+ }
+ } else {
+ tlvReader.getNull(AnonymousTag)
+ null
+ }
+
+ decodedValue?.let { emit(SupportedMapsAttributeSubscriptionState.Success(it)) }
+ }
+ SubscriptionState.SubscriptionEstablished -> {
+ emit(SupportedMapsAttributeSubscriptionState.SubscriptionEstablished)
+ }
+ }
+ }
+ }
+
+ suspend fun readSelectedLocationsAttribute(): SelectedLocationsAttribute {
+ val ATTRIBUTE_ID: UInt = 2u
+
+ val attributePath =
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+
+ val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath))
+
+ val response = controller.read(readRequest)
+
+ if (response.successes.isEmpty()) {
+ logger.log(Level.WARNING, "Read command failed")
+ throw IllegalStateException("Read command failed with failures: ${response.failures}")
+ }
+
+ logger.log(Level.FINE, "Read command succeeded")
+
+ val attributeData =
+ response.successes.filterIsInstance().firstOrNull {
+ it.path.attributeId == ATTRIBUTE_ID
+ }
+
+ requireNotNull(attributeData) { "Selectedlocations attribute not found in response" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: List? =
+ if (!tlvReader.isNull()) {
+ buildList {
+ tlvReader.enterArray(AnonymousTag)
+ while (!tlvReader.isEndOfContainer()) {
+ add(tlvReader.getUInt(AnonymousTag))
+ }
+ tlvReader.exitContainer()
+ }
+ } else {
+ tlvReader.getNull(AnonymousTag)
+ null
+ }
+
+ return SelectedLocationsAttribute(decodedValue)
+ }
+
+ suspend fun subscribeSelectedLocationsAttribute(
+ minInterval: Int,
+ maxInterval: Int
+ ): Flow {
+ val ATTRIBUTE_ID: UInt = 2u
+ val attributePaths =
+ listOf(
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+ )
+
+ val subscribeRequest: SubscribeRequest =
+ SubscribeRequest(
+ eventPaths = emptyList(),
+ attributePaths = attributePaths,
+ minInterval = Duration.ofSeconds(minInterval.toLong()),
+ maxInterval = Duration.ofSeconds(maxInterval.toLong())
+ )
+
+ return controller.subscribe(subscribeRequest).transform { subscriptionState ->
+ when (subscriptionState) {
+ is SubscriptionState.SubscriptionErrorNotification -> {
+ emit(
+ SelectedLocationsAttributeSubscriptionState.Error(
+ Exception(
+ "Subscription terminated with error code: ${subscriptionState.terminationCause}"
+ )
+ )
+ )
+ }
+ is SubscriptionState.NodeStateUpdate -> {
+ val attributeData =
+ subscriptionState.updateState.successes
+ .filterIsInstance()
+ .firstOrNull { it.path.attributeId == ATTRIBUTE_ID }
+
+ requireNotNull(attributeData) {
+ "Selectedlocations attribute not found in Node State update"
+ }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: List? =
+ if (!tlvReader.isNull()) {
+ buildList {
+ tlvReader.enterArray(AnonymousTag)
+ while (!tlvReader.isEndOfContainer()) {
+ add(tlvReader.getUInt(AnonymousTag))
+ }
+ tlvReader.exitContainer()
+ }
+ } else {
+ tlvReader.getNull(AnonymousTag)
+ null
+ }
+
+ decodedValue?.let { emit(SelectedLocationsAttributeSubscriptionState.Success(it)) }
+ }
+ SubscriptionState.SubscriptionEstablished -> {
+ emit(SelectedLocationsAttributeSubscriptionState.SubscriptionEstablished)
+ }
+ }
+ }
+ }
+
+ suspend fun readCurrentLocationAttribute(): CurrentLocationAttribute {
+ val ATTRIBUTE_ID: UInt = 3u
+
+ val attributePath =
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+
+ val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath))
+
+ val response = controller.read(readRequest)
+
+ if (response.successes.isEmpty()) {
+ logger.log(Level.WARNING, "Read command failed")
+ throw IllegalStateException("Read command failed with failures: ${response.failures}")
+ }
+
+ logger.log(Level.FINE, "Read command succeeded")
+
+ val attributeData =
+ response.successes.filterIsInstance().firstOrNull {
+ it.path.attributeId == ATTRIBUTE_ID
+ }
+
+ requireNotNull(attributeData) { "Currentlocation attribute not found in response" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: UInt? =
+ if (!tlvReader.isNull()) {
+ if (tlvReader.isNextTag(AnonymousTag)) {
+ tlvReader.getUInt(AnonymousTag)
+ } else {
+ null
+ }
+ } else {
+ tlvReader.getNull(AnonymousTag)
+ null
+ }
+
+ return CurrentLocationAttribute(decodedValue)
+ }
+
+ suspend fun subscribeCurrentLocationAttribute(
+ minInterval: Int,
+ maxInterval: Int
+ ): Flow {
+ val ATTRIBUTE_ID: UInt = 3u
+ val attributePaths =
+ listOf(
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+ )
+
+ val subscribeRequest: SubscribeRequest =
+ SubscribeRequest(
+ eventPaths = emptyList(),
+ attributePaths = attributePaths,
+ minInterval = Duration.ofSeconds(minInterval.toLong()),
+ maxInterval = Duration.ofSeconds(maxInterval.toLong())
+ )
+
+ return controller.subscribe(subscribeRequest).transform { subscriptionState ->
+ when (subscriptionState) {
+ is SubscriptionState.SubscriptionErrorNotification -> {
+ emit(
+ CurrentLocationAttributeSubscriptionState.Error(
+ Exception(
+ "Subscription terminated with error code: ${subscriptionState.terminationCause}"
+ )
+ )
+ )
+ }
+ is SubscriptionState.NodeStateUpdate -> {
+ val attributeData =
+ subscriptionState.updateState.successes
+ .filterIsInstance()
+ .firstOrNull { it.path.attributeId == ATTRIBUTE_ID }
+
+ requireNotNull(attributeData) {
+ "Currentlocation attribute not found in Node State update"
+ }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: UInt? =
+ if (!tlvReader.isNull()) {
+ if (tlvReader.isNextTag(AnonymousTag)) {
+ tlvReader.getUInt(AnonymousTag)
+ } else {
+ null
+ }
+ } else {
+ tlvReader.getNull(AnonymousTag)
+ null
+ }
+
+ decodedValue?.let { emit(CurrentLocationAttributeSubscriptionState.Success(it)) }
+ }
+ SubscriptionState.SubscriptionEstablished -> {
+ emit(CurrentLocationAttributeSubscriptionState.SubscriptionEstablished)
+ }
+ }
+ }
+ }
+
+ suspend fun readEstimatedEndTimeAttribute(): EstimatedEndTimeAttribute {
+ val ATTRIBUTE_ID: UInt = 4u
+
+ val attributePath =
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+
+ val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath))
+
+ val response = controller.read(readRequest)
+
+ if (response.successes.isEmpty()) {
+ logger.log(Level.WARNING, "Read command failed")
+ throw IllegalStateException("Read command failed with failures: ${response.failures}")
+ }
+
+ logger.log(Level.FINE, "Read command succeeded")
+
+ val attributeData =
+ response.successes.filterIsInstance().firstOrNull {
+ it.path.attributeId == ATTRIBUTE_ID
+ }
+
+ requireNotNull(attributeData) { "Estimatedendtime attribute not found in response" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: UInt? =
+ if (!tlvReader.isNull()) {
+ if (tlvReader.isNextTag(AnonymousTag)) {
+ tlvReader.getUInt(AnonymousTag)
+ } else {
+ null
+ }
+ } else {
+ tlvReader.getNull(AnonymousTag)
+ null
+ }
+
+ return EstimatedEndTimeAttribute(decodedValue)
+ }
+
+ suspend fun subscribeEstimatedEndTimeAttribute(
+ minInterval: Int,
+ maxInterval: Int
+ ): Flow {
+ val ATTRIBUTE_ID: UInt = 4u
+ val attributePaths =
+ listOf(
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+ )
+
+ val subscribeRequest: SubscribeRequest =
+ SubscribeRequest(
+ eventPaths = emptyList(),
+ attributePaths = attributePaths,
+ minInterval = Duration.ofSeconds(minInterval.toLong()),
+ maxInterval = Duration.ofSeconds(maxInterval.toLong())
+ )
+
+ return controller.subscribe(subscribeRequest).transform { subscriptionState ->
+ when (subscriptionState) {
+ is SubscriptionState.SubscriptionErrorNotification -> {
+ emit(
+ EstimatedEndTimeAttributeSubscriptionState.Error(
+ Exception(
+ "Subscription terminated with error code: ${subscriptionState.terminationCause}"
+ )
+ )
+ )
+ }
+ is SubscriptionState.NodeStateUpdate -> {
+ val attributeData =
+ subscriptionState.updateState.successes
+ .filterIsInstance()
+ .firstOrNull { it.path.attributeId == ATTRIBUTE_ID }
+
+ requireNotNull(attributeData) {
+ "Estimatedendtime attribute not found in Node State update"
+ }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: UInt? =
+ if (!tlvReader.isNull()) {
+ if (tlvReader.isNextTag(AnonymousTag)) {
+ tlvReader.getUInt(AnonymousTag)
+ } else {
+ null
+ }
+ } else {
+ tlvReader.getNull(AnonymousTag)
+ null
+ }
+
+ decodedValue?.let { emit(EstimatedEndTimeAttributeSubscriptionState.Success(it)) }
+ }
+ SubscriptionState.SubscriptionEstablished -> {
+ emit(EstimatedEndTimeAttributeSubscriptionState.SubscriptionEstablished)
+ }
+ }
+ }
+ }
+
+ suspend fun readProgressAttribute(): ProgressAttribute {
+ val ATTRIBUTE_ID: UInt = 5u
+
+ val attributePath =
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+
+ val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath))
+
+ val response = controller.read(readRequest)
+
+ if (response.successes.isEmpty()) {
+ logger.log(Level.WARNING, "Read command failed")
+ throw IllegalStateException("Read command failed with failures: ${response.failures}")
+ }
+
+ logger.log(Level.FINE, "Read command succeeded")
+
+ val attributeData =
+ response.successes.filterIsInstance().firstOrNull {
+ it.path.attributeId == ATTRIBUTE_ID
+ }
+
+ requireNotNull(attributeData) { "Progress attribute not found in response" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: List? =
+ if (!tlvReader.isNull()) {
+ if (tlvReader.isNextTag(AnonymousTag)) {
+ buildList {
+ tlvReader.enterArray(AnonymousTag)
+ while (!tlvReader.isEndOfContainer()) {
+ add(ServiceAreaClusterProgressStruct.fromTlv(AnonymousTag, tlvReader))
+ }
+ tlvReader.exitContainer()
+ }
+ } else {
+ null
+ }
+ } else {
+ tlvReader.getNull(AnonymousTag)
+ null
+ }
+
+ return ProgressAttribute(decodedValue)
+ }
+
+ suspend fun subscribeProgressAttribute(
+ minInterval: Int,
+ maxInterval: Int
+ ): Flow {
+ val ATTRIBUTE_ID: UInt = 5u
+ val attributePaths =
+ listOf(
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+ )
+
+ val subscribeRequest: SubscribeRequest =
+ SubscribeRequest(
+ eventPaths = emptyList(),
+ attributePaths = attributePaths,
+ minInterval = Duration.ofSeconds(minInterval.toLong()),
+ maxInterval = Duration.ofSeconds(maxInterval.toLong())
+ )
+
+ return controller.subscribe(subscribeRequest).transform { subscriptionState ->
+ when (subscriptionState) {
+ is SubscriptionState.SubscriptionErrorNotification -> {
+ emit(
+ ProgressAttributeSubscriptionState.Error(
+ Exception(
+ "Subscription terminated with error code: ${subscriptionState.terminationCause}"
+ )
+ )
+ )
+ }
+ is SubscriptionState.NodeStateUpdate -> {
+ val attributeData =
+ subscriptionState.updateState.successes
+ .filterIsInstance()
+ .firstOrNull { it.path.attributeId == ATTRIBUTE_ID }
+
+ requireNotNull(attributeData) { "Progress attribute not found in Node State update" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: List? =
+ if (!tlvReader.isNull()) {
+ if (tlvReader.isNextTag(AnonymousTag)) {
+ buildList {
+ tlvReader.enterArray(AnonymousTag)
+ while (!tlvReader.isEndOfContainer()) {
+ add(ServiceAreaClusterProgressStruct.fromTlv(AnonymousTag, tlvReader))
+ }
+ tlvReader.exitContainer()
+ }
+ } else {
+ null
+ }
+ } else {
+ tlvReader.getNull(AnonymousTag)
+ null
+ }
+
+ decodedValue?.let { emit(ProgressAttributeSubscriptionState.Success(it)) }
+ }
+ SubscriptionState.SubscriptionEstablished -> {
+ emit(ProgressAttributeSubscriptionState.SubscriptionEstablished)
+ }
+ }
+ }
+ }
+
+ suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute {
+ val ATTRIBUTE_ID: UInt = 65528u
+
+ val attributePath =
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+
+ val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath))
+
+ val response = controller.read(readRequest)
+
+ if (response.successes.isEmpty()) {
+ logger.log(Level.WARNING, "Read command failed")
+ throw IllegalStateException("Read command failed with failures: ${response.failures}")
+ }
+
+ logger.log(Level.FINE, "Read command succeeded")
+
+ val attributeData =
+ response.successes.filterIsInstance().firstOrNull {
+ it.path.attributeId == ATTRIBUTE_ID
+ }
+
+ requireNotNull(attributeData) { "Generatedcommandlist attribute not found in response" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: List =
+ buildList {
+ tlvReader.enterArray(AnonymousTag)
+ while (!tlvReader.isEndOfContainer()) {
+ add(tlvReader.getUInt(AnonymousTag))
+ }
+ tlvReader.exitContainer()
+ }
+
+ return GeneratedCommandListAttribute(decodedValue)
+ }
+
+ suspend fun subscribeGeneratedCommandListAttribute(
+ minInterval: Int,
+ maxInterval: Int
+ ): Flow {
+ val ATTRIBUTE_ID: UInt = 65528u
+ val attributePaths =
+ listOf(
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+ )
+
+ val subscribeRequest: SubscribeRequest =
+ SubscribeRequest(
+ eventPaths = emptyList(),
+ attributePaths = attributePaths,
+ minInterval = Duration.ofSeconds(minInterval.toLong()),
+ maxInterval = Duration.ofSeconds(maxInterval.toLong())
+ )
+
+ return controller.subscribe(subscribeRequest).transform { subscriptionState ->
+ when (subscriptionState) {
+ is SubscriptionState.SubscriptionErrorNotification -> {
+ emit(
+ GeneratedCommandListAttributeSubscriptionState.Error(
+ Exception(
+ "Subscription terminated with error code: ${subscriptionState.terminationCause}"
+ )
+ )
+ )
+ }
+ is SubscriptionState.NodeStateUpdate -> {
+ val attributeData =
+ subscriptionState.updateState.successes
+ .filterIsInstance()
+ .firstOrNull { it.path.attributeId == ATTRIBUTE_ID }
+
+ requireNotNull(attributeData) {
+ "Generatedcommandlist attribute not found in Node State update"
+ }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: List =
+ buildList {
+ tlvReader.enterArray(AnonymousTag)
+ while (!tlvReader.isEndOfContainer()) {
+ add(tlvReader.getUInt(AnonymousTag))
+ }
+ tlvReader.exitContainer()
+ }
+
+ emit(GeneratedCommandListAttributeSubscriptionState.Success(decodedValue))
+ }
+ SubscriptionState.SubscriptionEstablished -> {
+ emit(GeneratedCommandListAttributeSubscriptionState.SubscriptionEstablished)
+ }
+ }
+ }
+ }
+
+ suspend fun readAcceptedCommandListAttribute(): AcceptedCommandListAttribute {
+ val ATTRIBUTE_ID: UInt = 65529u
+
+ val attributePath =
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+
+ val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath))
+
+ val response = controller.read(readRequest)
+
+ if (response.successes.isEmpty()) {
+ logger.log(Level.WARNING, "Read command failed")
+ throw IllegalStateException("Read command failed with failures: ${response.failures}")
+ }
+
+ logger.log(Level.FINE, "Read command succeeded")
+
+ val attributeData =
+ response.successes.filterIsInstance().firstOrNull {
+ it.path.attributeId == ATTRIBUTE_ID
+ }
+
+ requireNotNull(attributeData) { "Acceptedcommandlist attribute not found in response" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: List =
+ buildList {
+ tlvReader.enterArray(AnonymousTag)
+ while (!tlvReader.isEndOfContainer()) {
+ add(tlvReader.getUInt(AnonymousTag))
+ }
+ tlvReader.exitContainer()
+ }
+
+ return AcceptedCommandListAttribute(decodedValue)
+ }
+
+ suspend fun subscribeAcceptedCommandListAttribute(
+ minInterval: Int,
+ maxInterval: Int
+ ): Flow {
+ val ATTRIBUTE_ID: UInt = 65529u
+ val attributePaths =
+ listOf(
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+ )
+
+ val subscribeRequest: SubscribeRequest =
+ SubscribeRequest(
+ eventPaths = emptyList(),
+ attributePaths = attributePaths,
+ minInterval = Duration.ofSeconds(minInterval.toLong()),
+ maxInterval = Duration.ofSeconds(maxInterval.toLong())
+ )
+
+ return controller.subscribe(subscribeRequest).transform { subscriptionState ->
+ when (subscriptionState) {
+ is SubscriptionState.SubscriptionErrorNotification -> {
+ emit(
+ AcceptedCommandListAttributeSubscriptionState.Error(
+ Exception(
+ "Subscription terminated with error code: ${subscriptionState.terminationCause}"
+ )
+ )
+ )
+ }
+ is SubscriptionState.NodeStateUpdate -> {
+ val attributeData =
+ subscriptionState.updateState.successes
+ .filterIsInstance()
+ .firstOrNull { it.path.attributeId == ATTRIBUTE_ID }
+
+ requireNotNull(attributeData) {
+ "Acceptedcommandlist attribute not found in Node State update"
+ }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: List =
+ buildList {
+ tlvReader.enterArray(AnonymousTag)
+ while (!tlvReader.isEndOfContainer()) {
+ add(tlvReader.getUInt(AnonymousTag))
+ }
+ tlvReader.exitContainer()
+ }
+
+ emit(AcceptedCommandListAttributeSubscriptionState.Success(decodedValue))
+ }
+ SubscriptionState.SubscriptionEstablished -> {
+ emit(AcceptedCommandListAttributeSubscriptionState.SubscriptionEstablished)
+ }
+ }
+ }
+ }
+
+ suspend fun readEventListAttribute(): EventListAttribute {
+ val ATTRIBUTE_ID: UInt = 65530u
+
+ val attributePath =
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+
+ val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath))
+
+ val response = controller.read(readRequest)
+
+ if (response.successes.isEmpty()) {
+ logger.log(Level.WARNING, "Read command failed")
+ throw IllegalStateException("Read command failed with failures: ${response.failures}")
+ }
+
+ logger.log(Level.FINE, "Read command succeeded")
+
+ val attributeData =
+ response.successes.filterIsInstance().firstOrNull {
+ it.path.attributeId == ATTRIBUTE_ID
+ }
+
+ requireNotNull(attributeData) { "Eventlist attribute not found in response" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: List =
+ buildList {
+ tlvReader.enterArray(AnonymousTag)
+ while (!tlvReader.isEndOfContainer()) {
+ add(tlvReader.getUInt(AnonymousTag))
+ }
+ tlvReader.exitContainer()
+ }
+
+ return EventListAttribute(decodedValue)
+ }
+
+ suspend fun subscribeEventListAttribute(
+ minInterval: Int,
+ maxInterval: Int
+ ): Flow {
+ val ATTRIBUTE_ID: UInt = 65530u
+ val attributePaths =
+ listOf(
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+ )
+
+ val subscribeRequest: SubscribeRequest =
+ SubscribeRequest(
+ eventPaths = emptyList(),
+ attributePaths = attributePaths,
+ minInterval = Duration.ofSeconds(minInterval.toLong()),
+ maxInterval = Duration.ofSeconds(maxInterval.toLong())
+ )
+
+ return controller.subscribe(subscribeRequest).transform { subscriptionState ->
+ when (subscriptionState) {
+ is SubscriptionState.SubscriptionErrorNotification -> {
+ emit(
+ EventListAttributeSubscriptionState.Error(
+ Exception(
+ "Subscription terminated with error code: ${subscriptionState.terminationCause}"
+ )
+ )
+ )
+ }
+ is SubscriptionState.NodeStateUpdate -> {
+ val attributeData =
+ subscriptionState.updateState.successes
+ .filterIsInstance()
+ .firstOrNull { it.path.attributeId == ATTRIBUTE_ID }
+
+ requireNotNull(attributeData) { "Eventlist attribute not found in Node State update" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: List =
+ buildList {
+ tlvReader.enterArray(AnonymousTag)
+ while (!tlvReader.isEndOfContainer()) {
+ add(tlvReader.getUInt(AnonymousTag))
+ }
+ tlvReader.exitContainer()
+ }
+
+ emit(EventListAttributeSubscriptionState.Success(decodedValue))
+ }
+ SubscriptionState.SubscriptionEstablished -> {
+ emit(EventListAttributeSubscriptionState.SubscriptionEstablished)
+ }
+ }
+ }
+ }
+
+ suspend fun readAttributeListAttribute(): AttributeListAttribute {
+ val ATTRIBUTE_ID: UInt = 65531u
+
+ val attributePath =
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+
+ val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath))
+
+ val response = controller.read(readRequest)
+
+ if (response.successes.isEmpty()) {
+ logger.log(Level.WARNING, "Read command failed")
+ throw IllegalStateException("Read command failed with failures: ${response.failures}")
+ }
+
+ logger.log(Level.FINE, "Read command succeeded")
+
+ val attributeData =
+ response.successes.filterIsInstance().firstOrNull {
+ it.path.attributeId == ATTRIBUTE_ID
+ }
+
+ requireNotNull(attributeData) { "Attributelist attribute not found in response" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: List =
+ buildList {
+ tlvReader.enterArray(AnonymousTag)
+ while (!tlvReader.isEndOfContainer()) {
+ add(tlvReader.getUInt(AnonymousTag))
+ }
+ tlvReader.exitContainer()
+ }
+
+ return AttributeListAttribute(decodedValue)
+ }
+
+ suspend fun subscribeAttributeListAttribute(
+ minInterval: Int,
+ maxInterval: Int
+ ): Flow {
+ val ATTRIBUTE_ID: UInt = 65531u
+ val attributePaths =
+ listOf(
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+ )
+
+ val subscribeRequest: SubscribeRequest =
+ SubscribeRequest(
+ eventPaths = emptyList(),
+ attributePaths = attributePaths,
+ minInterval = Duration.ofSeconds(minInterval.toLong()),
+ maxInterval = Duration.ofSeconds(maxInterval.toLong())
+ )
+
+ return controller.subscribe(subscribeRequest).transform { subscriptionState ->
+ when (subscriptionState) {
+ is SubscriptionState.SubscriptionErrorNotification -> {
+ emit(
+ AttributeListAttributeSubscriptionState.Error(
+ Exception(
+ "Subscription terminated with error code: ${subscriptionState.terminationCause}"
+ )
+ )
+ )
+ }
+ is SubscriptionState.NodeStateUpdate -> {
+ val attributeData =
+ subscriptionState.updateState.successes
+ .filterIsInstance()
+ .firstOrNull { it.path.attributeId == ATTRIBUTE_ID }
+
+ requireNotNull(attributeData) { "Attributelist attribute not found in Node State update" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: List =
+ buildList {
+ tlvReader.enterArray(AnonymousTag)
+ while (!tlvReader.isEndOfContainer()) {
+ add(tlvReader.getUInt(AnonymousTag))
+ }
+ tlvReader.exitContainer()
+ }
+
+ emit(AttributeListAttributeSubscriptionState.Success(decodedValue))
+ }
+ SubscriptionState.SubscriptionEstablished -> {
+ emit(AttributeListAttributeSubscriptionState.SubscriptionEstablished)
+ }
+ }
+ }
+ }
+
+ suspend fun readFeatureMapAttribute(): UInt {
+ val ATTRIBUTE_ID: UInt = 65532u
+
+ val attributePath =
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+
+ val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath))
+
+ val response = controller.read(readRequest)
+
+ if (response.successes.isEmpty()) {
+ logger.log(Level.WARNING, "Read command failed")
+ throw IllegalStateException("Read command failed with failures: ${response.failures}")
+ }
+
+ logger.log(Level.FINE, "Read command succeeded")
+
+ val attributeData =
+ response.successes.filterIsInstance().firstOrNull {
+ it.path.attributeId == ATTRIBUTE_ID
+ }
+
+ requireNotNull(attributeData) { "Featuremap attribute not found in response" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: UInt = tlvReader.getUInt(AnonymousTag)
+
+ return decodedValue
+ }
+
+ suspend fun subscribeFeatureMapAttribute(
+ minInterval: Int,
+ maxInterval: Int
+ ): Flow {
+ val ATTRIBUTE_ID: UInt = 65532u
+ val attributePaths =
+ listOf(
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+ )
+
+ val subscribeRequest: SubscribeRequest =
+ SubscribeRequest(
+ eventPaths = emptyList(),
+ attributePaths = attributePaths,
+ minInterval = Duration.ofSeconds(minInterval.toLong()),
+ maxInterval = Duration.ofSeconds(maxInterval.toLong())
+ )
+
+ return controller.subscribe(subscribeRequest).transform { subscriptionState ->
+ when (subscriptionState) {
+ is SubscriptionState.SubscriptionErrorNotification -> {
+ emit(
+ UIntSubscriptionState.Error(
+ Exception(
+ "Subscription terminated with error code: ${subscriptionState.terminationCause}"
+ )
+ )
+ )
+ }
+ is SubscriptionState.NodeStateUpdate -> {
+ val attributeData =
+ subscriptionState.updateState.successes
+ .filterIsInstance()
+ .firstOrNull { it.path.attributeId == ATTRIBUTE_ID }
+
+ requireNotNull(attributeData) { "Featuremap attribute not found in Node State update" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: UInt = tlvReader.getUInt(AnonymousTag)
+
+ emit(UIntSubscriptionState.Success(decodedValue))
+ }
+ SubscriptionState.SubscriptionEstablished -> {
+ emit(UIntSubscriptionState.SubscriptionEstablished)
+ }
+ }
+ }
+ }
+
+ suspend fun readClusterRevisionAttribute(): UShort {
+ val ATTRIBUTE_ID: UInt = 65533u
+
+ val attributePath =
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+
+ val readRequest = ReadRequest(eventPaths = emptyList(), attributePaths = listOf(attributePath))
+
+ val response = controller.read(readRequest)
+
+ if (response.successes.isEmpty()) {
+ logger.log(Level.WARNING, "Read command failed")
+ throw IllegalStateException("Read command failed with failures: ${response.failures}")
+ }
+
+ logger.log(Level.FINE, "Read command succeeded")
+
+ val attributeData =
+ response.successes.filterIsInstance().firstOrNull {
+ it.path.attributeId == ATTRIBUTE_ID
+ }
+
+ requireNotNull(attributeData) { "Clusterrevision attribute not found in response" }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: UShort = tlvReader.getUShort(AnonymousTag)
+
+ return decodedValue
+ }
+
+ suspend fun subscribeClusterRevisionAttribute(
+ minInterval: Int,
+ maxInterval: Int
+ ): Flow {
+ val ATTRIBUTE_ID: UInt = 65533u
+ val attributePaths =
+ listOf(
+ AttributePath(endpointId = endpointId, clusterId = CLUSTER_ID, attributeId = ATTRIBUTE_ID)
+ )
+
+ val subscribeRequest: SubscribeRequest =
+ SubscribeRequest(
+ eventPaths = emptyList(),
+ attributePaths = attributePaths,
+ minInterval = Duration.ofSeconds(minInterval.toLong()),
+ maxInterval = Duration.ofSeconds(maxInterval.toLong())
+ )
+
+ return controller.subscribe(subscribeRequest).transform { subscriptionState ->
+ when (subscriptionState) {
+ is SubscriptionState.SubscriptionErrorNotification -> {
+ emit(
+ UShortSubscriptionState.Error(
+ Exception(
+ "Subscription terminated with error code: ${subscriptionState.terminationCause}"
+ )
+ )
+ )
+ }
+ is SubscriptionState.NodeStateUpdate -> {
+ val attributeData =
+ subscriptionState.updateState.successes
+ .filterIsInstance()
+ .firstOrNull { it.path.attributeId == ATTRIBUTE_ID }
+
+ requireNotNull(attributeData) {
+ "Clusterrevision attribute not found in Node State update"
+ }
+
+ // Decode the TLV data into the appropriate type
+ val tlvReader = TlvReader(attributeData.data)
+ val decodedValue: UShort = tlvReader.getUShort(AnonymousTag)
+
+ emit(UShortSubscriptionState.Success(decodedValue))
+ }
+ SubscriptionState.SubscriptionEstablished -> {
+ emit(UShortSubscriptionState.SubscriptionEstablished)
+ }
+ }
+ }
+ }
+
+ companion object {
+ private val logger = Logger.getLogger(ServiceAreaCluster::class.java.name)
+ const val CLUSTER_ID: UInt = 336u
+ }
+}
diff --git a/src/controller/java/generated/java/matter/controller/cluster/files.gni b/src/controller/java/generated/java/matter/controller/cluster/files.gni
index ff3afa7d53e5fd..4485a760e2b427 100644
--- a/src/controller/java/generated/java/matter/controller/cluster/files.gni
+++ b/src/controller/java/generated/java/matter/controller/cluster/files.gni
@@ -115,6 +115,11 @@ matter_structs_sources = [
"${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterAttributeValuePair.kt",
"${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterExtensionFieldSet.kt",
"${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ScenesManagementClusterSceneInfoStruct.kt",
+ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterHomeLocationStruct.kt",
+ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLocationInfoStruct.kt",
+ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLocationStruct.kt",
+ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterMapStruct.kt",
+ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterProgressStruct.kt",
"${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/SoftwareDiagnosticsClusterThreadMetricsStruct.kt",
"${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/TargetNavigatorClusterTargetInfoStruct.kt",
"${chip_root}/src/controller/java/generated/java/matter/controller/cluster/structs/ThermostatClusterPresetStruct.kt",
@@ -325,6 +330,7 @@ matter_clusters_sources = [
"${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/RvcRunModeCluster.kt",
"${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/SampleMeiCluster.kt",
"${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ScenesManagementCluster.kt",
+ "${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/ServiceAreaCluster.kt",
"${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/SmokeCoAlarmCluster.kt",
"${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/SoftwareDiagnosticsCluster.kt",
"${chip_root}/src/controller/java/generated/java/matter/controller/cluster/clusters/SwitchCluster.kt",
diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterHomeLocationStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterHomeLocationStruct.kt
new file mode 100644
index 00000000000000..5af3730a4460a8
--- /dev/null
+++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterHomeLocationStruct.kt
@@ -0,0 +1,84 @@
+/*
+ *
+ * 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.
+ */
+package matter.controller.cluster.structs
+
+import matter.controller.cluster.*
+import matter.tlv.ContextSpecificTag
+import matter.tlv.Tag
+import matter.tlv.TlvReader
+import matter.tlv.TlvWriter
+
+class ServiceAreaClusterHomeLocationStruct(
+ val locationName: String,
+ val floorNumber: Short?,
+ val areaType: UByte?
+) {
+ override fun toString(): String = buildString {
+ append("ServiceAreaClusterHomeLocationStruct {\n")
+ append("\tlocationName : $locationName\n")
+ append("\tfloorNumber : $floorNumber\n")
+ append("\tareaType : $areaType\n")
+ append("}\n")
+ }
+
+ fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
+ tlvWriter.apply {
+ startStructure(tlvTag)
+ put(ContextSpecificTag(TAG_LOCATION_NAME), locationName)
+ if (floorNumber != null) {
+ put(ContextSpecificTag(TAG_FLOOR_NUMBER), floorNumber)
+ } else {
+ putNull(ContextSpecificTag(TAG_FLOOR_NUMBER))
+ }
+ if (areaType != null) {
+ put(ContextSpecificTag(TAG_AREA_TYPE), areaType)
+ } else {
+ putNull(ContextSpecificTag(TAG_AREA_TYPE))
+ }
+ endStructure()
+ }
+ }
+
+ companion object {
+ private const val TAG_LOCATION_NAME = 0
+ private const val TAG_FLOOR_NUMBER = 1
+ private const val TAG_AREA_TYPE = 2
+
+ fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterHomeLocationStruct {
+ tlvReader.enterStructure(tlvTag)
+ val locationName = tlvReader.getString(ContextSpecificTag(TAG_LOCATION_NAME))
+ val floorNumber =
+ if (!tlvReader.isNull()) {
+ tlvReader.getShort(ContextSpecificTag(TAG_FLOOR_NUMBER))
+ } else {
+ tlvReader.getNull(ContextSpecificTag(TAG_FLOOR_NUMBER))
+ null
+ }
+ val areaType =
+ if (!tlvReader.isNull()) {
+ tlvReader.getUByte(ContextSpecificTag(TAG_AREA_TYPE))
+ } else {
+ tlvReader.getNull(ContextSpecificTag(TAG_AREA_TYPE))
+ null
+ }
+
+ tlvReader.exitContainer()
+
+ return ServiceAreaClusterHomeLocationStruct(locationName, floorNumber, areaType)
+ }
+ }
+}
diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLocationInfoStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLocationInfoStruct.kt
new file mode 100644
index 00000000000000..c53b65c2dbb22f
--- /dev/null
+++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLocationInfoStruct.kt
@@ -0,0 +1,117 @@
+/*
+ *
+ * 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.
+ */
+package matter.controller.cluster.structs
+
+import matter.controller.cluster.*
+import matter.tlv.ContextSpecificTag
+import matter.tlv.Tag
+import matter.tlv.TlvReader
+import matter.tlv.TlvWriter
+
+class ServiceAreaClusterLocationInfoStruct(
+ val locationInfo: ServiceAreaClusterHomeLocationStruct?,
+ val landmarkTag: UByte?,
+ val positionTag: UByte?,
+ val surfaceTag: UByte?
+) {
+ override fun toString(): String = buildString {
+ append("ServiceAreaClusterLocationInfoStruct {\n")
+ append("\tlocationInfo : $locationInfo\n")
+ append("\tlandmarkTag : $landmarkTag\n")
+ append("\tpositionTag : $positionTag\n")
+ append("\tsurfaceTag : $surfaceTag\n")
+ append("}\n")
+ }
+
+ fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
+ tlvWriter.apply {
+ startStructure(tlvTag)
+ if (locationInfo != null) {
+ locationInfo.toTlv(ContextSpecificTag(TAG_LOCATION_INFO), this)
+ } else {
+ putNull(ContextSpecificTag(TAG_LOCATION_INFO))
+ }
+ if (landmarkTag != null) {
+ put(ContextSpecificTag(TAG_LANDMARK_TAG), landmarkTag)
+ } else {
+ putNull(ContextSpecificTag(TAG_LANDMARK_TAG))
+ }
+ if (positionTag != null) {
+ put(ContextSpecificTag(TAG_POSITION_TAG), positionTag)
+ } else {
+ putNull(ContextSpecificTag(TAG_POSITION_TAG))
+ }
+ if (surfaceTag != null) {
+ put(ContextSpecificTag(TAG_SURFACE_TAG), surfaceTag)
+ } else {
+ putNull(ContextSpecificTag(TAG_SURFACE_TAG))
+ }
+ endStructure()
+ }
+ }
+
+ companion object {
+ private const val TAG_LOCATION_INFO = 0
+ private const val TAG_LANDMARK_TAG = 1
+ private const val TAG_POSITION_TAG = 2
+ private const val TAG_SURFACE_TAG = 3
+
+ fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterLocationInfoStruct {
+ tlvReader.enterStructure(tlvTag)
+ val locationInfo =
+ if (!tlvReader.isNull()) {
+ ServiceAreaClusterHomeLocationStruct.fromTlv(
+ ContextSpecificTag(TAG_LOCATION_INFO),
+ tlvReader
+ )
+ } else {
+ tlvReader.getNull(ContextSpecificTag(TAG_LOCATION_INFO))
+ null
+ }
+ val landmarkTag =
+ if (!tlvReader.isNull()) {
+ tlvReader.getUByte(ContextSpecificTag(TAG_LANDMARK_TAG))
+ } else {
+ tlvReader.getNull(ContextSpecificTag(TAG_LANDMARK_TAG))
+ null
+ }
+ val positionTag =
+ if (!tlvReader.isNull()) {
+ tlvReader.getUByte(ContextSpecificTag(TAG_POSITION_TAG))
+ } else {
+ tlvReader.getNull(ContextSpecificTag(TAG_POSITION_TAG))
+ null
+ }
+ val surfaceTag =
+ if (!tlvReader.isNull()) {
+ tlvReader.getUByte(ContextSpecificTag(TAG_SURFACE_TAG))
+ } else {
+ tlvReader.getNull(ContextSpecificTag(TAG_SURFACE_TAG))
+ null
+ }
+
+ tlvReader.exitContainer()
+
+ return ServiceAreaClusterLocationInfoStruct(
+ locationInfo,
+ landmarkTag,
+ positionTag,
+ surfaceTag
+ )
+ }
+ }
+}
diff --git a/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLocationStruct.kt b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLocationStruct.kt
new file mode 100644
index 00000000000000..0a5b5aa3a825b4
--- /dev/null
+++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterLocationStruct.kt
@@ -0,0 +1,78 @@
+/*
+ *
+ * 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.
+ */
+package matter.controller.cluster.structs
+
+import matter.controller.cluster.*
+import matter.tlv.ContextSpecificTag
+import matter.tlv.Tag
+import matter.tlv.TlvReader
+import matter.tlv.TlvWriter
+
+class ServiceAreaClusterLocationStruct(
+ val locationID: UInt,
+ val mapID: UByte?,
+ val locationInfo: ServiceAreaClusterLocationInfoStruct
+) {
+ override fun toString(): String = buildString {
+ append("ServiceAreaClusterLocationStruct {\n")
+ append("\tlocationID : $locationID\n")
+ append("\tmapID : $mapID\n")
+ append("\tlocationInfo : $locationInfo\n")
+ append("}\n")
+ }
+
+ fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
+ tlvWriter.apply {
+ startStructure(tlvTag)
+ put(ContextSpecificTag(TAG_LOCATION_I_D), locationID)
+ if (mapID != null) {
+ put(ContextSpecificTag(TAG_MAP_I_D), mapID)
+ } else {
+ putNull(ContextSpecificTag(TAG_MAP_I_D))
+ }
+ locationInfo.toTlv(ContextSpecificTag(TAG_LOCATION_INFO), this)
+ endStructure()
+ }
+ }
+
+ companion object {
+ private const val TAG_LOCATION_I_D = 0
+ private const val TAG_MAP_I_D = 1
+ private const val TAG_LOCATION_INFO = 2
+
+ fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterLocationStruct {
+ tlvReader.enterStructure(tlvTag)
+ val locationID = tlvReader.getUInt(ContextSpecificTag(TAG_LOCATION_I_D))
+ val mapID =
+ if (!tlvReader.isNull()) {
+ tlvReader.getUByte(ContextSpecificTag(TAG_MAP_I_D))
+ } else {
+ tlvReader.getNull(ContextSpecificTag(TAG_MAP_I_D))
+ null
+ }
+ val locationInfo =
+ ServiceAreaClusterLocationInfoStruct.fromTlv(
+ ContextSpecificTag(TAG_LOCATION_INFO),
+ tlvReader
+ )
+
+ tlvReader.exitContainer()
+
+ return ServiceAreaClusterLocationStruct(locationID, mapID, locationInfo)
+ }
+ }
+}
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
new file mode 100644
index 00000000000000..3109c9bcb82b76
--- /dev/null
+++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterMapStruct.kt
@@ -0,0 +1,56 @@
+/*
+ *
+ * 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.
+ */
+package matter.controller.cluster.structs
+
+import matter.controller.cluster.*
+import matter.tlv.ContextSpecificTag
+import matter.tlv.Tag
+import matter.tlv.TlvReader
+import matter.tlv.TlvWriter
+
+class ServiceAreaClusterMapStruct(val mapID: UByte, val name: String) {
+ override fun toString(): String = buildString {
+ append("ServiceAreaClusterMapStruct {\n")
+ append("\tmapID : $mapID\n")
+ append("\tname : $name\n")
+ append("}\n")
+ }
+
+ fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
+ tlvWriter.apply {
+ startStructure(tlvTag)
+ put(ContextSpecificTag(TAG_MAP_I_D), mapID)
+ put(ContextSpecificTag(TAG_NAME), name)
+ endStructure()
+ }
+ }
+
+ companion object {
+ private const val TAG_MAP_I_D = 0
+ private const val TAG_NAME = 1
+
+ fun fromTlv(tlvTag: Tag, tlvReader: TlvReader): ServiceAreaClusterMapStruct {
+ tlvReader.enterStructure(tlvTag)
+ val mapID = tlvReader.getUByte(ContextSpecificTag(TAG_MAP_I_D))
+ val name = tlvReader.getString(ContextSpecificTag(TAG_NAME))
+
+ tlvReader.exitContainer()
+
+ return ServiceAreaClusterMapStruct(mapID, name)
+ }
+ }
+}
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
new file mode 100644
index 00000000000000..a5dac6e470d299
--- /dev/null
+++ b/src/controller/java/generated/java/matter/controller/cluster/structs/ServiceAreaClusterProgressStruct.kt
@@ -0,0 +1,109 @@
+/*
+ *
+ * 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.
+ */
+package matter.controller.cluster.structs
+
+import java.util.Optional
+import matter.controller.cluster.*
+import matter.tlv.ContextSpecificTag
+import matter.tlv.Tag
+import matter.tlv.TlvReader
+import matter.tlv.TlvWriter
+
+class ServiceAreaClusterProgressStruct(
+ val locationID: UInt,
+ val status: UByte,
+ val totalOperationalTime: Optional?,
+ val estimatedTime: Optional?
+) {
+ override fun toString(): String = buildString {
+ append("ServiceAreaClusterProgressStruct {\n")
+ append("\tlocationID : $locationID\n")
+ append("\tstatus : $status\n")
+ append("\ttotalOperationalTime : $totalOperationalTime\n")
+ append("\testimatedTime : $estimatedTime\n")
+ append("}\n")
+ }
+
+ fun toTlv(tlvTag: Tag, tlvWriter: TlvWriter) {
+ tlvWriter.apply {
+ startStructure(tlvTag)
+ put(ContextSpecificTag(TAG_LOCATION_I_D), locationID)
+ put(ContextSpecificTag(TAG_STATUS), status)
+ if (totalOperationalTime != null) {
+ if (totalOperationalTime.isPresent) {
+ val opttotalOperationalTime = totalOperationalTime.get()
+ put(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME), opttotalOperationalTime)
+ }
+ } else {
+ putNull(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME))
+ }
+ if (estimatedTime != null) {
+ if (estimatedTime.isPresent) {
+ val optestimatedTime = estimatedTime.get()
+ put(ContextSpecificTag(TAG_ESTIMATED_TIME), optestimatedTime)
+ }
+ } else {
+ putNull(ContextSpecificTag(TAG_ESTIMATED_TIME))
+ }
+ endStructure()
+ }
+ }
+
+ companion object {
+ private const val TAG_LOCATION_I_D = 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 locationID = tlvReader.getUInt(ContextSpecificTag(TAG_LOCATION_I_D))
+ val status = tlvReader.getUByte(ContextSpecificTag(TAG_STATUS))
+ val totalOperationalTime =
+ if (!tlvReader.isNull()) {
+ if (tlvReader.isNextTag(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME))) {
+ Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME)))
+ } else {
+ Optional.empty()
+ }
+ } else {
+ tlvReader.getNull(ContextSpecificTag(TAG_TOTAL_OPERATIONAL_TIME))
+ null
+ }
+ val estimatedTime =
+ if (!tlvReader.isNull()) {
+ if (tlvReader.isNextTag(ContextSpecificTag(TAG_ESTIMATED_TIME))) {
+ Optional.of(tlvReader.getUInt(ContextSpecificTag(TAG_ESTIMATED_TIME)))
+ } else {
+ Optional.empty()
+ }
+ } else {
+ tlvReader.getNull(ContextSpecificTag(TAG_ESTIMATED_TIME))
+ null
+ }
+
+ tlvReader.exitContainer()
+
+ return ServiceAreaClusterProgressStruct(
+ locationID,
+ status,
+ totalOperationalTime,
+ estimatedTime
+ )
+ }
+ }
+}
diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp
index 6f9ee58cafcadb..7cdabec93f43ca 100644
--- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp
+++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp
@@ -27716,6 +27716,607 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR
}
break;
}
+ case app::Clusters::ServiceArea::Id: {
+ using namespace app::Clusters::ServiceArea;
+ switch (aPath.mAttributeId)
+ {
+ case Attributes::SupportedLocations::Id: {
+ using TypeInfo = Attributes::SupportedLocations::TypeInfo;
+ TypeInfo::DecodableType cppValue;
+ *aError = app::DataModel::Decode(aReader, cppValue);
+ if (*aError != CHIP_NO_ERROR)
+ {
+ return nullptr;
+ }
+ jobject value;
+ chip::JniReferences::GetInstance().CreateArrayList(value);
+
+ auto iter_value_0 = cppValue.begin();
+ while (iter_value_0.Next())
+ {
+ auto & entry_0 = iter_value_0.GetValue();
+ jobject newElement_0;
+ jobject newElement_0_locationID;
+ std::string newElement_0_locationIDClassName = "java/lang/Long";
+ std::string newElement_0_locationIDCtorSignature = "(J)V";
+ jlong jninewElement_0_locationID = static_cast(entry_0.locationID);
+ chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_locationIDClassName.c_str(),
+ newElement_0_locationIDCtorSignature.c_str(),
+ jninewElement_0_locationID, newElement_0_locationID);
+ jobject newElement_0_mapID;
+ if (entry_0.mapID.IsNull())
+ {
+ newElement_0_mapID = nullptr;
+ }
+ else
+ {
+ std::string newElement_0_mapIDClassName = "java/lang/Integer";
+ std::string newElement_0_mapIDCtorSignature = "(I)V";
+ jint jninewElement_0_mapID = static_cast(entry_0.mapID.Value());
+ chip::JniReferences::GetInstance().CreateBoxedObject(newElement_0_mapIDClassName.c_str(),
+ newElement_0_mapIDCtorSignature.c_str(),
+ jninewElement_0_mapID, newElement_0_mapID);
+ }
+ jobject newElement_0_locationInfo;
+ jobject newElement_0_locationInfo_locationInfo;
+ if (entry_0.locationInfo.locationInfo.IsNull())
+ {
+ newElement_0_locationInfo_locationInfo = nullptr;
+ }
+ else
+ {
+ jobject newElement_0_locationInfo_locationInfo_locationName;
+ LogErrorOnFailure(
+ chip::JniReferences::GetInstance().CharToStringUTF(entry_0.locationInfo.locationInfo.Value().locationName,
+ newElement_0_locationInfo_locationInfo_locationName));
+ jobject newElement_0_locationInfo_locationInfo_floorNumber;
+ if (entry_0.locationInfo.locationInfo.Value().floorNumber.IsNull())
+ {
+ newElement_0_locationInfo_locationInfo_floorNumber = nullptr;
+ }
+ else
+ {
+ std::string newElement_0_locationInfo_locationInfo_floorNumberClassName = "java/lang/Integer";
+ std::string newElement_0_locationInfo_locationInfo_floorNumberCtorSignature = "(I)V";
+ jint jninewElement_0_locationInfo_locationInfo_floorNumber =
+ static_cast(entry_0.locationInfo.locationInfo.Value().floorNumber.Value());
+ chip::JniReferences::GetInstance().CreateBoxedObject(
+ newElement_0_locationInfo_locationInfo_floorNumberClassName.c_str(),
+ newElement_0_locationInfo_locationInfo_floorNumberCtorSignature.c_str(),
+ jninewElement_0_locationInfo_locationInfo_floorNumber,
+ newElement_0_locationInfo_locationInfo_floorNumber);
+ }
+ jobject newElement_0_locationInfo_locationInfo_areaType;
+ if (entry_0.locationInfo.locationInfo.Value().areaType.IsNull())
+ {
+ newElement_0_locationInfo_locationInfo_areaType = nullptr;
+ }
+ else
+ {
+ std::string newElement_0_locationInfo_locationInfo_areaTypeClassName = "java/lang/Integer";
+ std::string newElement_0_locationInfo_locationInfo_areaTypeCtorSignature = "(I)V";
+ jint jninewElement_0_locationInfo_locationInfo_areaType =
+ static_cast(entry_0.locationInfo.locationInfo.Value().areaType.Value());
+ chip::JniReferences::GetInstance().CreateBoxedObject(
+ newElement_0_locationInfo_locationInfo_areaTypeClassName.c_str(),
+ newElement_0_locationInfo_locationInfo_areaTypeCtorSignature.c_str(),
+ jninewElement_0_locationInfo_locationInfo_areaType, newElement_0_locationInfo_locationInfo_areaType);
+ }
+
+ jclass homeLocationStructStructClass_4;
+ err = chip::JniReferences::GetInstance().GetLocalClassRef(
+ env, "chip/devicecontroller/ChipStructs$ServiceAreaClusterHomeLocationStruct",
+ homeLocationStructStructClass_4);
+ if (err != CHIP_NO_ERROR)
+ {
+ ChipLogError(Zcl, "Could not find class ChipStructs$ServiceAreaClusterHomeLocationStruct");
+ return nullptr;
+ }
+
+ jmethodID homeLocationStructStructCtor_4;
+ err = chip::JniReferences::GetInstance().FindMethod(
+ env, homeLocationStructStructClass_4, "",
+ "(Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;)V", &homeLocationStructStructCtor_4);
+ if (err != CHIP_NO_ERROR || homeLocationStructStructCtor_4 == nullptr)
+ {
+ ChipLogError(Zcl, "Could not find ChipStructs$ServiceAreaClusterHomeLocationStruct constructor");
+ return nullptr;
+ }
+
+ newElement_0_locationInfo_locationInfo = env->NewObject(
+ homeLocationStructStructClass_4, homeLocationStructStructCtor_4,
+ newElement_0_locationInfo_locationInfo_locationName, newElement_0_locationInfo_locationInfo_floorNumber,
+ newElement_0_locationInfo_locationInfo_areaType);
+ }
+ jobject newElement_0_locationInfo_landmarkTag;
+ if (entry_0.locationInfo.landmarkTag.IsNull())
+ {
+ newElement_0_locationInfo_landmarkTag = nullptr;
+ }
+ else
+ {
+ std::string newElement_0_locationInfo_landmarkTagClassName = "java/lang/Integer";
+ std::string newElement_0_locationInfo_landmarkTagCtorSignature = "(I)V";
+ jint jninewElement_0_locationInfo_landmarkTag = static_cast(entry_0.locationInfo.landmarkTag.Value());
+ chip::JniReferences::GetInstance().CreateBoxedObject(
+ newElement_0_locationInfo_landmarkTagClassName.c_str(),
+ newElement_0_locationInfo_landmarkTagCtorSignature.c_str(), jninewElement_0_locationInfo_landmarkTag,
+ newElement_0_locationInfo_landmarkTag);
+ }
+ jobject newElement_0_locationInfo_positionTag;
+ if (entry_0.locationInfo.positionTag.IsNull())
+ {
+ newElement_0_locationInfo_positionTag = nullptr;
+ }
+ else
+ {
+ std::string newElement_0_locationInfo_positionTagClassName = "java/lang/Integer";
+ std::string newElement_0_locationInfo_positionTagCtorSignature = "(I)V";
+ jint jninewElement_0_locationInfo_positionTag = static_cast(entry_0.locationInfo.positionTag.Value());
+ chip::JniReferences::GetInstance().CreateBoxedObject(
+ newElement_0_locationInfo_positionTagClassName.c_str(),
+ newElement_0_locationInfo_positionTagCtorSignature.c_str(), jninewElement_0_locationInfo_positionTag,
+ newElement_0_locationInfo_positionTag);
+ }
+ jobject newElement_0_locationInfo_surfaceTag;
+ if (entry_0.locationInfo.surfaceTag.IsNull())
+ {
+ newElement_0_locationInfo_surfaceTag = nullptr;
+ }
+ else
+ {
+ std::string newElement_0_locationInfo_surfaceTagClassName = "java/lang/Integer";
+ std::string newElement_0_locationInfo_surfaceTagCtorSignature = "(I)V";
+ jint jninewElement_0_locationInfo_surfaceTag = static_cast(entry_0.locationInfo.surfaceTag.Value());
+ chip::JniReferences::GetInstance().CreateBoxedObject(
+ newElement_0_locationInfo_surfaceTagClassName.c_str(),
+ newElement_0_locationInfo_surfaceTagCtorSignature.c_str(), jninewElement_0_locationInfo_surfaceTag,
+ newElement_0_locationInfo_surfaceTag);
+ }
+
+ jclass locationInfoStructStructClass_2;
+ err = chip::JniReferences::GetInstance().GetLocalClassRef(
+ env, "chip/devicecontroller/ChipStructs$ServiceAreaClusterLocationInfoStruct", locationInfoStructStructClass_2);
+ if (err != CHIP_NO_ERROR)
+ {
+ ChipLogError(Zcl, "Could not find class ChipStructs$ServiceAreaClusterLocationInfoStruct");
+ return nullptr;
+ }
+
+ jmethodID locationInfoStructStructCtor_2;
+ err = chip::JniReferences::GetInstance().FindMethod(
+ env, locationInfoStructStructClass_2, "",
+ "(Lchip/devicecontroller/ChipStructs$ServiceAreaClusterHomeLocationStruct;Ljava/lang/Integer;Ljava/lang/"
+ "Integer;Ljava/lang/Integer;)V",
+ &locationInfoStructStructCtor_2);
+ if (err != CHIP_NO_ERROR || locationInfoStructStructCtor_2 == nullptr)
+ {
+ ChipLogError(Zcl, "Could not find ChipStructs$ServiceAreaClusterLocationInfoStruct constructor");
+ return nullptr;
+ }
+
+ newElement_0_locationInfo =
+ env->NewObject(locationInfoStructStructClass_2, locationInfoStructStructCtor_2,
+ newElement_0_locationInfo_locationInfo, newElement_0_locationInfo_landmarkTag,
+ newElement_0_locationInfo_positionTag, newElement_0_locationInfo_surfaceTag);
+
+ jclass locationStructStructClass_1;
+ err = chip::JniReferences::GetInstance().GetLocalClassRef(
+ env, "chip/devicecontroller/ChipStructs$ServiceAreaClusterLocationStruct", locationStructStructClass_1);
+ if (err != CHIP_NO_ERROR)
+ {
+ ChipLogError(Zcl, "Could not find class ChipStructs$ServiceAreaClusterLocationStruct");
+ return nullptr;
+ }
+
+ jmethodID locationStructStructCtor_1;
+ err = chip::JniReferences::GetInstance().FindMethod(env, locationStructStructClass_1, "",
+ "(Ljava/lang/Long;Ljava/lang/Integer;Lchip/devicecontroller/"
+ "ChipStructs$ServiceAreaClusterLocationInfoStruct;)V",
+ &locationStructStructCtor_1);
+ if (err != CHIP_NO_ERROR || locationStructStructCtor_1 == nullptr)
+ {
+ ChipLogError(Zcl, "Could not find ChipStructs$ServiceAreaClusterLocationStruct constructor");
+ return nullptr;
+ }
+
+ newElement_0 = env->NewObject(locationStructStructClass_1, locationStructStructCtor_1, newElement_0_locationID,
+ newElement_0_mapID, newElement_0_locationInfo);
+ chip::JniReferences::GetInstance().AddToList(value, newElement_0);
+ }
+ return value;
+ }
+ case Attributes::SupportedMaps::Id: {
+ using TypeInfo = Attributes::SupportedMaps::TypeInfo;
+ TypeInfo::DecodableType cppValue;
+ *aError = app::DataModel::Decode(aReader, cppValue);
+ if (*aError != CHIP_NO_ERROR)
+ {
+ return nullptr;
+ }
+ jobject value;
+ if (cppValue.IsNull())
+ {
+ value = nullptr;
+ }
+ else
+ {
+ chip::JniReferences::GetInstance().CreateArrayList(value);
+
+ auto iter_value_1 = cppValue.Value().begin();
+ while (iter_value_1.Next())
+ {
+ auto & entry_1 = iter_value_1.GetValue();
+ jobject newElement_1;
+ jobject newElement_1_mapID;
+ std::string newElement_1_mapIDClassName = "java/lang/Integer";
+ std::string newElement_1_mapIDCtorSignature = "(I)V";
+ jint jninewElement_1_mapID = static_cast(entry_1.mapID);
+ chip::JniReferences::GetInstance().CreateBoxedObject(newElement_1_mapIDClassName.c_str(),
+ newElement_1_mapIDCtorSignature.c_str(),
+ jninewElement_1_mapID, newElement_1_mapID);
+ jobject newElement_1_name;
+ LogErrorOnFailure(chip::JniReferences::GetInstance().CharToStringUTF(entry_1.name, newElement_1_name));
+
+ jclass mapStructStructClass_2;
+ err = chip::JniReferences::GetInstance().GetLocalClassRef(
+ env, "chip/devicecontroller/ChipStructs$ServiceAreaClusterMapStruct", mapStructStructClass_2);
+ if (err != CHIP_NO_ERROR)
+ {
+ ChipLogError(Zcl, "Could not find class ChipStructs$ServiceAreaClusterMapStruct");
+ return nullptr;
+ }
+
+ jmethodID mapStructStructCtor_2;
+ err = chip::JniReferences::GetInstance().FindMethod(
+ env, mapStructStructClass_2, "", "(Ljava/lang/Integer;Ljava/lang/String;)V", &mapStructStructCtor_2);
+ if (err != CHIP_NO_ERROR || mapStructStructCtor_2 == nullptr)
+ {
+ ChipLogError(Zcl, "Could not find ChipStructs$ServiceAreaClusterMapStruct constructor");
+ return nullptr;
+ }
+
+ newElement_1 =
+ env->NewObject(mapStructStructClass_2, mapStructStructCtor_2, newElement_1_mapID, newElement_1_name);
+ chip::JniReferences::GetInstance().AddToList(value, newElement_1);
+ }
+ }
+ return value;
+ }
+ case Attributes::SelectedLocations::Id: {
+ using TypeInfo = Attributes::SelectedLocations::TypeInfo;
+ TypeInfo::DecodableType cppValue;
+ *aError = app::DataModel::Decode(aReader, cppValue);
+ if (*aError != CHIP_NO_ERROR)
+ {
+ return nullptr;
+ }
+ jobject value;
+ if (cppValue.IsNull())
+ {
+ value = nullptr;
+ }
+ else
+ {
+ chip::JniReferences::GetInstance().CreateArrayList(value);
+
+ auto iter_value_1 = cppValue.Value().begin();
+ while (iter_value_1.Next())
+ {
+ auto & entry_1 = iter_value_1.GetValue();
+ jobject newElement_1;
+ std::string newElement_1ClassName = "java/lang/Long";
+ std::string newElement_1CtorSignature = "(J)V";
+ jlong jninewElement_1 = static_cast(entry_1);
+ chip::JniReferences::GetInstance().CreateBoxedObject(
+ newElement_1ClassName.c_str(), newElement_1CtorSignature.c_str(), jninewElement_1, newElement_1);
+ chip::JniReferences::GetInstance().AddToList(value, newElement_1);
+ }
+ }
+ return value;
+ }
+ case Attributes::CurrentLocation::Id: {
+ using TypeInfo = Attributes::CurrentLocation::TypeInfo;
+ TypeInfo::DecodableType cppValue;
+ *aError = app::DataModel::Decode(aReader, cppValue);
+ if (*aError != CHIP_NO_ERROR)
+ {
+ return nullptr;
+ }
+ jobject value;
+ if (cppValue.IsNull())
+ {
+ value = nullptr;
+ }
+ else
+ {
+ std::string valueClassName = "java/lang/Long";
+ std::string valueCtorSignature = "(J)V";
+ jlong jnivalue = static_cast(cppValue.Value());
+ chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(),
+ jnivalue, value);
+ }
+ return value;
+ }
+ case Attributes::EstimatedEndTime::Id: {
+ using TypeInfo = Attributes::EstimatedEndTime::TypeInfo;
+ TypeInfo::DecodableType cppValue;
+ *aError = app::DataModel::Decode(aReader, cppValue);
+ if (*aError != CHIP_NO_ERROR)
+ {
+ return nullptr;
+ }
+ jobject value;
+ if (cppValue.IsNull())
+ {
+ value = nullptr;
+ }
+ else
+ {
+ std::string valueClassName = "java/lang/Long";
+ std::string valueCtorSignature = "(J)V";
+ jlong jnivalue = static_cast(cppValue.Value());
+ chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(),
+ jnivalue, value);
+ }
+ return value;
+ }
+ case Attributes::Progress::Id: {
+ using TypeInfo = Attributes::Progress::TypeInfo;
+ TypeInfo::DecodableType cppValue;
+ *aError = app::DataModel::Decode(aReader, cppValue);
+ if (*aError != CHIP_NO_ERROR)
+ {
+ return nullptr;
+ }
+ jobject value;
+ if (cppValue.IsNull())
+ {
+ value = nullptr;
+ }
+ else
+ {
+ chip::JniReferences::GetInstance().CreateArrayList(value);
+
+ auto iter_value_1 = cppValue.Value().begin();
+ while (iter_value_1.Next())
+ {
+ auto & entry_1 = iter_value_1.GetValue();
+ jobject newElement_1;
+ jobject newElement_1_locationID;
+ std::string newElement_1_locationIDClassName = "java/lang/Long";
+ std::string newElement_1_locationIDCtorSignature = "(J)V";
+ jlong jninewElement_1_locationID = static_cast(entry_1.locationID);
+ chip::JniReferences::GetInstance().CreateBoxedObject(
+ newElement_1_locationIDClassName.c_str(), newElement_1_locationIDCtorSignature.c_str(),
+ jninewElement_1_locationID, newElement_1_locationID);
+ jobject newElement_1_status;
+ std::string newElement_1_statusClassName = "java/lang/Integer";
+ std::string newElement_1_statusCtorSignature = "(I)V";
+ jint jninewElement_1_status = static_cast(entry_1.status);
+ chip::JniReferences::GetInstance().CreateBoxedObject(newElement_1_statusClassName.c_str(),
+ newElement_1_statusCtorSignature.c_str(),
+ jninewElement_1_status, newElement_1_status);
+ jobject newElement_1_totalOperationalTime;
+ if (!entry_1.totalOperationalTime.HasValue())
+ {
+ chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_1_totalOperationalTime);
+ }
+ else
+ {
+ jobject newElement_1_totalOperationalTimeInsideOptional;
+ if (entry_1.totalOperationalTime.Value().IsNull())
+ {
+ newElement_1_totalOperationalTimeInsideOptional = nullptr;
+ }
+ else
+ {
+ std::string newElement_1_totalOperationalTimeInsideOptionalClassName = "java/lang/Long";
+ std::string newElement_1_totalOperationalTimeInsideOptionalCtorSignature = "(J)V";
+ jlong jninewElement_1_totalOperationalTimeInsideOptional =
+ static_cast(entry_1.totalOperationalTime.Value().Value());
+ chip::JniReferences::GetInstance().CreateBoxedObject(
+ newElement_1_totalOperationalTimeInsideOptionalClassName.c_str(),
+ newElement_1_totalOperationalTimeInsideOptionalCtorSignature.c_str(),
+ jninewElement_1_totalOperationalTimeInsideOptional,
+ newElement_1_totalOperationalTimeInsideOptional);
+ }
+ chip::JniReferences::GetInstance().CreateOptional(newElement_1_totalOperationalTimeInsideOptional,
+ newElement_1_totalOperationalTime);
+ }
+ jobject newElement_1_estimatedTime;
+ if (!entry_1.estimatedTime.HasValue())
+ {
+ chip::JniReferences::GetInstance().CreateOptional(nullptr, newElement_1_estimatedTime);
+ }
+ else
+ {
+ jobject newElement_1_estimatedTimeInsideOptional;
+ if (entry_1.estimatedTime.Value().IsNull())
+ {
+ newElement_1_estimatedTimeInsideOptional = nullptr;
+ }
+ else
+ {
+ std::string newElement_1_estimatedTimeInsideOptionalClassName = "java/lang/Long";
+ std::string newElement_1_estimatedTimeInsideOptionalCtorSignature = "(J)V";
+ jlong jninewElement_1_estimatedTimeInsideOptional =
+ static_cast(entry_1.estimatedTime.Value().Value());
+ chip::JniReferences::GetInstance().CreateBoxedObject(
+ newElement_1_estimatedTimeInsideOptionalClassName.c_str(),
+ newElement_1_estimatedTimeInsideOptionalCtorSignature.c_str(),
+ jninewElement_1_estimatedTimeInsideOptional, newElement_1_estimatedTimeInsideOptional);
+ }
+ chip::JniReferences::GetInstance().CreateOptional(newElement_1_estimatedTimeInsideOptional,
+ newElement_1_estimatedTime);
+ }
+
+ jclass progressStructStructClass_2;
+ err = chip::JniReferences::GetInstance().GetLocalClassRef(
+ env, "chip/devicecontroller/ChipStructs$ServiceAreaClusterProgressStruct", progressStructStructClass_2);
+ if (err != CHIP_NO_ERROR)
+ {
+ ChipLogError(Zcl, "Could not find class ChipStructs$ServiceAreaClusterProgressStruct");
+ return nullptr;
+ }
+
+ jmethodID progressStructStructCtor_2;
+ err = chip::JniReferences::GetInstance().FindMethod(
+ env, progressStructStructClass_2, "",
+ "(Ljava/lang/Long;Ljava/lang/Integer;Ljava/util/Optional;Ljava/util/Optional;)V",
+ &progressStructStructCtor_2);
+ if (err != CHIP_NO_ERROR || progressStructStructCtor_2 == nullptr)
+ {
+ ChipLogError(Zcl, "Could not find ChipStructs$ServiceAreaClusterProgressStruct constructor");
+ return nullptr;
+ }
+
+ newElement_1 =
+ env->NewObject(progressStructStructClass_2, progressStructStructCtor_2, newElement_1_locationID,
+ newElement_1_status, newElement_1_totalOperationalTime, newElement_1_estimatedTime);
+ chip::JniReferences::GetInstance().AddToList(value, newElement_1);
+ }
+ }
+ return value;
+ }
+ case Attributes::GeneratedCommandList::Id: {
+ using TypeInfo = Attributes::GeneratedCommandList::TypeInfo;
+ TypeInfo::DecodableType cppValue;
+ *aError = app::DataModel::Decode(aReader, cppValue);
+ if (*aError != CHIP_NO_ERROR)
+ {
+ return nullptr;
+ }
+ jobject value;
+ chip::JniReferences::GetInstance().CreateArrayList(value);
+
+ auto iter_value_0 = cppValue.begin();
+ while (iter_value_0.Next())
+ {
+ auto & entry_0 = iter_value_0.GetValue();
+ jobject newElement_0;
+ std::string newElement_0ClassName = "java/lang/Long";
+ std::string newElement_0CtorSignature = "(J)V";
+ jlong jninewElement_0 = static_cast(entry_0);
+ chip::JniReferences::GetInstance().CreateBoxedObject(
+ newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0);
+ chip::JniReferences::GetInstance().AddToList(value, newElement_0);
+ }
+ return value;
+ }
+ case Attributes::AcceptedCommandList::Id: {
+ using TypeInfo = Attributes::AcceptedCommandList::TypeInfo;
+ TypeInfo::DecodableType cppValue;
+ *aError = app::DataModel::Decode(aReader, cppValue);
+ if (*aError != CHIP_NO_ERROR)
+ {
+ return nullptr;
+ }
+ jobject value;
+ chip::JniReferences::GetInstance().CreateArrayList(value);
+
+ auto iter_value_0 = cppValue.begin();
+ while (iter_value_0.Next())
+ {
+ auto & entry_0 = iter_value_0.GetValue();
+ jobject newElement_0;
+ std::string newElement_0ClassName = "java/lang/Long";
+ std::string newElement_0CtorSignature = "(J)V";
+ jlong jninewElement_0 = static_cast(entry_0);
+ chip::JniReferences::GetInstance().CreateBoxedObject(
+ newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0);
+ chip::JniReferences::GetInstance().AddToList(value, newElement_0);
+ }
+ return value;
+ }
+ case Attributes::EventList::Id: {
+ using TypeInfo = Attributes::EventList::TypeInfo;
+ TypeInfo::DecodableType cppValue;
+ *aError = app::DataModel::Decode(aReader, cppValue);
+ if (*aError != CHIP_NO_ERROR)
+ {
+ return nullptr;
+ }
+ jobject value;
+ chip::JniReferences::GetInstance().CreateArrayList(value);
+
+ auto iter_value_0 = cppValue.begin();
+ while (iter_value_0.Next())
+ {
+ auto & entry_0 = iter_value_0.GetValue();
+ jobject newElement_0;
+ std::string newElement_0ClassName = "java/lang/Long";
+ std::string newElement_0CtorSignature = "(J)V";
+ jlong jninewElement_0 = static_cast(entry_0);
+ chip::JniReferences::GetInstance().CreateBoxedObject(
+ newElement_0ClassName.c_str(), newElement_0CtorSignature.c_str(), jninewElement_0, newElement_0);
+ chip::JniReferences::GetInstance().AddToList(value, newElement_0);
+ }
+ return value;
+ }
+ case Attributes::AttributeList::Id: {
+ using TypeInfo = Attributes::AttributeList::TypeInfo;
+ TypeInfo::DecodableType cppValue;
+ *aError = app::DataModel::Decode(aReader, cppValue);
+ if (*aError != CHIP_NO_ERROR)
+ {
+ return nullptr;
+ }
+ jobject value;
+ chip::JniReferences::GetInstance().CreateArrayList(value);
+
+ auto iter_value_0 = cppValue.begin();
+ while (iter_value_0.Next())
+ {
+ auto & entry_0 = iter_value_0.GetValue();
+ jobject newElement_0;
+ std::string newElement_0ClassName = "java/lang/Long";
+ std::string newElement_0CtorSignature = "(J)V";
+ jlong jninewElement_0 = static_cast