| /* |
| * |
| * Copyright (c) 2021 Project CHIP Authors |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| // THIS FILE IS GENERATED BY ZAP |
| |
| #include "CHIPClusters.h" |
| |
| #include <app-common/zap-generated/ids/Attributes.h> |
| #include <zap-generated/CHIPClientCallbacks.h> |
| |
| namespace chip { |
| |
| using namespace app::Clusters; |
| using namespace System; |
| using namespace Encoding::LittleEndian; |
| |
| namespace Controller { |
| |
| // TODO(#4502): onCompletion is not used by IM for now. |
| // 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. |
| |
| // FlowMeasurement Cluster Commands |
| // FlowMeasurement Cluster Attributes |
| CHIP_ERROR FlowMeasurementCluster::ReadAttributeMeasuredValue(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x00000000; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR FlowMeasurementCluster::SubscribeAttributeMeasuredValue(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, uint16_t minInterval, |
| uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = FlowMeasurement::Attributes::MeasuredValue::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR FlowMeasurementCluster::ReportAttributeMeasuredValue(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(FlowMeasurement::Attributes::MeasuredValue::Id, onReportCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR FlowMeasurementCluster::ReadAttributeMinMeasuredValue(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x00000001; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR FlowMeasurementCluster::SubscribeAttributeMinMeasuredValue(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, |
| uint16_t minInterval, uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = FlowMeasurement::Attributes::MinMeasuredValue::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR FlowMeasurementCluster::ReportAttributeMinMeasuredValue(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(FlowMeasurement::Attributes::MinMeasuredValue::Id, onReportCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR FlowMeasurementCluster::ReadAttributeMaxMeasuredValue(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x00000002; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR FlowMeasurementCluster::SubscribeAttributeMaxMeasuredValue(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, |
| uint16_t minInterval, uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = FlowMeasurement::Attributes::MaxMeasuredValue::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR FlowMeasurementCluster::ReportAttributeMaxMeasuredValue(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(FlowMeasurement::Attributes::MaxMeasuredValue::Id, onReportCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR FlowMeasurementCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x0000FFFD; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int16uAttributeCallback>); |
| } |
| |
| CHIP_ERROR FlowMeasurementCluster::SubscribeAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, uint16_t minInterval, |
| uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = Globals::Attributes::ClusterRevision::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR FlowMeasurementCluster::ReportAttributeClusterRevision(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(Globals::Attributes::ClusterRevision::Id, onReportCallback, |
| BasicAttributeFilter<Int16uAttributeCallback>); |
| } |
| |
| // LevelControl Cluster Commands |
| CHIP_ERROR LevelControlCluster::Move(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, |
| uint8_t moveMode, uint8_t rate, uint8_t optionMask, uint8_t optionOverride) |
| { |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| TLV::TLVWriter * writer = nullptr; |
| uint8_t argSeqNumber = 0; |
| |
| // Used when encoding non-empty command. Suppress error message when encoding empty commands. |
| (void) writer; |
| (void) argSeqNumber; |
| |
| VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); |
| |
| app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, LevelControl::Commands::Move::Id, |
| (app::CommandPathFlags::kEndpointIdValid) }; |
| |
| CommandSenderHandle sender( |
| Platform::New<app::CommandSender>(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); |
| |
| VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); |
| |
| SuccessOrExit(err = sender->PrepareCommand(cmdParams)); |
| |
| VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); |
| // moveMode: moveMode |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), moveMode)); |
| // rate: int8u |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), rate)); |
| // optionMask: bitmap8 |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), optionMask)); |
| // optionOverride: bitmap8 |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), optionOverride)); |
| |
| SuccessOrExit(err = sender->FinishCommand()); |
| |
| // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. |
| mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); |
| |
| SuccessOrExit(err = mDevice->SendCommands(sender.get())); |
| |
| // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object |
| // now. |
| sender.release(); |
| exit: |
| return err; |
| } |
| |
| CHIP_ERROR LevelControlCluster::MoveToLevel(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, |
| uint8_t level, uint16_t transitionTime, uint8_t optionMask, uint8_t optionOverride) |
| { |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| TLV::TLVWriter * writer = nullptr; |
| uint8_t argSeqNumber = 0; |
| |
| // Used when encoding non-empty command. Suppress error message when encoding empty commands. |
| (void) writer; |
| (void) argSeqNumber; |
| |
| VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); |
| |
| app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, LevelControl::Commands::MoveToLevel::Id, |
| (app::CommandPathFlags::kEndpointIdValid) }; |
| |
| CommandSenderHandle sender( |
| Platform::New<app::CommandSender>(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); |
| |
| VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); |
| |
| SuccessOrExit(err = sender->PrepareCommand(cmdParams)); |
| |
| VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); |
| // level: int8u |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), level)); |
| // transitionTime: int16u |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), transitionTime)); |
| // optionMask: bitmap8 |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), optionMask)); |
| // optionOverride: bitmap8 |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), optionOverride)); |
| |
| SuccessOrExit(err = sender->FinishCommand()); |
| |
| // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. |
| mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); |
| |
| SuccessOrExit(err = mDevice->SendCommands(sender.get())); |
| |
| // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object |
| // now. |
| sender.release(); |
| exit: |
| return err; |
| } |
| |
| CHIP_ERROR LevelControlCluster::MoveToLevelWithOnOff(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, uint8_t level, |
| uint16_t transitionTime) |
| { |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| TLV::TLVWriter * writer = nullptr; |
| uint8_t argSeqNumber = 0; |
| |
| // Used when encoding non-empty command. Suppress error message when encoding empty commands. |
| (void) writer; |
| (void) argSeqNumber; |
| |
| VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); |
| |
| app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, LevelControl::Commands::MoveToLevelWithOnOff::Id, |
| (app::CommandPathFlags::kEndpointIdValid) }; |
| |
| CommandSenderHandle sender( |
| Platform::New<app::CommandSender>(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); |
| |
| VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); |
| |
| SuccessOrExit(err = sender->PrepareCommand(cmdParams)); |
| |
| VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); |
| // level: int8u |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), level)); |
| // transitionTime: int16u |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), transitionTime)); |
| |
| SuccessOrExit(err = sender->FinishCommand()); |
| |
| // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. |
| mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); |
| |
| SuccessOrExit(err = mDevice->SendCommands(sender.get())); |
| |
| // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object |
| // now. |
| sender.release(); |
| exit: |
| return err; |
| } |
| |
| CHIP_ERROR LevelControlCluster::MoveWithOnOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, |
| uint8_t moveMode, uint8_t rate) |
| { |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| TLV::TLVWriter * writer = nullptr; |
| uint8_t argSeqNumber = 0; |
| |
| // Used when encoding non-empty command. Suppress error message when encoding empty commands. |
| (void) writer; |
| (void) argSeqNumber; |
| |
| VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); |
| |
| app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, LevelControl::Commands::MoveWithOnOff::Id, |
| (app::CommandPathFlags::kEndpointIdValid) }; |
| |
| CommandSenderHandle sender( |
| Platform::New<app::CommandSender>(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); |
| |
| VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); |
| |
| SuccessOrExit(err = sender->PrepareCommand(cmdParams)); |
| |
| VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); |
| // moveMode: moveMode |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), moveMode)); |
| // rate: int8u |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), rate)); |
| |
| SuccessOrExit(err = sender->FinishCommand()); |
| |
| // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. |
| mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); |
| |
| SuccessOrExit(err = mDevice->SendCommands(sender.get())); |
| |
| // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object |
| // now. |
| sender.release(); |
| exit: |
| return err; |
| } |
| |
| CHIP_ERROR LevelControlCluster::Step(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, |
| uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime, uint8_t optionMask, |
| uint8_t optionOverride) |
| { |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| TLV::TLVWriter * writer = nullptr; |
| uint8_t argSeqNumber = 0; |
| |
| // Used when encoding non-empty command. Suppress error message when encoding empty commands. |
| (void) writer; |
| (void) argSeqNumber; |
| |
| VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); |
| |
| app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, LevelControl::Commands::Step::Id, |
| (app::CommandPathFlags::kEndpointIdValid) }; |
| |
| CommandSenderHandle sender( |
| Platform::New<app::CommandSender>(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); |
| |
| VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); |
| |
| SuccessOrExit(err = sender->PrepareCommand(cmdParams)); |
| |
| VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); |
| // stepMode: stepMode |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), stepMode)); |
| // stepSize: int8u |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), stepSize)); |
| // transitionTime: int16u |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), transitionTime)); |
| // optionMask: bitmap8 |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), optionMask)); |
| // optionOverride: bitmap8 |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), optionOverride)); |
| |
| SuccessOrExit(err = sender->FinishCommand()); |
| |
| // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. |
| mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); |
| |
| SuccessOrExit(err = mDevice->SendCommands(sender.get())); |
| |
| // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object |
| // now. |
| sender.release(); |
| exit: |
| return err; |
| } |
| |
| CHIP_ERROR LevelControlCluster::StepWithOnOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, |
| uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime) |
| { |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| TLV::TLVWriter * writer = nullptr; |
| uint8_t argSeqNumber = 0; |
| |
| // Used when encoding non-empty command. Suppress error message when encoding empty commands. |
| (void) writer; |
| (void) argSeqNumber; |
| |
| VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); |
| |
| app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, LevelControl::Commands::StepWithOnOff::Id, |
| (app::CommandPathFlags::kEndpointIdValid) }; |
| |
| CommandSenderHandle sender( |
| Platform::New<app::CommandSender>(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); |
| |
| VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); |
| |
| SuccessOrExit(err = sender->PrepareCommand(cmdParams)); |
| |
| VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); |
| // stepMode: stepMode |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), stepMode)); |
| // stepSize: int8u |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), stepSize)); |
| // transitionTime: int16u |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), transitionTime)); |
| |
| SuccessOrExit(err = sender->FinishCommand()); |
| |
| // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. |
| mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); |
| |
| SuccessOrExit(err = mDevice->SendCommands(sender.get())); |
| |
| // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object |
| // now. |
| sender.release(); |
| exit: |
| return err; |
| } |
| |
| CHIP_ERROR LevelControlCluster::Stop(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, |
| uint8_t optionMask, uint8_t optionOverride) |
| { |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| TLV::TLVWriter * writer = nullptr; |
| uint8_t argSeqNumber = 0; |
| |
| // Used when encoding non-empty command. Suppress error message when encoding empty commands. |
| (void) writer; |
| (void) argSeqNumber; |
| |
| VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); |
| |
| app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, LevelControl::Commands::Stop::Id, |
| (app::CommandPathFlags::kEndpointIdValid) }; |
| |
| CommandSenderHandle sender( |
| Platform::New<app::CommandSender>(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); |
| |
| VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); |
| |
| SuccessOrExit(err = sender->PrepareCommand(cmdParams)); |
| |
| VerifyOrExit((writer = sender->GetCommandDataIBTLVWriter()) != nullptr, err = CHIP_ERROR_INCORRECT_STATE); |
| // optionMask: bitmap8 |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), optionMask)); |
| // optionOverride: bitmap8 |
| SuccessOrExit(err = writer->Put(TLV::ContextTag(argSeqNumber++), optionOverride)); |
| |
| SuccessOrExit(err = sender->FinishCommand()); |
| |
| // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. |
| mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); |
| |
| SuccessOrExit(err = mDevice->SendCommands(sender.get())); |
| |
| // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object |
| // now. |
| sender.release(); |
| exit: |
| return err; |
| } |
| |
| CHIP_ERROR LevelControlCluster::StopWithOnOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) |
| { |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| TLV::TLVWriter * writer = nullptr; |
| uint8_t argSeqNumber = 0; |
| |
| // Used when encoding non-empty command. Suppress error message when encoding empty commands. |
| (void) writer; |
| (void) argSeqNumber; |
| |
| VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); |
| |
| app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, LevelControl::Commands::StopWithOnOff::Id, |
| (app::CommandPathFlags::kEndpointIdValid) }; |
| |
| CommandSenderHandle sender( |
| Platform::New<app::CommandSender>(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); |
| |
| VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); |
| |
| SuccessOrExit(err = sender->PrepareCommand(cmdParams)); |
| |
| // Command takes no arguments. |
| |
| SuccessOrExit(err = sender->FinishCommand()); |
| |
| // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. |
| mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); |
| |
| SuccessOrExit(err = mDevice->SendCommands(sender.get())); |
| |
| // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object |
| // now. |
| sender.release(); |
| exit: |
| return err; |
| } |
| |
| // LevelControl Cluster Attributes |
| CHIP_ERROR LevelControlCluster::ReadAttributeCurrentLevel(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x00000000; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int8uAttributeCallback>); |
| } |
| |
| CHIP_ERROR LevelControlCluster::SubscribeAttributeCurrentLevel(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, uint16_t minInterval, |
| uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = LevelControl::Attributes::CurrentLevel::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR LevelControlCluster::ReportAttributeCurrentLevel(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(LevelControl::Attributes::CurrentLevel::Id, onReportCallback, |
| BasicAttributeFilter<Int8uAttributeCallback>); |
| } |
| |
| CHIP_ERROR LevelControlCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x0000FFFD; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int16uAttributeCallback>); |
| } |
| |
| CHIP_ERROR LevelControlCluster::SubscribeAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, uint16_t minInterval, |
| uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = Globals::Attributes::ClusterRevision::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR LevelControlCluster::ReportAttributeClusterRevision(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(Globals::Attributes::ClusterRevision::Id, onReportCallback, |
| BasicAttributeFilter<Int16uAttributeCallback>); |
| } |
| |
| // OnOff Cluster Commands |
| CHIP_ERROR OnOffCluster::Off(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) |
| { |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| TLV::TLVWriter * writer = nullptr; |
| uint8_t argSeqNumber = 0; |
| |
| // Used when encoding non-empty command. Suppress error message when encoding empty commands. |
| (void) writer; |
| (void) argSeqNumber; |
| |
| VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); |
| |
| app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, OnOff::Commands::Off::Id, |
| (app::CommandPathFlags::kEndpointIdValid) }; |
| |
| CommandSenderHandle sender( |
| Platform::New<app::CommandSender>(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); |
| |
| VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); |
| |
| SuccessOrExit(err = sender->PrepareCommand(cmdParams)); |
| |
| // Command takes no arguments. |
| |
| SuccessOrExit(err = sender->FinishCommand()); |
| |
| // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. |
| mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); |
| |
| SuccessOrExit(err = mDevice->SendCommands(sender.get())); |
| |
| // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object |
| // now. |
| sender.release(); |
| exit: |
| return err; |
| } |
| |
| CHIP_ERROR OnOffCluster::On(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) |
| { |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| TLV::TLVWriter * writer = nullptr; |
| uint8_t argSeqNumber = 0; |
| |
| // Used when encoding non-empty command. Suppress error message when encoding empty commands. |
| (void) writer; |
| (void) argSeqNumber; |
| |
| VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); |
| |
| app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, OnOff::Commands::On::Id, |
| (app::CommandPathFlags::kEndpointIdValid) }; |
| |
| CommandSenderHandle sender( |
| Platform::New<app::CommandSender>(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); |
| |
| VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); |
| |
| SuccessOrExit(err = sender->PrepareCommand(cmdParams)); |
| |
| // Command takes no arguments. |
| |
| SuccessOrExit(err = sender->FinishCommand()); |
| |
| // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. |
| mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); |
| |
| SuccessOrExit(err = mDevice->SendCommands(sender.get())); |
| |
| // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object |
| // now. |
| sender.release(); |
| exit: |
| return err; |
| } |
| |
| CHIP_ERROR OnOffCluster::Toggle(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) |
| { |
| CHIP_ERROR err = CHIP_NO_ERROR; |
| TLV::TLVWriter * writer = nullptr; |
| uint8_t argSeqNumber = 0; |
| |
| // Used when encoding non-empty command. Suppress error message when encoding empty commands. |
| (void) writer; |
| (void) argSeqNumber; |
| |
| VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); |
| |
| app::CommandPathParams cmdParams = { mEndpoint, /* group id */ 0, mClusterId, OnOff::Commands::Toggle::Id, |
| (app::CommandPathFlags::kEndpointIdValid) }; |
| |
| CommandSenderHandle sender( |
| Platform::New<app::CommandSender>(mDevice->GetInteractionModelDelegate(), mDevice->GetExchangeManager())); |
| |
| VerifyOrReturnError(sender != nullptr, CHIP_ERROR_NO_MEMORY); |
| |
| SuccessOrExit(err = sender->PrepareCommand(cmdParams)); |
| |
| // Command takes no arguments. |
| |
| SuccessOrExit(err = sender->FinishCommand()); |
| |
| // #6308: This is a temporary solution before we fully support IM on application side and should be replaced by IMDelegate. |
| mDevice->AddIMResponseHandler(sender.get(), onSuccessCallback, onFailureCallback); |
| |
| SuccessOrExit(err = mDevice->SendCommands(sender.get())); |
| |
| // We have successfully sent the command, and the callback handler will be responsible to free the object, release the object |
| // now. |
| sender.release(); |
| exit: |
| return err; |
| } |
| |
| // OnOff Cluster Attributes |
| CHIP_ERROR OnOffCluster::ReadAttributeOnOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x00000000; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<BooleanAttributeCallback>); |
| } |
| |
| CHIP_ERROR OnOffCluster::SubscribeAttributeOnOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, |
| uint16_t minInterval, uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = OnOff::Attributes::OnOff::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR OnOffCluster::ReportAttributeOnOff(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(OnOff::Attributes::OnOff::Id, onReportCallback, |
| BasicAttributeFilter<BooleanAttributeCallback>); |
| } |
| |
| CHIP_ERROR OnOffCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x0000FFFD; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int16uAttributeCallback>); |
| } |
| |
| CHIP_ERROR OnOffCluster::SubscribeAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, uint16_t minInterval, |
| uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = Globals::Attributes::ClusterRevision::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR OnOffCluster::ReportAttributeClusterRevision(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(Globals::Attributes::ClusterRevision::Id, onReportCallback, |
| BasicAttributeFilter<Int16uAttributeCallback>); |
| } |
| |
| // PressureMeasurement Cluster Commands |
| // PressureMeasurement Cluster Attributes |
| CHIP_ERROR PressureMeasurementCluster::ReadAttributeMeasuredValue(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x00000000; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR PressureMeasurementCluster::SubscribeAttributeMeasuredValue(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, |
| uint16_t minInterval, uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = PressureMeasurement::Attributes::MeasuredValue::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR PressureMeasurementCluster::ReportAttributeMeasuredValue(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(PressureMeasurement::Attributes::MeasuredValue::Id, onReportCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR PressureMeasurementCluster::ReadAttributeMinMeasuredValue(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x00000001; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR PressureMeasurementCluster::SubscribeAttributeMinMeasuredValue(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, |
| uint16_t minInterval, uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = PressureMeasurement::Attributes::MinMeasuredValue::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR PressureMeasurementCluster::ReportAttributeMinMeasuredValue(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(PressureMeasurement::Attributes::MinMeasuredValue::Id, onReportCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR PressureMeasurementCluster::ReadAttributeMaxMeasuredValue(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x00000002; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR PressureMeasurementCluster::SubscribeAttributeMaxMeasuredValue(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, |
| uint16_t minInterval, uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = PressureMeasurement::Attributes::MaxMeasuredValue::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR PressureMeasurementCluster::ReportAttributeMaxMeasuredValue(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(PressureMeasurement::Attributes::MaxMeasuredValue::Id, onReportCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR PressureMeasurementCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x0000FFFD; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int16uAttributeCallback>); |
| } |
| |
| CHIP_ERROR PressureMeasurementCluster::SubscribeAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, |
| uint16_t minInterval, uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = Globals::Attributes::ClusterRevision::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR PressureMeasurementCluster::ReportAttributeClusterRevision(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(Globals::Attributes::ClusterRevision::Id, onReportCallback, |
| BasicAttributeFilter<Int16uAttributeCallback>); |
| } |
| |
| // PumpConfigurationAndControl Cluster Commands |
| // PumpConfigurationAndControl Cluster Attributes |
| CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeMaxPressure(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x00000000; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::SubscribeAttributeMaxPressure(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, |
| uint16_t minInterval, uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = PumpConfigurationAndControl::Attributes::MaxPressure::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::ReportAttributeMaxPressure(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(PumpConfigurationAndControl::Attributes::MaxPressure::Id, onReportCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeMaxSpeed(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x00000001; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int16uAttributeCallback>); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::SubscribeAttributeMaxSpeed(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, |
| uint16_t minInterval, uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = PumpConfigurationAndControl::Attributes::MaxSpeed::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::ReportAttributeMaxSpeed(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(PumpConfigurationAndControl::Attributes::MaxSpeed::Id, onReportCallback, |
| BasicAttributeFilter<Int16uAttributeCallback>); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeMaxFlow(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x00000002; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int16uAttributeCallback>); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::SubscribeAttributeMaxFlow(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, |
| uint16_t minInterval, uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = PumpConfigurationAndControl::Attributes::MaxFlow::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::ReportAttributeMaxFlow(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(PumpConfigurationAndControl::Attributes::MaxFlow::Id, onReportCallback, |
| BasicAttributeFilter<Int16uAttributeCallback>); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeEffectiveOperationMode(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x00000011; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int8uAttributeCallback>); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::SubscribeAttributeEffectiveOperationMode(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, |
| uint16_t minInterval, uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = PumpConfigurationAndControl::Attributes::EffectiveOperationMode::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::ReportAttributeEffectiveOperationMode(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(PumpConfigurationAndControl::Attributes::EffectiveOperationMode::Id, onReportCallback, |
| BasicAttributeFilter<Int8uAttributeCallback>); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeEffectiveControlMode(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x00000012; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int8uAttributeCallback>); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::SubscribeAttributeEffectiveControlMode(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, |
| uint16_t minInterval, uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::ReportAttributeEffectiveControlMode(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id, onReportCallback, |
| BasicAttributeFilter<Int8uAttributeCallback>); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeCapacity(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x00000013; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::SubscribeAttributeCapacity(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, |
| uint16_t minInterval, uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = PumpConfigurationAndControl::Attributes::Capacity::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::ReportAttributeCapacity(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(PumpConfigurationAndControl::Attributes::Capacity::Id, onReportCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeOperationMode(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x00000020; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int8uAttributeCallback>); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::SubscribeAttributeOperationMode(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, |
| uint16_t minInterval, uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = PumpConfigurationAndControl::Attributes::OperationMode::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::ReportAttributeOperationMode(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(PumpConfigurationAndControl::Attributes::OperationMode::Id, onReportCallback, |
| BasicAttributeFilter<Int8uAttributeCallback>); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x0000FFFD; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int16uAttributeCallback>); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::SubscribeAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, |
| uint16_t minInterval, uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = Globals::Attributes::ClusterRevision::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR PumpConfigurationAndControlCluster::ReportAttributeClusterRevision(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(Globals::Attributes::ClusterRevision::Id, onReportCallback, |
| BasicAttributeFilter<Int16uAttributeCallback>); |
| } |
| |
| // TemperatureMeasurement Cluster Commands |
| // TemperatureMeasurement Cluster Attributes |
| CHIP_ERROR TemperatureMeasurementCluster::ReadAttributeMeasuredValue(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x00000000; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR TemperatureMeasurementCluster::SubscribeAttributeMeasuredValue(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, |
| uint16_t minInterval, uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = TemperatureMeasurement::Attributes::MeasuredValue::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR TemperatureMeasurementCluster::ReportAttributeMeasuredValue(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(TemperatureMeasurement::Attributes::MeasuredValue::Id, onReportCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR TemperatureMeasurementCluster::ReadAttributeMinMeasuredValue(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x00000001; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR TemperatureMeasurementCluster::SubscribeAttributeMinMeasuredValue(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, |
| uint16_t minInterval, uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = TemperatureMeasurement::Attributes::MinMeasuredValue::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR TemperatureMeasurementCluster::ReportAttributeMinMeasuredValue(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(TemperatureMeasurement::Attributes::MinMeasuredValue::Id, onReportCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR TemperatureMeasurementCluster::ReadAttributeMaxMeasuredValue(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x00000002; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR TemperatureMeasurementCluster::SubscribeAttributeMaxMeasuredValue(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, |
| uint16_t minInterval, uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = TemperatureMeasurement::Attributes::MaxMeasuredValue::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR TemperatureMeasurementCluster::ReportAttributeMaxMeasuredValue(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(TemperatureMeasurement::Attributes::MaxMeasuredValue::Id, onReportCallback, |
| BasicAttributeFilter<Int16sAttributeCallback>); |
| } |
| |
| CHIP_ERROR TemperatureMeasurementCluster::ReadAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback) |
| { |
| app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = 0x0000FFFD; |
| return mDevice->SendReadAttributeRequest(attributePath, onSuccessCallback, onFailureCallback, |
| BasicAttributeFilter<Int16uAttributeCallback>); |
| } |
| |
| CHIP_ERROR TemperatureMeasurementCluster::SubscribeAttributeClusterRevision(Callback::Cancelable * onSuccessCallback, |
| Callback::Cancelable * onFailureCallback, |
| uint16_t minInterval, uint16_t maxInterval) |
| { |
| chip::app::AttributePathParams attributePath; |
| attributePath.mEndpointId = mEndpoint; |
| attributePath.mClusterId = mClusterId; |
| attributePath.mAttributeId = Globals::Attributes::ClusterRevision::Id; |
| return mDevice->SendSubscribeAttributeRequest(attributePath, minInterval, maxInterval, onSuccessCallback, onFailureCallback); |
| } |
| |
| CHIP_ERROR TemperatureMeasurementCluster::ReportAttributeClusterRevision(Callback::Cancelable * onReportCallback) |
| { |
| return RequestAttributeReporting(Globals::Attributes::ClusterRevision::Id, onReportCallback, |
| BasicAttributeFilter<Int16uAttributeCallback>); |
| } |
| |
| } // namespace Controller |
| } // namespace chip |