Skip to content

Commit

Permalink
RPC: Restart commissioning after setting SpakeInfo
Browse files Browse the repository at this point in the history
The CommissioningWindowManager now caches the CommssionableDataProvider
and therefore needs to be restarted after changing the SpakeInfo using
the RPC for testing.
  • Loading branch information
Rob Oliver committed Oct 21, 2022
1 parent a325034 commit 42ff525
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions examples/common/pigweed/rpc_services/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <platform/CommissionableDataProvider.h>

#include "app/clusters/ota-requestor/OTARequestorInterface.h"
#include "app/server/CommissioningWindowManager.h"
#include "app/server/OnboardingCodesUtil.h"
#include "app/server/Server.h"
#include "credentials/FabricTable.h"
Expand Down Expand Up @@ -418,6 +419,21 @@ class Device : public pw_rpc::nanopb::Device::Service<Device>
{
mCommissionableDataProvider.SetSpake2pVerifier(ByteSpan(request.verifier.bytes, request.verifier.size));
}

if (Server::GetInstance().GetCommissioningWindowManager().IsCommissioningWindowOpen())
{
// Restart commissioning window to recache the value:
{
DeviceLayer::StackLock lock;
Server::GetInstance().GetCommissioningWindowManager().CloseCommissioningWindow();
}
// Let other tasks possibly work since Commissioning window close/open are "heavy"
{
DeviceLayer::StackLock lock;
Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow();
}
}

return pw::OkStatus();
}

Expand Down

0 comments on commit 42ff525

Please sign in to comment.