Fix ReadEvent (#12626)
diff --git a/src/controller/ReadInteraction.h b/src/controller/ReadInteraction.h
index efc977b..3405afc 100644
--- a/src/controller/ReadInteraction.h
+++ b/src/controller/ReadInteraction.h
@@ -88,17 +88,17 @@
* 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 EventTypeInfo is generally expected to be a ClusterName::Events::EventName::TypeInfo struct, but any
+ * The DecodableEventType is generally expected to be a ClusterName::Events::EventName::DecodableEventType struct, but any
* object that contains type information exposed through a 'DecodableType' type declaration as well as GetClusterId() and
* GetEventId() methods is expected to work.
*/
-template <typename DecodableEventTypeInfo>
+template <typename DecodableEventType>
CHIP_ERROR ReadEvent(Messaging::ExchangeManager * apExchangeMgr, const SessionHandle sessionHandle, EndpointId endpointId,
- typename TypedReadEventCallback<DecodableEventTypeInfo>::OnSuccessCallbackType onSuccessCb,
- typename TypedReadEventCallback<DecodableEventTypeInfo>::OnErrorCallbackType onErrorCb)
+ typename TypedReadEventCallback<DecodableEventType>::OnSuccessCallbackType onSuccessCb,
+ typename TypedReadEventCallback<DecodableEventType>::OnErrorCallbackType onErrorCb)
{
- ClusterId clusterId = DecodableEventTypeInfo::GetClusterId();
- EventId eventId = DecodableEventTypeInfo::GetEventId();
+ ClusterId clusterId = DecodableEventType::GetClusterId();
+ EventId eventId = DecodableEventType::GetEventId();
app::EventPathParams eventPath(endpointId, clusterId, eventId);
app::ReadPrepareParams readParams(sessionHandle);
app::ReadClient * readClient = nullptr;
@@ -108,17 +108,15 @@
readParams.mpEventPathParamsList = &eventPath;
readParams.mEventPathParamsListSize = 1;
- auto onDone = [](app::ReadClient * apReadClient, TypedReadEventCallback<DecodableEventTypeInfo> * callback) {
+ auto onDone = [](app::ReadClient * apReadClient, TypedReadEventCallback<DecodableEventType> * callback) {
chip::Platform::Delete(callback);
};
- auto callback = chip::Platform::MakeUnique<TypedReadEventCallback<DecodableEventTypeInfo>>(clusterId, eventId, onSuccessCb,
- onErrorCb, onDone);
+ auto callback = chip::Platform::MakeUnique<TypedReadEventCallback<DecodableEventType>>(onSuccessCb, onErrorCb, onDone);
VerifyOrReturnError(callback != nullptr, CHIP_ERROR_NO_MEMORY);
- ReturnErrorOnFailure(
- engine->NewReadClient(&readClient, app::ReadClient::InteractionType::Read, &callback.get()->GetBufferedCallback()));
+ ReturnErrorOnFailure(engine->NewReadClient(&readClient, app::ReadClient::InteractionType::Read, callback.get()));
err = readClient->SendReadRequest(readParams);
if (err != CHIP_NO_ERROR)
@@ -146,13 +144,5 @@
AttributeTypeInfo::GetClusterId(),
AttributeTypeInfo::GetAttributeId(), onSuccessCb, onErrorCb);
}
-
-template <typename EventTypeInfo>
-CHIP_ERROR ReadEvent(Messaging::ExchangeManager * aExchangeMgr, const SessionHandle sessionHandle, EndpointId endpointId,
- typename TypedReadEventCallback<typename EventTypeInfo::DecodableType>::OnSuccessCallbackType onSuccessCb,
- typename TypedReadEventCallback<typename EventTypeInfo::DecodableType>::OnErrorCallbackType onErrorCb)
-{
- return ReadEvent<typename EventTypeInfo::DecodableType>(aExchangeMgr, sessionHandle, endpointId, onSuccessCb, onErrorCb);
-}
} // namespace Controller
} // namespace chip