Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No longer provide OperationDeviceProxy in OnDeviceConnected callback #21256

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
2612ea8
No longer provide OperationDeviceProxy in OnDeviceConnected callback
tehampson Jul 14, 2022
deb7c9c
Fix minor CI compiler issues introduce with code cleanup
tehampson Jul 27, 2022
6886d3b
Restyle and handle Disconnect from callers previously using FindExist…
tehampson Jul 27, 2022
70157db
name cleanup, small python change, restyle
tehampson Jul 27, 2022
93a7416
Merge branch 'master' into operational-device-proxy-19259-part-3
tehampson Jul 27, 2022
0efbe31
Fix new compiler errors after merging master
tehampson Jul 27, 2022
0ff0241
Address PR comments
tehampson Jul 28, 2022
74c80ab
Restyle
tehampson Jul 28, 2022
0851d38
Merge branch 'master' into operational-device-proxy-19259-part-3
tehampson Jul 28, 2022
f73d28e
Fix ameba CI issue
tehampson Jul 28, 2022
abc0179
Restyle
tehampson Jul 28, 2022
d25f5c3
Merge branch 'master' into operational-device-proxy-19259-part-3
tehampson Jul 28, 2022
ecf1035
Merge branch 'master' into operational-device-proxy-19259-part-3
tehampson Aug 2, 2022
d688df9
Make changes to Darwin OnConnected callback
tehampson Aug 2, 2022
1f13582
Restyle
tehampson Aug 2, 2022
a5a40a5
Small fix
tehampson Aug 2, 2022
d735904
Small fix add JNIU to release OperationDeviceProxy
tehampson Aug 2, 2022
6e9cb4b
Small CI fix
tehampson Aug 2, 2022
be7c941
Address PR comments
tehampson Aug 2, 2022
9ee9e82
Address PR comment
tehampson Aug 2, 2022
a940a62
Small fix
tehampson Aug 2, 2022
9032db4
Restyle
tehampson Aug 2, 2022
3c9c10e
Merge branch 'master' into operational-device-proxy-19259-part-3
tehampson Aug 3, 2022
e1c40b2
change timeout to 10min
tehampson Aug 3, 2022
acdb99d
Experiment to see if cirque CI passes
tehampson Aug 3, 2022
9666a8f
Crique CI test change
tehampson Aug 4, 2022
53c9c3e
Remove test hacks for CI
tehampson Aug 4, 2022
cd525a1
Merge branch 'master' into operational-device-proxy-19259-part-3
tehampson Aug 4, 2022
d5e978c
Test to see if this is a real fix to cirque CI issue
tehampson Aug 4, 2022
126d18d
Hopefully a real fix to cirque CI failure
tehampson Aug 4, 2022
af29fe6
Address final PR comments
tehampson Aug 4, 2022
ead0907
Address PR comments
tehampson Aug 4, 2022
5af3c25
Restyle
tehampson Aug 4, 2022
dd8ff17
Address PR comments
tehampson Aug 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ static void RegisterSwitchCommands()
}
#endif // defined(ENABLE_CHIP_SHELL)

static void BoundDeviceChangedHandler(const EmberBindingTableEntry & binding, chip::DeviceProxy * peer_device, void * context)
static void BoundDeviceChangedHandler(const EmberBindingTableEntry & binding, chip::OperationalDeviceProxy * peer_device,
mrjerryjohns marked this conversation as resolved.
Show resolved Hide resolved
void * context)
{
using namespace chip;
using namespace chip::app;
Expand All @@ -88,6 +89,7 @@ static void BoundDeviceChangedHandler(const EmberBindingTableEntry & binding, ch
ChipLogError(NotSpecified, "OnOff command failed: %" CHIP_ERROR_FORMAT, error.Format());
};

VerifyOrDie(peer_device != nullptr && peer_device->ConnectionReady());
if (sSwitchOnOffState)
{
Clusters::OnOff::Commands::On::Type onCommand;
Expand Down
6 changes: 4 additions & 2 deletions examples/all-clusters-app/ameba/main/BindingHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ Engine sShellSwitchBindingSubCommands;

namespace {

void ProcessOnOffUnicastBindingCommand(CommandId commandId, const EmberBindingTableEntry & binding, DeviceProxy * peer_device)
void ProcessOnOffUnicastBindingCommand(CommandId commandId, const EmberBindingTableEntry & binding,
OperationalDeviceProxy * peer_device)
{
auto onSuccess = [](const ConcreteCommandPath & commandPath, const StatusIB & status, const auto & dataResponse) {
ChipLogProgress(NotSpecified, "OnOff command succeeds");
Expand All @@ -60,6 +61,7 @@ void ProcessOnOffUnicastBindingCommand(CommandId commandId, const EmberBindingTa
ChipLogError(NotSpecified, "OnOff command failed: %" CHIP_ERROR_FORMAT, error.Format());
};

VerifyOrDie(peer_device != nullptr && peer_device->ConnectionReady());
switch (commandId)
{
case Clusters::OnOff::Commands::Toggle::Id:
Expand Down Expand Up @@ -106,7 +108,7 @@ void ProcessOnOffGroupBindingCommand(CommandId commandId, const EmberBindingTabl
}
}

void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, DeviceProxy * peer_device, void * context)
void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, OperationalDeviceProxy * peer_device, void * context)
{
VerifyOrReturn(context != nullptr, ChipLogError(NotSpecified, "OnDeviceConnectedFn: context is null"));
BindingCommandData * data = static_cast<BindingCommandData *>(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class CASECommands

private:
CASECommands() {}
static void OnConnected(void * context, OperationalDeviceProxy * deviceProxy)
static void OnConnected(void * context, Messaging::ExchangeManager & exchangeMgr, SessionHandle & sessionHandle)
{
streamer_printf(streamer_get(), "Establish CASESession Success!\r\n");
GetInstance().SetOnConnecting(false);
Expand Down
4 changes: 3 additions & 1 deletion examples/all-clusters-app/nxp/mw320/binding-handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ static void RegisterSwitchCommands()
}
#endif // defined(ENABLE_CHIP_SHELL)

static void BoundDeviceChangedHandler(const EmberBindingTableEntry & binding, chip::DeviceProxy * peer_device, void * context)
static void BoundDeviceChangedHandler(const EmberBindingTableEntry & binding, chip::OperationalDeviceProxy * peer_device,
void * context)
{
using namespace chip;
using namespace chip::app;
Expand All @@ -92,6 +93,7 @@ static void BoundDeviceChangedHandler(const EmberBindingTableEntry & binding, ch
// command (SwitchCommandHandler)
{
Clusters::OnOff::Commands::Toggle::Type toggleCommand;
VerifyOrDie(peer_device != nullptr && peer_device->ConnectionReady());
Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(),
binding.remote, toggleCommand, onSuccess, onFailure);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class CASECommands

private:
CASECommands() {}
static void OnConnected(void * context, OperationalDeviceProxy * deviceProxy)
static void OnConnected(void * context, Messaging::ExchangeManager & exchangeMgr, SessionHandle & sessionHandle)
{
streamer_printf(streamer_get(), "Establish CASESession Success!\r\n");
GetInstance().SetOnConnecting(false);
Expand Down
6 changes: 4 additions & 2 deletions examples/chip-tool/commands/clusters/ModelCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ CHIP_ERROR ModelCommand::RunCommand()
&mOnDeviceConnectionFailureCallback);
}

void ModelCommand::OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device)
void ModelCommand::OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr,
chip::SessionHandle & sessionHandle)
{
ModelCommand * command = reinterpret_cast<ModelCommand *>(context);
VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "OnDeviceConnectedFn: context is null"));

CHIP_ERROR err = command->SendCommand(device, command->mEndPointId);
chip::OperationalDeviceProxy device(&exchangeMgr, sessionHandle);
tehampson marked this conversation as resolved.
Show resolved Hide resolved
CHIP_ERROR err = command->SendCommand(&device, command->mEndPointId);
VerifyOrReturn(CHIP_NO_ERROR == err, command->SetCommandExitStatus(err));
}

Expand Down
3 changes: 2 additions & 1 deletion examples/chip-tool/commands/clusters/ModelCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ class ModelCommand : public CHIPCommand
chip::NodeId mDestinationId;
std::vector<chip::EndpointId> mEndPointId;

static void OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device);
static void OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr,
chip::SessionHandle & sessionHandle);
static void OnDeviceConnectionFailureFn(void * context, const chip::ScopedNodeId & peerId, CHIP_ERROR error);

chip::Callback::Callback<chip::OnDeviceConnected> mOnDeviceConnectedCallback;
Expand Down
14 changes: 7 additions & 7 deletions examples/chip-tool/commands/pairing/CloseSessionCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,16 @@ CHIP_ERROR CloseSessionCommand::RunCommand()
CommissioneeDeviceProxy * commissioneeDeviceProxy = nullptr;
if (CHIP_NO_ERROR == CurrentCommissioner().GetDeviceBeingCommissioned(mDestinationId, &commissioneeDeviceProxy))
{
return CloseSession(commissioneeDeviceProxy);
VerifyOrReturnError(commissioneeDeviceProxy->GetSecureSession().HasValue(), CHIP_ERROR_INCORRECT_STATE);
return CloseSession(*commissioneeDeviceProxy->GetExchangeManager(), commissioneeDeviceProxy->GetSecureSession().Value());
}

return CurrentCommissioner().GetConnectedDevice(mDestinationId, &mOnDeviceConnectedCallback,
&mOnDeviceConnectionFailureCallback);
}

CHIP_ERROR CloseSessionCommand::CloseSession(DeviceProxy * device)
CHIP_ERROR CloseSessionCommand::CloseSession(Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle)
{
VerifyOrReturnError(device->GetSecureSession().HasValue(), CHIP_ERROR_INCORRECT_STATE);

// TODO perhaps factor out this code into something on StatusReport that
// takes an exchange and maybe a SendMessageFlags?
SecureChannel::StatusReport statusReport(SecureChannel::GeneralStatusCode::kSuccess, SecureChannel::Id,
Expand All @@ -51,7 +50,7 @@ CHIP_ERROR CloseSessionCommand::CloseSession(DeviceProxy * device)
System::PacketBufferHandle msg = bbuf.Finalize();
VerifyOrReturnError(!msg.IsNull(), CHIP_ERROR_NO_MEMORY);

auto * exchange = device->GetExchangeManager()->NewContext(device->GetSecureSession().Value(), nullptr);
auto * exchange = exchangeMgr.NewContext(sessionHandle, nullptr);
VerifyOrReturnError(exchange != nullptr, CHIP_ERROR_NO_MEMORY);

// Per spec, CloseSession reports are always sent with MRP disabled.
Expand All @@ -69,12 +68,13 @@ CHIP_ERROR CloseSessionCommand::CloseSession(DeviceProxy * device)
return err;
}

void CloseSessionCommand::OnDeviceConnectedFn(void * context, OperationalDeviceProxy * device)
void CloseSessionCommand::OnDeviceConnectedFn(void * context, Messaging::ExchangeManager & exchangeMgr,
SessionHandle & sessionHandle)
{
auto * command = reinterpret_cast<CloseSessionCommand *>(context);
VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "OnDeviceConnectedFn: context is null"));

CHIP_ERROR err = command->CloseSession(device);
CHIP_ERROR err = command->CloseSession(exchangeMgr, sessionHandle);
VerifyOrReturn(CHIP_NO_ERROR == err, command->SetCommandExitStatus(err));
}

Expand Down
7 changes: 4 additions & 3 deletions examples/chip-tool/commands/pairing/CloseSessionCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#pragma once

#include "../common/CHIPCommand.h"
#include <app/OperationalDeviceProxy.h>
#include <app/OperationalSessionSetup.h>
#include <lib/core/CHIPCallback.h>
#include <lib/core/DataModelTypes.h>

Expand All @@ -46,11 +46,12 @@ class CloseSessionCommand : public CHIPCommand
chip::NodeId mDestinationId;
chip::Optional<uint16_t> mTimeoutSecs;

static void OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device);
static void OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr,
chip::SessionHandle & sessionHandle);
static void OnDeviceConnectionFailureFn(void * context, const chip::ScopedNodeId & peerId, CHIP_ERROR error);

// Try to send the action CloseSession status report.
CHIP_ERROR CloseSession(chip::DeviceProxy * device);
CHIP_ERROR CloseSession(chip::Messaging::ExchangeManager & exchangeMgr, const chip::SessionHandle & sessionHandle);

chip::Callback::Callback<chip::OnDeviceConnected> mOnDeviceConnectedCallback;
chip::Callback::Callback<chip::OnDeviceConnectionFailure> mOnDeviceConnectionFailureCallback;
Expand Down
5 changes: 3 additions & 2 deletions examples/chip-tool/commands/tests/TestCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ CHIP_ERROR TestCommand::WaitForCommissionee(const char * identity,
&mOnDeviceConnectionFailureCallback);
}

void TestCommand::OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device)
void TestCommand::OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr,
chip::SessionHandle & sessionHandle)
{
ChipLogProgress(chipTool, " **** Test Setup: Device Connected\n");
auto * command = static_cast<TestCommand *>(context);
VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "Device connected, but cannot run the test, as the context is null"));
command->mDevices[command->GetIdentity()] = device;
command->mDevices[command->GetIdentity()] = std::make_unique<chip::OperationalDeviceProxy>(&exchangeMgr, sessionHandle);

LogErrorOnFailure(command->ContinueOnChipMainThread(CHIP_NO_ERROR));
}
Expand Down
7 changes: 4 additions & 3 deletions examples/chip-tool/commands/tests/TestCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ class TestCommand : public TestRunner,
void OnWaitForMs() override { NextTest(); };

/////////// Interaction Model Interface /////////
chip::DeviceProxy * GetDevice(const char * identity) override { return mDevices[identity]; }
chip::DeviceProxy * GetDevice(const char * identity) override { return mDevices[identity].get(); }
void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override{};

static void OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device);
static void OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr,
chip::SessionHandle & sessionHandle);
static void OnDeviceConnectionFailureFn(void * context, const chip::ScopedNodeId & peerId, CHIP_ERROR error);

CHIP_ERROR ContinueOnChipMainThread(CHIP_ERROR err) override;
Expand All @@ -94,7 +95,7 @@ class TestCommand : public TestRunner,

chip::Optional<char *> mPICSFilePath;
chip::Optional<uint16_t> mTimeout;
std::map<std::string, chip::DeviceProxy *> mDevices;
std::map<std::string, std::unique_ptr<chip::OperationalDeviceProxy>> mDevices;

// When set to false, prevents interaction model events from affecting the current test status.
// This flag exists because if an error happens while processing a response the allocated
Expand Down
6 changes: 4 additions & 2 deletions examples/light-switch-app/ameba/main/BindingHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ Engine sShellSwitchBindingSubCommands;

namespace {

void ProcessOnOffUnicastBindingCommand(CommandId commandId, const EmberBindingTableEntry & binding, DeviceProxy * peer_device)
void ProcessOnOffUnicastBindingCommand(CommandId commandId, const EmberBindingTableEntry & binding,
OperationalDeviceProxy * peer_device)
{
auto onSuccess = [](const ConcreteCommandPath & commandPath, const StatusIB & status, const auto & dataResponse) {
ChipLogProgress(NotSpecified, "OnOff command succeeds");
Expand All @@ -60,6 +61,7 @@ void ProcessOnOffUnicastBindingCommand(CommandId commandId, const EmberBindingTa
ChipLogError(NotSpecified, "OnOff command failed: %" CHIP_ERROR_FORMAT, error.Format());
};

VerifyOrDie(peer_device != nullptr && peer_device->ConnectionReady());
switch (commandId)
{
case Clusters::OnOff::Commands::Toggle::Id:
Expand Down Expand Up @@ -106,7 +108,7 @@ void ProcessOnOffGroupBindingCommand(CommandId commandId, const EmberBindingTabl
}
}

void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, DeviceProxy * peer_device, void * context)
void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, OperationalDeviceProxy * peer_device, void * context)
{
VerifyOrReturn(context != nullptr, ChipLogError(NotSpecified, "OnDeviceConnectedFn: context is null"));
BindingCommandData * data = static_cast<BindingCommandData *>(context);
Expand Down
18 changes: 9 additions & 9 deletions examples/light-switch-app/efr32/src/binding-handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ Engine sShellSwitchBindingSubCommands;

namespace {

void ProcessOnOffUnicastBindingCommand(CommandId commandId, const EmberBindingTableEntry & binding, DeviceProxy * peer_device)
void ProcessOnOffUnicastBindingCommand(CommandId commandId, const EmberBindingTableEntry & binding,
Messaging::ExchangeManager * exchangeMgr, const SessionHandle & sessionHandle)
{
auto onSuccess = [](const ConcreteCommandPath & commandPath, const StatusIB & status, const auto & dataResponse) {
ChipLogProgress(NotSpecified, "OnOff command succeeds");
Expand All @@ -65,20 +66,17 @@ void ProcessOnOffUnicastBindingCommand(CommandId commandId, const EmberBindingTa
{
case Clusters::OnOff::Commands::Toggle::Id:
Clusters::OnOff::Commands::Toggle::Type toggleCommand;
Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote,
toggleCommand, onSuccess, onFailure);
Controller::InvokeCommandRequest(exchangeMgr, sessionHandle, binding.remote, toggleCommand, onSuccess, onFailure);
break;

case Clusters::OnOff::Commands::On::Id:
Clusters::OnOff::Commands::On::Type onCommand;
Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote,
onCommand, onSuccess, onFailure);
Controller::InvokeCommandRequest(exchangeMgr, sessionHandle, binding.remote, onCommand, onSuccess, onFailure);
break;

case Clusters::OnOff::Commands::Off::Id:
Clusters::OnOff::Commands::Off::Type offCommand;
Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote,
offCommand, onSuccess, onFailure);
Controller::InvokeCommandRequest(exchangeMgr, sessionHandle, binding.remote, offCommand, onSuccess, onFailure);
break;
}
}
Expand Down Expand Up @@ -107,7 +105,7 @@ void ProcessOnOffGroupBindingCommand(CommandId commandId, const EmberBindingTabl
}
}

void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, DeviceProxy * peer_device, void * context)
void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, OperationalDeviceProxy * peer_device, void * context)
{
VerifyOrReturn(context != nullptr, ChipLogError(NotSpecified, "OnDeviceConnectedFn: context is null"));
BindingCommandData * data = static_cast<BindingCommandData *>(context);
Expand All @@ -126,7 +124,9 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, DevicePro
switch (data->clusterId)
{
case Clusters::OnOff::Id:
ProcessOnOffUnicastBindingCommand(data->commandId, binding, peer_device);
VerifyOrDie(peer_device != nullptr && peer_device->ConnectionReady());
ProcessOnOffUnicastBindingCommand(data->commandId, binding, peer_device->GetExchangeManager(),
peer_device->GetSecureSession().Value());
break;
}
}
Expand Down
18 changes: 9 additions & 9 deletions examples/light-switch-app/esp32/main/BindingHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ Engine sShellSwitchBindingSubCommands;

namespace {

void ProcessOnOffUnicastBindingCommand(CommandId commandId, const EmberBindingTableEntry & binding, DeviceProxy * peer_device)
void ProcessOnOffUnicastBindingCommand(CommandId commandId, const EmberBindingTableEntry & binding,
Messaging::ExchangeManager * exchangeMgr, const SessionHandle & sessionHandle)
{
auto onSuccess = [](const ConcreteCommandPath & commandPath, const StatusIB & status, const auto & dataResponse) {
ChipLogProgress(NotSpecified, "OnOff command succeeds");
Expand All @@ -64,20 +65,17 @@ void ProcessOnOffUnicastBindingCommand(CommandId commandId, const EmberBindingTa
{
case Clusters::OnOff::Commands::Toggle::Id:
Clusters::OnOff::Commands::Toggle::Type toggleCommand;
Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote,
toggleCommand, onSuccess, onFailure);
Controller::InvokeCommandRequest(exchangeMgr, sessionHandle, binding.remote, toggleCommand, onSuccess, onFailure);
break;

case Clusters::OnOff::Commands::On::Id:
Clusters::OnOff::Commands::On::Type onCommand;
Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote,
onCommand, onSuccess, onFailure);
Controller::InvokeCommandRequest(exchangeMgr, sessionHandle, binding.remote, onCommand, onSuccess, onFailure);
break;

case Clusters::OnOff::Commands::Off::Id:
Clusters::OnOff::Commands::Off::Type offCommand;
Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote,
offCommand, onSuccess, onFailure);
Controller::InvokeCommandRequest(exchangeMgr, sessionHandle, binding.remote, offCommand, onSuccess, onFailure);
break;
}
}
Expand Down Expand Up @@ -106,7 +104,7 @@ void ProcessOnOffGroupBindingCommand(CommandId commandId, const EmberBindingTabl
}
}

void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, DeviceProxy * peer_device, void * context)
void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, OperationalDeviceProxy * peer_device, void * context)
{
VerifyOrReturn(context != nullptr, ChipLogError(NotSpecified, "OnDeviceConnectedFn: context is null"));
BindingCommandData * data = static_cast<BindingCommandData *>(context);
Expand All @@ -125,7 +123,9 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, DevicePro
switch (data->clusterId)
{
case Clusters::OnOff::Id:
ProcessOnOffUnicastBindingCommand(data->commandId, binding, peer_device);
VerifyOrDie(peer_device != nullptr && peer_device->ConnectionReady());
ProcessOnOffUnicastBindingCommand(data->commandId, binding, peer_device->GetExchangeManager(),
peer_device->GetSecureSession().Value());
break;
}
}
Expand Down
Loading