Skip to content

Commit

Permalink
get ExchangeManager from Server instead of chip:: method (#9943)
Browse files Browse the repository at this point in the history
  • Loading branch information
holbrookt authored Sep 28, 2021
1 parent 52535b1 commit 3c45842
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions examples/ota-provider-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ int main(int argc, char * argv[])
CHIP_ERROR err = CHIP_NO_ERROR;
OTAProviderExample otaProvider;
BdxOtaSender bdxServer;
ExchangeManager * exchangeMgr;

if (chip::Platform::MemoryInit() != CHIP_NO_ERROR)
{
Expand All @@ -123,9 +122,13 @@ int main(int argc, char * argv[])
chip::DeviceLayer::ConfigurationMgr().LogDeviceConfig();
chip::Server::GetInstance().Init();

exchangeMgr = chip::ExchangeManager();
err = exchangeMgr->RegisterUnsolicitedMessageHandlerForProtocol(chip::Protocols::BDX::Id, &bdxServer);
VerifyOrReturnError(err == CHIP_NO_ERROR, 1);
err = chip::Server::GetInstance().GetExchangeManager().RegisterUnsolicitedMessageHandlerForProtocol(chip::Protocols::BDX::Id,
&bdxServer);
if (err != CHIP_NO_ERROR)
{
ChipLogDetail(SoftwareUpdate, "RegisterUnsolicitedMessageHandler failed: %s", chip::ErrorStr(err));
return 1;
}

ChipLogDetail(SoftwareUpdate, "using OTA file: %s", gOtaFilepath ? gOtaFilepath : "(none)");

Expand All @@ -144,6 +147,7 @@ int main(int argc, char * argv[])
if (err != CHIP_NO_ERROR)
{
ChipLogError(BDX, "failed to init BDX server: %s", chip::ErrorStr(err));
return 1;
}

chip::DeviceLayer::PlatformMgr().RunEventLoop();
Expand Down

0 comments on commit 3c45842

Please sign in to comment.