From 1766900fa89451ad8a14dcfe79914179c1b1cc8d Mon Sep 17 00:00:00 2001 From: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com> Date: Tue, 22 Feb 2022 17:48:23 -0500 Subject: [PATCH] [EFR32] Fix light switch example for efr32 (#15431) * fix light-switch * Restyle --- .../light-switch-app/efr32/src/binding-handler.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/light-switch-app/efr32/src/binding-handler.cpp b/examples/light-switch-app/efr32/src/binding-handler.cpp index bd69d74802d091..e32c6d6f0a1d9e 100644 --- a/examples/light-switch-app/efr32/src/binding-handler.cpp +++ b/examples/light-switch-app/efr32/src/binding-handler.cpp @@ -26,7 +26,7 @@ #include "controller/InvokeInteraction.h" namespace { -void BoundDeviceChangedHandler(const EmberBindingTableEntry * binding, chip::DeviceProxy * peer_device, void * context) +void BoundDeviceChangedHandler(const EmberBindingTableEntry & binding, chip::DeviceProxy * peer_device, void * context) { using namespace chip; using namespace chip::app; @@ -38,17 +38,18 @@ void BoundDeviceChangedHandler(const EmberBindingTableEntry * binding, chip::Dev ChipLogError(NotSpecified, "OnOff command failed: %" CHIP_ERROR_FORMAT, error.Format()); }; - if (binding->type == EMBER_MULTICAST_BINDING) + if (binding.type == EMBER_MULTICAST_BINDING) { ChipLogError(NotSpecified, "Group binding is not supported now"); return; } - if (binding->type == EMBER_UNICAST_BINDING && binding->local == 1 && binding->clusterId == Clusters::OnOff::Id) + if (binding.type == EMBER_UNICAST_BINDING && binding.local == 1 && binding.clusterId.HasValue() && + binding.clusterId.Value() == Clusters::OnOff::Id) { Clusters::OnOff::Commands::Toggle::Type toggleCommand; - Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), - binding->remote, toggleCommand, onSuccess, onFailure); + Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(), binding.remote, + toggleCommand, onSuccess, onFailure); } } } // namespace