Skip to content

Commit

Permalink
Remove now-unused InteractionModelDelegate (#14594)
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Mar 4, 2022
1 parent e26e857 commit b33f8f1
Show file tree
Hide file tree
Showing 22 changed files with 43 additions and 125 deletions.
1 change: 0 additions & 1 deletion src/app/AttributePathExpandIterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <app/ClusterInfo.h>
#include <app/ConcreteAttributePath.h>
#include <app/EventManagement.h>
#include <app/InteractionModelDelegate.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/CHIPTLVDebug.hpp>
#include <lib/support/CodeUtils.h>
Expand Down
1 change: 0 additions & 1 deletion src/app/AttributePathExpandIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <app/ClusterInfo.h>
#include <app/ConcreteAttributePath.h>
#include <app/EventManagement.h>
#include <app/InteractionModelDelegate.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/CHIPTLVDebug.hpp>
#include <lib/support/CodeUtils.h>
Expand Down
1 change: 1 addition & 0 deletions src/app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ static_library("app") {
"EventPathParams.h",
"InteractionModelEngine.cpp",
"InteractionModelRevision.h",
"InteractionModelTimeout.h",
"MessageDef/ArrayBuilder.cpp",
"MessageDef/ArrayParser.cpp",
"MessageDef/AttributeDataIB.cpp",
Expand Down
1 change: 0 additions & 1 deletion src/app/CommandHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#pragma once

#include <app/ConcreteCommandPath.h>
#include <app/InteractionModelDelegate.h>
#include <app/data-model/Encode.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/CHIPTLV.h>
Expand Down
1 change: 0 additions & 1 deletion src/app/CommandSender.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <type_traits>

#include <app/CommandPathParams.h>
#include <app/InteractionModelDelegate.h>
#include <app/MessageDef/InvokeRequestMessage.h>
#include <app/MessageDef/InvokeResponseMessage.h>
#include <app/MessageDef/StatusIB.h>
Expand Down
60 changes: 0 additions & 60 deletions src/app/InteractionModelDelegate.h

This file was deleted.

3 changes: 1 addition & 2 deletions src/app/InteractionModelEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
#include <app/CommandSender.h>
#include <app/ConcreteAttributePath.h>
#include <app/ConcreteCommandPath.h>
#include <app/InteractionModelDelegate.h>
#include <app/ReadClient.h>
#include <app/ReadHandler.h>
#include <app/StatusResponse.h>
Expand All @@ -58,6 +57,7 @@

namespace chip {
namespace app {

/**
* @class InteractionModelEngine
*
Expand All @@ -82,7 +82,6 @@ class InteractionModelEngine : public Messaging::ExchangeDelegate, public Comman
* Initialize the InteractionModel Engine.
*
* @param[in] apExchangeMgr A pointer to the ExchangeManager object.
* @param[in] apDelegate InteractionModelDelegate set by application.
*
* @retval #CHIP_ERROR_INCORRECT_STATE If the state is not equal to
* kState_NotInitialized.
Expand Down
28 changes: 28 additions & 0 deletions src/app/InteractionModelTimeout.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2022 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#include <system/SystemClock.h>

namespace chip {
namespace app {

static constexpr System::Clock::Timeout kImMessageTimeout = System::Clock::Seconds16(12);

} // namespace app
} // namespace chip
4 changes: 2 additions & 2 deletions src/app/ReadClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#include <app/ConcreteAttributePath.h>
#include <app/EventHeader.h>
#include <app/EventPathParams.h>
#include <app/InteractionModelDelegate.h>
#include <app/MessageDef/ReadRequestMessage.h>
#include <app/MessageDef/StatusIB.h>
#include <app/MessageDef/StatusResponseMessage.h>
#include <app/MessageDef/SubscribeRequestMessage.h>
#include <app/MessageDef/SubscribeResponseMessage.h>
Expand Down Expand Up @@ -187,7 +187,7 @@ class ReadClient : public Messaging::ExchangeDelegate
*
* @param[in] apImEngine A valid pointer to the IM engine.
* @param[in] apExchangeMgr A pointer to the ExchangeManager object.
* @param[in] apCallback InteractionModelDelegate set by application.
* @param[in] apCallback Callback set by application.
* @param[in] aInteractionType Type of interaction (read or subscribe)
*
* @retval #CHIP_ERROR_INCORRECT_STATE incorrect state if it is already initialized
Expand Down
1 change: 0 additions & 1 deletion src/app/ReadHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <app/AttributePathExpandIterator.h>
#include <app/ClusterInfo.h>
#include <app/EventManagement.h>
#include <app/InteractionModelDelegate.h>
#include <app/MessageDef/AttributePathIBs.h>
#include <app/MessageDef/EventPathIBs.h>
#include <lib/core/CHIPCore.h>
Expand Down
1 change: 1 addition & 0 deletions src/app/ReadPrepareParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include <app/AttributePathParams.h>
#include <app/EventPathParams.h>
#include <app/InteractionModelTimeout.h>
#include <app/util/basic-types.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/CHIPTLV.h>
Expand Down
1 change: 0 additions & 1 deletion src/app/TimedHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/

#include "TimedHandler.h"
#include <app/InteractionModelDelegate.h>
#include <app/InteractionModelEngine.h>
#include <app/MessageDef/TimedRequestMessage.h>
#include <app/StatusResponse.h>
Expand Down
3 changes: 1 addition & 2 deletions src/app/WriteClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include <app/AttributePathParams.h>
#include <app/ConcreteAttributePath.h>
#include <app/InteractionModelDelegate.h>
#include <app/MessageDef/AttributeDataIBs.h>
#include <app/MessageDef/AttributeStatusIB.h>
#include <app/MessageDef/StatusIB.h>
Expand Down Expand Up @@ -111,7 +110,7 @@ class WriteClient : public Messaging::ExchangeDelegate
* of this instance.
*
* @param[in] apExchangeMgr A pointer to the ExchangeManager object.
* @param[in] apDelegate InteractionModelDelegate set by application.
* @param[in] apCallback Callback set by application.
* @param[in] aTimedWriteTimeoutMs If provided, do a timed write using this timeout.
*/
WriteClient(Messaging::ExchangeManager * apExchangeMgr, Callback * apCallback,
Expand Down
3 changes: 0 additions & 3 deletions src/app/WriteHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

#pragma once
#include <app/AttributePathParams.h>
#include <app/InteractionModelDelegate.h>
#include <app/MessageDef/WriteResponseMessage.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/CHIPTLVDebug.hpp>
Expand Down Expand Up @@ -46,8 +45,6 @@ class WriteHandler
* construction until a call to Shutdown is made to terminate the
* instance.
*
* @param[in] apDelegate InteractionModelDelegate set by application.
*
* @retval #CHIP_ERROR_INCORRECT_STATE If the state is not equal to
* kState_NotInitialized.
* @retval #CHIP_NO_ERROR On success.
Expand Down
1 change: 0 additions & 1 deletion src/app/tests/TestAttributePathExpandIterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <app/ClusterInfo.h>
#include <app/ConcreteAttributePath.h>
#include <app/EventManagement.h>
#include <app/InteractionModelDelegate.h>
#include <app/util/mock/Constants.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/CHIPTLVDebug.hpp>
Expand Down
1 change: 0 additions & 1 deletion src/app/tests/TestWriteInteraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ void TestWriteInteraction::TestWriteHandler(nlTestSuite * apSuite, void * apCont

app::WriteHandler writeHandler;

chip::app::InteractionModelDelegate IMdelegate;
System::PacketBufferHandle buf = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSize);
err = writeHandler.Init();

Expand Down
3 changes: 1 addition & 2 deletions src/app/tests/integration/chip_im_initiator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ void HandleSubscribeReportComplete()
static_cast<double>(transitTime.count()) / 1000);
}

class MockInteractionModelApp : public chip::app::InteractionModelDelegate,
public ::chip::app::CommandSender::Callback,
class MockInteractionModelApp : public ::chip::app::CommandSender::Callback,
public ::chip::app::WriteClient::Callback,
public ::chip::app::ReadClient::Callback
{
Expand Down
35 changes: 0 additions & 35 deletions src/app/tests/integration/chip_im_responder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ CHIP_ERROR WriteSingleClusterData(const Access::SubjectDescriptor & aSubjectDesc
} // namespace chip

namespace {
bool testSyncReport = false;
chip::TransportMgr<chip::Transport::UDP> gTransportManager;
chip::SecurePairingUsingTestSecret gTestPairing;
LivenessEventGenerator gLivenessGenerator;
Expand All @@ -139,45 +138,11 @@ void InitializeEventLogging(chip::Messaging::ExchangeManager * apMgr)
gCircularEventBuffer, logStorageResources, nullptr, 0, nullptr);
}

void MutateClusterHandler(chip::System::Layer * systemLayer, void * appState)
{
chip::app::ClusterInfo dirtyPath;
dirtyPath.mClusterId = kTestClusterId;
dirtyPath.mEndpointId = kTestEndpointId;
printf("MutateClusterHandler is triggered...");
// send dirty change
if (!testSyncReport)
{
dirtyPath.mAttributeId = 1;
chip::app::InteractionModelEngine::GetInstance()->GetReportingEngine().SetDirty(dirtyPath);
chip::app::InteractionModelEngine::GetInstance()->GetReportingEngine().ScheduleRun();
chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds16(1), MutateClusterHandler, NULL);
testSyncReport = true;
}
else
{
dirtyPath.mAttributeId = 10; // unknown field
chip::app::InteractionModelEngine::GetInstance()->GetReportingEngine().SetDirty(dirtyPath);
// send sync message(empty report)
chip::app::InteractionModelEngine::GetInstance()->GetReportingEngine().ScheduleRun();
}
}

class MockInteractionModelApp : public chip::app::InteractionModelDelegate
{
public:
virtual CHIP_ERROR SubscriptionEstablished(const chip::app::ReadHandler * apReadHandler)
{
chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Seconds16(1), MutateClusterHandler, NULL);
return CHIP_NO_ERROR;
}
};
} // namespace

int main(int argc, char * argv[])
{
CHIP_ERROR err = CHIP_NO_ERROR;
MockInteractionModelApp mockDelegate;
chip::Optional<chip::Transport::PeerAddress> peer(chip::Transport::Type::kUndefined);
const chip::FabricIndex gFabricIndex = 0;

Expand Down
1 change: 0 additions & 1 deletion src/app/util/mock/attribute-storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include <app/ClusterInfo.h>
#include <app/ConcreteAttributePath.h>
#include <app/EventManagement.h>
#include <app/InteractionModelDelegate.h>
#include <lib/core/CHIPCore.h>
#include <lib/core/CHIPEncoding.h>
#include <lib/core/CHIPTLVDebug.hpp>
Expand Down
7 changes: 3 additions & 4 deletions src/controller/CHIPDeviceController.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

#include <app/CASEClientPool.h>
#include <app/CASESessionManager.h>
#include <app/InteractionModelDelegate.h>
#include <app/OperationalDeviceProxy.h>
#include <app/OperationalDeviceProxyPool.h>
#include <controller/AbstractDnssdDiscoveryController.h>
Expand Down Expand Up @@ -167,11 +166,11 @@ typedef void (*OnOpenCommissioningWindow)(void * context, NodeId deviceId, CHIP_
* and device pairing information for individual devices). Alternatively, this class can retrieve the
* relevant information when the application tries to communicate with the device
*/
class DLL_EXPORT DeviceController : public SessionRecoveryDelegate,
class DLL_EXPORT DeviceController : public SessionRecoveryDelegate
#if CHIP_DEVICE_CONFIG_ENABLE_DNSSD
public AbstractDnssdDiscoveryController,
,
public AbstractDnssdDiscoveryController
#endif
public app::InteractionModelDelegate
{
public:
DeviceController();
Expand Down
10 changes: 5 additions & 5 deletions src/controller/TypedReadCallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include <app/BufferedReadCallback.h>
#include <app/ConcreteAttributePath.h>
#include <app/InteractionModelDelegate.h>
#include <app/data-model/Decode.h>
#include <functional>
#include <lib/support/CHIPMem.h>
Expand All @@ -31,11 +30,12 @@ namespace Controller {
/*
* This provides an adapter class that implements ReadClient::Callback and provides three additional
* features:
* 1. The ability to pass in std::function closures to permit more flexible programming scenarios than are provided by the strict
* delegate interface stipulated by by InteractionModelDelegate.
* 1. The ability to pass in std::function closures to permit more flexible
* programming scenarios than are provided by the strict delegate interface
* stipulated by ReadClient::Callback.
*
* 2. Automatic decoding of attribute data provided in the TLVReader by InteractionModelDelegate::OnReportData into a decoded
* cluster object.
* 2. Automatic decoding of attribute data provided in the TLVReader by
* ReadClient::Callback::OnAttributeData into a decoded cluster object.
*
* 3. Automatically representing all errors as a CHIP_ERROR (which might
* encapsulate a StatusIB). This could be a path-specific error or it
Expand Down
1 change: 0 additions & 1 deletion src/controller/python/chip/interaction_model/Delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#include <type_traits>

#include <app/InteractionModelDelegate.h>
#include <controller/CHIPDeviceController.h>

namespace chip {
Expand Down

0 comments on commit b33f8f1

Please sign in to comment.