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

Move Media::AccountLogin cluster to match the spec #29944

Merged
merged 20 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from 12 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 @@ -3645,11 +3645,11 @@ server cluster AccountLogin = 1294 {
}

response struct GetSetupPINResponse = 1 {
char_string setupPIN = 0;
nullable char_string setupPIN = 0;
andy31415 marked this conversation as resolved.
Show resolved Hide resolved
}

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

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 @@ -6449,7 +6449,7 @@ client cluster AccountLogin = 1294 {
}

response struct GetSetupPINResponse = 1 {
char_string setupPIN = 0;
nullable char_string setupPIN = 0;
}

request struct LoginRequest {
Expand All @@ -6458,9 +6458,9 @@ 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;
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;
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;
}
Expand All @@ -6484,11 +6484,11 @@ server cluster AccountLogin = 1294 {
}

response struct GetSetupPINResponse = 1 {
char_string setupPIN = 0;
nullable char_string setupPIN = 0;
}

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

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 @@ -6408,7 +6408,7 @@ client cluster AccountLogin = 1294 {
}

response struct GetSetupPINResponse = 1 {
char_string setupPIN = 0;
nullable char_string setupPIN = 0;
}

request struct LoginRequest {
Expand All @@ -6417,9 +6417,9 @@ 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;
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;
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;
}
Expand All @@ -6443,11 +6443,11 @@ server cluster AccountLogin = 1294 {
}

response struct GetSetupPINResponse = 1 {
char_string setupPIN = 0;
nullable char_string setupPIN = 0;
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void AccountLoginManager::HandleGetSetupPin(CommandResponseHelper<GetSetupPINRes
GetSetupPINResponse response;
ChipLogProgress(Zcl, "temporary account id: %s returning pin: %s", tempAccountIdentifierString.c_str(), mSetupPin);

response.setupPIN = CharSpan::fromCharString(mSetupPin);
response.setupPIN.SetNonNull(CharSpan::fromCharString(mSetupPin));
helper.Success(response);
}

Expand Down Expand Up @@ -93,7 +93,14 @@ void AccountLoginManager::GetSetupPin(char * setupPin, size_t setupPinSize, cons
GetSetupPINResponse pinResponse = mCommandDelegate->FormatGetSetupPINResponse(response, status);
if (status == chip::Protocols::InteractionModel::Status::Success)
{
CopyString(setupPin, setupPinSize, pinResponse.setupPIN);
if (pinResponse.setupPIN.IsNull())
{
setupPin[0] = '\0';
}
else
{
CopyString(setupPin, setupPinSize, pinResponse.setupPIN.Value());
}
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions examples/tv-app/android/java/ContentAppCommandDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,11 @@ GetSetupPINResponseType ContentAppCommandDelegate::FormatGetSetupPINResponse(Jso
std::to_string(to_underlying(app::Clusters::AccountLogin::Commands::GetSetupPINResponse::Fields::kSetupPIN));
if (!value[setupPINFieldId].empty())
{
getSetupPINresponse.setupPIN = CharSpan::fromCharString(value[setupPINFieldId].asCString());
getSetupPINresponse.setupPIN.SetNonNull(CharSpan::fromCharString(value[setupPINFieldId].asCString()));
}
else
{
getSetupPINresponse.setupPIN = "";
getSetupPINresponse.setupPIN.SetNull();
}
return getSetupPINresponse;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ void AccountLoginManager::HandleGetSetupPin(CommandResponseHelper<GetSetupPINRes
GetSetupPINResponse response;
ChipLogProgress(Zcl, "temporary account id: %s returning pin: %s", tempAccountIdentifierString.c_str(), mSetupPin);

response.setupPIN = CharSpan::fromCharString(mSetupPin);
response.setupPIN = chip::app::DataModel::MakeNullable(CharSpan::fromCharString(mSetupPin));
andy31415 marked this conversation as resolved.
Show resolved Hide resolved
helper.Success(response);
}
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 @@ -2416,11 +2416,11 @@ server cluster AccountLogin = 1294 {
}

response struct GetSetupPINResponse = 1 {
char_string setupPIN = 0;
nullable char_string setupPIN = 0;
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1969,7 +1969,7 @@ client cluster AccountLogin = 1294 {
}

response struct GetSetupPINResponse = 1 {
char_string setupPIN = 0;
nullable char_string setupPIN = 0;
}

request struct LoginRequest {
Expand All @@ -1978,9 +1978,9 @@ 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;
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;
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ limitations under the License.

<command source="client" code="0x00" name="GetSetupPIN" 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">
<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>
Expand All @@ -42,7 +44,7 @@ limitations under the License.

<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"/>
<arg name="SetupPIN" type="char_string" isNullable="true"/>
</command>

</cluster>
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 @@ -6392,7 +6392,7 @@ client cluster AccountLogin = 1294 {
}

response struct GetSetupPINResponse = 1 {
char_string setupPIN = 0;
nullable char_string setupPIN = 0;
}

request struct LoginRequest {
Expand All @@ -6401,9 +6401,9 @@ 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;
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;
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27245,7 +27245,7 @@ public void logout(DefaultClusterCallback callback, int timedInvokeTimeoutMs) {
private native void logout(long chipClusterPtr, DefaultClusterCallback callback, @Nullable Integer timedInvokeTimeoutMs);

public interface GetSetupPINResponseCallback {
void onSuccess(String setupPIN);
void onSuccess(@Nullable String setupPIN);
void onError(Exception error);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15196,7 +15196,7 @@ public void setCallbackDelegate(ClusterCommandCallback callback) {
}

@Override
public void onSuccess(String setupPIN) {
public void onSuccess(@Nullable String setupPIN) {
Map<CommandResponseInfo, Object> responseValues = new LinkedHashMap<>();

CommandResponseInfo setupPINResponseValue = new CommandResponseInfo("setupPIN", "String");
Expand Down
9 changes: 8 additions & 1 deletion src/controller/java/zap-generated/CHIPInvokeCallbacks.cpp

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

4 changes: 2 additions & 2 deletions src/controller/python/chip/clusters/Objects.py

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

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

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

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

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

Loading