diff --git a/examples/chip-tool/templates/commands.zapt b/examples/chip-tool/templates/commands.zapt index 78fd416bb433e4..52b80012429e8f 100644 --- a/examples/chip-tool/templates/commands.zapt +++ b/examples/chip-tool/templates/commands.zapt @@ -182,9 +182,9 @@ static void OnDefaultSuccessResponse(void * context) command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnDefaultFailureResponse(void * context, uint8_t status) +static void OnDefaultFailure(void * context, EmberAfStatus status) { - ChipLogProgress(chipTool, "Default Failure Response: 0x%02x", status); + ChipLogProgress(chipTool, "Default Failure Response: 0x%02x", chip::to_underlying(status)); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_ERROR_INTERNAL); @@ -195,81 +195,6 @@ static void OnDefaultSuccess(void * context, const chip::app::DataModel::NullObj OnDefaultSuccessResponse(context); }; -static void OnDefaultFailure(void * context, EmberAfStatus status) -{ - OnDefaultFailureResponse(context, status); -}; - -static void OnBooleanAttributeReport(void * context, bool value) -{ - ChipLogProgress(chipTool, "Boolean attribute Response: %d", value); -} - -static void OnInt8uAttributeReport(void * context, uint8_t value) -{ - ChipLogProgress(chipTool, "Int8u attribute Response: %" PRIu8, value); -} - -static void OnInt16uAttributeReport(void * context, uint16_t value) -{ - ChipLogProgress(chipTool, "Int16u attribute Response: %" PRIu16, value); -} - -static void OnInt32uAttributeReport(void * context, uint32_t value) -{ - ChipLogProgress(chipTool, "Int32u attribute Response: %" PRIu32, value); -} - -static void OnInt64uAttributeReport(void * context, uint64_t value) -{ - ChipLogProgress(chipTool, "Int64u attribute Response: %" PRIu64, value); -} - -static void OnInt8sAttributeReport(void * context, int8_t value) -{ - ChipLogProgress(chipTool, "Int8s attribute Response: %" PRId8, value); -} - -static void OnInt16sAttributeReport(void * context, int16_t value) -{ - ChipLogProgress(chipTool, "Int16s attribute Response: %" PRId16, value); -} - -static void OnInt32sAttributeReport(void * context, int32_t value) -{ - ChipLogProgress(chipTool, "Int32s attribute Response: %" PRId32, value); -} - -static void OnInt64sAttributeReport(void * context, int64_t value) -{ - ChipLogProgress(chipTool, "Int64s attribute Response: %" PRId64, value); -} - -static void OnFloatAttributeReport(void * context, float value) -{ - ChipLogProgress(chipTool, "Float attribute Response: %f", value); -} - -static void OnDoubleAttributeReport(void * context, double value) -{ - ChipLogProgress(chipTool, "Double attribute Response: %f", value); -} - -static void OnOctetStringAttributeReport(void * context, const chip::ByteSpan value) -{ - char buffer[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; - if (CHIP_NO_ERROR == chip::Encoding::BytesToUppercaseHexString(value.data(), value.size(), &buffer[0], CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE)) { - ChipLogProgress(chipTool, "OctetString attribute Response: %s", buffer); - } else { - ChipLogProgress(chipTool, "OctetString attribute Response len: %zu", value.size()); - } -} - -static void OnCharStringAttributeReport(void * context, const chip::CharSpan value) -{ - ChipLogProgress(chipTool, "CharString attribute Response: %.*s", static_cast(value.size()), value.data()); -} - template static void OnGeneralAttributeResponse(void * context, const char * label, T value) { @@ -430,7 +355,6 @@ private: {{/unless}} {{/if}} {{#if isReportableAttribute}} -{{#unless isList}} class Report{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}: public ModelCommand { public: @@ -445,10 +369,6 @@ public: ~Report{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}() { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; } CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override @@ -458,10 +378,8 @@ public: chip::Controller::{{asUpperCamelCase parent.name}}Cluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttribute{{asUpperCamelCase name}}(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttribute{{asUpperCamelCase name}}(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute(this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -469,17 +387,17 @@ public: return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, {{zapTypeToDecodableClusterObjectType type ns=parent.name isArgument=true}} value) + { + LogValue("{{asUpperCamelCase parent.name}}.{{asUpperCamelCase name}} report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback<{{chipCallback.name}}AttributeCallback> * onReportCallback = new chip::Callback::Callback<{{chipCallback.name}}AttributeCallback>(On{{chipCallback.name}}AttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; }; -{{/unless}} {{/if}} {{/unless}} {{/chip_server_cluster_attributes}} diff --git a/src/app/DeviceProxy.cpp b/src/app/DeviceProxy.cpp index d98213eb63bb09..66167ee18b0bd3 100644 --- a/src/app/DeviceProxy.cpp +++ b/src/app/DeviceProxy.cpp @@ -102,7 +102,7 @@ CHIP_ERROR DeviceProxy::SendSubscribeAttributeRequest(app::AttributePathParams a params.mMaxIntervalCeilingSeconds = mMaxIntervalCeilingSeconds; params.mKeepSubscriptions = false; - CHIP_ERROR err = readClient->SendSubscribeRequest(params); + CHIP_ERROR err = readClient->SendRequest(params); if (err != CHIP_NO_ERROR) { GetInteractionModelDelegate()->FreeAttributePathParam(reinterpret_cast(readClient)); diff --git a/src/app/InteractionModelEngine.cpp b/src/app/InteractionModelEngine.cpp index 9e7110240f8c08..e1a26d15b81468 100644 --- a/src/app/InteractionModelEngine.cpp +++ b/src/app/InteractionModelEngine.cpp @@ -459,7 +459,7 @@ CHIP_ERROR InteractionModelEngine::SendReadRequest(ReadPrepareParams & aReadPrep ReadClient * client = nullptr; CHIP_ERROR err = CHIP_NO_ERROR; ReturnErrorOnFailure(NewReadClient(&client, ReadClient::InteractionType::Read, aCallback)); - err = client->SendReadRequest(aReadPrepareParams); + err = client->SendRequest(aReadPrepareParams); if (err != CHIP_NO_ERROR) { client->Shutdown(); @@ -471,7 +471,7 @@ CHIP_ERROR InteractionModelEngine::SendSubscribeRequest(ReadPrepareParams & aRea { ReadClient * client = nullptr; ReturnErrorOnFailure(NewReadClient(&client, ReadClient::InteractionType::Subscribe, aCallback)); - ReturnErrorOnFailure(client->SendSubscribeRequest(aReadPrepareParams)); + ReturnErrorOnFailure(client->SendRequest(aReadPrepareParams)); return CHIP_NO_ERROR; } diff --git a/src/app/ReadClient.cpp b/src/app/ReadClient.cpp index 2ad95422a844b8..80834662d9040f 100644 --- a/src/app/ReadClient.cpp +++ b/src/app/ReadClient.cpp @@ -114,6 +114,21 @@ void ReadClient::MoveToState(const ClientState aTargetState) GetStateStr()); } +CHIP_ERROR ReadClient::SendRequest(ReadPrepareParams & aReadPrepareParams) +{ + if (mInteractionType == InteractionType::Read) + { + return SendReadRequest(aReadPrepareParams); + } + + if (mInteractionType == InteractionType::Subscribe) + { + return SendSubscribeRequest(aReadPrepareParams); + } + + return CHIP_ERROR_INVALID_ARGUMENT; +} + CHIP_ERROR ReadClient::SendReadRequest(ReadPrepareParams & aReadPrepareParams) { // TODO: SendRequest parameter is too long, need to have the structure to represent it diff --git a/src/app/ReadClient.h b/src/app/ReadClient.h index c0cb6613a0d8fb..f64b537fb85263 100644 --- a/src/app/ReadClient.h +++ b/src/app/ReadClient.h @@ -76,7 +76,9 @@ class ReadClient : public Messaging::ExchangeDelegate * The ReadClient object MUST continue to exist after this call is completed. * * This callback will be called when receiving event data received in the Read and Subscribe interactions - * only one of the apData and apStatus will be non-null. + * + * Only one of the apData and apStatus will be non-null. + * * @param[in] apReadClient: The read client object that initiated the read or subscribe transaction. * @param[in] aEventHeader: The event header in report response. * @param[in] apData: A TLVReader positioned right on the payload of the event. @@ -110,15 +112,15 @@ class ReadClient : public Messaging::ExchangeDelegate /** * OnSubscriptionEstablished will be called when a subscription is established for the given subscription transaction. * - * The ReadClient object MUST continue to exist after this call is completed. The application shall wait until it - * receives an OnDone call before it shuts down the object. + * The ReadClient object MUST continue to exist after this call is completed. The application shall not shut down the + * object until after this call has returned, and shall not delete the object until OnDone is called. * * @param[in] apReadClient The read client object that initiated the read transaction. */ virtual void OnSubscriptionEstablished(const ReadClient * apReadClient) {} /** - * OnError will be called when an error occurs *after* a successful call to SendReadRequest(). The following + * OnError will be called when an error occurs *after* a successful call to SendRequest(). The following * errors will be delivered through this call in the aError field: * * - CHIP_ERROR_TIMEOUT: A response was not received within the expected response timeout. @@ -135,14 +137,15 @@ class ReadClient : public Messaging::ExchangeDelegate /** * OnDone will be called when ReadClient has finished all work and is reserved for future ReadClient ownership change. - * (#10366) Users may use this function to release their own objects related to this write interaction. + * (#10366) Users may use this function to release their own objects related to this read or subscribe interaction. * * This function will: - * - Always be called exactly *once* for a given WriteClient instance. + * - Always be called exactly *once* for a given ReadClient instance. * - Be called even in error circumstances. - * - Only be called after a successful call to SendWriteRequest as been made. + * - Only be called after a successful call to SendRequest has been + * made, when the read completes or the subscription is shut down. * - * @param[in] apReadClient The read client object of the terminated read transaction. + * @param[in] apReadClient The read client object of the terminated read or subscribe interaction. */ virtual void OnDone(ReadClient * apReadClient) = 0; }; @@ -156,33 +159,28 @@ class ReadClient : public Messaging::ExchangeDelegate * Shut down the Client. This terminates this instance of the object and releases * all held resources. The object must not be used after Shutdown() is called. * - * SDK consumer can choose when to shut down the ReadClient. - * The ReadClient will automatically shut itself down when it receives a + * SDK consumer can choose when to shut down the ReadClient. The + * ReadClient will automatically shut itself down when it receives a read * response or the response times out. So manual shutdown is only needed * to shut down a ReadClient before one of those two things has happened, - * (e.g. if SendReadRequest returned failure). + * (e.g. if SendRequest returned failure) or if this ReadClient represents + * a subscription. */ void Shutdown(); /** - * Send a Read Request. There can be one Read Request outstanding on a given ReadClient. - * If SendReadRequest returns success, no more Read Requests can be sent on this ReadClient - * until the corresponding InteractionModelDelegate::ReadDone call happens with guarantee. + * Send a request. There can be one request outstanding on a given ReadClient. + * If SendRequest returns success, no more SendRequest calls can happen on this ReadClient + * until the corresponding OnDone call has happened. + * + * This will send either a Read Request or a Subscribe Request depending on + * the InteractionType this read client was initialized with. * * @retval #others fail to send read request * @retval #CHIP_NO_ERROR On success. */ - CHIP_ERROR SendReadRequest(ReadPrepareParams & aReadPrepareParams); + CHIP_ERROR SendRequest(ReadPrepareParams & aReadPrepareParams); - /** - * Send a subscribe Request. There can be one Subscribe Request outstanding on a given ReadClient. - * If SendSubscribeRequest returns success, no more subscribe Requests can be sent on this ReadClient - * until the corresponding InteractionModelDelegate::ReadDone call happens with guarantee. - * - * @retval #others fail to send subscribe request - * @retval #CHIP_NO_ERROR On success. - */ - CHIP_ERROR SendSubscribeRequest(ReadPrepareParams & aSubscribePrepareParams); CHIP_ERROR OnUnsolicitedReportData(Messaging::ExchangeContext * apExchangeContext, System::PacketBufferHandle && aPayload); auto GetSubscriptionId() const @@ -203,7 +201,7 @@ class ReadClient : public Messaging::ExchangeDelegate enum class ClientState : uint8_t { Uninitialized = 0, ///< The client has not been initialized - Initialized, ///< The client has been initialized and is ready for a SendReadRequest + Initialized, ///< The client has been initialized and is ready for a SendRequest AwaitingInitialReport, ///< The client is waiting for initial report AwaitingSubscribeResponse, ///< The client is waiting for subscribe response SubscriptionActive, ///< The client is maintaining subscription @@ -271,6 +269,9 @@ class ReadClient : public Messaging::ExchangeDelegate CHIP_ERROR AbortExistingExchangeContext(); const char * GetStateStr() const; + // Specialized request-sending functions. + CHIP_ERROR SendReadRequest(ReadPrepareParams & aReadPrepareParams); + CHIP_ERROR SendSubscribeRequest(ReadPrepareParams & aSubscribePrepareParams); /** * Internal shutdown method that we use when we know what's going on with * our exchange and don't need to manually close it. diff --git a/src/app/WriteClient.h b/src/app/WriteClient.h index 1d595a893ac040..1a9a93dae7ffd3 100644 --- a/src/app/WriteClient.h +++ b/src/app/WriteClient.h @@ -98,7 +98,7 @@ class WriteClient : public Messaging::ExchangeDelegate * This function will: * - Always be called exactly *once* for a given WriteClient instance. * - Be called even in error circumstances. - * - Only be called after a successful call to SendWriteRequest as been made. + * - Only be called after a successful call to SendWriteRequest has been made. * * @param[in] apWriteClient The write client object of the terminated write transaction. */ diff --git a/src/app/tests/TestReadInteraction.cpp b/src/app/tests/TestReadInteraction.cpp index f34232c7c8adcd..74d7baeb751f1c 100644 --- a/src/app/tests/TestReadInteraction.cpp +++ b/src/app/tests/TestReadInteraction.cpp @@ -371,7 +371,7 @@ void TestReadInteraction::TestReadClient(nlTestSuite * apSuite, void * apContext err = readClient.Init(&ctx.GetExchangeManager(), &delegate, chip::app::ReadClient::InteractionType::Read); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); ReadPrepareParams readPrepareParams(ctx.GetSessionBobToAlice()); - err = readClient.SendReadRequest(readPrepareParams); + err = readClient.SendRequest(readPrepareParams); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); GenerateReportData(apSuite, apContext, buf, false /*aNeedInvalidReport*/, true /* aSuppressResponse*/); @@ -498,7 +498,7 @@ void TestReadInteraction::TestReadClientInvalidReport(nlTestSuite * apSuite, voi NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); ReadPrepareParams readPrepareParams(ctx.GetSessionBobToAlice()); - err = readClient.SendReadRequest(readPrepareParams); + err = readClient.SendRequest(readPrepareParams); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); GenerateReportData(apSuite, apContext, buf, true /*aNeedInvalidReport*/, true /* aSuppressResponse*/); @@ -1197,7 +1197,7 @@ void TestReadInteraction::TestSubscribeRoundtrip(nlTestSuite * apSuite, void * a ReadClient readClient3; readClient3.Init(&ctx.GetExchangeManager(), &delegate, ReadClient::InteractionType::Subscribe); - err = readClient3.SendSubscribeRequest(readPrepareParams3); + err = readClient3.SendRequest(readPrepareParams3); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); engine->GetReportingEngine().Run(); NL_TEST_ASSERT(apSuite, delegate.mGotReport); @@ -1220,7 +1220,7 @@ void TestReadInteraction::TestSubscribeRoundtrip(nlTestSuite * apSuite, void * a ReadClient readClient4; readClient4.Init(&ctx.GetExchangeManager(), &delegate, ReadClient::InteractionType::Subscribe); - err = readClient4.SendSubscribeRequest(readPrepareParams4); + err = readClient4.SendRequest(readPrepareParams4); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); engine->GetReportingEngine().Run(); NL_TEST_ASSERT(apSuite, !delegate.mGotReport); diff --git a/src/controller/CHIPCluster.h b/src/controller/CHIPCluster.h index 5ed766d3b02bbd..c8112a4f773192 100644 --- a/src/controller/CHIPCluster.h +++ b/src/controller/CHIPCluster.h @@ -45,8 +45,9 @@ using WriteResponseSuccessCallback = void (*)(void * context); using WriteResponseFailureCallback = void (*)(void * context, EmberAfStatus status); using WriteResponseDoneCallback = void (*)(void * context); template -using ReadResponseSuccessCallback = void (*)(void * context, T responseData); -using ReadResponseFailureCallback = void (*)(void * context, EmberAfStatus status); +using ReadResponseSuccessCallback = void (*)(void * context, T responseData); +using ReadResponseFailureCallback = void (*)(void * context, EmberAfStatus status); +using SubscriptionEstablishedCallback = void (*)(void * context); class DLL_EXPORT ClusterBase { @@ -205,6 +206,56 @@ class DLL_EXPORT ClusterBase mEndpoint, clusterId, attributeId, onSuccessCb, onFailureCb); } + /** + * Subscribe to attribute and get a type-safe callback with the attribute + * value when it changes. + */ + template + CHIP_ERROR SubscribeAttribute(void * context, ReadResponseSuccessCallback reportCb, + ReadResponseFailureCallback failureCb, uint16_t minIntervalFloorSeconds, + uint16_t maxIntervalCeilingSeconds, + SubscriptionEstablishedCallback subscriptionEstablishedCb = nullptr) + { + return SubscribeAttribute( + context, AttributeInfo::GetClusterId(), AttributeInfo::GetAttributeId(), reportCb, failureCb, minIntervalFloorSeconds, + maxIntervalCeilingSeconds, subscriptionEstablishedCb); + } + + template + CHIP_ERROR SubscribeAttribute(void * context, ClusterId clusterId, AttributeId attributeId, + ReadResponseSuccessCallback reportCb, ReadResponseFailureCallback failureCb, + uint16_t minIntervalFloorSeconds, uint16_t maxIntervalCeilingSeconds, + SubscriptionEstablishedCallback subscriptionEstablishedCb = nullptr) + { + VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE); + + auto onReportCb = [context, reportCb](const app::ConcreteAttributePath & commandPath, const DecodableType & aData) { + if (reportCb != nullptr) + { + reportCb(context, aData); + } + }; + + auto onFailureCb = [context, failureCb](const app::ConcreteAttributePath * commandPath, app::StatusIB status, + CHIP_ERROR aError) { + if (failureCb != nullptr) + { + failureCb(context, app::ToEmberAfStatus(status.mStatus)); + } + }; + + auto onSubscriptionEstablishedCb = [context, subscriptionEstablishedCb]() { + if (subscriptionEstablishedCb != nullptr) + { + subscriptionEstablishedCb(context); + } + }; + + return Controller::SubscribeAttribute( + mDevice->GetExchangeManager(), mDevice->GetSecureSession().Value(), mEndpoint, clusterId, attributeId, onReportCb, + onFailureCb, minIntervalFloorSeconds, maxIntervalCeilingSeconds, onSubscriptionEstablishedCb); + } + protected: ClusterBase(uint16_t cluster) : mClusterId(cluster) {} diff --git a/src/controller/ReadInteraction.h b/src/controller/ReadInteraction.h index 3405afc0ab1441..293d4f72826667 100644 --- a/src/controller/ReadInteraction.h +++ b/src/controller/ReadInteraction.h @@ -25,30 +25,24 @@ namespace chip { namespace Controller { +namespace detail { -/* - * A typed read attribute function that takes as input a template parameter that encapsulates the type information - * for a given attribute as well as callbacks for success and failure and either returns a decoded cluster-object representation - * of the requested attribute through the provided success callback or calls the provided failure callback. - * - * The AttributeTypeInfo is generally expected to be a ClusterName::Attributes::AttributeName::TypeInfo struct, but any - * object that contains type information exposed through a 'DecodableType' type declaration as well as GetClusterId() and - * GetAttributeId() methods is expected to work. - * - */ +template +struct ReportParams : public app::ReadPrepareParams +{ + ReportParams(SessionHandle sessionHandle) : app::ReadPrepareParams(sessionHandle) { mKeepSubscriptions = false; } + typename TypedReadAttributeCallback::OnSuccessCallbackType mOnReportCb; + typename TypedReadAttributeCallback::OnErrorCallbackType mOnErrorCb; + typename TypedReadAttributeCallback::OnSubscriptionEstablishedCallbackType + mOnSubscriptionEstablishedCb = nullptr; + app::ReadClient::InteractionType mReportType = app::ReadClient::InteractionType::Read; +}; -/** - * To avoid instantiating all the complicated code on a per-attribute basis, we - * have a helper that's just templated on the type. - */ template -CHIP_ERROR ReadAttribute(Messaging::ExchangeManager * aExchangeMgr, const SessionHandle sessionHandle, EndpointId endpointId, - ClusterId clusterId, AttributeId attributeId, - typename TypedReadAttributeCallback::OnSuccessCallbackType onSuccessCb, - typename TypedReadAttributeCallback::OnErrorCallbackType onErrorCb) +CHIP_ERROR ReportAttribute(Messaging::ExchangeManager * exchangeMgr, EndpointId endpointId, ClusterId clusterId, + AttributeId attributeId, ReportParams && readParams) { app::AttributePathParams attributePath(endpointId, clusterId, attributeId); - app::ReadPrepareParams readParams(sessionHandle); app::ReadClient * readClient = nullptr; app::InteractionModelEngine * engine = app::InteractionModelEngine::GetInstance(); CHIP_ERROR err = CHIP_NO_ERROR; @@ -60,14 +54,14 @@ CHIP_ERROR ReadAttribute(Messaging::ExchangeManager * aExchangeMgr, const Sessio chip::Platform::Delete(callback); }; - auto callback = chip::Platform::MakeUnique>(clusterId, attributeId, - onSuccessCb, onErrorCb, onDone); + auto callback = chip::Platform::MakeUnique>( + clusterId, attributeId, readParams.mOnReportCb, readParams.mOnErrorCb, onDone, readParams.mOnSubscriptionEstablishedCb); VerifyOrReturnError(callback != nullptr, CHIP_ERROR_NO_MEMORY); - ReturnErrorOnFailure( - engine->NewReadClient(&readClient, app::ReadClient::InteractionType::Read, &(callback->GetBufferedCallback()))); + ReturnErrorOnFailure(engine->NewReadClient(&readClient, readParams.mReportType, &(callback->GetBufferedCallback()))); + + err = readClient->SendRequest(readParams); - err = readClient->SendReadRequest(readParams); if (err != CHIP_NO_ERROR) { readClient->Shutdown(); @@ -83,6 +77,83 @@ CHIP_ERROR ReadAttribute(Messaging::ExchangeManager * aExchangeMgr, const Sessio return err; } +} // namespace detail + +/** + * To avoid instantiating all the complicated read code on a per-attribute + * basis, we have a helper that's just templated on the type. + */ +template +CHIP_ERROR ReadAttribute(Messaging::ExchangeManager * exchangeMgr, const SessionHandle sessionHandle, EndpointId endpointId, + ClusterId clusterId, AttributeId attributeId, + typename TypedReadAttributeCallback::OnSuccessCallbackType onSuccessCb, + typename TypedReadAttributeCallback::OnErrorCallbackType onErrorCb) +{ + detail::ReportParams params(sessionHandle); + params.mOnReportCb = onSuccessCb; + params.mOnErrorCb = onErrorCb; + return detail::ReportAttribute(exchangeMgr, endpointId, clusterId, attributeId, std::move(params)); +} + +/* + * A typed read attribute function that takes as input a template parameter that encapsulates the type information + * for a given attribute as well as callbacks for success and failure and either returns a decoded cluster-object representation + * of the requested attribute through the provided success callback or calls the provided failure callback. + * + * The AttributeTypeInfo is generally expected to be a ClusterName::Attributes::AttributeName::TypeInfo struct, but any + * object that contains type information exposed through a 'DecodableType' type declaration as well as GetClusterId() and + * GetAttributeId() methods is expected to work. + */ +template +CHIP_ERROR +ReadAttribute(Messaging::ExchangeManager * exchangeMgr, const SessionHandle sessionHandle, EndpointId endpointId, + typename TypedReadAttributeCallback::OnSuccessCallbackType onSuccessCb, + typename TypedReadAttributeCallback::OnErrorCallbackType onErrorCb) +{ + return ReadAttribute(exchangeMgr, sessionHandle, endpointId, + AttributeTypeInfo::GetClusterId(), + AttributeTypeInfo::GetAttributeId(), onSuccessCb, onErrorCb); +} + +// Helper for SubscribeAttribute to reduce the amount of code generated. +template +CHIP_ERROR SubscribeAttribute(Messaging::ExchangeManager * exchangeMgr, const SessionHandle sessionHandle, EndpointId endpointId, + ClusterId clusterId, AttributeId attributeId, + typename TypedReadAttributeCallback::OnSuccessCallbackType onReportCb, + typename TypedReadAttributeCallback::OnErrorCallbackType onErrorCb, + uint16_t minIntervalFloorSeconds, uint16_t maxIntervalCeilingSeconds, + typename TypedReadAttributeCallback::OnSubscriptionEstablishedCallbackType + onSubscriptionEstablishedCb = nullptr) +{ + detail::ReportParams params(sessionHandle); + params.mOnReportCb = onReportCb; + params.mOnErrorCb = onErrorCb; + params.mOnSubscriptionEstablishedCb = onSubscriptionEstablishedCb; + params.mMinIntervalFloorSeconds = minIntervalFloorSeconds; + params.mMaxIntervalCeilingSeconds = maxIntervalCeilingSeconds; + params.mReportType = app::ReadClient::InteractionType::Subscribe; + return detail::ReportAttribute(exchangeMgr, endpointId, clusterId, attributeId, std::move(params)); +} + +/* + * A typed way to subscribe to the value of a single attribute. See + * documentation for ReadAttribute above for details on how AttributeTypeInfo + * works. + */ +template +CHIP_ERROR SubscribeAttribute( + Messaging::ExchangeManager * exchangeMgr, const SessionHandle sessionHandle, EndpointId endpointId, + typename TypedReadAttributeCallback::OnSuccessCallbackType onReportCb, + typename TypedReadAttributeCallback::OnErrorCallbackType onErrorCb, + uint16_t aMinIntervalFloorSeconds, uint16_t aMaxIntervalCeilingSeconds, + typename TypedReadAttributeCallback::OnSubscriptionEstablishedCallbackType + onSubscriptionEstablishedCb = nullptr) +{ + return SubscribeAttribute( + exchangeMgr, sessionHandle, endpointId, AttributeTypeInfo::GetClusterId(), AttributeTypeInfo::GetAttributeId(), onReportCb, + onErrorCb, aMinIntervalFloorSeconds, aMaxIntervalCeilingSeconds, onSubscriptionEstablishedCb); +} + /* * A typed read event function that takes as input a template parameter that encapsulates the type information * for a given attribute as well as callbacks for success and failure and either returns a decoded cluster-object representation @@ -118,7 +189,7 @@ CHIP_ERROR ReadEvent(Messaging::ExchangeManager * apExchangeMgr, const SessionHa ReturnErrorOnFailure(engine->NewReadClient(&readClient, app::ReadClient::InteractionType::Read, callback.get())); - err = readClient->SendReadRequest(readParams); + err = readClient->SendRequest(readParams); if (err != CHIP_NO_ERROR) { readClient->Shutdown(); @@ -134,15 +205,5 @@ CHIP_ERROR ReadEvent(Messaging::ExchangeManager * apExchangeMgr, const SessionHa return err; } -template -CHIP_ERROR -ReadAttribute(Messaging::ExchangeManager * aExchangeMgr, const SessionHandle sessionHandle, EndpointId endpointId, - typename TypedReadAttributeCallback::OnSuccessCallbackType onSuccessCb, - typename TypedReadAttributeCallback::OnErrorCallbackType onErrorCb) -{ - return ReadAttribute(aExchangeMgr, sessionHandle, endpointId, - AttributeTypeInfo::GetClusterId(), - AttributeTypeInfo::GetAttributeId(), onSuccessCb, onErrorCb); -} } // namespace Controller } // namespace chip diff --git a/src/controller/TypedReadCallback.h b/src/controller/TypedReadCallback.h index 38869ecbdb5058..d3cfdbcf617531 100644 --- a/src/controller/TypedReadCallback.h +++ b/src/controller/TypedReadCallback.h @@ -45,11 +45,14 @@ class TypedReadAttributeCallback final : public app::ReadClient::Callback using OnErrorCallbackType = std::function; using OnDoneCallbackType = std::function; + using OnSubscriptionEstablishedCallbackType = std::function; TypedReadAttributeCallback(ClusterId aClusterId, AttributeId aAttributeId, OnSuccessCallbackType aOnSuccess, - OnErrorCallbackType aOnError, OnDoneCallbackType aOnDone) : + OnErrorCallbackType aOnError, OnDoneCallbackType aOnDone, + OnSubscriptionEstablishedCallbackType aOnSubscriptionEstablished = nullptr) : mClusterId(aClusterId), - mAttributeId(aAttributeId), mOnSuccess(aOnSuccess), mOnError(aOnError), mOnDone(aOnDone), mBufferedReadAdapter(*this) + mAttributeId(aAttributeId), mOnSuccess(aOnSuccess), mOnError(aOnError), mOnDone(aOnDone), + mOnSubscriptionEstablished(aOnSubscriptionEstablished), mBufferedReadAdapter(*this) {} app::BufferedReadCallback & GetBufferedCallback() { return mBufferedReadAdapter; } @@ -99,11 +102,20 @@ class TypedReadAttributeCallback final : public app::ReadClient::Callback void OnDone(app::ReadClient * apReadClient) override { mOnDone(apReadClient, this); } + void OnSubscriptionEstablished(const app::ReadClient * apReadClient) override + { + if (mOnSubscriptionEstablished) + { + mOnSubscriptionEstablished(); + } + } + ClusterId mClusterId; AttributeId mAttributeId; OnSuccessCallbackType mOnSuccess; OnErrorCallbackType mOnError; OnDoneCallbackType mOnDone; + OnSubscriptionEstablishedCallbackType mOnSubscriptionEstablished; app::BufferedReadCallback mBufferedReadAdapter; }; diff --git a/src/controller/python/chip/clusters/attribute.cpp b/src/controller/python/chip/clusters/attribute.cpp index 961cdac8d5bfb5..a6ee511542ab4f 100644 --- a/src/controller/python/chip/clusters/attribute.cpp +++ b/src/controller/python/chip/clusters/attribute.cpp @@ -323,14 +323,10 @@ chip::ChipError::StorageType pychip_ReadClient_ReadAttributes(void * appContext, { params.mMinIntervalFloorSeconds = minInterval; params.mMaxIntervalCeilingSeconds = maxInterval; - - err = readClient->SendSubscribeRequest(params); - } - else - { - err = readClient->SendReadRequest(params); } + err = readClient->SendRequest(params); + if (err != CHIP_NO_ERROR) { readClient->Shutdown(); @@ -384,14 +380,10 @@ chip::ChipError::StorageType pychip_ReadClient_ReadEvents(void * appContext, Dev { params.mMinIntervalFloorSeconds = minInterval; params.mMaxIntervalCeilingSeconds = maxInterval; - - err = readClient->SendSubscribeRequest(params); - } - else - { - err = readClient->SendReadRequest(params); } + err = readClient->SendRequest(params); + if (err != CHIP_NO_ERROR) { readClient->Shutdown(); diff --git a/src/controller/tests/TestReadChunking.cpp b/src/controller/tests/TestReadChunking.cpp index 23a8eec4b19692..da1a3273d83742 100644 --- a/src/controller/tests/TestReadChunking.cpp +++ b/src/controller/tests/TestReadChunking.cpp @@ -232,7 +232,7 @@ void TestCommandInteraction::TestChunking(nlTestSuite * apSuite, void * apContex NL_TEST_ASSERT(apSuite, engine->NewReadClient(&readClient, app::ReadClient::InteractionType::Read, &readCallback.mBufferedCallback) == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, readClient->SendReadRequest(readParams) == CHIP_NO_ERROR); + NL_TEST_ASSERT(apSuite, readClient->SendRequest(readParams) == CHIP_NO_ERROR); // // Service the IO + Engine till we get a ReportEnd callback on the client. @@ -306,7 +306,7 @@ void TestCommandInteraction::TestListChunking(nlTestSuite * apSuite, void * apCo NL_TEST_ASSERT(apSuite, engine->NewReadClient(&readClient, app::ReadClient::InteractionType::Read, &readCallback.mBufferedCallback) == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, readClient->SendReadRequest(readParams) == CHIP_NO_ERROR); + NL_TEST_ASSERT(apSuite, readClient->SendRequest(readParams) == CHIP_NO_ERROR); // // Service the IO + Engine till we get a ReportEnd callback on the client. @@ -368,7 +368,7 @@ void TestCommandInteraction::TestBadChunking(nlTestSuite * apSuite, void * apCon NL_TEST_ASSERT(apSuite, engine->NewReadClient(&readClient, app::ReadClient::InteractionType::Read, &readCallback.mBufferedCallback) == CHIP_NO_ERROR); - NL_TEST_ASSERT(apSuite, readClient->SendReadRequest(readParams) == CHIP_NO_ERROR); + NL_TEST_ASSERT(apSuite, readClient->SendRequest(readParams) == CHIP_NO_ERROR); // // Service the IO + Engine till we get a ReportEnd callback on the client. diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index ec60419bcf21c0..a95f053a86dfe4 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -2237,9 +2237,9 @@ static void OnDefaultSuccessResponse(void * context) command->SetCommandExitStatus(CHIP_NO_ERROR); } -static void OnDefaultFailureResponse(void * context, uint8_t status) +static void OnDefaultFailure(void * context, EmberAfStatus status) { - ChipLogProgress(chipTool, "Default Failure Response: 0x%02x", status); + ChipLogProgress(chipTool, "Default Failure Response: 0x%02x", chip::to_underlying(status)); ModelCommand * command = static_cast(context); command->SetCommandExitStatus(CHIP_ERROR_INTERNAL); @@ -2250,85 +2250,6 @@ static void OnDefaultSuccess(void * context, const chip::app::DataModel::NullObj OnDefaultSuccessResponse(context); }; -static void OnDefaultFailure(void * context, EmberAfStatus status) -{ - OnDefaultFailureResponse(context, status); -}; - -static void OnBooleanAttributeReport(void * context, bool value) -{ - ChipLogProgress(chipTool, "Boolean attribute Response: %d", value); -} - -static void OnInt8uAttributeReport(void * context, uint8_t value) -{ - ChipLogProgress(chipTool, "Int8u attribute Response: %" PRIu8, value); -} - -static void OnInt16uAttributeReport(void * context, uint16_t value) -{ - ChipLogProgress(chipTool, "Int16u attribute Response: %" PRIu16, value); -} - -static void OnInt32uAttributeReport(void * context, uint32_t value) -{ - ChipLogProgress(chipTool, "Int32u attribute Response: %" PRIu32, value); -} - -static void OnInt64uAttributeReport(void * context, uint64_t value) -{ - ChipLogProgress(chipTool, "Int64u attribute Response: %" PRIu64, value); -} - -static void OnInt8sAttributeReport(void * context, int8_t value) -{ - ChipLogProgress(chipTool, "Int8s attribute Response: %" PRId8, value); -} - -static void OnInt16sAttributeReport(void * context, int16_t value) -{ - ChipLogProgress(chipTool, "Int16s attribute Response: %" PRId16, value); -} - -static void OnInt32sAttributeReport(void * context, int32_t value) -{ - ChipLogProgress(chipTool, "Int32s attribute Response: %" PRId32, value); -} - -static void OnInt64sAttributeReport(void * context, int64_t value) -{ - ChipLogProgress(chipTool, "Int64s attribute Response: %" PRId64, value); -} - -static void OnFloatAttributeReport(void * context, float value) -{ - ChipLogProgress(chipTool, "Float attribute Response: %f", value); -} - -static void OnDoubleAttributeReport(void * context, double value) -{ - ChipLogProgress(chipTool, "Double attribute Response: %f", value); -} - -static void OnOctetStringAttributeReport(void * context, const chip::ByteSpan value) -{ - char buffer[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE]; - if (CHIP_NO_ERROR == - chip::Encoding::BytesToUppercaseHexString(value.data(), value.size(), &buffer[0], CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE)) - { - ChipLogProgress(chipTool, "OctetString attribute Response: %s", buffer); - } - else - { - ChipLogProgress(chipTool, "OctetString attribute Response len: %zu", value.size()); - } -} - -static void OnCharStringAttributeReport(void * context, const chip::CharSpan value) -{ - ChipLogProgress(chipTool, "CharString attribute Response: %.*s", static_cast(value.size()), value.data()); -} - template static void OnGeneralAttributeResponse(void * context, const char * label, T value) { @@ -3661,6 +3582,51 @@ class ReadAccessControlAcl : public ModelCommand } }; +class ReportAccessControlAcl : public ModelCommand +{ +public: + ReportAccessControlAcl() : ModelCommand("report") + { + AddArgument("attr-name", "acl"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportAccessControlAcl() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x001F) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::AccessControlCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport( + void * context, + const chip::app::DataModel::DecodableList & + value) + { + LogValue("AccessControl.Acl report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute Extension */ @@ -3694,6 +3660,51 @@ class ReadAccessControlExtension : public ModelCommand } }; +class ReportAccessControlExtension : public ModelCommand +{ +public: + ReportAccessControlExtension() : ModelCommand("report") + { + AddArgument("attr-name", "extension"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportAccessControlExtension() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x001F) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::AccessControlCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport( + void * context, + const chip::app::DataModel::DecodableList & + value) + { + LogValue("AccessControl.Extension report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute AttributeList */ @@ -3887,13 +3898,7 @@ class ReportAccountLoginClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportAccountLoginClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportAccountLoginClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -3902,10 +3907,9 @@ class ReportAccountLoginClusterRevision : public ModelCommand chip::Controller::AccountLoginCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -3913,15 +3917,9 @@ class ReportAccountLoginClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("AccountLogin.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -4178,13 +4176,7 @@ class ReportAdministratorCommissioningClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportAdministratorCommissioningClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportAdministratorCommissioningClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -4193,10 +4185,9 @@ class ReportAdministratorCommissioningClusterRevision : public ModelCommand chip::Controller::AdministratorCommissioningCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -4204,15 +4195,12 @@ class ReportAdministratorCommissioningClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("AdministratorCommissioning.ClusterRevision report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -4303,13 +4291,7 @@ class ReportApplicationBasicVendorName : public ModelCommand ModelCommand::AddArguments(); } - ~ReportApplicationBasicVendorName() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportApplicationBasicVendorName() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -4318,10 +4300,9 @@ class ReportApplicationBasicVendorName : public ModelCommand chip::Controller::ApplicationBasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeVendorName(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeVendorName(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -4329,15 +4310,9 @@ class ReportApplicationBasicVendorName : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) { LogValue("ApplicationBasic.VendorName report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -4385,13 +4360,7 @@ class ReportApplicationBasicVendorId : public ModelCommand ModelCommand::AddArguments(); } - ~ReportApplicationBasicVendorId() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportApplicationBasicVendorId() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -4400,10 +4369,9 @@ class ReportApplicationBasicVendorId : public ModelCommand chip::Controller::ApplicationBasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeVendorId(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeVendorId(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -4411,15 +4379,9 @@ class ReportApplicationBasicVendorId : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ApplicationBasic.VendorId report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -4467,13 +4429,7 @@ class ReportApplicationBasicApplicationName : public ModelCommand ModelCommand::AddArguments(); } - ~ReportApplicationBasicApplicationName() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportApplicationBasicApplicationName() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -4482,10 +4438,9 @@ class ReportApplicationBasicApplicationName : public ModelCommand chip::Controller::ApplicationBasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeApplicationName(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeApplicationName(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -4493,15 +4448,12 @@ class ReportApplicationBasicApplicationName : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) + { + LogValue("ApplicationBasic.ApplicationName report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -4549,13 +4501,7 @@ class ReportApplicationBasicProductId : public ModelCommand ModelCommand::AddArguments(); } - ~ReportApplicationBasicProductId() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportApplicationBasicProductId() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -4564,10 +4510,9 @@ class ReportApplicationBasicProductId : public ModelCommand chip::Controller::ApplicationBasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeProductId(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeProductId(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -4575,15 +4520,9 @@ class ReportApplicationBasicProductId : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ApplicationBasic.ProductId report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -4631,13 +4570,7 @@ class ReportApplicationBasicApplicationId : public ModelCommand ModelCommand::AddArguments(); } - ~ReportApplicationBasicApplicationId() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportApplicationBasicApplicationId() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -4646,10 +4579,9 @@ class ReportApplicationBasicApplicationId : public ModelCommand chip::Controller::ApplicationBasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeApplicationId(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeApplicationId(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -4657,15 +4589,9 @@ class ReportApplicationBasicApplicationId : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) { LogValue("ApplicationBasic.ApplicationId report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -4713,13 +4639,7 @@ class ReportApplicationBasicCatalogVendorId : public ModelCommand ModelCommand::AddArguments(); } - ~ReportApplicationBasicCatalogVendorId() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportApplicationBasicCatalogVendorId() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -4728,10 +4648,9 @@ class ReportApplicationBasicCatalogVendorId : public ModelCommand chip::Controller::ApplicationBasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCatalogVendorId(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCatalogVendorId(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -4739,15 +4658,9 @@ class ReportApplicationBasicCatalogVendorId : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ApplicationBasic.CatalogVendorId report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -4795,13 +4708,7 @@ class ReportApplicationBasicApplicationStatus : public ModelCommand ModelCommand::AddArguments(); } - ~ReportApplicationBasicApplicationStatus() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportApplicationBasicApplicationStatus() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -4810,11 +4717,9 @@ class ReportApplicationBasicApplicationStatus : public ModelCommand chip::Controller::ApplicationBasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeApplicationStatus(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeApplicationStatus(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -4822,15 +4727,9 @@ class ReportApplicationBasicApplicationStatus : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ApplicationBasic.ApplicationStatus report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -4908,13 +4807,7 @@ class ReportApplicationBasicClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportApplicationBasicClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportApplicationBasicClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -4923,10 +4816,9 @@ class ReportApplicationBasicClusterRevision : public ModelCommand chip::Controller::ApplicationBasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -4934,15 +4826,9 @@ class ReportApplicationBasicClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ApplicationBasic.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -5018,6 +4904,48 @@ class ReadApplicationLauncherApplicationLauncherList : public ModelCommand } }; +class ReportApplicationLauncherApplicationLauncherList : public ModelCommand +{ +public: + ReportApplicationLauncherApplicationLauncherList() : ModelCommand("report") + { + AddArgument("attr-name", "application-launcher-list"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportApplicationLauncherApplicationLauncherList() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050C) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::ApplicationLauncherCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, const chip::app::DataModel::DecodableList & value) + { + LogValue("ApplicationLauncher.ApplicationLauncherList report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute CatalogVendorId */ @@ -5060,13 +4988,7 @@ class ReportApplicationLauncherCatalogVendorId : public ModelCommand ModelCommand::AddArguments(); } - ~ReportApplicationLauncherCatalogVendorId() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportApplicationLauncherCatalogVendorId() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -5075,10 +4997,9 @@ class ReportApplicationLauncherCatalogVendorId : public ModelCommand chip::Controller::ApplicationLauncherCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCatalogVendorId(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCatalogVendorId(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -5086,15 +5007,9 @@ class ReportApplicationLauncherCatalogVendorId : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ApplicationLauncher.CatalogVendorId report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -5142,13 +5057,7 @@ class ReportApplicationLauncherApplicationId : public ModelCommand ModelCommand::AddArguments(); } - ~ReportApplicationLauncherApplicationId() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportApplicationLauncherApplicationId() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -5157,10 +5066,9 @@ class ReportApplicationLauncherApplicationId : public ModelCommand chip::Controller::ApplicationLauncherCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeApplicationId(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeApplicationId(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -5168,15 +5076,9 @@ class ReportApplicationLauncherApplicationId : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ApplicationLauncher.ApplicationId report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -5254,13 +5156,7 @@ class ReportApplicationLauncherClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportApplicationLauncherClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportApplicationLauncherClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -5269,10 +5165,9 @@ class ReportApplicationLauncherClusterRevision : public ModelCommand chip::Controller::ApplicationLauncherCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -5280,15 +5175,9 @@ class ReportApplicationLauncherClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ApplicationLauncher.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -5390,6 +5279,51 @@ class ReadAudioOutputAudioOutputList : public ModelCommand } }; +class ReportAudioOutputAudioOutputList : public ModelCommand +{ +public: + ReportAudioOutputAudioOutputList() : ModelCommand("report") + { + AddArgument("attr-name", "audio-output-list"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportAudioOutputAudioOutputList() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050B) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::AudioOutputCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport( + void * context, + const chip::app::DataModel::DecodableList & + value) + { + LogValue("AudioOutput.AudioOutputList report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute CurrentAudioOutput */ @@ -5432,13 +5366,7 @@ class ReportAudioOutputCurrentAudioOutput : public ModelCommand ModelCommand::AddArguments(); } - ~ReportAudioOutputCurrentAudioOutput() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportAudioOutputCurrentAudioOutput() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -5447,11 +5375,9 @@ class ReportAudioOutputCurrentAudioOutput : public ModelCommand chip::Controller::AudioOutputCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentAudioOutput(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentAudioOutput(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -5459,15 +5385,9 @@ class ReportAudioOutputCurrentAudioOutput : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("AudioOutput.CurrentAudioOutput report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -5545,13 +5465,7 @@ class ReportAudioOutputClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportAudioOutputClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportAudioOutputClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -5560,10 +5474,9 @@ class ReportAudioOutputClusterRevision : public ModelCommand chip::Controller::AudioOutputCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -5571,15 +5484,9 @@ class ReportAudioOutputClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("AudioOutput.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -5687,13 +5594,7 @@ class ReportBarrierControlBarrierMovingState : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBarrierControlBarrierMovingState() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBarrierControlBarrierMovingState() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -5702,11 +5603,9 @@ class ReportBarrierControlBarrierMovingState : public ModelCommand chip::Controller::BarrierControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeBarrierMovingState(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeBarrierMovingState(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -5714,15 +5613,9 @@ class ReportBarrierControlBarrierMovingState : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("BarrierControl.BarrierMovingState report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -5770,13 +5663,7 @@ class ReportBarrierControlBarrierSafetyStatus : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBarrierControlBarrierSafetyStatus() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBarrierControlBarrierSafetyStatus() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -5785,11 +5672,9 @@ class ReportBarrierControlBarrierSafetyStatus : public ModelCommand chip::Controller::BarrierControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeBarrierSafetyStatus(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeBarrierSafetyStatus(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -5797,15 +5682,9 @@ class ReportBarrierControlBarrierSafetyStatus : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("BarrierControl.BarrierSafetyStatus report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -5853,13 +5732,7 @@ class ReportBarrierControlBarrierCapabilities : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBarrierControlBarrierCapabilities() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBarrierControlBarrierCapabilities() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -5868,11 +5741,9 @@ class ReportBarrierControlBarrierCapabilities : public ModelCommand chip::Controller::BarrierControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeBarrierCapabilities(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeBarrierCapabilities(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -5880,15 +5751,9 @@ class ReportBarrierControlBarrierCapabilities : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("BarrierControl.BarrierCapabilities report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -5936,13 +5801,7 @@ class ReportBarrierControlBarrierPosition : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBarrierControlBarrierPosition() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBarrierControlBarrierPosition() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -5951,10 +5810,9 @@ class ReportBarrierControlBarrierPosition : public ModelCommand chip::Controller::BarrierControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeBarrierPosition(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeBarrierPosition(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -5962,15 +5820,9 @@ class ReportBarrierControlBarrierPosition : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("BarrierControl.BarrierPosition report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -6048,13 +5900,7 @@ class ReportBarrierControlClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBarrierControlClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBarrierControlClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -6063,10 +5909,9 @@ class ReportBarrierControlClusterRevision : public ModelCommand chip::Controller::BarrierControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -6074,15 +5919,9 @@ class ReportBarrierControlClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("BarrierControl.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -6180,13 +6019,7 @@ class ReportBasicInteractionModelVersion : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBasicInteractionModelVersion() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBasicInteractionModelVersion() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -6195,11 +6028,9 @@ class ReportBasicInteractionModelVersion : public ModelCommand chip::Controller::BasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInteractionModelVersion(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInteractionModelVersion(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -6207,15 +6038,9 @@ class ReportBasicInteractionModelVersion : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("Basic.InteractionModelVersion report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -6263,13 +6088,7 @@ class ReportBasicVendorName : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBasicVendorName() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBasicVendorName() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -6278,10 +6097,9 @@ class ReportBasicVendorName : public ModelCommand chip::Controller::BasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeVendorName(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeVendorName(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -6289,15 +6107,9 @@ class ReportBasicVendorName : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) { LogValue("Basic.VendorName report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -6345,13 +6157,7 @@ class ReportBasicVendorID : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBasicVendorID() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBasicVendorID() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -6360,10 +6166,9 @@ class ReportBasicVendorID : public ModelCommand chip::Controller::BasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeVendorID(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeVendorID(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -6371,15 +6176,9 @@ class ReportBasicVendorID : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("Basic.VendorID report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -6427,13 +6226,7 @@ class ReportBasicProductName : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBasicProductName() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBasicProductName() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -6442,10 +6235,9 @@ class ReportBasicProductName : public ModelCommand chip::Controller::BasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeProductName(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeProductName(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -6453,15 +6245,9 @@ class ReportBasicProductName : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) { LogValue("Basic.ProductName report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -6509,13 +6295,7 @@ class ReportBasicProductID : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBasicProductID() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBasicProductID() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -6524,10 +6304,9 @@ class ReportBasicProductID : public ModelCommand chip::Controller::BasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeProductID(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeProductID(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -6535,15 +6314,9 @@ class ReportBasicProductID : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("Basic.ProductID report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -6617,13 +6390,7 @@ class ReportBasicNodeLabel : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBasicNodeLabel() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBasicNodeLabel() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -6632,10 +6399,9 @@ class ReportBasicNodeLabel : public ModelCommand chip::Controller::BasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNodeLabel(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNodeLabel(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -6643,15 +6409,9 @@ class ReportBasicNodeLabel : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) { LogValue("Basic.NodeLabel report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -6725,13 +6485,7 @@ class ReportBasicLocation : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBasicLocation() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBasicLocation() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -6740,10 +6494,9 @@ class ReportBasicLocation : public ModelCommand chip::Controller::BasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeLocation(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeLocation(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -6751,15 +6504,9 @@ class ReportBasicLocation : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) { LogValue("Basic.Location report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -6807,13 +6554,7 @@ class ReportBasicHardwareVersion : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBasicHardwareVersion() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBasicHardwareVersion() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -6822,10 +6563,9 @@ class ReportBasicHardwareVersion : public ModelCommand chip::Controller::BasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeHardwareVersion(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeHardwareVersion(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -6833,15 +6573,9 @@ class ReportBasicHardwareVersion : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("Basic.HardwareVersion report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -6889,13 +6623,7 @@ class ReportBasicHardwareVersionString : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBasicHardwareVersionString() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBasicHardwareVersionString() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -6904,11 +6632,9 @@ class ReportBasicHardwareVersionString : public ModelCommand chip::Controller::BasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeHardwareVersionString(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeHardwareVersionString(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -6916,15 +6642,9 @@ class ReportBasicHardwareVersionString : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) { LogValue("Basic.HardwareVersionString report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -6972,13 +6692,7 @@ class ReportBasicSoftwareVersion : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBasicSoftwareVersion() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBasicSoftwareVersion() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -6987,10 +6701,9 @@ class ReportBasicSoftwareVersion : public ModelCommand chip::Controller::BasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeSoftwareVersion(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeSoftwareVersion(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -6998,15 +6711,9 @@ class ReportBasicSoftwareVersion : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) { LogValue("Basic.SoftwareVersion report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -7054,13 +6761,7 @@ class ReportBasicSoftwareVersionString : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBasicSoftwareVersionString() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBasicSoftwareVersionString() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -7069,11 +6770,9 @@ class ReportBasicSoftwareVersionString : public ModelCommand chip::Controller::BasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeSoftwareVersionString(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeSoftwareVersionString(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -7081,15 +6780,9 @@ class ReportBasicSoftwareVersionString : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) { LogValue("Basic.SoftwareVersionString report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -7137,13 +6830,7 @@ class ReportBasicManufacturingDate : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBasicManufacturingDate() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBasicManufacturingDate() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -7152,11 +6839,9 @@ class ReportBasicManufacturingDate : public ModelCommand chip::Controller::BasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeManufacturingDate(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeManufacturingDate(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -7164,15 +6849,9 @@ class ReportBasicManufacturingDate : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) { LogValue("Basic.ManufacturingDate report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -7220,13 +6899,7 @@ class ReportBasicPartNumber : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBasicPartNumber() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBasicPartNumber() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -7235,10 +6908,9 @@ class ReportBasicPartNumber : public ModelCommand chip::Controller::BasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePartNumber(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePartNumber(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -7246,15 +6918,9 @@ class ReportBasicPartNumber : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) { LogValue("Basic.PartNumber report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -7302,13 +6968,7 @@ class ReportBasicProductURL : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBasicProductURL() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBasicProductURL() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -7317,10 +6977,9 @@ class ReportBasicProductURL : public ModelCommand chip::Controller::BasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeProductURL(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeProductURL(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -7328,15 +6987,9 @@ class ReportBasicProductURL : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) { LogValue("Basic.ProductURL report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -7384,13 +7037,7 @@ class ReportBasicProductLabel : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBasicProductLabel() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBasicProductLabel() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -7399,10 +7046,9 @@ class ReportBasicProductLabel : public ModelCommand chip::Controller::BasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeProductLabel(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeProductLabel(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -7410,15 +7056,9 @@ class ReportBasicProductLabel : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) { LogValue("Basic.ProductLabel report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -7466,13 +7106,7 @@ class ReportBasicSerialNumber : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBasicSerialNumber() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBasicSerialNumber() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -7481,10 +7115,9 @@ class ReportBasicSerialNumber : public ModelCommand chip::Controller::BasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeSerialNumber(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeSerialNumber(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -7492,15 +7125,9 @@ class ReportBasicSerialNumber : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) { LogValue("Basic.SerialNumber report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -7574,13 +7201,7 @@ class ReportBasicLocalConfigDisabled : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBasicLocalConfigDisabled() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBasicLocalConfigDisabled() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -7589,11 +7210,9 @@ class ReportBasicLocalConfigDisabled : public ModelCommand chip::Controller::BasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeLocalConfigDisabled(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeLocalConfigDisabled(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -7601,15 +7220,9 @@ class ReportBasicLocalConfigDisabled : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, bool value) { LogValue("Basic.LocalConfigDisabled report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnBooleanAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -7657,13 +7270,7 @@ class ReportBasicReachable : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBasicReachable() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBasicReachable() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -7672,10 +7279,9 @@ class ReportBasicReachable : public ModelCommand chip::Controller::BasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeReachable(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeReachable(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -7683,15 +7289,9 @@ class ReportBasicReachable : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, bool value) { LogValue("Basic.Reachable report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnBooleanAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -7799,13 +7399,7 @@ class ReportBasicClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBasicClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBasicClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -7814,10 +7408,9 @@ class ReportBasicClusterRevision : public ModelCommand chip::Controller::BasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -7825,15 +7418,9 @@ class ReportBasicClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("Basic.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -7920,13 +7507,7 @@ class ReportBinaryInputBasicOutOfService : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBinaryInputBasicOutOfService() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBinaryInputBasicOutOfService() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -7935,10 +7516,9 @@ class ReportBinaryInputBasicOutOfService : public ModelCommand chip::Controller::BinaryInputBasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOutOfService(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOutOfService(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -7946,15 +7526,9 @@ class ReportBinaryInputBasicOutOfService : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, bool value) { LogValue("BinaryInputBasic.OutOfService report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnBooleanAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -8028,13 +7602,7 @@ class ReportBinaryInputBasicPresentValue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBinaryInputBasicPresentValue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBinaryInputBasicPresentValue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -8043,10 +7611,9 @@ class ReportBinaryInputBasicPresentValue : public ModelCommand chip::Controller::BinaryInputBasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePresentValue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePresentValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -8054,15 +7621,9 @@ class ReportBinaryInputBasicPresentValue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, bool value) { LogValue("BinaryInputBasic.PresentValue report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnBooleanAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -8110,13 +7671,7 @@ class ReportBinaryInputBasicStatusFlags : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBinaryInputBasicStatusFlags() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBinaryInputBasicStatusFlags() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -8125,10 +7680,9 @@ class ReportBinaryInputBasicStatusFlags : public ModelCommand chip::Controller::BinaryInputBasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeStatusFlags(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeStatusFlags(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -8136,15 +7690,9 @@ class ReportBinaryInputBasicStatusFlags : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("BinaryInputBasic.StatusFlags report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -8222,13 +7770,7 @@ class ReportBinaryInputBasicClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBinaryInputBasicClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBinaryInputBasicClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -8237,10 +7779,9 @@ class ReportBinaryInputBasicClusterRevision : public ModelCommand chip::Controller::BinaryInputBasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -8248,15 +7789,9 @@ class ReportBinaryInputBasicClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("BinaryInputBasic.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -8400,13 +7935,7 @@ class ReportBindingClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBindingClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBindingClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -8415,10 +7944,9 @@ class ReportBindingClusterRevision : public ModelCommand chip::Controller::BindingCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -8426,15 +7954,9 @@ class ReportBindingClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("Binding.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -8493,13 +8015,7 @@ class ReportBooleanStateStateValue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBooleanStateStateValue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBooleanStateStateValue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -8508,10 +8024,9 @@ class ReportBooleanStateStateValue : public ModelCommand chip::Controller::BooleanStateCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeStateValue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeStateValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -8519,15 +8034,9 @@ class ReportBooleanStateStateValue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, bool value) { LogValue("BooleanState.StateValue report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnBooleanAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -8605,13 +8114,7 @@ class ReportBooleanStateClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBooleanStateClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBooleanStateClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -8620,10 +8123,9 @@ class ReportBooleanStateClusterRevision : public ModelCommand chip::Controller::BooleanStateCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -8631,15 +8133,9 @@ class ReportBooleanStateClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("BooleanState.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -9008,6 +8504,51 @@ class ReadBridgedActionsActionList : public ModelCommand } }; +class ReportBridgedActionsActionList : public ModelCommand +{ +public: + ReportBridgedActionsActionList() : ModelCommand("report") + { + AddArgument("attr-name", "action-list"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportBridgedActionsActionList() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0025) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::BridgedActionsCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport( + void * context, + const chip::app::DataModel::DecodableList & + value) + { + LogValue("BridgedActions.ActionList report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute EndpointList */ @@ -9041,6 +8582,51 @@ class ReadBridgedActionsEndpointList : public ModelCommand } }; +class ReportBridgedActionsEndpointList : public ModelCommand +{ +public: + ReportBridgedActionsEndpointList() : ModelCommand("report") + { + AddArgument("attr-name", "endpoint-list"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportBridgedActionsEndpointList() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0025) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::BridgedActionsCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport( + void * context, + const chip::app::DataModel::DecodableList & + value) + { + LogValue("BridgedActions.EndpointList report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute SetupUrl */ @@ -9083,13 +8669,7 @@ class ReportBridgedActionsSetupUrl : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBridgedActionsSetupUrl() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBridgedActionsSetupUrl() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -9098,10 +8678,9 @@ class ReportBridgedActionsSetupUrl : public ModelCommand chip::Controller::BridgedActionsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeSetupUrl(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeSetupUrl(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -9109,15 +8688,9 @@ class ReportBridgedActionsSetupUrl : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) { LogValue("BridgedActions.SetupUrl report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -9195,13 +8768,7 @@ class ReportBridgedActionsClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBridgedActionsClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBridgedActionsClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -9210,10 +8777,9 @@ class ReportBridgedActionsClusterRevision : public ModelCommand chip::Controller::BridgedActionsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -9221,15 +8787,9 @@ class ReportBridgedActionsClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("BridgedActions.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -9317,13 +8877,7 @@ class ReportBridgedDeviceBasicClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportBridgedDeviceBasicClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportBridgedDeviceBasicClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -9332,10 +8886,9 @@ class ReportBridgedDeviceBasicClusterRevision : public ModelCommand chip::Controller::BridgedDeviceBasicCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -9343,15 +8896,9 @@ class ReportBridgedDeviceBasicClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("BridgedDeviceBasic.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -10022,13 +9569,7 @@ class ReportColorControlCurrentHue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlCurrentHue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlCurrentHue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -10037,10 +9578,9 @@ class ReportColorControlCurrentHue : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentHue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentHue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -10048,15 +9588,9 @@ class ReportColorControlCurrentHue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ColorControl.CurrentHue report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -10104,13 +9638,7 @@ class ReportColorControlCurrentSaturation : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlCurrentSaturation() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlCurrentSaturation() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -10119,11 +9647,9 @@ class ReportColorControlCurrentSaturation : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentSaturation(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentSaturation(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -10131,15 +9657,9 @@ class ReportColorControlCurrentSaturation : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ColorControl.CurrentSaturation report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -10187,13 +9707,7 @@ class ReportColorControlRemainingTime : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlRemainingTime() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlRemainingTime() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -10202,10 +9716,9 @@ class ReportColorControlRemainingTime : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRemainingTime(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRemainingTime(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -10213,15 +9726,9 @@ class ReportColorControlRemainingTime : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.RemainingTime report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -10269,13 +9776,7 @@ class ReportColorControlCurrentX : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlCurrentX() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlCurrentX() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -10284,10 +9785,9 @@ class ReportColorControlCurrentX : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentX(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentX(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -10295,15 +9795,9 @@ class ReportColorControlCurrentX : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.CurrentX report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -10351,13 +9845,7 @@ class ReportColorControlCurrentY : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlCurrentY() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlCurrentY() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -10366,10 +9854,9 @@ class ReportColorControlCurrentY : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentY(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentY(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -10377,15 +9864,9 @@ class ReportColorControlCurrentY : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.CurrentY report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -10433,13 +9914,7 @@ class ReportColorControlDriftCompensation : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlDriftCompensation() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlDriftCompensation() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -10448,11 +9923,9 @@ class ReportColorControlDriftCompensation : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeDriftCompensation(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeDriftCompensation(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -10460,15 +9933,9 @@ class ReportColorControlDriftCompensation : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ColorControl.DriftCompensation report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -10516,13 +9983,7 @@ class ReportColorControlCompensationText : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlCompensationText() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlCompensationText() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -10531,10 +9992,9 @@ class ReportColorControlCompensationText : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCompensationText(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCompensationText(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -10542,15 +10002,9 @@ class ReportColorControlCompensationText : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) { LogValue("ColorControl.CompensationText report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -10598,13 +10052,7 @@ class ReportColorControlColorTemperature : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlColorTemperature() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlColorTemperature() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -10613,10 +10061,9 @@ class ReportColorControlColorTemperature : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeColorTemperature(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeColorTemperature(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -10624,15 +10071,9 @@ class ReportColorControlColorTemperature : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.ColorTemperature report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -10680,13 +10121,7 @@ class ReportColorControlColorMode : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlColorMode() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlColorMode() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -10695,10 +10130,9 @@ class ReportColorControlColorMode : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeColorMode(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeColorMode(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -10706,15 +10140,9 @@ class ReportColorControlColorMode : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ColorControl.ColorMode report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -10788,13 +10216,7 @@ class ReportColorControlColorControlOptions : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlColorControlOptions() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlColorControlOptions() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -10803,11 +10225,9 @@ class ReportColorControlColorControlOptions : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeColorControlOptions(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeColorControlOptions(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -10815,15 +10235,9 @@ class ReportColorControlColorControlOptions : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ColorControl.ColorControlOptions report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -10871,13 +10285,7 @@ class ReportColorControlNumberOfPrimaries : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlNumberOfPrimaries() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlNumberOfPrimaries() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -10886,11 +10294,9 @@ class ReportColorControlNumberOfPrimaries : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNumberOfPrimaries(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNumberOfPrimaries(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -10898,15 +10304,9 @@ class ReportColorControlNumberOfPrimaries : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ColorControl.NumberOfPrimaries report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -10954,13 +10354,7 @@ class ReportColorControlPrimary1X : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlPrimary1X() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlPrimary1X() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -10969,10 +10363,9 @@ class ReportColorControlPrimary1X : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePrimary1X(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePrimary1X(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -10980,15 +10373,9 @@ class ReportColorControlPrimary1X : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.Primary1X report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -11036,13 +10423,7 @@ class ReportColorControlPrimary1Y : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlPrimary1Y() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlPrimary1Y() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -11051,10 +10432,9 @@ class ReportColorControlPrimary1Y : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePrimary1Y(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePrimary1Y(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -11062,15 +10442,9 @@ class ReportColorControlPrimary1Y : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.Primary1Y report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -11118,13 +10492,7 @@ class ReportColorControlPrimary1Intensity : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlPrimary1Intensity() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlPrimary1Intensity() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -11133,11 +10501,9 @@ class ReportColorControlPrimary1Intensity : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePrimary1Intensity(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePrimary1Intensity(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -11145,15 +10511,9 @@ class ReportColorControlPrimary1Intensity : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ColorControl.Primary1Intensity report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -11201,13 +10561,7 @@ class ReportColorControlPrimary2X : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlPrimary2X() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlPrimary2X() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -11216,10 +10570,9 @@ class ReportColorControlPrimary2X : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePrimary2X(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePrimary2X(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -11227,15 +10580,9 @@ class ReportColorControlPrimary2X : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.Primary2X report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -11283,13 +10630,7 @@ class ReportColorControlPrimary2Y : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlPrimary2Y() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlPrimary2Y() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -11298,10 +10639,9 @@ class ReportColorControlPrimary2Y : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePrimary2Y(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePrimary2Y(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -11309,15 +10649,9 @@ class ReportColorControlPrimary2Y : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.Primary2Y report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -11365,13 +10699,7 @@ class ReportColorControlPrimary2Intensity : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlPrimary2Intensity() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlPrimary2Intensity() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -11380,11 +10708,9 @@ class ReportColorControlPrimary2Intensity : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePrimary2Intensity(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePrimary2Intensity(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -11392,15 +10718,9 @@ class ReportColorControlPrimary2Intensity : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ColorControl.Primary2Intensity report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -11448,13 +10768,7 @@ class ReportColorControlPrimary3X : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlPrimary3X() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlPrimary3X() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -11463,10 +10777,9 @@ class ReportColorControlPrimary3X : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePrimary3X(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePrimary3X(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -11474,15 +10787,9 @@ class ReportColorControlPrimary3X : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.Primary3X report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -11530,13 +10837,7 @@ class ReportColorControlPrimary3Y : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlPrimary3Y() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlPrimary3Y() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -11545,10 +10846,9 @@ class ReportColorControlPrimary3Y : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePrimary3Y(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePrimary3Y(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -11556,15 +10856,9 @@ class ReportColorControlPrimary3Y : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.Primary3Y report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -11612,13 +10906,7 @@ class ReportColorControlPrimary3Intensity : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlPrimary3Intensity() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlPrimary3Intensity() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -11627,11 +10915,9 @@ class ReportColorControlPrimary3Intensity : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePrimary3Intensity(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePrimary3Intensity(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -11639,15 +10925,9 @@ class ReportColorControlPrimary3Intensity : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ColorControl.Primary3Intensity report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -11695,13 +10975,7 @@ class ReportColorControlPrimary4X : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlPrimary4X() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlPrimary4X() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -11710,10 +10984,9 @@ class ReportColorControlPrimary4X : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePrimary4X(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePrimary4X(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -11721,15 +10994,9 @@ class ReportColorControlPrimary4X : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.Primary4X report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -11777,13 +11044,7 @@ class ReportColorControlPrimary4Y : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlPrimary4Y() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlPrimary4Y() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -11792,10 +11053,9 @@ class ReportColorControlPrimary4Y : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePrimary4Y(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePrimary4Y(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -11803,15 +11063,9 @@ class ReportColorControlPrimary4Y : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.Primary4Y report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -11859,13 +11113,7 @@ class ReportColorControlPrimary4Intensity : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlPrimary4Intensity() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlPrimary4Intensity() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -11874,11 +11122,9 @@ class ReportColorControlPrimary4Intensity : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePrimary4Intensity(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePrimary4Intensity(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -11886,15 +11132,9 @@ class ReportColorControlPrimary4Intensity : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ColorControl.Primary4Intensity report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -11942,13 +11182,7 @@ class ReportColorControlPrimary5X : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlPrimary5X() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlPrimary5X() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -11957,10 +11191,9 @@ class ReportColorControlPrimary5X : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePrimary5X(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePrimary5X(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -11968,15 +11201,9 @@ class ReportColorControlPrimary5X : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.Primary5X report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -12024,13 +11251,7 @@ class ReportColorControlPrimary5Y : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlPrimary5Y() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlPrimary5Y() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -12039,10 +11260,9 @@ class ReportColorControlPrimary5Y : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePrimary5Y(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePrimary5Y(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -12050,15 +11270,9 @@ class ReportColorControlPrimary5Y : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.Primary5Y report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -12106,13 +11320,7 @@ class ReportColorControlPrimary5Intensity : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlPrimary5Intensity() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlPrimary5Intensity() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -12121,11 +11329,9 @@ class ReportColorControlPrimary5Intensity : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePrimary5Intensity(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePrimary5Intensity(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -12133,15 +11339,9 @@ class ReportColorControlPrimary5Intensity : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ColorControl.Primary5Intensity report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -12189,13 +11389,7 @@ class ReportColorControlPrimary6X : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlPrimary6X() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlPrimary6X() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -12204,10 +11398,9 @@ class ReportColorControlPrimary6X : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePrimary6X(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePrimary6X(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -12215,15 +11408,9 @@ class ReportColorControlPrimary6X : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.Primary6X report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -12271,13 +11458,7 @@ class ReportColorControlPrimary6Y : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlPrimary6Y() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlPrimary6Y() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -12286,10 +11467,9 @@ class ReportColorControlPrimary6Y : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePrimary6Y(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePrimary6Y(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -12297,15 +11477,9 @@ class ReportColorControlPrimary6Y : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.Primary6Y report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -12353,13 +11527,7 @@ class ReportColorControlPrimary6Intensity : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlPrimary6Intensity() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlPrimary6Intensity() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -12368,11 +11536,9 @@ class ReportColorControlPrimary6Intensity : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePrimary6Intensity(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePrimary6Intensity(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -12380,15 +11546,9 @@ class ReportColorControlPrimary6Intensity : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ColorControl.Primary6Intensity report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -12462,13 +11622,7 @@ class ReportColorControlWhitePointX : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlWhitePointX() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlWhitePointX() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -12477,10 +11631,9 @@ class ReportColorControlWhitePointX : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeWhitePointX(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeWhitePointX(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -12488,15 +11641,9 @@ class ReportColorControlWhitePointX : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.WhitePointX report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -12570,13 +11717,7 @@ class ReportColorControlWhitePointY : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlWhitePointY() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlWhitePointY() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -12585,10 +11726,9 @@ class ReportColorControlWhitePointY : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeWhitePointY(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeWhitePointY(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -12596,15 +11736,9 @@ class ReportColorControlWhitePointY : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.WhitePointY report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -12678,13 +11812,7 @@ class ReportColorControlColorPointRX : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlColorPointRX() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlColorPointRX() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -12693,10 +11821,9 @@ class ReportColorControlColorPointRX : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeColorPointRX(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeColorPointRX(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -12704,15 +11831,9 @@ class ReportColorControlColorPointRX : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.ColorPointRX report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -12786,13 +11907,7 @@ class ReportColorControlColorPointRY : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlColorPointRY() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlColorPointRY() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -12801,10 +11916,9 @@ class ReportColorControlColorPointRY : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeColorPointRY(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeColorPointRY(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -12812,15 +11926,9 @@ class ReportColorControlColorPointRY : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.ColorPointRY report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -12894,13 +12002,7 @@ class ReportColorControlColorPointRIntensity : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlColorPointRIntensity() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlColorPointRIntensity() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -12909,11 +12011,9 @@ class ReportColorControlColorPointRIntensity : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeColorPointRIntensity(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeColorPointRIntensity(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -12921,15 +12021,9 @@ class ReportColorControlColorPointRIntensity : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ColorControl.ColorPointRIntensity report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -13003,13 +12097,7 @@ class ReportColorControlColorPointGX : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlColorPointGX() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlColorPointGX() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -13018,10 +12106,9 @@ class ReportColorControlColorPointGX : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeColorPointGX(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeColorPointGX(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -13029,15 +12116,9 @@ class ReportColorControlColorPointGX : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.ColorPointGX report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -13111,13 +12192,7 @@ class ReportColorControlColorPointGY : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlColorPointGY() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlColorPointGY() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -13126,10 +12201,9 @@ class ReportColorControlColorPointGY : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeColorPointGY(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeColorPointGY(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -13137,15 +12211,9 @@ class ReportColorControlColorPointGY : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.ColorPointGY report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -13219,13 +12287,7 @@ class ReportColorControlColorPointGIntensity : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlColorPointGIntensity() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlColorPointGIntensity() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -13234,11 +12296,9 @@ class ReportColorControlColorPointGIntensity : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeColorPointGIntensity(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeColorPointGIntensity(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -13246,15 +12306,9 @@ class ReportColorControlColorPointGIntensity : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ColorControl.ColorPointGIntensity report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -13328,13 +12382,7 @@ class ReportColorControlColorPointBX : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlColorPointBX() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlColorPointBX() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -13343,10 +12391,9 @@ class ReportColorControlColorPointBX : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeColorPointBX(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeColorPointBX(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -13354,15 +12401,9 @@ class ReportColorControlColorPointBX : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.ColorPointBX report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -13436,13 +12477,7 @@ class ReportColorControlColorPointBY : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlColorPointBY() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlColorPointBY() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -13451,10 +12486,9 @@ class ReportColorControlColorPointBY : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeColorPointBY(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeColorPointBY(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -13462,15 +12496,9 @@ class ReportColorControlColorPointBY : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.ColorPointBY report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -13544,13 +12572,7 @@ class ReportColorControlColorPointBIntensity : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlColorPointBIntensity() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlColorPointBIntensity() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -13559,11 +12581,9 @@ class ReportColorControlColorPointBIntensity : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeColorPointBIntensity(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeColorPointBIntensity(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -13571,15 +12591,9 @@ class ReportColorControlColorPointBIntensity : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ColorControl.ColorPointBIntensity report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -13627,13 +12641,7 @@ class ReportColorControlEnhancedCurrentHue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlEnhancedCurrentHue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlEnhancedCurrentHue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -13642,11 +12650,9 @@ class ReportColorControlEnhancedCurrentHue : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeEnhancedCurrentHue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeEnhancedCurrentHue(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -13654,15 +12660,9 @@ class ReportColorControlEnhancedCurrentHue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.EnhancedCurrentHue report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -13710,13 +12710,7 @@ class ReportColorControlEnhancedColorMode : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlEnhancedColorMode() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlEnhancedColorMode() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -13725,11 +12719,9 @@ class ReportColorControlEnhancedColorMode : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeEnhancedColorMode(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeEnhancedColorMode(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -13737,15 +12729,9 @@ class ReportColorControlEnhancedColorMode : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ColorControl.EnhancedColorMode report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -13793,13 +12779,7 @@ class ReportColorControlColorLoopActive : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlColorLoopActive() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlColorLoopActive() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -13808,10 +12788,9 @@ class ReportColorControlColorLoopActive : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeColorLoopActive(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeColorLoopActive(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -13819,15 +12798,9 @@ class ReportColorControlColorLoopActive : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ColorControl.ColorLoopActive report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -13875,13 +12848,7 @@ class ReportColorControlColorLoopDirection : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlColorLoopDirection() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlColorLoopDirection() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -13890,11 +12857,9 @@ class ReportColorControlColorLoopDirection : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeColorLoopDirection(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeColorLoopDirection(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -13902,15 +12867,9 @@ class ReportColorControlColorLoopDirection : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ColorControl.ColorLoopDirection report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -13958,13 +12917,7 @@ class ReportColorControlColorLoopTime : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlColorLoopTime() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlColorLoopTime() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -13973,10 +12926,9 @@ class ReportColorControlColorLoopTime : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeColorLoopTime(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeColorLoopTime(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -13984,15 +12936,9 @@ class ReportColorControlColorLoopTime : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.ColorLoopTime report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -14040,13 +12986,7 @@ class ReportColorControlColorLoopStartEnhancedHue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlColorLoopStartEnhancedHue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlColorLoopStartEnhancedHue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -14055,11 +12995,9 @@ class ReportColorControlColorLoopStartEnhancedHue : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeColorLoopStartEnhancedHue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeColorLoopStartEnhancedHue(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -14067,15 +13005,12 @@ class ReportColorControlColorLoopStartEnhancedHue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("ColorControl.ColorLoopStartEnhancedHue report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -14123,13 +13058,7 @@ class ReportColorControlColorLoopStoredEnhancedHue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlColorLoopStoredEnhancedHue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlColorLoopStoredEnhancedHue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -14138,11 +13067,9 @@ class ReportColorControlColorLoopStoredEnhancedHue : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeColorLoopStoredEnhancedHue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeColorLoopStoredEnhancedHue(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -14150,15 +13077,12 @@ class ReportColorControlColorLoopStoredEnhancedHue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("ColorControl.ColorLoopStoredEnhancedHue report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -14206,13 +13130,7 @@ class ReportColorControlColorCapabilities : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlColorCapabilities() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlColorCapabilities() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -14221,11 +13139,9 @@ class ReportColorControlColorCapabilities : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeColorCapabilities(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeColorCapabilities(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -14233,15 +13149,9 @@ class ReportColorControlColorCapabilities : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.ColorCapabilities report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -14289,13 +13199,7 @@ class ReportColorControlColorTempPhysicalMin : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlColorTempPhysicalMin() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlColorTempPhysicalMin() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -14304,11 +13208,9 @@ class ReportColorControlColorTempPhysicalMin : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeColorTempPhysicalMin(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeColorTempPhysicalMin(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -14316,15 +13218,9 @@ class ReportColorControlColorTempPhysicalMin : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.ColorTempPhysicalMin report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -14372,13 +13268,7 @@ class ReportColorControlColorTempPhysicalMax : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlColorTempPhysicalMax() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlColorTempPhysicalMax() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -14387,11 +13277,9 @@ class ReportColorControlColorTempPhysicalMax : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeColorTempPhysicalMax(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeColorTempPhysicalMax(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -14399,15 +13287,9 @@ class ReportColorControlColorTempPhysicalMax : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.ColorTempPhysicalMax report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -14455,13 +13337,7 @@ class ReportColorControlCoupleColorTempToLevelMinMireds : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlCoupleColorTempToLevelMinMireds() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlCoupleColorTempToLevelMinMireds() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -14470,11 +13346,9 @@ class ReportColorControlCoupleColorTempToLevelMinMireds : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCoupleColorTempToLevelMinMireds(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCoupleColorTempToLevelMinMireds(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -14482,15 +13356,12 @@ class ReportColorControlCoupleColorTempToLevelMinMireds : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("ColorControl.CoupleColorTempToLevelMinMireds report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -14564,13 +13435,7 @@ class ReportColorControlStartUpColorTemperatureMireds : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlStartUpColorTemperatureMireds() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlStartUpColorTemperatureMireds() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -14579,11 +13444,9 @@ class ReportColorControlStartUpColorTemperatureMireds : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeStartUpColorTemperatureMireds(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeStartUpColorTemperatureMireds(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -14591,15 +13454,12 @@ class ReportColorControlStartUpColorTemperatureMireds : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("ColorControl.StartUpColorTemperatureMireds report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -14677,13 +13537,7 @@ class ReportColorControlClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportColorControlClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportColorControlClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -14692,10 +13546,9 @@ class ReportColorControlClusterRevision : public ModelCommand chip::Controller::ColorControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -14703,15 +13556,9 @@ class ReportColorControlClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ColorControl.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -14811,6 +13658,48 @@ class ReadContentLauncherAcceptsHeaderList : public ModelCommand } }; +class ReportContentLauncherAcceptsHeaderList : public ModelCommand +{ +public: + ReportContentLauncherAcceptsHeaderList() : ModelCommand("report") + { + AddArgument("attr-name", "accepts-header-list"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportContentLauncherAcceptsHeaderList() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050A) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::ContentLauncherCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, const chip::app::DataModel::DecodableList & value) + { + LogValue("ContentLauncher.AcceptsHeaderList report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute SupportedStreamingTypes */ @@ -14843,6 +13732,50 @@ class ReadContentLauncherSupportedStreamingTypes : public ModelCommand } }; +class ReportContentLauncherSupportedStreamingTypes : public ModelCommand +{ +public: + ReportContentLauncherSupportedStreamingTypes() : ModelCommand("report") + { + AddArgument("attr-name", "supported-streaming-types"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportContentLauncherSupportedStreamingTypes() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050A) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::ContentLauncherCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport( + void * context, + const chip::app::DataModel::DecodableList & value) + { + LogValue("ContentLauncher.SupportedStreamingTypes report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute AttributeList */ @@ -14915,13 +13848,7 @@ class ReportContentLauncherClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportContentLauncherClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportContentLauncherClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -14930,10 +13857,9 @@ class ReportContentLauncherClusterRevision : public ModelCommand chip::Controller::ContentLauncherCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -14941,15 +13867,9 @@ class ReportContentLauncherClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ContentLauncher.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -15001,6 +13921,50 @@ class ReadDescriptorDeviceList : public ModelCommand } }; +class ReportDescriptorDeviceList : public ModelCommand +{ +public: + ReportDescriptorDeviceList() : ModelCommand("report") + { + AddArgument("attr-name", "device-list"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportDescriptorDeviceList() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x001D) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::DescriptorCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport( + void * context, + const chip::app::DataModel::DecodableList & value) + { + LogValue("Descriptor.DeviceList report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute ServerList */ @@ -15031,6 +13995,48 @@ class ReadDescriptorServerList : public ModelCommand } }; +class ReportDescriptorServerList : public ModelCommand +{ +public: + ReportDescriptorServerList() : ModelCommand("report") + { + AddArgument("attr-name", "server-list"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportDescriptorServerList() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x001D) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::DescriptorCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, const chip::app::DataModel::DecodableList & value) + { + LogValue("Descriptor.ServerList report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute ClientList */ @@ -15061,6 +14067,48 @@ class ReadDescriptorClientList : public ModelCommand } }; +class ReportDescriptorClientList : public ModelCommand +{ +public: + ReportDescriptorClientList() : ModelCommand("report") + { + AddArgument("attr-name", "client-list"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportDescriptorClientList() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x001D) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::DescriptorCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, const chip::app::DataModel::DecodableList & value) + { + LogValue("Descriptor.ClientList report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute PartsList */ @@ -15091,6 +14139,48 @@ class ReadDescriptorPartsList : public ModelCommand } }; +class ReportDescriptorPartsList : public ModelCommand +{ +public: + ReportDescriptorPartsList() : ModelCommand("report") + { + AddArgument("attr-name", "parts-list"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportDescriptorPartsList() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x001D) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::DescriptorCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, const chip::app::DataModel::DecodableList & value) + { + LogValue("Descriptor.PartsList report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute AttributeList */ @@ -15163,13 +14253,7 @@ class ReportDescriptorClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportDescriptorClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportDescriptorClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -15178,10 +14262,9 @@ class ReportDescriptorClusterRevision : public ModelCommand chip::Controller::DescriptorCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -15189,15 +14272,9 @@ class ReportDescriptorClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("Descriptor.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -15925,13 +15002,7 @@ class ReportDoorLockLockState : public ModelCommand ModelCommand::AddArguments(); } - ~ReportDoorLockLockState() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportDoorLockLockState() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -15940,10 +15011,9 @@ class ReportDoorLockLockState : public ModelCommand chip::Controller::DoorLockCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeLockState(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeLockState(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -15951,15 +15021,13 @@ class ReportDoorLockLockState : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, + const chip::app::DataModel::Nullable & value) + { + LogValue("DoorLock.LockState report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -16007,13 +15075,7 @@ class ReportDoorLockLockType : public ModelCommand ModelCommand::AddArguments(); } - ~ReportDoorLockLockType() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportDoorLockLockType() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -16022,10 +15084,9 @@ class ReportDoorLockLockType : public ModelCommand chip::Controller::DoorLockCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeLockType(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeLockType(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -16033,15 +15094,12 @@ class ReportDoorLockLockType : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::app::Clusters::DoorLock::DlLockType value) + { + LogValue("DoorLock.LockType report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -16089,13 +15147,7 @@ class ReportDoorLockActuatorEnabled : public ModelCommand ModelCommand::AddArguments(); } - ~ReportDoorLockActuatorEnabled() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportDoorLockActuatorEnabled() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -16104,10 +15156,9 @@ class ReportDoorLockActuatorEnabled : public ModelCommand chip::Controller::DoorLockCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeActuatorEnabled(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeActuatorEnabled(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -16115,15 +15166,9 @@ class ReportDoorLockActuatorEnabled : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, bool value) { LogValue("DoorLock.ActuatorEnabled report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnBooleanAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -16201,13 +15246,7 @@ class ReportDoorLockClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportDoorLockClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportDoorLockClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -16216,10 +15255,9 @@ class ReportDoorLockClusterRevision : public ModelCommand chip::Controller::DoorLockCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -16227,15 +15265,9 @@ class ReportDoorLockClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("DoorLock.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -16304,13 +15336,7 @@ class ReportElectricalMeasurementMeasurementType : public ModelCommand ModelCommand::AddArguments(); } - ~ReportElectricalMeasurementMeasurementType() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportElectricalMeasurementMeasurementType() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -16319,10 +15345,9 @@ class ReportElectricalMeasurementMeasurementType : public ModelCommand chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMeasurementType(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMeasurementType(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -16330,15 +15355,12 @@ class ReportElectricalMeasurementMeasurementType : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ElectricalMeasurement.MeasurementType report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -16386,13 +15408,7 @@ class ReportElectricalMeasurementTotalActivePower : public ModelCommand ModelCommand::AddArguments(); } - ~ReportElectricalMeasurementTotalActivePower() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportElectricalMeasurementTotalActivePower() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -16401,10 +15417,9 @@ class ReportElectricalMeasurementTotalActivePower : public ModelCommand chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTotalActivePower(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTotalActivePower(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -16412,15 +15427,12 @@ class ReportElectricalMeasurementTotalActivePower : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int32_t value) + { + LogValue("ElectricalMeasurement.TotalActivePower report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -16468,13 +15480,7 @@ class ReportElectricalMeasurementRmsVoltage : public ModelCommand ModelCommand::AddArguments(); } - ~ReportElectricalMeasurementRmsVoltage() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportElectricalMeasurementRmsVoltage() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -16483,10 +15489,9 @@ class ReportElectricalMeasurementRmsVoltage : public ModelCommand chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRmsVoltage(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRmsVoltage(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -16494,15 +15499,9 @@ class ReportElectricalMeasurementRmsVoltage : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ElectricalMeasurement.RmsVoltage report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -16550,13 +15549,7 @@ class ReportElectricalMeasurementRmsVoltageMin : public ModelCommand ModelCommand::AddArguments(); } - ~ReportElectricalMeasurementRmsVoltageMin() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportElectricalMeasurementRmsVoltageMin() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -16565,10 +15558,9 @@ class ReportElectricalMeasurementRmsVoltageMin : public ModelCommand chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRmsVoltageMin(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRmsVoltageMin(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -16576,15 +15568,9 @@ class ReportElectricalMeasurementRmsVoltageMin : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ElectricalMeasurement.RmsVoltageMin report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -16632,13 +15618,7 @@ class ReportElectricalMeasurementRmsVoltageMax : public ModelCommand ModelCommand::AddArguments(); } - ~ReportElectricalMeasurementRmsVoltageMax() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportElectricalMeasurementRmsVoltageMax() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -16647,10 +15627,9 @@ class ReportElectricalMeasurementRmsVoltageMax : public ModelCommand chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRmsVoltageMax(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRmsVoltageMax(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -16658,15 +15637,9 @@ class ReportElectricalMeasurementRmsVoltageMax : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ElectricalMeasurement.RmsVoltageMax report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -16714,13 +15687,7 @@ class ReportElectricalMeasurementRmsCurrent : public ModelCommand ModelCommand::AddArguments(); } - ~ReportElectricalMeasurementRmsCurrent() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportElectricalMeasurementRmsCurrent() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -16729,10 +15696,9 @@ class ReportElectricalMeasurementRmsCurrent : public ModelCommand chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRmsCurrent(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRmsCurrent(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -16740,15 +15706,9 @@ class ReportElectricalMeasurementRmsCurrent : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ElectricalMeasurement.RmsCurrent report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -16796,13 +15756,7 @@ class ReportElectricalMeasurementRmsCurrentMin : public ModelCommand ModelCommand::AddArguments(); } - ~ReportElectricalMeasurementRmsCurrentMin() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportElectricalMeasurementRmsCurrentMin() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -16811,10 +15765,9 @@ class ReportElectricalMeasurementRmsCurrentMin : public ModelCommand chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRmsCurrentMin(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRmsCurrentMin(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -16822,15 +15775,9 @@ class ReportElectricalMeasurementRmsCurrentMin : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ElectricalMeasurement.RmsCurrentMin report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -16878,13 +15825,7 @@ class ReportElectricalMeasurementRmsCurrentMax : public ModelCommand ModelCommand::AddArguments(); } - ~ReportElectricalMeasurementRmsCurrentMax() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportElectricalMeasurementRmsCurrentMax() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -16893,10 +15834,9 @@ class ReportElectricalMeasurementRmsCurrentMax : public ModelCommand chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRmsCurrentMax(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRmsCurrentMax(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -16904,15 +15844,9 @@ class ReportElectricalMeasurementRmsCurrentMax : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ElectricalMeasurement.RmsCurrentMax report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -16960,13 +15894,7 @@ class ReportElectricalMeasurementActivePower : public ModelCommand ModelCommand::AddArguments(); } - ~ReportElectricalMeasurementActivePower() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportElectricalMeasurementActivePower() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -16975,10 +15903,9 @@ class ReportElectricalMeasurementActivePower : public ModelCommand chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeActivePower(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeActivePower(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -16986,15 +15913,9 @@ class ReportElectricalMeasurementActivePower : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("ElectricalMeasurement.ActivePower report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -17042,13 +15963,7 @@ class ReportElectricalMeasurementActivePowerMin : public ModelCommand ModelCommand::AddArguments(); } - ~ReportElectricalMeasurementActivePowerMin() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportElectricalMeasurementActivePowerMin() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -17057,10 +15972,9 @@ class ReportElectricalMeasurementActivePowerMin : public ModelCommand chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeActivePowerMin(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeActivePowerMin(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -17068,15 +15982,9 @@ class ReportElectricalMeasurementActivePowerMin : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("ElectricalMeasurement.ActivePowerMin report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -17124,13 +16032,7 @@ class ReportElectricalMeasurementActivePowerMax : public ModelCommand ModelCommand::AddArguments(); } - ~ReportElectricalMeasurementActivePowerMax() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportElectricalMeasurementActivePowerMax() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -17139,10 +16041,9 @@ class ReportElectricalMeasurementActivePowerMax : public ModelCommand chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeActivePowerMax(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeActivePowerMax(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -17150,15 +16051,9 @@ class ReportElectricalMeasurementActivePowerMax : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("ElectricalMeasurement.ActivePowerMax report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -17236,13 +16131,7 @@ class ReportElectricalMeasurementClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportElectricalMeasurementClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportElectricalMeasurementClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -17251,10 +16140,9 @@ class ReportElectricalMeasurementClusterRevision : public ModelCommand chip::Controller::ElectricalMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -17262,15 +16150,12 @@ class ReportElectricalMeasurementClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("ElectricalMeasurement.ClusterRevision report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -17359,13 +16244,7 @@ class ReportEthernetNetworkDiagnosticsPHYRate : public ModelCommand ModelCommand::AddArguments(); } - ~ReportEthernetNetworkDiagnosticsPHYRate() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportEthernetNetworkDiagnosticsPHYRate() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -17374,10 +16253,9 @@ class ReportEthernetNetworkDiagnosticsPHYRate : public ModelCommand chip::Controller::EthernetNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePHYRate(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePHYRate(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -17385,15 +16263,9 @@ class ReportEthernetNetworkDiagnosticsPHYRate : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("EthernetNetworkDiagnostics.PHYRate report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -17441,13 +16313,7 @@ class ReportEthernetNetworkDiagnosticsFullDuplex : public ModelCommand ModelCommand::AddArguments(); } - ~ReportEthernetNetworkDiagnosticsFullDuplex() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportEthernetNetworkDiagnosticsFullDuplex() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -17456,10 +16322,9 @@ class ReportEthernetNetworkDiagnosticsFullDuplex : public ModelCommand chip::Controller::EthernetNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeFullDuplex(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeFullDuplex(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -17467,15 +16332,9 @@ class ReportEthernetNetworkDiagnosticsFullDuplex : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, bool value) { LogValue("EthernetNetworkDiagnostics.FullDuplex report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnBooleanAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -17523,13 +16382,7 @@ class ReportEthernetNetworkDiagnosticsPacketRxCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportEthernetNetworkDiagnosticsPacketRxCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportEthernetNetworkDiagnosticsPacketRxCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -17538,10 +16391,9 @@ class ReportEthernetNetworkDiagnosticsPacketRxCount : public ModelCommand chip::Controller::EthernetNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePacketRxCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePacketRxCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -17549,15 +16401,12 @@ class ReportEthernetNetworkDiagnosticsPacketRxCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) + { + LogValue("EthernetNetworkDiagnostics.PacketRxCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -17605,13 +16454,7 @@ class ReportEthernetNetworkDiagnosticsPacketTxCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportEthernetNetworkDiagnosticsPacketTxCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportEthernetNetworkDiagnosticsPacketTxCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -17620,10 +16463,9 @@ class ReportEthernetNetworkDiagnosticsPacketTxCount : public ModelCommand chip::Controller::EthernetNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePacketTxCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePacketTxCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -17631,15 +16473,12 @@ class ReportEthernetNetworkDiagnosticsPacketTxCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) + { + LogValue("EthernetNetworkDiagnostics.PacketTxCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -17687,13 +16526,7 @@ class ReportEthernetNetworkDiagnosticsTxErrCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportEthernetNetworkDiagnosticsTxErrCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportEthernetNetworkDiagnosticsTxErrCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -17702,10 +16535,9 @@ class ReportEthernetNetworkDiagnosticsTxErrCount : public ModelCommand chip::Controller::EthernetNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTxErrCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTxErrCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -17713,15 +16545,12 @@ class ReportEthernetNetworkDiagnosticsTxErrCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) + { + LogValue("EthernetNetworkDiagnostics.TxErrCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -17769,13 +16598,7 @@ class ReportEthernetNetworkDiagnosticsCollisionCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportEthernetNetworkDiagnosticsCollisionCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportEthernetNetworkDiagnosticsCollisionCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -17784,10 +16607,9 @@ class ReportEthernetNetworkDiagnosticsCollisionCount : public ModelCommand chip::Controller::EthernetNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCollisionCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCollisionCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -17795,15 +16617,12 @@ class ReportEthernetNetworkDiagnosticsCollisionCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) + { + LogValue("EthernetNetworkDiagnostics.CollisionCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -17851,13 +16670,7 @@ class ReportEthernetNetworkDiagnosticsOverrunCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportEthernetNetworkDiagnosticsOverrunCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportEthernetNetworkDiagnosticsOverrunCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -17866,10 +16679,9 @@ class ReportEthernetNetworkDiagnosticsOverrunCount : public ModelCommand chip::Controller::EthernetNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOverrunCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOverrunCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -17877,15 +16689,12 @@ class ReportEthernetNetworkDiagnosticsOverrunCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) + { + LogValue("EthernetNetworkDiagnostics.OverrunCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -17933,13 +16742,7 @@ class ReportEthernetNetworkDiagnosticsCarrierDetect : public ModelCommand ModelCommand::AddArguments(); } - ~ReportEthernetNetworkDiagnosticsCarrierDetect() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportEthernetNetworkDiagnosticsCarrierDetect() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -17948,10 +16751,9 @@ class ReportEthernetNetworkDiagnosticsCarrierDetect : public ModelCommand chip::Controller::EthernetNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCarrierDetect(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCarrierDetect(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -17959,15 +16761,9 @@ class ReportEthernetNetworkDiagnosticsCarrierDetect : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, bool value) { LogValue("EthernetNetworkDiagnostics.CarrierDetect report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnBooleanAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -18015,13 +16811,7 @@ class ReportEthernetNetworkDiagnosticsTimeSinceReset : public ModelCommand ModelCommand::AddArguments(); } - ~ReportEthernetNetworkDiagnosticsTimeSinceReset() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportEthernetNetworkDiagnosticsTimeSinceReset() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -18030,10 +16820,9 @@ class ReportEthernetNetworkDiagnosticsTimeSinceReset : public ModelCommand chip::Controller::EthernetNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTimeSinceReset(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTimeSinceReset(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -18041,15 +16830,12 @@ class ReportEthernetNetworkDiagnosticsTimeSinceReset : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) + { + LogValue("EthernetNetworkDiagnostics.TimeSinceReset report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -18157,13 +16943,7 @@ class ReportEthernetNetworkDiagnosticsClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportEthernetNetworkDiagnosticsClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportEthernetNetworkDiagnosticsClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -18172,10 +16952,9 @@ class ReportEthernetNetworkDiagnosticsClusterRevision : public ModelCommand chip::Controller::EthernetNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -18183,15 +16962,12 @@ class ReportEthernetNetworkDiagnosticsClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("EthernetNetworkDiagnostics.ClusterRevision report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -18240,6 +17016,50 @@ class ReadFixedLabelLabelList : public ModelCommand } }; +class ReportFixedLabelLabelList : public ModelCommand +{ +public: + ReportFixedLabelLabelList() : ModelCommand("report") + { + AddArgument("attr-name", "label-list"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportFixedLabelLabelList() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0040) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::FixedLabelCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport( + void * context, + const chip::app::DataModel::DecodableList & value) + { + LogValue("FixedLabel.LabelList report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute AttributeList */ @@ -18312,13 +17132,7 @@ class ReportFixedLabelClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportFixedLabelClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportFixedLabelClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -18327,10 +17141,9 @@ class ReportFixedLabelClusterRevision : public ModelCommand chip::Controller::FixedLabelCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -18338,15 +17151,9 @@ class ReportFixedLabelClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("FixedLabel.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -18408,13 +17215,7 @@ class ReportFlowMeasurementMeasuredValue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportFlowMeasurementMeasuredValue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportFlowMeasurementMeasuredValue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -18423,10 +17224,9 @@ class ReportFlowMeasurementMeasuredValue : public ModelCommand chip::Controller::FlowMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMeasuredValue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMeasuredValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -18434,15 +17234,9 @@ class ReportFlowMeasurementMeasuredValue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("FlowMeasurement.MeasuredValue report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -18490,13 +17284,7 @@ class ReportFlowMeasurementMinMeasuredValue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportFlowMeasurementMinMeasuredValue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportFlowMeasurementMinMeasuredValue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -18505,10 +17293,9 @@ class ReportFlowMeasurementMinMeasuredValue : public ModelCommand chip::Controller::FlowMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMinMeasuredValue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMinMeasuredValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -18516,15 +17303,9 @@ class ReportFlowMeasurementMinMeasuredValue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("FlowMeasurement.MinMeasuredValue report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -18572,13 +17353,7 @@ class ReportFlowMeasurementMaxMeasuredValue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportFlowMeasurementMaxMeasuredValue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportFlowMeasurementMaxMeasuredValue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -18587,10 +17362,9 @@ class ReportFlowMeasurementMaxMeasuredValue : public ModelCommand chip::Controller::FlowMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMaxMeasuredValue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMaxMeasuredValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -18598,15 +17372,9 @@ class ReportFlowMeasurementMaxMeasuredValue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("FlowMeasurement.MaxMeasuredValue report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -18654,13 +17422,7 @@ class ReportFlowMeasurementTolerance : public ModelCommand ModelCommand::AddArguments(); } - ~ReportFlowMeasurementTolerance() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportFlowMeasurementTolerance() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -18669,10 +17431,9 @@ class ReportFlowMeasurementTolerance : public ModelCommand chip::Controller::FlowMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTolerance(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTolerance(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -18680,15 +17441,9 @@ class ReportFlowMeasurementTolerance : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("FlowMeasurement.Tolerance report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -18766,13 +17521,7 @@ class ReportFlowMeasurementClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportFlowMeasurementClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportFlowMeasurementClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -18781,10 +17530,9 @@ class ReportFlowMeasurementClusterRevision : public ModelCommand chip::Controller::FlowMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -18792,15 +17540,9 @@ class ReportFlowMeasurementClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("FlowMeasurement.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -18965,13 +17707,7 @@ class ReportGeneralCommissioningBreadcrumb : public ModelCommand ModelCommand::AddArguments(); } - ~ReportGeneralCommissioningBreadcrumb() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportGeneralCommissioningBreadcrumb() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -18980,10 +17716,9 @@ class ReportGeneralCommissioningBreadcrumb : public ModelCommand chip::Controller::GeneralCommissioningCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeBreadcrumb(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeBreadcrumb(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -18991,15 +17726,9 @@ class ReportGeneralCommissioningBreadcrumb : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) { LogValue("GeneralCommissioning.Breadcrumb report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -19038,6 +17767,52 @@ class ReadGeneralCommissioningBasicCommissioningInfoList : public ModelCommand } }; +class ReportGeneralCommissioningBasicCommissioningInfoList : public ModelCommand +{ +public: + ReportGeneralCommissioningBasicCommissioningInfoList() : ModelCommand("report") + { + AddArgument("attr-name", "basic-commissioning-info-list"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportGeneralCommissioningBasicCommissioningInfoList() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0030) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::GeneralCommissioningCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void + OnValueReport(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::GeneralCommissioning::Structs::BasicCommissioningInfoType::DecodableType> & value) + { + LogValue("GeneralCommissioning.BasicCommissioningInfoList report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute RegulatoryConfig */ @@ -19170,13 +17945,7 @@ class ReportGeneralCommissioningClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportGeneralCommissioningClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportGeneralCommissioningClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -19185,10 +17954,9 @@ class ReportGeneralCommissioningClusterRevision : public ModelCommand chip::Controller::GeneralCommissioningCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -19196,15 +17964,9 @@ class ReportGeneralCommissioningClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("GeneralCommissioning.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -19261,6 +18023,50 @@ class ReadGeneralDiagnosticsNetworkInterfaces : public ModelCommand } }; +class ReportGeneralDiagnosticsNetworkInterfaces : public ModelCommand +{ +public: + ReportGeneralDiagnosticsNetworkInterfaces() : ModelCommand("report") + { + AddArgument("attr-name", "network-interfaces"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportGeneralDiagnosticsNetworkInterfaces() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0033) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::GeneralDiagnosticsCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::GeneralDiagnostics::Structs::NetworkInterfaceType::DecodableType> & value) + { + LogValue("GeneralDiagnostics.NetworkInterfaces report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute RebootCount */ @@ -19303,13 +18109,7 @@ class ReportGeneralDiagnosticsRebootCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportGeneralDiagnosticsRebootCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportGeneralDiagnosticsRebootCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -19318,10 +18118,9 @@ class ReportGeneralDiagnosticsRebootCount : public ModelCommand chip::Controller::GeneralDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRebootCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRebootCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -19329,15 +18128,9 @@ class ReportGeneralDiagnosticsRebootCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("GeneralDiagnostics.RebootCount report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -19385,13 +18178,7 @@ class ReportGeneralDiagnosticsUpTime : public ModelCommand ModelCommand::AddArguments(); } - ~ReportGeneralDiagnosticsUpTime() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportGeneralDiagnosticsUpTime() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -19400,10 +18187,9 @@ class ReportGeneralDiagnosticsUpTime : public ModelCommand chip::Controller::GeneralDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeUpTime(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeUpTime(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -19411,15 +18197,9 @@ class ReportGeneralDiagnosticsUpTime : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) { LogValue("GeneralDiagnostics.UpTime report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -19467,13 +18247,7 @@ class ReportGeneralDiagnosticsTotalOperationalHours : public ModelCommand ModelCommand::AddArguments(); } - ~ReportGeneralDiagnosticsTotalOperationalHours() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportGeneralDiagnosticsTotalOperationalHours() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -19482,11 +18256,9 @@ class ReportGeneralDiagnosticsTotalOperationalHours : public ModelCommand chip::Controller::GeneralDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTotalOperationalHours(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTotalOperationalHours(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -19494,15 +18266,12 @@ class ReportGeneralDiagnosticsTotalOperationalHours : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("GeneralDiagnostics.TotalOperationalHours report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -19550,13 +18319,7 @@ class ReportGeneralDiagnosticsBootReasons : public ModelCommand ModelCommand::AddArguments(); } - ~ReportGeneralDiagnosticsBootReasons() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportGeneralDiagnosticsBootReasons() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -19565,10 +18328,9 @@ class ReportGeneralDiagnosticsBootReasons : public ModelCommand chip::Controller::GeneralDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeBootReasons(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeBootReasons(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -19576,15 +18338,9 @@ class ReportGeneralDiagnosticsBootReasons : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("GeneralDiagnostics.BootReasons report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -19620,6 +18376,48 @@ class ReadGeneralDiagnosticsActiveHardwareFaults : public ModelCommand } }; +class ReportGeneralDiagnosticsActiveHardwareFaults : public ModelCommand +{ +public: + ReportGeneralDiagnosticsActiveHardwareFaults() : ModelCommand("report") + { + AddArgument("attr-name", "active-hardware-faults"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportGeneralDiagnosticsActiveHardwareFaults() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0033) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::GeneralDiagnosticsCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, const chip::app::DataModel::DecodableList & value) + { + LogValue("GeneralDiagnostics.ActiveHardwareFaults report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute ActiveRadioFaults */ @@ -19650,6 +18448,48 @@ class ReadGeneralDiagnosticsActiveRadioFaults : public ModelCommand } }; +class ReportGeneralDiagnosticsActiveRadioFaults : public ModelCommand +{ +public: + ReportGeneralDiagnosticsActiveRadioFaults() : ModelCommand("report") + { + AddArgument("attr-name", "active-radio-faults"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportGeneralDiagnosticsActiveRadioFaults() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0033) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::GeneralDiagnosticsCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, const chip::app::DataModel::DecodableList & value) + { + LogValue("GeneralDiagnostics.ActiveRadioFaults report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute ActiveNetworkFaults */ @@ -19680,6 +18520,48 @@ class ReadGeneralDiagnosticsActiveNetworkFaults : public ModelCommand } }; +class ReportGeneralDiagnosticsActiveNetworkFaults : public ModelCommand +{ +public: + ReportGeneralDiagnosticsActiveNetworkFaults() : ModelCommand("report") + { + AddArgument("attr-name", "active-network-faults"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportGeneralDiagnosticsActiveNetworkFaults() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0033) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::GeneralDiagnosticsCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, const chip::app::DataModel::DecodableList & value) + { + LogValue("GeneralDiagnostics.ActiveNetworkFaults report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute AttributeList */ @@ -19752,13 +18634,7 @@ class ReportGeneralDiagnosticsClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportGeneralDiagnosticsClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportGeneralDiagnosticsClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -19767,10 +18643,9 @@ class ReportGeneralDiagnosticsClusterRevision : public ModelCommand chip::Controller::GeneralDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -19778,15 +18653,9 @@ class ReportGeneralDiagnosticsClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("GeneralDiagnostics.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -19837,6 +18706,51 @@ class ReadGroupKeyManagementGroups : public ModelCommand } }; +class ReportGroupKeyManagementGroups : public ModelCommand +{ +public: + ReportGroupKeyManagementGroups() : ModelCommand("report") + { + AddArgument("attr-name", "groups"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportGroupKeyManagementGroups() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x003F) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::GroupKeyManagementCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport( + void * context, + const chip::app::DataModel::DecodableList & + value) + { + LogValue("GroupKeyManagement.Groups report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute GroupKeys */ @@ -19870,6 +18784,51 @@ class ReadGroupKeyManagementGroupKeys : public ModelCommand } }; +class ReportGroupKeyManagementGroupKeys : public ModelCommand +{ +public: + ReportGroupKeyManagementGroupKeys() : ModelCommand("report") + { + AddArgument("attr-name", "group-keys"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportGroupKeyManagementGroupKeys() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x003F) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::GroupKeyManagementCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport( + void * context, + const chip::app::DataModel::DecodableList & + value) + { + LogValue("GroupKeyManagement.GroupKeys report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute AttributeList */ @@ -19942,13 +18901,7 @@ class ReportGroupKeyManagementClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportGroupKeyManagementClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportGroupKeyManagementClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -19957,10 +18910,9 @@ class ReportGroupKeyManagementClusterRevision : public ModelCommand chip::Controller::GroupKeyManagementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -19968,15 +18920,9 @@ class ReportGroupKeyManagementClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("GroupKeyManagement.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -20183,13 +19129,7 @@ class ReportGroupsNameSupport : public ModelCommand ModelCommand::AddArguments(); } - ~ReportGroupsNameSupport() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportGroupsNameSupport() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -20198,10 +19138,9 @@ class ReportGroupsNameSupport : public ModelCommand chip::Controller::GroupsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNameSupport(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNameSupport(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -20209,15 +19148,9 @@ class ReportGroupsNameSupport : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("Groups.NameSupport report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -20295,13 +19228,7 @@ class ReportGroupsClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportGroupsClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportGroupsClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -20310,10 +19237,9 @@ class ReportGroupsClusterRevision : public ModelCommand chip::Controller::GroupsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -20321,15 +19247,9 @@ class ReportGroupsClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("Groups.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -20489,13 +19409,7 @@ class ReportIdentifyIdentifyTime : public ModelCommand ModelCommand::AddArguments(); } - ~ReportIdentifyIdentifyTime() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportIdentifyIdentifyTime() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -20504,10 +19418,9 @@ class ReportIdentifyIdentifyTime : public ModelCommand chip::Controller::IdentifyCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeIdentifyTime(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeIdentifyTime(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -20515,15 +19428,9 @@ class ReportIdentifyIdentifyTime : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("Identify.IdentifyTime report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -20571,13 +19478,7 @@ class ReportIdentifyIdentifyType : public ModelCommand ModelCommand::AddArguments(); } - ~ReportIdentifyIdentifyType() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportIdentifyIdentifyType() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -20586,10 +19487,9 @@ class ReportIdentifyIdentifyType : public ModelCommand chip::Controller::IdentifyCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeIdentifyType(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeIdentifyType(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -20597,15 +19497,9 @@ class ReportIdentifyIdentifyType : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("Identify.IdentifyType report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -20683,13 +19577,7 @@ class ReportIdentifyClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportIdentifyClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportIdentifyClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -20698,10 +19586,9 @@ class ReportIdentifyClusterRevision : public ModelCommand chip::Controller::IdentifyCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -20709,15 +19596,9 @@ class ReportIdentifyClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("Identify.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -20780,13 +19661,7 @@ class ReportIlluminanceMeasurementMeasuredValue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportIlluminanceMeasurementMeasuredValue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportIlluminanceMeasurementMeasuredValue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -20795,10 +19670,9 @@ class ReportIlluminanceMeasurementMeasuredValue : public ModelCommand chip::Controller::IlluminanceMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMeasuredValue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMeasuredValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -20806,15 +19680,12 @@ class ReportIlluminanceMeasurementMeasuredValue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("IlluminanceMeasurement.MeasuredValue report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -20862,13 +19733,7 @@ class ReportIlluminanceMeasurementMinMeasuredValue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportIlluminanceMeasurementMinMeasuredValue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportIlluminanceMeasurementMinMeasuredValue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -20877,10 +19742,9 @@ class ReportIlluminanceMeasurementMinMeasuredValue : public ModelCommand chip::Controller::IlluminanceMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMinMeasuredValue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMinMeasuredValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -20888,15 +19752,12 @@ class ReportIlluminanceMeasurementMinMeasuredValue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("IlluminanceMeasurement.MinMeasuredValue report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -20944,13 +19805,7 @@ class ReportIlluminanceMeasurementMaxMeasuredValue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportIlluminanceMeasurementMaxMeasuredValue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportIlluminanceMeasurementMaxMeasuredValue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -20959,10 +19814,9 @@ class ReportIlluminanceMeasurementMaxMeasuredValue : public ModelCommand chip::Controller::IlluminanceMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMaxMeasuredValue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMaxMeasuredValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -20970,15 +19824,12 @@ class ReportIlluminanceMeasurementMaxMeasuredValue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("IlluminanceMeasurement.MaxMeasuredValue report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -21026,13 +19877,7 @@ class ReportIlluminanceMeasurementTolerance : public ModelCommand ModelCommand::AddArguments(); } - ~ReportIlluminanceMeasurementTolerance() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportIlluminanceMeasurementTolerance() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -21041,10 +19886,9 @@ class ReportIlluminanceMeasurementTolerance : public ModelCommand chip::Controller::IlluminanceMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTolerance(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTolerance(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -21052,15 +19896,9 @@ class ReportIlluminanceMeasurementTolerance : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("IlluminanceMeasurement.Tolerance report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -21108,13 +19946,7 @@ class ReportIlluminanceMeasurementLightSensorType : public ModelCommand ModelCommand::AddArguments(); } - ~ReportIlluminanceMeasurementLightSensorType() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportIlluminanceMeasurementLightSensorType() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -21123,10 +19955,9 @@ class ReportIlluminanceMeasurementLightSensorType : public ModelCommand chip::Controller::IlluminanceMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeLightSensorType(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeLightSensorType(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -21134,15 +19965,12 @@ class ReportIlluminanceMeasurementLightSensorType : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("IlluminanceMeasurement.LightSensorType report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -21220,13 +20048,7 @@ class ReportIlluminanceMeasurementClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportIlluminanceMeasurementClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportIlluminanceMeasurementClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -21235,10 +20057,9 @@ class ReportIlluminanceMeasurementClusterRevision : public ModelCommand chip::Controller::IlluminanceMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -21246,15 +20067,12 @@ class ReportIlluminanceMeasurementClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("IlluminanceMeasurement.ClusterRevision report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -21368,13 +20186,7 @@ class ReportKeypadInputClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportKeypadInputClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportKeypadInputClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -21383,10 +20195,9 @@ class ReportKeypadInputClusterRevision : public ModelCommand chip::Controller::KeypadInputCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -21394,15 +20205,9 @@ class ReportKeypadInputClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("KeypadInput.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -21689,13 +20494,7 @@ class ReportLevelControlCurrentLevel : public ModelCommand ModelCommand::AddArguments(); } - ~ReportLevelControlCurrentLevel() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportLevelControlCurrentLevel() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -21704,10 +20503,9 @@ class ReportLevelControlCurrentLevel : public ModelCommand chip::Controller::LevelControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentLevel(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentLevel(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -21715,15 +20513,9 @@ class ReportLevelControlCurrentLevel : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("LevelControl.CurrentLevel report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -21771,13 +20563,7 @@ class ReportLevelControlRemainingTime : public ModelCommand ModelCommand::AddArguments(); } - ~ReportLevelControlRemainingTime() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportLevelControlRemainingTime() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -21786,10 +20572,9 @@ class ReportLevelControlRemainingTime : public ModelCommand chip::Controller::LevelControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRemainingTime(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRemainingTime(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -21797,15 +20582,9 @@ class ReportLevelControlRemainingTime : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("LevelControl.RemainingTime report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -21853,13 +20632,7 @@ class ReportLevelControlMinLevel : public ModelCommand ModelCommand::AddArguments(); } - ~ReportLevelControlMinLevel() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportLevelControlMinLevel() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -21868,10 +20641,9 @@ class ReportLevelControlMinLevel : public ModelCommand chip::Controller::LevelControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMinLevel(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMinLevel(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -21879,15 +20651,9 @@ class ReportLevelControlMinLevel : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("LevelControl.MinLevel report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -21935,13 +20701,7 @@ class ReportLevelControlMaxLevel : public ModelCommand ModelCommand::AddArguments(); } - ~ReportLevelControlMaxLevel() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportLevelControlMaxLevel() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -21950,10 +20710,9 @@ class ReportLevelControlMaxLevel : public ModelCommand chip::Controller::LevelControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMaxLevel(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMaxLevel(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -21961,15 +20720,9 @@ class ReportLevelControlMaxLevel : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("LevelControl.MaxLevel report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -22017,13 +20770,7 @@ class ReportLevelControlCurrentFrequency : public ModelCommand ModelCommand::AddArguments(); } - ~ReportLevelControlCurrentFrequency() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportLevelControlCurrentFrequency() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -22032,10 +20779,9 @@ class ReportLevelControlCurrentFrequency : public ModelCommand chip::Controller::LevelControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentFrequency(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentFrequency(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -22043,15 +20789,9 @@ class ReportLevelControlCurrentFrequency : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("LevelControl.CurrentFrequency report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -22099,13 +20839,7 @@ class ReportLevelControlMinFrequency : public ModelCommand ModelCommand::AddArguments(); } - ~ReportLevelControlMinFrequency() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportLevelControlMinFrequency() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -22114,10 +20848,9 @@ class ReportLevelControlMinFrequency : public ModelCommand chip::Controller::LevelControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMinFrequency(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMinFrequency(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -22125,15 +20858,9 @@ class ReportLevelControlMinFrequency : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("LevelControl.MinFrequency report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -22181,13 +20908,7 @@ class ReportLevelControlMaxFrequency : public ModelCommand ModelCommand::AddArguments(); } - ~ReportLevelControlMaxFrequency() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportLevelControlMaxFrequency() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -22196,10 +20917,9 @@ class ReportLevelControlMaxFrequency : public ModelCommand chip::Controller::LevelControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMaxFrequency(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMaxFrequency(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -22207,15 +20927,9 @@ class ReportLevelControlMaxFrequency : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("LevelControl.MaxFrequency report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -22289,13 +21003,7 @@ class ReportLevelControlOptions : public ModelCommand ModelCommand::AddArguments(); } - ~ReportLevelControlOptions() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportLevelControlOptions() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -22304,10 +21012,9 @@ class ReportLevelControlOptions : public ModelCommand chip::Controller::LevelControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOptions(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOptions(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -22315,15 +21022,9 @@ class ReportLevelControlOptions : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("LevelControl.Options report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -22397,13 +21098,7 @@ class ReportLevelControlOnOffTransitionTime : public ModelCommand ModelCommand::AddArguments(); } - ~ReportLevelControlOnOffTransitionTime() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportLevelControlOnOffTransitionTime() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -22412,11 +21107,9 @@ class ReportLevelControlOnOffTransitionTime : public ModelCommand chip::Controller::LevelControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOnOffTransitionTime(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOnOffTransitionTime(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -22424,15 +21117,9 @@ class ReportLevelControlOnOffTransitionTime : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("LevelControl.OnOffTransitionTime report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -22506,13 +21193,7 @@ class ReportLevelControlOnLevel : public ModelCommand ModelCommand::AddArguments(); } - ~ReportLevelControlOnLevel() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportLevelControlOnLevel() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -22521,10 +21202,9 @@ class ReportLevelControlOnLevel : public ModelCommand chip::Controller::LevelControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOnLevel(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOnLevel(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -22532,15 +21212,12 @@ class ReportLevelControlOnLevel : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("LevelControl.OnLevel report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -22614,13 +21291,7 @@ class ReportLevelControlOnTransitionTime : public ModelCommand ModelCommand::AddArguments(); } - ~ReportLevelControlOnTransitionTime() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportLevelControlOnTransitionTime() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -22629,10 +21300,9 @@ class ReportLevelControlOnTransitionTime : public ModelCommand chip::Controller::LevelControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOnTransitionTime(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOnTransitionTime(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -22640,15 +21310,12 @@ class ReportLevelControlOnTransitionTime : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("LevelControl.OnTransitionTime report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -22722,13 +21389,7 @@ class ReportLevelControlOffTransitionTime : public ModelCommand ModelCommand::AddArguments(); } - ~ReportLevelControlOffTransitionTime() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportLevelControlOffTransitionTime() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -22737,11 +21398,9 @@ class ReportLevelControlOffTransitionTime : public ModelCommand chip::Controller::LevelControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOffTransitionTime(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOffTransitionTime(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -22749,15 +21408,12 @@ class ReportLevelControlOffTransitionTime : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("LevelControl.OffTransitionTime report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -22831,13 +21487,7 @@ class ReportLevelControlDefaultMoveRate : public ModelCommand ModelCommand::AddArguments(); } - ~ReportLevelControlDefaultMoveRate() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportLevelControlDefaultMoveRate() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -22846,10 +21496,9 @@ class ReportLevelControlDefaultMoveRate : public ModelCommand chip::Controller::LevelControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeDefaultMoveRate(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeDefaultMoveRate(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -22857,15 +21506,12 @@ class ReportLevelControlDefaultMoveRate : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("LevelControl.DefaultMoveRate report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -22939,13 +21585,7 @@ class ReportLevelControlStartUpCurrentLevel : public ModelCommand ModelCommand::AddArguments(); } - ~ReportLevelControlStartUpCurrentLevel() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportLevelControlStartUpCurrentLevel() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -22954,11 +21594,9 @@ class ReportLevelControlStartUpCurrentLevel : public ModelCommand chip::Controller::LevelControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeStartUpCurrentLevel(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeStartUpCurrentLevel(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -22966,15 +21604,9 @@ class ReportLevelControlStartUpCurrentLevel : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("LevelControl.StartUpCurrentLevel report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -23052,13 +21684,7 @@ class ReportLevelControlClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportLevelControlClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportLevelControlClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -23067,10 +21693,9 @@ class ReportLevelControlClusterRevision : public ModelCommand chip::Controller::LevelControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -23078,15 +21703,9 @@ class ReportLevelControlClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("LevelControl.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -23195,13 +21814,7 @@ class ReportLowPowerClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportLowPowerClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportLowPowerClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -23210,10 +21823,9 @@ class ReportLowPowerClusterRevision : public ModelCommand chip::Controller::LowPowerCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -23221,15 +21833,9 @@ class ReportLowPowerClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("LowPower.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -23372,6 +21978,50 @@ class ReadMediaInputMediaInputList : public ModelCommand } }; +class ReportMediaInputMediaInputList : public ModelCommand +{ +public: + ReportMediaInputMediaInputList() : ModelCommand("report") + { + AddArgument("attr-name", "media-input-list"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportMediaInputMediaInputList() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0507) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::MediaInputCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport( + void * context, + const chip::app::DataModel::DecodableList & value) + { + LogValue("MediaInput.MediaInputList report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute CurrentMediaInput */ @@ -23414,13 +22064,7 @@ class ReportMediaInputCurrentMediaInput : public ModelCommand ModelCommand::AddArguments(); } - ~ReportMediaInputCurrentMediaInput() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportMediaInputCurrentMediaInput() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -23429,11 +22073,9 @@ class ReportMediaInputCurrentMediaInput : public ModelCommand chip::Controller::MediaInputCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentMediaInput(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentMediaInput(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -23441,15 +22083,9 @@ class ReportMediaInputCurrentMediaInput : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("MediaInput.CurrentMediaInput report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -23527,13 +22163,7 @@ class ReportMediaInputClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportMediaInputClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportMediaInputClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -23542,10 +22172,9 @@ class ReportMediaInputClusterRevision : public ModelCommand chip::Controller::MediaInputCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -23553,15 +22182,9 @@ class ReportMediaInputClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("MediaInput.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -23870,13 +22493,7 @@ class ReportMediaPlaybackPlaybackState : public ModelCommand ModelCommand::AddArguments(); } - ~ReportMediaPlaybackPlaybackState() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportMediaPlaybackPlaybackState() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -23885,10 +22502,9 @@ class ReportMediaPlaybackPlaybackState : public ModelCommand chip::Controller::MediaPlaybackCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePlaybackState(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePlaybackState(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -23896,15 +22512,9 @@ class ReportMediaPlaybackPlaybackState : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("MediaPlayback.PlaybackState report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -23952,13 +22562,7 @@ class ReportMediaPlaybackStartTime : public ModelCommand ModelCommand::AddArguments(); } - ~ReportMediaPlaybackStartTime() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportMediaPlaybackStartTime() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -23967,10 +22571,9 @@ class ReportMediaPlaybackStartTime : public ModelCommand chip::Controller::MediaPlaybackCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeStartTime(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeStartTime(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -23978,15 +22581,9 @@ class ReportMediaPlaybackStartTime : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) { LogValue("MediaPlayback.StartTime report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -24034,13 +22631,7 @@ class ReportMediaPlaybackDuration : public ModelCommand ModelCommand::AddArguments(); } - ~ReportMediaPlaybackDuration() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportMediaPlaybackDuration() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -24049,10 +22640,9 @@ class ReportMediaPlaybackDuration : public ModelCommand chip::Controller::MediaPlaybackCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeDuration(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeDuration(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -24060,15 +22650,9 @@ class ReportMediaPlaybackDuration : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) { LogValue("MediaPlayback.Duration report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -24116,13 +22700,7 @@ class ReportMediaPlaybackPositionUpdatedAt : public ModelCommand ModelCommand::AddArguments(); } - ~ReportMediaPlaybackPositionUpdatedAt() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportMediaPlaybackPositionUpdatedAt() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -24131,11 +22709,9 @@ class ReportMediaPlaybackPositionUpdatedAt : public ModelCommand chip::Controller::MediaPlaybackCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePositionUpdatedAt(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePositionUpdatedAt(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -24143,15 +22719,9 @@ class ReportMediaPlaybackPositionUpdatedAt : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) { LogValue("MediaPlayback.PositionUpdatedAt report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -24199,13 +22769,7 @@ class ReportMediaPlaybackPosition : public ModelCommand ModelCommand::AddArguments(); } - ~ReportMediaPlaybackPosition() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportMediaPlaybackPosition() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -24214,10 +22778,9 @@ class ReportMediaPlaybackPosition : public ModelCommand chip::Controller::MediaPlaybackCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePosition(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePosition(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -24225,15 +22788,9 @@ class ReportMediaPlaybackPosition : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) { LogValue("MediaPlayback.Position report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -24281,13 +22838,7 @@ class ReportMediaPlaybackPlaybackSpeed : public ModelCommand ModelCommand::AddArguments(); } - ~ReportMediaPlaybackPlaybackSpeed() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportMediaPlaybackPlaybackSpeed() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -24296,10 +22847,9 @@ class ReportMediaPlaybackPlaybackSpeed : public ModelCommand chip::Controller::MediaPlaybackCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePlaybackSpeed(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePlaybackSpeed(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -24307,15 +22857,9 @@ class ReportMediaPlaybackPlaybackSpeed : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) { LogValue("MediaPlayback.PlaybackSpeed report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -24363,13 +22907,7 @@ class ReportMediaPlaybackSeekRangeEnd : public ModelCommand ModelCommand::AddArguments(); } - ~ReportMediaPlaybackSeekRangeEnd() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportMediaPlaybackSeekRangeEnd() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -24378,10 +22916,9 @@ class ReportMediaPlaybackSeekRangeEnd : public ModelCommand chip::Controller::MediaPlaybackCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeSeekRangeEnd(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeSeekRangeEnd(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -24389,15 +22926,9 @@ class ReportMediaPlaybackSeekRangeEnd : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) { LogValue("MediaPlayback.SeekRangeEnd report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -24445,13 +22976,7 @@ class ReportMediaPlaybackSeekRangeStart : public ModelCommand ModelCommand::AddArguments(); } - ~ReportMediaPlaybackSeekRangeStart() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportMediaPlaybackSeekRangeStart() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -24460,10 +22985,9 @@ class ReportMediaPlaybackSeekRangeStart : public ModelCommand chip::Controller::MediaPlaybackCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeSeekRangeStart(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeSeekRangeStart(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -24471,15 +22995,9 @@ class ReportMediaPlaybackSeekRangeStart : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) { LogValue("MediaPlayback.SeekRangeStart report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -24557,13 +23075,7 @@ class ReportMediaPlaybackClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportMediaPlaybackClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportMediaPlaybackClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -24572,10 +23084,9 @@ class ReportMediaPlaybackClusterRevision : public ModelCommand chip::Controller::MediaPlaybackCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -24583,15 +23094,9 @@ class ReportMediaPlaybackClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("MediaPlayback.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -24679,13 +23184,7 @@ class ReportModeSelectCurrentMode : public ModelCommand ModelCommand::AddArguments(); } - ~ReportModeSelectCurrentMode() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportModeSelectCurrentMode() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -24694,10 +23193,9 @@ class ReportModeSelectCurrentMode : public ModelCommand chip::Controller::ModeSelectCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentMode(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentMode(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -24705,15 +23203,9 @@ class ReportModeSelectCurrentMode : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ModeSelect.CurrentMode report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -24752,6 +23244,51 @@ class ReadModeSelectSupportedModes : public ModelCommand } }; +class ReportModeSelectSupportedModes : public ModelCommand +{ +public: + ReportModeSelectSupportedModes() : ModelCommand("report") + { + AddArgument("attr-name", "supported-modes"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportModeSelectSupportedModes() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0050) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::ModeSelectCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport( + void * context, + const chip::app::DataModel::DecodableList & + value) + { + LogValue("ModeSelect.SupportedModes report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute OnMode */ @@ -24820,13 +23357,7 @@ class ReportModeSelectOnMode : public ModelCommand ModelCommand::AddArguments(); } - ~ReportModeSelectOnMode() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportModeSelectOnMode() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -24835,10 +23366,9 @@ class ReportModeSelectOnMode : public ModelCommand chip::Controller::ModeSelectCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOnMode(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOnMode(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -24846,15 +23376,9 @@ class ReportModeSelectOnMode : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ModeSelect.OnMode report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -24902,13 +23426,7 @@ class ReportModeSelectStartUpMode : public ModelCommand ModelCommand::AddArguments(); } - ~ReportModeSelectStartUpMode() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportModeSelectStartUpMode() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -24917,10 +23435,9 @@ class ReportModeSelectStartUpMode : public ModelCommand chip::Controller::ModeSelectCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeStartUpMode(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeStartUpMode(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -24928,15 +23445,9 @@ class ReportModeSelectStartUpMode : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ModeSelect.StartUpMode report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -24984,13 +23495,7 @@ class ReportModeSelectDescription : public ModelCommand ModelCommand::AddArguments(); } - ~ReportModeSelectDescription() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportModeSelectDescription() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -24999,10 +23504,9 @@ class ReportModeSelectDescription : public ModelCommand chip::Controller::ModeSelectCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeDescription(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeDescription(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -25010,15 +23514,9 @@ class ReportModeSelectDescription : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) { LogValue("ModeSelect.Description report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -25096,13 +23594,7 @@ class ReportModeSelectClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportModeSelectClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportModeSelectClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -25111,10 +23603,9 @@ class ReportModeSelectClusterRevision : public ModelCommand chip::Controller::ModeSelectCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -25122,15 +23613,9 @@ class ReportModeSelectClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ModeSelect.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -25437,13 +23922,7 @@ class ReportNetworkCommissioningFeatureMap : public ModelCommand ModelCommand::AddArguments(); } - ~ReportNetworkCommissioningFeatureMap() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportNetworkCommissioningFeatureMap() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -25452,10 +23931,9 @@ class ReportNetworkCommissioningFeatureMap : public ModelCommand chip::Controller::NetworkCommissioningCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeFeatureMap(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeFeatureMap(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -25463,15 +23941,9 @@ class ReportNetworkCommissioningFeatureMap : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) { LogValue("NetworkCommissioning.FeatureMap report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -25519,13 +23991,7 @@ class ReportNetworkCommissioningClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportNetworkCommissioningClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportNetworkCommissioningClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -25534,10 +24000,9 @@ class ReportNetworkCommissioningClusterRevision : public ModelCommand chip::Controller::NetworkCommissioningCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -25545,15 +24010,9 @@ class ReportNetworkCommissioningClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("NetworkCommissioning.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -25725,13 +24184,7 @@ class ReportOtaSoftwareUpdateProviderClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOtaSoftwareUpdateProviderClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOtaSoftwareUpdateProviderClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -25740,10 +24193,9 @@ class ReportOtaSoftwareUpdateProviderClusterRevision : public ModelCommand chip::Controller::OtaSoftwareUpdateProviderCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -25751,15 +24203,12 @@ class ReportOtaSoftwareUpdateProviderClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("OtaSoftwareUpdateProvider.ClusterRevision report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -25875,13 +24324,7 @@ class ReportOtaSoftwareUpdateRequestorDefaultOtaProvider : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOtaSoftwareUpdateRequestorDefaultOtaProvider() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOtaSoftwareUpdateRequestorDefaultOtaProvider() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -25890,11 +24333,10 @@ class ReportOtaSoftwareUpdateRequestorDefaultOtaProvider : public ModelCommand chip::Controller::OtaSoftwareUpdateRequestorCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeDefaultOtaProvider(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeDefaultOtaProvider(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -25902,15 +24344,12 @@ class ReportOtaSoftwareUpdateRequestorDefaultOtaProvider : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::ByteSpan value) + { + LogValue("OtaSoftwareUpdateRequestor.DefaultOtaProvider report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnOctetStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -25958,13 +24397,7 @@ class ReportOtaSoftwareUpdateRequestorUpdatePossible : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOtaSoftwareUpdateRequestorUpdatePossible() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOtaSoftwareUpdateRequestorUpdatePossible() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -25973,10 +24406,9 @@ class ReportOtaSoftwareUpdateRequestorUpdatePossible : public ModelCommand chip::Controller::OtaSoftwareUpdateRequestorCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeUpdatePossible(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeUpdatePossible(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -25984,15 +24416,12 @@ class ReportOtaSoftwareUpdateRequestorUpdatePossible : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, bool value) + { + LogValue("OtaSoftwareUpdateRequestor.UpdatePossible report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnBooleanAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -26070,13 +24499,7 @@ class ReportOtaSoftwareUpdateRequestorClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOtaSoftwareUpdateRequestorClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOtaSoftwareUpdateRequestorClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -26085,10 +24508,9 @@ class ReportOtaSoftwareUpdateRequestorClusterRevision : public ModelCommand chip::Controller::OtaSoftwareUpdateRequestorCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -26096,15 +24518,12 @@ class ReportOtaSoftwareUpdateRequestorClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("OtaSoftwareUpdateRequestor.ClusterRevision report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -26165,13 +24584,7 @@ class ReportOccupancySensingOccupancy : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOccupancySensingOccupancy() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOccupancySensingOccupancy() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -26180,10 +24593,9 @@ class ReportOccupancySensingOccupancy : public ModelCommand chip::Controller::OccupancySensingCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOccupancy(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOccupancy(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -26191,15 +24603,9 @@ class ReportOccupancySensingOccupancy : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("OccupancySensing.Occupancy report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -26247,13 +24653,7 @@ class ReportOccupancySensingOccupancySensorType : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOccupancySensingOccupancySensorType() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOccupancySensingOccupancySensorType() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -26262,11 +24662,9 @@ class ReportOccupancySensingOccupancySensorType : public ModelCommand chip::Controller::OccupancySensingCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOccupancySensorType(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOccupancySensorType(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -26274,15 +24672,9 @@ class ReportOccupancySensingOccupancySensorType : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("OccupancySensing.OccupancySensorType report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -26330,13 +24722,7 @@ class ReportOccupancySensingOccupancySensorTypeBitmap : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOccupancySensingOccupancySensorTypeBitmap() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOccupancySensingOccupancySensorTypeBitmap() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -26345,11 +24731,9 @@ class ReportOccupancySensingOccupancySensorTypeBitmap : public ModelCommand chip::Controller::OccupancySensingCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOccupancySensorTypeBitmap(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOccupancySensorTypeBitmap(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -26357,15 +24741,12 @@ class ReportOccupancySensingOccupancySensorTypeBitmap : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) + { + LogValue("OccupancySensing.OccupancySensorTypeBitmap report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -26443,13 +24824,7 @@ class ReportOccupancySensingClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOccupancySensingClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOccupancySensingClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -26458,10 +24833,9 @@ class ReportOccupancySensingClusterRevision : public ModelCommand chip::Controller::OccupancySensingCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -26469,15 +24843,9 @@ class ReportOccupancySensingClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("OccupancySensing.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -26681,13 +25049,7 @@ class ReportOnOffOnOff : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOnOffOnOff() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOnOffOnOff() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -26696,10 +25058,9 @@ class ReportOnOffOnOff : public ModelCommand chip::Controller::OnOffCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOnOff(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOnOff(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -26707,15 +25068,9 @@ class ReportOnOffOnOff : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, bool value) { LogValue("OnOff.OnOff report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnBooleanAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -26763,13 +25118,7 @@ class ReportOnOffGlobalSceneControl : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOnOffGlobalSceneControl() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOnOffGlobalSceneControl() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -26778,11 +25127,9 @@ class ReportOnOffGlobalSceneControl : public ModelCommand chip::Controller::OnOffCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeGlobalSceneControl(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeGlobalSceneControl(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -26790,15 +25137,9 @@ class ReportOnOffGlobalSceneControl : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, bool value) { LogValue("OnOff.GlobalSceneControl report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnBooleanAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -26872,13 +25213,7 @@ class ReportOnOffOnTime : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOnOffOnTime() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOnOffOnTime() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -26887,10 +25222,9 @@ class ReportOnOffOnTime : public ModelCommand chip::Controller::OnOffCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOnTime(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOnTime(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -26898,15 +25232,9 @@ class ReportOnOffOnTime : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("OnOff.OnTime report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -26980,13 +25308,7 @@ class ReportOnOffOffWaitTime : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOnOffOffWaitTime() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOnOffOffWaitTime() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -26995,10 +25317,9 @@ class ReportOnOffOffWaitTime : public ModelCommand chip::Controller::OnOffCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOffWaitTime(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOffWaitTime(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -27006,15 +25327,9 @@ class ReportOnOffOffWaitTime : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("OnOff.OffWaitTime report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -27088,13 +25403,7 @@ class ReportOnOffStartUpOnOff : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOnOffStartUpOnOff() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOnOffStartUpOnOff() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -27103,10 +25412,9 @@ class ReportOnOffStartUpOnOff : public ModelCommand chip::Controller::OnOffCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeStartUpOnOff(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeStartUpOnOff(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -27114,15 +25422,9 @@ class ReportOnOffStartUpOnOff : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("OnOff.StartUpOnOff report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -27200,13 +25502,7 @@ class ReportOnOffFeatureMap : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOnOffFeatureMap() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOnOffFeatureMap() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -27215,10 +25511,9 @@ class ReportOnOffFeatureMap : public ModelCommand chip::Controller::OnOffCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeFeatureMap(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeFeatureMap(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -27226,15 +25521,9 @@ class ReportOnOffFeatureMap : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) { LogValue("OnOff.FeatureMap report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -27282,13 +25571,7 @@ class ReportOnOffClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOnOffClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOnOffClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -27297,10 +25580,9 @@ class ReportOnOffClusterRevision : public ModelCommand chip::Controller::OnOffCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -27308,15 +25590,9 @@ class ReportOnOffClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("OnOff.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -27376,13 +25652,7 @@ class ReportOnOffSwitchConfigurationSwitchType : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOnOffSwitchConfigurationSwitchType() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOnOffSwitchConfigurationSwitchType() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -27391,10 +25661,9 @@ class ReportOnOffSwitchConfigurationSwitchType : public ModelCommand chip::Controller::OnOffSwitchConfigurationCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeSwitchType(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeSwitchType(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -27402,15 +25671,9 @@ class ReportOnOffSwitchConfigurationSwitchType : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("OnOffSwitchConfiguration.SwitchType report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -27484,13 +25747,7 @@ class ReportOnOffSwitchConfigurationSwitchActions : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOnOffSwitchConfigurationSwitchActions() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOnOffSwitchConfigurationSwitchActions() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -27499,10 +25756,9 @@ class ReportOnOffSwitchConfigurationSwitchActions : public ModelCommand chip::Controller::OnOffSwitchConfigurationCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeSwitchActions(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeSwitchActions(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -27510,15 +25766,12 @@ class ReportOnOffSwitchConfigurationSwitchActions : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) + { + LogValue("OnOffSwitchConfiguration.SwitchActions report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -27596,13 +25849,7 @@ class ReportOnOffSwitchConfigurationClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOnOffSwitchConfigurationClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOnOffSwitchConfigurationClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -27611,10 +25858,9 @@ class ReportOnOffSwitchConfigurationClusterRevision : public ModelCommand chip::Controller::OnOffSwitchConfigurationCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -27622,15 +25868,12 @@ class ReportOnOffSwitchConfigurationClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("OnOffSwitchConfiguration.ClusterRevision report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -27914,6 +26157,50 @@ class ReadOperationalCredentialsFabricsList : public ModelCommand } }; +class ReportOperationalCredentialsFabricsList : public ModelCommand +{ +public: + ReportOperationalCredentialsFabricsList() : ModelCommand("report") + { + AddArgument("attr-name", "fabrics-list"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportOperationalCredentialsFabricsList() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x003E) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::OperationalCredentialsCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & value) + { + LogValue("OperationalCredentials.FabricsList report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute SupportedFabrics */ @@ -27956,13 +26243,7 @@ class ReportOperationalCredentialsSupportedFabrics : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOperationalCredentialsSupportedFabrics() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOperationalCredentialsSupportedFabrics() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -27971,10 +26252,9 @@ class ReportOperationalCredentialsSupportedFabrics : public ModelCommand chip::Controller::OperationalCredentialsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeSupportedFabrics(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeSupportedFabrics(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -27982,15 +26262,12 @@ class ReportOperationalCredentialsSupportedFabrics : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) + { + LogValue("OperationalCredentials.SupportedFabrics report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -28038,13 +26315,7 @@ class ReportOperationalCredentialsCommissionedFabrics : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOperationalCredentialsCommissionedFabrics() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOperationalCredentialsCommissionedFabrics() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -28053,11 +26324,9 @@ class ReportOperationalCredentialsCommissionedFabrics : public ModelCommand chip::Controller::OperationalCredentialsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCommissionedFabrics(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCommissionedFabrics(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -28065,15 +26334,12 @@ class ReportOperationalCredentialsCommissionedFabrics : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) + { + LogValue("OperationalCredentials.CommissionedFabrics report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -28109,6 +26375,49 @@ class ReadOperationalCredentialsTrustedRootCertificates : public ModelCommand } }; +class ReportOperationalCredentialsTrustedRootCertificates : public ModelCommand +{ +public: + ReportOperationalCredentialsTrustedRootCertificates() : ModelCommand("report") + { + AddArgument("attr-name", "trusted-root-certificates"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportOperationalCredentialsTrustedRootCertificates() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x003E) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::OperationalCredentialsCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, const chip::app::DataModel::DecodableList & value) + { + LogValue("OperationalCredentials.TrustedRootCertificates report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute CurrentFabricIndex */ @@ -28151,13 +26460,7 @@ class ReportOperationalCredentialsCurrentFabricIndex : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOperationalCredentialsCurrentFabricIndex() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOperationalCredentialsCurrentFabricIndex() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -28166,11 +26469,9 @@ class ReportOperationalCredentialsCurrentFabricIndex : public ModelCommand chip::Controller::OperationalCredentialsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentFabricIndex(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentFabricIndex(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -28178,15 +26479,12 @@ class ReportOperationalCredentialsCurrentFabricIndex : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::FabricIndex value) + { + LogValue("OperationalCredentials.CurrentFabricIndex report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -28264,13 +26562,7 @@ class ReportOperationalCredentialsClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportOperationalCredentialsClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportOperationalCredentialsClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -28279,10 +26571,9 @@ class ReportOperationalCredentialsClusterRevision : public ModelCommand chip::Controller::OperationalCredentialsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -28290,15 +26581,12 @@ class ReportOperationalCredentialsClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("OperationalCredentials.ClusterRevision report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -28366,13 +26654,7 @@ class ReportPowerSourceStatus : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPowerSourceStatus() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPowerSourceStatus() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -28381,10 +26663,9 @@ class ReportPowerSourceStatus : public ModelCommand chip::Controller::PowerSourceCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeStatus(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeStatus(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -28392,15 +26673,9 @@ class ReportPowerSourceStatus : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("PowerSource.Status report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -28448,13 +26723,7 @@ class ReportPowerSourceOrder : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPowerSourceOrder() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPowerSourceOrder() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -28463,10 +26732,9 @@ class ReportPowerSourceOrder : public ModelCommand chip::Controller::PowerSourceCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOrder(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOrder(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -28474,15 +26742,9 @@ class ReportPowerSourceOrder : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("PowerSource.Order report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -28530,13 +26792,7 @@ class ReportPowerSourceDescription : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPowerSourceDescription() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPowerSourceDescription() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -28545,10 +26801,9 @@ class ReportPowerSourceDescription : public ModelCommand chip::Controller::PowerSourceCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeDescription(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeDescription(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -28556,15 +26811,9 @@ class ReportPowerSourceDescription : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) { LogValue("PowerSource.Description report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -28612,13 +26861,7 @@ class ReportPowerSourceBatteryVoltage : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPowerSourceBatteryVoltage() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPowerSourceBatteryVoltage() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -28627,10 +26870,9 @@ class ReportPowerSourceBatteryVoltage : public ModelCommand chip::Controller::PowerSourceCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeBatteryVoltage(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeBatteryVoltage(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -28638,15 +26880,9 @@ class ReportPowerSourceBatteryVoltage : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) { LogValue("PowerSource.BatteryVoltage report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -28694,13 +26930,7 @@ class ReportPowerSourceBatteryPercentRemaining : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPowerSourceBatteryPercentRemaining() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPowerSourceBatteryPercentRemaining() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -28709,11 +26939,9 @@ class ReportPowerSourceBatteryPercentRemaining : public ModelCommand chip::Controller::PowerSourceCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeBatteryPercentRemaining(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeBatteryPercentRemaining(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -28721,15 +26949,9 @@ class ReportPowerSourceBatteryPercentRemaining : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("PowerSource.BatteryPercentRemaining report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -28777,13 +26999,7 @@ class ReportPowerSourceBatteryTimeRemaining : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPowerSourceBatteryTimeRemaining() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPowerSourceBatteryTimeRemaining() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -28792,11 +27008,9 @@ class ReportPowerSourceBatteryTimeRemaining : public ModelCommand chip::Controller::PowerSourceCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeBatteryTimeRemaining(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeBatteryTimeRemaining(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -28804,15 +27018,9 @@ class ReportPowerSourceBatteryTimeRemaining : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) { LogValue("PowerSource.BatteryTimeRemaining report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -28860,13 +27068,7 @@ class ReportPowerSourceBatteryChargeLevel : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPowerSourceBatteryChargeLevel() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPowerSourceBatteryChargeLevel() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -28875,11 +27077,9 @@ class ReportPowerSourceBatteryChargeLevel : public ModelCommand chip::Controller::PowerSourceCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeBatteryChargeLevel(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeBatteryChargeLevel(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -28887,15 +27087,9 @@ class ReportPowerSourceBatteryChargeLevel : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("PowerSource.BatteryChargeLevel report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -28931,6 +27125,48 @@ class ReadPowerSourceActiveBatteryFaults : public ModelCommand } }; +class ReportPowerSourceActiveBatteryFaults : public ModelCommand +{ +public: + ReportPowerSourceActiveBatteryFaults() : ModelCommand("report") + { + AddArgument("attr-name", "active-battery-faults"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportPowerSourceActiveBatteryFaults() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x002F) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::PowerSourceCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, const chip::app::DataModel::DecodableList & value) + { + LogValue("PowerSource.ActiveBatteryFaults report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute BatteryChargeState */ @@ -28973,13 +27209,7 @@ class ReportPowerSourceBatteryChargeState : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPowerSourceBatteryChargeState() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPowerSourceBatteryChargeState() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -28988,11 +27218,9 @@ class ReportPowerSourceBatteryChargeState : public ModelCommand chip::Controller::PowerSourceCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeBatteryChargeState(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeBatteryChargeState(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -29000,15 +27228,9 @@ class ReportPowerSourceBatteryChargeState : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("PowerSource.BatteryChargeState report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -29086,13 +27308,7 @@ class ReportPowerSourceFeatureMap : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPowerSourceFeatureMap() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPowerSourceFeatureMap() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -29101,10 +27317,9 @@ class ReportPowerSourceFeatureMap : public ModelCommand chip::Controller::PowerSourceCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeFeatureMap(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeFeatureMap(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -29112,15 +27327,9 @@ class ReportPowerSourceFeatureMap : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) { LogValue("PowerSource.FeatureMap report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -29168,13 +27377,7 @@ class ReportPowerSourceClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPowerSourceClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPowerSourceClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -29183,10 +27386,9 @@ class ReportPowerSourceClusterRevision : public ModelCommand chip::Controller::PowerSourceCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -29194,15 +27396,9 @@ class ReportPowerSourceClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("PowerSource.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -29364,13 +27560,7 @@ class ReportPressureMeasurementMeasuredValue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPressureMeasurementMeasuredValue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPressureMeasurementMeasuredValue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -29379,10 +27569,9 @@ class ReportPressureMeasurementMeasuredValue : public ModelCommand chip::Controller::PressureMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMeasuredValue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMeasuredValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -29390,15 +27579,9 @@ class ReportPressureMeasurementMeasuredValue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("PressureMeasurement.MeasuredValue report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -29446,13 +27629,7 @@ class ReportPressureMeasurementMinMeasuredValue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPressureMeasurementMinMeasuredValue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPressureMeasurementMinMeasuredValue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -29461,10 +27638,9 @@ class ReportPressureMeasurementMinMeasuredValue : public ModelCommand chip::Controller::PressureMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMinMeasuredValue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMinMeasuredValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -29472,15 +27648,9 @@ class ReportPressureMeasurementMinMeasuredValue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("PressureMeasurement.MinMeasuredValue report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -29528,13 +27698,7 @@ class ReportPressureMeasurementMaxMeasuredValue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPressureMeasurementMaxMeasuredValue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPressureMeasurementMaxMeasuredValue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -29543,10 +27707,9 @@ class ReportPressureMeasurementMaxMeasuredValue : public ModelCommand chip::Controller::PressureMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMaxMeasuredValue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMaxMeasuredValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -29554,15 +27717,9 @@ class ReportPressureMeasurementMaxMeasuredValue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("PressureMeasurement.MaxMeasuredValue report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -29640,13 +27797,7 @@ class ReportPressureMeasurementClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPressureMeasurementClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPressureMeasurementClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -29655,10 +27806,9 @@ class ReportPressureMeasurementClusterRevision : public ModelCommand chip::Controller::PressureMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -29666,15 +27816,9 @@ class ReportPressureMeasurementClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("PressureMeasurement.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -29757,13 +27901,7 @@ class ReportPumpConfigurationAndControlMaxPressure : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlMaxPressure() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlMaxPressure() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -29772,10 +27910,9 @@ class ReportPumpConfigurationAndControlMaxPressure : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMaxPressure(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMaxPressure(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -29783,15 +27920,12 @@ class ReportPumpConfigurationAndControlMaxPressure : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) + { + LogValue("PumpConfigurationAndControl.MaxPressure report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -29839,13 +27973,7 @@ class ReportPumpConfigurationAndControlMaxSpeed : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlMaxSpeed() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlMaxSpeed() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -29854,10 +27982,9 @@ class ReportPumpConfigurationAndControlMaxSpeed : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMaxSpeed(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMaxSpeed(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -29865,15 +27992,9 @@ class ReportPumpConfigurationAndControlMaxSpeed : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("PumpConfigurationAndControl.MaxSpeed report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -29921,13 +28042,7 @@ class ReportPumpConfigurationAndControlMaxFlow : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlMaxFlow() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlMaxFlow() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -29936,10 +28051,9 @@ class ReportPumpConfigurationAndControlMaxFlow : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMaxFlow(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMaxFlow(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -29947,15 +28061,9 @@ class ReportPumpConfigurationAndControlMaxFlow : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("PumpConfigurationAndControl.MaxFlow report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -30003,13 +28111,7 @@ class ReportPumpConfigurationAndControlMinConstPressure : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlMinConstPressure() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlMinConstPressure() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -30018,10 +28120,9 @@ class ReportPumpConfigurationAndControlMinConstPressure : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMinConstPressure(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMinConstPressure(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -30029,15 +28130,12 @@ class ReportPumpConfigurationAndControlMinConstPressure : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) + { + LogValue("PumpConfigurationAndControl.MinConstPressure report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -30085,13 +28183,7 @@ class ReportPumpConfigurationAndControlMaxConstPressure : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlMaxConstPressure() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlMaxConstPressure() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -30100,10 +28192,9 @@ class ReportPumpConfigurationAndControlMaxConstPressure : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMaxConstPressure(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMaxConstPressure(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -30111,15 +28202,12 @@ class ReportPumpConfigurationAndControlMaxConstPressure : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) + { + LogValue("PumpConfigurationAndControl.MaxConstPressure report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -30167,13 +28255,7 @@ class ReportPumpConfigurationAndControlMinCompPressure : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlMinCompPressure() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlMinCompPressure() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -30182,10 +28264,9 @@ class ReportPumpConfigurationAndControlMinCompPressure : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMinCompPressure(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMinCompPressure(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -30193,15 +28274,12 @@ class ReportPumpConfigurationAndControlMinCompPressure : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) + { + LogValue("PumpConfigurationAndControl.MinCompPressure report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -30249,13 +28327,7 @@ class ReportPumpConfigurationAndControlMaxCompPressure : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlMaxCompPressure() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlMaxCompPressure() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -30264,10 +28336,9 @@ class ReportPumpConfigurationAndControlMaxCompPressure : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMaxCompPressure(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMaxCompPressure(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -30275,15 +28346,12 @@ class ReportPumpConfigurationAndControlMaxCompPressure : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) + { + LogValue("PumpConfigurationAndControl.MaxCompPressure report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -30331,13 +28399,7 @@ class ReportPumpConfigurationAndControlMinConstSpeed : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlMinConstSpeed() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlMinConstSpeed() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -30346,10 +28408,9 @@ class ReportPumpConfigurationAndControlMinConstSpeed : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMinConstSpeed(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMinConstSpeed(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -30357,15 +28418,12 @@ class ReportPumpConfigurationAndControlMinConstSpeed : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("PumpConfigurationAndControl.MinConstSpeed report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -30413,13 +28471,7 @@ class ReportPumpConfigurationAndControlMaxConstSpeed : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlMaxConstSpeed() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlMaxConstSpeed() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -30428,10 +28480,9 @@ class ReportPumpConfigurationAndControlMaxConstSpeed : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMaxConstSpeed(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMaxConstSpeed(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -30439,15 +28490,12 @@ class ReportPumpConfigurationAndControlMaxConstSpeed : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("PumpConfigurationAndControl.MaxConstSpeed report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -30495,13 +28543,7 @@ class ReportPumpConfigurationAndControlMinConstFlow : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlMinConstFlow() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlMinConstFlow() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -30510,10 +28552,9 @@ class ReportPumpConfigurationAndControlMinConstFlow : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMinConstFlow(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMinConstFlow(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -30521,15 +28562,12 @@ class ReportPumpConfigurationAndControlMinConstFlow : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("PumpConfigurationAndControl.MinConstFlow report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -30577,13 +28615,7 @@ class ReportPumpConfigurationAndControlMaxConstFlow : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlMaxConstFlow() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlMaxConstFlow() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -30592,10 +28624,9 @@ class ReportPumpConfigurationAndControlMaxConstFlow : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMaxConstFlow(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMaxConstFlow(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -30603,15 +28634,12 @@ class ReportPumpConfigurationAndControlMaxConstFlow : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("PumpConfigurationAndControl.MaxConstFlow report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -30659,13 +28687,7 @@ class ReportPumpConfigurationAndControlMinConstTemp : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlMinConstTemp() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlMinConstTemp() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -30674,10 +28696,9 @@ class ReportPumpConfigurationAndControlMinConstTemp : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMinConstTemp(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMinConstTemp(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -30685,15 +28706,12 @@ class ReportPumpConfigurationAndControlMinConstTemp : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) + { + LogValue("PumpConfigurationAndControl.MinConstTemp report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -30741,13 +28759,7 @@ class ReportPumpConfigurationAndControlMaxConstTemp : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlMaxConstTemp() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlMaxConstTemp() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -30756,10 +28768,9 @@ class ReportPumpConfigurationAndControlMaxConstTemp : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMaxConstTemp(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMaxConstTemp(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -30767,15 +28778,12 @@ class ReportPumpConfigurationAndControlMaxConstTemp : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) + { + LogValue("PumpConfigurationAndControl.MaxConstTemp report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -30823,13 +28831,7 @@ class ReportPumpConfigurationAndControlPumpStatus : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlPumpStatus() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlPumpStatus() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -30838,10 +28840,9 @@ class ReportPumpConfigurationAndControlPumpStatus : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePumpStatus(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePumpStatus(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -30849,15 +28850,12 @@ class ReportPumpConfigurationAndControlPumpStatus : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("PumpConfigurationAndControl.PumpStatus report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -30906,13 +28904,7 @@ class ReportPumpConfigurationAndControlEffectiveOperationMode : public ModelComm ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlEffectiveOperationMode() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlEffectiveOperationMode() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -30921,11 +28913,10 @@ class ReportPumpConfigurationAndControlEffectiveOperationMode : public ModelComm chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeEffectiveOperationMode(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeEffectiveOperationMode(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -30933,15 +28924,12 @@ class ReportPumpConfigurationAndControlEffectiveOperationMode : public ModelComm return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) + { + LogValue("PumpConfigurationAndControl.EffectiveOperationMode report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -30989,13 +28977,7 @@ class ReportPumpConfigurationAndControlEffectiveControlMode : public ModelComman ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlEffectiveControlMode() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlEffectiveControlMode() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -31004,11 +28986,10 @@ class ReportPumpConfigurationAndControlEffectiveControlMode : public ModelComman chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeEffectiveControlMode(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeEffectiveControlMode(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -31016,15 +28997,12 @@ class ReportPumpConfigurationAndControlEffectiveControlMode : public ModelComman return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) + { + LogValue("PumpConfigurationAndControl.EffectiveControlMode report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -31072,13 +29050,7 @@ class ReportPumpConfigurationAndControlCapacity : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlCapacity() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlCapacity() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -31087,10 +29059,9 @@ class ReportPumpConfigurationAndControlCapacity : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCapacity(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCapacity(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -31098,15 +29069,9 @@ class ReportPumpConfigurationAndControlCapacity : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("PumpConfigurationAndControl.Capacity report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -31154,13 +29119,7 @@ class ReportPumpConfigurationAndControlSpeed : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlSpeed() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlSpeed() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -31169,10 +29128,9 @@ class ReportPumpConfigurationAndControlSpeed : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeSpeed(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeSpeed(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -31180,15 +29138,9 @@ class ReportPumpConfigurationAndControlSpeed : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("PumpConfigurationAndControl.Speed report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -31262,13 +29214,7 @@ class ReportPumpConfigurationAndControlLifetimeRunningHours : public ModelComman ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlLifetimeRunningHours() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlLifetimeRunningHours() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -31277,11 +29223,10 @@ class ReportPumpConfigurationAndControlLifetimeRunningHours : public ModelComman chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeLifetimeRunningHours(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeLifetimeRunningHours(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -31289,15 +29234,12 @@ class ReportPumpConfigurationAndControlLifetimeRunningHours : public ModelComman return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("PumpConfigurationAndControl.LifetimeRunningHours report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -31345,13 +29287,7 @@ class ReportPumpConfigurationAndControlPower : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlPower() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlPower() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -31360,10 +29296,9 @@ class ReportPumpConfigurationAndControlPower : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePower(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePower(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -31371,15 +29306,9 @@ class ReportPumpConfigurationAndControlPower : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) { LogValue("PumpConfigurationAndControl.Power report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -31455,13 +29384,7 @@ class ReportPumpConfigurationAndControlLifetimeEnergyConsumed : public ModelComm ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlLifetimeEnergyConsumed() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlLifetimeEnergyConsumed() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -31470,11 +29393,10 @@ class ReportPumpConfigurationAndControlLifetimeEnergyConsumed : public ModelComm chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeLifetimeEnergyConsumed(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeLifetimeEnergyConsumed(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -31482,15 +29404,12 @@ class ReportPumpConfigurationAndControlLifetimeEnergyConsumed : public ModelComm return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("PumpConfigurationAndControl.LifetimeEnergyConsumed report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -31564,13 +29483,7 @@ class ReportPumpConfigurationAndControlOperationMode : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlOperationMode() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlOperationMode() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -31579,10 +29492,9 @@ class ReportPumpConfigurationAndControlOperationMode : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOperationMode(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOperationMode(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -31590,15 +29502,12 @@ class ReportPumpConfigurationAndControlOperationMode : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) + { + LogValue("PumpConfigurationAndControl.OperationMode report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -31672,13 +29581,7 @@ class ReportPumpConfigurationAndControlControlMode : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlControlMode() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlControlMode() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -31687,10 +29590,9 @@ class ReportPumpConfigurationAndControlControlMode : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeControlMode(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeControlMode(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -31698,15 +29600,12 @@ class ReportPumpConfigurationAndControlControlMode : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) + { + LogValue("PumpConfigurationAndControl.ControlMode report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -31754,13 +29653,7 @@ class ReportPumpConfigurationAndControlAlarmMask : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlAlarmMask() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlAlarmMask() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -31769,10 +29662,9 @@ class ReportPumpConfigurationAndControlAlarmMask : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeAlarmMask(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeAlarmMask(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -31780,15 +29672,12 @@ class ReportPumpConfigurationAndControlAlarmMask : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("PumpConfigurationAndControl.AlarmMask report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -31866,13 +29755,7 @@ class ReportPumpConfigurationAndControlFeatureMap : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlFeatureMap() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlFeatureMap() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -31881,10 +29764,9 @@ class ReportPumpConfigurationAndControlFeatureMap : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeFeatureMap(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeFeatureMap(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -31892,15 +29774,12 @@ class ReportPumpConfigurationAndControlFeatureMap : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("PumpConfigurationAndControl.FeatureMap report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -31948,13 +29827,7 @@ class ReportPumpConfigurationAndControlClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportPumpConfigurationAndControlClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportPumpConfigurationAndControlClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -31963,10 +29836,9 @@ class ReportPumpConfigurationAndControlClusterRevision : public ModelCommand chip::Controller::PumpConfigurationAndControlCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -31974,15 +29846,12 @@ class ReportPumpConfigurationAndControlClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("PumpConfigurationAndControl.ClusterRevision report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -32044,13 +29913,7 @@ class ReportRelativeHumidityMeasurementMeasuredValue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportRelativeHumidityMeasurementMeasuredValue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportRelativeHumidityMeasurementMeasuredValue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -32059,10 +29922,9 @@ class ReportRelativeHumidityMeasurementMeasuredValue : public ModelCommand chip::Controller::RelativeHumidityMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMeasuredValue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMeasuredValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -32070,15 +29932,12 @@ class ReportRelativeHumidityMeasurementMeasuredValue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("RelativeHumidityMeasurement.MeasuredValue report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -32126,13 +29985,7 @@ class ReportRelativeHumidityMeasurementMinMeasuredValue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportRelativeHumidityMeasurementMinMeasuredValue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportRelativeHumidityMeasurementMinMeasuredValue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -32141,10 +29994,9 @@ class ReportRelativeHumidityMeasurementMinMeasuredValue : public ModelCommand chip::Controller::RelativeHumidityMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMinMeasuredValue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMinMeasuredValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -32152,15 +30004,12 @@ class ReportRelativeHumidityMeasurementMinMeasuredValue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("RelativeHumidityMeasurement.MinMeasuredValue report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -32208,13 +30057,7 @@ class ReportRelativeHumidityMeasurementMaxMeasuredValue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportRelativeHumidityMeasurementMaxMeasuredValue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportRelativeHumidityMeasurementMaxMeasuredValue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -32223,10 +30066,9 @@ class ReportRelativeHumidityMeasurementMaxMeasuredValue : public ModelCommand chip::Controller::RelativeHumidityMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMaxMeasuredValue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMaxMeasuredValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -32234,15 +30076,12 @@ class ReportRelativeHumidityMeasurementMaxMeasuredValue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("RelativeHumidityMeasurement.MaxMeasuredValue report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -32290,13 +30129,7 @@ class ReportRelativeHumidityMeasurementTolerance : public ModelCommand ModelCommand::AddArguments(); } - ~ReportRelativeHumidityMeasurementTolerance() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportRelativeHumidityMeasurementTolerance() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -32305,10 +30138,9 @@ class ReportRelativeHumidityMeasurementTolerance : public ModelCommand chip::Controller::RelativeHumidityMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTolerance(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTolerance(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -32316,15 +30148,12 @@ class ReportRelativeHumidityMeasurementTolerance : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("RelativeHumidityMeasurement.Tolerance report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -32402,13 +30231,7 @@ class ReportRelativeHumidityMeasurementClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportRelativeHumidityMeasurementClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportRelativeHumidityMeasurementClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -32417,10 +30240,9 @@ class ReportRelativeHumidityMeasurementClusterRevision : public ModelCommand chip::Controller::RelativeHumidityMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -32428,15 +30250,12 @@ class ReportRelativeHumidityMeasurementClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("RelativeHumidityMeasurement.ClusterRevision report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -32683,13 +30502,7 @@ class ReportScenesSceneCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportScenesSceneCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportScenesSceneCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -32698,10 +30511,9 @@ class ReportScenesSceneCount : public ModelCommand chip::Controller::ScenesCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeSceneCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeSceneCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -32709,15 +30521,9 @@ class ReportScenesSceneCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("Scenes.SceneCount report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -32765,13 +30571,7 @@ class ReportScenesCurrentScene : public ModelCommand ModelCommand::AddArguments(); } - ~ReportScenesCurrentScene() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportScenesCurrentScene() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -32780,10 +30580,9 @@ class ReportScenesCurrentScene : public ModelCommand chip::Controller::ScenesCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentScene(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentScene(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -32791,15 +30590,9 @@ class ReportScenesCurrentScene : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("Scenes.CurrentScene report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -32847,13 +30640,7 @@ class ReportScenesCurrentGroup : public ModelCommand ModelCommand::AddArguments(); } - ~ReportScenesCurrentGroup() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportScenesCurrentGroup() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -32862,10 +30649,9 @@ class ReportScenesCurrentGroup : public ModelCommand chip::Controller::ScenesCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentGroup(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentGroup(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -32873,15 +30659,9 @@ class ReportScenesCurrentGroup : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("Scenes.CurrentGroup report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -32929,13 +30709,7 @@ class ReportScenesSceneValid : public ModelCommand ModelCommand::AddArguments(); } - ~ReportScenesSceneValid() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportScenesSceneValid() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -32944,10 +30718,9 @@ class ReportScenesSceneValid : public ModelCommand chip::Controller::ScenesCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeSceneValid(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeSceneValid(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -32955,15 +30728,9 @@ class ReportScenesSceneValid : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, bool value) { LogValue("Scenes.SceneValid report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnBooleanAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -33011,13 +30778,7 @@ class ReportScenesNameSupport : public ModelCommand ModelCommand::AddArguments(); } - ~ReportScenesNameSupport() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportScenesNameSupport() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -33026,10 +30787,9 @@ class ReportScenesNameSupport : public ModelCommand chip::Controller::ScenesCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNameSupport(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNameSupport(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -33037,15 +30797,9 @@ class ReportScenesNameSupport : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("Scenes.NameSupport report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -33123,13 +30877,7 @@ class ReportScenesClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportScenesClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportScenesClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -33138,10 +30886,9 @@ class ReportScenesClusterRevision : public ModelCommand chip::Controller::ScenesCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -33149,15 +30896,9 @@ class ReportScenesClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("Scenes.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -33232,6 +30973,51 @@ class ReadSoftwareDiagnosticsThreadMetrics : public ModelCommand } }; +class ReportSoftwareDiagnosticsThreadMetrics : public ModelCommand +{ +public: + ReportSoftwareDiagnosticsThreadMetrics() : ModelCommand("report") + { + AddArgument("attr-name", "thread-metrics"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportSoftwareDiagnosticsThreadMetrics() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0034) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::SoftwareDiagnosticsCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport( + void * context, + const chip::app::DataModel::DecodableList & + value) + { + LogValue("SoftwareDiagnostics.ThreadMetrics report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute CurrentHeapFree */ @@ -33274,13 +31060,7 @@ class ReportSoftwareDiagnosticsCurrentHeapFree : public ModelCommand ModelCommand::AddArguments(); } - ~ReportSoftwareDiagnosticsCurrentHeapFree() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportSoftwareDiagnosticsCurrentHeapFree() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -33289,10 +31069,9 @@ class ReportSoftwareDiagnosticsCurrentHeapFree : public ModelCommand chip::Controller::SoftwareDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentHeapFree(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentHeapFree(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -33300,15 +31079,9 @@ class ReportSoftwareDiagnosticsCurrentHeapFree : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) { LogValue("SoftwareDiagnostics.CurrentHeapFree report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -33356,13 +31129,7 @@ class ReportSoftwareDiagnosticsCurrentHeapUsed : public ModelCommand ModelCommand::AddArguments(); } - ~ReportSoftwareDiagnosticsCurrentHeapUsed() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportSoftwareDiagnosticsCurrentHeapUsed() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -33371,10 +31138,9 @@ class ReportSoftwareDiagnosticsCurrentHeapUsed : public ModelCommand chip::Controller::SoftwareDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentHeapUsed(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentHeapUsed(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -33382,15 +31148,9 @@ class ReportSoftwareDiagnosticsCurrentHeapUsed : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) { LogValue("SoftwareDiagnostics.CurrentHeapUsed report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -33438,13 +31198,7 @@ class ReportSoftwareDiagnosticsCurrentHeapHighWatermark : public ModelCommand ModelCommand::AddArguments(); } - ~ReportSoftwareDiagnosticsCurrentHeapHighWatermark() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportSoftwareDiagnosticsCurrentHeapHighWatermark() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -33453,11 +31207,9 @@ class ReportSoftwareDiagnosticsCurrentHeapHighWatermark : public ModelCommand chip::Controller::SoftwareDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentHeapHighWatermark(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentHeapHighWatermark(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -33465,15 +31217,12 @@ class ReportSoftwareDiagnosticsCurrentHeapHighWatermark : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) + { + LogValue("SoftwareDiagnostics.CurrentHeapHighWatermark report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -33581,13 +31330,7 @@ class ReportSoftwareDiagnosticsClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportSoftwareDiagnosticsClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportSoftwareDiagnosticsClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -33596,10 +31339,9 @@ class ReportSoftwareDiagnosticsClusterRevision : public ModelCommand chip::Controller::SoftwareDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -33607,15 +31349,9 @@ class ReportSoftwareDiagnosticsClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("SoftwareDiagnostics.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -33677,13 +31413,7 @@ class ReportSwitchNumberOfPositions : public ModelCommand ModelCommand::AddArguments(); } - ~ReportSwitchNumberOfPositions() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportSwitchNumberOfPositions() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -33692,11 +31422,9 @@ class ReportSwitchNumberOfPositions : public ModelCommand chip::Controller::SwitchCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNumberOfPositions(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNumberOfPositions(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -33704,15 +31432,9 @@ class ReportSwitchNumberOfPositions : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("Switch.NumberOfPositions report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -33760,13 +31482,7 @@ class ReportSwitchCurrentPosition : public ModelCommand ModelCommand::AddArguments(); } - ~ReportSwitchCurrentPosition() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportSwitchCurrentPosition() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -33775,10 +31491,9 @@ class ReportSwitchCurrentPosition : public ModelCommand chip::Controller::SwitchCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentPosition(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentPosition(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -33786,15 +31501,9 @@ class ReportSwitchCurrentPosition : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("Switch.CurrentPosition report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -33842,13 +31551,7 @@ class ReportSwitchMultiPressMax : public ModelCommand ModelCommand::AddArguments(); } - ~ReportSwitchMultiPressMax() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportSwitchMultiPressMax() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -33857,10 +31560,9 @@ class ReportSwitchMultiPressMax : public ModelCommand chip::Controller::SwitchCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMultiPressMax(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMultiPressMax(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -33868,15 +31570,9 @@ class ReportSwitchMultiPressMax : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("Switch.MultiPressMax report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -33954,13 +31650,7 @@ class ReportSwitchFeatureMap : public ModelCommand ModelCommand::AddArguments(); } - ~ReportSwitchFeatureMap() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportSwitchFeatureMap() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -33969,10 +31659,9 @@ class ReportSwitchFeatureMap : public ModelCommand chip::Controller::SwitchCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeFeatureMap(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeFeatureMap(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -33980,15 +31669,9 @@ class ReportSwitchFeatureMap : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) { LogValue("Switch.FeatureMap report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -34036,13 +31719,7 @@ class ReportSwitchClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportSwitchClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportSwitchClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -34051,10 +31728,9 @@ class ReportSwitchClusterRevision : public ModelCommand chip::Controller::SwitchCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -34062,15 +31738,9 @@ class ReportSwitchClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("Switch.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -34197,6 +31867,50 @@ class ReadTvChannelTvChannelList : public ModelCommand } }; +class ReportTvChannelTvChannelList : public ModelCommand +{ +public: + ReportTvChannelTvChannelList() : ModelCommand("report") + { + AddArgument("attr-name", "tv-channel-list"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportTvChannelTvChannelList() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0504) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::TvChannelCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport( + void * context, + const chip::app::DataModel::DecodableList & value) + { + LogValue("TvChannel.TvChannelList report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute TvChannelLineup */ @@ -34239,13 +31953,7 @@ class ReportTvChannelTvChannelLineup : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTvChannelTvChannelLineup() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTvChannelTvChannelLineup() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -34254,10 +31962,9 @@ class ReportTvChannelTvChannelLineup : public ModelCommand chip::Controller::TvChannelCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTvChannelLineup(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTvChannelLineup(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -34265,15 +31972,9 @@ class ReportTvChannelTvChannelLineup : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::ByteSpan value) { LogValue("TvChannel.TvChannelLineup report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnOctetStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -34321,13 +32022,7 @@ class ReportTvChannelCurrentTvChannel : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTvChannelCurrentTvChannel() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTvChannelCurrentTvChannel() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -34336,10 +32031,9 @@ class ReportTvChannelCurrentTvChannel : public ModelCommand chip::Controller::TvChannelCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentTvChannel(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentTvChannel(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -34347,15 +32041,9 @@ class ReportTvChannelCurrentTvChannel : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::ByteSpan value) { LogValue("TvChannel.CurrentTvChannel report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnOctetStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -34433,13 +32121,7 @@ class ReportTvChannelClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTvChannelClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTvChannelClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -34448,10 +32130,9 @@ class ReportTvChannelClusterRevision : public ModelCommand chip::Controller::TvChannelCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -34459,15 +32140,9 @@ class ReportTvChannelClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("TvChannel.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -34543,6 +32218,50 @@ class ReadTargetNavigatorTargetNavigatorList : public ModelCommand } }; +class ReportTargetNavigatorTargetNavigatorList : public ModelCommand +{ +public: + ReportTargetNavigatorTargetNavigatorList() : ModelCommand("report") + { + AddArgument("attr-name", "target-navigator-list"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportTargetNavigatorTargetNavigatorList() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0505) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::TargetNavigatorCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::TargetNavigator::Structs::NavigateTargetTargetInfo::DecodableType> & value) + { + LogValue("TargetNavigator.TargetNavigatorList report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute AttributeList */ @@ -34615,13 +32334,7 @@ class ReportTargetNavigatorClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTargetNavigatorClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTargetNavigatorClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -34630,10 +32343,9 @@ class ReportTargetNavigatorClusterRevision : public ModelCommand chip::Controller::TargetNavigatorCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -34641,15 +32353,9 @@ class ReportTargetNavigatorClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("TargetNavigator.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -34711,13 +32417,7 @@ class ReportTemperatureMeasurementMeasuredValue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTemperatureMeasurementMeasuredValue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTemperatureMeasurementMeasuredValue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -34726,10 +32426,9 @@ class ReportTemperatureMeasurementMeasuredValue : public ModelCommand chip::Controller::TemperatureMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMeasuredValue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMeasuredValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -34737,15 +32436,9 @@ class ReportTemperatureMeasurementMeasuredValue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("TemperatureMeasurement.MeasuredValue report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -34793,13 +32486,7 @@ class ReportTemperatureMeasurementMinMeasuredValue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTemperatureMeasurementMinMeasuredValue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTemperatureMeasurementMinMeasuredValue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -34808,10 +32495,9 @@ class ReportTemperatureMeasurementMinMeasuredValue : public ModelCommand chip::Controller::TemperatureMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMinMeasuredValue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMinMeasuredValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -34819,15 +32505,12 @@ class ReportTemperatureMeasurementMinMeasuredValue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) + { + LogValue("TemperatureMeasurement.MinMeasuredValue report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -34875,13 +32558,7 @@ class ReportTemperatureMeasurementMaxMeasuredValue : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTemperatureMeasurementMaxMeasuredValue() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTemperatureMeasurementMaxMeasuredValue() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -34890,10 +32567,9 @@ class ReportTemperatureMeasurementMaxMeasuredValue : public ModelCommand chip::Controller::TemperatureMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMaxMeasuredValue(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMaxMeasuredValue(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -34901,15 +32577,12 @@ class ReportTemperatureMeasurementMaxMeasuredValue : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) + { + LogValue("TemperatureMeasurement.MaxMeasuredValue report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -34957,13 +32630,7 @@ class ReportTemperatureMeasurementTolerance : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTemperatureMeasurementTolerance() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTemperatureMeasurementTolerance() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -34972,10 +32639,9 @@ class ReportTemperatureMeasurementTolerance : public ModelCommand chip::Controller::TemperatureMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTolerance(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTolerance(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -34983,15 +32649,9 @@ class ReportTemperatureMeasurementTolerance : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("TemperatureMeasurement.Tolerance report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -35069,13 +32729,7 @@ class ReportTemperatureMeasurementClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTemperatureMeasurementClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTemperatureMeasurementClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -35084,10 +32738,9 @@ class ReportTemperatureMeasurementClusterRevision : public ModelCommand chip::Controller::TemperatureMeasurementCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -35095,15 +32748,12 @@ class ReportTemperatureMeasurementClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("TemperatureMeasurement.ClusterRevision report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -35672,13 +33322,7 @@ class ReportTestClusterBoolean : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterBoolean() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterBoolean() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -35687,10 +33331,9 @@ class ReportTestClusterBoolean : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeBoolean(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeBoolean(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -35698,15 +33341,9 @@ class ReportTestClusterBoolean : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, bool value) { LogValue("TestCluster.Boolean report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnBooleanAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -35780,13 +33417,7 @@ class ReportTestClusterBitmap8 : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterBitmap8() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterBitmap8() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -35795,10 +33426,9 @@ class ReportTestClusterBitmap8 : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeBitmap8(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeBitmap8(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -35806,15 +33436,9 @@ class ReportTestClusterBitmap8 : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("TestCluster.Bitmap8 report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -35888,13 +33512,7 @@ class ReportTestClusterBitmap16 : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterBitmap16() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterBitmap16() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -35903,10 +33521,9 @@ class ReportTestClusterBitmap16 : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeBitmap16(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeBitmap16(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -35914,15 +33531,9 @@ class ReportTestClusterBitmap16 : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("TestCluster.Bitmap16 report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -35996,13 +33607,7 @@ class ReportTestClusterBitmap32 : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterBitmap32() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterBitmap32() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -36011,10 +33616,9 @@ class ReportTestClusterBitmap32 : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeBitmap32(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeBitmap32(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -36022,15 +33626,9 @@ class ReportTestClusterBitmap32 : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) { LogValue("TestCluster.Bitmap32 report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -36104,13 +33702,7 @@ class ReportTestClusterBitmap64 : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterBitmap64() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterBitmap64() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -36119,10 +33711,9 @@ class ReportTestClusterBitmap64 : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeBitmap64(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeBitmap64(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -36130,15 +33721,9 @@ class ReportTestClusterBitmap64 : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) { LogValue("TestCluster.Bitmap64 report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -36212,13 +33797,7 @@ class ReportTestClusterInt8u : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterInt8u() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterInt8u() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -36227,10 +33806,9 @@ class ReportTestClusterInt8u : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInt8u(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInt8u(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -36238,15 +33816,9 @@ class ReportTestClusterInt8u : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("TestCluster.Int8u report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -36320,13 +33892,7 @@ class ReportTestClusterInt16u : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterInt16u() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterInt16u() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -36335,10 +33901,9 @@ class ReportTestClusterInt16u : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInt16u(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInt16u(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -36346,15 +33911,9 @@ class ReportTestClusterInt16u : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("TestCluster.Int16u report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -36428,13 +33987,7 @@ class ReportTestClusterInt24u : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterInt24u() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterInt24u() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -36443,10 +33996,9 @@ class ReportTestClusterInt24u : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInt24u(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInt24u(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -36454,15 +34006,9 @@ class ReportTestClusterInt24u : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) { LogValue("TestCluster.Int24u report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -36536,13 +34082,7 @@ class ReportTestClusterInt32u : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterInt32u() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterInt32u() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -36551,10 +34091,9 @@ class ReportTestClusterInt32u : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInt32u(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInt32u(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -36562,15 +34101,9 @@ class ReportTestClusterInt32u : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) { LogValue("TestCluster.Int32u report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -36644,13 +34177,7 @@ class ReportTestClusterInt40u : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterInt40u() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterInt40u() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -36659,10 +34186,9 @@ class ReportTestClusterInt40u : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInt40u(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInt40u(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -36670,15 +34196,9 @@ class ReportTestClusterInt40u : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) { LogValue("TestCluster.Int40u report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -36752,13 +34272,7 @@ class ReportTestClusterInt48u : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterInt48u() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterInt48u() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -36767,10 +34281,9 @@ class ReportTestClusterInt48u : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInt48u(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInt48u(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -36778,15 +34291,9 @@ class ReportTestClusterInt48u : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) { LogValue("TestCluster.Int48u report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -36860,13 +34367,7 @@ class ReportTestClusterInt56u : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterInt56u() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterInt56u() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -36875,10 +34376,9 @@ class ReportTestClusterInt56u : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInt56u(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInt56u(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -36886,15 +34386,9 @@ class ReportTestClusterInt56u : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) { LogValue("TestCluster.Int56u report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -36968,13 +34462,7 @@ class ReportTestClusterInt64u : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterInt64u() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterInt64u() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -36983,10 +34471,9 @@ class ReportTestClusterInt64u : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInt64u(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInt64u(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -36994,15 +34481,9 @@ class ReportTestClusterInt64u : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) { LogValue("TestCluster.Int64u report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -37076,13 +34557,7 @@ class ReportTestClusterInt8s : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterInt8s() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterInt8s() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -37091,10 +34566,9 @@ class ReportTestClusterInt8s : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInt8s(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInt8s(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -37102,15 +34576,9 @@ class ReportTestClusterInt8s : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int8_t value) { LogValue("TestCluster.Int8s report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -37184,13 +34652,7 @@ class ReportTestClusterInt16s : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterInt16s() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterInt16s() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -37199,10 +34661,9 @@ class ReportTestClusterInt16s : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInt16s(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInt16s(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -37210,15 +34671,9 @@ class ReportTestClusterInt16s : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("TestCluster.Int16s report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -37292,13 +34747,7 @@ class ReportTestClusterInt24s : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterInt24s() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterInt24s() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -37307,10 +34756,9 @@ class ReportTestClusterInt24s : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInt24s(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInt24s(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -37318,15 +34766,9 @@ class ReportTestClusterInt24s : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int32_t value) { LogValue("TestCluster.Int24s report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -37400,13 +34842,7 @@ class ReportTestClusterInt32s : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterInt32s() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterInt32s() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -37415,10 +34851,9 @@ class ReportTestClusterInt32s : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInt32s(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInt32s(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -37426,15 +34861,9 @@ class ReportTestClusterInt32s : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int32_t value) { LogValue("TestCluster.Int32s report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -37508,13 +34937,7 @@ class ReportTestClusterInt40s : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterInt40s() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterInt40s() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -37523,10 +34946,9 @@ class ReportTestClusterInt40s : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInt40s(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInt40s(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -37534,15 +34956,9 @@ class ReportTestClusterInt40s : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int64_t value) { LogValue("TestCluster.Int40s report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -37616,13 +35032,7 @@ class ReportTestClusterInt48s : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterInt48s() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterInt48s() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -37631,10 +35041,9 @@ class ReportTestClusterInt48s : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInt48s(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInt48s(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -37642,15 +35051,9 @@ class ReportTestClusterInt48s : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int64_t value) { LogValue("TestCluster.Int48s report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -37724,13 +35127,7 @@ class ReportTestClusterInt56s : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterInt56s() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterInt56s() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -37739,10 +35136,9 @@ class ReportTestClusterInt56s : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInt56s(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInt56s(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -37750,15 +35146,9 @@ class ReportTestClusterInt56s : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int64_t value) { LogValue("TestCluster.Int56s report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -37832,13 +35222,7 @@ class ReportTestClusterInt64s : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterInt64s() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterInt64s() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -37847,10 +35231,9 @@ class ReportTestClusterInt64s : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInt64s(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInt64s(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -37858,15 +35241,9 @@ class ReportTestClusterInt64s : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int64_t value) { LogValue("TestCluster.Int64s report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -37940,13 +35317,7 @@ class ReportTestClusterEnum8 : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterEnum8() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterEnum8() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -37955,10 +35326,9 @@ class ReportTestClusterEnum8 : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeEnum8(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeEnum8(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -37966,15 +35336,9 @@ class ReportTestClusterEnum8 : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("TestCluster.Enum8 report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -38048,13 +35412,7 @@ class ReportTestClusterEnum16 : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterEnum16() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterEnum16() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -38063,10 +35421,9 @@ class ReportTestClusterEnum16 : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeEnum16(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeEnum16(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -38074,15 +35431,9 @@ class ReportTestClusterEnum16 : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("TestCluster.Enum16 report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -38156,13 +35507,7 @@ class ReportTestClusterFloatSingle : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterFloatSingle() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterFloatSingle() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -38171,10 +35516,9 @@ class ReportTestClusterFloatSingle : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeFloatSingle(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeFloatSingle(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -38182,15 +35526,9 @@ class ReportTestClusterFloatSingle : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, float value) { LogValue("TestCluster.FloatSingle report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnFloatAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -38264,13 +35602,7 @@ class ReportTestClusterFloatDouble : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterFloatDouble() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterFloatDouble() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -38279,10 +35611,9 @@ class ReportTestClusterFloatDouble : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeFloatDouble(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeFloatDouble(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -38290,15 +35621,9 @@ class ReportTestClusterFloatDouble : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, double value) { LogValue("TestCluster.FloatDouble report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnDoubleAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -38372,13 +35697,7 @@ class ReportTestClusterOctetString : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterOctetString() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterOctetString() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -38387,10 +35706,9 @@ class ReportTestClusterOctetString : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOctetString(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOctetString(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -38398,15 +35716,9 @@ class ReportTestClusterOctetString : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::ByteSpan value) { LogValue("TestCluster.OctetString report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnOctetStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -38442,6 +35754,48 @@ class ReadTestClusterListInt8u : public ModelCommand } }; +class ReportTestClusterListInt8u : public ModelCommand +{ +public: + ReportTestClusterListInt8u() : ModelCommand("report") + { + AddArgument("attr-name", "list-int8u"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportTestClusterListInt8u() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, const chip::app::DataModel::DecodableList & value) + { + LogValue("TestCluster.ListInt8u report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute ListOctetString */ @@ -38472,6 +35826,48 @@ class ReadTestClusterListOctetString : public ModelCommand } }; +class ReportTestClusterListOctetString : public ModelCommand +{ +public: + ReportTestClusterListOctetString() : ModelCommand("report") + { + AddArgument("attr-name", "list-octet-string"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportTestClusterListOctetString() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, const chip::app::DataModel::DecodableList & value) + { + LogValue("TestCluster.ListOctetString report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute ListStructOctetString */ @@ -38505,6 +35901,51 @@ class ReadTestClusterListStructOctetString : public ModelCommand } }; +class ReportTestClusterListStructOctetString : public ModelCommand +{ +public: + ReportTestClusterListStructOctetString() : ModelCommand("report") + { + AddArgument("attr-name", "list-struct-octet-string"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportTestClusterListStructOctetString() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport( + void * context, + const chip::app::DataModel::DecodableList & + value) + { + LogValue("TestCluster.ListStructOctetString report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute LongOctetString */ @@ -38573,13 +36014,7 @@ class ReportTestClusterLongOctetString : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterLongOctetString() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterLongOctetString() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -38588,10 +36023,9 @@ class ReportTestClusterLongOctetString : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeLongOctetString(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeLongOctetString(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -38599,15 +36033,9 @@ class ReportTestClusterLongOctetString : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::ByteSpan value) { LogValue("TestCluster.LongOctetString report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnOctetStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -38681,13 +36109,7 @@ class ReportTestClusterCharString : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterCharString() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterCharString() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -38696,10 +36118,9 @@ class ReportTestClusterCharString : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCharString(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCharString(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -38707,15 +36128,9 @@ class ReportTestClusterCharString : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) { LogValue("TestCluster.CharString report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -38789,13 +36204,7 @@ class ReportTestClusterLongCharString : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterLongCharString() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterLongCharString() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -38804,10 +36213,9 @@ class ReportTestClusterLongCharString : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeLongCharString(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeLongCharString(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -38815,15 +36223,9 @@ class ReportTestClusterLongCharString : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) { LogValue("TestCluster.LongCharString report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -38897,13 +36299,7 @@ class ReportTestClusterEpochUs : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterEpochUs() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterEpochUs() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -38912,10 +36308,9 @@ class ReportTestClusterEpochUs : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeEpochUs(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeEpochUs(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -38923,15 +36318,9 @@ class ReportTestClusterEpochUs : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) { LogValue("TestCluster.EpochUs report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -39005,13 +36394,7 @@ class ReportTestClusterEpochS : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterEpochS() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterEpochS() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -39020,10 +36403,9 @@ class ReportTestClusterEpochS : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeEpochS(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeEpochS(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -39031,15 +36413,9 @@ class ReportTestClusterEpochS : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) { LogValue("TestCluster.EpochS report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -39113,13 +36489,7 @@ class ReportTestClusterVendorId : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterVendorId() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterVendorId() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -39128,10 +36498,9 @@ class ReportTestClusterVendorId : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeVendorId(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeVendorId(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -39139,15 +36508,9 @@ class ReportTestClusterVendorId : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::VendorId value) { LogValue("TestCluster.VendorId report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -39186,6 +36549,50 @@ class ReadTestClusterListNullablesAndOptionalsStruct : public ModelCommand } }; +class ReportTestClusterListNullablesAndOptionalsStruct : public ModelCommand +{ +public: + ReportTestClusterListNullablesAndOptionalsStruct() : ModelCommand("report") + { + AddArgument("attr-name", "list-nullables-and-optionals-struct"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportTestClusterListNullablesAndOptionalsStruct() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x050F) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::TestClusterCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::TestCluster::Structs::NullablesAndOptionalsStruct::DecodableType> & value) + { + LogValue("TestCluster.ListNullablesAndOptionalsStruct report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute EnumAttr */ @@ -39254,13 +36661,7 @@ class ReportTestClusterEnumAttr : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterEnumAttr() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterEnumAttr() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -39269,10 +36670,9 @@ class ReportTestClusterEnumAttr : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeEnumAttr(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeEnumAttr(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -39280,15 +36680,12 @@ class ReportTestClusterEnumAttr : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::app::Clusters::TestCluster::SimpleEnum value) + { + LogValue("TestCluster.EnumAttr report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -39362,13 +36759,7 @@ class ReportTestClusterRangeRestrictedInt8u : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterRangeRestrictedInt8u() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterRangeRestrictedInt8u() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -39377,11 +36768,9 @@ class ReportTestClusterRangeRestrictedInt8u : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRangeRestrictedInt8u(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRangeRestrictedInt8u(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -39389,15 +36778,9 @@ class ReportTestClusterRangeRestrictedInt8u : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("TestCluster.RangeRestrictedInt8u report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -39471,13 +36854,7 @@ class ReportTestClusterRangeRestrictedInt8s : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterRangeRestrictedInt8s() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterRangeRestrictedInt8s() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -39486,11 +36863,9 @@ class ReportTestClusterRangeRestrictedInt8s : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRangeRestrictedInt8s(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRangeRestrictedInt8s(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -39498,15 +36873,9 @@ class ReportTestClusterRangeRestrictedInt8s : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int8_t value) { LogValue("TestCluster.RangeRestrictedInt8s report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -39580,13 +36949,7 @@ class ReportTestClusterRangeRestrictedInt16u : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterRangeRestrictedInt16u() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterRangeRestrictedInt16u() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -39595,11 +36958,9 @@ class ReportTestClusterRangeRestrictedInt16u : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRangeRestrictedInt16u(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRangeRestrictedInt16u(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -39607,15 +36968,9 @@ class ReportTestClusterRangeRestrictedInt16u : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("TestCluster.RangeRestrictedInt16u report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -39689,13 +37044,7 @@ class ReportTestClusterRangeRestrictedInt16s : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterRangeRestrictedInt16s() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterRangeRestrictedInt16s() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -39704,11 +37053,9 @@ class ReportTestClusterRangeRestrictedInt16s : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRangeRestrictedInt16s(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRangeRestrictedInt16s(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -39716,15 +37063,9 @@ class ReportTestClusterRangeRestrictedInt16s : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("TestCluster.RangeRestrictedInt16s report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -39884,13 +37225,7 @@ class ReportTestClusterUnsupported : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterUnsupported() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterUnsupported() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -39899,10 +37234,9 @@ class ReportTestClusterUnsupported : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeUnsupported(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeUnsupported(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -39910,15 +37244,9 @@ class ReportTestClusterUnsupported : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, bool value) { LogValue("TestCluster.Unsupported report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnBooleanAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -39992,13 +37320,7 @@ class ReportTestClusterNullableBoolean : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableBoolean() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableBoolean() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -40007,10 +37329,9 @@ class ReportTestClusterNullableBoolean : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableBoolean(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableBoolean(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -40018,15 +37339,12 @@ class ReportTestClusterNullableBoolean : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableBoolean report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnBooleanAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -40100,13 +37418,7 @@ class ReportTestClusterNullableBitmap8 : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableBitmap8() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableBitmap8() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -40115,10 +37427,9 @@ class ReportTestClusterNullableBitmap8 : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableBitmap8(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableBitmap8(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -40126,15 +37437,12 @@ class ReportTestClusterNullableBitmap8 : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableBitmap8 report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -40208,13 +37516,7 @@ class ReportTestClusterNullableBitmap16 : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableBitmap16() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableBitmap16() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -40223,10 +37525,9 @@ class ReportTestClusterNullableBitmap16 : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableBitmap16(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableBitmap16(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -40234,15 +37535,12 @@ class ReportTestClusterNullableBitmap16 : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableBitmap16 report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -40316,13 +37614,7 @@ class ReportTestClusterNullableBitmap32 : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableBitmap32() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableBitmap32() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -40331,10 +37623,9 @@ class ReportTestClusterNullableBitmap32 : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableBitmap32(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableBitmap32(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -40342,15 +37633,12 @@ class ReportTestClusterNullableBitmap32 : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableBitmap32 report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -40424,13 +37712,7 @@ class ReportTestClusterNullableBitmap64 : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableBitmap64() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableBitmap64() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -40439,10 +37721,9 @@ class ReportTestClusterNullableBitmap64 : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableBitmap64(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableBitmap64(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -40450,15 +37731,12 @@ class ReportTestClusterNullableBitmap64 : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableBitmap64 report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -40532,13 +37810,7 @@ class ReportTestClusterNullableInt8u : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableInt8u() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableInt8u() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -40547,10 +37819,9 @@ class ReportTestClusterNullableInt8u : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableInt8u(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableInt8u(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -40558,15 +37829,12 @@ class ReportTestClusterNullableInt8u : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableInt8u report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -40640,13 +37908,7 @@ class ReportTestClusterNullableInt16u : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableInt16u() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableInt16u() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -40655,10 +37917,9 @@ class ReportTestClusterNullableInt16u : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableInt16u(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableInt16u(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -40666,15 +37927,12 @@ class ReportTestClusterNullableInt16u : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableInt16u report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -40748,13 +38006,7 @@ class ReportTestClusterNullableInt24u : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableInt24u() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableInt24u() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -40763,10 +38015,9 @@ class ReportTestClusterNullableInt24u : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableInt24u(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableInt24u(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -40774,15 +38025,12 @@ class ReportTestClusterNullableInt24u : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableInt24u report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -40856,13 +38104,7 @@ class ReportTestClusterNullableInt32u : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableInt32u() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableInt32u() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -40871,10 +38113,9 @@ class ReportTestClusterNullableInt32u : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableInt32u(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableInt32u(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -40882,15 +38123,12 @@ class ReportTestClusterNullableInt32u : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableInt32u report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -40964,13 +38202,7 @@ class ReportTestClusterNullableInt40u : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableInt40u() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableInt40u() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -40979,10 +38211,9 @@ class ReportTestClusterNullableInt40u : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableInt40u(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableInt40u(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -40990,15 +38221,12 @@ class ReportTestClusterNullableInt40u : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableInt40u report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -41072,13 +38300,7 @@ class ReportTestClusterNullableInt48u : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableInt48u() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableInt48u() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -41087,10 +38309,9 @@ class ReportTestClusterNullableInt48u : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableInt48u(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableInt48u(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -41098,15 +38319,12 @@ class ReportTestClusterNullableInt48u : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableInt48u report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -41180,13 +38398,7 @@ class ReportTestClusterNullableInt56u : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableInt56u() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableInt56u() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -41195,10 +38407,9 @@ class ReportTestClusterNullableInt56u : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableInt56u(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableInt56u(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -41206,15 +38417,12 @@ class ReportTestClusterNullableInt56u : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableInt56u report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -41288,13 +38496,7 @@ class ReportTestClusterNullableInt64u : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableInt64u() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableInt64u() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -41303,10 +38505,9 @@ class ReportTestClusterNullableInt64u : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableInt64u(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableInt64u(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -41314,15 +38515,12 @@ class ReportTestClusterNullableInt64u : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableInt64u report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -41396,13 +38594,7 @@ class ReportTestClusterNullableInt8s : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableInt8s() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableInt8s() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -41411,10 +38603,9 @@ class ReportTestClusterNullableInt8s : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableInt8s(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableInt8s(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -41422,15 +38613,12 @@ class ReportTestClusterNullableInt8s : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableInt8s report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -41504,13 +38692,7 @@ class ReportTestClusterNullableInt16s : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableInt16s() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableInt16s() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -41519,10 +38701,9 @@ class ReportTestClusterNullableInt16s : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableInt16s(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableInt16s(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -41530,15 +38711,12 @@ class ReportTestClusterNullableInt16s : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableInt16s report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -41612,13 +38790,7 @@ class ReportTestClusterNullableInt24s : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableInt24s() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableInt24s() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -41627,10 +38799,9 @@ class ReportTestClusterNullableInt24s : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableInt24s(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableInt24s(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -41638,15 +38809,12 @@ class ReportTestClusterNullableInt24s : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableInt24s report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -41720,13 +38888,7 @@ class ReportTestClusterNullableInt32s : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableInt32s() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableInt32s() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -41735,10 +38897,9 @@ class ReportTestClusterNullableInt32s : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableInt32s(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableInt32s(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -41746,15 +38907,12 @@ class ReportTestClusterNullableInt32s : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableInt32s report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -41828,13 +38986,7 @@ class ReportTestClusterNullableInt40s : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableInt40s() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableInt40s() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -41843,10 +38995,9 @@ class ReportTestClusterNullableInt40s : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableInt40s(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableInt40s(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -41854,15 +39005,12 @@ class ReportTestClusterNullableInt40s : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableInt40s report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -41936,13 +39084,7 @@ class ReportTestClusterNullableInt48s : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableInt48s() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableInt48s() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -41951,10 +39093,9 @@ class ReportTestClusterNullableInt48s : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableInt48s(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableInt48s(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -41962,15 +39103,12 @@ class ReportTestClusterNullableInt48s : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableInt48s report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -42044,13 +39182,7 @@ class ReportTestClusterNullableInt56s : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableInt56s() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableInt56s() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -42059,10 +39191,9 @@ class ReportTestClusterNullableInt56s : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableInt56s(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableInt56s(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -42070,15 +39201,12 @@ class ReportTestClusterNullableInt56s : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableInt56s report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -42152,13 +39280,7 @@ class ReportTestClusterNullableInt64s : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableInt64s() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableInt64s() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -42167,10 +39289,9 @@ class ReportTestClusterNullableInt64s : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableInt64s(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableInt64s(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -42178,15 +39299,12 @@ class ReportTestClusterNullableInt64s : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableInt64s report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -42260,13 +39378,7 @@ class ReportTestClusterNullableEnum8 : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableEnum8() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableEnum8() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -42275,10 +39387,9 @@ class ReportTestClusterNullableEnum8 : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableEnum8(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableEnum8(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -42286,15 +39397,12 @@ class ReportTestClusterNullableEnum8 : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableEnum8 report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -42368,13 +39476,7 @@ class ReportTestClusterNullableEnum16 : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableEnum16() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableEnum16() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -42383,10 +39485,9 @@ class ReportTestClusterNullableEnum16 : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableEnum16(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableEnum16(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -42394,15 +39495,12 @@ class ReportTestClusterNullableEnum16 : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableEnum16 report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -42476,13 +39574,7 @@ class ReportTestClusterNullableFloatSingle : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableFloatSingle() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableFloatSingle() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -42491,11 +39583,9 @@ class ReportTestClusterNullableFloatSingle : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableFloatSingle(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableFloatSingle(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -42503,15 +39593,12 @@ class ReportTestClusterNullableFloatSingle : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableFloatSingle report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnFloatAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -42585,13 +39672,7 @@ class ReportTestClusterNullableFloatDouble : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableFloatDouble() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableFloatDouble() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -42600,11 +39681,9 @@ class ReportTestClusterNullableFloatDouble : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableFloatDouble(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableFloatDouble(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -42612,15 +39691,12 @@ class ReportTestClusterNullableFloatDouble : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableFloatDouble report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnDoubleAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -42694,13 +39770,7 @@ class ReportTestClusterNullableOctetString : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableOctetString() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableOctetString() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -42709,11 +39779,9 @@ class ReportTestClusterNullableOctetString : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableOctetString(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableOctetString(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -42721,15 +39789,12 @@ class ReportTestClusterNullableOctetString : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableOctetString report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnOctetStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -42803,13 +39868,7 @@ class ReportTestClusterNullableCharString : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableCharString() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableCharString() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -42818,11 +39877,9 @@ class ReportTestClusterNullableCharString : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableCharString(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableCharString(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -42830,15 +39887,12 @@ class ReportTestClusterNullableCharString : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableCharString report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -42913,13 +39967,7 @@ class ReportTestClusterNullableEnumAttr : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableEnumAttr() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableEnumAttr() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -42928,10 +39976,9 @@ class ReportTestClusterNullableEnumAttr : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableEnumAttr(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableEnumAttr(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -42939,15 +39986,13 @@ class ReportTestClusterNullableEnumAttr : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, + const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableEnumAttr report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -43021,13 +40066,7 @@ class ReportTestClusterNullableRangeRestrictedInt8u : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableRangeRestrictedInt8u() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableRangeRestrictedInt8u() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -43036,11 +40075,9 @@ class ReportTestClusterNullableRangeRestrictedInt8u : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableRangeRestrictedInt8u(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableRangeRestrictedInt8u(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -43048,15 +40085,12 @@ class ReportTestClusterNullableRangeRestrictedInt8u : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableRangeRestrictedInt8u report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -43130,13 +40164,7 @@ class ReportTestClusterNullableRangeRestrictedInt8s : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableRangeRestrictedInt8s() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableRangeRestrictedInt8s() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -43145,11 +40173,9 @@ class ReportTestClusterNullableRangeRestrictedInt8s : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableRangeRestrictedInt8s(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableRangeRestrictedInt8s(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -43157,15 +40183,12 @@ class ReportTestClusterNullableRangeRestrictedInt8s : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableRangeRestrictedInt8s report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -43239,13 +40262,7 @@ class ReportTestClusterNullableRangeRestrictedInt16u : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableRangeRestrictedInt16u() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableRangeRestrictedInt16u() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -43254,11 +40271,9 @@ class ReportTestClusterNullableRangeRestrictedInt16u : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableRangeRestrictedInt16u(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableRangeRestrictedInt16u(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -43266,15 +40281,12 @@ class ReportTestClusterNullableRangeRestrictedInt16u : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableRangeRestrictedInt16u report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -43348,13 +40360,7 @@ class ReportTestClusterNullableRangeRestrictedInt16s : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterNullableRangeRestrictedInt16s() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterNullableRangeRestrictedInt16s() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -43363,11 +40369,9 @@ class ReportTestClusterNullableRangeRestrictedInt16s : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNullableRangeRestrictedInt16s(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNullableRangeRestrictedInt16s(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -43375,15 +40379,12 @@ class ReportTestClusterNullableRangeRestrictedInt16s : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, const chip::app::DataModel::Nullable & value) + { + LogValue("TestCluster.NullableRangeRestrictedInt16s report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -43461,13 +40462,7 @@ class ReportTestClusterClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportTestClusterClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportTestClusterClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -43476,10 +40471,9 @@ class ReportTestClusterClusterRevision : public ModelCommand chip::Controller::TestClusterCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -43487,15 +40481,9 @@ class ReportTestClusterClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("TestCluster.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -43700,13 +40688,7 @@ class ReportThermostatLocalTemperature : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThermostatLocalTemperature() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatLocalTemperature() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -43715,10 +40697,9 @@ class ReportThermostatLocalTemperature : public ModelCommand chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeLocalTemperature(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeLocalTemperature(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -43726,15 +40707,9 @@ class ReportThermostatLocalTemperature : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("Thermostat.LocalTemperature report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -43782,13 +40757,7 @@ class ReportThermostatAbsMinHeatSetpointLimit : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThermostatAbsMinHeatSetpointLimit() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatAbsMinHeatSetpointLimit() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -43797,11 +40766,9 @@ class ReportThermostatAbsMinHeatSetpointLimit : public ModelCommand chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeAbsMinHeatSetpointLimit(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeAbsMinHeatSetpointLimit(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -43809,15 +40776,9 @@ class ReportThermostatAbsMinHeatSetpointLimit : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("Thermostat.AbsMinHeatSetpointLimit report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -43865,13 +40826,7 @@ class ReportThermostatAbsMaxHeatSetpointLimit : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThermostatAbsMaxHeatSetpointLimit() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatAbsMaxHeatSetpointLimit() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -43880,11 +40835,9 @@ class ReportThermostatAbsMaxHeatSetpointLimit : public ModelCommand chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeAbsMaxHeatSetpointLimit(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeAbsMaxHeatSetpointLimit(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -43892,15 +40845,9 @@ class ReportThermostatAbsMaxHeatSetpointLimit : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("Thermostat.AbsMaxHeatSetpointLimit report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -43948,13 +40895,7 @@ class ReportThermostatAbsMinCoolSetpointLimit : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThermostatAbsMinCoolSetpointLimit() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatAbsMinCoolSetpointLimit() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -43963,11 +40904,9 @@ class ReportThermostatAbsMinCoolSetpointLimit : public ModelCommand chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeAbsMinCoolSetpointLimit(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeAbsMinCoolSetpointLimit(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -43975,15 +40914,9 @@ class ReportThermostatAbsMinCoolSetpointLimit : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("Thermostat.AbsMinCoolSetpointLimit report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -44031,13 +40964,7 @@ class ReportThermostatAbsMaxCoolSetpointLimit : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThermostatAbsMaxCoolSetpointLimit() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatAbsMaxCoolSetpointLimit() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -44046,11 +40973,9 @@ class ReportThermostatAbsMaxCoolSetpointLimit : public ModelCommand chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeAbsMaxCoolSetpointLimit(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeAbsMaxCoolSetpointLimit(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -44058,15 +40983,9 @@ class ReportThermostatAbsMaxCoolSetpointLimit : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("Thermostat.AbsMaxCoolSetpointLimit report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -44140,13 +41059,7 @@ class ReportThermostatOccupiedCoolingSetpoint : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThermostatOccupiedCoolingSetpoint() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatOccupiedCoolingSetpoint() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -44155,11 +41068,9 @@ class ReportThermostatOccupiedCoolingSetpoint : public ModelCommand chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOccupiedCoolingSetpoint(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOccupiedCoolingSetpoint(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -44167,15 +41078,9 @@ class ReportThermostatOccupiedCoolingSetpoint : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("Thermostat.OccupiedCoolingSetpoint report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -44249,13 +41154,7 @@ class ReportThermostatOccupiedHeatingSetpoint : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThermostatOccupiedHeatingSetpoint() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatOccupiedHeatingSetpoint() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -44264,11 +41163,9 @@ class ReportThermostatOccupiedHeatingSetpoint : public ModelCommand chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOccupiedHeatingSetpoint(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOccupiedHeatingSetpoint(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -44276,15 +41173,9 @@ class ReportThermostatOccupiedHeatingSetpoint : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("Thermostat.OccupiedHeatingSetpoint report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -44358,13 +41249,7 @@ class ReportThermostatMinHeatSetpointLimit : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThermostatMinHeatSetpointLimit() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatMinHeatSetpointLimit() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -44373,11 +41258,9 @@ class ReportThermostatMinHeatSetpointLimit : public ModelCommand chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMinHeatSetpointLimit(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMinHeatSetpointLimit(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -44385,15 +41268,9 @@ class ReportThermostatMinHeatSetpointLimit : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("Thermostat.MinHeatSetpointLimit report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -44467,13 +41344,7 @@ class ReportThermostatMaxHeatSetpointLimit : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThermostatMaxHeatSetpointLimit() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatMaxHeatSetpointLimit() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -44482,11 +41353,9 @@ class ReportThermostatMaxHeatSetpointLimit : public ModelCommand chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMaxHeatSetpointLimit(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMaxHeatSetpointLimit(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -44494,15 +41363,9 @@ class ReportThermostatMaxHeatSetpointLimit : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("Thermostat.MaxHeatSetpointLimit report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -44576,13 +41439,7 @@ class ReportThermostatMinCoolSetpointLimit : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThermostatMinCoolSetpointLimit() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatMinCoolSetpointLimit() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -44591,11 +41448,9 @@ class ReportThermostatMinCoolSetpointLimit : public ModelCommand chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMinCoolSetpointLimit(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMinCoolSetpointLimit(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -44603,15 +41458,9 @@ class ReportThermostatMinCoolSetpointLimit : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("Thermostat.MinCoolSetpointLimit report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -44685,13 +41534,7 @@ class ReportThermostatMaxCoolSetpointLimit : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThermostatMaxCoolSetpointLimit() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatMaxCoolSetpointLimit() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -44700,11 +41543,9 @@ class ReportThermostatMaxCoolSetpointLimit : public ModelCommand chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMaxCoolSetpointLimit(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMaxCoolSetpointLimit(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -44712,15 +41553,9 @@ class ReportThermostatMaxCoolSetpointLimit : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int16_t value) { LogValue("Thermostat.MaxCoolSetpointLimit report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -44794,13 +41629,7 @@ class ReportThermostatMinSetpointDeadBand : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThermostatMinSetpointDeadBand() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatMinSetpointDeadBand() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -44809,11 +41638,9 @@ class ReportThermostatMinSetpointDeadBand : public ModelCommand chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMinSetpointDeadBand(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMinSetpointDeadBand(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -44821,15 +41648,9 @@ class ReportThermostatMinSetpointDeadBand : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int8_t value) { LogValue("Thermostat.MinSetpointDeadBand report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -44903,13 +41724,7 @@ class ReportThermostatControlSequenceOfOperation : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThermostatControlSequenceOfOperation() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatControlSequenceOfOperation() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -44918,11 +41733,9 @@ class ReportThermostatControlSequenceOfOperation : public ModelCommand chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeControlSequenceOfOperation(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeControlSequenceOfOperation(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -44930,15 +41743,9 @@ class ReportThermostatControlSequenceOfOperation : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("Thermostat.ControlSequenceOfOperation report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -45012,13 +41819,7 @@ class ReportThermostatSystemMode : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThermostatSystemMode() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatSystemMode() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -45027,10 +41828,9 @@ class ReportThermostatSystemMode : public ModelCommand chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeSystemMode(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeSystemMode(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -45038,15 +41838,9 @@ class ReportThermostatSystemMode : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("Thermostat.SystemMode report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -45094,13 +41888,7 @@ class ReportThermostatStartOfWeek : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThermostatStartOfWeek() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatStartOfWeek() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -45109,10 +41897,9 @@ class ReportThermostatStartOfWeek : public ModelCommand chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeStartOfWeek(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeStartOfWeek(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -45120,15 +41907,9 @@ class ReportThermostatStartOfWeek : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("Thermostat.StartOfWeek report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -45176,13 +41957,7 @@ class ReportThermostatNumberOfWeeklyTransitions : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThermostatNumberOfWeeklyTransitions() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatNumberOfWeeklyTransitions() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -45191,11 +41966,9 @@ class ReportThermostatNumberOfWeeklyTransitions : public ModelCommand chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNumberOfWeeklyTransitions(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNumberOfWeeklyTransitions(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -45203,15 +41976,9 @@ class ReportThermostatNumberOfWeeklyTransitions : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("Thermostat.NumberOfWeeklyTransitions report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -45259,13 +42026,7 @@ class ReportThermostatNumberOfDailyTransitions : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThermostatNumberOfDailyTransitions() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatNumberOfDailyTransitions() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -45274,11 +42035,9 @@ class ReportThermostatNumberOfDailyTransitions : public ModelCommand chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNumberOfDailyTransitions(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNumberOfDailyTransitions(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -45286,15 +42045,9 @@ class ReportThermostatNumberOfDailyTransitions : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("Thermostat.NumberOfDailyTransitions report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -45372,13 +42125,7 @@ class ReportThermostatFeatureMap : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThermostatFeatureMap() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatFeatureMap() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -45387,10 +42134,9 @@ class ReportThermostatFeatureMap : public ModelCommand chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeFeatureMap(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeFeatureMap(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -45398,15 +42144,9 @@ class ReportThermostatFeatureMap : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) { LogValue("Thermostat.FeatureMap report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -45454,13 +42194,7 @@ class ReportThermostatClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThermostatClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -45469,10 +42203,9 @@ class ReportThermostatClusterRevision : public ModelCommand chip::Controller::ThermostatCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -45480,15 +42213,9 @@ class ReportThermostatClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("Thermostat.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -45577,13 +42304,7 @@ class ReportThermostatUserInterfaceConfigurationTemperatureDisplayMode : public ModelCommand::AddArguments(); } - ~ReportThermostatUserInterfaceConfigurationTemperatureDisplayMode() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatUserInterfaceConfigurationTemperatureDisplayMode() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -45592,11 +42313,10 @@ class ReportThermostatUserInterfaceConfigurationTemperatureDisplayMode : public chip::Controller::ThermostatUserInterfaceConfigurationCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTemperatureDisplayMode(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTemperatureDisplayMode(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute< + chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::TypeInfo>( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -45604,15 +42324,12 @@ class ReportThermostatUserInterfaceConfigurationTemperatureDisplayMode : public return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) + { + LogValue("ThermostatUserInterfaceConfiguration.TemperatureDisplayMode report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -45688,13 +42405,7 @@ class ReportThermostatUserInterfaceConfigurationKeypadLockout : public ModelComm ModelCommand::AddArguments(); } - ~ReportThermostatUserInterfaceConfigurationKeypadLockout() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatUserInterfaceConfigurationKeypadLockout() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -45703,10 +42414,10 @@ class ReportThermostatUserInterfaceConfigurationKeypadLockout : public ModelComm chip::Controller::ThermostatUserInterfaceConfigurationCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeKeypadLockout(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeKeypadLockout(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -45714,15 +42425,12 @@ class ReportThermostatUserInterfaceConfigurationKeypadLockout : public ModelComm return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) + { + LogValue("ThermostatUserInterfaceConfiguration.KeypadLockout report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -45798,13 +42506,7 @@ class ReportThermostatUserInterfaceConfigurationScheduleProgrammingVisibility : ModelCommand::AddArguments(); } - ~ReportThermostatUserInterfaceConfigurationScheduleProgrammingVisibility() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatUserInterfaceConfigurationScheduleProgrammingVisibility() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -45813,11 +42515,10 @@ class ReportThermostatUserInterfaceConfigurationScheduleProgrammingVisibility : chip::Controller::ThermostatUserInterfaceConfigurationCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeScheduleProgrammingVisibility(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeScheduleProgrammingVisibility(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute< + chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::TypeInfo>( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -45825,15 +42526,12 @@ class ReportThermostatUserInterfaceConfigurationScheduleProgrammingVisibility : return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) + { + LogValue("ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -45913,13 +42611,7 @@ class ReportThermostatUserInterfaceConfigurationClusterRevision : public ModelCo ModelCommand::AddArguments(); } - ~ReportThermostatUserInterfaceConfigurationClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThermostatUserInterfaceConfigurationClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -45928,10 +42620,10 @@ class ReportThermostatUserInterfaceConfigurationClusterRevision : public ModelCo chip::Controller::ThermostatUserInterfaceConfigurationCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -45939,15 +42631,12 @@ class ReportThermostatUserInterfaceConfigurationClusterRevision : public ModelCo return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("ThermostatUserInterfaceConfiguration.ClusterRevision report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -46090,13 +42779,7 @@ class ReportThreadNetworkDiagnosticsChannel : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsChannel() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsChannel() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -46105,10 +42788,9 @@ class ReportThreadNetworkDiagnosticsChannel : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeChannel(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeChannel(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -46116,15 +42798,9 @@ class ReportThreadNetworkDiagnosticsChannel : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ThreadNetworkDiagnostics.Channel report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -46172,13 +42848,7 @@ class ReportThreadNetworkDiagnosticsRoutingRole : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsRoutingRole() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsRoutingRole() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -46187,10 +42857,9 @@ class ReportThreadNetworkDiagnosticsRoutingRole : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRoutingRole(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRoutingRole(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -46198,15 +42867,9 @@ class ReportThreadNetworkDiagnosticsRoutingRole : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ThreadNetworkDiagnostics.RoutingRole report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -46254,13 +42917,7 @@ class ReportThreadNetworkDiagnosticsNetworkName : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsNetworkName() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsNetworkName() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -46269,10 +42926,9 @@ class ReportThreadNetworkDiagnosticsNetworkName : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeNetworkName(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeNetworkName(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -46280,15 +42936,12 @@ class ReportThreadNetworkDiagnosticsNetworkName : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::ByteSpan value) + { + LogValue("ThreadNetworkDiagnostics.NetworkName report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnOctetStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -46336,13 +42989,7 @@ class ReportThreadNetworkDiagnosticsPanId : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsPanId() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsPanId() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -46351,10 +42998,9 @@ class ReportThreadNetworkDiagnosticsPanId : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePanId(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePanId(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -46362,15 +43008,9 @@ class ReportThreadNetworkDiagnosticsPanId : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("ThreadNetworkDiagnostics.PanId report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -46418,13 +43058,7 @@ class ReportThreadNetworkDiagnosticsExtendedPanId : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsExtendedPanId() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsExtendedPanId() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -46433,10 +43067,9 @@ class ReportThreadNetworkDiagnosticsExtendedPanId : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeExtendedPanId(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeExtendedPanId(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -46444,15 +43077,12 @@ class ReportThreadNetworkDiagnosticsExtendedPanId : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) + { + LogValue("ThreadNetworkDiagnostics.ExtendedPanId report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -46500,13 +43130,7 @@ class ReportThreadNetworkDiagnosticsMeshLocalPrefix : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsMeshLocalPrefix() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsMeshLocalPrefix() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -46515,10 +43139,9 @@ class ReportThreadNetworkDiagnosticsMeshLocalPrefix : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMeshLocalPrefix(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMeshLocalPrefix(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -46526,15 +43149,12 @@ class ReportThreadNetworkDiagnosticsMeshLocalPrefix : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::ByteSpan value) + { + LogValue("ThreadNetworkDiagnostics.MeshLocalPrefix report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnOctetStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -46582,13 +43202,7 @@ class ReportThreadNetworkDiagnosticsOverrunCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsOverrunCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsOverrunCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -46597,10 +43211,9 @@ class ReportThreadNetworkDiagnosticsOverrunCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOverrunCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOverrunCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -46608,15 +43221,12 @@ class ReportThreadNetworkDiagnosticsOverrunCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) + { + LogValue("ThreadNetworkDiagnostics.OverrunCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -46655,6 +43265,50 @@ class ReadThreadNetworkDiagnosticsNeighborTableList : public ModelCommand } }; +class ReportThreadNetworkDiagnosticsNeighborTableList : public ModelCommand +{ +public: + ReportThreadNetworkDiagnosticsNeighborTableList() : ModelCommand("report") + { + AddArgument("attr-name", "neighbor-table-list"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportThreadNetworkDiagnosticsNeighborTableList() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0035) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::ThreadNetworkDiagnosticsCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::ThreadNetworkDiagnostics::Structs::NeighborTable::DecodableType> & value) + { + LogValue("ThreadNetworkDiagnostics.NeighborTableList report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute RouteTableList */ @@ -46687,6 +43341,50 @@ class ReadThreadNetworkDiagnosticsRouteTableList : public ModelCommand } }; +class ReportThreadNetworkDiagnosticsRouteTableList : public ModelCommand +{ +public: + ReportThreadNetworkDiagnosticsRouteTableList() : ModelCommand("report") + { + AddArgument("attr-name", "route-table-list"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportThreadNetworkDiagnosticsRouteTableList() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0035) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::ThreadNetworkDiagnosticsCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::ThreadNetworkDiagnostics::Structs::RouteTable::DecodableType> & value) + { + LogValue("ThreadNetworkDiagnostics.RouteTableList report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute PartitionId */ @@ -46729,13 +43427,7 @@ class ReportThreadNetworkDiagnosticsPartitionId : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsPartitionId() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsPartitionId() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -46744,10 +43436,9 @@ class ReportThreadNetworkDiagnosticsPartitionId : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePartitionId(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePartitionId(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -46755,15 +43446,9 @@ class ReportThreadNetworkDiagnosticsPartitionId : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) { LogValue("ThreadNetworkDiagnostics.PartitionId report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -46811,13 +43496,7 @@ class ReportThreadNetworkDiagnosticsWeighting : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsWeighting() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsWeighting() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -46826,10 +43505,9 @@ class ReportThreadNetworkDiagnosticsWeighting : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeWeighting(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeWeighting(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -46837,15 +43515,9 @@ class ReportThreadNetworkDiagnosticsWeighting : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ThreadNetworkDiagnostics.Weighting report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -46893,13 +43565,7 @@ class ReportThreadNetworkDiagnosticsDataVersion : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsDataVersion() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsDataVersion() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -46908,10 +43574,9 @@ class ReportThreadNetworkDiagnosticsDataVersion : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeDataVersion(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeDataVersion(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -46919,15 +43584,9 @@ class ReportThreadNetworkDiagnosticsDataVersion : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("ThreadNetworkDiagnostics.DataVersion report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -46975,13 +43634,7 @@ class ReportThreadNetworkDiagnosticsStableDataVersion : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsStableDataVersion() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsStableDataVersion() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -46990,11 +43643,9 @@ class ReportThreadNetworkDiagnosticsStableDataVersion : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeStableDataVersion(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeStableDataVersion(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -47002,15 +43653,12 @@ class ReportThreadNetworkDiagnosticsStableDataVersion : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) + { + LogValue("ThreadNetworkDiagnostics.StableDataVersion report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -47058,13 +43706,7 @@ class ReportThreadNetworkDiagnosticsLeaderRouterId : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsLeaderRouterId() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsLeaderRouterId() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -47073,10 +43715,9 @@ class ReportThreadNetworkDiagnosticsLeaderRouterId : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeLeaderRouterId(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeLeaderRouterId(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -47084,15 +43725,12 @@ class ReportThreadNetworkDiagnosticsLeaderRouterId : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) + { + LogValue("ThreadNetworkDiagnostics.LeaderRouterId report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -47140,13 +43778,7 @@ class ReportThreadNetworkDiagnosticsDetachedRoleCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsDetachedRoleCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsDetachedRoleCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -47155,11 +43787,9 @@ class ReportThreadNetworkDiagnosticsDetachedRoleCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeDetachedRoleCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeDetachedRoleCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -47167,15 +43797,12 @@ class ReportThreadNetworkDiagnosticsDetachedRoleCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("ThreadNetworkDiagnostics.DetachedRoleCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -47223,13 +43850,7 @@ class ReportThreadNetworkDiagnosticsChildRoleCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsChildRoleCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsChildRoleCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -47238,10 +43859,9 @@ class ReportThreadNetworkDiagnosticsChildRoleCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeChildRoleCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeChildRoleCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -47249,15 +43869,12 @@ class ReportThreadNetworkDiagnosticsChildRoleCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("ThreadNetworkDiagnostics.ChildRoleCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -47305,13 +43922,7 @@ class ReportThreadNetworkDiagnosticsRouterRoleCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsRouterRoleCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsRouterRoleCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -47320,10 +43931,9 @@ class ReportThreadNetworkDiagnosticsRouterRoleCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRouterRoleCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRouterRoleCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -47331,15 +43941,12 @@ class ReportThreadNetworkDiagnosticsRouterRoleCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("ThreadNetworkDiagnostics.RouterRoleCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -47387,13 +43994,7 @@ class ReportThreadNetworkDiagnosticsLeaderRoleCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsLeaderRoleCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsLeaderRoleCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -47402,10 +44003,9 @@ class ReportThreadNetworkDiagnosticsLeaderRoleCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeLeaderRoleCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeLeaderRoleCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -47413,15 +44013,12 @@ class ReportThreadNetworkDiagnosticsLeaderRoleCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("ThreadNetworkDiagnostics.LeaderRoleCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -47469,13 +44066,7 @@ class ReportThreadNetworkDiagnosticsAttachAttemptCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsAttachAttemptCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsAttachAttemptCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -47484,11 +44075,9 @@ class ReportThreadNetworkDiagnosticsAttachAttemptCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeAttachAttemptCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeAttachAttemptCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -47496,15 +44085,12 @@ class ReportThreadNetworkDiagnosticsAttachAttemptCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("ThreadNetworkDiagnostics.AttachAttemptCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -47552,13 +44138,7 @@ class ReportThreadNetworkDiagnosticsPartitionIdChangeCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsPartitionIdChangeCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsPartitionIdChangeCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -47567,11 +44147,10 @@ class ReportThreadNetworkDiagnosticsPartitionIdChangeCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePartitionIdChangeCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePartitionIdChangeCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -47579,15 +44158,12 @@ class ReportThreadNetworkDiagnosticsPartitionIdChangeCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("ThreadNetworkDiagnostics.PartitionIdChangeCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -47636,13 +44212,7 @@ class ReportThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount : public M ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -47651,11 +44221,10 @@ class ReportThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount : public M chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeBetterPartitionAttachAttemptCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeBetterPartitionAttachAttemptCount(successCallback, onFailureCallback->Cancel(), - mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute< + chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::BetterPartitionAttachAttemptCount::TypeInfo>( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -47663,15 +44232,12 @@ class ReportThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount : public M return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("ThreadNetworkDiagnostics.BetterPartitionAttachAttemptCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -47719,13 +44285,7 @@ class ReportThreadNetworkDiagnosticsParentChangeCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsParentChangeCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsParentChangeCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -47734,11 +44294,9 @@ class ReportThreadNetworkDiagnosticsParentChangeCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeParentChangeCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeParentChangeCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -47746,15 +44304,12 @@ class ReportThreadNetworkDiagnosticsParentChangeCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("ThreadNetworkDiagnostics.ParentChangeCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -47802,13 +44357,7 @@ class ReportThreadNetworkDiagnosticsTxTotalCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsTxTotalCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsTxTotalCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -47817,10 +44366,9 @@ class ReportThreadNetworkDiagnosticsTxTotalCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTxTotalCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTxTotalCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -47828,15 +44376,12 @@ class ReportThreadNetworkDiagnosticsTxTotalCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.TxTotalCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -47884,13 +44429,7 @@ class ReportThreadNetworkDiagnosticsTxUnicastCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsTxUnicastCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsTxUnicastCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -47899,10 +44438,9 @@ class ReportThreadNetworkDiagnosticsTxUnicastCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTxUnicastCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTxUnicastCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -47910,15 +44448,12 @@ class ReportThreadNetworkDiagnosticsTxUnicastCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.TxUnicastCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -47966,13 +44501,7 @@ class ReportThreadNetworkDiagnosticsTxBroadcastCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsTxBroadcastCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsTxBroadcastCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -47981,10 +44510,9 @@ class ReportThreadNetworkDiagnosticsTxBroadcastCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTxBroadcastCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTxBroadcastCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -47992,15 +44520,12 @@ class ReportThreadNetworkDiagnosticsTxBroadcastCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.TxBroadcastCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -48048,13 +44573,7 @@ class ReportThreadNetworkDiagnosticsTxAckRequestedCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsTxAckRequestedCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsTxAckRequestedCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -48063,11 +44582,9 @@ class ReportThreadNetworkDiagnosticsTxAckRequestedCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTxAckRequestedCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTxAckRequestedCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -48075,15 +44592,12 @@ class ReportThreadNetworkDiagnosticsTxAckRequestedCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.TxAckRequestedCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -48131,13 +44645,7 @@ class ReportThreadNetworkDiagnosticsTxAckedCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsTxAckedCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsTxAckedCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -48146,10 +44654,9 @@ class ReportThreadNetworkDiagnosticsTxAckedCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTxAckedCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTxAckedCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -48157,15 +44664,12 @@ class ReportThreadNetworkDiagnosticsTxAckedCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.TxAckedCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -48213,13 +44717,7 @@ class ReportThreadNetworkDiagnosticsTxNoAckRequestedCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsTxNoAckRequestedCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsTxNoAckRequestedCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -48228,11 +44726,10 @@ class ReportThreadNetworkDiagnosticsTxNoAckRequestedCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTxNoAckRequestedCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTxNoAckRequestedCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -48240,15 +44737,12 @@ class ReportThreadNetworkDiagnosticsTxNoAckRequestedCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.TxNoAckRequestedCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -48296,13 +44790,7 @@ class ReportThreadNetworkDiagnosticsTxDataCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsTxDataCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsTxDataCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -48311,10 +44799,9 @@ class ReportThreadNetworkDiagnosticsTxDataCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTxDataCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTxDataCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -48322,15 +44809,9 @@ class ReportThreadNetworkDiagnosticsTxDataCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) { LogValue("ThreadNetworkDiagnostics.TxDataCount report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -48378,13 +44859,7 @@ class ReportThreadNetworkDiagnosticsTxDataPollCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsTxDataPollCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsTxDataPollCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -48393,10 +44868,9 @@ class ReportThreadNetworkDiagnosticsTxDataPollCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTxDataPollCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTxDataPollCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -48404,15 +44878,12 @@ class ReportThreadNetworkDiagnosticsTxDataPollCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.TxDataPollCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -48460,13 +44931,7 @@ class ReportThreadNetworkDiagnosticsTxBeaconCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsTxBeaconCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsTxBeaconCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -48475,10 +44940,9 @@ class ReportThreadNetworkDiagnosticsTxBeaconCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTxBeaconCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTxBeaconCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -48486,15 +44950,12 @@ class ReportThreadNetworkDiagnosticsTxBeaconCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.TxBeaconCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -48542,13 +45003,7 @@ class ReportThreadNetworkDiagnosticsTxBeaconRequestCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsTxBeaconRequestCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsTxBeaconRequestCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -48557,11 +45012,10 @@ class ReportThreadNetworkDiagnosticsTxBeaconRequestCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTxBeaconRequestCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTxBeaconRequestCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -48569,15 +45023,12 @@ class ReportThreadNetworkDiagnosticsTxBeaconRequestCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.TxBeaconRequestCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -48625,13 +45076,7 @@ class ReportThreadNetworkDiagnosticsTxOtherCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsTxOtherCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsTxOtherCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -48640,10 +45085,9 @@ class ReportThreadNetworkDiagnosticsTxOtherCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTxOtherCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTxOtherCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -48651,15 +45095,12 @@ class ReportThreadNetworkDiagnosticsTxOtherCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.TxOtherCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -48707,13 +45148,7 @@ class ReportThreadNetworkDiagnosticsTxRetryCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsTxRetryCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsTxRetryCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -48722,10 +45157,9 @@ class ReportThreadNetworkDiagnosticsTxRetryCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTxRetryCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTxRetryCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -48733,15 +45167,12 @@ class ReportThreadNetworkDiagnosticsTxRetryCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.TxRetryCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -48790,13 +45221,7 @@ class ReportThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount : public ModelCo ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -48805,11 +45230,10 @@ class ReportThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount : public ModelCo chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTxDirectMaxRetryExpiryCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTxDirectMaxRetryExpiryCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -48817,15 +45241,12 @@ class ReportThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount : public ModelCo return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.TxDirectMaxRetryExpiryCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -48874,13 +45295,7 @@ class ReportThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount : public Model ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -48889,11 +45304,10 @@ class ReportThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount : public Model chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTxIndirectMaxRetryExpiryCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTxIndirectMaxRetryExpiryCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -48901,15 +45315,12 @@ class ReportThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount : public Model return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.TxIndirectMaxRetryExpiryCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -48957,13 +45368,7 @@ class ReportThreadNetworkDiagnosticsTxErrCcaCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsTxErrCcaCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsTxErrCcaCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -48972,10 +45377,9 @@ class ReportThreadNetworkDiagnosticsTxErrCcaCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTxErrCcaCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTxErrCcaCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -48983,15 +45387,12 @@ class ReportThreadNetworkDiagnosticsTxErrCcaCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.TxErrCcaCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -49039,13 +45440,7 @@ class ReportThreadNetworkDiagnosticsTxErrAbortCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsTxErrAbortCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsTxErrAbortCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -49054,10 +45449,9 @@ class ReportThreadNetworkDiagnosticsTxErrAbortCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTxErrAbortCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTxErrAbortCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -49065,15 +45459,12 @@ class ReportThreadNetworkDiagnosticsTxErrAbortCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.TxErrAbortCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -49121,13 +45512,7 @@ class ReportThreadNetworkDiagnosticsTxErrBusyChannelCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsTxErrBusyChannelCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsTxErrBusyChannelCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -49136,11 +45521,10 @@ class ReportThreadNetworkDiagnosticsTxErrBusyChannelCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTxErrBusyChannelCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTxErrBusyChannelCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -49148,15 +45532,12 @@ class ReportThreadNetworkDiagnosticsTxErrBusyChannelCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.TxErrBusyChannelCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -49204,13 +45585,7 @@ class ReportThreadNetworkDiagnosticsRxTotalCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsRxTotalCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsRxTotalCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -49219,10 +45594,9 @@ class ReportThreadNetworkDiagnosticsRxTotalCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRxTotalCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRxTotalCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -49230,15 +45604,12 @@ class ReportThreadNetworkDiagnosticsRxTotalCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.RxTotalCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -49286,13 +45657,7 @@ class ReportThreadNetworkDiagnosticsRxUnicastCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsRxUnicastCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsRxUnicastCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -49301,10 +45666,9 @@ class ReportThreadNetworkDiagnosticsRxUnicastCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRxUnicastCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRxUnicastCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -49312,15 +45676,12 @@ class ReportThreadNetworkDiagnosticsRxUnicastCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.RxUnicastCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -49368,13 +45729,7 @@ class ReportThreadNetworkDiagnosticsRxBroadcastCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsRxBroadcastCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsRxBroadcastCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -49383,10 +45738,9 @@ class ReportThreadNetworkDiagnosticsRxBroadcastCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRxBroadcastCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRxBroadcastCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -49394,15 +45748,12 @@ class ReportThreadNetworkDiagnosticsRxBroadcastCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.RxBroadcastCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -49450,13 +45801,7 @@ class ReportThreadNetworkDiagnosticsRxDataCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsRxDataCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsRxDataCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -49465,10 +45810,9 @@ class ReportThreadNetworkDiagnosticsRxDataCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRxDataCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRxDataCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -49476,15 +45820,9 @@ class ReportThreadNetworkDiagnosticsRxDataCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) { LogValue("ThreadNetworkDiagnostics.RxDataCount report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -49532,13 +45870,7 @@ class ReportThreadNetworkDiagnosticsRxDataPollCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsRxDataPollCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsRxDataPollCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -49547,10 +45879,9 @@ class ReportThreadNetworkDiagnosticsRxDataPollCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRxDataPollCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRxDataPollCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -49558,15 +45889,12 @@ class ReportThreadNetworkDiagnosticsRxDataPollCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.RxDataPollCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -49614,13 +45942,7 @@ class ReportThreadNetworkDiagnosticsRxBeaconCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsRxBeaconCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsRxBeaconCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -49629,10 +45951,9 @@ class ReportThreadNetworkDiagnosticsRxBeaconCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRxBeaconCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRxBeaconCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -49640,15 +45961,12 @@ class ReportThreadNetworkDiagnosticsRxBeaconCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.RxBeaconCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -49696,13 +46014,7 @@ class ReportThreadNetworkDiagnosticsRxBeaconRequestCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsRxBeaconRequestCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsRxBeaconRequestCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -49711,11 +46023,10 @@ class ReportThreadNetworkDiagnosticsRxBeaconRequestCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRxBeaconRequestCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRxBeaconRequestCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -49723,15 +46034,12 @@ class ReportThreadNetworkDiagnosticsRxBeaconRequestCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.RxBeaconRequestCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -49779,13 +46087,7 @@ class ReportThreadNetworkDiagnosticsRxOtherCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsRxOtherCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsRxOtherCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -49794,10 +46096,9 @@ class ReportThreadNetworkDiagnosticsRxOtherCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRxOtherCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRxOtherCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -49805,15 +46106,12 @@ class ReportThreadNetworkDiagnosticsRxOtherCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.RxOtherCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -49861,13 +46159,7 @@ class ReportThreadNetworkDiagnosticsRxAddressFilteredCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsRxAddressFilteredCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsRxAddressFilteredCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -49876,11 +46168,10 @@ class ReportThreadNetworkDiagnosticsRxAddressFilteredCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRxAddressFilteredCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRxAddressFilteredCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -49888,15 +46179,12 @@ class ReportThreadNetworkDiagnosticsRxAddressFilteredCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.RxAddressFilteredCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -49944,13 +46232,7 @@ class ReportThreadNetworkDiagnosticsRxDestAddrFilteredCount : public ModelComman ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsRxDestAddrFilteredCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsRxDestAddrFilteredCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -49959,11 +46241,10 @@ class ReportThreadNetworkDiagnosticsRxDestAddrFilteredCount : public ModelComman chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRxDestAddrFilteredCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRxDestAddrFilteredCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -49971,15 +46252,12 @@ class ReportThreadNetworkDiagnosticsRxDestAddrFilteredCount : public ModelComman return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.RxDestAddrFilteredCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -50027,13 +46305,7 @@ class ReportThreadNetworkDiagnosticsRxDuplicatedCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsRxDuplicatedCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsRxDuplicatedCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -50042,11 +46314,9 @@ class ReportThreadNetworkDiagnosticsRxDuplicatedCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRxDuplicatedCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRxDuplicatedCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -50054,15 +46324,12 @@ class ReportThreadNetworkDiagnosticsRxDuplicatedCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.RxDuplicatedCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -50110,13 +46377,7 @@ class ReportThreadNetworkDiagnosticsRxErrNoFrameCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsRxErrNoFrameCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsRxErrNoFrameCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -50125,11 +46386,9 @@ class ReportThreadNetworkDiagnosticsRxErrNoFrameCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRxErrNoFrameCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRxErrNoFrameCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -50137,15 +46396,12 @@ class ReportThreadNetworkDiagnosticsRxErrNoFrameCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.RxErrNoFrameCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -50194,13 +46450,7 @@ class ReportThreadNetworkDiagnosticsRxErrUnknownNeighborCount : public ModelComm ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsRxErrUnknownNeighborCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsRxErrUnknownNeighborCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -50209,11 +46459,10 @@ class ReportThreadNetworkDiagnosticsRxErrUnknownNeighborCount : public ModelComm chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRxErrUnknownNeighborCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRxErrUnknownNeighborCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -50221,15 +46470,12 @@ class ReportThreadNetworkDiagnosticsRxErrUnknownNeighborCount : public ModelComm return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.RxErrUnknownNeighborCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -50277,13 +46523,7 @@ class ReportThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount : public ModelComma ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -50292,11 +46532,10 @@ class ReportThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount : public ModelComma chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRxErrInvalidSrcAddrCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRxErrInvalidSrcAddrCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -50304,15 +46543,12 @@ class ReportThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount : public ModelComma return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.RxErrInvalidSrcAddrCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -50360,13 +46596,7 @@ class ReportThreadNetworkDiagnosticsRxErrSecCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsRxErrSecCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsRxErrSecCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -50375,10 +46605,9 @@ class ReportThreadNetworkDiagnosticsRxErrSecCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRxErrSecCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRxErrSecCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -50386,15 +46615,12 @@ class ReportThreadNetworkDiagnosticsRxErrSecCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.RxErrSecCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -50442,13 +46668,7 @@ class ReportThreadNetworkDiagnosticsRxErrFcsCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsRxErrFcsCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsRxErrFcsCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -50457,10 +46677,9 @@ class ReportThreadNetworkDiagnosticsRxErrFcsCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRxErrFcsCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRxErrFcsCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -50468,15 +46687,12 @@ class ReportThreadNetworkDiagnosticsRxErrFcsCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.RxErrFcsCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -50524,13 +46740,7 @@ class ReportThreadNetworkDiagnosticsRxErrOtherCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsRxErrOtherCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsRxErrOtherCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -50539,10 +46749,9 @@ class ReportThreadNetworkDiagnosticsRxErrOtherCount : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRxErrOtherCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRxErrOtherCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -50550,15 +46759,12 @@ class ReportThreadNetworkDiagnosticsRxErrOtherCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("ThreadNetworkDiagnostics.RxErrOtherCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -50606,13 +46812,7 @@ class ReportThreadNetworkDiagnosticsActiveTimestamp : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsActiveTimestamp() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsActiveTimestamp() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -50621,10 +46821,9 @@ class ReportThreadNetworkDiagnosticsActiveTimestamp : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeActiveTimestamp(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeActiveTimestamp(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -50632,15 +46831,12 @@ class ReportThreadNetworkDiagnosticsActiveTimestamp : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) + { + LogValue("ThreadNetworkDiagnostics.ActiveTimestamp report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -50688,13 +46884,7 @@ class ReportThreadNetworkDiagnosticsPendingTimestamp : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsPendingTimestamp() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsPendingTimestamp() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -50703,10 +46893,9 @@ class ReportThreadNetworkDiagnosticsPendingTimestamp : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePendingTimestamp(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePendingTimestamp(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -50714,15 +46903,12 @@ class ReportThreadNetworkDiagnosticsPendingTimestamp : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) + { + LogValue("ThreadNetworkDiagnostics.PendingTimestamp report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -50770,13 +46956,7 @@ class ReportThreadNetworkDiagnosticsDelay : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsDelay() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsDelay() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -50785,10 +46965,9 @@ class ReportThreadNetworkDiagnosticsDelay : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeDelay(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeDelay(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -50796,15 +46975,9 @@ class ReportThreadNetworkDiagnosticsDelay : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) { LogValue("ThreadNetworkDiagnostics.Delay report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -50843,6 +47016,50 @@ class ReadThreadNetworkDiagnosticsSecurityPolicy : public ModelCommand } }; +class ReportThreadNetworkDiagnosticsSecurityPolicy : public ModelCommand +{ +public: + ReportThreadNetworkDiagnosticsSecurityPolicy() : ModelCommand("report") + { + AddArgument("attr-name", "security-policy"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportThreadNetworkDiagnosticsSecurityPolicy() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0035) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::ThreadNetworkDiagnosticsCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void OnValueReport(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::ThreadNetworkDiagnostics::Structs::SecurityPolicy::DecodableType> & value) + { + LogValue("ThreadNetworkDiagnostics.SecurityPolicy report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute ChannelMask */ @@ -50885,13 +47102,7 @@ class ReportThreadNetworkDiagnosticsChannelMask : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsChannelMask() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsChannelMask() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -50900,10 +47111,9 @@ class ReportThreadNetworkDiagnosticsChannelMask : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeChannelMask(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeChannelMask(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -50911,15 +47121,12 @@ class ReportThreadNetworkDiagnosticsChannelMask : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::ByteSpan value) + { + LogValue("ThreadNetworkDiagnostics.ChannelMask report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnOctetStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -50959,6 +47166,52 @@ class ReadThreadNetworkDiagnosticsOperationalDatasetComponents : public ModelCom } }; +class ReportThreadNetworkDiagnosticsOperationalDatasetComponents : public ModelCommand +{ +public: + ReportThreadNetworkDiagnosticsOperationalDatasetComponents() : ModelCommand("report") + { + AddArgument("attr-name", "operational-dataset-components"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportThreadNetworkDiagnosticsOperationalDatasetComponents() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0035) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::ThreadNetworkDiagnosticsCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void + OnValueReport(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::ThreadNetworkDiagnostics::Structs::OperationalDatasetComponents::DecodableType> & value) + { + LogValue("ThreadNetworkDiagnostics.OperationalDatasetComponents report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute ActiveNetworkFaultsList */ @@ -50991,6 +47244,51 @@ class ReadThreadNetworkDiagnosticsActiveNetworkFaultsList : public ModelCommand } }; +class ReportThreadNetworkDiagnosticsActiveNetworkFaultsList : public ModelCommand +{ +public: + ReportThreadNetworkDiagnosticsActiveNetworkFaultsList() : ModelCommand("report") + { + AddArgument("attr-name", "active-network-faults-list"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~ReportThreadNetworkDiagnosticsActiveNetworkFaultsList() {} + + CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0035) command (0x06) on endpoint %" PRIu8, endpointId); + + chip::Controller::ThreadNetworkDiagnosticsCluster cluster; + cluster.Associate(device, endpointId); + + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + + static void + OnValueReport(void * context, + const chip::app::DataModel::DecodableList & value) + { + LogValue("ThreadNetworkDiagnostics.ActiveNetworkFaultsList report", 0, value); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute AttributeList */ @@ -51093,13 +47391,7 @@ class ReportThreadNetworkDiagnosticsClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportThreadNetworkDiagnosticsClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportThreadNetworkDiagnosticsClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -51108,10 +47400,9 @@ class ReportThreadNetworkDiagnosticsClusterRevision : public ModelCommand chip::Controller::ThreadNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -51119,15 +47410,12 @@ class ReportThreadNetworkDiagnosticsClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("ThreadNetworkDiagnostics.ClusterRevision report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -51186,13 +47474,7 @@ class ReportWakeOnLanWakeOnLanMacAddress : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWakeOnLanWakeOnLanMacAddress() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWakeOnLanWakeOnLanMacAddress() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -51201,11 +47483,9 @@ class ReportWakeOnLanWakeOnLanMacAddress : public ModelCommand chip::Controller::WakeOnLanCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeWakeOnLanMacAddress(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeWakeOnLanMacAddress(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -51213,15 +47493,9 @@ class ReportWakeOnLanWakeOnLanMacAddress : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::CharSpan value) { LogValue("WakeOnLan.WakeOnLanMacAddress report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnCharStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -51299,13 +47573,7 @@ class ReportWakeOnLanClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWakeOnLanClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWakeOnLanClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -51314,10 +47582,9 @@ class ReportWakeOnLanClusterRevision : public ModelCommand chip::Controller::WakeOnLanCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -51325,15 +47592,9 @@ class ReportWakeOnLanClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("WakeOnLan.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -51426,13 +47687,7 @@ class ReportWiFiNetworkDiagnosticsBssid : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWiFiNetworkDiagnosticsBssid() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWiFiNetworkDiagnosticsBssid() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -51441,10 +47696,9 @@ class ReportWiFiNetworkDiagnosticsBssid : public ModelCommand chip::Controller::WiFiNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeBssid(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeBssid(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -51452,15 +47706,9 @@ class ReportWiFiNetworkDiagnosticsBssid : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, chip::ByteSpan value) { LogValue("WiFiNetworkDiagnostics.Bssid report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnOctetStringAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -51508,13 +47756,7 @@ class ReportWiFiNetworkDiagnosticsSecurityType : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWiFiNetworkDiagnosticsSecurityType() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWiFiNetworkDiagnosticsSecurityType() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -51523,10 +47765,9 @@ class ReportWiFiNetworkDiagnosticsSecurityType : public ModelCommand chip::Controller::WiFiNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeSecurityType(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeSecurityType(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -51534,15 +47775,9 @@ class ReportWiFiNetworkDiagnosticsSecurityType : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("WiFiNetworkDiagnostics.SecurityType report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -51590,13 +47825,7 @@ class ReportWiFiNetworkDiagnosticsWiFiVersion : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWiFiNetworkDiagnosticsWiFiVersion() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWiFiNetworkDiagnosticsWiFiVersion() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -51605,10 +47834,9 @@ class ReportWiFiNetworkDiagnosticsWiFiVersion : public ModelCommand chip::Controller::WiFiNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeWiFiVersion(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeWiFiVersion(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -51616,15 +47844,9 @@ class ReportWiFiNetworkDiagnosticsWiFiVersion : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("WiFiNetworkDiagnostics.WiFiVersion report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -51672,13 +47894,7 @@ class ReportWiFiNetworkDiagnosticsChannelNumber : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWiFiNetworkDiagnosticsChannelNumber() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWiFiNetworkDiagnosticsChannelNumber() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -51687,10 +47903,9 @@ class ReportWiFiNetworkDiagnosticsChannelNumber : public ModelCommand chip::Controller::WiFiNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeChannelNumber(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeChannelNumber(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -51698,15 +47913,9 @@ class ReportWiFiNetworkDiagnosticsChannelNumber : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("WiFiNetworkDiagnostics.ChannelNumber report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -51754,13 +47963,7 @@ class ReportWiFiNetworkDiagnosticsRssi : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWiFiNetworkDiagnosticsRssi() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWiFiNetworkDiagnosticsRssi() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -51769,10 +47972,9 @@ class ReportWiFiNetworkDiagnosticsRssi : public ModelCommand chip::Controller::WiFiNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeRssi(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeRssi(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -51780,15 +47982,9 @@ class ReportWiFiNetworkDiagnosticsRssi : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, int8_t value) { LogValue("WiFiNetworkDiagnostics.Rssi report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8sAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -51836,13 +48032,7 @@ class ReportWiFiNetworkDiagnosticsBeaconLostCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWiFiNetworkDiagnosticsBeaconLostCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWiFiNetworkDiagnosticsBeaconLostCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -51851,10 +48041,9 @@ class ReportWiFiNetworkDiagnosticsBeaconLostCount : public ModelCommand chip::Controller::WiFiNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeBeaconLostCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeBeaconLostCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -51862,15 +48051,12 @@ class ReportWiFiNetworkDiagnosticsBeaconLostCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("WiFiNetworkDiagnostics.BeaconLostCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -51918,13 +48104,7 @@ class ReportWiFiNetworkDiagnosticsBeaconRxCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWiFiNetworkDiagnosticsBeaconRxCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWiFiNetworkDiagnosticsBeaconRxCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -51933,10 +48113,9 @@ class ReportWiFiNetworkDiagnosticsBeaconRxCount : public ModelCommand chip::Controller::WiFiNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeBeaconRxCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeBeaconRxCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -51944,15 +48123,9 @@ class ReportWiFiNetworkDiagnosticsBeaconRxCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) { LogValue("WiFiNetworkDiagnostics.BeaconRxCount report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -52000,13 +48173,7 @@ class ReportWiFiNetworkDiagnosticsPacketMulticastRxCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWiFiNetworkDiagnosticsPacketMulticastRxCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWiFiNetworkDiagnosticsPacketMulticastRxCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -52015,11 +48182,10 @@ class ReportWiFiNetworkDiagnosticsPacketMulticastRxCount : public ModelCommand chip::Controller::WiFiNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePacketMulticastRxCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePacketMulticastRxCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -52027,15 +48193,12 @@ class ReportWiFiNetworkDiagnosticsPacketMulticastRxCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("WiFiNetworkDiagnostics.PacketMulticastRxCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -52083,13 +48246,7 @@ class ReportWiFiNetworkDiagnosticsPacketMulticastTxCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWiFiNetworkDiagnosticsPacketMulticastTxCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWiFiNetworkDiagnosticsPacketMulticastTxCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -52098,11 +48255,10 @@ class ReportWiFiNetworkDiagnosticsPacketMulticastTxCount : public ModelCommand chip::Controller::WiFiNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePacketMulticastTxCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePacketMulticastTxCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -52110,15 +48266,12 @@ class ReportWiFiNetworkDiagnosticsPacketMulticastTxCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("WiFiNetworkDiagnostics.PacketMulticastTxCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -52166,13 +48319,7 @@ class ReportWiFiNetworkDiagnosticsPacketUnicastRxCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWiFiNetworkDiagnosticsPacketUnicastRxCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWiFiNetworkDiagnosticsPacketUnicastRxCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -52181,11 +48328,9 @@ class ReportWiFiNetworkDiagnosticsPacketUnicastRxCount : public ModelCommand chip::Controller::WiFiNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePacketUnicastRxCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePacketUnicastRxCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -52193,15 +48338,12 @@ class ReportWiFiNetworkDiagnosticsPacketUnicastRxCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("WiFiNetworkDiagnostics.PacketUnicastRxCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -52249,13 +48391,7 @@ class ReportWiFiNetworkDiagnosticsPacketUnicastTxCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWiFiNetworkDiagnosticsPacketUnicastTxCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWiFiNetworkDiagnosticsPacketUnicastTxCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -52264,11 +48400,9 @@ class ReportWiFiNetworkDiagnosticsPacketUnicastTxCount : public ModelCommand chip::Controller::WiFiNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributePacketUnicastTxCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributePacketUnicastTxCount(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -52276,15 +48410,12 @@ class ReportWiFiNetworkDiagnosticsPacketUnicastTxCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) + { + LogValue("WiFiNetworkDiagnostics.PacketUnicastTxCount report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -52332,13 +48463,7 @@ class ReportWiFiNetworkDiagnosticsCurrentMaxRate : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWiFiNetworkDiagnosticsCurrentMaxRate() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWiFiNetworkDiagnosticsCurrentMaxRate() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -52347,10 +48472,9 @@ class ReportWiFiNetworkDiagnosticsCurrentMaxRate : public ModelCommand chip::Controller::WiFiNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentMaxRate(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentMaxRate(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -52358,15 +48482,12 @@ class ReportWiFiNetworkDiagnosticsCurrentMaxRate : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) + { + LogValue("WiFiNetworkDiagnostics.CurrentMaxRate report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -52414,13 +48535,7 @@ class ReportWiFiNetworkDiagnosticsOverrunCount : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWiFiNetworkDiagnosticsOverrunCount() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWiFiNetworkDiagnosticsOverrunCount() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -52429,10 +48544,9 @@ class ReportWiFiNetworkDiagnosticsOverrunCount : public ModelCommand chip::Controller::WiFiNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOverrunCount(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOverrunCount(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -52440,15 +48554,9 @@ class ReportWiFiNetworkDiagnosticsOverrunCount : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint64_t value) { LogValue("WiFiNetworkDiagnostics.OverrunCount report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt64uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -52556,13 +48664,7 @@ class ReportWiFiNetworkDiagnosticsClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWiFiNetworkDiagnosticsClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWiFiNetworkDiagnosticsClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -52571,10 +48673,9 @@ class ReportWiFiNetworkDiagnosticsClusterRevision : public ModelCommand chip::Controller::WiFiNetworkDiagnosticsCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -52582,15 +48683,12 @@ class ReportWiFiNetworkDiagnosticsClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("WiFiNetworkDiagnostics.ClusterRevision report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -52832,13 +48930,7 @@ class ReportWindowCoveringType : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWindowCoveringType() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWindowCoveringType() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -52847,10 +48939,9 @@ class ReportWindowCoveringType : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeType(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeType(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -52858,15 +48949,9 @@ class ReportWindowCoveringType : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("WindowCovering.Type report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -52914,13 +48999,7 @@ class ReportWindowCoveringCurrentPositionLift : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWindowCoveringCurrentPositionLift() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWindowCoveringCurrentPositionLift() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -52929,11 +49008,9 @@ class ReportWindowCoveringCurrentPositionLift : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentPositionLift(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentPositionLift(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -52941,15 +49018,9 @@ class ReportWindowCoveringCurrentPositionLift : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("WindowCovering.CurrentPositionLift report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -52997,13 +49068,7 @@ class ReportWindowCoveringCurrentPositionTilt : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWindowCoveringCurrentPositionTilt() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWindowCoveringCurrentPositionTilt() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -53012,11 +49077,9 @@ class ReportWindowCoveringCurrentPositionTilt : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentPositionTilt(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentPositionTilt(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -53024,15 +49087,9 @@ class ReportWindowCoveringCurrentPositionTilt : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("WindowCovering.CurrentPositionTilt report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -53080,13 +49137,7 @@ class ReportWindowCoveringConfigStatus : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWindowCoveringConfigStatus() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWindowCoveringConfigStatus() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -53095,10 +49146,9 @@ class ReportWindowCoveringConfigStatus : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeConfigStatus(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeConfigStatus(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -53106,15 +49156,9 @@ class ReportWindowCoveringConfigStatus : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("WindowCovering.ConfigStatus report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -53162,13 +49206,7 @@ class ReportWindowCoveringCurrentPositionLiftPercentage : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWindowCoveringCurrentPositionLiftPercentage() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWindowCoveringCurrentPositionLiftPercentage() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -53177,11 +49215,9 @@ class ReportWindowCoveringCurrentPositionLiftPercentage : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentPositionLiftPercentage(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentPositionLiftPercentage(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -53189,15 +49225,12 @@ class ReportWindowCoveringCurrentPositionLiftPercentage : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) + { + LogValue("WindowCovering.CurrentPositionLiftPercentage report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -53245,13 +49278,7 @@ class ReportWindowCoveringCurrentPositionTiltPercentage : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWindowCoveringCurrentPositionTiltPercentage() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWindowCoveringCurrentPositionTiltPercentage() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -53260,11 +49287,9 @@ class ReportWindowCoveringCurrentPositionTiltPercentage : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentPositionTiltPercentage(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentPositionTiltPercentage(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -53272,15 +49297,12 @@ class ReportWindowCoveringCurrentPositionTiltPercentage : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) + { + LogValue("WindowCovering.CurrentPositionTiltPercentage report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -53328,13 +49350,7 @@ class ReportWindowCoveringOperationalStatus : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWindowCoveringOperationalStatus() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWindowCoveringOperationalStatus() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -53343,11 +49359,9 @@ class ReportWindowCoveringOperationalStatus : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeOperationalStatus(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeOperationalStatus(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -53355,15 +49369,9 @@ class ReportWindowCoveringOperationalStatus : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("WindowCovering.OperationalStatus report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -53411,13 +49419,7 @@ class ReportWindowCoveringTargetPositionLiftPercent100ths : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWindowCoveringTargetPositionLiftPercent100ths() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWindowCoveringTargetPositionLiftPercent100ths() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -53426,11 +49428,10 @@ class ReportWindowCoveringTargetPositionLiftPercent100ths : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTargetPositionLiftPercent100ths(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTargetPositionLiftPercent100ths(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -53438,15 +49439,12 @@ class ReportWindowCoveringTargetPositionLiftPercent100ths : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("WindowCovering.TargetPositionLiftPercent100ths report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -53494,13 +49492,7 @@ class ReportWindowCoveringTargetPositionTiltPercent100ths : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWindowCoveringTargetPositionTiltPercent100ths() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWindowCoveringTargetPositionTiltPercent100ths() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -53509,11 +49501,10 @@ class ReportWindowCoveringTargetPositionTiltPercent100ths : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeTargetPositionTiltPercent100ths(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeTargetPositionTiltPercent100ths(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -53521,15 +49512,12 @@ class ReportWindowCoveringTargetPositionTiltPercent100ths : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("WindowCovering.TargetPositionTiltPercent100ths report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -53577,13 +49565,7 @@ class ReportWindowCoveringEndProductType : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWindowCoveringEndProductType() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWindowCoveringEndProductType() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -53592,10 +49574,9 @@ class ReportWindowCoveringEndProductType : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeEndProductType(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeEndProductType(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -53603,15 +49584,9 @@ class ReportWindowCoveringEndProductType : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("WindowCovering.EndProductType report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -53659,13 +49634,7 @@ class ReportWindowCoveringCurrentPositionLiftPercent100ths : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWindowCoveringCurrentPositionLiftPercent100ths() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWindowCoveringCurrentPositionLiftPercent100ths() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -53674,11 +49643,10 @@ class ReportWindowCoveringCurrentPositionLiftPercent100ths : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentPositionLiftPercent100ths(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentPositionLiftPercent100ths(successCallback, onFailureCallback->Cancel(), - mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -53686,15 +49654,12 @@ class ReportWindowCoveringCurrentPositionLiftPercent100ths : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("WindowCovering.CurrentPositionLiftPercent100ths report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -53742,13 +49707,7 @@ class ReportWindowCoveringCurrentPositionTiltPercent100ths : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWindowCoveringCurrentPositionTiltPercent100ths() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWindowCoveringCurrentPositionTiltPercent100ths() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -53757,11 +49716,10 @@ class ReportWindowCoveringCurrentPositionTiltPercent100ths : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeCurrentPositionTiltPercent100ths(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeCurrentPositionTiltPercent100ths(successCallback, onFailureCallback->Cancel(), - mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster + .SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -53769,15 +49727,12 @@ class ReportWindowCoveringCurrentPositionTiltPercent100ths : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("WindowCovering.CurrentPositionTiltPercent100ths report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -53825,13 +49780,7 @@ class ReportWindowCoveringInstalledOpenLimitLift : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWindowCoveringInstalledOpenLimitLift() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWindowCoveringInstalledOpenLimitLift() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -53840,11 +49789,9 @@ class ReportWindowCoveringInstalledOpenLimitLift : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInstalledOpenLimitLift(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInstalledOpenLimitLift(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -53852,15 +49799,12 @@ class ReportWindowCoveringInstalledOpenLimitLift : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("WindowCovering.InstalledOpenLimitLift report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -53908,13 +49852,7 @@ class ReportWindowCoveringInstalledClosedLimitLift : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWindowCoveringInstalledClosedLimitLift() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWindowCoveringInstalledClosedLimitLift() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -53923,11 +49861,9 @@ class ReportWindowCoveringInstalledClosedLimitLift : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInstalledClosedLimitLift(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInstalledClosedLimitLift(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -53935,15 +49871,12 @@ class ReportWindowCoveringInstalledClosedLimitLift : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("WindowCovering.InstalledClosedLimitLift report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -53991,13 +49924,7 @@ class ReportWindowCoveringInstalledOpenLimitTilt : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWindowCoveringInstalledOpenLimitTilt() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWindowCoveringInstalledOpenLimitTilt() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -54006,11 +49933,9 @@ class ReportWindowCoveringInstalledOpenLimitTilt : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInstalledOpenLimitTilt(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInstalledOpenLimitTilt(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -54018,15 +49943,12 @@ class ReportWindowCoveringInstalledOpenLimitTilt : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("WindowCovering.InstalledOpenLimitTilt report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -54074,13 +49996,7 @@ class ReportWindowCoveringInstalledClosedLimitTilt : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWindowCoveringInstalledClosedLimitTilt() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWindowCoveringInstalledClosedLimitTilt() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -54089,11 +50005,9 @@ class ReportWindowCoveringInstalledClosedLimitTilt : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeInstalledClosedLimitTilt(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeInstalledClosedLimitTilt(successCallback, onFailureCallback->Cancel(), mMinInterval, - mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -54101,15 +50015,12 @@ class ReportWindowCoveringInstalledClosedLimitTilt : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) + { + LogValue("WindowCovering.InstalledClosedLimitTilt report", 0, value); + } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -54183,13 +50094,7 @@ class ReportWindowCoveringMode : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWindowCoveringMode() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWindowCoveringMode() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -54198,10 +50103,9 @@ class ReportWindowCoveringMode : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeMode(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeMode(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -54209,15 +50113,9 @@ class ReportWindowCoveringMode : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint8_t value) { LogValue("WindowCovering.Mode report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt8uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -54265,13 +50163,7 @@ class ReportWindowCoveringSafetyStatus : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWindowCoveringSafetyStatus() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWindowCoveringSafetyStatus() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -54280,10 +50172,9 @@ class ReportWindowCoveringSafetyStatus : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeSafetyStatus(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeSafetyStatus(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -54291,15 +50182,9 @@ class ReportWindowCoveringSafetyStatus : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("WindowCovering.SafetyStatus report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -54377,13 +50262,7 @@ class ReportWindowCoveringFeatureMap : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWindowCoveringFeatureMap() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWindowCoveringFeatureMap() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -54392,10 +50271,9 @@ class ReportWindowCoveringFeatureMap : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeFeatureMap(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeFeatureMap(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -54403,15 +50281,9 @@ class ReportWindowCoveringFeatureMap : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint32_t value) { LogValue("WindowCovering.FeatureMap report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt32uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait; @@ -54459,13 +50331,7 @@ class ReportWindowCoveringClusterRevision : public ModelCommand ModelCommand::AddArguments(); } - ~ReportWindowCoveringClusterRevision() - { - delete onSuccessCallback; - delete onSuccessCallbackWithoutExit; - delete onFailureCallback; - delete onReportCallback; - } + ~ReportWindowCoveringClusterRevision() {} CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endpointId) override { @@ -54474,10 +50340,9 @@ class ReportWindowCoveringClusterRevision : public ModelCommand chip::Controller::WindowCoveringCluster cluster; cluster.Associate(device, endpointId); - ReturnErrorOnFailure(cluster.ReportAttributeClusterRevision(onReportCallback->Cancel())); - - chip::Callback::Cancelable * successCallback = mWait ? onSuccessCallbackWithoutExit->Cancel() : onSuccessCallback->Cancel(); - return cluster.SubscribeAttributeClusterRevision(successCallback, onFailureCallback->Cancel(), mMinInterval, mMaxInterval); + auto subscriptionEstablishedCallback = mWait ? OnDefaultSuccessResponseWithoutExit : OnDefaultSuccessResponse; + return cluster.SubscribeAttribute( + this, OnValueReport, OnDefaultFailure, mMinInterval, mMaxInterval, subscriptionEstablishedCallback); } chip::System::Clock::Timeout GetWaitDuration() const override @@ -54485,15 +50350,9 @@ class ReportWindowCoveringClusterRevision : public ModelCommand return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } + static void OnValueReport(void * context, uint16_t value) { LogValue("WindowCovering.ClusterRevision report", 0, value); } + private: - chip::Callback::Callback * onSuccessCallback = - new chip::Callback::Callback(OnDefaultSuccessResponse, this); - chip::Callback::Callback * onSuccessCallbackWithoutExit = - new chip::Callback::Callback(OnDefaultSuccessResponseWithoutExit, this); - chip::Callback::Callback * onFailureCallback = - new chip::Callback::Callback(OnDefaultFailureResponse, this); - chip::Callback::Callback * onReportCallback = - new chip::Callback::Callback(OnInt16uAttributeReport, this); uint16_t mMinInterval; uint16_t mMaxInterval; bool mWait;