Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
swan-amazon committed Sep 6, 2024
1 parent 649ce59 commit fcd9b6d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -439,19 +439,15 @@ bool emberAfGeneralCommissioningClusterSetTCAcknowledgementsCallback(

Commands::SetTCAcknowledgementsResponse::Type response;
response.errorCode = CheckTermsAndConditionsAcknowledgementsState(termsAndConditionsProvider, acceptedTermsAndConditions);
CheckSuccess(termsAndConditionsProvider->SetAcceptance(acceptedTermsAndConditions), Failure);

if (CommissioningErrorEnum::kOk == response.errorCode)
if (failSafeContext.IsFailSafeArmed())
{
CheckSuccess(termsAndConditionsProvider->SetAcceptance(acceptedTermsAndConditions), Failure);

if (failSafeContext.IsFailSafeArmed())
{
failSafeContext.SetUpdateTermsAndConditionsHasBeenInvoked();
}
else
{
CheckSuccess(termsAndConditionsProvider->CommitAcceptance(), Failure);
}
failSafeContext.SetUpdateTermsAndConditionsHasBeenInvoked();
}
else
{
CheckSuccess(termsAndConditionsProvider->CommitAcceptance(), Failure);
}

commandObj->AddResponse(commandPath, response);
Expand Down
2 changes: 1 addition & 1 deletion src/python_testing/TC_CGEN_2_5.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# === BEGIN CI TEST ARGUMENTS ===
# test-runner-runs: run1
# test-runner-run/run1/app: ${ALL_CLUSTERS_APP}
# test-runner-run/run1/app: ${TERMS_AND_CONDITIONS_APP}
# test-runner-run/run1/factoryreset: True
# test-runner-run/run1/quiet: True
# test-runner-run/run1/app-args: --KVS kvs1 --trace-to json:${TRACE_APP}.json
Expand Down
10 changes: 9 additions & 1 deletion src/python_testing/TC_CGEN_2_6.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# === BEGIN CI TEST ARGUMENTS ===
# test-runner-runs: run1
# test-runner-run/run1/app: ${ALL_CLUSTERS_APP}
# test-runner-run/run1/app: ${TERMS_AND_CONDITIONS_APP}
# test-runner-run/run1/factoryreset: True
# test-runner-run/run1/quiet: True
# test-runner-run/run1/app-args: --KVS kvs1 --trace-to json:${TRACE_APP}.json
Expand Down Expand Up @@ -81,6 +81,14 @@ async def test_TC_CGEN_2_6(self):
asserts.assert_equal(
resp.errorCode, Clusters.GeneralCommissioning.Enums.CommissioningErrorEnum.kTCAcknowledgementsNotReceived, 'Incorrect error code')

cmd = Clusters.GeneralCommissioning.Commands.SetTCAcknowledgements(1, 0)
resp = await self.th1.SendCommand(nodeid=self.dut_node_id, endpoint=0, payload=cmd, timedRequestTimeoutMs=6000)
asserts.assert_equal(resp.errorCode, Clusters.GeneralCommissioning.Enums.CommissioningErrorEnum.kRequiredTCNotAccepted, 'Incorrect error code')

cmd = Clusters.GeneralCommissioning.Commands.CommissioningComplete()
resp = await self.th1.SendCommand(nodeid=self.dut_node_id, endpoint=0, payload=cmd, timedRequestTimeoutMs=6000)
asserts.assert_equal(
resp.errorCode, Clusters.GeneralCommissioning.Enums.CommissioningErrorEnum.kRequiredTCNotAccepted, 'Incorrect error code')

if __name__ == "__main__":
default_matter_test_main({"pre_commissioning": False})

0 comments on commit fcd9b6d

Please sign in to comment.