From 42217057be0d6ef29952d67a06f8aa82ff58330f Mon Sep 17 00:00:00 2001 From: Marc Lepage <67919234+mlepage-google@users.noreply.github.com> Date: Sun, 28 Nov 2021 14:56:55 -0500 Subject: [PATCH] Disable python codegen for lists (#12300) * Disable python codegen for lists This code is not really used right now, doesn't work with nullable lists, and is blocking new clusters from using nullable lists. Disable for now to unblock, until it can be fixed or removed entirely. * Regen code Not strictly necessary (as only unused python code was removed for just the case of lists) but presubmits require it. * Restyle code * Change comment and removal syntax --- .../python/chip/clusters/CHIPClusters.cpp | 1480 ----------------- .../templates/python-CHIPClusters-cpp.zapt | 82 +- 2 files changed, 1 insertion(+), 1561 deletions(-) diff --git a/src/controller/python/chip/clusters/CHIPClusters.cpp b/src/controller/python/chip/clusters/CHIPClusters.cpp index 0974f520d5e662..ab532e0d847ed4 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.cpp +++ b/src/controller/python/chip/clusters/CHIPClusters.cpp @@ -105,42 +105,6 @@ static void OnApplicationLauncherApplicationLauncherListListAttributeResponse(void * context, const chip::app::DataModel::DecodableList<uint16_t> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " %" PRIu16 ",", entry); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -152,46 +116,6 @@ static void OnAudioOutputAudioOutputListListAttributeResponse( void * context, const chip::app::DataModel::DecodableList<chip::app::Clusters::AudioOutput::Structs::AudioOutputInfo::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " index: %" PRIu8 ",", entry.index); - ChipLogProgress(Zcl, " outputType: %" PRIu8 ",", entry.outputType); - ChipLogProgress(Zcl, " name: %.*s,", static_cast<int>(entry.name.size()), entry.name.data()); - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -202,49 +126,6 @@ static void OnBridgedActionsActionListListAttributeResponse( void * context, const chip::app::DataModel::DecodableList<chip::app::Clusters::BridgedActions::Structs::ActionStruct::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " ActionID: %" PRIu16 ",", entry.actionID); - ChipLogProgress(Zcl, " Name: %.*s,", static_cast<int>(entry.name.size()), entry.name.data()); - ChipLogProgress(Zcl, " Type: %" PRIu8 ",", entry.type); - ChipLogProgress(Zcl, " EndpointListID: %" PRIu16 ",", entry.endpointListID); - ChipLogProgress(Zcl, " SupportedCommands: %" PRIu16 ",", entry.supportedCommands); - ChipLogProgress(Zcl, " Status: %" PRIu8 ",", entry.status); - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -256,47 +137,6 @@ static void OnBridgedActionsEndpointListListAttributeResponse( const chip::app::DataModel::DecodableList<chip::app::Clusters::BridgedActions::Structs::EndpointListStruct::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " EndpointListID: %" PRIu16 ",", entry.endpointListID); - ChipLogProgress(Zcl, " Name: %.*s,", static_cast<int>(entry.name.size()), entry.name.data()); - ChipLogProgress(Zcl, " Type: %" PRIu8 ",", entry.type); - ChipLogProgress(chipTool, " Endpoints: list member of struct element of list attribute printing not supported yet"); - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -307,42 +147,6 @@ static void OnContentLauncherAcceptsHeaderListListAttributeResponse(void * context, const chip::app::DataModel::DecodableList<chip::ByteSpan> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " %s,", ByteSpanToString(entry).c_str()); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -352,42 +156,6 @@ static void OnContentLauncherSupportedStreamingTypesListAttributeResponse( void * context, const chip::app::DataModel::DecodableList<chip::app::Clusters::ContentLauncher::ContentLaunchStreamingType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " %" PRIu8 ",", entry); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -398,45 +166,6 @@ static void OnDescriptorDeviceListListAttributeResponse( void * context, const chip::app::DataModel::DecodableList<chip::app::Clusters::Descriptor::Structs::DeviceType::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " type: %" PRIu32 ",", entry.type); - ChipLogProgress(Zcl, " revision: %" PRIu16 ",", entry.revision); - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -446,42 +175,6 @@ chip::Callback::Callback<DescriptorDeviceListListAttributeCallback> gDescriptorD static void OnDescriptorServerListListAttributeResponse(void * context, const chip::app::DataModel::DecodableList<chip::ClusterId> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " %" PRIu32 ",", entry); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -491,42 +184,6 @@ chip::Callback::Callback<DescriptorServerListListAttributeCallback> gDescriptorS static void OnDescriptorClientListListAttributeResponse(void * context, const chip::app::DataModel::DecodableList<chip::ClusterId> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " %" PRIu32 ",", entry); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -536,42 +193,6 @@ chip::Callback::Callback<DescriptorClientListListAttributeCallback> gDescriptorC static void OnDescriptorPartsListListAttributeResponse(void * context, const chip::app::DataModel::DecodableList<chip::EndpointId> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " %" PRIu16 ",", entry); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -582,45 +203,6 @@ static void OnFixedLabelLabelListListAttributeResponse( void * context, const chip::app::DataModel::DecodableList<chip::app::Clusters::FixedLabel::Structs::LabelStruct::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " label: %.*s,", static_cast<int>(entry.label.size()), entry.label.data()); - ChipLogProgress(Zcl, " value: %.*s,", static_cast<int>(entry.value.size()), entry.value.data()); - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -632,44 +214,6 @@ static void OnGeneralCommissioningBasicCommissioningInfoListListAttributeRespons const chip::app::DataModel::DecodableList< chip::app::Clusters::GeneralCommissioning::Structs::BasicCommissioningInfoType::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " FailSafeExpiryLengthMs: %" PRIu32 ",", entry.failSafeExpiryLengthMs); - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -682,49 +226,6 @@ static void OnGeneralDiagnosticsNetworkInterfacesListAttributeResponse( const chip::app::DataModel::DecodableList< chip::app::Clusters::GeneralDiagnostics::Structs::NetworkInterfaceType::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " Name: %.*s,", static_cast<int>(entry.name.size()), entry.name.data()); - ChipLogProgress(Zcl, " FabricConnected: %d,", entry.fabricConnected); - ChipLogProgress(Zcl, " OffPremiseServicesReachableIPv4: %d,", entry.offPremiseServicesReachableIPv4); - ChipLogProgress(Zcl, " OffPremiseServicesReachableIPv6: %d,", entry.offPremiseServicesReachableIPv6); - ChipLogProgress(Zcl, " HardwareAddress: %s,", ByteSpanToString(entry.hardwareAddress).c_str()); - ChipLogProgress(Zcl, " Type: %" PRIu8 ",", entry.type); - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -734,42 +235,6 @@ chip::Callback::Callback<GeneralDiagnosticsNetworkInterfacesListAttributeCallbac static void OnGeneralDiagnosticsActiveHardwareFaultsListAttributeResponse(void * context, const chip::app::DataModel::DecodableList<uint8_t> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " %" PRIu8 ",", entry); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -779,42 +244,6 @@ chip::Callback::Callback<GeneralDiagnosticsActiveHardwareFaultsListAttributeCall static void OnGeneralDiagnosticsActiveRadioFaultsListAttributeResponse(void * context, const chip::app::DataModel::DecodableList<uint8_t> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " %" PRIu8 ",", entry); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -824,42 +253,6 @@ chip::Callback::Callback<GeneralDiagnosticsActiveRadioFaultsListAttributeCallbac static void OnGeneralDiagnosticsActiveNetworkFaultsListAttributeResponse(void * context, const chip::app::DataModel::DecodableList<uint8_t> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " %" PRIu8 ",", entry); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -870,46 +263,6 @@ static void OnGroupKeyManagementGroupsListAttributeResponse( void * context, const chip::app::DataModel::DecodableList<chip::app::Clusters::GroupKeyManagement::Structs::GroupState::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " VendorId: %" PRIu16 ",", entry.vendorId); - ChipLogProgress(Zcl, " VendorGroupId: %" PRIu16 ",", entry.vendorGroupId); - ChipLogProgress(Zcl, " GroupKeySetIndex: %" PRIu16 ",", entry.groupKeySetIndex); - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -920,48 +273,6 @@ static void OnGroupKeyManagementGroupKeysListAttributeResponse( void * context, const chip::app::DataModel::DecodableList<chip::app::Clusters::GroupKeyManagement::Structs::GroupKey::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " VendorId: %" PRIu16 ",", entry.vendorId); - ChipLogProgress(Zcl, " GroupKeyIndex: %" PRIu16 ",", entry.groupKeyIndex); - ChipLogProgress(Zcl, " GroupKeyRoot: %s,", ByteSpanToString(entry.groupKeyRoot).c_str()); - ChipLogProgress(Zcl, " GroupKeyEpochStartTime: %" PRIu64 ",", entry.groupKeyEpochStartTime); - ChipLogProgress(Zcl, " GroupKeySecurityPolicy: %" PRIu8 ",", entry.groupKeySecurityPolicy); - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -972,47 +283,6 @@ static void OnMediaInputMediaInputListListAttributeResponse( void * context, const chip::app::DataModel::DecodableList<chip::app::Clusters::MediaInput::Structs::MediaInputInfo::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " index: %" PRIu8 ",", entry.index); - ChipLogProgress(Zcl, " inputType: %" PRIu8 ",", entry.inputType); - ChipLogProgress(Zcl, " name: %.*s,", static_cast<int>(entry.name.size()), entry.name.data()); - ChipLogProgress(Zcl, " description: %.*s,", static_cast<int>(entry.description.size()), entry.description.data()); - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -1023,46 +293,6 @@ static void OnModeSelectSupportedModesListAttributeResponse( void * context, const chip::app::DataModel::DecodableList<chip::app::Clusters::ModeSelect::Structs::ModeOptionStruct::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " Label: %.*s,", static_cast<int>(entry.label.size()), entry.label.data()); - ChipLogProgress(Zcl, " Mode: %" PRIu8 ",", entry.mode); - ChipLogProgress(Zcl, " SemanticTag: %" PRIu32 ",", entry.semanticTag); - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -1074,49 +304,6 @@ static void OnOperationalCredentialsFabricsListListAttributeResponse( const chip::app::DataModel::DecodableList< chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " FabricIndex: %" PRIu8 ",", entry.fabricIndex); - ChipLogProgress(Zcl, " RootPublicKey: %s,", ByteSpanToString(entry.rootPublicKey).c_str()); - ChipLogProgress(Zcl, " VendorId: %" PRIu16 ",", entry.vendorId); - ChipLogProgress(Zcl, " FabricId: %" PRIu64 ",", entry.fabricId); - ChipLogProgress(Zcl, " NodeId: %" PRIu64 ",", entry.nodeId); - ChipLogProgress(Zcl, " Label: %.*s,", static_cast<int>(entry.label.size()), entry.label.data()); - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -1125,42 +312,6 @@ chip::Callback::Callback<OperationalCredentialsFabricsListListAttributeCallback> static void OnOperationalCredentialsTrustedRootCertificatesListAttributeResponse( void * context, const chip::app::DataModel::DecodableList<chip::ByteSpan> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " %s,", ByteSpanToString(entry).c_str()); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -1171,42 +322,6 @@ chip::Callback::Callback<OperationalCredentialsTrustedRootCertificatesListAttrib static void OnPowerSourceActiveBatteryFaultsListAttributeResponse(void * context, const chip::app::DataModel::DecodableList<uint8_t> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " %" PRIu8 ",", entry); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -1218,48 +333,6 @@ static void OnSoftwareDiagnosticsThreadMetricsListAttributeResponse( const chip::app::DataModel::DecodableList<chip::app::Clusters::SoftwareDiagnostics::Structs::ThreadMetrics::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " Id: %" PRIu64 ",", entry.id); - ChipLogProgress(Zcl, " Name: %.*s,", static_cast<int>(entry.name.size()), entry.name.data()); - ChipLogProgress(Zcl, " StackFreeCurrent: %" PRIu32 ",", entry.stackFreeCurrent); - ChipLogProgress(Zcl, " StackFreeMinimum: %" PRIu32 ",", entry.stackFreeMinimum); - ChipLogProgress(Zcl, " StackSize: %" PRIu32 ",", entry.stackSize); - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -1269,49 +342,6 @@ static void OnTvChannelTvChannelListListAttributeResponse( void * context, const chip::app::DataModel::DecodableList<chip::app::Clusters::TvChannel::Structs::TvChannelInfo::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " majorNumber: %" PRIu16 ",", entry.majorNumber); - ChipLogProgress(Zcl, " minorNumber: %" PRIu16 ",", entry.minorNumber); - ChipLogProgress(Zcl, " name: %.*s,", static_cast<int>(entry.name.size()), entry.name.data()); - ChipLogProgress(Zcl, " callSign: %.*s,", static_cast<int>(entry.callSign.size()), entry.callSign.data()); - ChipLogProgress(Zcl, " affiliateCallSign: %.*s,", static_cast<int>(entry.affiliateCallSign.size()), - entry.affiliateCallSign.data()); - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -1323,45 +353,6 @@ static void OnTargetNavigatorTargetNavigatorListListAttributeResponse( const chip::app::DataModel::DecodableList< chip::app::Clusters::TargetNavigator::Structs::NavigateTargetTargetInfo::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " identifier: %" PRIu8 ",", entry.identifier); - ChipLogProgress(Zcl, " name: %.*s,", static_cast<int>(entry.name.size()), entry.name.data()); - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -1369,42 +360,6 @@ chip::Callback::Callback<TargetNavigatorTargetNavigatorListListAttributeCallback gTargetNavigatorTargetNavigatorListListAttributeCallback{ OnTargetNavigatorTargetNavigatorListListAttributeResponse, nullptr }; static void OnTestClusterListInt8uListAttributeResponse(void * context, const chip::app::DataModel::DecodableList<uint8_t> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " %" PRIu8 ",", entry); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -1414,42 +369,6 @@ chip::Callback::Callback<TestClusterListInt8uListAttributeCallback> gTestCluster static void OnTestClusterListOctetStringListAttributeResponse(void * context, const chip::app::DataModel::DecodableList<chip::ByteSpan> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " %s,", ByteSpanToString(entry).c_str()); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -1460,45 +379,6 @@ static void OnTestClusterListStructOctetStringListAttributeResponse( void * context, const chip::app::DataModel::DecodableList<chip::app::Clusters::TestCluster::Structs::TestListStructOctet::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " fabricIndex: %" PRIu64 ",", entry.fabricIndex); - ChipLogProgress(Zcl, " operationalCert: %s,", ByteSpanToString(entry.operationalCert).c_str()); - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -1509,144 +389,6 @@ static void OnTestClusterListNullablesAndOptionalsStructListAttributeResponse( const chip::app::DataModel::DecodableList< chip::app::Clusters::TestCluster::Structs::NullablesAndOptionalsStruct::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - if (entry.nullableInt.IsNull()) - { - ChipLogProgress(chipTool, " NullableInt: null"); - } - else - { - ChipLogProgress(Zcl, " NullableInt: %" PRIu16 ",", entry.nullableInt.Value()); - } - if (entry.optionalInt.HasValue()) - { - ChipLogProgress(Zcl, " OptionalInt: %" PRIu16 ",", entry.optionalInt.Value()); - } - if (entry.nullableOptionalInt.HasValue()) - { - if (entry.nullableOptionalInt.Value().IsNull()) - { - ChipLogProgress(chipTool, " NullableOptionalInt: null"); - } - else - { - ChipLogProgress(Zcl, " NullableOptionalInt: %" PRIu16 ",", entry.nullableOptionalInt.Value().Value()); - } - } - if (entry.nullableString.IsNull()) - { - ChipLogProgress(chipTool, " NullableString: null"); - } - else - { - ChipLogProgress(Zcl, " NullableString: %.*s,", static_cast<int>(entry.nullableString.Value().size()), - entry.nullableString.Value().data()); - } - if (entry.optionalString.HasValue()) - { - ChipLogProgress(Zcl, " OptionalString: %.*s,", static_cast<int>(entry.optionalString.Value().size()), - entry.optionalString.Value().data()); - } - if (entry.nullableOptionalString.HasValue()) - { - if (entry.nullableOptionalString.Value().IsNull()) - { - ChipLogProgress(chipTool, " NullableOptionalString: null"); - } - else - { - ChipLogProgress(Zcl, " NullableOptionalString: %.*s,", - static_cast<int>(entry.nullableOptionalString.Value().Value().size()), - entry.nullableOptionalString.Value().Value().data()); - } - } - if (entry.nullableStruct.IsNull()) - { - ChipLogProgress(chipTool, " NullableStruct: null"); - } - else - { - ChipLogProgress(chipTool, - " NullableStruct: struct member of struct element of list attribute printing not supported yet"); - } - if (entry.optionalStruct.HasValue()) - { - ChipLogProgress(chipTool, - " OptionalStruct: struct member of struct element of list attribute printing not supported yet"); - } - if (entry.nullableOptionalStruct.HasValue()) - { - if (entry.nullableOptionalStruct.Value().IsNull()) - { - ChipLogProgress(chipTool, " NullableOptionalStruct: null"); - } - else - { - ChipLogProgress( - chipTool, - " NullableOptionalStruct: struct member of struct element of list attribute printing not supported yet"); - } - } - if (entry.nullableList.IsNull()) - { - ChipLogProgress(chipTool, " NullableList: null"); - } - else - { - ChipLogProgress(chipTool, " NullableList: list member of struct element of list attribute printing not supported yet"); - } - if (entry.optionalList.HasValue()) - { - ChipLogProgress(chipTool, " OptionalList: list member of struct element of list attribute printing not supported yet"); - } - if (entry.nullableOptionalList.HasValue()) - { - if (entry.nullableOptionalList.Value().IsNull()) - { - ChipLogProgress(chipTool, " NullableOptionalList: null"); - } - else - { - ChipLogProgress( - chipTool, " NullableOptionalList: list member of struct element of list attribute printing not supported yet"); - } - } - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -1659,57 +401,6 @@ static void OnThreadNetworkDiagnosticsNeighborTableListListAttributeResponse( const chip::app::DataModel::DecodableList< chip::app::Clusters::ThreadNetworkDiagnostics::Structs::NeighborTable::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " ExtAddress: %" PRIu64 ",", entry.extAddress); - ChipLogProgress(Zcl, " Age: %" PRIu32 ",", entry.age); - ChipLogProgress(Zcl, " Rloc16: %" PRIu16 ",", entry.rloc16); - ChipLogProgress(Zcl, " LinkFrameCounter: %" PRIu32 ",", entry.linkFrameCounter); - ChipLogProgress(Zcl, " MleFrameCounter: %" PRIu32 ",", entry.mleFrameCounter); - ChipLogProgress(Zcl, " LQI: %" PRIu8 ",", entry.lqi); - ChipLogProgress(Zcl, " AverageRssi: %" PRId8 ",", entry.averageRssi); - ChipLogProgress(Zcl, " LastRssi: %" PRId8 ",", entry.lastRssi); - ChipLogProgress(Zcl, " FrameErrorRate: %" PRIu8 ",", entry.frameErrorRate); - ChipLogProgress(Zcl, " MessageErrorRate: %" PRIu8 ",", entry.messageErrorRate); - ChipLogProgress(Zcl, " RxOnWhenIdle: %d,", entry.rxOnWhenIdle); - ChipLogProgress(Zcl, " FullThreadDevice: %d,", entry.fullThreadDevice); - ChipLogProgress(Zcl, " FullNetworkData: %d,", entry.fullNetworkData); - ChipLogProgress(Zcl, " IsChild: %d,", entry.isChild); - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -1722,53 +413,6 @@ static void OnThreadNetworkDiagnosticsRouteTableListListAttributeResponse( const chip::app::DataModel::DecodableList<chip::app::Clusters::ThreadNetworkDiagnostics::Structs::RouteTable::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " ExtAddress: %" PRIu64 ",", entry.extAddress); - ChipLogProgress(Zcl, " Rloc16: %" PRIu16 ",", entry.rloc16); - ChipLogProgress(Zcl, " RouterId: %" PRIu8 ",", entry.routerId); - ChipLogProgress(Zcl, " NextHop: %" PRIu8 ",", entry.nextHop); - ChipLogProgress(Zcl, " PathCost: %" PRIu8 ",", entry.pathCost); - ChipLogProgress(Zcl, " LQIIn: %" PRIu8 ",", entry.LQIIn); - ChipLogProgress(Zcl, " LQIOut: %" PRIu8 ",", entry.LQIOut); - ChipLogProgress(Zcl, " Age: %" PRIu8 ",", entry.age); - ChipLogProgress(Zcl, " Allocated: %d,", entry.allocated); - ChipLogProgress(Zcl, " LinkEstablished: %d,", entry.linkEstablished); - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -1780,45 +424,6 @@ static void OnThreadNetworkDiagnosticsSecurityPolicyListAttributeResponse( const chip::app::DataModel::DecodableList< chip::app::Clusters::ThreadNetworkDiagnostics::Structs::SecurityPolicy::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " RotationTime: %" PRIu16 ",", entry.rotationTime); - ChipLogProgress(Zcl, " Flags: %" PRIu16 ",", entry.flags); - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -1830,55 +435,6 @@ static void OnThreadNetworkDiagnosticsOperationalDatasetComponentsListAttributeR const chip::app::DataModel::DecodableList< chip::app::Clusters::ThreadNetworkDiagnostics::Structs::OperationalDatasetComponents::DecodableType> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " {"); - ChipLogProgress(Zcl, " ActiveTimestampPresent: %d,", entry.activeTimestampPresent); - ChipLogProgress(Zcl, " PendingTimestampPresent: %d,", entry.pendingTimestampPresent); - ChipLogProgress(Zcl, " MasterKeyPresent: %d,", entry.masterKeyPresent); - ChipLogProgress(Zcl, " NetworkNamePresent: %d,", entry.networkNamePresent); - ChipLogProgress(Zcl, " ExtendedPanIdPresent: %d,", entry.extendedPanIdPresent); - ChipLogProgress(Zcl, " MeshLocalPrefixPresent: %d,", entry.meshLocalPrefixPresent); - ChipLogProgress(Zcl, " DelayPresent: %d,", entry.delayPresent); - ChipLogProgress(Zcl, " PanIdPresent: %d,", entry.panIdPresent); - ChipLogProgress(Zcl, " ChannelPresent: %d,", entry.channelPresent); - ChipLogProgress(Zcl, " PskcPresent: %d,", entry.pskcPresent); - ChipLogProgress(Zcl, " SecurityPolicyPresent: %d,", entry.securityPolicyPresent); - ChipLogProgress(Zcl, " ChannelMaskPresent: %d,", entry.channelMaskPresent); - ChipLogProgress(Zcl, " },"); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } @@ -1889,42 +445,6 @@ chip::Callback::Callback<ThreadNetworkDiagnosticsOperationalDatasetComponentsLis static void OnThreadNetworkDiagnosticsActiveNetworkFaultsListListAttributeResponse( void * context, const chip::app::DataModel::DecodableList<chip::app::Clusters::ThreadNetworkDiagnostics::NetworkFault> & list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - ChipLogProgress(Zcl, " %" PRIu8 ",", entry); -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); } diff --git a/src/controller/python/templates/python-CHIPClusters-cpp.zapt b/src/controller/python/templates/python-CHIPClusters-cpp.zapt index 4fb2d50430cab3..5ba06ea7836f03 100644 --- a/src/controller/python/templates/python-CHIPClusters-cpp.zapt +++ b/src/controller/python/templates/python-CHIPClusters-cpp.zapt @@ -90,87 +90,7 @@ void OnAttributeResponse<bool>(void * /* context */, bool value) {{#if isList}} static void On{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}ListAttributeResponse(void * context, {{zapTypeToDecodableClusterObjectType type ns=parent.name isArgument=true}} list) { - size_t count = 0; - CHIP_ERROR err = list.ComputeSize(&count); - if (err != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - ChipLogProgress(Zcl, " attributeValue:%s", count > 0 ? "" : " []"); - - if (count > 0) - ChipLogProgress(Zcl, " ["); - - auto iter = list.begin(); - while (iter.Next()) - { -#if CHIP_PROGRESS_LOGGING - auto & entry = iter.GetValue(); - {{#if isStruct}} - ChipLogProgress(Zcl, " {"); - {{#chip_attribute_list_entryTypes}} - {{~#*inline "field"}}entry.{{asLowerCamelCase name}}{{#if isOptional}}.Value(){{/if}}{{/inline~}} - {{~#*inline "fieldValue"}}{{>field}}{{#if isNullable}}.Value(){{/if}}{{/inline~}} - {{#if isOptional}} - if (entry.{{asLowerCamelCase name}}.HasValue()) { - {{/if}} - {{#if isNullable}} - if ({{>field}}.IsNull()) { - ChipLogProgress(chipTool, " {{asSymbol label}}: null"); - } else { - {{/if}} - {{#if isArray}} - {{! TODO: Add support for printing list member of struct element of list attribute }} - ChipLogProgress(chipTool, " {{asSymbol label}}: list member of struct element of list attribute printing not supported yet"); - {{else if (isOctetString type)}} - ChipLogProgress(Zcl, " {{asSymbol label}}: %s,", ByteSpanToString({{>fieldValue}}).c_str()); - {{else if (isCharString type)}} - ChipLogProgress(Zcl, " {{asSymbol label}}: %.*s,", static_cast<int>({{>fieldValue}}.size()), {{>fieldValue}}.data()); - {{else if isStruct}} - {{! TODO: Add support for printing struct member of struct element of list attribute }} - ChipLogProgress(chipTool, " {{asSymbol label}}: struct member of struct element of list attribute printing not supported yet"); - {{else}} - ChipLogProgress(Zcl, " {{asSymbol label}}: {{asPrintFormat type}},", {{>fieldValue}}); - {{/if}} - {{#if isNullable}} - } - {{/if}} - {{#if isOptional}} - } - {{/if}} - {{/chip_attribute_list_entryTypes}} - ChipLogProgress(Zcl, " },"); - {{else if (isOctetString type)}} - ChipLogProgress(Zcl, " %s,", ByteSpanToString(entry).c_str()); - {{else if (isCharString type)}} - ChipLogProgress(Zcl, " %.*s,", static_cast<int>(entry.size()), entry.data()); - {{else}} - {{~! NOTE: asPrintFormat does not handle the isArray case at - all right, but we want the print format for our _entries_ - anyway. Indirect through a partial that will let us set - isArray to false. ~}} - {{~#*inline "asPrintFormatForElement"}}{{asPrintFormat type}}{{/inline~}} - ChipLogProgress(Zcl, " {{>asPrintFormatForElement isArray=false}},", entry); - {{/if}} -#endif // CHIP_PROGRESS_LOGGING - } - if (iter.GetStatus() != CHIP_NO_ERROR) - { - if (gFailureResponseDelegate != nullptr) - { - gFailureResponseDelegate(EMBER_ZCL_STATUS_INVALID_VALUE); - } - return; - } - - if (count > 0) - ChipLogProgress(Zcl, " ]"); - + {{! TODO: implementation }} if (gSuccessResponseDelegate != nullptr) gSuccessResponseDelegate(); }