From c4cab9cff2413bd2b9142cbed851a02d74841596 Mon Sep 17 00:00:00 2001 From: jmartinez-silabs <67972863+jmartinez-silabs@users.noreply.github.com> Date: Fri, 16 Jul 2021 20:50:31 -0400 Subject: [PATCH] Add Color Control test cases in the test suites (#8444) * Add Test_TC_ColorControl.yaml to add testing of this cluster in the test suites and darwin tests Add the test cases to the test-commands.zapt and cluster-test.zap * Add Test cases for the ColorControl cluster commands --- examples/chip-tool/commands/tests/Commands.h | 5162 +++++++++++++++++ .../chip-tool/templates/tests-commands.zapt | 6 +- src/app/tests/suites/Test_TC_CC_3_4.yaml | 379 ++ src/app/tests/suites/Test_TC_CC_5.yaml | 134 + src/app/tests/suites/Test_TC_CC_6.yaml | 159 + src/app/tests/suites/Test_TC_CC_7.yaml | 203 + 6 files changed, 6042 insertions(+), 1 deletion(-) create mode 100644 src/app/tests/suites/Test_TC_CC_3_4.yaml create mode 100644 src/app/tests/suites/Test_TC_CC_5.yaml create mode 100644 src/app/tests/suites/Test_TC_CC_6.yaml create mode 100644 src/app/tests/suites/Test_TC_CC_7.yaml diff --git a/examples/chip-tool/commands/tests/Commands.h b/examples/chip-tool/commands/tests/Commands.h index d1bf5933f3844a..088c8ba5151162 100644 --- a/examples/chip-tool/commands/tests/Commands.h +++ b/examples/chip-tool/commands/tests/Commands.h @@ -13365,6 +13365,5164 @@ class Test_TC_DM_3_1 : public TestCommand // }; +class Test_TC_CC_3_4 : public TestCommand +{ +public: + Test_TC_CC_3_4() : TestCommand("Test_TC_CC_3_4"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, "Test_TC_CC_3_4: Test complete"); + SetCommandExitStatus(CHIP_NO_ERROR); + } + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + err = TestSendClusterOnOffCommandOn_0(); + break; + case 1: + err = TestSendClusterOnOffCommandReadAttribute_1(); + break; + case 2: + err = TestSendClusterColorControlCommandMoveToHue_2(); + break; + case 3: + err = TestSendClusterColorControlCommandReadAttribute_3(); + break; + case 4: + err = TestSendClusterColorControlCommandMoveToHue_4(); + break; + case 5: + err = TestSendClusterColorControlCommandReadAttribute_5(); + break; + case 6: + err = TestSendClusterColorControlCommandMoveToHue_6(); + break; + case 7: + err = TestSendClusterColorControlCommandReadAttribute_7(); + break; + case 8: + err = TestSendClusterColorControlCommandMoveToHue_8(); + break; + case 9: + err = TestSendClusterColorControlCommandReadAttribute_9(); + break; + case 10: + err = TestSendClusterColorControlCommandMoveHue_10(); + break; + case 11: + err = TestSendClusterColorControlCommandReadAttribute_11(); + break; + case 12: + err = TestSendClusterColorControlCommandMoveHue_12(); + break; + case 13: + err = TestSendClusterColorControlCommandReadAttribute_13(); + break; + case 14: + err = TestSendClusterColorControlCommandMoveHue_14(); + break; + case 15: + err = TestSendClusterColorControlCommandReadAttribute_15(); + break; + case 16: + err = TestSendClusterColorControlCommandMoveHue_16(); + break; + case 17: + err = TestSendClusterColorControlCommandReadAttribute_17(); + break; + case 18: + err = TestSendClusterColorControlCommandStepHue_18(); + break; + case 19: + err = TestSendClusterColorControlCommandReadAttribute_19(); + break; + case 20: + err = TestSendClusterColorControlCommandStepHue_20(); + break; + case 21: + err = TestSendClusterColorControlCommandReadAttribute_21(); + break; + case 22: + err = TestSendClusterColorControlCommandReadAttribute_22(); + break; + case 23: + err = TestSendClusterColorControlCommandMoveToSaturation_23(); + break; + case 24: + err = TestSendClusterColorControlCommandReadAttribute_24(); + break; + case 25: + err = TestSendClusterColorControlCommandMoveSaturation_25(); + break; + case 26: + err = TestSendClusterColorControlCommandReadAttribute_26(); + break; + case 27: + err = TestSendClusterColorControlCommandMoveSaturation_27(); + break; + case 28: + err = TestSendClusterColorControlCommandReadAttribute_28(); + break; + case 29: + err = TestSendClusterColorControlCommandStepSaturation_29(); + break; + case 30: + err = TestSendClusterColorControlCommandReadAttribute_30(); + break; + case 31: + err = TestSendClusterColorControlCommandStepSaturation_31(); + break; + case 32: + err = TestSendClusterColorControlCommandReadAttribute_32(); + break; + case 33: + err = TestSendClusterColorControlCommandMoveToHueAndSaturation_33(); + break; + case 34: + err = TestSendClusterColorControlCommandReadAttribute_34(); + break; + case 35: + err = TestSendClusterColorControlCommandReadAttribute_35(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogProgress(chipTool, "Test_TC_CC_3_4: %s", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 36; + + // + // Tests methods + // + + // Test Turn on light for color control tests + using SuccessCallback_0 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_0{ OnTestSendClusterOnOffCommandOn_0_SuccessResponse, this }; + chip::Callback::Callback mOnFailureCallback_0{ OnTestSendClusterOnOffCommandOn_0_FailureResponse, + this }; + bool mIsFailureExpected_0 = 0; + + CHIP_ERROR TestSendClusterOnOffCommandOn_0() + { + ChipLogProgress(chipTool, "On/Off - Turn on light for color control tests: Sending command..."); + + chip::Controller::OnOffCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.On(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + + return err; + } + + static void OnTestSendClusterOnOffCommandOn_0_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "On/Off - Turn on light for color control tests: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_0 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterOnOffCommandOn_0_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "On/Off - Turn on light for color control tests: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_0 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check on/off attribute value is true after on command + using SuccessCallback_1 = void (*)(void * context, uint8_t onOff); + chip::Callback::Callback mOnSuccessCallback_1{ OnTestSendClusterOnOffCommandReadAttribute_1_SuccessResponse, + this }; + chip::Callback::Callback mOnFailureCallback_1{ + OnTestSendClusterOnOffCommandReadAttribute_1_FailureResponse, this + }; + bool mIsFailureExpected_1 = 0; + + CHIP_ERROR TestSendClusterOnOffCommandReadAttribute_1() + { + ChipLogProgress(chipTool, "On/Off - Check on/off attribute value is true after on command: Sending command..."); + + chip::Controller::OnOffCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + + return err; + } + + static void OnTestSendClusterOnOffCommandReadAttribute_1_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "On/Off - Check on/off attribute value is true after on command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_1 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterOnOffCommandReadAttribute_1_SuccessResponse(void * context, uint8_t onOff) + { + ChipLogProgress(chipTool, "On/Off - Check on/off attribute value is true after on command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_1 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + if (onOff != 1) + { + ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "1"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Move to hue shortest distance command + using SuccessCallback_2 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_2{ + OnTestSendClusterColorControlCommandMoveToHue_2_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_2{ + OnTestSendClusterColorControlCommandMoveToHue_2_FailureResponse, this + }; + bool mIsFailureExpected_2 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandMoveToHue_2() + { + ChipLogProgress(chipTool, "Color Control - Move to hue shortest distance command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t hueArgument = 150; + uint8_t directionArgument = 0; + uint16_t transitionTimeArgument = 100U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.MoveToHue(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel(), hueArgument, directionArgument, + transitionTimeArgument, optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandMoveToHue_2_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Move to hue shortest distance command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_2 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandMoveToHue_2_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Move to hue shortest distance command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_2 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check current hue attribute value matched the value sent by the last command + using SuccessCallback_3 = void (*)(void * context, uint8_t currentHue); + chip::Callback::Callback mOnSuccessCallback_3{ + OnTestSendClusterColorControlCommandReadAttribute_3_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_3{ + OnTestSendClusterColorControlCommandReadAttribute_3_FailureResponse, this + }; + bool mIsFailureExpected_3 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_3() + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentHue(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_3_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_3 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_3_SuccessResponse(void * context, uint8_t currentHue) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_3 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Move to hue longest distance command + using SuccessCallback_4 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_4{ + OnTestSendClusterColorControlCommandMoveToHue_4_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_4{ + OnTestSendClusterColorControlCommandMoveToHue_4_FailureResponse, this + }; + bool mIsFailureExpected_4 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandMoveToHue_4() + { + ChipLogProgress(chipTool, "Color Control - Move to hue longest distance command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t hueArgument = 200; + uint8_t directionArgument = 1; + uint16_t transitionTimeArgument = 100U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.MoveToHue(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel(), hueArgument, directionArgument, + transitionTimeArgument, optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandMoveToHue_4_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Move to hue longest distance command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_4 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandMoveToHue_4_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Move to hue longest distance command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_4 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check current hue attribute value matched the value sent by the last command + using SuccessCallback_5 = void (*)(void * context, uint8_t currentHue); + chip::Callback::Callback mOnSuccessCallback_5{ + OnTestSendClusterColorControlCommandReadAttribute_5_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_5{ + OnTestSendClusterColorControlCommandReadAttribute_5_FailureResponse, this + }; + bool mIsFailureExpected_5 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_5() + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentHue(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_5_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_5 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_5_SuccessResponse(void * context, uint8_t currentHue) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_5 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Move to hue up command + using SuccessCallback_6 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_6{ + OnTestSendClusterColorControlCommandMoveToHue_6_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_6{ + OnTestSendClusterColorControlCommandMoveToHue_6_FailureResponse, this + }; + bool mIsFailureExpected_6 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandMoveToHue_6() + { + ChipLogProgress(chipTool, "Color Control - Move to hue up command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t hueArgument = 250; + uint8_t directionArgument = 2; + uint16_t transitionTimeArgument = 100U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.MoveToHue(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel(), hueArgument, directionArgument, + transitionTimeArgument, optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandMoveToHue_6_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Move to hue up command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_6 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandMoveToHue_6_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Move to hue up command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_6 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check current hue attribute value matched the value sent by the last command + using SuccessCallback_7 = void (*)(void * context, uint8_t currentHue); + chip::Callback::Callback mOnSuccessCallback_7{ + OnTestSendClusterColorControlCommandReadAttribute_7_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_7{ + OnTestSendClusterColorControlCommandReadAttribute_7_FailureResponse, this + }; + bool mIsFailureExpected_7 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_7() + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentHue(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_7_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_7 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_7_SuccessResponse(void * context, uint8_t currentHue) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_7 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Move to hue down command + using SuccessCallback_8 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_8{ + OnTestSendClusterColorControlCommandMoveToHue_8_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_8{ + OnTestSendClusterColorControlCommandMoveToHue_8_FailureResponse, this + }; + bool mIsFailureExpected_8 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandMoveToHue_8() + { + ChipLogProgress(chipTool, "Color Control - Move to hue down command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t hueArgument = 225; + uint8_t directionArgument = 3; + uint16_t transitionTimeArgument = 100U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.MoveToHue(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel(), hueArgument, directionArgument, + transitionTimeArgument, optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandMoveToHue_8_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Move to hue down command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_8 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandMoveToHue_8_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Move to hue down command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_8 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check current hue attribute value matched the value sent by the last command + using SuccessCallback_9 = void (*)(void * context, uint8_t currentHue); + chip::Callback::Callback mOnSuccessCallback_9{ + OnTestSendClusterColorControlCommandReadAttribute_9_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_9{ + OnTestSendClusterColorControlCommandReadAttribute_9_FailureResponse, this + }; + bool mIsFailureExpected_9 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_9() + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentHue(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_9_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_9 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_9_SuccessResponse(void * context, uint8_t currentHue) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_9 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Move hue up command + using SuccessCallback_10 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_10{ + OnTestSendClusterColorControlCommandMoveHue_10_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_10{ + OnTestSendClusterColorControlCommandMoveHue_10_FailureResponse, this + }; + bool mIsFailureExpected_10 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandMoveHue_10() + { + ChipLogProgress(chipTool, "Color Control - Move hue up command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t moveModeArgument = 1; + uint8_t rateArgument = 50; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.MoveHue(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel(), moveModeArgument, rateArgument, + optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandMoveHue_10_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Move hue up command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_10 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandMoveHue_10_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Move hue up command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_10 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check current hue attribute value matched the value sent by the last command + using SuccessCallback_11 = void (*)(void * context, uint8_t currentHue); + chip::Callback::Callback mOnSuccessCallback_11{ + OnTestSendClusterColorControlCommandReadAttribute_11_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_11{ + OnTestSendClusterColorControlCommandReadAttribute_11_FailureResponse, this + }; + bool mIsFailureExpected_11 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_11() + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentHue(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_11_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_11 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_11_SuccessResponse(void * context, uint8_t currentHue) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_11 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Move hue stop command + using SuccessCallback_12 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_12{ + OnTestSendClusterColorControlCommandMoveHue_12_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_12{ + OnTestSendClusterColorControlCommandMoveHue_12_FailureResponse, this + }; + bool mIsFailureExpected_12 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandMoveHue_12() + { + ChipLogProgress(chipTool, "Color Control - Move hue stop command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t moveModeArgument = 0; + uint8_t rateArgument = 50; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.MoveHue(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel(), moveModeArgument, rateArgument, + optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandMoveHue_12_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Move hue stop command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_12 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandMoveHue_12_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Move hue stop command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_12 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check current hue attribute value matched the value sent by the last command + using SuccessCallback_13 = void (*)(void * context, uint8_t currentHue); + chip::Callback::Callback mOnSuccessCallback_13{ + OnTestSendClusterColorControlCommandReadAttribute_13_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_13{ + OnTestSendClusterColorControlCommandReadAttribute_13_FailureResponse, this + }; + bool mIsFailureExpected_13 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_13() + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentHue(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_13_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_13 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_13_SuccessResponse(void * context, uint8_t currentHue) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_13 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Move hue down command + using SuccessCallback_14 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_14{ + OnTestSendClusterColorControlCommandMoveHue_14_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_14{ + OnTestSendClusterColorControlCommandMoveHue_14_FailureResponse, this + }; + bool mIsFailureExpected_14 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandMoveHue_14() + { + ChipLogProgress(chipTool, "Color Control - Move hue down command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t moveModeArgument = 3; + uint8_t rateArgument = 50; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.MoveHue(mOnSuccessCallback_14.Cancel(), mOnFailureCallback_14.Cancel(), moveModeArgument, rateArgument, + optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandMoveHue_14_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Move hue down command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_14 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandMoveHue_14_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Move hue down command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_14 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check current hue attribute value matched the value sent by the last command + using SuccessCallback_15 = void (*)(void * context, uint8_t currentHue); + chip::Callback::Callback mOnSuccessCallback_15{ + OnTestSendClusterColorControlCommandReadAttribute_15_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_15{ + OnTestSendClusterColorControlCommandReadAttribute_15_FailureResponse, this + }; + bool mIsFailureExpected_15 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_15() + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentHue(mOnSuccessCallback_15.Cancel(), mOnFailureCallback_15.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_15_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_15 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_15_SuccessResponse(void * context, uint8_t currentHue) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_15 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Move hue stop command + using SuccessCallback_16 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_16{ + OnTestSendClusterColorControlCommandMoveHue_16_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_16{ + OnTestSendClusterColorControlCommandMoveHue_16_FailureResponse, this + }; + bool mIsFailureExpected_16 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandMoveHue_16() + { + ChipLogProgress(chipTool, "Color Control - Move hue stop command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t moveModeArgument = 0; + uint8_t rateArgument = 50; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.MoveHue(mOnSuccessCallback_16.Cancel(), mOnFailureCallback_16.Cancel(), moveModeArgument, rateArgument, + optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandMoveHue_16_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Move hue stop command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_16 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandMoveHue_16_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Move hue stop command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_16 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check current hue attribute value matched the value sent by the last command + using SuccessCallback_17 = void (*)(void * context, uint8_t currentHue); + chip::Callback::Callback mOnSuccessCallback_17{ + OnTestSendClusterColorControlCommandReadAttribute_17_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_17{ + OnTestSendClusterColorControlCommandReadAttribute_17_FailureResponse, this + }; + bool mIsFailureExpected_17 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_17() + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentHue(mOnSuccessCallback_17.Cancel(), mOnFailureCallback_17.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_17_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_17 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_17_SuccessResponse(void * context, uint8_t currentHue) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_17 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Step hue up command + using SuccessCallback_18 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_18{ + OnTestSendClusterColorControlCommandStepHue_18_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_18{ + OnTestSendClusterColorControlCommandStepHue_18_FailureResponse, this + }; + bool mIsFailureExpected_18 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandStepHue_18() + { + ChipLogProgress(chipTool, "Color Control - Step hue up command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t stepModeArgument = 1; + uint8_t stepSizeArgument = 5; + uint8_t transitionTimeArgument = 25; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.StepHue(mOnSuccessCallback_18.Cancel(), mOnFailureCallback_18.Cancel(), stepModeArgument, stepSizeArgument, + transitionTimeArgument, optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandStepHue_18_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Step hue up command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_18 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandStepHue_18_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Step hue up command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_18 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check current hue attribute value matched the value sent by the last command + using SuccessCallback_19 = void (*)(void * context, uint8_t currentHue); + chip::Callback::Callback mOnSuccessCallback_19{ + OnTestSendClusterColorControlCommandReadAttribute_19_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_19{ + OnTestSendClusterColorControlCommandReadAttribute_19_FailureResponse, this + }; + bool mIsFailureExpected_19 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_19() + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentHue(mOnSuccessCallback_19.Cancel(), mOnFailureCallback_19.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_19_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_19 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_19_SuccessResponse(void * context, uint8_t currentHue) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_19 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Step hue down command + using SuccessCallback_20 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_20{ + OnTestSendClusterColorControlCommandStepHue_20_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_20{ + OnTestSendClusterColorControlCommandStepHue_20_FailureResponse, this + }; + bool mIsFailureExpected_20 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandStepHue_20() + { + ChipLogProgress(chipTool, "Color Control - Step hue down command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t stepModeArgument = 3; + uint8_t stepSizeArgument = 5; + uint8_t transitionTimeArgument = 25; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.StepHue(mOnSuccessCallback_20.Cancel(), mOnFailureCallback_20.Cancel(), stepModeArgument, stepSizeArgument, + transitionTimeArgument, optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandStepHue_20_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Step hue down command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_20 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandStepHue_20_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Step hue down command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_20 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check current hue attribute value matched the value sent by the last command + using SuccessCallback_21 = void (*)(void * context, uint8_t currentHue); + chip::Callback::Callback mOnSuccessCallback_21{ + OnTestSendClusterColorControlCommandReadAttribute_21_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_21{ + OnTestSendClusterColorControlCommandReadAttribute_21_FailureResponse, this + }; + bool mIsFailureExpected_21 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_21() + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentHue(mOnSuccessCallback_21.Cancel(), mOnFailureCallback_21.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_21_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_21 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_21_SuccessResponse(void * context, uint8_t currentHue) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_21 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check Saturation attribute value matched before any change + using SuccessCallback_22 = void (*)(void * context, uint8_t currentSaturation); + chip::Callback::Callback mOnSuccessCallback_22{ + OnTestSendClusterColorControlCommandReadAttribute_22_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_22{ + OnTestSendClusterColorControlCommandReadAttribute_22_FailureResponse, this + }; + bool mIsFailureExpected_22 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_22() + { + ChipLogProgress(chipTool, "Color Control - Check Saturation attribute value matched before any change: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentSaturation(mOnSuccessCallback_22.Cancel(), mOnFailureCallback_22.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_22_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Check Saturation attribute value matched before any change: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_22 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_22_SuccessResponse(void * context, uint8_t currentSaturation) + { + ChipLogProgress(chipTool, "Color Control - Check Saturation attribute value matched before any change: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_22 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Move to saturation command + using SuccessCallback_23 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_23{ + OnTestSendClusterColorControlCommandMoveToSaturation_23_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_23{ + OnTestSendClusterColorControlCommandMoveToSaturation_23_FailureResponse, this + }; + bool mIsFailureExpected_23 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandMoveToSaturation_23() + { + ChipLogProgress(chipTool, "Color Control - Move to saturation command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t saturationArgument = 90; + uint16_t transitionTimeArgument = 10U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.MoveToSaturation(mOnSuccessCallback_23.Cancel(), mOnFailureCallback_23.Cancel(), saturationArgument, + transitionTimeArgument, optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandMoveToSaturation_23_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Move to saturation command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_23 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandMoveToSaturation_23_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Move to saturation command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_23 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check Saturation attribute value matched the value sent by the last command + using SuccessCallback_24 = void (*)(void * context, uint8_t currentSaturation); + chip::Callback::Callback mOnSuccessCallback_24{ + OnTestSendClusterColorControlCommandReadAttribute_24_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_24{ + OnTestSendClusterColorControlCommandReadAttribute_24_FailureResponse, this + }; + bool mIsFailureExpected_24 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_24() + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentSaturation(mOnSuccessCallback_24.Cancel(), mOnFailureCallback_24.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_24_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_24 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_24_SuccessResponse(void * context, uint8_t currentSaturation) + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_24 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Move saturation up command + using SuccessCallback_25 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_25{ + OnTestSendClusterColorControlCommandMoveSaturation_25_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_25{ + OnTestSendClusterColorControlCommandMoveSaturation_25_FailureResponse, this + }; + bool mIsFailureExpected_25 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandMoveSaturation_25() + { + ChipLogProgress(chipTool, "Color Control - Move saturation up command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t moveModeArgument = 1; + uint8_t rateArgument = 5; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.MoveSaturation(mOnSuccessCallback_25.Cancel(), mOnFailureCallback_25.Cancel(), moveModeArgument, rateArgument, + optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandMoveSaturation_25_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Move saturation up command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_25 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandMoveSaturation_25_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Move saturation up command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_25 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check Saturation attribute value matched the value sent by the last command + using SuccessCallback_26 = void (*)(void * context, uint8_t currentSaturation); + chip::Callback::Callback mOnSuccessCallback_26{ + OnTestSendClusterColorControlCommandReadAttribute_26_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_26{ + OnTestSendClusterColorControlCommandReadAttribute_26_FailureResponse, this + }; + bool mIsFailureExpected_26 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_26() + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentSaturation(mOnSuccessCallback_26.Cancel(), mOnFailureCallback_26.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_26_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_26 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_26_SuccessResponse(void * context, uint8_t currentSaturation) + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_26 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Move saturation down command + using SuccessCallback_27 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_27{ + OnTestSendClusterColorControlCommandMoveSaturation_27_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_27{ + OnTestSendClusterColorControlCommandMoveSaturation_27_FailureResponse, this + }; + bool mIsFailureExpected_27 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandMoveSaturation_27() + { + ChipLogProgress(chipTool, "Color Control - Move saturation down command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t moveModeArgument = 3; + uint8_t rateArgument = 5; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.MoveSaturation(mOnSuccessCallback_27.Cancel(), mOnFailureCallback_27.Cancel(), moveModeArgument, rateArgument, + optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandMoveSaturation_27_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Move saturation down command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_27 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandMoveSaturation_27_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Move saturation down command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_27 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check Saturation attribute value matched the value sent by the last command + using SuccessCallback_28 = void (*)(void * context, uint8_t currentSaturation); + chip::Callback::Callback mOnSuccessCallback_28{ + OnTestSendClusterColorControlCommandReadAttribute_28_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_28{ + OnTestSendClusterColorControlCommandReadAttribute_28_FailureResponse, this + }; + bool mIsFailureExpected_28 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_28() + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentSaturation(mOnSuccessCallback_28.Cancel(), mOnFailureCallback_28.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_28_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_28 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_28_SuccessResponse(void * context, uint8_t currentSaturation) + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_28 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Step saturation up command + using SuccessCallback_29 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_29{ + OnTestSendClusterColorControlCommandStepSaturation_29_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_29{ + OnTestSendClusterColorControlCommandStepSaturation_29_FailureResponse, this + }; + bool mIsFailureExpected_29 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandStepSaturation_29() + { + ChipLogProgress(chipTool, "Color Control - Step saturation up command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t stepModeArgument = 1; + uint8_t stepSizeArgument = 15; + uint8_t transitionTimeArgument = 10; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.StepSaturation(mOnSuccessCallback_29.Cancel(), mOnFailureCallback_29.Cancel(), stepModeArgument, + stepSizeArgument, transitionTimeArgument, optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandStepSaturation_29_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Step saturation up command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_29 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandStepSaturation_29_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Step saturation up command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_29 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check Saturation attribute value matched the value sent by the last command + using SuccessCallback_30 = void (*)(void * context, uint8_t currentSaturation); + chip::Callback::Callback mOnSuccessCallback_30{ + OnTestSendClusterColorControlCommandReadAttribute_30_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_30{ + OnTestSendClusterColorControlCommandReadAttribute_30_FailureResponse, this + }; + bool mIsFailureExpected_30 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_30() + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentSaturation(mOnSuccessCallback_30.Cancel(), mOnFailureCallback_30.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_30_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_30 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_30_SuccessResponse(void * context, uint8_t currentSaturation) + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_30 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Step saturation down command + using SuccessCallback_31 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_31{ + OnTestSendClusterColorControlCommandStepSaturation_31_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_31{ + OnTestSendClusterColorControlCommandStepSaturation_31_FailureResponse, this + }; + bool mIsFailureExpected_31 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandStepSaturation_31() + { + ChipLogProgress(chipTool, "Color Control - Step saturation down command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t stepModeArgument = 3; + uint8_t stepSizeArgument = 20; + uint8_t transitionTimeArgument = 10; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.StepSaturation(mOnSuccessCallback_31.Cancel(), mOnFailureCallback_31.Cancel(), stepModeArgument, + stepSizeArgument, transitionTimeArgument, optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandStepSaturation_31_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Step saturation down command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_31 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandStepSaturation_31_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Step saturation down command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_31 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check Saturation attribute value matched the value sent by the last command + using SuccessCallback_32 = void (*)(void * context, uint8_t currentSaturation); + chip::Callback::Callback mOnSuccessCallback_32{ + OnTestSendClusterColorControlCommandReadAttribute_32_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_32{ + OnTestSendClusterColorControlCommandReadAttribute_32_FailureResponse, this + }; + bool mIsFailureExpected_32 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_32() + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentSaturation(mOnSuccessCallback_32.Cancel(), mOnFailureCallback_32.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_32_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_32 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_32_SuccessResponse(void * context, uint8_t currentSaturation) + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_32 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Move To current hue and saturation command + using SuccessCallback_33 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_33{ + OnTestSendClusterColorControlCommandMoveToHueAndSaturation_33_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_33{ + OnTestSendClusterColorControlCommandMoveToHueAndSaturation_33_FailureResponse, this + }; + bool mIsFailureExpected_33 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandMoveToHueAndSaturation_33() + { + ChipLogProgress(chipTool, "Color Control - Move To current hue and saturation command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t hueArgument = 40; + uint8_t saturationArgument = 160; + uint16_t transitionTimeArgument = 10U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.MoveToHueAndSaturation(mOnSuccessCallback_33.Cancel(), mOnFailureCallback_33.Cancel(), hueArgument, + saturationArgument, transitionTimeArgument, optionsMaskArgument, + optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandMoveToHueAndSaturation_33_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Move To current hue and saturation command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_33 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandMoveToHueAndSaturation_33_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Move To current hue and saturation command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_33 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check current hue attribute value matched the value sent by the last command + using SuccessCallback_34 = void (*)(void * context, uint8_t currentHue); + chip::Callback::Callback mOnSuccessCallback_34{ + OnTestSendClusterColorControlCommandReadAttribute_34_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_34{ + OnTestSendClusterColorControlCommandReadAttribute_34_FailureResponse, this + }; + bool mIsFailureExpected_34 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_34() + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentHue(mOnSuccessCallback_34.Cancel(), mOnFailureCallback_34.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_34_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_34 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_34_SuccessResponse(void * context, uint8_t currentHue) + { + ChipLogProgress( + chipTool, + "Color Control - Check current hue attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_34 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check Saturation attribute value matched the value sent by the last command + using SuccessCallback_35 = void (*)(void * context, uint8_t currentSaturation); + chip::Callback::Callback mOnSuccessCallback_35{ + OnTestSendClusterColorControlCommandReadAttribute_35_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_35{ + OnTestSendClusterColorControlCommandReadAttribute_35_FailureResponse, this + }; + bool mIsFailureExpected_35 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_35() + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentSaturation(mOnSuccessCallback_35.Cancel(), mOnFailureCallback_35.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_35_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_35 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_35_SuccessResponse(void * context, uint8_t currentSaturation) + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_3_4 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_35 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } +}; + +class Test_TC_CC_5 : public TestCommand +{ +public: + Test_TC_CC_5() : TestCommand("Test_TC_CC_5"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, "Test_TC_CC_5: Test complete"); + SetCommandExitStatus(CHIP_NO_ERROR); + } + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + err = TestSendClusterOnOffCommandOn_0(); + break; + case 1: + err = TestSendClusterOnOffCommandReadAttribute_1(); + break; + case 2: + err = TestSendClusterColorControlCommandMoveToColor_2(); + break; + case 3: + err = TestSendClusterColorControlCommandReadAttribute_3(); + break; + case 4: + err = TestSendClusterColorControlCommandReadAttribute_4(); + break; + case 5: + err = TestSendClusterColorControlCommandMoveColor_5(); + break; + case 6: + err = TestSendClusterColorControlCommandReadAttribute_6(); + break; + case 7: + err = TestSendClusterColorControlCommandReadAttribute_7(); + break; + case 8: + err = TestSendClusterColorControlCommandStopMoveStep_8(); + break; + case 9: + err = TestSendClusterColorControlCommandReadAttribute_9(); + break; + case 10: + err = TestSendClusterColorControlCommandReadAttribute_10(); + break; + case 11: + err = TestSendClusterColorControlCommandStepColor_11(); + break; + case 12: + err = TestSendClusterColorControlCommandReadAttribute_12(); + break; + case 13: + err = TestSendClusterColorControlCommandReadAttribute_13(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogProgress(chipTool, "Test_TC_CC_5: %s", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 14; + + // + // Tests methods + // + + // Test Turn on light for color control tests + using SuccessCallback_0 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_0{ OnTestSendClusterOnOffCommandOn_0_SuccessResponse, this }; + chip::Callback::Callback mOnFailureCallback_0{ OnTestSendClusterOnOffCommandOn_0_FailureResponse, + this }; + bool mIsFailureExpected_0 = 0; + + CHIP_ERROR TestSendClusterOnOffCommandOn_0() + { + ChipLogProgress(chipTool, "On/Off - Turn on light for color control tests: Sending command..."); + + chip::Controller::OnOffCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.On(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + + return err; + } + + static void OnTestSendClusterOnOffCommandOn_0_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "On/Off - Turn on light for color control tests: Failure Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_0 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterOnOffCommandOn_0_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "On/Off - Turn on light for color control tests: Success Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_0 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check on/off attribute value is true after on command + using SuccessCallback_1 = void (*)(void * context, uint8_t onOff); + chip::Callback::Callback mOnSuccessCallback_1{ OnTestSendClusterOnOffCommandReadAttribute_1_SuccessResponse, + this }; + chip::Callback::Callback mOnFailureCallback_1{ + OnTestSendClusterOnOffCommandReadAttribute_1_FailureResponse, this + }; + bool mIsFailureExpected_1 = 0; + + CHIP_ERROR TestSendClusterOnOffCommandReadAttribute_1() + { + ChipLogProgress(chipTool, "On/Off - Check on/off attribute value is true after on command: Sending command..."); + + chip::Controller::OnOffCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + + return err; + } + + static void OnTestSendClusterOnOffCommandReadAttribute_1_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "On/Off - Check on/off attribute value is true after on command: Failure Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_1 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterOnOffCommandReadAttribute_1_SuccessResponse(void * context, uint8_t onOff) + { + ChipLogProgress(chipTool, "On/Off - Check on/off attribute value is true after on command: Success Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_1 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + if (onOff != 1) + { + ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "1"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Move to Color command + using SuccessCallback_2 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_2{ + OnTestSendClusterColorControlCommandMoveToColor_2_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_2{ + OnTestSendClusterColorControlCommandMoveToColor_2_FailureResponse, this + }; + bool mIsFailureExpected_2 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandMoveToColor_2() + { + ChipLogProgress(chipTool, "Color Control - Move to Color command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint16_t colorXArgument = 200U; + uint16_t colorYArgument = 300U; + uint16_t transitionTimeArgument = 20U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.MoveToColor(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel(), colorXArgument, colorYArgument, + transitionTimeArgument, optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandMoveToColor_2_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Move to Color command: Failure Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_2 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandMoveToColor_2_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Move to Color command: Success Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_2 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check current y attribute value matched the value sent by the last command + using SuccessCallback_3 = void (*)(void * context, uint16_t currentX); + chip::Callback::Callback mOnSuccessCallback_3{ + OnTestSendClusterColorControlCommandReadAttribute_3_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_3{ + OnTestSendClusterColorControlCommandReadAttribute_3_FailureResponse, this + }; + bool mIsFailureExpected_3 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_3() + { + ChipLogProgress( + chipTool, + "Color Control - Check current y attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentX(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_3_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check current y attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_3 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_3_SuccessResponse(void * context, uint16_t currentX) + { + ChipLogProgress( + chipTool, + "Color Control - Check current y attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_3 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check current x attribute value matched the value sent by the last command + using SuccessCallback_4 = void (*)(void * context, uint16_t currentY); + chip::Callback::Callback mOnSuccessCallback_4{ + OnTestSendClusterColorControlCommandReadAttribute_4_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_4{ + OnTestSendClusterColorControlCommandReadAttribute_4_FailureResponse, this + }; + bool mIsFailureExpected_4 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_4() + { + ChipLogProgress( + chipTool, + "Color Control - Check current x attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentY(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_4_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check current x attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_4 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_4_SuccessResponse(void * context, uint16_t currentY) + { + ChipLogProgress( + chipTool, + "Color Control - Check current x attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_4 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Move Color command + using SuccessCallback_5 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_5{ + OnTestSendClusterColorControlCommandMoveColor_5_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_5{ + OnTestSendClusterColorControlCommandMoveColor_5_FailureResponse, this + }; + bool mIsFailureExpected_5 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandMoveColor_5() + { + ChipLogProgress(chipTool, "Color Control - Move Color command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + int16_t rateXArgument = 15; + int16_t rateYArgument = 20; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.MoveColor(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel(), rateXArgument, rateYArgument, + optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandMoveColor_5_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Move Color command: Failure Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_5 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandMoveColor_5_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Move Color command: Success Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_5 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check current x attribute value matched the value sent by the last command + using SuccessCallback_6 = void (*)(void * context, uint16_t currentX); + chip::Callback::Callback mOnSuccessCallback_6{ + OnTestSendClusterColorControlCommandReadAttribute_6_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_6{ + OnTestSendClusterColorControlCommandReadAttribute_6_FailureResponse, this + }; + bool mIsFailureExpected_6 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_6() + { + ChipLogProgress( + chipTool, + "Color Control - Check current x attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentX(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_6_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check current x attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_6 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_6_SuccessResponse(void * context, uint16_t currentX) + { + ChipLogProgress( + chipTool, + "Color Control - Check current x attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_6 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check current y attribute value matched the value sent by the last command + using SuccessCallback_7 = void (*)(void * context, uint16_t currentY); + chip::Callback::Callback mOnSuccessCallback_7{ + OnTestSendClusterColorControlCommandReadAttribute_7_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_7{ + OnTestSendClusterColorControlCommandReadAttribute_7_FailureResponse, this + }; + bool mIsFailureExpected_7 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_7() + { + ChipLogProgress( + chipTool, + "Color Control - Check current y attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentY(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_7_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check current y attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_7 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_7_SuccessResponse(void * context, uint16_t currentY) + { + ChipLogProgress( + chipTool, + "Color Control - Check current y attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_7 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Stop Move Step command + using SuccessCallback_8 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_8{ + OnTestSendClusterColorControlCommandStopMoveStep_8_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_8{ + OnTestSendClusterColorControlCommandStopMoveStep_8_FailureResponse, this + }; + bool mIsFailureExpected_8 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandStopMoveStep_8() + { + ChipLogProgress(chipTool, "Color Control - Stop Move Step command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.StopMoveStep(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel(), optionsMaskArgument, + optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandStopMoveStep_8_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Stop Move Step command: Failure Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_8 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandStopMoveStep_8_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Stop Move Step command: Success Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_8 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check current x attribute value matched the value sent by the last command + using SuccessCallback_9 = void (*)(void * context, uint16_t currentX); + chip::Callback::Callback mOnSuccessCallback_9{ + OnTestSendClusterColorControlCommandReadAttribute_9_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_9{ + OnTestSendClusterColorControlCommandReadAttribute_9_FailureResponse, this + }; + bool mIsFailureExpected_9 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_9() + { + ChipLogProgress( + chipTool, + "Color Control - Check current x attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentX(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_9_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check current x attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_9 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_9_SuccessResponse(void * context, uint16_t currentX) + { + ChipLogProgress( + chipTool, + "Color Control - Check current x attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_9 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check current y attribute value matched the value sent by the last command + using SuccessCallback_10 = void (*)(void * context, uint16_t currentY); + chip::Callback::Callback mOnSuccessCallback_10{ + OnTestSendClusterColorControlCommandReadAttribute_10_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_10{ + OnTestSendClusterColorControlCommandReadAttribute_10_FailureResponse, this + }; + bool mIsFailureExpected_10 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_10() + { + ChipLogProgress( + chipTool, + "Color Control - Check current y attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentY(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_10_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check current y attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_10 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_10_SuccessResponse(void * context, uint16_t currentY) + { + ChipLogProgress( + chipTool, + "Color Control - Check current y attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_10 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Step Color command + using SuccessCallback_11 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_11{ + OnTestSendClusterColorControlCommandStepColor_11_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_11{ + OnTestSendClusterColorControlCommandStepColor_11_FailureResponse, this + }; + bool mIsFailureExpected_11 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandStepColor_11() + { + ChipLogProgress(chipTool, "Color Control - Step Color command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + int16_t stepXArgument = 15; + int16_t stepYArgument = 20; + uint16_t transitionTimeArgument = 50U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.StepColor(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel(), stepXArgument, stepYArgument, + transitionTimeArgument, optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandStepColor_11_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Step Color command: Failure Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_11 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandStepColor_11_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Step Color command: Success Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_11 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check current x attribute value matched the value sent by the last command + using SuccessCallback_12 = void (*)(void * context, uint16_t currentX); + chip::Callback::Callback mOnSuccessCallback_12{ + OnTestSendClusterColorControlCommandReadAttribute_12_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_12{ + OnTestSendClusterColorControlCommandReadAttribute_12_FailureResponse, this + }; + bool mIsFailureExpected_12 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_12() + { + ChipLogProgress( + chipTool, + "Color Control - Check current x attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentX(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_12_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check current x attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_12 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_12_SuccessResponse(void * context, uint16_t currentX) + { + ChipLogProgress( + chipTool, + "Color Control - Check current x attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_12 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check current y attribute value matched the value sent by the last command + using SuccessCallback_13 = void (*)(void * context, uint16_t currentY); + chip::Callback::Callback mOnSuccessCallback_13{ + OnTestSendClusterColorControlCommandReadAttribute_13_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_13{ + OnTestSendClusterColorControlCommandReadAttribute_13_FailureResponse, this + }; + bool mIsFailureExpected_13 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_13() + { + ChipLogProgress( + chipTool, + "Color Control - Check current y attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentY(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_13_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check current y attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_13 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_13_SuccessResponse(void * context, uint16_t currentY) + { + ChipLogProgress( + chipTool, + "Color Control - Check current y attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_5 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_13 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } +}; + +class Test_TC_CC_6 : public TestCommand +{ +public: + Test_TC_CC_6() : TestCommand("Test_TC_CC_6"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, "Test_TC_CC_6: Test complete"); + SetCommandExitStatus(CHIP_NO_ERROR); + } + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + err = TestSendClusterOnOffCommandOn_0(); + break; + case 1: + err = TestSendClusterOnOffCommandReadAttribute_1(); + break; + case 2: + err = TestSendClusterColorControlCommandMoveToColorTemperature_2(); + break; + case 3: + err = TestSendClusterColorControlCommandReadAttribute_3(); + break; + case 4: + err = TestSendClusterColorControlCommandMoveColorTemperature_4(); + break; + case 5: + err = TestSendClusterColorControlCommandReadAttribute_5(); + break; + case 6: + err = TestSendClusterColorControlCommandMoveColorTemperature_6(); + break; + case 7: + err = TestSendClusterColorControlCommandReadAttribute_7(); + break; + case 8: + err = TestSendClusterColorControlCommandMoveColorTemperature_8(); + break; + case 9: + err = TestSendClusterColorControlCommandReadAttribute_9(); + break; + case 10: + err = TestSendClusterColorControlCommandStepColorTemperature_10(); + break; + case 11: + err = TestSendClusterColorControlCommandReadAttribute_11(); + break; + case 12: + err = TestSendClusterColorControlCommandStepColorTemperature_12(); + break; + case 13: + err = TestSendClusterColorControlCommandReadAttribute_13(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogProgress(chipTool, "Test_TC_CC_6: %s", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 14; + + // + // Tests methods + // + + // Test Turn on light for color control tests + using SuccessCallback_0 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_0{ OnTestSendClusterOnOffCommandOn_0_SuccessResponse, this }; + chip::Callback::Callback mOnFailureCallback_0{ OnTestSendClusterOnOffCommandOn_0_FailureResponse, + this }; + bool mIsFailureExpected_0 = 0; + + CHIP_ERROR TestSendClusterOnOffCommandOn_0() + { + ChipLogProgress(chipTool, "On/Off - Turn on light for color control tests: Sending command..."); + + chip::Controller::OnOffCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.On(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + + return err; + } + + static void OnTestSendClusterOnOffCommandOn_0_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "On/Off - Turn on light for color control tests: Failure Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_0 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterOnOffCommandOn_0_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "On/Off - Turn on light for color control tests: Success Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_0 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check on/off attribute value is true after on command + using SuccessCallback_1 = void (*)(void * context, uint8_t onOff); + chip::Callback::Callback mOnSuccessCallback_1{ OnTestSendClusterOnOffCommandReadAttribute_1_SuccessResponse, + this }; + chip::Callback::Callback mOnFailureCallback_1{ + OnTestSendClusterOnOffCommandReadAttribute_1_FailureResponse, this + }; + bool mIsFailureExpected_1 = 0; + + CHIP_ERROR TestSendClusterOnOffCommandReadAttribute_1() + { + ChipLogProgress(chipTool, "On/Off - Check on/off attribute value is true after on command: Sending command..."); + + chip::Controller::OnOffCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + + return err; + } + + static void OnTestSendClusterOnOffCommandReadAttribute_1_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "On/Off - Check on/off attribute value is true after on command: Failure Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_1 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterOnOffCommandReadAttribute_1_SuccessResponse(void * context, uint8_t onOff) + { + ChipLogProgress(chipTool, "On/Off - Check on/off attribute value is true after on command: Success Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_1 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + if (onOff != 1) + { + ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "1"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Move To Color Temperature command + using SuccessCallback_2 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_2{ + OnTestSendClusterColorControlCommandMoveToColorTemperature_2_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_2{ + OnTestSendClusterColorControlCommandMoveToColorTemperature_2_FailureResponse, this + }; + bool mIsFailureExpected_2 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandMoveToColorTemperature_2() + { + ChipLogProgress(chipTool, "Color Control - Move To Color Temperature command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint16_t colorTemperatureArgument = 100U; + uint16_t transitionTimeArgument = 10U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.MoveToColorTemperature(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel(), colorTemperatureArgument, + transitionTimeArgument, optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandMoveToColorTemperature_2_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Move To Color Temperature command: Failure Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_2 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandMoveToColorTemperature_2_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Move To Color Temperature command: Success Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_2 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Read current color temprature + using SuccessCallback_3 = void (*)(void * context, uint16_t colorTemperature); + chip::Callback::Callback mOnSuccessCallback_3{ + OnTestSendClusterColorControlCommandReadAttribute_3_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_3{ + OnTestSendClusterColorControlCommandReadAttribute_3_FailureResponse, this + }; + bool mIsFailureExpected_3 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_3() + { + ChipLogProgress(chipTool, "Color Control - Read current color temprature: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeColorTemperature(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_3_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Read current color temprature: Failure Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_3 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_3_SuccessResponse(void * context, uint16_t colorTemperature) + { + ChipLogProgress(chipTool, "Color Control - Read current color temprature: Success Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_3 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Move up color temperature command + using SuccessCallback_4 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_4{ + OnTestSendClusterColorControlCommandMoveColorTemperature_4_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_4{ + OnTestSendClusterColorControlCommandMoveColorTemperature_4_FailureResponse, this + }; + bool mIsFailureExpected_4 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandMoveColorTemperature_4() + { + ChipLogProgress(chipTool, "Color Control - Move up color temperature command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t moveModeArgument = 1; + uint16_t rateArgument = 10U; + uint16_t colorTemperatureMinimumArgument = 1U; + uint16_t colorTemperatureMaximumArgument = 255U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.MoveColorTemperature(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel(), moveModeArgument, + rateArgument, colorTemperatureMinimumArgument, colorTemperatureMaximumArgument, + optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandMoveColorTemperature_4_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Move up color temperature command: Failure Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_4 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandMoveColorTemperature_4_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Move up color temperature command: Success Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_4 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Read current color temprature + using SuccessCallback_5 = void (*)(void * context, uint16_t colorTemperature); + chip::Callback::Callback mOnSuccessCallback_5{ + OnTestSendClusterColorControlCommandReadAttribute_5_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_5{ + OnTestSendClusterColorControlCommandReadAttribute_5_FailureResponse, this + }; + bool mIsFailureExpected_5 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_5() + { + ChipLogProgress(chipTool, "Color Control - Read current color temprature: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeColorTemperature(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_5_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Read current color temprature: Failure Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_5 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_5_SuccessResponse(void * context, uint16_t colorTemperature) + { + ChipLogProgress(chipTool, "Color Control - Read current color temprature: Success Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_5 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Stop Color Temperature command + using SuccessCallback_6 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_6{ + OnTestSendClusterColorControlCommandMoveColorTemperature_6_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_6{ + OnTestSendClusterColorControlCommandMoveColorTemperature_6_FailureResponse, this + }; + bool mIsFailureExpected_6 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandMoveColorTemperature_6() + { + ChipLogProgress(chipTool, "Color Control - Stop Color Temperature command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t moveModeArgument = 0; + uint16_t rateArgument = 10U; + uint16_t colorTemperatureMinimumArgument = 1U; + uint16_t colorTemperatureMaximumArgument = 255U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.MoveColorTemperature(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel(), moveModeArgument, + rateArgument, colorTemperatureMinimumArgument, colorTemperatureMaximumArgument, + optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandMoveColorTemperature_6_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Stop Color Temperature command: Failure Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_6 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandMoveColorTemperature_6_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Stop Color Temperature command: Success Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_6 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Read current color temprature + using SuccessCallback_7 = void (*)(void * context, uint16_t colorTemperature); + chip::Callback::Callback mOnSuccessCallback_7{ + OnTestSendClusterColorControlCommandReadAttribute_7_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_7{ + OnTestSendClusterColorControlCommandReadAttribute_7_FailureResponse, this + }; + bool mIsFailureExpected_7 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_7() + { + ChipLogProgress(chipTool, "Color Control - Read current color temprature: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeColorTemperature(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_7_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Read current color temprature: Failure Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_7 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_7_SuccessResponse(void * context, uint16_t colorTemperature) + { + ChipLogProgress(chipTool, "Color Control - Read current color temprature: Success Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_7 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Move down color temperature command + using SuccessCallback_8 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_8{ + OnTestSendClusterColorControlCommandMoveColorTemperature_8_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_8{ + OnTestSendClusterColorControlCommandMoveColorTemperature_8_FailureResponse, this + }; + bool mIsFailureExpected_8 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandMoveColorTemperature_8() + { + ChipLogProgress(chipTool, "Color Control - Move down color temperature command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t moveModeArgument = 3; + uint16_t rateArgument = 20U; + uint16_t colorTemperatureMinimumArgument = 1U; + uint16_t colorTemperatureMaximumArgument = 255U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.MoveColorTemperature(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel(), moveModeArgument, + rateArgument, colorTemperatureMinimumArgument, colorTemperatureMaximumArgument, + optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandMoveColorTemperature_8_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Move down color temperature command: Failure Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_8 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandMoveColorTemperature_8_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Move down color temperature command: Success Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_8 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Read current color temprature + using SuccessCallback_9 = void (*)(void * context, uint16_t colorTemperature); + chip::Callback::Callback mOnSuccessCallback_9{ + OnTestSendClusterColorControlCommandReadAttribute_9_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_9{ + OnTestSendClusterColorControlCommandReadAttribute_9_FailureResponse, this + }; + bool mIsFailureExpected_9 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_9() + { + ChipLogProgress(chipTool, "Color Control - Read current color temprature: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeColorTemperature(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_9_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Read current color temprature: Failure Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_9 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_9_SuccessResponse(void * context, uint16_t colorTemperature) + { + ChipLogProgress(chipTool, "Color Control - Read current color temprature: Success Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_9 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Step up color temperature command + using SuccessCallback_10 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_10{ + OnTestSendClusterColorControlCommandStepColorTemperature_10_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_10{ + OnTestSendClusterColorControlCommandStepColorTemperature_10_FailureResponse, this + }; + bool mIsFailureExpected_10 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandStepColorTemperature_10() + { + ChipLogProgress(chipTool, "Color Control - Step up color temperature command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t stepModeArgument = 1; + uint16_t stepSizeArgument = 5U; + uint16_t transitionTimeArgument = 50U; + uint16_t colorTemperatureMinimumArgument = 5U; + uint16_t colorTemperatureMaximumArgument = 100U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.StepColorTemperature(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel(), stepModeArgument, + stepSizeArgument, transitionTimeArgument, colorTemperatureMinimumArgument, + colorTemperatureMaximumArgument, optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandStepColorTemperature_10_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Step up color temperature command: Failure Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_10 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandStepColorTemperature_10_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Step up color temperature command: Success Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_10 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Read current color temprature + using SuccessCallback_11 = void (*)(void * context, uint16_t colorTemperature); + chip::Callback::Callback mOnSuccessCallback_11{ + OnTestSendClusterColorControlCommandReadAttribute_11_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_11{ + OnTestSendClusterColorControlCommandReadAttribute_11_FailureResponse, this + }; + bool mIsFailureExpected_11 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_11() + { + ChipLogProgress(chipTool, "Color Control - Read current color temprature: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeColorTemperature(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_11_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Read current color temprature: Failure Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_11 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_11_SuccessResponse(void * context, uint16_t colorTemperature) + { + ChipLogProgress(chipTool, "Color Control - Read current color temprature: Success Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_11 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Step down color temperature command + using SuccessCallback_12 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_12{ + OnTestSendClusterColorControlCommandStepColorTemperature_12_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_12{ + OnTestSendClusterColorControlCommandStepColorTemperature_12_FailureResponse, this + }; + bool mIsFailureExpected_12 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandStepColorTemperature_12() + { + ChipLogProgress(chipTool, "Color Control - Step down color temperature command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t stepModeArgument = 3; + uint16_t stepSizeArgument = 5U; + uint16_t transitionTimeArgument = 50U; + uint16_t colorTemperatureMinimumArgument = 5U; + uint16_t colorTemperatureMaximumArgument = 100U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.StepColorTemperature(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel(), stepModeArgument, + stepSizeArgument, transitionTimeArgument, colorTemperatureMinimumArgument, + colorTemperatureMaximumArgument, optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandStepColorTemperature_12_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Step down color temperature command: Failure Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_12 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandStepColorTemperature_12_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Step down color temperature command: Success Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_12 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Read current color temprature + using SuccessCallback_13 = void (*)(void * context, uint16_t colorTemperature); + chip::Callback::Callback mOnSuccessCallback_13{ + OnTestSendClusterColorControlCommandReadAttribute_13_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_13{ + OnTestSendClusterColorControlCommandReadAttribute_13_FailureResponse, this + }; + bool mIsFailureExpected_13 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_13() + { + ChipLogProgress(chipTool, "Color Control - Read current color temprature: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeColorTemperature(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_13_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Read current color temprature: Failure Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_13 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_13_SuccessResponse(void * context, uint16_t colorTemperature) + { + ChipLogProgress(chipTool, "Color Control - Read current color temprature: Success Response"); + + Test_TC_CC_6 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_13 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } +}; + +class Test_TC_CC_7 : public TestCommand +{ +public: + Test_TC_CC_7() : TestCommand("Test_TC_CC_7"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, "Test_TC_CC_7: Test complete"); + SetCommandExitStatus(CHIP_NO_ERROR); + } + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + err = TestSendClusterOnOffCommandOn_0(); + break; + case 1: + err = TestSendClusterOnOffCommandReadAttribute_1(); + break; + case 2: + err = TestSendClusterColorControlCommandEnhancedMoveToHue_2(); + break; + case 3: + err = TestSendClusterColorControlCommandReadAttribute_3(); + break; + case 4: + err = TestSendClusterColorControlCommandReadAttribute_4(); + break; + case 5: + err = TestSendClusterColorControlCommandEnhancedMoveHue_5(); + break; + case 6: + err = TestSendClusterColorControlCommandEnhancedMoveHue_6(); + break; + case 7: + err = TestSendClusterColorControlCommandEnhancedMoveHue_7(); + break; + case 8: + err = TestSendClusterColorControlCommandEnhancedMoveHue_8(); + break; + case 9: + err = TestSendClusterColorControlCommandEnhancedStepHue_9(); + break; + case 10: + err = TestSendClusterColorControlCommandEnhancedStepHue_10(); + break; + case 11: + err = TestSendClusterColorControlCommandEnhancedMoveToHueAndSaturation_11(); + break; + case 12: + err = TestSendClusterColorControlCommandReadAttribute_12(); + break; + case 13: + err = TestSendClusterColorControlCommandReadAttribute_13(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogProgress(chipTool, "Test_TC_CC_7: %s", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 14; + + // + // Tests methods + // + + // Test Turn on light for color control tests + using SuccessCallback_0 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_0{ OnTestSendClusterOnOffCommandOn_0_SuccessResponse, this }; + chip::Callback::Callback mOnFailureCallback_0{ OnTestSendClusterOnOffCommandOn_0_FailureResponse, + this }; + bool mIsFailureExpected_0 = 0; + + CHIP_ERROR TestSendClusterOnOffCommandOn_0() + { + ChipLogProgress(chipTool, "On/Off - Turn on light for color control tests: Sending command..."); + + chip::Controller::OnOffCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.On(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + + return err; + } + + static void OnTestSendClusterOnOffCommandOn_0_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "On/Off - Turn on light for color control tests: Failure Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_0 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterOnOffCommandOn_0_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "On/Off - Turn on light for color control tests: Success Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_0 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check on/off attribute value is true after on command + using SuccessCallback_1 = void (*)(void * context, uint8_t onOff); + chip::Callback::Callback mOnSuccessCallback_1{ OnTestSendClusterOnOffCommandReadAttribute_1_SuccessResponse, + this }; + chip::Callback::Callback mOnFailureCallback_1{ + OnTestSendClusterOnOffCommandReadAttribute_1_FailureResponse, this + }; + bool mIsFailureExpected_1 = 0; + + CHIP_ERROR TestSendClusterOnOffCommandReadAttribute_1() + { + ChipLogProgress(chipTool, "On/Off - Check on/off attribute value is true after on command: Sending command..."); + + chip::Controller::OnOffCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + + return err; + } + + static void OnTestSendClusterOnOffCommandReadAttribute_1_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "On/Off - Check on/off attribute value is true after on command: Failure Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_1 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterOnOffCommandReadAttribute_1_SuccessResponse(void * context, uint8_t onOff) + { + ChipLogProgress(chipTool, "On/Off - Check on/off attribute value is true after on command: Success Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_1 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + if (onOff != 1) + { + ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "1"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Enhanced Move To Hue command + using SuccessCallback_2 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_2{ + OnTestSendClusterColorControlCommandEnhancedMoveToHue_2_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_2{ + OnTestSendClusterColorControlCommandEnhancedMoveToHue_2_FailureResponse, this + }; + bool mIsFailureExpected_2 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandEnhancedMoveToHue_2() + { + ChipLogProgress(chipTool, "Color Control - Enhanced Move To Hue command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint16_t enhancedHueArgument = 1025U; + uint8_t directionArgument = 0; + uint16_t transitionTimeArgument = 1U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.EnhancedMoveToHue(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel(), enhancedHueArgument, + directionArgument, transitionTimeArgument, optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandEnhancedMoveToHue_2_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Enhanced Move To Hue command: Failure Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_2 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandEnhancedMoveToHue_2_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Enhanced Move To Hue command: Success Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_2 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check Remaining time attribute value matched the value sent by the last command + using SuccessCallback_3 = void (*)(void * context, uint16_t remainingTime); + chip::Callback::Callback mOnSuccessCallback_3{ + OnTestSendClusterColorControlCommandReadAttribute_3_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_3{ + OnTestSendClusterColorControlCommandReadAttribute_3_FailureResponse, this + }; + bool mIsFailureExpected_3 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_3() + { + ChipLogProgress( + chipTool, + "Color Control - Check Remaining time attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeRemainingTime(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_3_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check Remaining time attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_3 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_3_SuccessResponse(void * context, uint16_t remainingTime) + { + ChipLogProgress( + chipTool, + "Color Control - Check Remaining time attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_3 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + if (remainingTime != 1U) + { + ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "1"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check EnhancedCurrentHue attribute value matched the value sent by the last command + using SuccessCallback_4 = void (*)(void * context, uint16_t enhancedCurrentHue); + chip::Callback::Callback mOnSuccessCallback_4{ + OnTestSendClusterColorControlCommandReadAttribute_4_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_4{ + OnTestSendClusterColorControlCommandReadAttribute_4_FailureResponse, this + }; + bool mIsFailureExpected_4 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_4() + { + ChipLogProgress(chipTool, + "Color Control - Check EnhancedCurrentHue attribute value matched the value sent by the last command: " + "Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeEnhancedCurrentHue(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_4_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, + "Color Control - Check EnhancedCurrentHue attribute value matched the value sent by the last command: " + "Failure Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_4 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_4_SuccessResponse(void * context, uint16_t enhancedCurrentHue) + { + ChipLogProgress(chipTool, + "Color Control - Check EnhancedCurrentHue attribute value matched the value sent by the last command: " + "Success Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_4 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Enhanced Move Hue Down command + using SuccessCallback_5 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_5{ + OnTestSendClusterColorControlCommandEnhancedMoveHue_5_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_5{ + OnTestSendClusterColorControlCommandEnhancedMoveHue_5_FailureResponse, this + }; + bool mIsFailureExpected_5 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandEnhancedMoveHue_5() + { + ChipLogProgress(chipTool, "Color Control - Enhanced Move Hue Down command : Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t moveModeArgument = 3; + uint16_t rateArgument = 5U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.EnhancedMoveHue(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel(), moveModeArgument, rateArgument, + optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandEnhancedMoveHue_5_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Enhanced Move Hue Down command : Failure Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_5 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandEnhancedMoveHue_5_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Enhanced Move Hue Down command : Success Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_5 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Enhanced Move Hue Stop command + using SuccessCallback_6 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_6{ + OnTestSendClusterColorControlCommandEnhancedMoveHue_6_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_6{ + OnTestSendClusterColorControlCommandEnhancedMoveHue_6_FailureResponse, this + }; + bool mIsFailureExpected_6 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandEnhancedMoveHue_6() + { + ChipLogProgress(chipTool, "Color Control - Enhanced Move Hue Stop command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t moveModeArgument = 0; + uint16_t rateArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.EnhancedMoveHue(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel(), moveModeArgument, rateArgument, + optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandEnhancedMoveHue_6_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Enhanced Move Hue Stop command: Failure Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_6 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandEnhancedMoveHue_6_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Enhanced Move Hue Stop command: Success Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_6 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Enhanced Move Hue Up command + using SuccessCallback_7 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_7{ + OnTestSendClusterColorControlCommandEnhancedMoveHue_7_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_7{ + OnTestSendClusterColorControlCommandEnhancedMoveHue_7_FailureResponse, this + }; + bool mIsFailureExpected_7 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandEnhancedMoveHue_7() + { + ChipLogProgress(chipTool, "Color Control - Enhanced Move Hue Up command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t moveModeArgument = 1; + uint16_t rateArgument = 50U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.EnhancedMoveHue(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel(), moveModeArgument, rateArgument, + optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandEnhancedMoveHue_7_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Enhanced Move Hue Up command: Failure Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_7 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandEnhancedMoveHue_7_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Enhanced Move Hue Up command: Success Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_7 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Enhanced Move Hue Stop command + using SuccessCallback_8 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_8{ + OnTestSendClusterColorControlCommandEnhancedMoveHue_8_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_8{ + OnTestSendClusterColorControlCommandEnhancedMoveHue_8_FailureResponse, this + }; + bool mIsFailureExpected_8 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandEnhancedMoveHue_8() + { + ChipLogProgress(chipTool, "Color Control - Enhanced Move Hue Stop command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t moveModeArgument = 0; + uint16_t rateArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.EnhancedMoveHue(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel(), moveModeArgument, rateArgument, + optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandEnhancedMoveHue_8_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Enhanced Move Hue Stop command: Failure Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_8 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandEnhancedMoveHue_8_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Enhanced Move Hue Stop command: Success Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_8 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Enhanced Step Hue Up command + using SuccessCallback_9 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_9{ + OnTestSendClusterColorControlCommandEnhancedStepHue_9_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_9{ + OnTestSendClusterColorControlCommandEnhancedStepHue_9_FailureResponse, this + }; + bool mIsFailureExpected_9 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandEnhancedStepHue_9() + { + ChipLogProgress(chipTool, "Color Control - Enhanced Step Hue Up command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t stepModeArgument = 0; + uint16_t stepSizeArgument = 50U; + uint16_t transitionTimeArgument = 1U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.EnhancedStepHue(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel(), stepModeArgument, + stepSizeArgument, transitionTimeArgument, optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandEnhancedStepHue_9_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Enhanced Step Hue Up command: Failure Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_9 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandEnhancedStepHue_9_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Enhanced Step Hue Up command: Success Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_9 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Enhanced Step Hue Down command + using SuccessCallback_10 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_10{ + OnTestSendClusterColorControlCommandEnhancedStepHue_10_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_10{ + OnTestSendClusterColorControlCommandEnhancedStepHue_10_FailureResponse, this + }; + bool mIsFailureExpected_10 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandEnhancedStepHue_10() + { + ChipLogProgress(chipTool, "Color Control - Enhanced Step Hue Down command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t stepModeArgument = 1; + uint16_t stepSizeArgument = 75U; + uint16_t transitionTimeArgument = 1U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.EnhancedStepHue(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel(), stepModeArgument, + stepSizeArgument, transitionTimeArgument, optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandEnhancedStepHue_10_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Enhanced Step Hue Down command: Failure Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_10 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandEnhancedStepHue_10_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Enhanced Step Hue Down command: Success Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_10 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Enhanced move to hue and saturation command + using SuccessCallback_11 = void (*)(void * context); + chip::Callback::Callback mOnSuccessCallback_11{ + OnTestSendClusterColorControlCommandEnhancedMoveToHueAndSaturation_11_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_11{ + OnTestSendClusterColorControlCommandEnhancedMoveToHueAndSaturation_11_FailureResponse, this + }; + bool mIsFailureExpected_11 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandEnhancedMoveToHueAndSaturation_11() + { + ChipLogProgress(chipTool, "Color Control - Enhanced move to hue and saturation command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint16_t enhancedHueArgument = 1200U; + uint8_t saturationArgument = 90; + uint16_t transitionTimeArgument = 10U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + err = cluster.EnhancedMoveToHueAndSaturation(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel(), + enhancedHueArgument, saturationArgument, transitionTimeArgument, + optionsMaskArgument, optionsOverrideArgument); + + return err; + } + + static void OnTestSendClusterColorControlCommandEnhancedMoveToHueAndSaturation_11_FailureResponse(void * context, + uint8_t status) + { + ChipLogProgress(chipTool, "Color Control - Enhanced move to hue and saturation command: Failure Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_11 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandEnhancedMoveToHueAndSaturation_11_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Color Control - Enhanced move to hue and saturation command: Success Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_11 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check EnhancedCurrentHue attribute value matched the value sent by the last command + using SuccessCallback_12 = void (*)(void * context, uint16_t enhancedCurrentHue); + chip::Callback::Callback mOnSuccessCallback_12{ + OnTestSendClusterColorControlCommandReadAttribute_12_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_12{ + OnTestSendClusterColorControlCommandReadAttribute_12_FailureResponse, this + }; + bool mIsFailureExpected_12 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_12() + { + ChipLogProgress(chipTool, + "Color Control - Check EnhancedCurrentHue attribute value matched the value sent by the last command: " + "Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeEnhancedCurrentHue(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_12_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, + "Color Control - Check EnhancedCurrentHue attribute value matched the value sent by the last command: " + "Failure Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_12 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_12_SuccessResponse(void * context, uint16_t enhancedCurrentHue) + { + ChipLogProgress(chipTool, + "Color Control - Check EnhancedCurrentHue attribute value matched the value sent by the last command: " + "Success Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_12 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Check Saturation attribute value matched the value sent by the last command + using SuccessCallback_13 = void (*)(void * context, uint8_t currentSaturation); + chip::Callback::Callback mOnSuccessCallback_13{ + OnTestSendClusterColorControlCommandReadAttribute_13_SuccessResponse, this + }; + chip::Callback::Callback mOnFailureCallback_13{ + OnTestSendClusterColorControlCommandReadAttribute_13_FailureResponse, this + }; + bool mIsFailureExpected_13 = 0; + + CHIP_ERROR TestSendClusterColorControlCommandReadAttribute_13() + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Sending command..."); + + chip::Controller::ColorControlCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCurrentSaturation(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); + + return err; + } + + static void OnTestSendClusterColorControlCommandReadAttribute_13_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Failure Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_13 == false) + { + ChipLogError(chipTool, "Error: The test was expecting a success callback. Got failure callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + static void OnTestSendClusterColorControlCommandReadAttribute_13_SuccessResponse(void * context, uint8_t currentSaturation) + { + ChipLogProgress( + chipTool, + "Color Control - Check Saturation attribute value matched the value sent by the last command: Success Response"); + + Test_TC_CC_7 * runner = reinterpret_cast(context); + + if (runner->mIsFailureExpected_13 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } +}; + void registerCommandsTests(Commands & commands) { const char * clusterName = "Tests"; @@ -13386,6 +18544,10 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), }; commands.Register(clusterName, clusterCommands); diff --git a/examples/chip-tool/templates/tests-commands.zapt b/examples/chip-tool/templates/tests-commands.zapt index 1d6a546504d3a0..6a35f21b046135 100644 --- a/examples/chip-tool/templates/tests-commands.zapt +++ b/examples/chip-tool/templates/tests-commands.zapt @@ -4,7 +4,7 @@ #include "TestCommand.h" -{{>test_cluster tests="TV_TargetNavigatorCluster, TV_AudioOutputCluster, TV_ApplicationLauncherCluster, TV_KeypadInputCluster, TV_AccountLoginCluster, TV_ApplicationBasicCluster, TV_MediaPlaybackCluster, TV_TvChannelCluster, TV_LowPowerCluster, TV_MediaInputCluster, TestCluster, Test_TC_OO_1_1, Test_TC_OO_2_1, Test_TC_OO_2_2, Test_TC_DM_1_1, Test_TC_DM_3_1"}} +{{>test_cluster tests="TV_TargetNavigatorCluster, TV_AudioOutputCluster, TV_ApplicationLauncherCluster, TV_KeypadInputCluster, TV_AccountLoginCluster, TV_ApplicationBasicCluster, TV_MediaPlaybackCluster, TV_TvChannelCluster, TV_LowPowerCluster, TV_MediaInputCluster, TestCluster, Test_TC_OO_1_1, Test_TC_OO_2_1, Test_TC_OO_2_2, Test_TC_DM_1_1, Test_TC_DM_3_1, Test_TC_CC_3_4, Test_TC_CC_5, Test_TC_CC_6, Test_TC_CC_7"}} void registerCommandsTests(Commands & commands) { @@ -27,6 +27,10 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), }; commands.Register(clusterName, clusterCommands); diff --git a/src/app/tests/suites/Test_TC_CC_3_4.yaml b/src/app/tests/suites/Test_TC_CC_3_4.yaml new file mode 100644 index 00000000000000..6b2a2246abca3f --- /dev/null +++ b/src/app/tests/suites/Test_TC_CC_3_4.yaml @@ -0,0 +1,379 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: + 3.2.15. [TC-CC-3.1 to 3.3 and 4.1 to 4.4] Color Hue and Saturation Controls + +config: + cluster: "Color Control" + endpoint: 1 + +tests: + - label: "Turn on light for color control tests" + cluster: "On/Off" + command: "on" + + - label: "Check on/off attribute value is true after on command" + cluster: "On/Off" + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Move to hue shortest distance command" + command: "MoveToHue" + arguments: + values: + - name: "hue" + value: 150 + - name: "direction" + value: 0 + - name: "transitionTime" + value: 100 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check current hue attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current hue" + # response: + # value: 150 + + - label: "Move to hue longest distance command" + command: "MoveToHue" + arguments: + values: + - name: "hue" + value: 200 + - name: "direction" + value: 1 + - name: "transitionTime" + value: 100 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check current hue attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current hue" + # response: + # value: 150 + + - label: "Move to hue up command" + command: "MoveToHue" + arguments: + values: + - name: "hue" + value: 250 + - name: "direction" + value: 2 + - name: "transitionTime" + value: 100 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check current hue attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current hue" + # response: + # value: 250 + + - label: "Move to hue down command" + command: "MoveToHue" + arguments: + values: + - name: "hue" + value: 225 + - name: "direction" + value: 3 + - name: "transitionTime" + value: 100 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check current hue attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current hue" + # response: + # value: 225 + + - label: "Move hue up command" + command: "MoveHue" + arguments: + values: + - name: "moveMode" + value: 1 + - name: "rate" + value: 50 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check current hue attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current hue" + + - label: "Move hue stop command" + command: "MoveHue" + arguments: + values: + - name: "moveMode" + value: 0 + - name: "rate" + value: 50 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check current hue attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current hue" + + - label: "Move hue down command" + command: "MoveHue" + arguments: + values: + - name: "moveMode" + value: 3 + - name: "rate" + value: 50 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check current hue attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current hue" + + - label: "Move hue stop command" + command: "MoveHue" + arguments: + values: + - name: "moveMode" + value: 0 + - name: "rate" + value: 50 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check current hue attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current hue" + + - label: "Step hue up command" + command: "StepHue" + arguments: + values: + - name: "stepMode" + value: 1 + - name: "stepSize" + value: 5 + - name: "transitionTime" + value: 25 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check current hue attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current hue" + + - label: "Step hue down command" + command: "StepHue" + arguments: + values: + - name: "stepMode" + value: 3 + - name: "stepSize" + value: 5 + - name: "transitionTime" + value: 25 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check current hue attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current hue" + + - label: "Check Saturation attribute value matched before any change" + command: "readAttribute" + attribute: "current saturation" + # response: + # value: 90 + + - label: "Move to saturation command" + command: "MoveToSaturation" + arguments: + values: + - name: "saturation" + value: 90 + - name: "transitionTime" + value: 10 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check Saturation attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current saturation" + # response: + # value: 90 + + - label: "Move saturation up command" + command: "MoveSaturation" + arguments: + values: + - name: "moveMode" + value: 1 + - name: "rate" + value: 5 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check Saturation attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current saturation" + + - label: "Move saturation down command" + command: "MoveSaturation" + arguments: + values: + - name: "moveMode" + value: 3 + - name: "rate" + value: 5 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check Saturation attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current saturation" + + - label: "Step saturation up command" + command: "StepSaturation" + arguments: + values: + - name: "stepMode" + value: 1 + - name: "stepSize" + value: 15 + - name: "transitionTime" + value: 10 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check Saturation attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current saturation" + + - label: "Step saturation down command" + command: "StepSaturation" + arguments: + values: + - name: "stepMode" + value: 3 + - name: "stepSize" + value: 20 + - name: "transitionTime" + value: 10 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check Saturation attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current saturation" + + - label: "Move To current hue and saturation command" + command: "MoveToHueAndSaturation" + arguments: + values: + - name: "hue" + value: 40 + - name: "saturation" + value: 160 + - name: "transitionTime" + value: 10 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + - label: + "Check current hue attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current hue" + # response: + # value: 40 + + - label: + "Check Saturation attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current saturation" +# response: +# value: 160 diff --git a/src/app/tests/suites/Test_TC_CC_5.yaml b/src/app/tests/suites/Test_TC_CC_5.yaml new file mode 100644 index 00000000000000..3e6120ee267017 --- /dev/null +++ b/src/app/tests/suites/Test_TC_CC_5.yaml @@ -0,0 +1,134 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 3.2.15. [TC-CC-5.1 to 5.3] Color XY Controls + +config: + cluster: "Color Control" + endpoint: 1 + +tests: + - label: "Turn on light for color control tests" + cluster: "On/Off" + command: "on" + + - label: "Check on/off attribute value is true after on command" + cluster: "On/Off" + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Move to Color command" + command: "MoveToColor" + arguments: + values: + - name: "colorX" + value: 200 + - name: "colorY" + value: 300 + - name: "transitionTime" + value: 20 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check current y attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current x" + # response: + # value: 200 + - label: + "Check current x attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current y" + # response: + # value: 300 + + - label: "Move Color command" + command: "MoveColor" + arguments: + values: + - name: "rateX" + value: 15 + - name: "rateY" + value: 20 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check current x attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current x" + + - label: + "Check current y attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current y" + + - label: "Stop Move Step command" + command: "StopMoveStep" + arguments: + values: + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check current x attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current x" + + - label: + "Check current y attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current y" + + - label: "Step Color command" + command: "StepColor" + arguments: + values: + - name: "stepX" + value: 15 + - name: "stepY" + value: 20 + - name: "transitionTime" + value: 50 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check current x attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current x" + + - label: + "Check current y attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current y" diff --git a/src/app/tests/suites/Test_TC_CC_6.yaml b/src/app/tests/suites/Test_TC_CC_6.yaml new file mode 100644 index 00000000000000..3b3a20304de10f --- /dev/null +++ b/src/app/tests/suites/Test_TC_CC_6.yaml @@ -0,0 +1,159 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 3.2.15. [TC-CC-6.1 to 6.3] Color Temperature Controls + +config: + cluster: "Color Control" + endpoint: 1 + +tests: + - label: "Turn on light for color control tests" + cluster: "On/Off" + command: "on" + + - label: "Check on/off attribute value is true after on command" + cluster: "On/Off" + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Move To Color Temperature command" + command: "MoveToColorTemperature" + arguments: + values: + - name: "colorTemperature" + value: 100 + - name: "transitionTime" + value: 10 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read current color temprature" + command: "readAttribute" + attribute: "color temperature" + # response: + # value: 100 + + - label: "Move up color temperature command" + command: "MoveColorTemperature" + arguments: + values: + - name: "moveMode" + value: 1 + - name: "rate" + value: 10 + - name: "colorTemperatureMinimum" + value: 1 + - name: "colorTemperatureMaximum" + value: 255 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read current color temprature" + command: "readAttribute" + attribute: "color temperature" + + - label: "Stop Color Temperature command" + command: "MoveColorTemperature" + arguments: + values: + - name: "moveMode" + value: 0 + - name: "rate" + value: 10 + - name: "colorTemperatureMinimum" + value: 1 + - name: "colorTemperatureMaximum" + value: 255 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read current color temprature" + command: "readAttribute" + attribute: "color temperature" + + - label: "Move down color temperature command" + command: "MoveColorTemperature" + arguments: + values: + - name: "moveMode" + value: 3 + - name: "rate" + value: 20 + - name: "colorTemperatureMinimum" + value: 1 + - name: "colorTemperatureMaximum" + value: 255 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read current color temprature" + command: "readAttribute" + attribute: "color temperature" + + - label: "Step up color temperature command" + command: "StepColorTemperature" + arguments: + values: + - name: "stepMode" + value: 1 + - name: "stepSize" + value: 5 + - name: "transitionTime" + value: 50 + - name: "colorTemperatureMinimum" + value: 5 + - name: "colorTemperatureMaximum" + value: 100 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read current color temprature" + command: "readAttribute" + attribute: "color temperature" + + - label: "Step down color temperature command" + command: "StepColorTemperature" + arguments: + values: + - name: "stepMode" + value: 3 + - name: "stepSize" + value: 5 + - name: "transitionTime" + value: 50 + - name: "colorTemperatureMinimum" + value: 5 + - name: "colorTemperatureMaximum" + value: 100 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read current color temprature" + command: "readAttribute" + attribute: "color temperature" diff --git a/src/app/tests/suites/Test_TC_CC_7.yaml b/src/app/tests/suites/Test_TC_CC_7.yaml new file mode 100644 index 00000000000000..48e9779a4e08bb --- /dev/null +++ b/src/app/tests/suites/Test_TC_CC_7.yaml @@ -0,0 +1,203 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 3.2.15. [TC-CC-7.1 to 7.4] Enhanced Color Controls + +config: + cluster: "Color Control" + endpoint: 1 + +tests: + - label: "Turn on light for color control tests" + cluster: "On/Off" + command: "on" + + - label: "Check on/off attribute value is true after on command" + cluster: "On/Off" + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Enhanced Move To Hue command" + command: "EnhancedMoveToHue" + arguments: + values: + - name: "enhancedHue" + value: 1025 + - name: "direction" + value: 0 + - name: "transitionTime" + value: 1 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check Remaining time attribute value matched the value sent by the + last command" + command: "readAttribute" + attribute: "remaining time" + response: + value: 1 + + - label: + "Check EnhancedCurrentHue attribute value matched the value sent by + the last command" + command: "readAttribute" + attribute: "enhanced current hue" + # response: + # value: 1025 + + - label: "Enhanced Move Hue Down command " + command: "EnhancedMoveHue" + arguments: + values: + - name: "moveMode" + value: 3 + - name: "rate" + value: 5 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Enhanced Move Hue Stop command" + command: "EnhancedMoveHue" + arguments: + values: + - name: "moveMode" + value: 0 + - name: "rate" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Check EnhancedCurrentHue attribute value changed to a lower Hue" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + + - label: "Enhanced Move Hue Up command" + command: "EnhancedMoveHue" + arguments: + values: + - name: "moveMode" + value: 1 + - name: "rate" + value: 50 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Enhanced Move Hue Stop command" + command: "EnhancedMoveHue" + arguments: + values: + - name: "moveMode" + value: 0 + - name: "rate" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Check EnhancedCurrentHue attribute value changed to a higher Hue" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + + - label: "Enhanced Step Hue Up command" + command: "EnhancedStepHue" + arguments: + values: + - name: "stepMode" + value: 0 + - name: "stepSize" + value: 50 + - name: "transitionTime" + value: 1 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check EnhancedCurrentHue attribute value matched the value sent by + the last command" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + # response: + # value: 1075 + + - label: "Enhanced Step Hue Down command" + command: "EnhancedStepHue" + arguments: + values: + - name: "stepMode" + value: 1 + - name: "stepSize" + value: 75 + - name: "transitionTime" + value: 1 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check EnhancedCurrentHue attribute value matched the value sent by + the last command" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + # response: + # value: 1000 + + - label: "Enhanced move to hue and saturation command" + command: "EnhancedMoveToHueAndSaturation" + arguments: + values: + - name: "enhancedHue" + value: 1200 + - name: "saturation" + value: 90 + - name: "transitionTime" + value: 10 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: + "Check EnhancedCurrentHue attribute value matched the value sent by + the last command" + command: "readAttribute" + attribute: "enhanced current hue" + # response: + # value: 1200 + + - label: + "Check Saturation attribute value matched the value sent by the last + command" + command: "readAttribute" + attribute: "current saturation" +# response: +# value: 90