From ddd91e3a8b2683f638a01a85226b55e494fda96d Mon Sep 17 00:00:00 2001 From: Lazar Kovacic Date: Mon, 5 Jul 2021 21:12:49 +0200 Subject: [PATCH] Generating the code using ZAP script --- .../chip-tool/commands/clusters/Commands.h | 156 ++++++++- examples/chip-tool/commands/tests/Commands.h | 315 +++++++++++++++--- .../tv-app/tv-common/gen/endpoint_config.h | 39 ++- .../data_model/gen/CHIPClusters.cpp | 48 +++ src/controller/data_model/gen/CHIPClusters.h | 4 + .../data_model/gen/chip-zcl-zpro-codec-api.h | 32 ++ src/controller/data_model/gen/encoder.cpp | 56 ++++ .../python/chip/clusters/CHIPClusters.cpp | 37 ++ .../python/chip/clusters/CHIPClusters.py | 36 ++ .../Framework/CHIP/gen/CHIPClustersObjc.h | 4 + .../Framework/CHIP/gen/CHIPClustersObjc.mm | 108 ++++++ .../Framework/CHIPTests/CHIPClustersTests.m | 76 +++++ 12 files changed, 847 insertions(+), 64 deletions(-) diff --git a/examples/chip-tool/commands/clusters/Commands.h b/examples/chip-tool/commands/clusters/Commands.h index c6076b8fdefa67..7dc26b430044c3 100644 --- a/examples/chip-tool/commands/clusters/Commands.h +++ b/examples/chip-tool/commands/clusters/Commands.h @@ -1696,6 +1696,8 @@ class ReadApplicationBasicClusterRevision : public ModelCommand |------------------------------------------------------------------------------| | Attributes: | | | * ApplicationLauncherList | 0x0000 | +| * CatalogVendorId | 0x0001 | +| * ApplicationId | 0x0002 | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -1805,6 +1807,74 @@ class ReadApplicationLauncherApplicationLauncherList : public ModelCommand new chip::Callback::Callback(OnDefaultFailureResponse, this); }; +/* + * Attribute CatalogVendorId + */ +class ReadApplicationLauncherCatalogVendorId : public ModelCommand +{ +public: + ReadApplicationLauncherCatalogVendorId() : ModelCommand("read") + { + AddArgument("attr-name", "catalog-vendor-id"); + ModelCommand::AddArguments(); + } + + ~ReadApplicationLauncherCatalogVendorId() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050C) command (0x00) on endpoint %" PRIu8, endpointId); + + chip::Controller::ApplicationLauncherCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeCatalogVendorId(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt8uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + +/* + * Attribute ApplicationId + */ +class ReadApplicationLauncherApplicationId : public ModelCommand +{ +public: + ReadApplicationLauncherApplicationId() : ModelCommand("read") + { + AddArgument("attr-name", "application-id"); + ModelCommand::AddArguments(); + } + + ~ReadApplicationLauncherApplicationId() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050C) command (0x00) on endpoint %" PRIu8, endpointId); + + chip::Controller::ApplicationLauncherCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeApplicationId(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt8uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + /* * Attribute ClusterRevision */ @@ -1848,6 +1918,7 @@ class ReadApplicationLauncherClusterRevision : public ModelCommand |------------------------------------------------------------------------------| | Attributes: | | | * AudioOutputList | 0x0000 | +| * CurrentAudioOutput | 0x0001 | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -1987,6 +2058,40 @@ class ReadAudioOutputAudioOutputList : public ModelCommand new chip::Callback::Callback(OnDefaultFailureResponse, this); }; +/* + * Attribute CurrentAudioOutput + */ +class ReadAudioOutputCurrentAudioOutput : public ModelCommand +{ +public: + ReadAudioOutputCurrentAudioOutput() : ModelCommand("read") + { + AddArgument("attr-name", "current-audio-output"); + ModelCommand::AddArguments(); + } + + ~ReadAudioOutputCurrentAudioOutput() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050B) command (0x00) on endpoint %" PRIu8, endpointId); + + chip::Controller::AudioOutputCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeCurrentAudioOutput(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt8uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + /* * Attribute ClusterRevision */ @@ -11738,6 +11843,7 @@ class ReadLowPowerClusterRevision : public ModelCommand |------------------------------------------------------------------------------| | Attributes: | | | * MediaInputList | 0x0000 | +| * CurrentMediaInput | 0x0001 | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -11935,6 +12041,40 @@ class ReadMediaInputMediaInputList : public ModelCommand new chip::Callback::Callback(OnDefaultFailureResponse, this); }; +/* + * Attribute CurrentMediaInput + */ +class ReadMediaInputCurrentMediaInput : public ModelCommand +{ +public: + ReadMediaInputCurrentMediaInput() : ModelCommand("read") + { + AddArgument("attr-name", "current-media-input"); + ModelCommand::AddArguments(); + } + + ~ReadMediaInputCurrentMediaInput() + { + delete onSuccessCallback; + delete onFailureCallback; + } + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0507) command (0x00) on endpoint %" PRIu8, endpointId); + + chip::Controller::MediaInputCluster cluster; + cluster.Associate(device, endpointId); + return cluster.ReadAttributeCurrentMediaInput(onSuccessCallback->Cancel(), onFailureCallback->Cancel()); + } + +private: + chip::Callback::Callback * onSuccessCallback = + new chip::Callback::Callback(OnInt8uAttributeResponse, this); + chip::Callback::Callback * onFailureCallback = + new chip::Callback::Callback(OnDefaultFailureResponse, this); +}; + /* * Attribute ClusterRevision */ @@ -22396,6 +22536,8 @@ void registerClusterApplicationLauncher(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), make_unique(), }; @@ -22406,9 +22548,9 @@ void registerClusterAudioOutput(Commands & commands) const char * clusterName = "AudioOutput"; commands_list clusterCommands = { - make_unique(), make_unique(), - make_unique(), make_unique(), - make_unique(), + make_unique(), make_unique(), + make_unique(), make_unique(), + make_unique(), make_unique(), }; commands.Register(clusterName, clusterCommands); @@ -22845,10 +22987,10 @@ void registerClusterMediaInput(Commands & commands) const char * clusterName = "MediaInput"; commands_list clusterCommands = { - make_unique(), make_unique(), - make_unique(), make_unique(), - make_unique(), make_unique(), - make_unique(), + make_unique(), make_unique(), + make_unique(), make_unique(), + make_unique(), make_unique(), + make_unique(), make_unique(), }; commands.Register(clusterName, clusterCommands); diff --git a/examples/chip-tool/commands/tests/Commands.h b/examples/chip-tool/commands/tests/Commands.h index ac3344fd18b9e1..4f543f863b9602 100644 --- a/examples/chip-tool/commands/tests/Commands.h +++ b/examples/chip-tool/commands/tests/Commands.h @@ -512,6 +512,12 @@ class TV_ApplicationLauncherCluster : public TestCommand case 1: err = TestSendClusterApplicationLauncherCommandLaunchApp_1(); break; + case 2: + err = TestSendClusterApplicationLauncherCommandReadAttribute_2(); + break; + case 3: + err = TestSendClusterApplicationLauncherCommandReadAttribute_3(); + break; } if (CHIP_NO_ERROR != err) @@ -523,7 +529,7 @@ class TV_ApplicationLauncherCluster : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; + const uint16_t mTestCount = 4; // // Tests methods @@ -679,6 +685,158 @@ class TV_ApplicationLauncherCluster : public TestCommand runner->NextTest(); } + + // Test Read attribute catalog vendor id + typedef void (*SuccessCallback_2)(void * context, uint8_t catalogVendorId); + chip::Callback::Callback * mOnSuccessCallback_2 = nullptr; + chip::Callback::Callback * mOnFailureCallback_2 = nullptr; + bool mIsFailureExpected_2 = 0; + + CHIP_ERROR TestSendClusterApplicationLauncherCommandReadAttribute_2() + { + ChipLogProgress(chipTool, "Application Launcher - Read attribute catalog vendor id: Sending command..."); + + mOnFailureCallback_2 = new chip::Callback::Callback( + OnTestSendClusterApplicationLauncherCommandReadAttribute_2_FailureResponse, this); + mOnSuccessCallback_2 = new chip::Callback::Callback( + OnTestSendClusterApplicationLauncherCommandReadAttribute_2_SuccessResponse, this); + + chip::Controller::ApplicationLauncherCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeCatalogVendorId(mOnSuccessCallback_2->Cancel(), mOnFailureCallback_2->Cancel()); + + if (CHIP_NO_ERROR != err) + { + delete mOnFailureCallback_2; + delete mOnSuccessCallback_2; + } + + return err; + } + + static void OnTestSendClusterApplicationLauncherCommandReadAttribute_2_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Application Launcher - Read attribute catalog vendor id: Failure Response"); + + TV_ApplicationLauncherCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_2; + delete runner->mOnSuccessCallback_2; + + 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 OnTestSendClusterApplicationLauncherCommandReadAttribute_2_SuccessResponse(void * context, uint8_t catalogVendorId) + { + ChipLogProgress(chipTool, "Application Launcher - Read attribute catalog vendor id: Success Response"); + + TV_ApplicationLauncherCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_2; + delete runner->mOnSuccessCallback_2; + + if (runner->mIsFailureExpected_2 == true) + { + ChipLogError(chipTool, "Error: The test was expecting a failure callback. Got success callback"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + if (catalogVendorId != 0) + { + ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } + + // Test Read attribute application id + typedef void (*SuccessCallback_3)(void * context, uint8_t applicationId); + chip::Callback::Callback * mOnSuccessCallback_3 = nullptr; + chip::Callback::Callback * mOnFailureCallback_3 = nullptr; + bool mIsFailureExpected_3 = 0; + + CHIP_ERROR TestSendClusterApplicationLauncherCommandReadAttribute_3() + { + ChipLogProgress(chipTool, "Application Launcher - Read attribute application id: Sending command..."); + + mOnFailureCallback_3 = new chip::Callback::Callback( + OnTestSendClusterApplicationLauncherCommandReadAttribute_3_FailureResponse, this); + mOnSuccessCallback_3 = new chip::Callback::Callback( + OnTestSendClusterApplicationLauncherCommandReadAttribute_3_SuccessResponse, this); + + chip::Controller::ApplicationLauncherCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + err = cluster.ReadAttributeApplicationId(mOnSuccessCallback_3->Cancel(), mOnFailureCallback_3->Cancel()); + + if (CHIP_NO_ERROR != err) + { + delete mOnFailureCallback_3; + delete mOnSuccessCallback_3; + } + + return err; + } + + static void OnTestSendClusterApplicationLauncherCommandReadAttribute_3_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Application Launcher - Read attribute application id: Failure Response"); + + TV_ApplicationLauncherCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_3; + delete runner->mOnSuccessCallback_3; + + 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 OnTestSendClusterApplicationLauncherCommandReadAttribute_3_SuccessResponse(void * context, uint8_t applicationId) + { + ChipLogProgress(chipTool, "Application Launcher - Read attribute application id: Success Response"); + + TV_ApplicationLauncherCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_3; + delete runner->mOnSuccessCallback_3; + + 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 (applicationId != 0) + { + ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "0"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + + runner->NextTest(); + } }; class TV_KeypadInputCluster : public TestCommand @@ -2874,13 +3032,16 @@ class TV_MediaInputCluster : public TestCommand err = TestSendClusterMediaInputCommandSelectInput_1(); break; case 2: - err = TestSendClusterMediaInputCommandHideInputStatus_2(); + err = TestSendClusterMediaInputCommandReadAttribute_2(); break; case 3: - err = TestSendClusterMediaInputCommandShowInputStatus_3(); + err = TestSendClusterMediaInputCommandHideInputStatus_3(); break; case 4: - err = TestSendClusterMediaInputCommandRenameInput_4(); + err = TestSendClusterMediaInputCommandShowInputStatus_4(); + break; + case 5: + err = TestSendClusterMediaInputCommandRenameInput_5(); break; } @@ -2893,7 +3054,7 @@ class TV_MediaInputCluster : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; + const uint16_t mTestCount = 6; // // Tests methods @@ -3046,27 +3207,27 @@ class TV_MediaInputCluster : public TestCommand runner->NextTest(); } - // Test Hide Input Status Command - typedef void (*SuccessCallback_2)(void * context); + // Test Read current input list + typedef void (*SuccessCallback_2)(void * context, uint8_t currentMediaInput); chip::Callback::Callback * mOnSuccessCallback_2 = nullptr; chip::Callback::Callback * mOnFailureCallback_2 = nullptr; bool mIsFailureExpected_2 = 0; - CHIP_ERROR TestSendClusterMediaInputCommandHideInputStatus_2() + CHIP_ERROR TestSendClusterMediaInputCommandReadAttribute_2() { - ChipLogProgress(chipTool, "Media Input - Hide Input Status Command: Sending command..."); + ChipLogProgress(chipTool, "Media Input - Read current input list: Sending command..."); mOnFailureCallback_2 = new chip::Callback::Callback( - OnTestSendClusterMediaInputCommandHideInputStatus_2_FailureResponse, this); + OnTestSendClusterMediaInputCommandReadAttribute_2_FailureResponse, this); mOnSuccessCallback_2 = new chip::Callback::Callback( - OnTestSendClusterMediaInputCommandHideInputStatus_2_SuccessResponse, this); + OnTestSendClusterMediaInputCommandReadAttribute_2_SuccessResponse, this); chip::Controller::MediaInputCluster cluster; cluster.Associate(mDevice, 1); CHIP_ERROR err = CHIP_NO_ERROR; - err = cluster.HideInputStatus(mOnSuccessCallback_2->Cancel(), mOnFailureCallback_2->Cancel()); + err = cluster.ReadAttributeCurrentMediaInput(mOnSuccessCallback_2->Cancel(), mOnFailureCallback_2->Cancel()); if (CHIP_NO_ERROR != err) { @@ -3077,9 +3238,9 @@ class TV_MediaInputCluster : public TestCommand return err; } - static void OnTestSendClusterMediaInputCommandHideInputStatus_2_FailureResponse(void * context, uint8_t status) + static void OnTestSendClusterMediaInputCommandReadAttribute_2_FailureResponse(void * context, uint8_t status) { - ChipLogProgress(chipTool, "Media Input - Hide Input Status Command: Failure Response"); + ChipLogProgress(chipTool, "Media Input - Read current input list: Failure Response"); TV_MediaInputCluster * runner = reinterpret_cast(context); @@ -3096,9 +3257,9 @@ class TV_MediaInputCluster : public TestCommand runner->NextTest(); } - static void OnTestSendClusterMediaInputCommandHideInputStatus_2_SuccessResponse(void * context) + static void OnTestSendClusterMediaInputCommandReadAttribute_2_SuccessResponse(void * context, uint8_t currentMediaInput) { - ChipLogProgress(chipTool, "Media Input - Hide Input Status Command: Success Response"); + ChipLogProgress(chipTool, "Media Input - Read current input list: Success Response"); TV_MediaInputCluster * runner = reinterpret_cast(context); @@ -3112,30 +3273,37 @@ class TV_MediaInputCluster : public TestCommand return; } + if (currentMediaInput != 1) + { + ChipLogError(chipTool, "Error: Value mismatch. Expected: '%s'", "1"); + runner->SetCommandExitStatus(CHIP_ERROR_INTERNAL); + return; + } + runner->NextTest(); } - // Test Show Input Status Command + // Test Hide Input Status Command typedef void (*SuccessCallback_3)(void * context); chip::Callback::Callback * mOnSuccessCallback_3 = nullptr; chip::Callback::Callback * mOnFailureCallback_3 = nullptr; bool mIsFailureExpected_3 = 0; - CHIP_ERROR TestSendClusterMediaInputCommandShowInputStatus_3() + CHIP_ERROR TestSendClusterMediaInputCommandHideInputStatus_3() { - ChipLogProgress(chipTool, "Media Input - Show Input Status Command: Sending command..."); + ChipLogProgress(chipTool, "Media Input - Hide Input Status Command: Sending command..."); mOnFailureCallback_3 = new chip::Callback::Callback( - OnTestSendClusterMediaInputCommandShowInputStatus_3_FailureResponse, this); + OnTestSendClusterMediaInputCommandHideInputStatus_3_FailureResponse, this); mOnSuccessCallback_3 = new chip::Callback::Callback( - OnTestSendClusterMediaInputCommandShowInputStatus_3_SuccessResponse, this); + OnTestSendClusterMediaInputCommandHideInputStatus_3_SuccessResponse, this); chip::Controller::MediaInputCluster cluster; cluster.Associate(mDevice, 1); CHIP_ERROR err = CHIP_NO_ERROR; - err = cluster.ShowInputStatus(mOnSuccessCallback_3->Cancel(), mOnFailureCallback_3->Cancel()); + err = cluster.HideInputStatus(mOnSuccessCallback_3->Cancel(), mOnFailureCallback_3->Cancel()); if (CHIP_NO_ERROR != err) { @@ -3146,9 +3314,9 @@ class TV_MediaInputCluster : public TestCommand return err; } - static void OnTestSendClusterMediaInputCommandShowInputStatus_3_FailureResponse(void * context, uint8_t status) + static void OnTestSendClusterMediaInputCommandHideInputStatus_3_FailureResponse(void * context, uint8_t status) { - ChipLogProgress(chipTool, "Media Input - Show Input Status Command: Failure Response"); + ChipLogProgress(chipTool, "Media Input - Hide Input Status Command: Failure Response"); TV_MediaInputCluster * runner = reinterpret_cast(context); @@ -3165,9 +3333,9 @@ class TV_MediaInputCluster : public TestCommand runner->NextTest(); } - static void OnTestSendClusterMediaInputCommandShowInputStatus_3_SuccessResponse(void * context) + static void OnTestSendClusterMediaInputCommandHideInputStatus_3_SuccessResponse(void * context) { - ChipLogProgress(chipTool, "Media Input - Show Input Status Command: Success Response"); + ChipLogProgress(chipTool, "Media Input - Hide Input Status Command: Success Response"); TV_MediaInputCluster * runner = reinterpret_cast(context); @@ -3184,29 +3352,27 @@ class TV_MediaInputCluster : public TestCommand runner->NextTest(); } - // Test Rename Input Command + // Test Show Input Status Command typedef void (*SuccessCallback_4)(void * context); chip::Callback::Callback * mOnSuccessCallback_4 = nullptr; chip::Callback::Callback * mOnFailureCallback_4 = nullptr; bool mIsFailureExpected_4 = 0; - CHIP_ERROR TestSendClusterMediaInputCommandRenameInput_4() + CHIP_ERROR TestSendClusterMediaInputCommandShowInputStatus_4() { - ChipLogProgress(chipTool, "Media Input - Rename Input Command: Sending command..."); + ChipLogProgress(chipTool, "Media Input - Show Input Status Command: Sending command..."); mOnFailureCallback_4 = new chip::Callback::Callback( - OnTestSendClusterMediaInputCommandRenameInput_4_FailureResponse, this); - mOnSuccessCallback_4 = - new chip::Callback::Callback(OnTestSendClusterMediaInputCommandRenameInput_4_SuccessResponse, this); + OnTestSendClusterMediaInputCommandShowInputStatus_4_FailureResponse, this); + mOnSuccessCallback_4 = new chip::Callback::Callback( + OnTestSendClusterMediaInputCommandShowInputStatus_4_SuccessResponse, this); chip::Controller::MediaInputCluster cluster; cluster.Associate(mDevice, 1); CHIP_ERROR err = CHIP_NO_ERROR; - uint8_t indexArgument = 1; - chip::ByteSpan nameArgument = chip::ByteSpan(chip::Uint8::from_const_char("newName"), strlen("newName")); - err = cluster.RenameInput(mOnSuccessCallback_4->Cancel(), mOnFailureCallback_4->Cancel(), indexArgument, nameArgument); + err = cluster.ShowInputStatus(mOnSuccessCallback_4->Cancel(), mOnFailureCallback_4->Cancel()); if (CHIP_NO_ERROR != err) { @@ -3217,9 +3383,9 @@ class TV_MediaInputCluster : public TestCommand return err; } - static void OnTestSendClusterMediaInputCommandRenameInput_4_FailureResponse(void * context, uint8_t status) + static void OnTestSendClusterMediaInputCommandShowInputStatus_4_FailureResponse(void * context, uint8_t status) { - ChipLogProgress(chipTool, "Media Input - Rename Input Command: Failure Response"); + ChipLogProgress(chipTool, "Media Input - Show Input Status Command: Failure Response"); TV_MediaInputCluster * runner = reinterpret_cast(context); @@ -3236,9 +3402,9 @@ class TV_MediaInputCluster : public TestCommand runner->NextTest(); } - static void OnTestSendClusterMediaInputCommandRenameInput_4_SuccessResponse(void * context) + static void OnTestSendClusterMediaInputCommandShowInputStatus_4_SuccessResponse(void * context) { - ChipLogProgress(chipTool, "Media Input - Rename Input Command: Success Response"); + ChipLogProgress(chipTool, "Media Input - Show Input Status Command: Success Response"); TV_MediaInputCluster * runner = reinterpret_cast(context); @@ -3254,6 +3420,77 @@ class TV_MediaInputCluster : public TestCommand runner->NextTest(); } + + // Test Rename Input Command + typedef void (*SuccessCallback_5)(void * context); + chip::Callback::Callback * mOnSuccessCallback_5 = nullptr; + chip::Callback::Callback * mOnFailureCallback_5 = nullptr; + bool mIsFailureExpected_5 = 0; + + CHIP_ERROR TestSendClusterMediaInputCommandRenameInput_5() + { + ChipLogProgress(chipTool, "Media Input - Rename Input Command: Sending command..."); + + mOnFailureCallback_5 = new chip::Callback::Callback( + OnTestSendClusterMediaInputCommandRenameInput_5_FailureResponse, this); + mOnSuccessCallback_5 = + new chip::Callback::Callback(OnTestSendClusterMediaInputCommandRenameInput_5_SuccessResponse, this); + + chip::Controller::MediaInputCluster cluster; + cluster.Associate(mDevice, 1); + + CHIP_ERROR err = CHIP_NO_ERROR; + + uint8_t indexArgument = 1; + chip::ByteSpan nameArgument = chip::ByteSpan(chip::Uint8::from_const_char("newName"), strlen("newName")); + err = cluster.RenameInput(mOnSuccessCallback_5->Cancel(), mOnFailureCallback_5->Cancel(), indexArgument, nameArgument); + + if (CHIP_NO_ERROR != err) + { + delete mOnFailureCallback_5; + delete mOnSuccessCallback_5; + } + + return err; + } + + static void OnTestSendClusterMediaInputCommandRenameInput_5_FailureResponse(void * context, uint8_t status) + { + ChipLogProgress(chipTool, "Media Input - Rename Input Command: Failure Response"); + + TV_MediaInputCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_5; + delete runner->mOnSuccessCallback_5; + + 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 OnTestSendClusterMediaInputCommandRenameInput_5_SuccessResponse(void * context) + { + ChipLogProgress(chipTool, "Media Input - Rename Input Command: Success Response"); + + TV_MediaInputCluster * runner = reinterpret_cast(context); + + delete runner->mOnFailureCallback_5; + delete runner->mOnSuccessCallback_5; + + 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(); + } }; class TestCluster : public TestCommand diff --git a/examples/tv-app/tv-common/gen/endpoint_config.h b/examples/tv-app/tv-common/gen/endpoint_config.h index e12fcc97e816ee..d32273256c8ca3 100644 --- a/examples/tv-app/tv-common/gen/endpoint_config.h +++ b/examples/tv-app/tv-common/gen/endpoint_config.h @@ -1391,7 +1391,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 182 +#define GENERATED_ATTRIBUTE_COUNT 185 #define GENERATED_ATTRIBUTES \ { \ \ @@ -1567,6 +1567,7 @@ \ /* Endpoint: 1, Cluster: Media Input (server) */ \ { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(4054) }, /* media input list */ \ + { 0x0001, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* current media input */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Low Power (server) */ \ @@ -1582,6 +1583,8 @@ \ /* Endpoint: 1, Cluster: Application Launcher (server) */ \ { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(4816) }, /* application launcher list */ \ + { 0x0001, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* catalog vendor id */ \ + { 0x0002, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* application id */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 2, Cluster: On/off (server) */ \ @@ -1735,55 +1738,55 @@ 0x0505, ZAP_ATTRIBUTE_INDEX(124), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Target Navigator (server) */ \ { \ - 0x0507, ZAP_ATTRIBUTE_INDEX(126), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0507, ZAP_ATTRIBUTE_INDEX(126), 3, 257, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Media Input (server) */ \ { \ - 0x0508, ZAP_ATTRIBUTE_INDEX(128), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0508, ZAP_ATTRIBUTE_INDEX(129), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Low Power (server) */ \ { \ - 0x0509, ZAP_ATTRIBUTE_INDEX(129), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0509, ZAP_ATTRIBUTE_INDEX(130), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Keypad Input (server) */ \ { \ - 0x050A, ZAP_ATTRIBUTE_INDEX(130), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050A, ZAP_ATTRIBUTE_INDEX(131), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Content Launcher (server) */ \ { \ - 0x050C, ZAP_ATTRIBUTE_INDEX(133), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050C, ZAP_ATTRIBUTE_INDEX(134), 4, 258, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Application Launcher (server) */ \ { 0x0006, \ - ZAP_ATTRIBUTE_INDEX(135), \ + ZAP_ATTRIBUTE_INDEX(138), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayOnOffServer }, /* Endpoint: 2, Cluster: On/off (server) */ \ { 0x0008, \ - ZAP_ATTRIBUTE_INDEX(137), \ + ZAP_ATTRIBUTE_INDEX(140), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayLevelControlServer }, /* Endpoint: 2, Cluster: Level Control (server) */ \ { \ - 0x050B, ZAP_ATTRIBUTE_INDEX(139), 3, 257, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050B, ZAP_ATTRIBUTE_INDEX(142), 3, 257, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 2, Cluster: Audio Output (server) */ \ { \ - 0x0506, ZAP_ATTRIBUTE_INDEX(142), 9, 59, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0506, ZAP_ATTRIBUTE_INDEX(145), 9, 59, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 3, Cluster: Media Playback (server) */ \ { \ - 0x050A, ZAP_ATTRIBUTE_INDEX(151), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050A, ZAP_ATTRIBUTE_INDEX(154), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 3, Cluster: Content Launcher (server) */ \ { \ - 0x050D, ZAP_ATTRIBUTE_INDEX(154), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050D, ZAP_ATTRIBUTE_INDEX(157), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 3, Cluster: Application Basic (server) */ \ { \ - 0x050E, ZAP_ATTRIBUTE_INDEX(162), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050E, ZAP_ATTRIBUTE_INDEX(165), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 3, Cluster: Account Login (server) */ \ { \ - 0x050A, ZAP_ATTRIBUTE_INDEX(163), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050A, ZAP_ATTRIBUTE_INDEX(166), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 4, Cluster: Content Launcher (server) */ \ { \ - 0x050D, ZAP_ATTRIBUTE_INDEX(166), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050D, ZAP_ATTRIBUTE_INDEX(169), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 4, Cluster: Application Basic (server) */ \ { \ - 0x050D, ZAP_ATTRIBUTE_INDEX(174), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050D, ZAP_ATTRIBUTE_INDEX(177), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 5, Cluster: Application Basic (server) */ \ } @@ -1792,7 +1795,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 15, 3527 }, { ZAP_CLUSTER_INDEX(15), 9, 1639 }, { ZAP_CLUSTER_INDEX(24), 3, 263 }, \ + { ZAP_CLUSTER_INDEX(0), 15, 3527 }, { ZAP_CLUSTER_INDEX(15), 9, 1642 }, { ZAP_CLUSTER_INDEX(24), 3, 263 }, \ { ZAP_CLUSTER_INDEX(27), 4, 676 }, { ZAP_CLUSTER_INDEX(31), 2, 615 }, { ZAP_CLUSTER_INDEX(33), 1, 105 }, \ } @@ -1803,7 +1806,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (641) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (6825) +#define ATTRIBUTE_MAX_SIZE (6828) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (6) diff --git a/src/controller/data_model/gen/CHIPClusters.cpp b/src/controller/data_model/gen/CHIPClusters.cpp index 806d31e96285da..5bb2e62ceeaeee 100644 --- a/src/controller/data_model/gen/CHIPClusters.cpp +++ b/src/controller/data_model/gen/CHIPClusters.cpp @@ -348,6 +348,30 @@ CHIP_ERROR ApplicationLauncherCluster::ReadAttributeApplicationLauncherList(Call ApplicationLauncherClusterApplicationLauncherListListAttributeFilter); } +CHIP_ERROR ApplicationLauncherCluster::ReadAttributeCatalogVendorId(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + chip::app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x0001; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + +CHIP_ERROR ApplicationLauncherCluster::ReadAttributeApplicationId(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + chip::app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x0002; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + CHIP_ERROR ApplicationLauncherCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { @@ -465,6 +489,18 @@ CHIP_ERROR AudioOutputCluster::ReadAttributeAudioOutputList(Callback::Cancelable AudioOutputClusterAudioOutputListListAttributeFilter); } +CHIP_ERROR AudioOutputCluster::ReadAttributeCurrentAudioOutput(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + chip::app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x0001; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + CHIP_ERROR AudioOutputCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { @@ -5881,6 +5917,18 @@ CHIP_ERROR MediaInputCluster::ReadAttributeMediaInputList(Callback::Cancelable * MediaInputClusterMediaInputListListAttributeFilter); } +CHIP_ERROR MediaInputCluster::ReadAttributeCurrentMediaInput(Callback::Cancelable * onSuccessCallback, + Callback::Cancelable * onFailureCallback) +{ + chip::app::AttributePathParams attributePath; + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x0001; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, + BasicAttributeFilter); +} + CHIP_ERROR MediaInputCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) { diff --git a/src/controller/data_model/gen/CHIPClusters.h b/src/controller/data_model/gen/CHIPClusters.h index 1f58a61b350b7b..5d854238d64a3d 100644 --- a/src/controller/data_model/gen/CHIPClusters.h +++ b/src/controller/data_model/gen/CHIPClusters.h @@ -134,6 +134,8 @@ class DLL_EXPORT ApplicationLauncherCluster : public ClusterBase CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR ReadAttributeApplicationLauncherList(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeCatalogVendorId(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeApplicationId(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); private: @@ -154,6 +156,7 @@ class DLL_EXPORT AudioOutputCluster : public ClusterBase // Cluster Attributes CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR ReadAttributeAudioOutputList(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeCurrentAudioOutput(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); private: @@ -870,6 +873,7 @@ class DLL_EXPORT MediaInputCluster : public ClusterBase // Cluster Attributes CHIP_ERROR DiscoverAttributes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR ReadAttributeMediaInputList(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); + CHIP_ERROR ReadAttributeCurrentMediaInput(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); CHIP_ERROR ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback); private: diff --git a/src/controller/data_model/gen/chip-zcl-zpro-codec-api.h b/src/controller/data_model/gen/chip-zcl-zpro-codec-api.h index 48899292648be7..7c5a6c4d1c98ac 100644 --- a/src/controller/data_model/gen/chip-zcl-zpro-codec-api.h +++ b/src/controller/data_model/gen/chip-zcl-zpro-codec-api.h @@ -189,6 +189,8 @@ chip::System::PacketBufferHandle encodeApplicationBasicClusterReadClusterRevisio |------------------------------------------------------------------------------| | Attributes: | | | * ApplicationLauncherList | 0x0000 | +| * CatalogVendorId | 0x0001 | +| * ApplicationId | 0x0002 | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -207,6 +209,20 @@ chip::System::PacketBufferHandle encodeApplicationLauncherClusterDiscoverAttribu chip::System::PacketBufferHandle encodeApplicationLauncherClusterReadApplicationLauncherListAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); +/** + * @brief + * Encode a Application Launcher server read command for the catalog vendor id attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeApplicationLauncherClusterReadCatalogVendorIdAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + +/** + * @brief + * Encode a Application Launcher server read command for the application id attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeApplicationLauncherClusterReadApplicationIdAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + /** * @brief * Encode a Application Launcher server read command for the cluster revision attribute into buffer including the APS frame @@ -223,6 +239,7 @@ chip::System::PacketBufferHandle encodeApplicationLauncherClusterReadClusterRevi |------------------------------------------------------------------------------| | Attributes: | | | * AudioOutputList | 0x0000 | +| * CurrentAudioOutput | 0x0001 | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -239,6 +256,13 @@ chip::System::PacketBufferHandle encodeAudioOutputClusterDiscoverAttributes(uint chip::System::PacketBufferHandle encodeAudioOutputClusterReadAudioOutputListAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); +/** + * @brief + * Encode a Audio Output server read command for the current audio output attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeAudioOutputClusterReadCurrentAudioOutputAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + /** * @brief * Encode a Audio Output server read command for the cluster revision attribute into buffer including the APS frame @@ -2055,6 +2079,7 @@ chip::System::PacketBufferHandle encodeLowPowerClusterReadClusterRevisionAttribu |------------------------------------------------------------------------------| | Attributes: | | | * MediaInputList | 0x0000 | +| * CurrentMediaInput | 0x0001 | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -2071,6 +2096,13 @@ chip::System::PacketBufferHandle encodeMediaInputClusterDiscoverAttributes(uint8 chip::System::PacketBufferHandle encodeMediaInputClusterReadMediaInputListAttribute(uint8_t seqNum, chip::EndpointId destinationEndpoint); +/** + * @brief + * Encode a Media Input server read command for the current media input attribute into buffer including the APS frame + */ +chip::System::PacketBufferHandle encodeMediaInputClusterReadCurrentMediaInputAttribute(uint8_t seqNum, + chip::EndpointId destinationEndpoint); + /** * @brief * Encode a Media Input server read command for the cluster revision attribute into buffer including the APS frame diff --git a/src/controller/data_model/gen/encoder.cpp b/src/controller/data_model/gen/encoder.cpp index 744cca1f112b69..556e4fe8c2aaf0 100644 --- a/src/controller/data_model/gen/encoder.cpp +++ b/src/controller/data_model/gen/encoder.cpp @@ -288,6 +288,8 @@ PacketBufferHandle encodeApplicationBasicClusterReadClusterRevisionAttribute(uin |------------------------------------------------------------------------------| | Attributes: | | | * ApplicationLauncherList | 0x0000 | +| * CatalogVendorId | 0x0001 | +| * ApplicationId | 0x0002 | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -312,6 +314,32 @@ PacketBufferHandle encodeApplicationLauncherClusterReadApplicationLauncherListAt COMMAND_FOOTER(); } +/* + * Attribute CatalogVendorId + */ +PacketBufferHandle encodeApplicationLauncherClusterReadCatalogVendorIdAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadApplicationLauncherCatalogVendorId", ApplicationLauncher::Id); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put32(Globals::Commands::Ids::ReadAttributes) + .Put32(ApplicationLauncher::Attributes::Ids::CatalogVendorId); + COMMAND_FOOTER(); +} + +/* + * Attribute ApplicationId + */ +PacketBufferHandle encodeApplicationLauncherClusterReadApplicationIdAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadApplicationLauncherApplicationId", ApplicationLauncher::Id); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put32(Globals::Commands::Ids::ReadAttributes) + .Put32(ApplicationLauncher::Attributes::Ids::ApplicationId); + COMMAND_FOOTER(); +} + /* * Attribute ClusterRevision */ @@ -334,6 +362,7 @@ PacketBufferHandle encodeApplicationLauncherClusterReadClusterRevisionAttribute( |------------------------------------------------------------------------------| | Attributes: | | | * AudioOutputList | 0x0000 | +| * CurrentAudioOutput | 0x0001 | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -357,6 +386,19 @@ PacketBufferHandle encodeAudioOutputClusterReadAudioOutputListAttribute(uint8_t COMMAND_FOOTER(); } +/* + * Attribute CurrentAudioOutput + */ +PacketBufferHandle encodeAudioOutputClusterReadCurrentAudioOutputAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadAudioOutputCurrentAudioOutput", AudioOutput::Id); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put32(Globals::Commands::Ids::ReadAttributes) + .Put32(AudioOutput::Attributes::Ids::CurrentAudioOutput); + COMMAND_FOOTER(); +} + /* * Attribute ClusterRevision */ @@ -3295,6 +3337,7 @@ PacketBufferHandle encodeLowPowerClusterReadClusterRevisionAttribute(uint8_t seq |------------------------------------------------------------------------------| | Attributes: | | | * MediaInputList | 0x0000 | +| * CurrentMediaInput | 0x0001 | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -3318,6 +3361,19 @@ PacketBufferHandle encodeMediaInputClusterReadMediaInputListAttribute(uint8_t se COMMAND_FOOTER(); } +/* + * Attribute CurrentMediaInput + */ +PacketBufferHandle encodeMediaInputClusterReadCurrentMediaInputAttribute(uint8_t seqNum, EndpointId destinationEndpoint) +{ + COMMAND_HEADER("ReadMediaInputCurrentMediaInput", MediaInput::Id); + buf.Put8(kFrameControlGlobalCommand) + .Put8(seqNum) + .Put32(Globals::Commands::Ids::ReadAttributes) + .Put32(MediaInput::Attributes::Ids::CurrentMediaInput); + COMMAND_FOOTER(); +} + /* * Attribute ClusterRevision */ diff --git a/src/controller/python/chip/clusters/CHIPClusters.cpp b/src/controller/python/chip/clusters/CHIPClusters.cpp index 1a970de024d9c8..a774500e8bc2ad 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.cpp +++ b/src/controller/python/chip/clusters/CHIPClusters.cpp @@ -476,6 +476,25 @@ CHIP_ERROR chip_ime_ReadAttribute_ApplicationLauncher_ApplicationLauncherList(ch gDefaultFailureCallback.Cancel()); } +CHIP_ERROR chip_ime_ReadAttribute_ApplicationLauncher_CatalogVendorId(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ApplicationLauncherCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCatalogVendorId(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + +CHIP_ERROR chip_ime_ReadAttribute_ApplicationLauncher_ApplicationId(chip::Controller::Device * device, + chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::ApplicationLauncherCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeApplicationId(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + CHIP_ERROR chip_ime_ReadAttribute_ApplicationLauncher_ClusterRevision(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) @@ -516,6 +535,15 @@ CHIP_ERROR chip_ime_ReadAttribute_AudioOutput_AudioOutputList(chip::Controller:: gDefaultFailureCallback.Cancel()); } +CHIP_ERROR chip_ime_ReadAttribute_AudioOutput_CurrentAudioOutput(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::AudioOutputCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentAudioOutput(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + CHIP_ERROR chip_ime_ReadAttribute_AudioOutput_ClusterRevision(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { @@ -2864,6 +2892,15 @@ CHIP_ERROR chip_ime_ReadAttribute_MediaInput_MediaInputList(chip::Controller::De gDefaultFailureCallback.Cancel()); } +CHIP_ERROR chip_ime_ReadAttribute_MediaInput_CurrentMediaInput(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, + chip::GroupId /* ZCLgroupId */) +{ + VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + chip::Controller::MediaInputCluster cluster; + cluster.Associate(device, ZCLendpointId); + return cluster.ReadAttributeCurrentMediaInput(gInt8uAttributeCallback.Cancel(), gDefaultFailureCallback.Cancel()); +} + CHIP_ERROR chip_ime_ReadAttribute_MediaInput_ClusterRevision(chip::Controller::Device * device, chip::EndpointId ZCLendpointId, chip::GroupId /* ZCLgroupId */) { diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index babaf37fa4878e..cff2f5e8661b6c 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -732,6 +732,14 @@ def ListClusterAttributes(self): "attributeId": 0x0000, "type": "int", }, + "CatalogVendorId": { + "attributeId": 0x0001, + "type": "int", + }, + "ApplicationId": { + "attributeId": 0x0002, + "type": "int", + }, "ClusterRevision": { "attributeId": 0xFFFD, "type": "int", @@ -742,6 +750,10 @@ def ListClusterAttributes(self): "attributeId": 0x0000, "type": "", }, + "CurrentAudioOutput": { + "attributeId": 0x0001, + "type": "int", + }, "ClusterRevision": { "attributeId": 0xFFFD, "type": "int", @@ -1418,6 +1430,10 @@ def ListClusterAttributes(self): "attributeId": 0x0000, "type": "", }, + "CurrentMediaInput": { + "attributeId": 0x0001, + "type": "int", + }, "ClusterRevision": { "attributeId": 0xFFFD, "type": "int", @@ -2805,10 +2821,16 @@ def ClusterApplicationBasic_ReadAttributeClusterRevision(self, device: ctypes.c_ return self._chipLib.chip_ime_ReadAttribute_ApplicationBasic_ClusterRevision(device, ZCLendpoint, ZCLgroupid) def ClusterApplicationLauncher_ReadAttributeApplicationLauncherList(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_ApplicationLauncher_ApplicationLauncherList(device, ZCLendpoint, ZCLgroupid) + def ClusterApplicationLauncher_ReadAttributeCatalogVendorId(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_ApplicationLauncher_CatalogVendorId(device, ZCLendpoint, ZCLgroupid) + def ClusterApplicationLauncher_ReadAttributeApplicationId(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_ApplicationLauncher_ApplicationId(device, ZCLendpoint, ZCLgroupid) def ClusterApplicationLauncher_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_ApplicationLauncher_ClusterRevision(device, ZCLendpoint, ZCLgroupid) def ClusterAudioOutput_ReadAttributeAudioOutputList(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_AudioOutput_AudioOutputList(device, ZCLendpoint, ZCLgroupid) + def ClusterAudioOutput_ReadAttributeCurrentAudioOutput(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_AudioOutput_CurrentAudioOutput(device, ZCLendpoint, ZCLgroupid) def ClusterAudioOutput_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_AudioOutput_ClusterRevision(device, ZCLendpoint, ZCLgroupid) def ClusterBarrierControl_ReadAttributeBarrierMovingState(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): @@ -3172,6 +3194,8 @@ def ClusterLowPower_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, return self._chipLib.chip_ime_ReadAttribute_LowPower_ClusterRevision(device, ZCLendpoint, ZCLgroupid) def ClusterMediaInput_ReadAttributeMediaInputList(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_MediaInput_MediaInputList(device, ZCLendpoint, ZCLgroupid) + def ClusterMediaInput_ReadAttributeCurrentMediaInput(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): + return self._chipLib.chip_ime_ReadAttribute_MediaInput_CurrentMediaInput(device, ZCLendpoint, ZCLgroupid) def ClusterMediaInput_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): return self._chipLib.chip_ime_ReadAttribute_MediaInput_ClusterRevision(device, ZCLendpoint, ZCLgroupid) def ClusterMediaPlayback_ReadAttributeClusterRevision(self, device: ctypes.c_void_p, ZCLendpoint: int, ZCLgroupid: int): @@ -3643,6 +3667,12 @@ def InitLib(self, chipLib): # Cluster ApplicationLauncher ReadAttribute ApplicationLauncherList self._chipLib.chip_ime_ReadAttribute_ApplicationLauncher_ApplicationLauncherList.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] self._chipLib.chip_ime_ReadAttribute_ApplicationLauncher_ApplicationLauncherList.restype = ctypes.c_uint32 + # Cluster ApplicationLauncher ReadAttribute CatalogVendorId + self._chipLib.chip_ime_ReadAttribute_ApplicationLauncher_CatalogVendorId.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_ApplicationLauncher_CatalogVendorId.restype = ctypes.c_uint32 + # Cluster ApplicationLauncher ReadAttribute ApplicationId + self._chipLib.chip_ime_ReadAttribute_ApplicationLauncher_ApplicationId.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_ApplicationLauncher_ApplicationId.restype = ctypes.c_uint32 # Cluster ApplicationLauncher ReadAttribute ClusterRevision self._chipLib.chip_ime_ReadAttribute_ApplicationLauncher_ClusterRevision.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] self._chipLib.chip_ime_ReadAttribute_ApplicationLauncher_ClusterRevision.restype = ctypes.c_uint32 @@ -3656,6 +3686,9 @@ def InitLib(self, chipLib): # Cluster AudioOutput ReadAttribute AudioOutputList self._chipLib.chip_ime_ReadAttribute_AudioOutput_AudioOutputList.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] self._chipLib.chip_ime_ReadAttribute_AudioOutput_AudioOutputList.restype = ctypes.c_uint32 + # Cluster AudioOutput ReadAttribute CurrentAudioOutput + self._chipLib.chip_ime_ReadAttribute_AudioOutput_CurrentAudioOutput.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_AudioOutput_CurrentAudioOutput.restype = ctypes.c_uint32 # Cluster AudioOutput ReadAttribute ClusterRevision self._chipLib.chip_ime_ReadAttribute_AudioOutput_ClusterRevision.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] self._chipLib.chip_ime_ReadAttribute_AudioOutput_ClusterRevision.restype = ctypes.c_uint32 @@ -4432,6 +4465,9 @@ def InitLib(self, chipLib): # Cluster MediaInput ReadAttribute MediaInputList self._chipLib.chip_ime_ReadAttribute_MediaInput_MediaInputList.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] self._chipLib.chip_ime_ReadAttribute_MediaInput_MediaInputList.restype = ctypes.c_uint32 + # Cluster MediaInput ReadAttribute CurrentMediaInput + self._chipLib.chip_ime_ReadAttribute_MediaInput_CurrentMediaInput.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] + self._chipLib.chip_ime_ReadAttribute_MediaInput_CurrentMediaInput.restype = ctypes.c_uint32 # Cluster MediaInput ReadAttribute ClusterRevision self._chipLib.chip_ime_ReadAttribute_MediaInput_ClusterRevision.argtypes = [ctypes.c_void_p, ctypes.c_uint8, ctypes.c_uint16] self._chipLib.chip_ime_ReadAttribute_MediaInput_ClusterRevision.restype = ctypes.c_uint32 diff --git a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h index e74e9ab2539740..859db3bdab8d74 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.h @@ -86,6 +86,8 @@ NS_ASSUME_NONNULL_BEGIN responseHandler:(ResponseHandler)responseHandler; - (void)readAttributeApplicationLauncherListWithResponseHandler:(ResponseHandler)responseHandler; +- (void)readAttributeCatalogVendorIdWithResponseHandler:(ResponseHandler)responseHandler; +- (void)readAttributeApplicationIdWithResponseHandler:(ResponseHandler)responseHandler; - (void)readAttributeClusterRevisionWithResponseHandler:(ResponseHandler)responseHandler; @end @@ -100,6 +102,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)selectOutput:(uint8_t)index responseHandler:(ResponseHandler)responseHandler; - (void)readAttributeAudioOutputListWithResponseHandler:(ResponseHandler)responseHandler; +- (void)readAttributeCurrentAudioOutputWithResponseHandler:(ResponseHandler)responseHandler; - (void)readAttributeClusterRevisionWithResponseHandler:(ResponseHandler)responseHandler; @end @@ -727,6 +730,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)showInputStatus:(ResponseHandler)responseHandler; - (void)readAttributeMediaInputListWithResponseHandler:(ResponseHandler)responseHandler; +- (void)readAttributeCurrentMediaInputWithResponseHandler:(ResponseHandler)responseHandler; - (void)readAttributeClusterRevisionWithResponseHandler:(ResponseHandler)responseHandler; @end diff --git a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm index 96d1823b7f924f..a69b1aa56aabc5 100644 --- a/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/gen/CHIPClustersObjc.mm @@ -4066,6 +4066,60 @@ - (void)readAttributeApplicationLauncherListWithResponseHandler:(ResponseHandler } } +- (void)readAttributeCatalogVendorIdWithResponseHandler:(ResponseHandler)responseHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(responseHandler, [self callbackQueue]); + if (!onSuccess) { + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(responseHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeCatalogVendorId(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + +- (void)readAttributeApplicationIdWithResponseHandler:(ResponseHandler)responseHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(responseHandler, [self callbackQueue]); + if (!onSuccess) { + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(responseHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeApplicationId(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + - (void)readAttributeClusterRevisionWithResponseHandler:(ResponseHandler)responseHandler { CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(responseHandler, [self callbackQueue]); @@ -4189,6 +4243,33 @@ - (void)readAttributeAudioOutputListWithResponseHandler:(ResponseHandler)respons } } +- (void)readAttributeCurrentAudioOutputWithResponseHandler:(ResponseHandler)responseHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(responseHandler, [self callbackQueue]); + if (!onSuccess) { + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(responseHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeCurrentAudioOutput(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + - (void)readAttributeClusterRevisionWithResponseHandler:(ResponseHandler)responseHandler { CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(responseHandler, [self callbackQueue]); @@ -11647,6 +11728,33 @@ - (void)readAttributeMediaInputListWithResponseHandler:(ResponseHandler)response } } +- (void)readAttributeCurrentMediaInputWithResponseHandler:(ResponseHandler)responseHandler +{ + CHIPInt8uAttributeCallbackBridge * onSuccess = new CHIPInt8uAttributeCallbackBridge(responseHandler, [self callbackQueue]); + if (!onSuccess) { + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + CHIPDefaultFailureCallbackBridge * onFailure = new CHIPDefaultFailureCallbackBridge(responseHandler, [self callbackQueue]); + if (!onFailure) { + delete onSuccess; + responseHandler([CHIPError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE], nil); + return; + } + + __block CHIP_ERROR err; + dispatch_sync([self chipWorkQueue], ^{ + err = self.cppCluster.ReadAttributeCurrentMediaInput(onSuccess->Cancel(), onFailure->Cancel()); + }); + + if (err != CHIP_NO_ERROR) { + delete onSuccess; + delete onFailure; + responseHandler([CHIPError errorForCHIPErrorCode:err], nil); + } +} + - (void)readAttributeClusterRevisionWithResponseHandler:(ResponseHandler)responseHandler { CHIPInt16uAttributeCallbackBridge * onSuccess = new CHIPInt16uAttributeCallbackBridge(responseHandler, [self callbackQueue]); diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index 1ba4acf294b9eb..164a1384fae2d5 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -3129,6 +3129,44 @@ - (void)testSendClusterApplicationLauncherReadAttributeApplicationLauncherListWi [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterApplicationLauncherReadAttributeCatalogVendorIdWithResponseHandler +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"ApplicationLauncherReadAttributeCatalogVendorIdWithResponseHandler"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPApplicationLauncher * cluster = [[CHIPApplicationLauncher alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCatalogVendorIdWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"ApplicationLauncher CatalogVendorId Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterApplicationLauncherReadAttributeApplicationIdWithResponseHandler +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"ApplicationLauncherReadAttributeApplicationIdWithResponseHandler"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPApplicationLauncher * cluster = [[CHIPApplicationLauncher alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeApplicationIdWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"ApplicationLauncher ApplicationId Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterApplicationLauncherReadAttributeClusterRevisionWithResponseHandler { XCTestExpectation * expectation = @@ -3167,6 +3205,25 @@ - (void)testSendClusterAudioOutputReadAttributeAudioOutputListWithResponseHandle [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterAudioOutputReadAttributeCurrentAudioOutputWithResponseHandler +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"AudioOutputReadAttributeCurrentAudioOutputWithResponseHandler"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPAudioOutput * cluster = [[CHIPAudioOutput alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentAudioOutputWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"AudioOutput CurrentAudioOutput Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterAudioOutputReadAttributeClusterRevisionWithResponseHandler { XCTestExpectation * expectation = @@ -5969,6 +6026,25 @@ - (void)testSendClusterMediaInputReadAttributeMediaInputListWithResponseHandler [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterMediaInputReadAttributeCurrentMediaInputWithResponseHandler +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"MediaInputReadAttributeCurrentMediaInputWithResponseHandler"]; + + CHIPDevice * device = GetPairedDevice(kDeviceId); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPMediaInput * cluster = [[CHIPMediaInput alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentMediaInputWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"MediaInput CurrentMediaInput Error: %@", err); + XCTAssertEqual(err.code, 0); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterMediaInputReadAttributeClusterRevisionWithResponseHandler { XCTestExpectation * expectation =