Skip to content

Commit

Permalink
Move Media::AccountLogin cluster to match the spec (#29944)
Browse files Browse the repository at this point in the history
* Move AccountLogin cluster to match spec:

- set "nullable" attribute to setup pin on reply for getting the setup
  pin
- mark the Login and GetSetupPin requiring administer privileges.

* Zap regen

* Fix typo in nullable

* Zap regen

* Minor change to re-kick CI

* Undo change

* Zap regen

* Fix compile for accountlogin tv example app

* Undo changes for onoff cluster ... those are part of another PR

* Also fix android compile

* More fixes for java compile

* Restyle

* Undo nullable change on setupPin

* ZAP regen

* Add fabric scoped to 3 commands

* ZAP regen

* Undo nullable update

* Switch order for idl generator to match outputs

---------

Co-authored-by: Andrei Litvin <[email protected]>
  • Loading branch information
andy31415 and andreilitvin authored Nov 1, 2023
1 parent 099d226 commit 7cbfc0a
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3671,9 +3671,9 @@ server cluster AccountLogin = 1294 {
char_string setupPIN = 0;
}

timed command GetSetupPIN(GetSetupPINRequest): GetSetupPINResponse = 0;
timed command Login(LoginRequest): DefaultSuccess = 2;
timed command Logout(): DefaultSuccess = 3;
fabric timed command access(invoke: administer) GetSetupPIN(GetSetupPINRequest): GetSetupPINResponse = 0;
fabric timed command access(invoke: administer) Login(LoginRequest): DefaultSuccess = 2;
fabric timed command Logout(): DefaultSuccess = 3;
}

/** The Test Cluster is meant to validate the generated code */
Expand Down
12 changes: 6 additions & 6 deletions examples/placeholder/linux/apps/app1/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -6480,11 +6480,11 @@ client cluster AccountLogin = 1294 {
}

/** 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. */
timed command GetSetupPIN(GetSetupPINRequest): GetSetupPINResponse = 0;
fabric timed command access(invoke: administer) GetSetupPIN(GetSetupPINRequest): GetSetupPINResponse = 0;
/** 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. */
timed command Login(LoginRequest): DefaultSuccess = 2;
fabric timed command access(invoke: administer) Login(LoginRequest): DefaultSuccess = 2;
/** 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. */
timed command Logout(): DefaultSuccess = 3;
fabric timed command Logout(): DefaultSuccess = 3;
}

/** This cluster provides commands that facilitate user account login on a Content App or a node. For example, a Content App running on a Video Player device, which is represented as an endpoint (see [TV Architecture]), can use this cluster to help make the user account on the Content App match the user account on the Client. */
Expand All @@ -6509,9 +6509,9 @@ server cluster AccountLogin = 1294 {
char_string setupPIN = 0;
}

timed command GetSetupPIN(GetSetupPINRequest): GetSetupPINResponse = 0;
timed command Login(LoginRequest): DefaultSuccess = 2;
timed command Logout(): DefaultSuccess = 3;
fabric timed command access(invoke: administer) GetSetupPIN(GetSetupPINRequest): GetSetupPINResponse = 0;
fabric timed command access(invoke: administer) Login(LoginRequest): DefaultSuccess = 2;
fabric timed command Logout(): DefaultSuccess = 3;
}

endpoint 0 {
Expand Down
12 changes: 6 additions & 6 deletions examples/placeholder/linux/apps/app2/config.matter
Original file line number Diff line number Diff line change
Expand Up @@ -6439,11 +6439,11 @@ client cluster AccountLogin = 1294 {
}

/** 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. */
timed command GetSetupPIN(GetSetupPINRequest): GetSetupPINResponse = 0;
fabric timed command access(invoke: administer) GetSetupPIN(GetSetupPINRequest): GetSetupPINResponse = 0;
/** 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. */
timed command Login(LoginRequest): DefaultSuccess = 2;
fabric timed command access(invoke: administer) Login(LoginRequest): DefaultSuccess = 2;
/** 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. */
timed command Logout(): DefaultSuccess = 3;
fabric timed command Logout(): DefaultSuccess = 3;
}

/** This cluster provides commands that facilitate user account login on a Content App or a node. For example, a Content App running on a Video Player device, which is represented as an endpoint (see [TV Architecture]), can use this cluster to help make the user account on the Content App match the user account on the Client. */
Expand All @@ -6468,9 +6468,9 @@ server cluster AccountLogin = 1294 {
char_string setupPIN = 0;
}

timed command GetSetupPIN(GetSetupPINRequest): GetSetupPINResponse = 0;
timed command Login(LoginRequest): DefaultSuccess = 2;
timed command Logout(): DefaultSuccess = 3;
fabric timed command access(invoke: administer) GetSetupPIN(GetSetupPINRequest): GetSetupPINResponse = 0;
fabric timed command access(invoke: administer) Login(LoginRequest): DefaultSuccess = 2;
fabric timed command Logout(): DefaultSuccess = 3;
}

endpoint 0 {
Expand Down
6 changes: 3 additions & 3 deletions examples/tv-app/tv-common/tv-app.matter
Original file line number Diff line number Diff line change
Expand Up @@ -2448,9 +2448,9 @@ server cluster AccountLogin = 1294 {
char_string setupPIN = 0;
}

timed command GetSetupPIN(GetSetupPINRequest): GetSetupPINResponse = 0;
timed command Login(LoginRequest): DefaultSuccess = 2;
timed command Logout(): DefaultSuccess = 3;
fabric timed command access(invoke: administer) GetSetupPIN(GetSetupPINRequest): GetSetupPINResponse = 0;
fabric timed command access(invoke: administer) Login(LoginRequest): DefaultSuccess = 2;
fabric timed command Logout(): DefaultSuccess = 3;
}

endpoint 0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1996,11 +1996,11 @@ client cluster AccountLogin = 1294 {
}

/** 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. */
timed command GetSetupPIN(GetSetupPINRequest): GetSetupPINResponse = 0;
fabric timed command access(invoke: administer) GetSetupPIN(GetSetupPINRequest): GetSetupPINResponse = 0;
/** 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. */
timed command Login(LoginRequest): DefaultSuccess = 2;
fabric timed command access(invoke: administer) Login(LoginRequest): DefaultSuccess = 2;
/** 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. */
timed command Logout(): DefaultSuccess = 3;
fabric timed command Logout(): DefaultSuccess = 3;
}

endpoint 0 {
Expand Down
4 changes: 2 additions & 2 deletions scripts/py_matter_idl/matter_idl/generators/idl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ def human_text_string(value: Union[ClusterSide, StructTag, StructQuality, EventP
return result
elif type(value) is CommandQuality:
result = ""
if CommandQuality.TIMED_INVOKE in value:
result += "timed "
if CommandQuality.FABRIC_SCOPED in value:
result += "fabric "
if CommandQuality.TIMED_INVOKE in value:
result += "timed "
return result
elif type(value) is ApiMaturity:
if value == ApiMaturity.STABLE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,20 @@ limitations under the License.
<server init="false" tick="false">true</server>
<description>This cluster provides commands that facilitate user account login on a Content App or a node. For example, a Content App running on a Video Player device, which is represented as an endpoint (see [TV Architecture]), can use this cluster to help make the user account on the Content App match the user account on the Client.</description>

<command source="client" code="0x00" name="GetSetupPIN" response="GetSetupPINResponse" mustUseTimedInvoke="true" optional="false">
<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" />
<arg name="TempAccountIdentifier" minLength="16" length="100" type="char_string"/>
</command>

<command source="client" code="0x02" name="Login" mustUseTimedInvoke="true" optional="false">
<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" />
<arg name="TempAccountIdentifier" minLength="16" length="100" type="char_string"/>
<arg name="SetupPIN" minLength="11" type="char_string"/>
</command>

<command source="client" code="0x03" name="Logout" mustUseTimedInvoke="true" optional="false">
<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>
</command>

Expand Down
6 changes: 3 additions & 3 deletions src/controller/data_model/controller-clusters.matter
Original file line number Diff line number Diff line change
Expand Up @@ -6508,11 +6508,11 @@ client cluster AccountLogin = 1294 {
}

/** 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. */
timed command GetSetupPIN(GetSetupPINRequest): GetSetupPINResponse = 0;
fabric timed command access(invoke: administer) GetSetupPIN(GetSetupPINRequest): GetSetupPINResponse = 0;
/** 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. */
timed command Login(LoginRequest): DefaultSuccess = 2;
fabric timed command access(invoke: administer) Login(LoginRequest): DefaultSuccess = 2;
/** 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. */
timed command Logout(): DefaultSuccess = 3;
fabric timed command Logout(): DefaultSuccess = 3;
}

/** Attributes related to the electrical properties of a device. This cluster is used by power outlets and other devices that need to provide instantaneous data as opposed to metrology data which should be retrieved from the metering cluster.. */
Expand Down

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

0 comments on commit 7cbfc0a

Please sign in to comment.