diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index f9aace48dfb1ef..f5209f5788abde 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -12119,6 +12119,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "current media input", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, { "name": "cluster revision", "code": 65533, @@ -12450,6 +12465,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "current audio output", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, { "name": "cluster revision", "code": 65533, @@ -12535,6 +12565,36 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "catalog vendor id", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "application id", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, { "name": "cluster revision", "code": 65533, diff --git a/examples/all-clusters-app/all-clusters-common/gen/endpoint_config.h b/examples/all-clusters-app/all-clusters-common/gen/endpoint_config.h index 4753f78a2f96c8..6690b2eaf13dd6 100644 --- a/examples/all-clusters-app/all-clusters-common/gen/endpoint_config.h +++ b/examples/all-clusters-app/all-clusters-common/gen/endpoint_config.h @@ -1809,7 +1809,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 363 +#define GENERATED_ATTRIBUTE_COUNT 367 #define GENERATED_ATTRIBUTES \ { \ \ @@ -2216,6 +2216,7 @@ \ /* Endpoint: 1, Cluster: Media Input (server) */ \ { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(6470) }, /* 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) */ \ @@ -2231,10 +2232,13 @@ \ /* Endpoint: 1, Cluster: Audio Output (server) */ \ { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(7232) }, /* audio output list */ \ + { 0x0001, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* current audio output */ \ { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \ \ /* Endpoint: 1, Cluster: Application Launcher (server) */ \ { 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(7486) }, /* 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: 1, Cluster: Application Basic (server) */ \ @@ -2510,46 +2514,46 @@ 0x0506, ZAP_ATTRIBUTE_INDEX(302), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Media Playback (server) */ \ { \ - 0x0507, ZAP_ATTRIBUTE_INDEX(303), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0507, ZAP_ATTRIBUTE_INDEX(303), 3, 257, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Media Input (server) */ \ { \ - 0x0508, ZAP_ATTRIBUTE_INDEX(305), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0508, ZAP_ATTRIBUTE_INDEX(306), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Low Power (server) */ \ { \ - 0x0509, ZAP_ATTRIBUTE_INDEX(306), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0509, ZAP_ATTRIBUTE_INDEX(307), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Keypad Input (server) */ \ { \ - 0x050A, ZAP_ATTRIBUTE_INDEX(307), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050A, ZAP_ATTRIBUTE_INDEX(308), 3, 510, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Content Launcher (server) */ \ { \ - 0x050B, ZAP_ATTRIBUTE_INDEX(310), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050B, ZAP_ATTRIBUTE_INDEX(311), 3, 257, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Audio Output (server) */ \ { \ - 0x050C, ZAP_ATTRIBUTE_INDEX(312), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050C, ZAP_ATTRIBUTE_INDEX(314), 4, 258, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Application Launcher (server) */ \ { \ - 0x050D, ZAP_ATTRIBUTE_INDEX(314), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050D, ZAP_ATTRIBUTE_INDEX(318), 8, 105, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Application Basic (server) */ \ { \ - 0x050E, ZAP_ATTRIBUTE_INDEX(322), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050E, ZAP_ATTRIBUTE_INDEX(326), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Account Login (server) */ \ { \ - 0x050F, ZAP_ATTRIBUTE_INDEX(323), 21, 1579, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x050F, ZAP_ATTRIBUTE_INDEX(327), 21, 1579, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Test Cluster (server) */ \ { \ - 0x0B04, ZAP_ATTRIBUTE_INDEX(344), 12, 28, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0x0B04, ZAP_ATTRIBUTE_INDEX(348), 12, 28, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Electrical Measurement (server) */ \ { \ - 0xF000, ZAP_ATTRIBUTE_INDEX(356), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ + 0xF000, ZAP_ATTRIBUTE_INDEX(360), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \ }, /* Endpoint: 1, Cluster: Binding (server) */ \ { 0x0006, \ - ZAP_ATTRIBUTE_INDEX(357), \ + ZAP_ATTRIBUTE_INDEX(361), \ 2, \ 3, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ chipFuncArrayOnOffServer }, /* Endpoint: 2, Cluster: On/off (server) */ \ { 0x0406, \ - ZAP_ATTRIBUTE_INDEX(359), \ + ZAP_ATTRIBUTE_INDEX(363), \ 4, \ 5, \ ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -2561,7 +2565,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 15, 3560 }, { ZAP_CLUSTER_INDEX(15), 37, 6238 }, { ZAP_CLUSTER_INDEX(52), 2, 8 }, \ + { ZAP_CLUSTER_INDEX(0), 15, 3560 }, { ZAP_CLUSTER_INDEX(15), 37, 6242 }, { ZAP_CLUSTER_INDEX(52), 2, 8 }, \ } // Largest attribute size is needed for various buffers @@ -2571,7 +2575,7 @@ #define ATTRIBUTE_SINGLETONS_SIZE (1497) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (9806) +#define ATTRIBUTE_MAX_SIZE (9810) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (3) diff --git a/examples/chip-tool/commands/clusters/Commands.h b/examples/chip-tool/commands/clusters/Commands.h index 3bdd877ac4fdfb..c9a3a7a2338b79 100644 --- a/examples/chip-tool/commands/clusters/Commands.h +++ b/examples/chip-tool/commands/clusters/Commands.h @@ -1698,6 +1698,8 @@ class ReadApplicationBasicClusterRevision : public ModelCommand |------------------------------------------------------------------------------| | Attributes: | | | * ApplicationLauncherList | 0x0000 | +| * CatalogVendorId | 0x0001 | +| * ApplicationId | 0x0002 | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -1807,6 +1809,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 */ @@ -1850,6 +1920,7 @@ class ReadApplicationLauncherClusterRevision : public ModelCommand |------------------------------------------------------------------------------| | Attributes: | | | * AudioOutputList | 0x0000 | +| * CurrentAudioOutput | 0x0001 | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -1989,6 +2060,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 */ @@ -11962,6 +12067,7 @@ class ReadLowPowerClusterRevision : public ModelCommand |------------------------------------------------------------------------------| | Attributes: | | | * MediaInputList | 0x0000 | +| * CurrentMediaInput | 0x0001 | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -12159,6 +12265,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 */ @@ -22844,6 +22984,8 @@ void registerClusterApplicationLauncher(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), make_unique(), }; @@ -22854,9 +22996,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); @@ -23298,10 +23440,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/examples/tv-app/tv-common/tv-app.zap b/examples/tv-app/tv-common/tv-app.zap index 01b30d6c9afbe7..5d3c22746c03b6 100644 --- a/examples/tv-app/tv-common/tv-app.zap +++ b/examples/tv-app/tv-common/tv-app.zap @@ -6307,6 +6307,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "current media input", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, { "name": "cluster revision", "code": 65533, @@ -6639,6 +6654,36 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "catalog vendor id", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "application id", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, { "name": "cluster revision", "code": 65533, diff --git a/src/app/tests/suites/TV_ApplicationLauncherCluster.yaml b/src/app/tests/suites/TV_ApplicationLauncherCluster.yaml index 545623bd82dfa8..27c795a7a648e6 100644 --- a/src/app/tests/suites/TV_ApplicationLauncherCluster.yaml +++ b/src/app/tests/suites/TV_ApplicationLauncherCluster.yaml @@ -35,3 +35,24 @@ tests: value: 1 - name: "applicationId" value: "appId" + + # TODO: Enable this once struct as response type is supported + # response: + # values: + # - name: "status" + # value: 0 + # - name: "data" + # value: "data" + # TODO: Read attribute catalog vendor id and Read attribute catalog vendor id + # TODO: shoudl be one test, but currently struct as attribute is not supported + - label: "Read attribute catalog vendor id" + command: "readAttribute" + attribute: "catalog vendor id" + response: + value: 0 + + - label: "Read attribute application id" + command: "readAttribute" + attribute: "application id" + response: + value: 0 diff --git a/src/app/tests/suites/TV_MediaInputCluster.yaml b/src/app/tests/suites/TV_MediaInputCluster.yaml index 8f26fb10311501..b07076486f99ff 100644 --- a/src/app/tests/suites/TV_MediaInputCluster.yaml +++ b/src/app/tests/suites/TV_MediaInputCluster.yaml @@ -36,6 +36,12 @@ tests: - name: "index" value: 1 + - label: "Read current input list" + command: "readAttribute" + attribute: "current media input" + response: + value: 1 + - label: "Hide Input Status Command" command: "HideInputStatus" diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index 913a394d462ce9..35216d8b2fe229 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -7825,6 +7825,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "current media input", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, { "name": "cluster revision", "code": 65533, @@ -8156,6 +8171,21 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "current audio output", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, { "name": "cluster revision", "code": 65533, @@ -8241,6 +8271,36 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "catalog vendor id", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "application id", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 0, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, { "name": "cluster revision", "code": 65533, diff --git a/src/controller/data_model/gen/CHIPClusters.cpp b/src/controller/data_model/gen/CHIPClusters.cpp index a2efa285655cc2..2b0c499c9bad37 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) { @@ -6133,6 +6169,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 89e77da8de70d5..bed76bbfc7b39e 100644 --- a/src/controller/data_model/gen/CHIPClusters.h +++ b/src/controller/data_model/gen/CHIPClusters.h @@ -135,6 +135,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: @@ -155,6 +157,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: @@ -889,6 +892,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 f932e0ddf9eadf..a4889b2a70a212 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 @@ -190,6 +190,8 @@ chip::System::PacketBufferHandle encodeApplicationBasicClusterReadClusterRevisio |------------------------------------------------------------------------------| | Attributes: | | | * ApplicationLauncherList | 0x0000 | +| * CatalogVendorId | 0x0001 | +| * ApplicationId | 0x0002 | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -208,6 +210,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 @@ -224,6 +240,7 @@ chip::System::PacketBufferHandle encodeApplicationLauncherClusterReadClusterRevi |------------------------------------------------------------------------------| | Attributes: | | | * AudioOutputList | 0x0000 | +| * CurrentAudioOutput | 0x0001 | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -240,6 +257,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 @@ -2061,6 +2085,7 @@ chip::System::PacketBufferHandle encodeLowPowerClusterReadClusterRevisionAttribu |------------------------------------------------------------------------------| | Attributes: | | | * MediaInputList | 0x0000 | +| * CurrentMediaInput | 0x0001 | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -2077,6 +2102,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 76b72ca3d4a771..922545e7a00f55 100644 --- a/src/controller/data_model/gen/encoder.cpp +++ b/src/controller/data_model/gen/encoder.cpp @@ -289,6 +289,8 @@ PacketBufferHandle encodeApplicationBasicClusterReadClusterRevisionAttribute(uin |------------------------------------------------------------------------------| | Attributes: | | | * ApplicationLauncherList | 0x0000 | +| * CatalogVendorId | 0x0001 | +| * ApplicationId | 0x0002 | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -313,6 +315,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 */ @@ -335,6 +363,7 @@ PacketBufferHandle encodeApplicationLauncherClusterReadClusterRevisionAttribute( |------------------------------------------------------------------------------| | Attributes: | | | * AudioOutputList | 0x0000 | +| * CurrentAudioOutput | 0x0001 | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -358,6 +387,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 */ @@ -3301,6 +3343,7 @@ PacketBufferHandle encodeLowPowerClusterReadClusterRevisionAttribute(uint8_t seq |------------------------------------------------------------------------------| | Attributes: | | | * MediaInputList | 0x0000 | +| * CurrentMediaInput | 0x0001 | | * ClusterRevision | 0xFFFD | \*----------------------------------------------------------------------------*/ @@ -3324,6 +3367,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 580ad583d7c6ab..f4109508e4d28a 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 */) { @@ -2915,6 +2943,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 95c359beeb0492..20fef58b03f735 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -770,6 +770,14 @@ def ListClusterAttributes(self): "attributeId": 0x0000, "type": "int", }, + "CatalogVendorId": { + "attributeId": 0x0001, + "type": "int", + }, + "ApplicationId": { + "attributeId": 0x0002, + "type": "int", + }, "ClusterRevision": { "attributeId": 0xFFFD, "type": "int", @@ -780,6 +788,10 @@ def ListClusterAttributes(self): "attributeId": 0x0000, "type": "", }, + "CurrentAudioOutput": { + "attributeId": 0x0001, + "type": "int", + }, "ClusterRevision": { "attributeId": 0xFFFD, "type": "int", @@ -1456,6 +1468,10 @@ def ListClusterAttributes(self): "attributeId": 0x0000, "type": "", }, + "CurrentMediaInput": { + "attributeId": 0x0001, + "type": "int", + }, "ClusterRevision": { "attributeId": 0xFFFD, "type": "int", @@ -2882,10 +2898,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): @@ -3249,6 +3271,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): @@ -3730,6 +3754,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 @@ -3743,6 +3773,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 @@ -4534,6 +4567,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 7352a6cc036898..61bd2978915499 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 @@ -758,6 +761,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 13552d9589c353..42f37cb48d46ed 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]); @@ -11808,6 +11889,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 0bafee5cbd8175..ddb961903667ea 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 =