Skip to content

Commit

Permalink
Update camera zone cluster to latest spec docs (#36411)
Browse files Browse the repository at this point in the history
* Generated using ./alchemy zap --attribute="in-progress" ... ZoneManagement.adoc

* Generated using ./scripts/tools/zap_regen_all.py

* Remove renamed file

* Restyled by whitespace

* Restyled by prettier-json

* Remove renamed file

* Remove choice for single element

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
gmarcosb and restyled-commits authored Nov 13, 2024
1 parent b20d8ae commit 59d7388
Show file tree
Hide file tree
Showing 36 changed files with 349 additions and 241 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ limitations under the License.
XML generated by Alchemy; DO NOT EDIT.
Source: src/app_clusters/ZoneManagement.adoc
Parameters: in-progress
Git: 0.9-fall2024-302-gebc8548b3
Git: 1.4-282-gad46b0990
-->
<configurator xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../zcl.xsd">
<domain name="Measurement &amp; Sensing"/>
Expand Down Expand Up @@ -78,12 +78,13 @@ Git: 0.9-fall2024-302-gebc8548b3
<item fieldId="2" name="ZoneSource" type="ZoneSourceEnum" min="0x00" max="0x01"/>
</struct>

<struct name="ZoneTriggeringTimeControlStruct" apiMaturity="provisional">
<struct name="ZoneTriggerControlStruct" apiMaturity="provisional">
<cluster code="0x0550"/>
<item fieldId="0" name="InitialDuration" type="int16u" default="10"/>
<item fieldId="1" name="AugmentationDuration" type="int16u" default="5"/>
<item fieldId="2" name="MaxDuration" type="elapsed_s" default="30"/>
<item fieldId="3" name="BlindDuration" type="int16u" default="30"/>
<item fieldId="4" name="Sensitivity" type="int8u" optional="true" default="5" min="1" max="10"/>
</struct>

<cluster apiMaturity="provisional">
Expand All @@ -94,16 +95,19 @@ Git: 0.9-fall2024-302-gebc8548b3
<description>This cluster provides an interface to manage regions of interest, or Zones, which can be either manufacturer or user defined.</description>
<client init="false" tick="false">true</client>
<features>
<feature bit="0" code="TWODCART" name="TwoDimensionalCartesianZone" summary="Devices support Two Dimensional Cartesian Zones">
<mandatoryConform/>
<feature bit="0" code="TWODCART" name="TwoDimensionalCartesianZone" summary="Support Two Dimensional Cartesian Zones">
<optionalConform/>
</feature>
<feature bit="1" code="PERZONESENS" name="PerZoneSensitivity" summary="Supports a sensitivity value per Zone">
<optionalConform/>
</feature>
</features>
<server init="false" tick="false">true</server>
<globalAttribute code="0xFFFD" side="either" value="1"/>
<attribute code="0x0000" side="server" define="SUPPORTED_ZONE_SOURCES" type="array" entryType="ZoneSourceEnum">SupportedZoneSources</attribute>
<attribute code="0x0001" side="server" define="ZONES" type="array" entryType="ZoneInformationStruct" optional="true">Zones</attribute>
<attribute code="0x0002" side="server" define="TIME_CONTROL" type="array" entryType="ZoneTriggeringTimeControlStruct" writable="true">TimeControl</attribute>
<attribute code="0x0003" side="server" define="SENSITIVITY" type="int8u" min="1" max="10" default="5" writable="true">Sensitivity</attribute>
<attribute code="0x0002" side="server" define="TIME_CONTROL" type="array" entryType="ZoneTriggerControlStruct" writable="true">Triggers</attribute>
<attribute code="0x0003" side="server" define="SENSITIVITY" type="int8u" min="1" max="10" default="5" writable="true" optional="true">Sensitivity</attribute>
<command code="0x00" source="client" name="CreateTwoDCartesianZone" optional="true" response="CreateTwoDCartesianZoneResponse">
<description>This command SHALL create and store a TwoD Cartesian Zone.</description>
<access op="invoke" privilege="manage"/>
Expand Down Expand Up @@ -148,7 +152,7 @@ Git: 0.9-fall2024-302-gebc8548b3
<event code="0x0001" name="ZoneStopped" priority="info" side="server">
<field id="0" name="Zones" array="true" type="int16u"/>
<field id="1" name="Reason" type="ZoneEventStoppedReasonEnum" min="0x00" max="0x01"/>
<description>This event SHALL be generated when either when the TriggerDetectedDuration value is exceeded by the TimeSinceInitialTrigger value or when the MaxDuration value is exceeded by the TimeSinceInitialTrigger value as described in ZoneTriggeringTimeControlStruct.</description>
<description>This event SHALL be generated when either when the TriggerDetectedDuration value is exceeded by the TimeSinceInitialTrigger value or when the MaxDuration value is exceeded by the TimeSinceInitialTrigger value as described in ZoneTriggerControlStruct.</description>
</event>

</cluster>
Expand Down
8 changes: 5 additions & 3 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -9443,6 +9443,7 @@ provisional cluster ZoneManagement = 1360 {

bitmap Feature : bitmap32 {
kTwoDimensionalCartesianZone = 0x1;
kPerZoneSensitivity = 0x2;
}

struct TwoDCartesianVertexStruct {
Expand All @@ -9463,11 +9464,12 @@ provisional cluster ZoneManagement = 1360 {
ZoneSourceEnum zoneSource = 2;
}

struct ZoneTriggeringTimeControlStruct {
struct ZoneTriggerControlStruct {
int16u initialDuration = 0;
int16u augmentationDuration = 1;
elapsed_s maxDuration = 2;
int16u blindDuration = 3;
optional int8u sensitivity = 4;
}

info event ZoneTriggered = 0 {
Expand All @@ -9482,8 +9484,8 @@ provisional cluster ZoneManagement = 1360 {

readonly attribute ZoneSourceEnum supportedZoneSources[] = 0;
readonly attribute optional ZoneInformationStruct zones[] = 1;
attribute ZoneTriggeringTimeControlStruct timeControl[] = 2;
attribute int8u sensitivity = 3;
attribute ZoneTriggerControlStruct triggers[] = 2;
attribute optional int8u sensitivity = 3;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59283,7 +59283,7 @@ public static class ZoneManagementCluster extends BaseChipCluster {

private static final long SUPPORTED_ZONE_SOURCES_ATTRIBUTE_ID = 0L;
private static final long ZONES_ATTRIBUTE_ID = 1L;
private static final long TIME_CONTROL_ATTRIBUTE_ID = 2L;
private static final long TRIGGERS_ATTRIBUTE_ID = 2L;
private static final long SENSITIVITY_ATTRIBUTE_ID = 3L;
private static final long GENERATED_COMMAND_LIST_ATTRIBUTE_ID = 65528L;
private static final long ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID = 65529L;
Expand Down Expand Up @@ -59422,8 +59422,8 @@ public interface ZonesAttributeCallback extends BaseAttributeCallback {
void onSuccess(List<ChipStructs.ZoneManagementClusterZoneInformationStruct> value);
}

public interface TimeControlAttributeCallback extends BaseAttributeCallback {
void onSuccess(List<ChipStructs.ZoneManagementClusterZoneTriggeringTimeControlStruct> value);
public interface TriggersAttributeCallback extends BaseAttributeCallback {
void onSuccess(List<ChipStructs.ZoneManagementClusterZoneTriggerControlStruct> value);
}

public interface GeneratedCommandListAttributeCallback extends BaseAttributeCallback {
Expand Down Expand Up @@ -59494,39 +59494,39 @@ public void onSuccess(byte[] tlv) {
}, ZONES_ATTRIBUTE_ID, minInterval, maxInterval);
}

public void readTimeControlAttribute(
TimeControlAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TIME_CONTROL_ATTRIBUTE_ID);
public void readTriggersAttribute(
TriggersAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TRIGGERS_ATTRIBUTE_ID);

readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
List<ChipStructs.ZoneManagementClusterZoneTriggeringTimeControlStruct> value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
List<ChipStructs.ZoneManagementClusterZoneTriggerControlStruct> value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
}, TIME_CONTROL_ATTRIBUTE_ID, true);
}, TRIGGERS_ATTRIBUTE_ID, true);
}

public void writeTimeControlAttribute(DefaultClusterCallback callback, ArrayList<ChipStructs.ZoneManagementClusterZoneTriggeringTimeControlStruct> value) {
writeTimeControlAttribute(callback, value, 0);
public void writeTriggersAttribute(DefaultClusterCallback callback, ArrayList<ChipStructs.ZoneManagementClusterZoneTriggerControlStruct> value) {
writeTriggersAttribute(callback, value, 0);
}

public void writeTimeControlAttribute(DefaultClusterCallback callback, ArrayList<ChipStructs.ZoneManagementClusterZoneTriggeringTimeControlStruct> value, int timedWriteTimeoutMs) {
public void writeTriggersAttribute(DefaultClusterCallback callback, ArrayList<ChipStructs.ZoneManagementClusterZoneTriggerControlStruct> value, int timedWriteTimeoutMs) {
BaseTLVType tlvValue = ArrayType.generateArrayType(value, (elementvalue) -> elementvalue.encodeTlv());
writeAttribute(new WriteAttributesCallbackImpl(callback), TIME_CONTROL_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs);
writeAttribute(new WriteAttributesCallbackImpl(callback), TRIGGERS_ATTRIBUTE_ID, tlvValue, timedWriteTimeoutMs);
}

public void subscribeTimeControlAttribute(
TimeControlAttributeCallback callback, int minInterval, int maxInterval) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TIME_CONTROL_ATTRIBUTE_ID);
public void subscribeTriggersAttribute(
TriggersAttributeCallback callback, int minInterval, int maxInterval) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, TRIGGERS_ATTRIBUTE_ID);

subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
List<ChipStructs.ZoneManagementClusterZoneTriggeringTimeControlStruct> value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
List<ChipStructs.ZoneManagementClusterZoneTriggerControlStruct> value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
}, TIME_CONTROL_ATTRIBUTE_ID, minInterval, maxInterval);
}, TRIGGERS_ATTRIBUTE_ID, minInterval, maxInterval);
}

public void readSensitivityAttribute(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12952,26 +12952,30 @@ public String toString() {
return output.toString();
}
}
public static class ZoneManagementClusterZoneTriggeringTimeControlStruct {
public static class ZoneManagementClusterZoneTriggerControlStruct {
public Integer initialDuration;
public Integer augmentationDuration;
public Long maxDuration;
public Integer blindDuration;
public Optional<Integer> sensitivity;
private static final long INITIAL_DURATION_ID = 0L;
private static final long AUGMENTATION_DURATION_ID = 1L;
private static final long MAX_DURATION_ID = 2L;
private static final long BLIND_DURATION_ID = 3L;
private static final long SENSITIVITY_ID = 4L;

public ZoneManagementClusterZoneTriggeringTimeControlStruct(
public ZoneManagementClusterZoneTriggerControlStruct(
Integer initialDuration,
Integer augmentationDuration,
Long maxDuration,
Integer blindDuration
Integer blindDuration,
Optional<Integer> sensitivity
) {
this.initialDuration = initialDuration;
this.augmentationDuration = augmentationDuration;
this.maxDuration = maxDuration;
this.blindDuration = blindDuration;
this.sensitivity = sensitivity;
}

public StructType encodeTlv() {
Expand All @@ -12980,18 +12984,20 @@ public StructType encodeTlv() {
values.add(new StructElement(AUGMENTATION_DURATION_ID, new UIntType(augmentationDuration)));
values.add(new StructElement(MAX_DURATION_ID, new UIntType(maxDuration)));
values.add(new StructElement(BLIND_DURATION_ID, new UIntType(blindDuration)));
values.add(new StructElement(SENSITIVITY_ID, sensitivity.<BaseTLVType>map((nonOptionalsensitivity) -> new UIntType(nonOptionalsensitivity)).orElse(new EmptyType())));

return new StructType(values);
}

public static ZoneManagementClusterZoneTriggeringTimeControlStruct decodeTlv(BaseTLVType tlvValue) {
public static ZoneManagementClusterZoneTriggerControlStruct decodeTlv(BaseTLVType tlvValue) {
if (tlvValue == null || tlvValue.type() != TLVType.Struct) {
return null;
}
Integer initialDuration = null;
Integer augmentationDuration = null;
Long maxDuration = null;
Integer blindDuration = null;
Optional<Integer> sensitivity = Optional.empty();
for (StructElement element: ((StructType)tlvValue).value()) {
if (element.contextTagNum() == INITIAL_DURATION_ID) {
if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
Expand All @@ -13013,20 +13019,26 @@ public static ZoneManagementClusterZoneTriggeringTimeControlStruct decodeTlv(Bas
UIntType castingValue = element.value(UIntType.class);
blindDuration = castingValue.value(Integer.class);
}
} else if (element.contextTagNum() == SENSITIVITY_ID) {
if (element.value(BaseTLVType.class).type() == TLVType.UInt) {
UIntType castingValue = element.value(UIntType.class);
sensitivity = Optional.of(castingValue.value(Integer.class));
}
}
}
return new ZoneManagementClusterZoneTriggeringTimeControlStruct(
return new ZoneManagementClusterZoneTriggerControlStruct(
initialDuration,
augmentationDuration,
maxDuration,
blindDuration
blindDuration,
sensitivity
);
}

@Override
public String toString() {
StringBuilder output = new StringBuilder();
output.append("ZoneManagementClusterZoneTriggeringTimeControlStruct {\n");
output.append("ZoneManagementClusterZoneTriggerControlStruct {\n");
output.append("\tinitialDuration: ");
output.append(initialDuration);
output.append("\n");
Expand All @@ -13039,6 +13051,9 @@ public String toString() {
output.append("\tblindDuration: ");
output.append(blindDuration);
output.append("\n");
output.append("\tsensitivity: ");
output.append(sensitivity);
output.append("\n");
output.append("}\n");
return output.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16897,7 +16897,7 @@ public long getID() {
public enum Attribute {
SupportedZoneSources(0L),
Zones(1L),
TimeControl(2L),
Triggers(2L),
Sensitivity(3L),
GeneratedCommandList(65528L),
AcceptedCommandList(65529L),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19955,17 +19955,17 @@ public void onError(Exception ex) {
}
}

public static class DelegatedZoneManagementClusterTimeControlAttributeCallback implements ChipClusters.ZoneManagementCluster.TimeControlAttributeCallback, DelegatedClusterCallback {
public static class DelegatedZoneManagementClusterTriggersAttributeCallback implements ChipClusters.ZoneManagementCluster.TriggersAttributeCallback, DelegatedClusterCallback {
private ClusterCommandCallback callback;
@Override
public void setCallbackDelegate(ClusterCommandCallback callback) {
this.callback = callback;
}

@Override
public void onSuccess(List<ChipStructs.ZoneManagementClusterZoneTriggeringTimeControlStruct> valueList) {
public void onSuccess(List<ChipStructs.ZoneManagementClusterZoneTriggerControlStruct> valueList) {
Map<CommandResponseInfo, Object> responseValues = new LinkedHashMap<>();
CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List<ChipStructs.ZoneManagementClusterZoneTriggeringTimeControlStruct>");
CommandResponseInfo commandResponseInfo = new CommandResponseInfo("valueList", "List<ChipStructs.ZoneManagementClusterZoneTriggerControlStruct>");
responseValues.put(commandResponseInfo, valueList);
callback.onSuccess(responseValues);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18204,17 +18204,17 @@ private static Map<String, InteractionInfo> readZoneManagementInteractionInfo()
readZoneManagementZonesCommandParams
);
result.put("readZonesAttribute", readZoneManagementZonesAttributeInteractionInfo);
Map<String, CommandParameterInfo> readZoneManagementTimeControlCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readZoneManagementTimeControlAttributeInteractionInfo = new InteractionInfo(
Map<String, CommandParameterInfo> readZoneManagementTriggersCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readZoneManagementTriggersAttributeInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.ZoneManagementCluster) cluster).readTimeControlAttribute(
(ChipClusters.ZoneManagementCluster.TimeControlAttributeCallback) callback
((ChipClusters.ZoneManagementCluster) cluster).readTriggersAttribute(
(ChipClusters.ZoneManagementCluster.TriggersAttributeCallback) callback
);
},
() -> new ClusterInfoMapping.DelegatedZoneManagementClusterTimeControlAttributeCallback(),
readZoneManagementTimeControlCommandParams
() -> new ClusterInfoMapping.DelegatedZoneManagementClusterTriggersAttributeCallback(),
readZoneManagementTriggersCommandParams
);
result.put("readTimeControlAttribute", readZoneManagementTimeControlAttributeInteractionInfo);
result.put("readTriggersAttribute", readZoneManagementTriggersAttributeInteractionInfo);
Map<String, CommandParameterInfo> readZoneManagementSensitivityCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readZoneManagementSensitivityAttributeInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ structs_sources = [
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ZoneManagementClusterTwoDCartesianVertexStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ZoneManagementClusterTwoDCartesianZoneStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ZoneManagementClusterZoneInformationStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ZoneManagementClusterZoneTriggeringTimeControlStruct.kt",
"${chip_root}/src/controller/java/generated/java/chip/devicecontroller/cluster/structs/ZoneManagementClusterZoneTriggerControlStruct.kt",
]

eventstructs_sources = [
Expand Down
Loading

0 comments on commit 59d7388

Please sign in to comment.