From 5775cd61e5ac4470d3793a0d990bf71dfc2f2bce Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Thu, 15 Feb 2024 22:05:17 +0000 Subject: [PATCH] Restyled by clang-format --- .../network-commissioning.cpp | 24 ++++++++++++------- src/app/data-model/Nullable.h | 2 +- src/app/tests/TestNullable.cpp | 12 ++++------ 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/app/clusters/network-commissioning/network-commissioning.cpp b/src/app/clusters/network-commissioning/network-commissioning.cpp index b1254d54cd439f..b1698c78c50db6 100644 --- a/src/app/clusters/network-commissioning/network-commissioning.cpp +++ b/src/app/clusters/network-commissioning/network-commissioning.cpp @@ -123,7 +123,8 @@ Instance::Instance(EndpointId aEndpointId, WiFiDriver * apDelegate) : Instance::Instance(EndpointId aEndpointId, ThreadDriver * apDelegate) : CommandHandlerInterface(Optional(aEndpointId), Id), AttributeAccessInterface(Optional(aEndpointId), Id), - mEndpointId(aEndpointId), mFeatureFlags(Feature::kThreadNetworkInterface), mpWirelessDriver(apDelegate), mpBaseDriver(apDelegate) + mEndpointId(aEndpointId), mFeatureFlags(Feature::kThreadNetworkInterface), mpWirelessDriver(apDelegate), + mpBaseDriver(apDelegate) { mpDriver.Set(apDelegate); } @@ -174,7 +175,8 @@ void Instance::SetLastNetworkingStatusValue(Attributes::LastNetworkingStatus::Ty { if (mLastNetworkingStatusValue.SetToMatch(networkingStatusValue)) { - MatterReportingAttributeChangeCallback(mEndpointId, Clusters::NetworkCommissioning::Id, Attributes::LastNetworkingStatus::TypeInfo::GetAttributeId()); + MatterReportingAttributeChangeCallback(mEndpointId, Clusters::NetworkCommissioning::Id, + Attributes::LastNetworkingStatus::TypeInfo::GetAttributeId()); } } @@ -182,24 +184,27 @@ void Instance::SetLastConnectErrorValue(Attributes::LastConnectErrorValue::TypeI { if (mLastConnectErrorValue.SetToMatch(connectErrorValue)) { - MatterReportingAttributeChangeCallback(mEndpointId, Clusters::NetworkCommissioning::Id, Attributes::LastConnectErrorValue::TypeInfo::GetAttributeId()); + MatterReportingAttributeChangeCallback(mEndpointId, Clusters::NetworkCommissioning::Id, + Attributes::LastConnectErrorValue::TypeInfo::GetAttributeId()); } } void Instance::SetLastNetworkId(ByteSpan lastNetworkId) { - ByteSpan prevLastNetworkId{mLastNetworkID, mLastNetworkIDLen}; + ByteSpan prevLastNetworkId{ mLastNetworkID, mLastNetworkIDLen }; VerifyOrReturn(lastNetworkId.size() <= kMaxNetworkIDLen); VerifyOrReturn(!prevLastNetworkId.data_equal(lastNetworkId)); memcpy(mLastNetworkID, lastNetworkId.data(), lastNetworkId.size()); mLastNetworkIDLen = static_cast(lastNetworkId.size()); - MatterReportingAttributeChangeCallback(mEndpointId, Clusters::NetworkCommissioning::Id, Attributes::LastNetworkID::TypeInfo::GetAttributeId()); + MatterReportingAttributeChangeCallback(mEndpointId, Clusters::NetworkCommissioning::Id, + Attributes::LastNetworkID::TypeInfo::GetAttributeId()); } void Instance::ReportNetworksListChanged() const { - MatterReportingAttributeChangeCallback(mEndpointId, Clusters::NetworkCommissioning::Id, Attributes::Networks::TypeInfo::GetAttributeId()); + MatterReportingAttributeChangeCallback(mEndpointId, Clusters::NetworkCommissioning::Id, + Attributes::Networks::TypeInfo::GetAttributeId()); } void Instance::InvokeCommand(HandlerContext & ctxt) @@ -478,7 +483,7 @@ void Instance::HandleScanNetworks(HandlerContext & ctx, const Commands::ScanNetw return; } - mScanningWasDirected = !ssid.empty(); + mScanningWasDirected = !ssid.empty(); mCurrentOperationBreadcrumb = req.breadcrumb; mAsyncCommandHandle = CommandHandler::Handle(&ctx.mCommandHandler); ctx.mCommandHandler.FlushAcksRightAwayOnSlowCommand(); @@ -948,7 +953,7 @@ void Instance::OnResult(Status commissioningError, CharSpan debugText, int32_t i SetLastConnectErrorValue(MakeNullable(interfaceStatus)); } - SetLastNetworkId(ByteSpan{mConnectingNetworkID, mConnectingNetworkIDLen}); + SetLastNetworkId(ByteSpan{ mConnectingNetworkID, mConnectingNetworkIDLen }); SetLastNetworkingStatusValue(MakeNullable(commissioningError)); #if CONFIG_NETWORK_LAYER_BLE && !CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION @@ -1124,7 +1129,8 @@ void Instance::OnFinished(Status status, CharSpan debugText, WiFiScanResponseIte // Only encode results on success, to avoid stale contents on partial failure. if (status == Status::kSuccess) { - for (; networks != nullptr && networks->Next(scanResponse) && networksEncoded < kMaxNetworksInScanResponse; networksEncoded++) + for (; networks != nullptr && networks->Next(scanResponse) && networksEncoded < kMaxNetworksInScanResponse; + networksEncoded++) { Structs::WiFiInterfaceScanResultStruct::Type result; result.security = scanResponse.security; diff --git a/src/app/data-model/Nullable.h b/src/app/data-model/Nullable.h index 75ec433855dd7d..c41d5f387628d4 100644 --- a/src/app/data-model/Nullable.h +++ b/src/app/data-model/Nullable.h @@ -86,7 +86,7 @@ struct Nullable : protected Optional constexpr bool SetToMatch(const Nullable & other) { bool changed = *this != other; - *this = other; + *this = other; return changed; } diff --git a/src/app/tests/TestNullable.cpp b/src/app/tests/TestNullable.cpp index 40859bec910a3d..d7f1eda07c6905 100644 --- a/src/app/tests/TestNullable.cpp +++ b/src/app/tests/TestNullable.cpp @@ -184,8 +184,8 @@ static void TestSetToMatch(nlTestSuite * inSuite, void * inContext) using SmallArray = std::array; // Arrays { - auto nullable1 = MakeNullable({1,2,3}); - auto nullable2 = MakeNullable({1,2,3}); + auto nullable1 = MakeNullable({ 1, 2, 3 }); + auto nullable2 = MakeNullable({ 1, 2, 3 }); NL_TEST_ASSERT(inSuite, !nullable1.IsNull()); NL_TEST_ASSERT(inSuite, !nullable2.IsNull()); @@ -209,13 +209,11 @@ static void TestSetToMatch(nlTestSuite * inSuite, void * inContext) uint8_t a; uint8_t b; - bool operator==(const SomeObject & other) const { - return (a == other.a) && (b == other.b); - } + bool operator==(const SomeObject & other) const { return (a == other.a) && (b == other.b); } }; - auto nullable1 = MakeNullable({1, 2}); - auto nullable2 = MakeNullable({1, 2}); + auto nullable1 = MakeNullable({ 1, 2 }); + auto nullable2 = MakeNullable({ 1, 2 }); NL_TEST_ASSERT(inSuite, !nullable1.IsNull()); NL_TEST_ASSERT(inSuite, !nullable2.IsNull());