Skip to content

Commit

Permalink
some code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pan-apple committed Feb 8, 2021
1 parent e44a446 commit 19cd638
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/all-clusters-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ class SetupListModel : public ListScreen::Model
if (i == 0)
{
ConnectivityMgr().ClearWiFiStationProvision();
OpenDefaultPairingWindow(true);
OpenDefaultPairingWindow(kResetAdmins);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/app/server/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class ServerCallback : public SecureSessionMgrDelegate

if (err != CHIP_NO_ERROR)
{
SuccessOrExit(err = OpenDefaultPairingWindow(false));
SuccessOrExit(err = OpenDefaultPairingWindow(kDoNotResetAdmins));
}
else
{
Expand Down Expand Up @@ -343,7 +343,7 @@ CHIP_ERROR OpenDefaultPairingWindow(bool resetAdmins)
params.SetSetupPINCode(pinCode);
#endif // CONFIG_NETWORK_LAYER_BLE

if (resetAdmins)
if (resetAdmins == kResetAdmins)
{
gNextAvailableAdminId = 0;
gAdminPairings.Reset();
Expand Down Expand Up @@ -409,7 +409,7 @@ void InitServer(AppDelegate * delegate)
}
else
{
SuccessOrExit(err = OpenDefaultPairingWindow(true));
SuccessOrExit(err = OpenDefaultPairingWindow(kResetAdmins));
}

#if CHIP_ENABLE_MDNS
Expand Down
7 changes: 7 additions & 0 deletions src/app/server/Server.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ using DemoTransportMgr = chip::TransportMgr<chip::Transport::UDP>;
*/
void InitServer(AppDelegate * delegate = nullptr);

namespace chip {

constexpr bool kResetAdmins = true;
constexpr bool kDoNotResetAdmins = false;

} // namespace chip

/**
* Open the pairing window using default configured parameters.
*/
Expand Down

0 comments on commit 19cd638

Please sign in to comment.