Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match Unit Localization Cluster to spec #29960

Merged
merged 7 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ server cluster UnitLocalization = 45 {
kTemperatureUnit = 0x1;
}

attribute TempUnitEnum temperatureUnit = 0;
attribute access(write: manage) nullable TempUnitEnum temperatureUnit = 0;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
2 changes: 1 addition & 1 deletion examples/bridge-app/bridge-common/bridge-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ server cluster UnitLocalization = 45 {
kTemperatureUnit = 0x1;
}

attribute TempUnitEnum temperatureUnit = 0;
attribute access(write: manage) nullable TempUnitEnum temperatureUnit = 0;
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 @@ -308,7 +308,7 @@ server cluster UnitLocalization = 45 {
kTemperatureUnit = 0x1;
}

attribute TempUnitEnum temperatureUnit = 0;
attribute access(write: manage) nullable TempUnitEnum temperatureUnit = 0;
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 @@ -308,7 +308,7 @@ server cluster UnitLocalization = 45 {
kTemperatureUnit = 0x1;
}

attribute TempUnitEnum temperatureUnit = 0;
attribute access(write: manage) nullable TempUnitEnum temperatureUnit = 0;
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 @@ -308,7 +308,7 @@ server cluster UnitLocalization = 45 {
kTemperatureUnit = 0x1;
}

attribute TempUnitEnum temperatureUnit = 0;
attribute access(write: manage) nullable TempUnitEnum temperatureUnit = 0;
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 @@ -396,7 +396,7 @@ server cluster UnitLocalization = 45 {
kTemperatureUnit = 0x1;
}

attribute TempUnitEnum temperatureUnit = 0;
attribute access(write: manage) nullable TempUnitEnum temperatureUnit = 0;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
4 changes: 2 additions & 2 deletions examples/placeholder/linux/apps/app1/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ client cluster UnitLocalization = 45 {
kTemperatureUnit = 0x1;
}

attribute optional TempUnitEnum temperatureUnit = 0;
attribute access(write: manage) optional nullable TempUnitEnum temperatureUnit = 0;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand All @@ -1036,7 +1036,7 @@ server cluster UnitLocalization = 45 {
kTemperatureUnit = 0x1;
}

attribute TempUnitEnum temperatureUnit = 0;
attribute access(write: manage) nullable TempUnitEnum temperatureUnit = 0;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
2 changes: 1 addition & 1 deletion examples/placeholder/linux/apps/app2/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ server cluster UnitLocalization = 45 {
kTemperatureUnit = 0x1;
}

attribute TempUnitEnum temperatureUnit = 0;
attribute access(write: manage) nullable TempUnitEnum temperatureUnit = 0;
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 @@ -263,7 +263,7 @@ server cluster UnitLocalization = 45 {
kTemperatureUnit = 0x1;
}

attribute TempUnitEnum temperatureUnit = 0;
attribute access(write: manage) nullable TempUnitEnum temperatureUnit = 0;
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 @@ -263,7 +263,7 @@ server cluster UnitLocalization = 45 {
kTemperatureUnit = 0x1;
}

attribute TempUnitEnum temperatureUnit = 0;
attribute access(write: manage) nullable TempUnitEnum temperatureUnit = 0;
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 @@ -711,7 +711,7 @@ server cluster UnitLocalization = 45 {
kTemperatureUnit = 0x1;
}

attribute TempUnitEnum temperatureUnit = 0;
attribute access(write: manage) nullable TempUnitEnum temperatureUnit = 0;
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 @@ -711,7 +711,7 @@ server cluster UnitLocalization = 45 {
kTemperatureUnit = 0x1;
}

attribute TempUnitEnum temperatureUnit = 0;
attribute access(write: manage) nullable TempUnitEnum temperatureUnit = 0;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
2 changes: 1 addition & 1 deletion examples/thermostat/thermostat-common/thermostat.matter
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ server cluster UnitLocalization = 45 {
kTemperatureUnit = 0x1;
}

attribute TempUnitEnum temperatureUnit = 0;
attribute access(write: manage) nullable TempUnitEnum temperatureUnit = 0;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
2 changes: 1 addition & 1 deletion examples/tv-app/tv-common/tv-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ server cluster UnitLocalization = 45 {
kTemperatureUnit = 0x1;
}

attribute TempUnitEnum temperatureUnit = 0;
attribute access(write: manage) nullable TempUnitEnum temperatureUnit = 0;
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 @@ -627,7 +627,7 @@ server cluster UnitLocalization = 45 {
kTemperatureUnit = 0x1;
}

attribute TempUnitEnum temperatureUnit = 0;
attribute access(write: manage) nullable TempUnitEnum temperatureUnit = 0;
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 @@ -654,7 +654,7 @@ server cluster UnitLocalization = 45 {
kTemperatureUnit = 0x1;
}

attribute TempUnitEnum temperatureUnit = 0;
attribute access(write: manage) nullable TempUnitEnum temperatureUnit = 0;
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 @@ -227,6 +227,7 @@
0x00000028, /* Cluster: Basic Information, Attribute: NodeLabel, Privilege: manage */ \
0x00000028, /* Cluster: Basic Information, Attribute: Location, Privilege: administer */ \
0x00000028, /* Cluster: Basic Information, Attribute: LocalConfigDisabled, Privilege: manage */ \
0x0000002D, /* Cluster: Unit Localization, Attribute: TemperatureUnit, Privilege: manage */ \
0x00000030, /* Cluster: General Commissioning, Attribute: Breadcrumb, Privilege: administer */ \
0x00000031, /* Cluster: Network Commissioning, Attribute: InterfaceEnabled, Privilege: administer */ \
0x0000003F, /* Cluster: Group Key Management, Attribute: GroupKeyMap, Privilege: manage */ \
Expand Down Expand Up @@ -281,6 +282,7 @@
0x00000005, /* Cluster: Basic Information, Attribute: NodeLabel, Privilege: manage */ \
0x00000006, /* Cluster: Basic Information, Attribute: Location, Privilege: administer */ \
0x00000010, /* Cluster: Basic Information, Attribute: LocalConfigDisabled, Privilege: manage */ \
0x00000000, /* Cluster: Unit Localization, Attribute: TemperatureUnit, Privilege: manage */ \
0x00000000, /* Cluster: General Commissioning, Attribute: Breadcrumb, Privilege: administer */ \
0x00000004, /* Cluster: Network Commissioning, Attribute: InterfaceEnabled, Privilege: administer */ \
0x00000000, /* Cluster: Group Key Management, Attribute: GroupKeyMap, Privilege: manage */ \
Expand Down Expand Up @@ -335,6 +337,7 @@
kMatterAccessPrivilegeManage, /* Cluster: Basic Information, Attribute: NodeLabel, Privilege: manage */ \
kMatterAccessPrivilegeAdminister, /* Cluster: Basic Information, Attribute: Location, Privilege: administer */ \
kMatterAccessPrivilegeManage, /* Cluster: Basic Information, Attribute: LocalConfigDisabled, Privilege: manage */ \
kMatterAccessPrivilegeManage, /* Cluster: Unit Localization, Attribute: TemperatureUnit, Privilege: manage */ \
kMatterAccessPrivilegeAdminister, /* Cluster: General Commissioning, Attribute: Breadcrumb, Privilege: administer */ \
kMatterAccessPrivilegeAdminister, /* Cluster: Network Commissioning, Attribute: InterfaceEnabled, Privilege: administer */ \
kMatterAccessPrivilegeManage, /* Cluster: Group Key Management, Attribute: GroupKeyMap, Privilege: manage */ \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,9 +469,10 @@
\
/* Endpoint: 0, Cluster: Unit Localization (server) */ \
{ ZAP_MIN_MAX_DEFAULTS_INDEX(1), 0x00000000, 1, ZAP_TYPE(ENUM8), \
ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) }, /* TemperatureUnit */ \
{ ZAP_SIMPLE_DEFAULT(0x1), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \
{ ZAP_SIMPLE_DEFAULT(1), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \
ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | \
ZAP_ATTRIBUTE_MASK(NULLABLE) }, /* TemperatureUnit */ \
{ ZAP_SIMPLE_DEFAULT(0x1), 0x0000FFFC, 4, ZAP_TYPE(BITMAP32), 0 }, /* FeatureMap */ \
{ ZAP_SIMPLE_DEFAULT(1), 0x0000FFFD, 2, ZAP_TYPE(INT16U), 0 }, /* ClusterRevision */ \
\
/* Endpoint: 0, Cluster: Power Source (server) */ \
{ ZAP_SIMPLE_DEFAULT(0), 0x00000000, 1, ZAP_TYPE(ENUM8), 0 }, /* Status */ \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ limitations under the License.
mechanism by which they can be configured to use a user’s preferred unit.</description>
<globalAttribute side="either" code="0xFFFD" value="1"/>
<!-- Base data types -->
<attribute side="server" code="0x00" define="TEMPERATURE_UNIT" type="TempUnitEnum" min="0" max="2" writable="true" optional="true">TemperatureUnit</attribute>
<attribute side="server" code="0x00" define="TEMPERATURE_UNIT" type="TempUnitEnum" min="0" max="2" writable="true" optional="true" isNullable="true">
andy31415 marked this conversation as resolved.
Show resolved Hide resolved
<description>TemperatureUnit</description>
<access op="write" role="manage"/>
</attribute>
</cluster>
<bitmap name="Feature" type="bitmap32">
<cluster code="0x002d"/>
Expand Down
2 changes: 1 addition & 1 deletion src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ client cluster UnitLocalization = 45 {
kTemperatureUnit = 0x1;
}

attribute optional TempUnitEnum temperatureUnit = 0;
attribute access(write: manage) optional nullable TempUnitEnum temperatureUnit = 0;
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 @@ -4361,6 +4361,12 @@ public UnitLocalizationCluster(long devicePtr, int endpointId) {
@Override
public native long initWithDevice(long devicePtr, int endpointId);

public interface TemperatureUnitAttributeCallback {
void onSuccess(@Nullable Integer value);
void onError(Exception ex);
default void onSubscriptionEstablished(long subscriptionId) {}
}

public interface GeneratedCommandListAttributeCallback {
void onSuccess(List<Long> value);
void onError(Exception ex);
Expand All @@ -4386,7 +4392,7 @@ default void onSubscriptionEstablished(long subscriptionId) {}
}

public void readTemperatureUnitAttribute(
IntegerAttributeCallback callback) {
TemperatureUnitAttributeCallback callback) {
readTemperatureUnitAttribute(chipClusterPtr, callback);
}

Expand All @@ -4399,7 +4405,7 @@ public void writeTemperatureUnitAttribute(DefaultClusterCallback callback, Integ
}

public void subscribeTemperatureUnitAttribute(
IntegerAttributeCallback callback, int minInterval, int maxInterval) {
TemperatureUnitAttributeCallback callback, int minInterval, int maxInterval) {
subscribeTemperatureUnitAttribute(chipClusterPtr, callback, minInterval, maxInterval);
}

Expand Down Expand Up @@ -4463,11 +4469,11 @@ public void subscribeClusterRevisionAttribute(
subscribeClusterRevisionAttribute(chipClusterPtr, callback, minInterval, maxInterval);
}

private native void readTemperatureUnitAttribute(long chipClusterPtr, IntegerAttributeCallback callback);
private native void readTemperatureUnitAttribute(long chipClusterPtr, TemperatureUnitAttributeCallback callback);

private native void writeTemperatureUnitAttribute(long chipClusterPtr, DefaultClusterCallback callback, Integer value, @Nullable Integer timedWriteTimeoutMs);

private native void subscribeTemperatureUnitAttribute(long chipClusterPtr, IntegerAttributeCallback callback, int minInterval, int maxInterval);
private native void subscribeTemperatureUnitAttribute(long chipClusterPtr, TemperatureUnitAttributeCallback callback, int minInterval, int maxInterval);

private native void readGeneratedCommandListAttribute(long chipClusterPtr, GeneratedCommandListAttributeCallback callback);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2553,6 +2553,27 @@ public void onError(Exception ex) {
}
}

public static class DelegatedUnitLocalizationClusterTemperatureUnitAttributeCallback implements ChipClusters.UnitLocalizationCluster.TemperatureUnitAttributeCallback, DelegatedClusterCallback {
private ClusterCommandCallback callback;
@Override
public void setCallbackDelegate(ClusterCommandCallback callback) {
this.callback = callback;
}

@Override
public void onSuccess(@Nullable Integer value) {
Map<CommandResponseInfo, Object> responseValues = new LinkedHashMap<>();
CommandResponseInfo commandResponseInfo = new CommandResponseInfo("value", "Integer");
responseValues.put(commandResponseInfo, value);
callback.onSuccess(responseValues);
}

@Override
public void onError(Exception ex) {
callback.onFailure(ex);
}
}

public static class DelegatedUnitLocalizationClusterGeneratedCommandListAttributeCallback implements ChipClusters.UnitLocalizationCluster.GeneratedCommandListAttributeCallback, DelegatedClusterCallback {
private ClusterCommandCallback callback;
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2133,10 +2133,10 @@ private static Map<String, InteractionInfo> readUnitLocalizationInteractionInfo(
InteractionInfo readUnitLocalizationTemperatureUnitAttributeInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.UnitLocalizationCluster) cluster).readTemperatureUnitAttribute(
(ChipClusters.IntegerAttributeCallback) callback
(ChipClusters.UnitLocalizationCluster.TemperatureUnitAttributeCallback) callback
);
},
() -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
() -> new ClusterInfoMapping.DelegatedUnitLocalizationClusterTemperatureUnitAttributeCallback(),
readUnitLocalizationTemperatureUnitCommandParams
);
result.put("readTemperatureUnitAttribute", readUnitLocalizationTemperatureUnitAttributeInteractionInfo);
Expand Down
17 changes: 12 additions & 5 deletions src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading