Skip to content

Commit

Permalink
Fix doxygen, and 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 19cd638 commit 394d295
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 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(kResetAdmins);
OpenDefaultPairingWindow(ResetAdmins::kYes);
}
}

Expand Down
8 changes: 4 additions & 4 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(kDoNotResetAdmins));
SuccessOrExit(err = OpenDefaultPairingWindow(ResetAdmins::kNo));
}
else
{
Expand Down Expand Up @@ -325,7 +325,7 @@ SecureSessionMgr & chip::SessionManager()
return gSessions;
}

CHIP_ERROR OpenDefaultPairingWindow(bool resetAdmins)
CHIP_ERROR OpenDefaultPairingWindow(ResetAdmins resetAdmins)
{
gDeviceDiscriminatorCache.RestoreDiscriminator();

Expand All @@ -343,7 +343,7 @@ CHIP_ERROR OpenDefaultPairingWindow(bool resetAdmins)
params.SetSetupPINCode(pinCode);
#endif // CONFIG_NETWORK_LAYER_BLE

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

#if CHIP_ENABLE_MDNS
Expand Down
9 changes: 6 additions & 3 deletions src/app/server/Server.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@ void InitServer(AppDelegate * delegate = nullptr);

namespace chip {

constexpr bool kResetAdmins = true;
constexpr bool kDoNotResetAdmins = false;
enum class ResetAdmins
{
kYes,
kNo,
};

} // namespace chip

/**
* Open the pairing window using default configured parameters.
*/
CHIP_ERROR OpenDefaultPairingWindow(bool resetAdmins);
CHIP_ERROR OpenDefaultPairingWindow(chip::ResetAdmins resetAdmins);
6 changes: 4 additions & 2 deletions src/controller/CHIPDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,11 @@ class DLL_EXPORT Device
* The device will exit the pairing mode after a successful pairing, or after the given `timeout` time.
*
* @param[in] timeout The pairing mode should terminate after this much time.
* @param[in] useToken The device should use the provided onboarding token instead of the default
* pairing setup PIN and discriminator.
* @param[in] useToken Generate an onboarding token and send it to the device. The device must
* use the provided onboarding token instead of the original pairing setup PIN
* and discriminator.
* @param[in] discriminator The discriminator that the device should use for advertising and pairing.
* @param[out] setupPayload The setup payload corresponding to the generated onboarding token.
*
* @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error
*/
Expand Down

0 comments on commit 394d295

Please sign in to comment.