Skip to content

Commit

Permalink
[EFR32] Fix light switch example for efr32 (#15431)
Browse files Browse the repository at this point in the history
* fix light-switch

* Restyle
  • Loading branch information
mkardous-silabs authored and pull[bot] committed Feb 2, 2024
1 parent 2140acc commit 1766900
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions examples/light-switch-app/efr32/src/binding-handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 1766900

Please sign in to comment.