Skip to content

Commit

Permalink
Cleanup extra namespace prefix (#35664)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca authored Sep 19, 2024
1 parent 3663d42 commit 884d9fa
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
54 changes: 26 additions & 28 deletions examples/fabric-admin/commands/pairing/PairingCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -521,15 +521,15 @@ 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);

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);

Expand Down Expand Up @@ -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
}
Expand All @@ -586,10 +585,10 @@ void PairingCommand::OnCurrentFabricRemove(void * context, NodeId nodeId, CHIP_E
command->SetCommandExitStatus(err);
}

chip::Optional<uint16_t> PairingCommand::FailSafeExpiryTimeoutSecs() const
Optional<uint16_t> PairingCommand::FailSafeExpiryTimeoutSecs() const
{
// No manual input, so do not need to extend.
return chip::Optional<uint16_t>();
return Optional<uint16_t>();
}

bool PairingCommand::ShouldWaitAfterDeviceAttestation()
Expand All @@ -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);
Expand All @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions examples/fabric-admin/device_manager/DeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<kMaxCommandSize> commandBuilder;
Expand Down Expand Up @@ -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.");

Expand Down Expand Up @@ -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:");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 4 additions & 6 deletions examples/fabric-admin/device_manager/DeviceSynchronization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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<ReadClient>(app::InteractionModelEngine::GetInstance(), &exchangeMgr /* echangeMgr */,
*this /* callback */, ReadClient::InteractionType::Read);
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions examples/fabric-admin/device_manager/UniqueIdGetter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions examples/fabric-admin/rpc/RpcClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -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");

Expand Down
10 changes: 5 additions & 5 deletions examples/fabric-admin/rpc/RpcServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -156,7 +156,7 @@ class FabricAdmin final : public rpc::FabricAdmin, public IcdManager::Delegate
KeepActiveWorkData * data =
Platform::New<KeepActiveWorkData>(this, request.node_id, request.stay_active_duration_ms, request.timeout_ms);
VerifyOrReturnValue(data, pw::Status::Internal());
chip::DeviceLayer::PlatformMgr().ScheduleWork(KeepActiveWork, reinterpret_cast<intptr_t>(data));
DeviceLayer::PlatformMgr().ScheduleWork(KeepActiveWork, reinterpret_cast<intptr_t>(data));
return pw::OkStatus();
}

Expand Down Expand Up @@ -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;
};
Expand All @@ -203,7 +203,7 @@ class FabricAdmin final : public rpc::FabricAdmin, public IcdManager::Delegate
{
KeepActiveWorkData * data = reinterpret_cast<KeepActiveWorkData *>(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
Expand Down

0 comments on commit 884d9fa

Please sign in to comment.