Skip to content

Commit 569f7ca

Browse files
committed
Use value again instead of operator** ... I was looking at the wrong compiler errors
1 parent 589cf12 commit 569f7ca

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/app/data-model/Nullable.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ struct Nullable : protected std::optional<T>
6262
return std::optional<T>::emplace(std::forward<Args>(args)...);
6363
}
6464

65-
template <typename... Args>
66-
constexpr auto ValueOr(Args &&... args) const
65+
template <typename Arg>
66+
constexpr auto ValueOr(Arg && arg) const
6767
{
68-
return std::optional<T>::value_or(std::forward<Args>(args)...);
68+
return std::optional<T>::value_or(std::forward<Arg>(arg));
6969
}
7070

71-
constexpr const T & Value() const { return **this; }
72-
T & Value() { return **this; }
71+
inline constexpr const T & Value() const { return std::optional<T>::value(); }
72+
inline T & Value() { return std::optional<T>::value(); }
7373

7474
// For integer types, being nullable involves a range restriction.
7575
template <

src/app/server/CommissioningWindowManager.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ using chip::app::DataModel::NullNullable;
4040

4141
namespace {
4242

43+
constexpr uint32_t kFailSafeTimeoutSeconds = 3;
44+
4345
// As per specifications (Section 13.3), Nodes SHALL exit commissioning mode after 20 failed commission attempts.
4446
constexpr uint8_t kMaxFailedCommissioningAttempts = 20;
4547

@@ -174,7 +176,7 @@ void CommissioningWindowManager::HandleFailedAttempt(CHIP_ERROR err)
174176
void CommissioningWindowManager::OnSessionEstablishmentStarted()
175177
{
176178
// As per specifications, section 5.5: Commissioning Flows
177-
constexpr System::Clock::Timeout kPASESessionEstablishmentTimeout = System::Clock::Seconds16(60);
179+
constexpr System::Clock::Timeout kPASESessionEstablishmentTimeout = System::Clock::Seconds16(kFailSafeTimeoutSeconds);
178180
DeviceLayer::SystemLayer().StartTimer(kPASESessionEstablishmentTimeout, HandleSessionEstablishmentTimeout, this);
179181

180182
ChipLogProgress(AppServer, "Commissioning session establishment step started");
@@ -208,7 +210,7 @@ void CommissioningWindowManager::OnSessionEstablished(const SessionHandle & sess
208210
}
209211
else
210212
{
211-
err = failSafeContext.ArmFailSafe(kUndefinedFabricIndex, System::Clock::Seconds16(60));
213+
err = failSafeContext.ArmFailSafe(kUndefinedFabricIndex, System::Clock::Seconds16(kFailSafeTimeoutSeconds));
212214
if (err != CHIP_NO_ERROR)
213215
{
214216
ChipLogError(AppServer, "Error arming failsafe on PASE session establishment completion");

0 commit comments

Comments
 (0)