Skip to content

Commit

Permalink
Add an instance of BDXTransferServer to be started by the CHIPDeviceC…
Browse files Browse the repository at this point in the history
…ontrollerFactory
  • Loading branch information
vivien-apple committed Jan 18, 2024
1 parent dabb7e2 commit 145cb8f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/controller/CHIPDeviceControllerFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ CHIP_ERROR DeviceControllerFactory::InitSystemState(FactoryInitParams params)
stateParams.timerDelegate = chip::Platform::New<chip::app::DefaultTimerDelegate>();
stateParams.reportScheduler = chip::Platform::New<app::reporting::ReportSchedulerImpl>(stateParams.timerDelegate);
stateParams.sessionKeystore = params.sessionKeystore;
stateParams.bdxTransferServer = chip::Platform::New<bdx::BDXTransferServer>();

// if no fabricTable was provided, create one and track it in stateParams for cleanup
stateParams.fabricTable = params.fabricTable;
Expand Down Expand Up @@ -225,6 +226,7 @@ CHIP_ERROR DeviceControllerFactory::InitSystemState(FactoryInitParams params)
ReturnErrorOnFailure(stateParams.exchangeMgr->Init(stateParams.sessionMgr));
ReturnErrorOnFailure(stateParams.messageCounterManager->Init(stateParams.exchangeMgr));
ReturnErrorOnFailure(stateParams.unsolicitedStatusHandler->Init(stateParams.exchangeMgr));
ReturnErrorOnFailure(stateParams.bdxTransferServer->ListenForSendInit(stateParams.systemLayer, stateParams.exchangeMgr));

InitDataModelHandler();

Expand Down Expand Up @@ -438,6 +440,13 @@ void DeviceControllerSystemState::Shutdown()
mFabricTableDelegate = nullptr;
}

if (mBDXTransferServer != nullptr)
{
mBDXTransferServer->Shutdown();
chip::Platform::Delete(mBDXTransferServer);
mBDXTransferServer = nullptr;
}

if (mCASEServer != nullptr)
{
mCASEServer->Shutdown();
Expand Down
9 changes: 7 additions & 2 deletions src/controller/CHIPDeviceControllerSystemState.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <credentials/GroupDataProvider.h>
#include <crypto/SessionKeystore.h>
#include <lib/core/CHIPConfig.h>
#include <protocols/bdx/BdxTransferServer.h>
#include <protocols/secure_channel/CASEServer.h>
#include <protocols/secure_channel/MessageCounterManager.h>
#include <protocols/secure_channel/SimpleSessionResumptionStorage.h>
Expand Down Expand Up @@ -102,6 +103,7 @@ struct DeviceControllerSystemStateParams
Protocols::SecureChannel::UnsolicitedStatusHandler * unsolicitedStatusHandler = nullptr;
Messaging::ExchangeManager * exchangeMgr = nullptr;
secure_channel::MessageCounterManager * messageCounterManager = nullptr;
bdx::BDXTransferServer * bdxTransferServer = nullptr;
CASEServer * caseServer = nullptr;
CASESessionManager * caseSessionManager = nullptr;
SessionSetupPool * sessionSetupPool = nullptr;
Expand Down Expand Up @@ -136,7 +138,8 @@ class DeviceControllerSystemState
mSystemLayer(params.systemLayer), mTCPEndPointManager(params.tcpEndPointManager),
mUDPEndPointManager(params.udpEndPointManager), mTransportMgr(params.transportMgr), mSessionMgr(params.sessionMgr),
mUnsolicitedStatusHandler(params.unsolicitedStatusHandler), mExchangeMgr(params.exchangeMgr),
mMessageCounterManager(params.messageCounterManager), mFabrics(params.fabricTable), mCASEServer(params.caseServer),
mMessageCounterManager(params.messageCounterManager), mFabrics(params.fabricTable),
mBDXTransferServer(params.bdxTransferServer), mCASEServer(params.caseServer),
mCASESessionManager(params.caseSessionManager), mSessionSetupPool(params.sessionSetupPool),
mCASEClientPool(params.caseClientPool), mGroupDataProvider(params.groupDataProvider), mTimerDelegate(params.timerDelegate),
mReportScheduler(params.reportScheduler), mSessionKeystore(params.sessionKeystore),
Expand Down Expand Up @@ -190,7 +193,7 @@ class DeviceControllerSystemState
mUnsolicitedStatusHandler != nullptr && mExchangeMgr != nullptr && mMessageCounterManager != nullptr &&
mFabrics != nullptr && mCASESessionManager != nullptr && mSessionSetupPool != nullptr && mCASEClientPool != nullptr &&
mGroupDataProvider != nullptr && mReportScheduler != nullptr && mTimerDelegate != nullptr &&
mSessionKeystore != nullptr && mSessionResumptionStorage != nullptr;
mSessionKeystore != nullptr && mSessionResumptionStorage != nullptr && mBDXTransferServer != nullptr;
};

System::Layer * SystemLayer() const { return mSystemLayer; };
Expand All @@ -214,6 +217,7 @@ class DeviceControllerSystemState
mTempFabricTable = tempFabricTable;
mEnableServerInteractions = enableServerInteractions;
}
bdx::BDXTransferServer * BDXTransferServer() const { return mBDXTransferServer; }

private:
DeviceControllerSystemState() {}
Expand All @@ -230,6 +234,7 @@ class DeviceControllerSystemState
Messaging::ExchangeManager * mExchangeMgr = nullptr;
secure_channel::MessageCounterManager * mMessageCounterManager = nullptr;
FabricTable * mFabrics = nullptr;
bdx::BDXTransferServer * mBDXTransferServer = nullptr;
CASEServer * mCASEServer = nullptr;
CASESessionManager * mCASESessionManager = nullptr;
SessionSetupPool * mSessionSetupPool = nullptr;
Expand Down

0 comments on commit 145cb8f

Please sign in to comment.