From 884d9fa1e55dad79599538301ad708c86ef31cfb Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Thu, 19 Sep 2024 00:43:33 -0700 Subject: [PATCH] Cleanup extra namespace prefix (#35664) --- .../fabric-sync/FabricSyncCommand.cpp | 2 +- .../OpenCommissioningWindowCommand.cpp | 2 +- .../commands/pairing/PairingCommand.cpp | 54 +++++++++---------- .../device_manager/DeviceManager.cpp | 6 +-- .../device_manager/DeviceSubscription.cpp | 2 +- .../DeviceSubscriptionManager.cpp | 2 +- .../device_manager/DeviceSynchronization.cpp | 10 ++-- .../device_manager/UniqueIdGetter.cpp | 4 +- examples/fabric-admin/rpc/RpcClient.cpp | 4 +- examples/fabric-admin/rpc/RpcServer.cpp | 10 ++-- 10 files changed, 46 insertions(+), 50 deletions(-) diff --git a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp index 64d43cce11f3ac..6e1b198ad9e924 100644 --- a/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp +++ b/examples/fabric-admin/commands/fabric-sync/FabricSyncCommand.cpp @@ -274,7 +274,7 @@ CHIP_ERROR FabricSyncRemoveLocalBridgeCommand::RunCommand() return CHIP_NO_ERROR; } -void FabricSyncDeviceCommand::OnCommissioningWindowOpened(NodeId deviceId, CHIP_ERROR err, chip::SetupPayload payload) +void FabricSyncDeviceCommand::OnCommissioningWindowOpened(NodeId deviceId, CHIP_ERROR err, SetupPayload payload) { ChipLogProgress(NotSpecified, "FabricSyncDeviceCommand::OnCommissioningWindowOpened"); diff --git a/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.cpp b/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.cpp index cfe212fda00131..b7e36ca2e1352d 100644 --- a/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.cpp +++ b/examples/fabric-admin/commands/pairing/OpenCommissioningWindowCommand.cpp @@ -68,7 +68,7 @@ CHIP_ERROR OpenCommissioningWindowCommand::RunCommand() } void OpenCommissioningWindowCommand::OnOpenCommissioningWindowResponse(void * context, NodeId remoteId, CHIP_ERROR err, - chip::SetupPayload payload) + SetupPayload payload) { OnOpenBasicCommissioningWindowResponse(context, remoteId, err); } diff --git a/examples/fabric-admin/commands/pairing/PairingCommand.cpp b/examples/fabric-admin/commands/pairing/PairingCommand.cpp index c9b58cd92f83ee..2e1cec184c2e3e 100644 --- a/examples/fabric-admin/commands/pairing/PairingCommand.cpp +++ b/examples/fabric-admin/commands/pairing/PairingCommand.cpp @@ -169,7 +169,7 @@ CommissioningParameters PairingCommand::GetCommissioningParameters() if (!mICDSymmetricKey.HasValue()) { - chip::Crypto::DRBG_get_bytes(mRandomGeneratedICDSymmetricKey, sizeof(mRandomGeneratedICDSymmetricKey)); + Crypto::DRBG_get_bytes(mRandomGeneratedICDSymmetricKey, sizeof(mRandomGeneratedICDSymmetricKey)); mICDSymmetricKey.SetValue(ByteSpan(mRandomGeneratedICDSymmetricKey)); } if (!mICDCheckInNodeId.HasValue()) @@ -296,7 +296,7 @@ CHIP_ERROR PairingCommand::PairWithMdnsOrBleByIndexWithCode(NodeId remoteId, uin // There is no device with this index that has some resolution data. This could simply // be because the device is a ble device. In this case let's fall back to looking for // a device with this index and some RendezvousParameters. - chip::SetupPayload payload; + SetupPayload payload; bool isQRCode = strncmp(mOnboardingPayload, kQRCodePrefix, strlen(kQRCodePrefix)) == 0; if (isQRCode) { @@ -336,21 +336,21 @@ CHIP_ERROR PairingCommand::PairWithMdns(NodeId remoteId) Dnssd::DiscoveryFilter filter(mFilterType); switch (mFilterType) { - case chip::Dnssd::DiscoveryFilterType::kNone: + case Dnssd::DiscoveryFilterType::kNone: break; - case chip::Dnssd::DiscoveryFilterType::kShortDiscriminator: - case chip::Dnssd::DiscoveryFilterType::kLongDiscriminator: - case chip::Dnssd::DiscoveryFilterType::kCompressedFabricId: - case chip::Dnssd::DiscoveryFilterType::kVendorId: - case chip::Dnssd::DiscoveryFilterType::kDeviceType: + case Dnssd::DiscoveryFilterType::kShortDiscriminator: + case Dnssd::DiscoveryFilterType::kLongDiscriminator: + case Dnssd::DiscoveryFilterType::kCompressedFabricId: + case Dnssd::DiscoveryFilterType::kVendorId: + case Dnssd::DiscoveryFilterType::kDeviceType: filter.code = mDiscoveryFilterCode; break; - case chip::Dnssd::DiscoveryFilterType::kCommissioningMode: + case Dnssd::DiscoveryFilterType::kCommissioningMode: break; - case chip::Dnssd::DiscoveryFilterType::kCommissioner: + case Dnssd::DiscoveryFilterType::kCommissioner: filter.code = 1; break; - case chip::Dnssd::DiscoveryFilterType::kInstanceName: + case Dnssd::DiscoveryFilterType::kInstanceName: filter.code = 0; filter.instanceName = mDiscoveryFilterInstanceName; break; @@ -480,10 +480,10 @@ void PairingCommand::OnReadCommissioningInfo(const Controller::ReadCommissioning void PairingCommand::OnICDRegistrationComplete(ScopedNodeId nodeId, uint32_t icdCounter) { - char icdSymmetricKeyHex[chip::Crypto::kAES_CCM128_Key_Length * 2 + 1]; + char icdSymmetricKeyHex[Crypto::kAES_CCM128_Key_Length * 2 + 1]; - chip::Encoding::BytesToHex(mICDSymmetricKey.Value().data(), mICDSymmetricKey.Value().size(), icdSymmetricKeyHex, - sizeof(icdSymmetricKeyHex), chip::Encoding::HexFlags::kNullTerminate); + Encoding::BytesToHex(mICDSymmetricKey.Value().data(), mICDSymmetricKey.Value().size(), icdSymmetricKeyHex, + sizeof(icdSymmetricKeyHex), Encoding::HexFlags::kNullTerminate); app::ICDClientInfo clientInfo; clientInfo.peer_node = nodeId; @@ -521,7 +521,7 @@ void PairingCommand::OnICDStayActiveComplete(ScopedNodeId deviceId, uint32_t pro ChipLogValueX64(deviceId.GetNodeId()), promisedActiveDuration); } -void PairingCommand::OnDiscoveredDevice(const chip::Dnssd::CommissionNodeData & nodeData) +void PairingCommand::OnDiscoveredDevice(const Dnssd::CommissionNodeData & nodeData) { // Ignore nodes with closed commissioning window VerifyOrReturn(nodeData.commissioningMode != 0); @@ -529,7 +529,7 @@ void PairingCommand::OnDiscoveredDevice(const chip::Dnssd::CommissionNodeData & auto & resolutionData = nodeData; const uint16_t port = resolutionData.port; - char buf[chip::Inet::IPAddress::kMaxStringLength]; + char buf[Inet::IPAddress::kMaxStringLength]; resolutionData.ipAddress[0].ToString(buf); ChipLogProgress(NotSpecified, "Discovered Device: %s:%u", buf, port); @@ -566,8 +566,7 @@ void PairingCommand::OnCurrentFabricRemove(void * context, NodeId nodeId, CHIP_E fprintf(stderr, "Device with Node ID: 0x%lx has been successfully removed.\n", nodeId); #if defined(PW_RPC_ENABLED) - chip::app::InteractionModelEngine::GetInstance()->ShutdownSubscriptions(command->CurrentCommissioner().GetFabricIndex(), - nodeId); + app::InteractionModelEngine::GetInstance()->ShutdownSubscriptions(command->CurrentCommissioner().GetFabricIndex(), nodeId); RemoveSynchronizedDevice(nodeId); #endif } @@ -586,10 +585,10 @@ void PairingCommand::OnCurrentFabricRemove(void * context, NodeId nodeId, CHIP_E command->SetCommandExitStatus(err); } -chip::Optional PairingCommand::FailSafeExpiryTimeoutSecs() const +Optional PairingCommand::FailSafeExpiryTimeoutSecs() const { // No manual input, so do not need to extend. - return chip::Optional(); + return Optional(); } bool PairingCommand::ShouldWaitAfterDeviceAttestation() @@ -603,10 +602,9 @@ bool PairingCommand::ShouldWaitAfterDeviceAttestation() return err == CHIP_NO_ERROR && (payload.vendorID != 0 || payload.productID != 0); } -void PairingCommand::OnDeviceAttestationCompleted(chip::Controller::DeviceCommissioner * deviceCommissioner, - chip::DeviceProxy * device, - const chip::Credentials::DeviceAttestationVerifier::AttestationDeviceInfo & info, - chip::Credentials::AttestationVerificationResult attestationResult) +void PairingCommand::OnDeviceAttestationCompleted(Controller::DeviceCommissioner * deviceCommissioner, DeviceProxy * device, + const Credentials::DeviceAttestationVerifier::AttestationDeviceInfo & info, + Credentials::AttestationVerificationResult attestationResult) { SetupPayload payload; CHIP_ERROR parse_error = GetPayload(mOnboardingPayload, payload); @@ -619,7 +617,7 @@ void PairingCommand::OnDeviceAttestationCompleted(chip::Controller::DeviceCommis "Requested VID: %u, Requested PID: %u.", payload.vendorID, payload.productID); deviceCommissioner->ContinueCommissioningAfterDeviceAttestation( - device, chip::Credentials::AttestationVerificationResult::kInvalidArgument); + device, Credentials::AttestationVerificationResult::kInvalidArgument); return; } @@ -633,8 +631,8 @@ void PairingCommand::OnDeviceAttestationCompleted(chip::Controller::DeviceCommis deviceCommissioner->ContinueCommissioningAfterDeviceAttestation( device, payload.vendorID == info.BasicInformationVendorId() - ? chip::Credentials::AttestationVerificationResult::kDacProductIdMismatch - : chip::Credentials::AttestationVerificationResult::kDacVendorIdMismatch); + ? Credentials::AttestationVerificationResult::kDacProductIdMismatch + : Credentials::AttestationVerificationResult::kDacVendorIdMismatch); return; } @@ -654,7 +652,7 @@ void PairingCommand::OnDeviceAttestationCompleted(chip::Controller::DeviceCommis { // Bypass attestation verification, continue with success auto err = deviceCommissioner->ContinueCommissioningAfterDeviceAttestation( - device, chip::Credentials::AttestationVerificationResult::kSuccess); + device, Credentials::AttestationVerificationResult::kSuccess); if (CHIP_NO_ERROR != err) { SetCommandExitStatus(err); diff --git a/examples/fabric-admin/device_manager/DeviceManager.cpp b/examples/fabric-admin/device_manager/DeviceManager.cpp index 897b1b60e0b68b..f34a8443feaa68 100644 --- a/examples/fabric-admin/device_manager/DeviceManager.cpp +++ b/examples/fabric-admin/device_manager/DeviceManager.cpp @@ -150,7 +150,7 @@ void DeviceManager::OpenRemoteDeviceCommissioningWindow(EndpointId remoteEndpoin } } -void DeviceManager::PairRemoteFabricBridge(chip::NodeId nodeId, uint32_t setupPINCode, const char * deviceRemoteIp, +void DeviceManager::PairRemoteFabricBridge(NodeId nodeId, uint32_t setupPINCode, const char * deviceRemoteIp, uint16_t deviceRemotePort) { StringBuilder commandBuilder; @@ -240,7 +240,7 @@ void DeviceManager::ReadSupportedDeviceCategories() PushCommand(commandBuilder.c_str()); } -void DeviceManager::HandleReadSupportedDeviceCategories(chip::TLV::TLVReader & data) +void DeviceManager::HandleReadSupportedDeviceCategories(TLV::TLVReader & data) { ChipLogProgress(NotSpecified, "Attribute SupportedDeviceCategories detected."); @@ -305,7 +305,7 @@ void DeviceManager::HandleCommissioningRequestResult(TLV::TLVReader & data) SendCommissionNodeRequest(value.requestID, kResponseTimeoutSeconds); } -void DeviceManager::HandleAttributePartsListUpdate(chip::TLV::TLVReader & data) +void DeviceManager::HandleAttributePartsListUpdate(TLV::TLVReader & data) { ChipLogProgress(NotSpecified, "Attribute PartsList change detected:"); diff --git a/examples/fabric-admin/device_manager/DeviceSubscription.cpp b/examples/fabric-admin/device_manager/DeviceSubscription.cpp index e83eda282c476b..c41f73e0464cd3 100644 --- a/examples/fabric-admin/device_manager/DeviceSubscription.cpp +++ b/examples/fabric-admin/device_manager/DeviceSubscription.cpp @@ -85,7 +85,7 @@ void DeviceSubscription::OnAttributeData(const ConcreteDataAttributePath & path, } case Clusters::AdministratorCommissioning::Attributes::AdminVendorId::Id: { #if defined(PW_RPC_ENABLED) - chip::VendorId vendorId; + VendorId vendorId; CHIP_ERROR err = data->Get(vendorId); mCurrentAdministratorCommissioningAttributes.has_opener_vendor_id = err == CHIP_NO_ERROR; if (mCurrentAdministratorCommissioningAttributes.has_opener_vendor_id) diff --git a/examples/fabric-admin/device_manager/DeviceSubscriptionManager.cpp b/examples/fabric-admin/device_manager/DeviceSubscriptionManager.cpp index b485806bef6292..8dd43f28751591 100644 --- a/examples/fabric-admin/device_manager/DeviceSubscriptionManager.cpp +++ b/examples/fabric-admin/device_manager/DeviceSubscriptionManager.cpp @@ -53,7 +53,7 @@ CHIP_ERROR DeviceSubscriptionManager::StartSubscription(Controller::DeviceContro return CHIP_NO_ERROR; } -CHIP_ERROR DeviceSubscriptionManager::RemoveSubscription(chip::NodeId nodeId) +CHIP_ERROR DeviceSubscriptionManager::RemoveSubscription(NodeId nodeId) { assertChipStackLockedByCurrentThread(); auto it = mDeviceSubscriptionMap.find(nodeId); diff --git a/examples/fabric-admin/device_manager/DeviceSynchronization.cpp b/examples/fabric-admin/device_manager/DeviceSynchronization.cpp index cbf84e23d0b2ed..e70a968d726280 100644 --- a/examples/fabric-admin/device_manager/DeviceSynchronization.cpp +++ b/examples/fabric-admin/device_manager/DeviceSynchronization.cpp @@ -138,7 +138,7 @@ void DeviceSynchronizer::OnReportEnd() MoveToState(State::ReceivedResponse); } -void DeviceSynchronizer::OnDone(chip::app::ReadClient * apReadClient) +void DeviceSynchronizer::OnDone(app::ReadClient * apReadClient) { #if defined(PW_RPC_ENABLED) if (mState == State::ReceivedResponse && !DeviceMgr().IsCurrentBridgeDevice(mNodeId)) @@ -163,8 +163,7 @@ void DeviceSynchronizer::OnError(CHIP_ERROR error) ChipLogProgress(NotSpecified, "Error fetching device data: %" CHIP_ERROR_FORMAT, error.Format()); } -void DeviceSynchronizer::OnDeviceConnected(chip::Messaging::ExchangeManager & exchangeMgr, - const chip::SessionHandle & sessionHandle) +void DeviceSynchronizer::OnDeviceConnected(Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle) { mClient = std::make_unique(app::InteractionModelEngine::GetInstance(), &exchangeMgr /* echangeMgr */, *this /* callback */, ReadClient::InteractionType::Read); @@ -188,14 +187,13 @@ void DeviceSynchronizer::OnDeviceConnected(chip::Messaging::ExchangeManager & ex MoveToState(State::AwaitingResponse); } -void DeviceSynchronizer::OnDeviceConnectionFailure(const chip::ScopedNodeId & peerId, CHIP_ERROR error) +void DeviceSynchronizer::OnDeviceConnectionFailure(const ScopedNodeId & peerId, CHIP_ERROR error) { ChipLogError(NotSpecified, "Device Sync failed to connect to " ChipLogFormatX64, ChipLogValueX64(peerId.GetNodeId())); MoveToState(State::Idle); } -void DeviceSynchronizer::StartDeviceSynchronization(chip::Controller::DeviceController * controller, chip::NodeId nodeId, - bool deviceIsIcd) +void DeviceSynchronizer::StartDeviceSynchronization(Controller::DeviceController * controller, NodeId nodeId, bool deviceIsIcd) { VerifyOrDie(controller); if (mState != State::Idle) diff --git a/examples/fabric-admin/device_manager/UniqueIdGetter.cpp b/examples/fabric-admin/device_manager/UniqueIdGetter.cpp index 3aba21752d9c67..9c59e54137bf2b 100644 --- a/examples/fabric-admin/device_manager/UniqueIdGetter.cpp +++ b/examples/fabric-admin/device_manager/UniqueIdGetter.cpp @@ -53,8 +53,8 @@ UniqueIdGetter::UniqueIdGetter() : mOnDeviceConnectionFailureCallback(OnDeviceConnectionFailureWrapper, this) {} -CHIP_ERROR UniqueIdGetter::GetUniqueId(OnDoneCallback onDoneCallback, chip::Controller::DeviceController & controller, - chip::NodeId nodeId, chip::EndpointId endpointId) +CHIP_ERROR UniqueIdGetter::GetUniqueId(OnDoneCallback onDoneCallback, Controller::DeviceController & controller, NodeId nodeId, + EndpointId endpointId) { assertChipStackLockedByCurrentThread(); VerifyOrDie(!mCurrentlyGettingUid); diff --git a/examples/fabric-admin/rpc/RpcClient.cpp b/examples/fabric-admin/rpc/RpcClient.cpp index df7a475071c4ba..9d094a6e102566 100644 --- a/examples/fabric-admin/rpc/RpcClient.cpp +++ b/examples/fabric-admin/rpc/RpcClient.cpp @@ -144,7 +144,7 @@ CHIP_ERROR AddSynchronizedDevice(const chip_rpc_SynchronizedDevice & data) return WaitForResponse(call); } -CHIP_ERROR RemoveSynchronizedDevice(chip::NodeId nodeId) +CHIP_ERROR RemoveSynchronizedDevice(NodeId nodeId) { ChipLogProgress(NotSpecified, "RemoveSynchronizedDevice"); @@ -164,7 +164,7 @@ CHIP_ERROR RemoveSynchronizedDevice(chip::NodeId nodeId) return WaitForResponse(call); } -CHIP_ERROR ActiveChanged(chip::NodeId nodeId, uint32_t promisedActiveDurationMs) +CHIP_ERROR ActiveChanged(NodeId nodeId, uint32_t promisedActiveDurationMs) { ChipLogProgress(NotSpecified, "ActiveChanged"); diff --git a/examples/fabric-admin/rpc/RpcServer.cpp b/examples/fabric-admin/rpc/RpcServer.cpp index 6e5e2ec8d66442..d5e072305fe0dc 100644 --- a/examples/fabric-admin/rpc/RpcServer.cpp +++ b/examples/fabric-admin/rpc/RpcServer.cpp @@ -45,7 +45,7 @@ namespace { class FabricAdmin final : public rpc::FabricAdmin, public IcdManager::Delegate { public: - void OnCheckInCompleted(const chip::app::ICDClientInfo & clientInfo) override + void OnCheckInCompleted(const app::ICDClientInfo & clientInfo) override { // Accessing mPendingCheckIn should only be done while holding ChipStackLock assertChipStackLockedByCurrentThread(); @@ -76,7 +76,7 @@ class FabricAdmin final : public rpc::FabricAdmin, public IcdManager::Delegate // addressed, we can implement what spec defines here. auto onDone = [=](uint32_t promisedActiveDuration) { ActiveChanged(nodeId, promisedActiveDuration); }; CHIP_ERROR err = StayActiveSender::SendStayActiveCommand(checkInData.mStayActiveDurationMs, clientInfo.peer_node, - chip::app::InteractionModelEngine::GetInstance(), onDone); + app::InteractionModelEngine::GetInstance(), onDone); if (err != CHIP_NO_ERROR) { ChipLogError(NotSpecified, "Failed to send StayActive command %s", err.AsString()); @@ -156,7 +156,7 @@ class FabricAdmin final : public rpc::FabricAdmin, public IcdManager::Delegate KeepActiveWorkData * data = Platform::New(this, request.node_id, request.stay_active_duration_ms, request.timeout_ms); VerifyOrReturnValue(data, pw::Status::Internal()); - chip::DeviceLayer::PlatformMgr().ScheduleWork(KeepActiveWork, reinterpret_cast(data)); + DeviceLayer::PlatformMgr().ScheduleWork(KeepActiveWork, reinterpret_cast(data)); return pw::OkStatus(); } @@ -194,7 +194,7 @@ class FabricAdmin final : public rpc::FabricAdmin, public IcdManager::Delegate {} FabricAdmin * mFabricAdmin; - chip::NodeId mNodeId; + NodeId mNodeId; uint32_t mStayActiveDurationMs; uint32_t mTimeoutMs; }; @@ -203,7 +203,7 @@ class FabricAdmin final : public rpc::FabricAdmin, public IcdManager::Delegate { KeepActiveWorkData * data = reinterpret_cast(arg); data->mFabricAdmin->ScheduleSendingKeepActiveOnCheckIn(data->mNodeId, data->mStayActiveDurationMs, data->mTimeoutMs); - chip::Platform::Delete(data); + Platform::Delete(data); } // Modifications to mPendingCheckIn should be done on the MatterEventLoop thread