Skip to content

Commit

Permalink
[CSA-CP] zap xmls improvements (#120)
Browse files Browse the repository at this point in the history
Co-authored-by: Ethan Zhou <[email protected]>
Co-authored-by: Andrei Litvin <[email protected]>
  • Loading branch information
3 people authored Nov 23, 2024
1 parent a151c8e commit 5ddc6a5
Show file tree
Hide file tree
Showing 111 changed files with 6,111 additions and 2,282 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4708,7 +4708,7 @@ provisional cluster DeviceEnergyManagement = 152 {
command ModifyForecastRequest(ModifyForecastRequestRequest): DefaultSuccess = 5;
/** Allows a client to ask the ESA to recompute its Forecast based on power and time constraints. */
command RequestConstraintBasedForecast(RequestConstraintBasedForecastRequest): DefaultSuccess = 6;
/** Allows a client to request cancellation of a previous adjustment request in a StartTimeAdjustRequest, ModifyForecastRequest or RequestConstraintBasedForecast command */
/** Allows a client to request cancellation of a previous adjustment request in a StartTimeAdjustRequest, ModifyForecastRequest or RequestConstraintBasedForecast command. */
command CancelRequest(): DefaultSuccess = 7;
}

Expand Down Expand Up @@ -4879,9 +4879,9 @@ cluster EnergyEvse = 153 {

/** Allows a client to disable the EVSE from charging and discharging. */
timed command Disable(): DefaultSuccess = 1;
/** This command allows a client to enable the EVSE to charge an EV, */
/** This command allows a client to enable the EVSE to charge an EV, and to provide or update the maximum and minimum charge current. */
timed command EnableCharging(EnableChargingRequest): DefaultSuccess = 2;
/** Upon receipt, this SHALL allow a client to enable the discharge of an EV, */
/** Upon receipt, this SHALL allow a client to enable the discharge of an EV, and to provide or update the maximum discharge current. */
timed command EnableDischarging(EnableDischargingRequest): DefaultSuccess = 3;
/** Allows a client to put the EVSE into a self-diagnostics mode. */
timed command StartDiagnostics(): DefaultSuccess = 4;
Expand Down Expand Up @@ -5003,8 +5003,7 @@ cluster EnergyEvseMode = 157 {
optional char_string<64> statusText = 1;
}

/** This command is used to change device modes.
On receipt of this command the device SHALL respond with a ChangeToModeResponse command. */
/** This command is used to change device modes. */
command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
}

Expand Down Expand Up @@ -5060,11 +5059,10 @@ cluster WaterHeaterMode = 158 {

response struct ChangeToModeResponse = 1 {
enum8 status = 0;
optional char_string statusText = 1;
optional char_string<64> statusText = 1;
}

/** This command is used to change device modes.
On receipt of this command the device SHALL respond with a ChangeToModeResponse command. */
/** This command is used to change device modes. */
command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
}

Expand Down Expand Up @@ -5124,8 +5122,7 @@ provisional cluster DeviceEnergyManagementMode = 159 {
optional char_string<64> statusText = 1;
}

/** This command is used to change device modes.
On receipt of this command the device SHALL respond with a ChangeToModeResponse command. */
/** This command is used to change device modes. */
command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2018,7 +2018,7 @@ provisional cluster DeviceEnergyManagement = 152 {
command ModifyForecastRequest(ModifyForecastRequestRequest): DefaultSuccess = 5;
/** Allows a client to ask the ESA to recompute its Forecast based on power and time constraints. */
command RequestConstraintBasedForecast(RequestConstraintBasedForecastRequest): DefaultSuccess = 6;
/** Allows a client to request cancellation of a previous adjustment request in a StartTimeAdjustRequest, ModifyForecastRequest or RequestConstraintBasedForecast command */
/** Allows a client to request cancellation of a previous adjustment request in a StartTimeAdjustRequest, ModifyForecastRequest or RequestConstraintBasedForecast command. */
command CancelRequest(): DefaultSuccess = 7;
}

Expand Down Expand Up @@ -2189,9 +2189,9 @@ cluster EnergyEvse = 153 {

/** Allows a client to disable the EVSE from charging and discharging. */
timed command Disable(): DefaultSuccess = 1;
/** This command allows a client to enable the EVSE to charge an EV, */
/** This command allows a client to enable the EVSE to charge an EV, and to provide or update the maximum and minimum charge current. */
timed command EnableCharging(EnableChargingRequest): DefaultSuccess = 2;
/** Upon receipt, this SHALL allow a client to enable the discharge of an EV, */
/** Upon receipt, this SHALL allow a client to enable the discharge of an EV, and to provide or update the maximum discharge current. */
timed command EnableDischarging(EnableDischargingRequest): DefaultSuccess = 3;
/** Allows a client to put the EVSE into a self-diagnostics mode. */
timed command StartDiagnostics(): DefaultSuccess = 4;
Expand Down Expand Up @@ -2279,8 +2279,7 @@ cluster EnergyEvseMode = 157 {
optional char_string<64> statusText = 1;
}

/** This command is used to change device modes.
On receipt of this command the device SHALL respond with a ChangeToModeResponse command. */
/** This command is used to change device modes. */
command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
}

Expand Down Expand Up @@ -2336,11 +2335,10 @@ cluster WaterHeaterMode = 158 {

response struct ChangeToModeResponse = 1 {
enum8 status = 0;
optional char_string statusText = 1;
optional char_string<64> statusText = 1;
}

/** This command is used to change device modes.
On receipt of this command the device SHALL respond with a ChangeToModeResponse command. */
/** This command is used to change device modes. */
command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
}

Expand Down Expand Up @@ -2400,8 +2398,7 @@ provisional cluster DeviceEnergyManagementMode = 159 {
optional char_string<64> statusText = 1;
}

/** This command is used to change device modes.
On receipt of this command the device SHALL respond with a ChangeToModeResponse command. */
/** This command is used to change device modes. */
command ChangeToMode(ChangeToModeRequest): ChangeToModeResponse = 0;
}

Expand Down
27 changes: 27 additions & 0 deletions scripts/py_matter_idl/matter_idl/test_zapxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,33 @@ def testGlobalStruct(self):
)
self.assertEqual(idl, Idl(global_structs=[struct]))

def testNameAttribute(self):
idl = XmlToIdl('''<?xml version="1.0"?>
<configurator>
<cluster>
<name>TestCluster</name>
<code>20</code>
<attribute side="server" code="0x0002" name="SubjectsPerAccessControlEntry" define="SUBJECTS_PER_ACCESS_CONTROL_ENTRY" type="int16u" min="4" default="4">
<mandatoryConform/>
</attribute>
</cluster>
</configurator>
''')
self.assertEqual(idl,
Idl(clusters=[
Cluster(name='TestCluster', code=20,
attributes=[
Attribute(
definition=Field(
data_type=DataType(name='int16u', min_value=4),
code=2,
name='SubjectsPerAccessControlEntry',
),
qualities=AttributeQuality.READABLE,
readacl=AccessPrivilege.VIEW,
writeacl=AccessPrivilege.OPERATE)])]))

def testStruct(self):
idl = XmlToIdl('''<?xml version="1.0"?>
<configurator>
Expand Down
4 changes: 3 additions & 1 deletion scripts/py_matter_idl/matter_idl/zapxml/handlers/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ def AttrsToAttribute(attrs) -> Attribute:
if 'max' in attrs:
data_type.max_value = ParseInt(attrs['max'], data_type)

name = attrs['name'] if 'name' in attrs else ''

field = Field(
data_type=data_type,
code=ParseInt(attrs['code']),
name='',
name=name,
is_list=(attrs['type'].lower() == 'array')
)

Expand Down
4 changes: 2 additions & 2 deletions scripts/setup/zap.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"mac-amd64",
"windows-amd64"
],
"tags": ["version:2@v2024.08.14-nightly.1"]
"tags": ["version:2@v2024.10.24-nightly.1"]
},
{
"_comment": "Always get the amd64 version on mac until usable arm64 zap build is available",
"path": "fuchsia/third_party/zap/mac-amd64",
"platforms": ["mac-arm64"],
"tags": ["version:2@v2024.08.14-nightly.1"]
"tags": ["version:2@v2024.10.24-nightly.1"]
}
]
}
2 changes: 1 addition & 1 deletion scripts/setup/zap.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2024.08.14-nightly
v2024.10.24-nightly
2 changes: 1 addition & 1 deletion scripts/tools/zap/zap_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# Use scripts/tools/zap/version_update.py to manage ZAP versioning as many
# files may need updating for versions
#
MIN_ZAP_VERSION = '2024.8.14'
MIN_ZAP_VERSION = '2024.10.24'


class ZapTool:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,33 +109,55 @@ limitations under the License.
and enforce Access Control for the Node&apos;s endpoints and their associated
cluster instances.</description>

<attribute side="server" code="0x0000" define="ACL" type="array" entryType="AccessControlEntryStruct" writable="true">
<description>ACL</description>
<attribute side="server" code="0x0000" name="ACL" define="ACL" type="array" entryType="AccessControlEntryStruct" writable="true">
<access op="read" privilege="administer"/>
<access op="write" privilege="administer"/>
<mandatoryConform/>
</attribute>

<attribute side="server" code="0x0001" define="EXTENSION" type="array" entryType="AccessControlExtensionStruct" writable="true" optional="true">
<description>Extension</description>
<attribute side="server" code="0x0001" name="Extension" define="EXTENSION" type="array" entryType="AccessControlExtensionStruct" writable="true" optional="true">
<access op="read" privilege="administer"/>
<access op="write" privilege="administer"/>
<mandatoryConform>
<feature name="EXTS"/>
</mandatoryConform>
</attribute>

<attribute side="server" code="0x0002" define="SUBJECTS_PER_ACCESS_CONTROL_ENTRY" type="int16u" min="4" default="4">SubjectsPerAccessControlEntry</attribute>
<attribute side="server" code="0x0003" define="TARGETS_PER_ACCESS_CONTROL_ENTRY" type="int16u" min="3" default="3">TargetsPerAccessControlEntry</attribute>
<attribute side="server" code="0x0004" define="ACCESS_CONTROL_ENTRIES_PER_FABRIC" type="int16u" min="4" default="4">AccessControlEntriesPerFabric</attribute>
<attribute code="0x0005" side="server" define="COMMISSIONING_ARL" type="array" entryType="CommissioningAccessRestrictionEntryStruct" optional="true">CommissioningARL</attribute>
<attribute code="0x0006" side="server" define="ARL" type="array" entryType="AccessRestrictionEntryStruct" optional="true">ARL</attribute>

<attribute side="server" code="0x0002" name="SubjectsPerAccessControlEntry" define="SUBJECTS_PER_ACCESS_CONTROL_ENTRY" type="int16u" min="4" default="4">
<mandatoryConform/>
</attribute>
<attribute side="server" code="0x0003" name="TargetsPerAccessControlEntry" define="TARGETS_PER_ACCESS_CONTROL_ENTRY" type="int16u" min="3" default="3">
<mandatoryConform/>
</attribute>
<attribute side="server" code="0x0004" name="AccessControlEntriesPerFabric" define="ACCESS_CONTROL_ENTRIES_PER_FABRIC" type="int16u" min="4" default="4">
<mandatoryConform/>
</attribute>
<attribute code="0x0005" side="server" name="CommissioningARL" define="COMMISSIONING_ARL" type="array" entryType="CommissioningAccessRestrictionEntryStruct" optional="true">
<mandatoryConform>
<feature name="MNGD"/>
</mandatoryConform>
</attribute>
<attribute code="0x0006" side="server" name="ARL" define="ARL" type="array" entryType="AccessRestrictionEntryStruct" optional="true">
<mandatoryConform>
<feature name="MNGD"/>
</mandatoryConform>
</attribute>

<command code="0x00" source="client" name="ReviewFabricRestrictions" isFabricScoped="true" optional="true" response="ReviewFabricRestrictionsResponse">
<description>This command signals to the service associated with the device vendor that the fabric administrator would like a review of the current restrictions on the accessing fabric.</description>
<access op="invoke" privilege="administer"/>
<arg id="0" name="ARL" array="true" type="CommissioningAccessRestrictionEntryStruct"/>
</command>
<mandatoryConform>
<feature name="MNGD"/>
</mandatoryConform>
</command>

<command code="0x01" source="server" name="ReviewFabricRestrictionsResponse" optional="true" disableDefaultResponse="true">
<description>Returns the review token for the request, which can be used to correlate with a FabricRestrictionReviewUpdate event.</description>
<arg id="0" name="Token" type="int64u"/>
<mandatoryConform>
<feature name="MNGD"/>
</mandatoryConform>
</command>

<event side="server" code="0x0000" name="AccessControlEntryChanged" priority="info" isFabricSensitive="true">
Expand All @@ -145,6 +167,7 @@ limitations under the License.
<field id="3" name="ChangeType" type="ChangeTypeEnum" min="0x00" max="0x02"/>
<field id="4" name="LatestValue" type="AccessControlEntryStruct" isNullable="true"/>
<access op="read" privilege="administer"/>
<mandatoryConform/>
</event>

<event side="server" code="0x0001" name="AccessControlExtensionChanged" priority="info" isFabricSensitive="true" optional="true">
Expand All @@ -154,6 +177,9 @@ limitations under the License.
<field id="3" name="ChangeType" type="ChangeTypeEnum" min="0x00" max="0x02"/>
<field id="4" name="LatestValue" type="AccessControlExtensionStruct" isNullable="true"/>
<access op="read" privilege="administer"/>
<mandatoryConform>
<feature name="EXTS"/>
</mandatoryConform>
</event>

<event side="server" code="0x0002" name="FabricRestrictionReviewUpdate" priority="info" isFabricSensitive="true" optional="true">
Expand All @@ -162,6 +188,9 @@ limitations under the License.
<field id="1" name="Instruction" type="long_char_string" optional="true" length="512"/>
<field id="2" name="ARLRequestFlowUrl" type="long_char_string" optional="true" length="256"/>
<access op="read" privilege="administer"/>
<mandatoryConform>
<feature name="MNGD"/>
</mandatoryConform>
</event>
</cluster>
</configurator>
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,36 @@ limitations under the License.

<command source="client" code="0x00" name="GetSetupPIN" isFabricScoped="true" response="GetSetupPINResponse" mustUseTimedInvoke="true" optional="false">
<description>Upon receipt, the Content App checks if the account associated with the client Temp Account Identifier Rotating ID is the same acount that is active on the given Content App. If the accounts are the same, then the Content App includes the Setup PIN in the GetSetupPIN Response.</description>
<access op="invoke" role="administer" />
<access op="invoke" role="administer"/>
<arg name="TempAccountIdentifier" minLength="16" length="100" type="char_string"/>
<mandatoryConform/>
</command>

<command source="client" code="0x02" name="Login" isFabricScoped="true" mustUseTimedInvoke="true" optional="false">
<description>Upon receipt, the Content App checks if the account associated with the client’s Temp Account Identifier (Rotating ID) has a current active Setup PIN with the given value. If the Setup PIN is valid for the user account associated with the Temp Account Identifier, then the Content App MAY make that user account active.</description>
<access op="invoke" role="administer" />
<access op="invoke" role="administer"/>
<arg name="TempAccountIdentifier" minLength="16" length="100" type="char_string"/>
<arg name="SetupPIN" minLength="8" type="char_string"/>
<arg name="Node" type="node_id" optional="true" />
<arg name="Node" type="node_id" optional="true"/>
<mandatoryConform/>
</command>

<command source="client" code="0x03" name="Logout" isFabricScoped="true" mustUseTimedInvoke="true" optional="false">
<description>The purpose of this command is to instruct the Content App to clear the current user account. This command SHOULD be used by clients of a Content App to indicate the end of a user session.</description>
<arg name="Node" type="node_id" optional="true"/>
<mandatoryConform/>
</command>

<command source="server" code="0x01" name="GetSetupPINResponse" optional="false" disableDefaultResponse="true">
<description>This message is sent in response to the GetSetupPIN Request, and contains the Setup PIN code, or null when the accounts identified in the request does not match the active account of the running Content App.</description>
<arg name="SetupPIN" type="char_string"/>
<mandatoryConform/>
</command>

<event side="server" code="0x00" priority="critical" name="LoggedOut" optional="false">
<description>This event can be used by the Content App to indicate that the current user has logged out. In response to this event, the Fabric Admin SHALL remove access to this Content App by the specified Node. If no Node is provided, then the Fabric Admin SHALL remove access to all non-Admin Nodes.</description>
<field id="0" name="Node" type="node_id" optional="true"/>
<optionalConform/>
</event>

</cluster>
Expand Down
Loading

0 comments on commit 5ddc6a5

Please sign in to comment.