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 20, 2022
1 parent d7cd5aa commit aea35dd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 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,14 @@ class Device : public pw_rpc::nanopb::Device::Service<Device>
{
mCommissionableDataProvider.SetSpake2pVerifier(ByteSpan(request.verifier.bytes, request.verifier.size));
}

// Resetart commissioning window to recache the value:
{
DeviceLayer::StackLock lock;
Server::GetInstance().GetCommissioningWindowManager().CloseCommissioningWindow();
Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow();
}

return pw::OkStatus();
}

Expand Down

0 comments on commit aea35dd

Please sign in to comment.