diff --git a/examples/pump-app/pump-common/gen/CHIPClientCallbacks.cpp b/examples/pump-app/pump-common/gen/CHIPClientCallbacks.cpp index 72cb04d3ab761d..d21fbb7e8b2d66 100644 --- a/examples/pump-app/pump-common/gen/CHIPClientCallbacks.cpp +++ b/examples/pump-app/pump-common/gen/CHIPClientCallbacks.cpp @@ -128,6 +128,8 @@ constexpr uint16_t kByteSpanSizeLengthInBytes = 2; return true; \ } +#define GET_ATTRIBUTE_RESPONSE_CALLBACKS(name) + #define GET_REPORT_CALLBACK(name) \ Callback::Cancelable * onReportCallback = nullptr; \ CHIP_ERROR err = gCallbacks.GetReportCallback(sourceId, endpointId, clusterId, attributeId, &onReportCallback); \ @@ -431,6 +433,48 @@ bool IMDefaultResponseCallback(const chip::app::Command * commandObj, EmberAfSta return true; } +bool IMWriteResponseCallback(const chip::app::WriteClient * writeClient, EmberAfStatus status) +{ + ChipLogProgress(Zcl, "WriteResponse:"); + LogStatus(status); + + Callback::Cancelable * onSuccessCallback = nullptr; + Callback::Cancelable * onFailureCallback = nullptr; + NodeId sourceNodeId = writeClient->GetSourceNodeId(); + uint8_t seq = static_cast(writeClient->GetAppIdentifier()); + CHIP_ERROR err = gCallbacks.GetResponseCallback(sourceNodeId, seq, &onSuccessCallback, &onFailureCallback); + + if (CHIP_NO_ERROR != err) + { + if (onSuccessCallback == nullptr) + { + ChipLogDetail(Zcl, "%s: Missing success callback", name); + } + + if (onFailureCallback == nullptr) + { + ChipLogDetail(Zcl, "%s: Missing failure callback", name); + } + + return true; + } + + if (status == EMBER_ZCL_STATUS_SUCCESS) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, static_cast(status)); + } + + return true; +} + bool IMReadReportAttributesResponseCallback(const app::ReadClient * apReadClient, const app::ClusterInfo & aPath, TLV::TLVReader * apData, Protocols::InteractionModel::ProtocolCode status) { diff --git a/examples/pump-app/pump-common/gen/CHIPClientCallbacks.h b/examples/pump-app/pump-common/gen/CHIPClientCallbacks.h index e819215d52eee9..1b7aa847ab2152 100644 --- a/examples/pump-app/pump-common/gen/CHIPClientCallbacks.h +++ b/examples/pump-app/pump-common/gen/CHIPClientCallbacks.h @@ -33,6 +33,7 @@ bool IMDefaultResponseCallback(const chip::app::Command * commandObj, EmberAfStatus status); bool IMReadReportAttributesResponseCallback(const chip::app::ReadClient * apReadClient, const chip::app::ClusterInfo & aPath, chip::TLV::TLVReader * apData, chip::Protocols::InteractionModel::ProtocolCode status); +bool IMWriteResponseCallback(const chip::app::WriteClient * writeClient, EmberAfStatus status); // Global Response Callbacks typedef void (*DefaultSuccessCallback)(void * context); diff --git a/examples/pump-app/pump-common/gen/CHIPClusters.cpp b/examples/pump-app/pump-common/gen/CHIPClusters.cpp index 8ff71eab4113f2..7990d341fd029a 100644 --- a/examples/pump-app/pump-common/gen/CHIPClusters.cpp +++ b/examples/pump-app/pump-common/gen/CHIPClusters.cpp @@ -30,7 +30,10 @@ #include #include +#include #include +#include +#include #define COMMAND_HEADER(name, clusterId) \ const char * kName = name; \ @@ -81,6 +84,11 @@ namespace Controller { // TODO(#4503): length should be passed to commands when byte string is in argument list. // TODO(#4503): Commands should take group id as an argument. +namespace { + +// The helper function to encode a single scalar (numeric / string / bytearray) attributes. +} + // FlowMeasurement Cluster Commands // FlowMeasurement Cluster Attributes CHIP_ERROR FlowMeasurementCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, diff --git a/examples/pump-controller-app/pump-controller-common/gen/CHIPClientCallbacks.cpp b/examples/pump-controller-app/pump-controller-common/gen/CHIPClientCallbacks.cpp index 72cb04d3ab761d..d21fbb7e8b2d66 100644 --- a/examples/pump-controller-app/pump-controller-common/gen/CHIPClientCallbacks.cpp +++ b/examples/pump-controller-app/pump-controller-common/gen/CHIPClientCallbacks.cpp @@ -128,6 +128,8 @@ constexpr uint16_t kByteSpanSizeLengthInBytes = 2; return true; \ } +#define GET_ATTRIBUTE_RESPONSE_CALLBACKS(name) + #define GET_REPORT_CALLBACK(name) \ Callback::Cancelable * onReportCallback = nullptr; \ CHIP_ERROR err = gCallbacks.GetReportCallback(sourceId, endpointId, clusterId, attributeId, &onReportCallback); \ @@ -431,6 +433,48 @@ bool IMDefaultResponseCallback(const chip::app::Command * commandObj, EmberAfSta return true; } +bool IMWriteResponseCallback(const chip::app::WriteClient * writeClient, EmberAfStatus status) +{ + ChipLogProgress(Zcl, "WriteResponse:"); + LogStatus(status); + + Callback::Cancelable * onSuccessCallback = nullptr; + Callback::Cancelable * onFailureCallback = nullptr; + NodeId sourceNodeId = writeClient->GetSourceNodeId(); + uint8_t seq = static_cast(writeClient->GetAppIdentifier()); + CHIP_ERROR err = gCallbacks.GetResponseCallback(sourceNodeId, seq, &onSuccessCallback, &onFailureCallback); + + if (CHIP_NO_ERROR != err) + { + if (onSuccessCallback == nullptr) + { + ChipLogDetail(Zcl, "%s: Missing success callback", name); + } + + if (onFailureCallback == nullptr) + { + ChipLogDetail(Zcl, "%s: Missing failure callback", name); + } + + return true; + } + + if (status == EMBER_ZCL_STATUS_SUCCESS) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, static_cast(status)); + } + + return true; +} + bool IMReadReportAttributesResponseCallback(const app::ReadClient * apReadClient, const app::ClusterInfo & aPath, TLV::TLVReader * apData, Protocols::InteractionModel::ProtocolCode status) { diff --git a/examples/pump-controller-app/pump-controller-common/gen/CHIPClientCallbacks.h b/examples/pump-controller-app/pump-controller-common/gen/CHIPClientCallbacks.h index e819215d52eee9..1b7aa847ab2152 100644 --- a/examples/pump-controller-app/pump-controller-common/gen/CHIPClientCallbacks.h +++ b/examples/pump-controller-app/pump-controller-common/gen/CHIPClientCallbacks.h @@ -33,6 +33,7 @@ bool IMDefaultResponseCallback(const chip::app::Command * commandObj, EmberAfStatus status); bool IMReadReportAttributesResponseCallback(const chip::app::ReadClient * apReadClient, const chip::app::ClusterInfo & aPath, chip::TLV::TLVReader * apData, chip::Protocols::InteractionModel::ProtocolCode status); +bool IMWriteResponseCallback(const chip::app::WriteClient * writeClient, EmberAfStatus status); // Global Response Callbacks typedef void (*DefaultSuccessCallback)(void * context); diff --git a/examples/pump-controller-app/pump-controller-common/gen/CHIPClusters.cpp b/examples/pump-controller-app/pump-controller-common/gen/CHIPClusters.cpp index ed03450389f73d..c2bbb75a7eaff2 100644 --- a/examples/pump-controller-app/pump-controller-common/gen/CHIPClusters.cpp +++ b/examples/pump-controller-app/pump-controller-common/gen/CHIPClusters.cpp @@ -30,7 +30,10 @@ #include #include +#include #include +#include +#include #define COMMAND_HEADER(name, clusterId) \ const char * kName = name; \ @@ -81,6 +84,11 @@ namespace Controller { // TODO(#4503): length should be passed to commands when byte string is in argument list. // TODO(#4503): Commands should take group id as an argument. +namespace { + +// The helper function to encode a single scalar (numeric / string / bytearray) attributes. +} + // FlowMeasurement Cluster Commands // FlowMeasurement Cluster Attributes CHIP_ERROR FlowMeasurementCluster::DiscoverAttributes(Callback::Cancelable * onSuccessCallback, @@ -918,17 +926,18 @@ CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeOperationMode(Callba } CHIP_ERROR PumpConfigurationAndControlCluster::WriteAttributeOperationMode(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, - uint8_t operationMode) + Callback::Cancelable * onFailureCallback, uint8_t value) { - COMMAND_HEADER("WritePumpConfigurationAndControlOperationMode", PumpConfigurationAndControl::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(PumpConfigurationAndControl::Attributes::Ids::OperationMode) - .Put8(48) - .Put8(static_cast(operationMode)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000020; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, diff --git a/src/controller/data_model/gen/CHIPClientCallbacks.cpp b/src/controller/data_model/gen/CHIPClientCallbacks.cpp index 9ebf9b623ff70b..6fec1c20ca3956 100644 --- a/src/controller/data_model/gen/CHIPClientCallbacks.cpp +++ b/src/controller/data_model/gen/CHIPClientCallbacks.cpp @@ -128,6 +128,8 @@ constexpr uint16_t kByteSpanSizeLengthInBytes = 2; return true; \ } +#define GET_ATTRIBUTE_RESPONSE_CALLBACKS(name) + #define GET_REPORT_CALLBACK(name) \ Callback::Cancelable * onReportCallback = nullptr; \ CHIP_ERROR err = gCallbacks.GetReportCallback(sourceId, endpointId, clusterId, attributeId, &onReportCallback); \ @@ -431,6 +433,48 @@ bool IMDefaultResponseCallback(const chip::app::Command * commandObj, EmberAfSta return true; } +bool IMWriteResponseCallback(const chip::app::WriteClient * writeClient, EmberAfStatus status) +{ + ChipLogProgress(Zcl, "WriteResponse:"); + LogStatus(status); + + Callback::Cancelable * onSuccessCallback = nullptr; + Callback::Cancelable * onFailureCallback = nullptr; + NodeId sourceNodeId = writeClient->GetSourceNodeId(); + uint8_t seq = static_cast(writeClient->GetAppIdentifier()); + CHIP_ERROR err = gCallbacks.GetResponseCallback(sourceNodeId, seq, &onSuccessCallback, &onFailureCallback); + + if (CHIP_NO_ERROR != err) + { + if (onSuccessCallback == nullptr) + { + ChipLogDetail(Zcl, "%s: Missing success callback", name); + } + + if (onFailureCallback == nullptr) + { + ChipLogDetail(Zcl, "%s: Missing failure callback", name); + } + + return true; + } + + if (status == EMBER_ZCL_STATUS_SUCCESS) + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onSuccessCallback); + cb->mCall(cb->mContext); + } + else + { + Callback::Callback * cb = + Callback::Callback::FromCancelable(onFailureCallback); + cb->mCall(cb->mContext, static_cast(status)); + } + + return true; +} + bool IMReadReportAttributesResponseCallback(const app::ReadClient * apReadClient, const app::ClusterInfo & aPath, TLV::TLVReader * apData, Protocols::InteractionModel::ProtocolCode status) { diff --git a/src/controller/data_model/gen/CHIPClientCallbacks.h b/src/controller/data_model/gen/CHIPClientCallbacks.h index 763c54f4a45992..619af647ad1f7b 100644 --- a/src/controller/data_model/gen/CHIPClientCallbacks.h +++ b/src/controller/data_model/gen/CHIPClientCallbacks.h @@ -33,6 +33,7 @@ bool IMDefaultResponseCallback(const chip::app::Command * commandObj, EmberAfStatus status); bool IMReadReportAttributesResponseCallback(const chip::app::ReadClient * apReadClient, const chip::app::ClusterInfo & aPath, chip::TLV::TLVReader * apData, chip::Protocols::InteractionModel::ProtocolCode status); +bool IMWriteResponseCallback(const chip::app::WriteClient * writeClient, EmberAfStatus status); // Global Response Callbacks typedef void (*DefaultSuccessCallback)(void * context); diff --git a/src/controller/data_model/gen/CHIPClusters.cpp b/src/controller/data_model/gen/CHIPClusters.cpp index a887bb7e7579c3..080a342f964396 100644 --- a/src/controller/data_model/gen/CHIPClusters.cpp +++ b/src/controller/data_model/gen/CHIPClusters.cpp @@ -30,7 +30,10 @@ #include #include +#include #include +#include +#include #define COMMAND_HEADER(name, clusterId) \ const char * kName = name; \ @@ -81,6 +84,11 @@ namespace Controller { // TODO(#4503): length should be passed to commands when byte string is in argument list. // TODO(#4503): Commands should take group id as an argument. +namespace { + +// The helper function to encode a single scalar (numeric / string / bytearray) attributes. +} + // AccountLogin Cluster Commands CHIP_ERROR AccountLoginCluster::GetSetupPIN(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, chip::ByteSpan tempAccountIdentifier) @@ -994,24 +1002,18 @@ CHIP_ERROR BasicCluster::ReadAttributeUserLabel(Callback::Cancelable * onSuccess } CHIP_ERROR BasicCluster::WriteAttributeUserLabel(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - chip::ByteSpan userLabel) + chip::ByteSpan value) { - COMMAND_HEADER("WriteBasicUserLabel", Basic::Id); - size_t userLabelStrLen = userLabel.size(); - if (!CanCastTo(userLabelStrLen)) - { - ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, userLabelStrLen); - return CHIP_ERROR_INTERNAL; - } + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000005; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(Basic::Attributes::Ids::UserLabel) - .Put8(66) - .Put(static_cast(userLabelStrLen)) - .Put(userLabel.data(), userLabelStrLen); - COMMAND_FOOTER(); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR BasicCluster::ReadAttributeLocation(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) @@ -1026,24 +1028,18 @@ CHIP_ERROR BasicCluster::ReadAttributeLocation(Callback::Cancelable * onSuccessC } CHIP_ERROR BasicCluster::WriteAttributeLocation(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - chip::ByteSpan location) + chip::ByteSpan value) { - COMMAND_HEADER("WriteBasicLocation", Basic::Id); - size_t locationStrLen = location.size(); - if (!CanCastTo(locationStrLen)) - { - ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, locationStrLen); - return CHIP_ERROR_INTERNAL; - } + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000006; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(Basic::Attributes::Ids::Location) - .Put8(66) - .Put(static_cast(locationStrLen)) - .Put(location.data(), locationStrLen); - COMMAND_FOOTER(); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR BasicCluster::ReadAttributeHardwareVersion(Callback::Cancelable * onSuccessCallback, @@ -1165,16 +1161,18 @@ CHIP_ERROR BasicCluster::ReadAttributeLocalConfigDisabled(Callback::Cancelable * } CHIP_ERROR BasicCluster::WriteAttributeLocalConfigDisabled(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, bool localConfigDisabled) + Callback::Cancelable * onFailureCallback, bool value) { - COMMAND_HEADER("WriteBasicLocalConfigDisabled", Basic::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(Basic::Attributes::Ids::LocalConfigDisabled) - .Put8(16) - .Put8(static_cast(localConfigDisabled)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000010; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR BasicCluster::ReadAttributeReachable(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) @@ -1223,16 +1221,18 @@ CHIP_ERROR BinaryInputBasicCluster::ReadAttributeOutOfService(Callback::Cancelab } CHIP_ERROR BinaryInputBasicCluster::WriteAttributeOutOfService(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, bool outOfService) + Callback::Cancelable * onFailureCallback, bool value) { - COMMAND_HEADER("WriteBinaryInputBasicOutOfService", BinaryInputBasic::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(BinaryInputBasic::Attributes::Ids::OutOfService) - .Put8(16) - .Put8(static_cast(outOfService)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000051; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR BinaryInputBasicCluster::ReadAttributePresentValue(Callback::Cancelable * onSuccessCallback, @@ -1248,16 +1248,18 @@ CHIP_ERROR BinaryInputBasicCluster::ReadAttributePresentValue(Callback::Cancelab } CHIP_ERROR BinaryInputBasicCluster::WriteAttributePresentValue(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, bool presentValue) + Callback::Cancelable * onFailureCallback, bool value) { - COMMAND_HEADER("WriteBinaryInputBasicPresentValue", BinaryInputBasic::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(BinaryInputBasic::Attributes::Ids::PresentValue) - .Put8(16) - .Put8(static_cast(presentValue)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000055; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR BinaryInputBasicCluster::ConfigureAttributePresentValue(Callback::Cancelable * onSuccessCallback, @@ -1501,24 +1503,18 @@ CHIP_ERROR BridgedDeviceBasicCluster::ReadAttributeUserLabel(Callback::Cancelabl } CHIP_ERROR BridgedDeviceBasicCluster::WriteAttributeUserLabel(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, chip::ByteSpan userLabel) + Callback::Cancelable * onFailureCallback, chip::ByteSpan value) { - COMMAND_HEADER("WriteBridgedDeviceBasicUserLabel", BridgedDeviceBasic::Id); - size_t userLabelStrLen = userLabel.size(); - if (!CanCastTo(userLabelStrLen)) - { - ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, userLabelStrLen); - return CHIP_ERROR_INTERNAL; - } + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000005; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(BridgedDeviceBasic::Attributes::Ids::UserLabel) - .Put8(66) - .Put(static_cast(userLabelStrLen)) - .Put(userLabel.data(), userLabelStrLen); - COMMAND_FOOTER(); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR BridgedDeviceBasicCluster::ReadAttributeHardwareVersion(Callback::Cancelable * onSuccessCallback, @@ -2837,17 +2833,18 @@ CHIP_ERROR ColorControlCluster::ReadAttributeColorControlOptions(Callback::Cance } CHIP_ERROR ColorControlCluster::WriteAttributeColorControlOptions(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, - uint8_t colorControlOptions) + Callback::Cancelable * onFailureCallback, uint8_t value) { - COMMAND_HEADER("WriteColorControlColorControlOptions", ColorControl::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(ColorControl::Attributes::Ids::ColorControlOptions) - .Put8(24) - .Put8(static_cast(colorControlOptions)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x0000000F; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR ColorControlCluster::ReadAttributeNumberOfPrimaries(Callback::Cancelable * onSuccessCallback, @@ -3091,16 +3088,18 @@ CHIP_ERROR ColorControlCluster::ReadAttributeWhitePointX(Callback::Cancelable * } CHIP_ERROR ColorControlCluster::WriteAttributeWhitePointX(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint16_t whitePointX) + Callback::Cancelable * onFailureCallback, uint16_t value) { - COMMAND_HEADER("WriteColorControlWhitePointX", ColorControl::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(ColorControl::Attributes::Ids::WhitePointX) - .Put8(33) - .Put16(static_cast(whitePointX)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000030; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR ColorControlCluster::ReadAttributeWhitePointY(Callback::Cancelable * onSuccessCallback, @@ -3116,16 +3115,18 @@ CHIP_ERROR ColorControlCluster::ReadAttributeWhitePointY(Callback::Cancelable * } CHIP_ERROR ColorControlCluster::WriteAttributeWhitePointY(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint16_t whitePointY) + Callback::Cancelable * onFailureCallback, uint16_t value) { - COMMAND_HEADER("WriteColorControlWhitePointY", ColorControl::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(ColorControl::Attributes::Ids::WhitePointY) - .Put8(33) - .Put16(static_cast(whitePointY)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000031; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR ColorControlCluster::ReadAttributeColorPointRX(Callback::Cancelable * onSuccessCallback, @@ -3141,16 +3142,18 @@ CHIP_ERROR ColorControlCluster::ReadAttributeColorPointRX(Callback::Cancelable * } CHIP_ERROR ColorControlCluster::WriteAttributeColorPointRX(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint16_t colorPointRX) + Callback::Cancelable * onFailureCallback, uint16_t value) { - COMMAND_HEADER("WriteColorControlColorPointRX", ColorControl::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(ColorControl::Attributes::Ids::ColorPointRX) - .Put8(33) - .Put16(static_cast(colorPointRX)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000032; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR ColorControlCluster::ReadAttributeColorPointRY(Callback::Cancelable * onSuccessCallback, @@ -3166,16 +3169,18 @@ CHIP_ERROR ColorControlCluster::ReadAttributeColorPointRY(Callback::Cancelable * } CHIP_ERROR ColorControlCluster::WriteAttributeColorPointRY(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint16_t colorPointRY) + Callback::Cancelable * onFailureCallback, uint16_t value) { - COMMAND_HEADER("WriteColorControlColorPointRY", ColorControl::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(ColorControl::Attributes::Ids::ColorPointRY) - .Put8(33) - .Put16(static_cast(colorPointRY)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000033; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR ColorControlCluster::ReadAttributeColorPointRIntensity(Callback::Cancelable * onSuccessCallback, @@ -3191,17 +3196,18 @@ CHIP_ERROR ColorControlCluster::ReadAttributeColorPointRIntensity(Callback::Canc } CHIP_ERROR ColorControlCluster::WriteAttributeColorPointRIntensity(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, - uint8_t colorPointRIntensity) + Callback::Cancelable * onFailureCallback, uint8_t value) { - COMMAND_HEADER("WriteColorControlColorPointRIntensity", ColorControl::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(ColorControl::Attributes::Ids::ColorPointRIntensity) - .Put8(32) - .Put8(static_cast(colorPointRIntensity)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000034; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR ColorControlCluster::ReadAttributeColorPointGX(Callback::Cancelable * onSuccessCallback, @@ -3217,16 +3223,18 @@ CHIP_ERROR ColorControlCluster::ReadAttributeColorPointGX(Callback::Cancelable * } CHIP_ERROR ColorControlCluster::WriteAttributeColorPointGX(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint16_t colorPointGX) + Callback::Cancelable * onFailureCallback, uint16_t value) { - COMMAND_HEADER("WriteColorControlColorPointGX", ColorControl::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(ColorControl::Attributes::Ids::ColorPointGX) - .Put8(33) - .Put16(static_cast(colorPointGX)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000036; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR ColorControlCluster::ReadAttributeColorPointGY(Callback::Cancelable * onSuccessCallback, @@ -3242,16 +3250,18 @@ CHIP_ERROR ColorControlCluster::ReadAttributeColorPointGY(Callback::Cancelable * } CHIP_ERROR ColorControlCluster::WriteAttributeColorPointGY(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint16_t colorPointGY) + Callback::Cancelable * onFailureCallback, uint16_t value) { - COMMAND_HEADER("WriteColorControlColorPointGY", ColorControl::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(ColorControl::Attributes::Ids::ColorPointGY) - .Put8(33) - .Put16(static_cast(colorPointGY)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000037; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR ColorControlCluster::ReadAttributeColorPointGIntensity(Callback::Cancelable * onSuccessCallback, @@ -3267,17 +3277,18 @@ CHIP_ERROR ColorControlCluster::ReadAttributeColorPointGIntensity(Callback::Canc } CHIP_ERROR ColorControlCluster::WriteAttributeColorPointGIntensity(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, - uint8_t colorPointGIntensity) + Callback::Cancelable * onFailureCallback, uint8_t value) { - COMMAND_HEADER("WriteColorControlColorPointGIntensity", ColorControl::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(ColorControl::Attributes::Ids::ColorPointGIntensity) - .Put8(32) - .Put8(static_cast(colorPointGIntensity)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000038; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR ColorControlCluster::ReadAttributeColorPointBX(Callback::Cancelable * onSuccessCallback, @@ -3293,16 +3304,18 @@ CHIP_ERROR ColorControlCluster::ReadAttributeColorPointBX(Callback::Cancelable * } CHIP_ERROR ColorControlCluster::WriteAttributeColorPointBX(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint16_t colorPointBX) + Callback::Cancelable * onFailureCallback, uint16_t value) { - COMMAND_HEADER("WriteColorControlColorPointBX", ColorControl::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(ColorControl::Attributes::Ids::ColorPointBX) - .Put8(33) - .Put16(static_cast(colorPointBX)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x0000003A; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR ColorControlCluster::ReadAttributeColorPointBY(Callback::Cancelable * onSuccessCallback, @@ -3318,16 +3331,18 @@ CHIP_ERROR ColorControlCluster::ReadAttributeColorPointBY(Callback::Cancelable * } CHIP_ERROR ColorControlCluster::WriteAttributeColorPointBY(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint16_t colorPointBY) + Callback::Cancelable * onFailureCallback, uint16_t value) { - COMMAND_HEADER("WriteColorControlColorPointBY", ColorControl::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(ColorControl::Attributes::Ids::ColorPointBY) - .Put8(33) - .Put16(static_cast(colorPointBY)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x0000003B; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR ColorControlCluster::ReadAttributeColorPointBIntensity(Callback::Cancelable * onSuccessCallback, @@ -3343,17 +3358,18 @@ CHIP_ERROR ColorControlCluster::ReadAttributeColorPointBIntensity(Callback::Canc } CHIP_ERROR ColorControlCluster::WriteAttributeColorPointBIntensity(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, - uint8_t colorPointBIntensity) + Callback::Cancelable * onFailureCallback, uint8_t value) { - COMMAND_HEADER("WriteColorControlColorPointBIntensity", ColorControl::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(ColorControl::Attributes::Ids::ColorPointBIntensity) - .Put8(32) - .Put8(static_cast(colorPointBIntensity)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x0000003C; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR ColorControlCluster::ReadAttributeEnhancedCurrentHue(Callback::Cancelable * onSuccessCallback, @@ -3478,16 +3494,18 @@ CHIP_ERROR ColorControlCluster::ReadAttributeStartUpColorTemperatureMireds(Callb CHIP_ERROR ColorControlCluster::WriteAttributeStartUpColorTemperatureMireds(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint16_t startUpColorTemperatureMireds) + uint16_t value) { - COMMAND_HEADER("WriteColorControlStartUpColorTemperatureMireds", ColorControl::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(ColorControl::Attributes::Ids::StartUpColorTemperatureMireds) - .Put8(33) - .Put16(static_cast(startUpColorTemperatureMireds)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00004010; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR ColorControlCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, @@ -5362,16 +5380,18 @@ CHIP_ERROR GeneralCommissioningCluster::ReadAttributeBreadcrumb(Callback::Cancel } CHIP_ERROR GeneralCommissioningCluster::WriteAttributeBreadcrumb(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint64_t breadcrumb) + Callback::Cancelable * onFailureCallback, uint64_t value) { - COMMAND_HEADER("WriteGeneralCommissioningBreadcrumb", GeneralCommissioning::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(GeneralCommissioning::Attributes::Ids::Breadcrumb) - .Put8(39) - .Put64(static_cast(breadcrumb)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000001; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR GeneralCommissioningCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, @@ -5861,16 +5881,18 @@ CHIP_ERROR IdentifyCluster::ReadAttributeIdentifyTime(Callback::Cancelable * onS } CHIP_ERROR IdentifyCluster::WriteAttributeIdentifyTime(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint16_t identifyTime) + Callback::Cancelable * onFailureCallback, uint16_t value) { - COMMAND_HEADER("WriteIdentifyIdentifyTime", Identify::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(Identify::Attributes::Ids::IdentifyTime) - .Put8(33) - .Put16(static_cast(identifyTime)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000000; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR IdentifyCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, @@ -8089,16 +8111,18 @@ CHIP_ERROR OnOffCluster::ReadAttributeOnTime(Callback::Cancelable * onSuccessCal } CHIP_ERROR OnOffCluster::WriteAttributeOnTime(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint16_t onTime) + uint16_t value) { - COMMAND_HEADER("WriteOnOffOnTime", OnOff::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(OnOff::Attributes::Ids::OnTime) - .Put8(33) - .Put16(static_cast(onTime)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00004001; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR OnOffCluster::ReadAttributeOffWaitTime(Callback::Cancelable * onSuccessCallback, @@ -8114,16 +8138,18 @@ CHIP_ERROR OnOffCluster::ReadAttributeOffWaitTime(Callback::Cancelable * onSucce } CHIP_ERROR OnOffCluster::WriteAttributeOffWaitTime(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint16_t offWaitTime) + Callback::Cancelable * onFailureCallback, uint16_t value) { - COMMAND_HEADER("WriteOnOffOffWaitTime", OnOff::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(OnOff::Attributes::Ids::OffWaitTime) - .Put8(33) - .Put16(static_cast(offWaitTime)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00004002; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR OnOffCluster::ReadAttributeStartUpOnOff(Callback::Cancelable * onSuccessCallback, @@ -8139,16 +8165,18 @@ CHIP_ERROR OnOffCluster::ReadAttributeStartUpOnOff(Callback::Cancelable * onSucc } CHIP_ERROR OnOffCluster::WriteAttributeStartUpOnOff(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint8_t startUpOnOff) + Callback::Cancelable * onFailureCallback, uint8_t value) { - COMMAND_HEADER("WriteOnOffStartUpOnOff", OnOff::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(OnOff::Attributes::Ids::StartUpOnOff) - .Put8(48) - .Put8(static_cast(startUpOnOff)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00004003; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR OnOffCluster::ReadAttributeFeatureMap(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) @@ -8776,17 +8804,18 @@ CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeOperationMode(Callba } CHIP_ERROR PumpConfigurationAndControlCluster::WriteAttributeOperationMode(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, - uint8_t operationMode) + Callback::Cancelable * onFailureCallback, uint8_t value) { - COMMAND_HEADER("WritePumpConfigurationAndControlOperationMode", PumpConfigurationAndControl::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(PumpConfigurationAndControl::Attributes::Ids::OperationMode) - .Put8(48) - .Put8(static_cast(operationMode)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000020; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, @@ -9974,16 +10003,18 @@ CHIP_ERROR TestClusterCluster::ReadAttributeBoolean(Callback::Cancelable * onSuc } CHIP_ERROR TestClusterCluster::WriteAttributeBoolean(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, bool boolean) + Callback::Cancelable * onFailureCallback, bool value) { - COMMAND_HEADER("WriteTestClusterBoolean", TestCluster::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(TestCluster::Attributes::Ids::Boolean) - .Put8(16) - .Put8(static_cast(boolean)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000000; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR TestClusterCluster::ReadAttributeBitmap8(Callback::Cancelable * onSuccessCallback, @@ -9999,16 +10030,18 @@ CHIP_ERROR TestClusterCluster::ReadAttributeBitmap8(Callback::Cancelable * onSuc } CHIP_ERROR TestClusterCluster::WriteAttributeBitmap8(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint8_t bitmap8) + Callback::Cancelable * onFailureCallback, uint8_t value) { - COMMAND_HEADER("WriteTestClusterBitmap8", TestCluster::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(TestCluster::Attributes::Ids::Bitmap8) - .Put8(24) - .Put8(static_cast(bitmap8)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000001; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR TestClusterCluster::ReadAttributeBitmap16(Callback::Cancelable * onSuccessCallback, @@ -10024,16 +10057,18 @@ CHIP_ERROR TestClusterCluster::ReadAttributeBitmap16(Callback::Cancelable * onSu } CHIP_ERROR TestClusterCluster::WriteAttributeBitmap16(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint16_t bitmap16) + Callback::Cancelable * onFailureCallback, uint16_t value) { - COMMAND_HEADER("WriteTestClusterBitmap16", TestCluster::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(TestCluster::Attributes::Ids::Bitmap16) - .Put8(25) - .Put16(static_cast(bitmap16)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000002; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR TestClusterCluster::ReadAttributeBitmap32(Callback::Cancelable * onSuccessCallback, @@ -10049,16 +10084,18 @@ CHIP_ERROR TestClusterCluster::ReadAttributeBitmap32(Callback::Cancelable * onSu } CHIP_ERROR TestClusterCluster::WriteAttributeBitmap32(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint32_t bitmap32) + Callback::Cancelable * onFailureCallback, uint32_t value) { - COMMAND_HEADER("WriteTestClusterBitmap32", TestCluster::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(TestCluster::Attributes::Ids::Bitmap32) - .Put8(27) - .Put32(static_cast(bitmap32)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000003; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR TestClusterCluster::ReadAttributeBitmap64(Callback::Cancelable * onSuccessCallback, @@ -10074,16 +10111,18 @@ CHIP_ERROR TestClusterCluster::ReadAttributeBitmap64(Callback::Cancelable * onSu } CHIP_ERROR TestClusterCluster::WriteAttributeBitmap64(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint64_t bitmap64) + Callback::Cancelable * onFailureCallback, uint64_t value) { - COMMAND_HEADER("WriteTestClusterBitmap64", TestCluster::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(TestCluster::Attributes::Ids::Bitmap64) - .Put8(31) - .Put64(static_cast(bitmap64)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000004; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR TestClusterCluster::ReadAttributeInt8u(Callback::Cancelable * onSuccessCallback, @@ -10099,16 +10138,18 @@ CHIP_ERROR TestClusterCluster::ReadAttributeInt8u(Callback::Cancelable * onSucce } CHIP_ERROR TestClusterCluster::WriteAttributeInt8u(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint8_t int8u) + Callback::Cancelable * onFailureCallback, uint8_t value) { - COMMAND_HEADER("WriteTestClusterInt8u", TestCluster::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(TestCluster::Attributes::Ids::Int8u) - .Put8(32) - .Put8(static_cast(int8u)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000005; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR TestClusterCluster::ReadAttributeInt16u(Callback::Cancelable * onSuccessCallback, @@ -10124,16 +10165,18 @@ CHIP_ERROR TestClusterCluster::ReadAttributeInt16u(Callback::Cancelable * onSucc } CHIP_ERROR TestClusterCluster::WriteAttributeInt16u(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint16_t int16u) + Callback::Cancelable * onFailureCallback, uint16_t value) { - COMMAND_HEADER("WriteTestClusterInt16u", TestCluster::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(TestCluster::Attributes::Ids::Int16u) - .Put8(33) - .Put16(static_cast(int16u)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000006; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR TestClusterCluster::ReadAttributeInt32u(Callback::Cancelable * onSuccessCallback, @@ -10149,16 +10192,18 @@ CHIP_ERROR TestClusterCluster::ReadAttributeInt32u(Callback::Cancelable * onSucc } CHIP_ERROR TestClusterCluster::WriteAttributeInt32u(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint32_t int32u) + Callback::Cancelable * onFailureCallback, uint32_t value) { - COMMAND_HEADER("WriteTestClusterInt32u", TestCluster::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(TestCluster::Attributes::Ids::Int32u) - .Put8(35) - .Put32(static_cast(int32u)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000008; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR TestClusterCluster::ReadAttributeInt64u(Callback::Cancelable * onSuccessCallback, @@ -10174,16 +10219,18 @@ CHIP_ERROR TestClusterCluster::ReadAttributeInt64u(Callback::Cancelable * onSucc } CHIP_ERROR TestClusterCluster::WriteAttributeInt64u(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint64_t int64u) + Callback::Cancelable * onFailureCallback, uint64_t value) { - COMMAND_HEADER("WriteTestClusterInt64u", TestCluster::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(TestCluster::Attributes::Ids::Int64u) - .Put8(39) - .Put64(static_cast(int64u)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x0000000C; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR TestClusterCluster::ReadAttributeInt8s(Callback::Cancelable * onSuccessCallback, @@ -10199,16 +10246,18 @@ CHIP_ERROR TestClusterCluster::ReadAttributeInt8s(Callback::Cancelable * onSucce } CHIP_ERROR TestClusterCluster::WriteAttributeInt8s(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, int8_t int8s) + Callback::Cancelable * onFailureCallback, int8_t value) { - COMMAND_HEADER("WriteTestClusterInt8s", TestCluster::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(TestCluster::Attributes::Ids::Int8s) - .Put8(40) - .Put8(static_cast(int8s)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x0000000D; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR TestClusterCluster::ReadAttributeInt16s(Callback::Cancelable * onSuccessCallback, @@ -10224,16 +10273,18 @@ CHIP_ERROR TestClusterCluster::ReadAttributeInt16s(Callback::Cancelable * onSucc } CHIP_ERROR TestClusterCluster::WriteAttributeInt16s(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, int16_t int16s) + Callback::Cancelable * onFailureCallback, int16_t value) { - COMMAND_HEADER("WriteTestClusterInt16s", TestCluster::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(TestCluster::Attributes::Ids::Int16s) - .Put8(41) - .Put16(static_cast(int16s)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x0000000E; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR TestClusterCluster::ReadAttributeInt32s(Callback::Cancelable * onSuccessCallback, @@ -10249,16 +10300,18 @@ CHIP_ERROR TestClusterCluster::ReadAttributeInt32s(Callback::Cancelable * onSucc } CHIP_ERROR TestClusterCluster::WriteAttributeInt32s(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, int32_t int32s) + Callback::Cancelable * onFailureCallback, int32_t value) { - COMMAND_HEADER("WriteTestClusterInt32s", TestCluster::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(TestCluster::Attributes::Ids::Int32s) - .Put8(43) - .Put32(static_cast(int32s)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000010; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR TestClusterCluster::ReadAttributeInt64s(Callback::Cancelable * onSuccessCallback, @@ -10274,16 +10327,18 @@ CHIP_ERROR TestClusterCluster::ReadAttributeInt64s(Callback::Cancelable * onSucc } CHIP_ERROR TestClusterCluster::WriteAttributeInt64s(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, int64_t int64s) + Callback::Cancelable * onFailureCallback, int64_t value) { - COMMAND_HEADER("WriteTestClusterInt64s", TestCluster::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(TestCluster::Attributes::Ids::Int64s) - .Put8(47) - .Put64(static_cast(int64s)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000014; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR TestClusterCluster::ReadAttributeEnum8(Callback::Cancelable * onSuccessCallback, @@ -10299,16 +10354,18 @@ CHIP_ERROR TestClusterCluster::ReadAttributeEnum8(Callback::Cancelable * onSucce } CHIP_ERROR TestClusterCluster::WriteAttributeEnum8(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint8_t enum8) + Callback::Cancelable * onFailureCallback, uint8_t value) { - COMMAND_HEADER("WriteTestClusterEnum8", TestCluster::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(TestCluster::Attributes::Ids::Enum8) - .Put8(48) - .Put8(static_cast(enum8)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000015; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR TestClusterCluster::ReadAttributeEnum16(Callback::Cancelable * onSuccessCallback, @@ -10324,16 +10381,18 @@ CHIP_ERROR TestClusterCluster::ReadAttributeEnum16(Callback::Cancelable * onSucc } CHIP_ERROR TestClusterCluster::WriteAttributeEnum16(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint16_t enum16) + Callback::Cancelable * onFailureCallback, uint16_t value) { - COMMAND_HEADER("WriteTestClusterEnum16", TestCluster::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(TestCluster::Attributes::Ids::Enum16) - .Put8(49) - .Put16(static_cast(enum16)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000016; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR TestClusterCluster::ReadAttributeOctetString(Callback::Cancelable * onSuccessCallback, @@ -10349,24 +10408,18 @@ CHIP_ERROR TestClusterCluster::ReadAttributeOctetString(Callback::Cancelable * o } CHIP_ERROR TestClusterCluster::WriteAttributeOctetString(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, chip::ByteSpan octetString) + Callback::Cancelable * onFailureCallback, chip::ByteSpan value) { - COMMAND_HEADER("WriteTestClusterOctetString", TestCluster::Id); - size_t octetStringStrLen = octetString.size(); - if (!CanCastTo(octetStringStrLen)) - { - ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, octetStringStrLen); - return CHIP_ERROR_INTERNAL; - } + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000019; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(TestCluster::Attributes::Ids::OctetString) - .Put8(65) - .Put(static_cast(octetStringStrLen)) - .Put(octetString.data(), octetStringStrLen); - COMMAND_FOOTER(); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR TestClusterCluster::ReadAttributeListInt8u(Callback::Cancelable * onSuccessCallback, @@ -10418,25 +10471,18 @@ CHIP_ERROR TestClusterCluster::ReadAttributeLongOctetString(Callback::Cancelable } CHIP_ERROR TestClusterCluster::WriteAttributeLongOctetString(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, - chip::ByteSpan longOctetString) + Callback::Cancelable * onFailureCallback, chip::ByteSpan value) { - COMMAND_HEADER("WriteTestClusterLongOctetString", TestCluster::Id); - size_t longOctetStringStrLen = longOctetString.size(); - if (!CanCastTo(longOctetStringStrLen)) - { - ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, longOctetStringStrLen); - return CHIP_ERROR_INTERNAL; - } + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x0000001D; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(TestCluster::Attributes::Ids::LongOctetString) - .Put8(67) - .Put16(static_cast(longOctetStringStrLen)) - .Put(longOctetString.data(), longOctetStringStrLen); - COMMAND_FOOTER(); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR TestClusterCluster::ReadAttributeCharString(Callback::Cancelable * onSuccessCallback, @@ -10452,24 +10498,18 @@ CHIP_ERROR TestClusterCluster::ReadAttributeCharString(Callback::Cancelable * on } CHIP_ERROR TestClusterCluster::WriteAttributeCharString(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, chip::ByteSpan charString) + Callback::Cancelable * onFailureCallback, chip::ByteSpan value) { - COMMAND_HEADER("WriteTestClusterCharString", TestCluster::Id); - size_t charStringStrLen = charString.size(); - if (!CanCastTo(charStringStrLen)) - { - ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, charStringStrLen); - return CHIP_ERROR_INTERNAL; - } + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x0000001E; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(TestCluster::Attributes::Ids::CharString) - .Put8(66) - .Put(static_cast(charStringStrLen)) - .Put(charString.data(), charStringStrLen); - COMMAND_FOOTER(); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR TestClusterCluster::ReadAttributeLongCharString(Callback::Cancelable * onSuccessCallback, @@ -10485,24 +10525,18 @@ CHIP_ERROR TestClusterCluster::ReadAttributeLongCharString(Callback::Cancelable } CHIP_ERROR TestClusterCluster::WriteAttributeLongCharString(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, chip::ByteSpan longCharString) + Callback::Cancelable * onFailureCallback, chip::ByteSpan value) { - COMMAND_HEADER("WriteTestClusterLongCharString", TestCluster::Id); - size_t longCharStringStrLen = longCharString.size(); - if (!CanCastTo(longCharStringStrLen)) - { - ChipLogError(Zcl, "Error encoding %s command. String too long: %zu", kName, longCharStringStrLen); - return CHIP_ERROR_INTERNAL; - } + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x0000001F; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(TestCluster::Attributes::Ids::LongCharString) - .Put8(68) - .Put16(static_cast(longCharStringStrLen)) - .Put(longCharString.data(), longCharStringStrLen); - COMMAND_FOOTER(); + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR TestClusterCluster::ReadAttributeUnsupported(Callback::Cancelable * onSuccessCallback, @@ -10518,16 +10552,18 @@ CHIP_ERROR TestClusterCluster::ReadAttributeUnsupported(Callback::Cancelable * o } CHIP_ERROR TestClusterCluster::WriteAttributeUnsupported(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, bool unsupported) + Callback::Cancelable * onFailureCallback, bool value) { - COMMAND_HEADER("WriteTestClusterUnsupported", TestCluster::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(TestCluster::Attributes::Ids::Unsupported) - .Put8(16) - .Put8(static_cast(unsupported)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x000000FF; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR TestClusterCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, @@ -10809,17 +10845,18 @@ CHIP_ERROR ThermostatCluster::ReadAttributeOccupiedCoolingSetpoint(Callback::Can } CHIP_ERROR ThermostatCluster::WriteAttributeOccupiedCoolingSetpoint(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, - int16_t occupiedCoolingSetpoint) + Callback::Cancelable * onFailureCallback, int16_t value) { - COMMAND_HEADER("WriteThermostatOccupiedCoolingSetpoint", Thermostat::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(Thermostat::Attributes::Ids::OccupiedCoolingSetpoint) - .Put8(41) - .Put16(static_cast(occupiedCoolingSetpoint)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000011; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR ThermostatCluster::ReadAttributeOccupiedHeatingSetpoint(Callback::Cancelable * onSuccessCallback, @@ -10835,17 +10872,18 @@ CHIP_ERROR ThermostatCluster::ReadAttributeOccupiedHeatingSetpoint(Callback::Can } CHIP_ERROR ThermostatCluster::WriteAttributeOccupiedHeatingSetpoint(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, - int16_t occupiedHeatingSetpoint) + Callback::Cancelable * onFailureCallback, int16_t value) { - COMMAND_HEADER("WriteThermostatOccupiedHeatingSetpoint", Thermostat::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(Thermostat::Attributes::Ids::OccupiedHeatingSetpoint) - .Put8(41) - .Put16(static_cast(occupiedHeatingSetpoint)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000012; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR ThermostatCluster::ReadAttributeControlSequenceOfOperation(Callback::Cancelable * onSuccessCallback, @@ -10861,17 +10899,18 @@ CHIP_ERROR ThermostatCluster::ReadAttributeControlSequenceOfOperation(Callback:: } CHIP_ERROR ThermostatCluster::WriteAttributeControlSequenceOfOperation(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, - uint8_t controlSequenceOfOperation) + Callback::Cancelable * onFailureCallback, uint8_t value) { - COMMAND_HEADER("WriteThermostatControlSequenceOfOperation", Thermostat::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(Thermostat::Attributes::Ids::ControlSequenceOfOperation) - .Put8(48) - .Put8(static_cast(controlSequenceOfOperation)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x0000001B; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR ThermostatCluster::ReadAttributeSystemMode(Callback::Cancelable * onSuccessCallback, @@ -10887,16 +10926,18 @@ CHIP_ERROR ThermostatCluster::ReadAttributeSystemMode(Callback::Cancelable * onS } CHIP_ERROR ThermostatCluster::WriteAttributeSystemMode(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint8_t systemMode) + Callback::Cancelable * onFailureCallback, uint8_t value) { - COMMAND_HEADER("WriteThermostatSystemMode", Thermostat::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(Thermostat::Attributes::Ids::SystemMode) - .Put8(48) - .Put8(static_cast(systemMode)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x0000001C; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR ThermostatCluster::ReadAttributeStartOfWeek(Callback::Cancelable * onSuccessCallback, @@ -10983,16 +11024,18 @@ ThermostatUserInterfaceConfigurationCluster::ReadAttributeTemperatureDisplayMode } CHIP_ERROR ThermostatUserInterfaceConfigurationCluster::WriteAttributeTemperatureDisplayMode( - Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t temperatureDisplayMode) + Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t value) { - COMMAND_HEADER("WriteThermostatUserInterfaceConfigurationTemperatureDisplayMode", ThermostatUserInterfaceConfiguration::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(ThermostatUserInterfaceConfiguration::Attributes::Ids::TemperatureDisplayMode) - .Put8(48) - .Put8(static_cast(temperatureDisplayMode)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000000; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR ThermostatUserInterfaceConfigurationCluster::ReadAttributeKeypadLockout(Callback::Cancelable * onSuccessCallback, @@ -11009,16 +11052,18 @@ CHIP_ERROR ThermostatUserInterfaceConfigurationCluster::ReadAttributeKeypadLocko CHIP_ERROR ThermostatUserInterfaceConfigurationCluster::WriteAttributeKeypadLockout(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, - uint8_t keypadLockout) + uint8_t value) { - COMMAND_HEADER("WriteThermostatUserInterfaceConfigurationKeypadLockout", ThermostatUserInterfaceConfiguration::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(ThermostatUserInterfaceConfiguration::Attributes::Ids::KeypadLockout) - .Put8(48) - .Put8(static_cast(keypadLockout)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000001; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR @@ -11035,17 +11080,18 @@ ThermostatUserInterfaceConfigurationCluster::ReadAttributeScheduleProgrammingVis } CHIP_ERROR ThermostatUserInterfaceConfigurationCluster::WriteAttributeScheduleProgrammingVisibility( - Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t scheduleProgrammingVisibility) + Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t value) { - COMMAND_HEADER("WriteThermostatUserInterfaceConfigurationScheduleProgrammingVisibility", - ThermostatUserInterfaceConfiguration::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(ThermostatUserInterfaceConfiguration::Attributes::Ids::ScheduleProgrammingVisibility) - .Put8(48) - .Put8(static_cast(scheduleProgrammingVisibility)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000002; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR ThermostatUserInterfaceConfigurationCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, @@ -12655,16 +12701,18 @@ CHIP_ERROR WindowCoveringCluster::ReadAttributeMode(Callback::Cancelable * onSuc } CHIP_ERROR WindowCoveringCluster::WriteAttributeMode(Callback::Cancelable * onSuccessCallback, - Callback::Cancelable * onFailureCallback, uint8_t mode) + Callback::Cancelable * onFailureCallback, uint8_t value) { - COMMAND_HEADER("WriteWindowCoveringMode", WindowCovering::Id); - buf.Put8(kFrameControlGlobalCommand) - .Put8(seqNum) - .Put32(Globals::Commands::Ids::WriteAttributes) - .Put32(WindowCovering::Attributes::Ids::Mode) - .Put8(24) - .Put8(static_cast(mode)); - COMMAND_FOOTER(); + app::WriteClientHandle handle; + chip::app::AttributePathParams attributePath; + attributePath.mNodeId = mDevice->GetDeviceId(); + attributePath.mEndpointId = mEndpoint; + attributePath.mClusterId = mClusterId; + attributePath.mFieldId = 0x00000017; + attributePath.mFlags.Set(chip::app::AttributePathParams::Flags::kFieldIdValid); + ReturnErrorOnFailure(handle.EncodeScalarAttributeWritePayload(attributePath, value)); + + return mDevice->SendWriteAttributeRequest(std::move(handle), onSuccessCallback, onFailureCallback); } CHIP_ERROR WindowCoveringCluster::ReadAttributeSafetyStatus(Callback::Cancelable * onSuccessCallback,