@@ -51,7 +51,8 @@ Engine sShellSwitchBindingSubCommands;
51
51
52
52
namespace {
53
53
54
- void ProcessOnOffUnicastBindingCommand (CommandId commandId, const EmberBindingTableEntry & binding, DeviceProxy * peer_device)
54
+ void ProcessOnOffUnicastBindingCommand (CommandId commandId, const EmberBindingTableEntry & binding,
55
+ Messaging::ExchangeManager * exchangeMgr, const SessionHandle & sessionHandle)
55
56
{
56
57
auto onSuccess = [](const ConcreteCommandPath & commandPath, const StatusIB & status, const auto & dataResponse) {
57
58
ChipLogProgress (NotSpecified, " OnOff command succeeds" );
@@ -65,20 +66,17 @@ void ProcessOnOffUnicastBindingCommand(CommandId commandId, const EmberBindingTa
65
66
{
66
67
case Clusters::OnOff::Commands::Toggle::Id:
67
68
Clusters::OnOff::Commands::Toggle::Type toggleCommand;
68
- Controller::InvokeCommandRequest (peer_device->GetExchangeManager (), peer_device->GetSecureSession ().Value (), binding.remote ,
69
- toggleCommand, onSuccess, onFailure);
69
+ Controller::InvokeCommandRequest (exchangeMgr, sessionHandle, binding.remote , toggleCommand, onSuccess, onFailure);
70
70
break ;
71
71
72
72
case Clusters::OnOff::Commands::On::Id:
73
73
Clusters::OnOff::Commands::On::Type onCommand;
74
- Controller::InvokeCommandRequest (peer_device->GetExchangeManager (), peer_device->GetSecureSession ().Value (), binding.remote ,
75
- onCommand, onSuccess, onFailure);
74
+ Controller::InvokeCommandRequest (exchangeMgr, sessionHandle, binding.remote , onCommand, onSuccess, onFailure);
76
75
break ;
77
76
78
77
case Clusters::OnOff::Commands::Off::Id:
79
78
Clusters::OnOff::Commands::Off::Type offCommand;
80
- Controller::InvokeCommandRequest (peer_device->GetExchangeManager (), peer_device->GetSecureSession ().Value (), binding.remote ,
81
- offCommand, onSuccess, onFailure);
79
+ Controller::InvokeCommandRequest (exchangeMgr, sessionHandle, binding.remote , offCommand, onSuccess, onFailure);
82
80
break ;
83
81
}
84
82
}
@@ -107,7 +105,7 @@ void ProcessOnOffGroupBindingCommand(CommandId commandId, const EmberBindingTabl
107
105
}
108
106
}
109
107
110
- void LightSwitchChangedHandler (const EmberBindingTableEntry & binding, DeviceProxy * peer_device, void * context)
108
+ void LightSwitchChangedHandler (const EmberBindingTableEntry & binding, OperationalDeviceProxy * peer_device, void * context)
111
109
{
112
110
VerifyOrReturn (context != nullptr , ChipLogError (NotSpecified, " OnDeviceConnectedFn: context is null" ));
113
111
BindingCommandData * data = static_cast <BindingCommandData *>(context);
@@ -126,7 +124,9 @@ void LightSwitchChangedHandler(const EmberBindingTableEntry & binding, DevicePro
126
124
switch (data->clusterId )
127
125
{
128
126
case Clusters::OnOff::Id:
129
- ProcessOnOffUnicastBindingCommand (data->commandId , binding, peer_device);
127
+ VerifyOrDie (peer_device != nullptr && peer_device->ConnectionReady ());
128
+ ProcessOnOffUnicastBindingCommand (data->commandId , binding, peer_device->GetExchangeManager (),
129
+ peer_device->GetSecureSession ().Value ());
130
130
break ;
131
131
}
132
132
}
0 commit comments