Skip to content

Commit 1766900

Browse files
mkardous-silabspull[bot]
authored andcommitted
[EFR32] Fix light switch example for efr32 (#15431)
* fix light-switch * Restyle
1 parent 2140acc commit 1766900

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

examples/light-switch-app/efr32/src/binding-handler.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "controller/InvokeInteraction.h"
2727

2828
namespace {
29-
void BoundDeviceChangedHandler(const EmberBindingTableEntry * binding, chip::DeviceProxy * peer_device, void * context)
29+
void BoundDeviceChangedHandler(const EmberBindingTableEntry & binding, chip::DeviceProxy * peer_device, void * context)
3030
{
3131
using namespace chip;
3232
using namespace chip::app;
@@ -38,17 +38,18 @@ void BoundDeviceChangedHandler(const EmberBindingTableEntry * binding, chip::Dev
3838
ChipLogError(NotSpecified, "OnOff command failed: %" CHIP_ERROR_FORMAT, error.Format());
3939
};
4040

41-
if (binding->type == EMBER_MULTICAST_BINDING)
41+
if (binding.type == EMBER_MULTICAST_BINDING)
4242
{
4343
ChipLogError(NotSpecified, "Group binding is not supported now");
4444
return;
4545
}
4646

47-
if (binding->type == EMBER_UNICAST_BINDING && binding->local == 1 && binding->clusterId == Clusters::OnOff::Id)
47+
if (binding.type == EMBER_UNICAST_BINDING && binding.local == 1 && binding.clusterId.HasValue() &&
48+
binding.clusterId.Value() == Clusters::OnOff::Id)
4849
{
4950
Clusters::OnOff::Commands::Toggle::Type toggleCommand;
50-
Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(),
51-
binding->remote, toggleCommand, onSuccess, onFailure);
51+
Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote,
52+
toggleCommand, onSuccess, onFailure);
5253
}
5354
}
5455
} // namespace

0 commit comments

Comments
 (0)