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

Add Spec version and Max Paths Per Invoke to Basic Information cluster #30496

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
25 changes: 25 additions & 0 deletions src/app/clusters/basic-information/basic-information.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/cluster-objects.h>
#include <app/DataModelRevision.h>
#include <app/SpecificationVersion.h>
#include <app/EventLogging.h>
#include <app/InteractionModelEngine.h>
#include <app/util/attribute-storage.h>
#include <lib/core/CHIPConfig.h>
#include <platform/CHIPDeviceLayer.h>
#include <platform/ConfigurationManager.h>
#include <platform/DeviceInstanceInfoProvider.h>
Expand Down Expand Up @@ -59,6 +61,8 @@ class BasicAttrAccess : public AttributeAccessInterface
CHIP_ERROR ReadLocation(AttributeValueEncoder & aEncoder);
CHIP_ERROR WriteLocation(AttributeValueDecoder & aDecoder);
CHIP_ERROR ReadProductAppearance(AttributeValueEncoder & aEncoder);
CHIP_ERROR ReadSpecificationVersion(AttributeValueEncoder & aEncoder);
CHIP_ERROR ReadMaxPathsPerInvoke(AttributeValueEncoder & aEncoder);
};

BasicAttrAccess gAttrAccess;
Expand Down Expand Up @@ -287,6 +291,16 @@ CHIP_ERROR BasicAttrAccess::Read(const ConcreteReadAttributePath & aPath, Attrib
break;
}

case SpecificationVersion::Id: {
status = ReadSpecificationVersion(aEncoder);
break;
}

case MaxPathsPerInvoke::Id: {
status = ReadMaxPathsPerInvoke(aEncoder);
break;
}

default:
// We did not find a processing path, the caller will delegate elsewhere.
break;
Expand Down Expand Up @@ -380,6 +394,17 @@ CHIP_ERROR BasicAttrAccess::ReadProductAppearance(AttributeValueEncoder & aEncod
return aEncoder.Encode(productAppearance);
}

CHIP_ERROR BasicAttrAccess::ReadSpecificationVersion(AttributeValueEncoder & aEncoder)
{
uint32_t specification_version = CHIP_DEVICE_SPECIFICATION_VERSION;
return aEncoder.Encode(specification_version);
}
CHIP_ERROR BasicAttrAccess::ReadMaxPathsPerInvoke(AttributeValueEncoder & aEncoder)
tehampson marked this conversation as resolved.
Show resolved Hide resolved
{
uint16_t max_path_per_invoke = CHIP_CONFIG_MAX_PATHS_PER_INVOKE;
return aEncoder.Encode(max_path_per_invoke);
}

class PlatformMgrDelegate : public DeviceLayer::PlatformManagerDelegate
{
void OnStartUp(uint32_t softwareVersion) override
Expand Down
18 changes: 17 additions & 1 deletion src/app/tests/suites/TestBasicInformation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ tests:
18,
19,
20,
21,
tehampson marked this conversation as resolved.
Show resolved Hide resolved
22,
0xFFF8, # GeneratedCommandList
0xFFF9, # AcceptedCommandList
0xFFFA, # EventList
Expand Down Expand Up @@ -191,9 +193,23 @@ tests:
arguments:
value: false

- label: "Read the ProductApppearance value"
- label: "Read the ProductAppearance value"
command: "readAttribute"
attribute: "ProductAppearance"
response:
# For now all-clusters-app is a satin purple.
value: { Finish: 2, PrimaryColor: 5 }

- label: "Read the Specification Version value"
command: "readAttribute"
attribute: "SpecificationVersion"
response:
# For now all-clusters-app has a version 1.3.
value: 0x01030000

- label: "Read the Max Paths Per Invoke value"
command: "readAttribute"
attribute: "MaxPathsPerInvoke"
response:
# For now all-clusters-app only supports 1 max paths per invoke.
value: 1
2 changes: 1 addition & 1 deletion src/app/tests/suites/certification/Test_TC_BINFO_1_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ tests:
command: "readAttribute"
attribute: "ClusterRevision"
response:
value: 2
value: 3
constraints:
type: int16u

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ limitations under the License.
<description>This cluster provides attributes and events for determining basic information about Nodes, which supports both
Commissioning and operational determination of Node characteristics, such as Vendor ID, Product ID and serial number,
which apply to the whole Node. Also allows setting user device information such as location.</description>
<globalAttribute side="either" code="0xFFFD" value="2"/>
<globalAttribute side="either" code="0xFFFD" value="3"/>

<attribute side="server" code="0" define="DATA_MODEL_REVISION" type="int16u" >DataModelRevision</attribute>
<attribute side="server" code="1" define="VENDOR_NAME" type="char_string" length="32" >VendorName</attribute>
Expand Down Expand Up @@ -107,6 +107,8 @@ limitations under the License.
<attribute side="server" code="18" define="UNIQUE_ID" type="char_string" length="32" optional="true">UniqueID</attribute>
<attribute side="server" code="19" define="CAPABILITY_MINIMA" type="CapabilityMinimaStruct" writable="false" >CapabilityMinima</attribute>
<attribute side="server" code="20" define="PRODUCT_APPEARANCE" type="ProductAppearanceStruct" optional="true">ProductAppearance</attribute>
<attribute side="server" code="21" define="SPECIFICATION_VERSION" type="int32u" >SpecificationVersion</attribute>
<attribute side="server" code="22" define="MAX_PATHS_PER_INVOKE" type="int16u" >MaxPathsPerInvoke</attribute>

<event side="server" code="0x00" name="StartUp" priority="critical" optional="false">
<description>The StartUp event SHALL be emitted by a Node as soon as reasonable after completing a boot or reboot process.</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ limitations under the License.
<define>BRIDGED_DEVICE_BASIC_INFORMATION_CLUSTER</define>
<client tick="false" init="false">true</client>
<server tick="false" init="false">true</server>
<globalAttribute side="either" code="0xFFFD" value="2"/>
<globalAttribute side="either" code="0xFFFD" value="3"/>

<attribute side="server" code="1" define="VENDOR_NAME" type="char_string" length="32" optional="true">VendorName</attribute>
<attribute side="server" code="2" define="VENDOR_ID" type="vendor_id" optional="true">VendorID</attribute>
Expand All @@ -86,7 +86,7 @@ limitations under the License.
<attribute side="server" code="15" define="SERIAL_NUMBER" type="char_string" length="32" optional="true">SerialNumber</attribute>
<attribute side="server" code="17" define="REACHABLE" type="boolean" default="1" optional="false">Reachable</attribute>
<attribute side="server" code="18" define="UNIQUE_ID" type="char_string" length="32" optional="true">UniqueID</attribute>
<attribute side="server" code="20" define="PRODUCT_APPEARANCE" type="ProductAppearanceStruct" optional="true">ProductAppearance</attribute>
<attribute side="server" code="20" define="PRODUCT_APPEARANCE" type="ProductAppearanceStruct" optional="true">ProductAppearance</attribute>

<event side="server" code="0x00" name="StartUp" priority="critical" optional="true">
<description>The StartUp event SHALL be emitted by a Node as soon as reasonable after completing a boot or reboot process.</description>
Expand Down
4 changes: 3 additions & 1 deletion src/app/zap-templates/zcl/zcl-with-test-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@
"SerialNumber",
"UniqueID",
"CapabilityMinima",
"ProductAppearance"
"ProductAppearance",
"SpecificationVersion",
"MaxPathsPerInvoke"
],
"Bridged Device Basic Information": ["ProductAppearance"],
"Descriptor": ["ClusterRevision"],
Expand Down
4 changes: 3 additions & 1 deletion src/app/zap-templates/zcl/zcl.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@
"SerialNumber",
"UniqueID",
"CapabilityMinima",
"ProductAppearance"
"ProductAppearance",
"SpecificationVersion",
"MaxPathsPerInvoke"
],
"Bridged Device Basic Information": ["ProductAppearance"],
"Descriptor": ["ClusterRevision"],
Expand Down
2 changes: 2 additions & 0 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,8 @@ client cluster BasicInformation = 40 {
readonly attribute optional char_string<32> uniqueID = 18;
readonly attribute CapabilityMinimaStruct capabilityMinima = 19;
readonly attribute optional ProductAppearanceStruct productAppearance = 20;
readonly attribute int32u specificationVersion = 21;
readonly attribute int16u maxPathsPerInvoke = 22;
readonly attribute command_id generatedCommandList[] = 65528;
readonly attribute command_id acceptedCommandList[] = 65529;
readonly attribute event_id eventList[] = 65530;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5773,6 +5773,8 @@ public static class BasicInformationCluster extends BaseChipCluster {
private static final long UNIQUE_I_D_ATTRIBUTE_ID = 18L;
private static final long CAPABILITY_MINIMA_ATTRIBUTE_ID = 19L;
private static final long PRODUCT_APPEARANCE_ATTRIBUTE_ID = 20L;
private static final long SPECIFICATION_VERSION_ATTRIBUTE_ID = 21L;
private static final long MAX_PATHS_PER_INVOKE_ATTRIBUTE_ID = 22L;
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;
Expand Down Expand Up @@ -6382,6 +6384,56 @@ public void onSuccess(byte[] tlv) {
}, PRODUCT_APPEARANCE_ATTRIBUTE_ID, minInterval, maxInterval);
}

public void readSpecificationVersionAttribute(
LongAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SPECIFICATION_VERSION_ATTRIBUTE_ID);

readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
}, SPECIFICATION_VERSION_ATTRIBUTE_ID, true);
}

public void subscribeSpecificationVersionAttribute(
LongAttributeCallback callback, int minInterval, int maxInterval) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, SPECIFICATION_VERSION_ATTRIBUTE_ID);

subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
}
}, SPECIFICATION_VERSION_ATTRIBUTE_ID, minInterval, maxInterval);
}

public void readMaxPathsPerInvokeAttribute(
IntegerAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MAX_PATHS_PER_INVOKE_ATTRIBUTE_ID);

readAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
callback.onSuccess(value);
}
}, MAX_PATHS_PER_INVOKE_ATTRIBUTE_ID, true);
}

public void subscribeMaxPathsPerInvokeAttribute(
IntegerAttributeCallback callback, int minInterval, int maxInterval) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, MAX_PATHS_PER_INVOKE_ATTRIBUTE_ID);

subscribeAttribute(new ReportCallbackImpl(callback, path) {
@Override
public void onSuccess(byte[] tlv) {
Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv);
}
}, MAX_PATHS_PER_INVOKE_ATTRIBUTE_ID, minInterval, maxInterval);
}

public void readGeneratedCommandListAttribute(
GeneratedCommandListAttributeCallback callback) {
ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, GENERATED_COMMAND_LIST_ATTRIBUTE_ID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2347,6 +2347,8 @@ public enum Attribute {
UniqueID(18L),
CapabilityMinima(19L),
ProductAppearance(20L),
SpecificationVersion(21L),
MaxPathsPerInvoke(22L),
GeneratedCommandList(65528L),
AcceptedCommandList(65529L),
EventList(65530L),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1680,6 +1680,28 @@ private static Map<String, InteractionInfo> readBasicInformationInteractionInfo(
readBasicInformationUniqueIDCommandParams
);
result.put("readUniqueIDAttribute", readBasicInformationUniqueIDAttributeInteractionInfo);
Map<String, CommandParameterInfo> readBasicInformationSpecificationVersionCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readBasicInformationSpecificationVersionAttributeInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.BasicInformationCluster) cluster).readSpecificationVersionAttribute(
(ChipClusters.LongAttributeCallback) callback
);
},
() -> new ClusterInfoMapping.DelegatedLongAttributeCallback(),
readBasicInformationSpecificationVersionCommandParams
);
result.put("readSpecificationVersionAttribute", readBasicInformationSpecificationVersionAttributeInteractionInfo);
Map<String, CommandParameterInfo> readBasicInformationMaxPathsPerInvokeCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readBasicInformationMaxPathsPerInvokeAttributeInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
((ChipClusters.BasicInformationCluster) cluster).readMaxPathsPerInvokeAttribute(
(ChipClusters.IntegerAttributeCallback) callback
);
},
() -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(),
readBasicInformationMaxPathsPerInvokeCommandParams
);
result.put("readMaxPathsPerInvokeAttribute", readBasicInformationMaxPathsPerInvokeAttributeInteractionInfo);
Map<String, CommandParameterInfo> readBasicInformationGeneratedCommandListCommandParams = new LinkedHashMap<String, CommandParameterInfo>();
InteractionInfo readBasicInformationGeneratedCommandListAttributeInteractionInfo = new InteractionInfo(
(cluster, callback, commandArguments) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,22 @@ class BasicInformationCluster(
// Implementation needs to be added here
}

suspend fun readSpecificationVersionAttribute(): UInt {
// Implementation needs to be added here
}

suspend fun subscribeSpecificationVersionAttribute(minInterval: Int, maxInterval: Int): UInt {
// Implementation needs to be added here
}

suspend fun readMaxPathsPerInvokeAttribute(): UShort {
// Implementation needs to be added here
}

suspend fun subscribeMaxPathsPerInvokeAttribute(minInterval: Int, maxInterval: Int): UShort {
// Implementation needs to be added here
}

suspend fun readGeneratedCommandListAttribute(): GeneratedCommandListAttribute {
// Implementation needs to be added here
}
Expand Down
32 changes: 32 additions & 0 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: 12 additions & 0 deletions src/controller/python/chip/clusters/CHIPClusters.py

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

Loading
Loading