diff --git a/src/app/codegen-data-model-provider/CodegenDataModelProvider.cpp b/src/app/codegen-data-model-provider/CodegenDataModelProvider.cpp index b30490d4f6d762..a353cd1c5d4c55 100644 --- a/src/app/codegen-data-model-provider/CodegenDataModelProvider.cpp +++ b/src/app/codegen-data-model-provider/CodegenDataModelProvider.cpp @@ -106,12 +106,12 @@ using detail::EnumeratorCommandFinder; namespace { -const chip::CommandId * AcceptedCommands(const EmberAfCluster & cluster) +const CommandId * AcceptedCommands(const EmberAfCluster & cluster) { return cluster.acceptedCommandList; } -const chip::CommandId * GeneratedCommands(const EmberAfCluster & cluster) +const CommandId * GeneratedCommands(const EmberAfCluster & cluster) { return cluster.generatedCommandList; } diff --git a/src/app/codegen-data-model-provider/CodegenDataModelProvider.h b/src/app/codegen-data-model-provider/CodegenDataModelProvider.h index bec7d95f5f3be6..0493272dbbff47 100644 --- a/src/app/codegen-data-model-provider/CodegenDataModelProvider.h +++ b/src/app/codegen-data-model-provider/CodegenDataModelProvider.h @@ -94,7 +94,7 @@ class EnumeratorCommandFinder /// Given that this relies on global data at link time, there generally can be /// only one CodegenDataModelProvider per application (you can create more instances, /// however they would share the exact same underlying data and storage). -class CodegenDataModelProvider : public chip::app::DataModel::Provider +class CodegenDataModelProvider : public DataModel::Provider { private: /// Ember commands are stored as a `CommandId *` pointer that is either null (i.e. no commands) @@ -151,8 +151,8 @@ class CodegenDataModelProvider : public chip::app::DataModel::Provider AttributeValueEncoder & encoder) override; DataModel::ActionReturnStatus WriteAttribute(const DataModel::WriteAttributeRequest & request, AttributeValueDecoder & decoder) override; - std::optional Invoke(const DataModel::InvokeRequest & request, - chip::TLV::TLVReader & input_arguments, CommandHandler * handler) override; + std::optional Invoke(const DataModel::InvokeRequest & request, TLV::TLVReader & input_arguments, + CommandHandler * handler) override; /// attribute tree iteration DataModel::EndpointEntry FirstEndpoint() override; @@ -227,16 +227,15 @@ class CodegenDataModelProvider : public chip::app::DataModel::Provider const EmberAfCluster * FindServerCluster(const ConcreteClusterPath & path); /// Find the index of the given attribute id - std::optional TryFindAttributeIndex(const EmberAfCluster * cluster, chip::AttributeId id) const; + std::optional TryFindAttributeIndex(const EmberAfCluster * cluster, AttributeId id) const; /// Find the index of the given cluster id - std::optional TryFindClusterIndex(const EmberAfEndpointType * endpoint, chip::ClusterId id, - ClusterSide clusterSide) const; + std::optional TryFindClusterIndex(const EmberAfEndpointType * endpoint, ClusterId id, ClusterSide clusterSide) const; /// Find the index of the given endpoint id - std::optional TryFindEndpointIndex(chip::EndpointId id) const; + std::optional TryFindEndpointIndex(EndpointId id) const; - using CommandListGetter = const chip::CommandId *(const EmberAfCluster &); + using CommandListGetter = const CommandId *(const EmberAfCluster &); CommandId FindCommand(const ConcreteCommandPath & path, detail::EnumeratorCommandFinder & handlerFinder, detail::EnumeratorCommandFinder::Operation operation, diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index 7363d519b5c5a4..4e0df666e36e47 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -99,8 +99,8 @@ Server Server::sServer; static uint8_t sInfoEventBuffer[CHIP_DEVICE_CONFIG_EVENT_LOGGING_INFO_BUFFER_SIZE]; static uint8_t sDebugEventBuffer[CHIP_DEVICE_CONFIG_EVENT_LOGGING_DEBUG_BUFFER_SIZE]; static uint8_t sCritEventBuffer[CHIP_DEVICE_CONFIG_EVENT_LOGGING_CRIT_BUFFER_SIZE]; -static ::chip::PersistedCounter sGlobalEventIdCounter; -static ::chip::app::CircularEventBuffer sLoggingBuffer[CHIP_NUM_EVENT_LOGGING_BUFFERS]; +static PersistedCounter sGlobalEventIdCounter; +static app::CircularEventBuffer sLoggingBuffer[CHIP_NUM_EVENT_LOGGING_BUFFERS]; #endif // CHIP_CONFIG_ENABLE_SERVER_IM_EVENT CHIP_ERROR Server::Init(const ServerInitParams & initParams) @@ -137,8 +137,8 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) VerifyOrExit(initParams.dataModelProvider != nullptr, err = CHIP_ERROR_INVALID_ARGUMENT); - // TODO(16969): Remove chip::Platform::MemoryInit() call from Server class, it belongs to outer code - chip::Platform::MemoryInit(); + // TODO(16969): Remove Platform::MemoryInit() call from Server class, it belongs to outer code + Platform::MemoryInit(); // Initialize PersistentStorageDelegate-based storage mDeviceStorage = initParams.persistentStorageDelegate; @@ -158,11 +158,11 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) } #if defined(CHIP_SUPPORT_ENABLE_STORAGE_API_AUDIT) - VerifyOrDie(chip::audit::ExecutePersistentStorageApiAudit(*mDeviceStorage)); + VerifyOrDie(audit::ExecutePersistentStorageApiAudit(*mDeviceStorage)); #endif #if defined(CHIP_SUPPORT_ENABLE_STORAGE_LOAD_TEST_AUDIT) - VerifyOrDie(chip::audit::ExecutePersistentStorageLoadTestAudit(*mDeviceStorage)); + VerifyOrDie(audit::ExecutePersistentStorageLoadTestAudit(*mDeviceStorage)); #endif // Set up attribute persistence before we try to bring up the data model @@ -179,7 +179,7 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) // 2) For now, provider initialization happens before InitDataModelHandler(), which depends // on atttribute persistence being already set up before it runs. Longer-term, the logic from // InitDataModelHandler should just move into the codegen provider. - chip::app::InteractionModelEngine::GetInstance()->SetDataModelProvider(initParams.dataModelProvider); + app::InteractionModelEngine::GetInstance()->SetDataModelProvider(initParams.dataModelProvider); { FabricTable::InitParams fabricTableInitParams; @@ -281,7 +281,7 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) app::DnssdServer::Instance().SetFabricTable(&mFabrics); app::DnssdServer::Instance().SetCommissioningModeProvider(&mCommissioningWindowManager); - chip::Dnssd::Resolver::Instance().Init(DeviceLayer::UDPEndPointManager()); + Dnssd::Resolver::Instance().Init(DeviceLayer::UDPEndPointManager()); #if CHIP_CONFIG_ENABLE_SERVER_IM_EVENT // Initialize event logging subsystem @@ -290,15 +290,15 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) SuccessOrExit(err); { - ::chip::app::LogStorageResources logStorageResources[] = { - { &sDebugEventBuffer[0], sizeof(sDebugEventBuffer), ::chip::app::PriorityLevel::Debug }, - { &sInfoEventBuffer[0], sizeof(sInfoEventBuffer), ::chip::app::PriorityLevel::Info }, - { &sCritEventBuffer[0], sizeof(sCritEventBuffer), ::chip::app::PriorityLevel::Critical } + app::LogStorageResources logStorageResources[] = { + { &sDebugEventBuffer[0], sizeof(sDebugEventBuffer), app::PriorityLevel::Debug }, + { &sInfoEventBuffer[0], sizeof(sInfoEventBuffer), app::PriorityLevel::Info }, + { &sCritEventBuffer[0], sizeof(sCritEventBuffer), app::PriorityLevel::Critical } }; - chip::app::EventManagement::GetInstance().Init(&mExchangeMgr, CHIP_NUM_EVENT_LOGGING_BUFFERS, &sLoggingBuffer[0], - &logStorageResources[0], &sGlobalEventIdCounter, - std::chrono::duration_cast(mInitTimestamp)); + app::EventManagement::GetInstance().Init(&mExchangeMgr, CHIP_NUM_EVENT_LOGGING_BUFFERS, &sLoggingBuffer[0], + &logStorageResources[0], &sGlobalEventIdCounter, + std::chrono::duration_cast(mInitTimestamp)); } #endif // CHIP_CONFIG_ENABLE_SERVER_IM_EVENT @@ -333,7 +333,7 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) #if CONFIG_NETWORK_LAYER_BLE // The device is already commissioned, proactively disable BLE advertisement. ChipLogProgress(AppServer, "Fabric already commissioned. Disabling BLE advertisement"); - chip::DeviceLayer::ConnectivityMgr().SetBLEAdvertisingEnabled(false); + DeviceLayer::ConnectivityMgr().SetBLEAdvertisingEnabled(false); #endif } else @@ -374,8 +374,8 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) &mCertificateValidityPolicy, mGroupsProvider); SuccessOrExit(err); - err = chip::app::InteractionModelEngine::GetInstance()->Init(&mExchangeMgr, &GetFabricTable(), mReportScheduler, - &mCASESessionManager, mSubscriptionResumptionStorage); + err = app::InteractionModelEngine::GetInstance()->Init(&mExchangeMgr, &GetFabricTable(), mReportScheduler, &mCASESessionManager, + mSubscriptionResumptionStorage); SuccessOrExit(err); #if CHIP_CONFIG_ENABLE_ICD_SERVER @@ -396,7 +396,7 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) .SetFabricTable(&GetFabricTable()) .SetSymmetricKeyStore(mSessionKeystore) .SetExchangeManager(&mExchangeMgr) - .SetSubscriptionsInfoProvider(chip::app::InteractionModelEngine::GetInstance()) + .SetSubscriptionsInfoProvider(app::InteractionModelEngine::GetInstance()) .SetICDCheckInBackOffStrategy(initParams.icdCheckInBackOffStrategy); #endif // CHIP_CONFIG_ENABLE_ICD_CIP @@ -455,7 +455,7 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) } #if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT // support UDC port for commissioner declaration msgs - mUdcTransportMgr = chip::Platform::New(); + mUdcTransportMgr = Platform::New(); ReturnErrorOnFailure(mUdcTransportMgr->Init(Transport::UdpListenParameters(DeviceLayer::UDPEndPointManager()) .SetAddressType(Inet::IPAddressType::kIPv6) .SetListenPort(static_cast(mCdcListenPort)) @@ -467,7 +467,7 @@ CHIP_ERROR Server::Init(const ServerInitParams & initParams) #endif // INET_CONFIG_ENABLE_IPV4 )); - gUDCClient = chip::Platform::New(); + gUDCClient = Platform::New(); mUdcTransportMgr->SetSessionManager(gUDCClient); #endif // CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY @@ -623,23 +623,23 @@ void Server::Shutdown() app::DnssdServer::Instance().SetICDManager(nullptr); #endif // CHIP_CONFIG_ENABLE_ICD_SERVER app::DnssdServer::Instance().SetCommissioningModeProvider(nullptr); - chip::Dnssd::ServiceAdvertiser::Instance().Shutdown(); + Dnssd::ServiceAdvertiser::Instance().Shutdown(); #if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT if (mUdcTransportMgr != nullptr) { - chip::Platform::Delete(mUdcTransportMgr); + Platform::Delete(mUdcTransportMgr); mUdcTransportMgr = nullptr; } if (gUDCClient != nullptr) { - chip::Platform::Delete(gUDCClient); + Platform::Delete(gUDCClient); gUDCClient = nullptr; } #endif // CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY - chip::Dnssd::Resolver::Instance().Shutdown(); - chip::app::InteractionModelEngine::GetInstance()->Shutdown(); + Dnssd::Resolver::Instance().Shutdown(); + app::InteractionModelEngine::GetInstance()->Shutdown(); #if CHIP_CONFIG_ENABLE_ICD_SERVER app::InteractionModelEngine::GetInstance()->SetICDManager(nullptr); #endif // CHIP_CONFIG_ENABLE_ICD_SERVER @@ -674,7 +674,7 @@ void Server::Shutdown() // NOTE: UDC client is located in Server.cpp because it really only makes sense // to send UDC from a Matter device. The UDC message payload needs to include the device's // randomly generated service name. -CHIP_ERROR Server::SendUserDirectedCommissioningRequest(chip::Transport::PeerAddress commissioner, +CHIP_ERROR Server::SendUserDirectedCommissioningRequest(Transport::PeerAddress commissioner, Protocols::UserDirectedCommissioning::IdentificationDeclaration & id) { ChipLogDetail(AppServer, "Server::SendUserDirectedCommissioningRequest()"); @@ -685,7 +685,7 @@ CHIP_ERROR Server::SendUserDirectedCommissioningRequest(chip::Transport::PeerAdd if (strlen(id.GetInstanceName()) == 0) { ChipLogDetail(AppServer, "Server::SendUserDirectedCommissioningRequest() Instance Name not known"); - char nameBuffer[chip::Dnssd::Commission::kInstanceNameMaxLength + 1]; + char nameBuffer[Dnssd::Commission::kInstanceNameMaxLength + 1]; err = app::DnssdServer::Instance().GetCommissionableInstanceName(nameBuffer, sizeof(nameBuffer)); if (err != CHIP_NO_ERROR) { @@ -727,9 +727,9 @@ CHIP_ERROR Server::SendUserDirectedCommissioningRequest(chip::Transport::PeerAdd if (strlen(id.GetDeviceName()) == 0) { - char deviceName[chip::Dnssd::kKeyDeviceNameMaxLength + 1] = {}; - if (!chip::DeviceLayer::ConfigurationMgr().IsCommissionableDeviceNameEnabled() || - chip::DeviceLayer::ConfigurationMgr().GetCommissionableDeviceName(deviceName, sizeof(deviceName)) != CHIP_NO_ERROR) + char deviceName[Dnssd::kKeyDeviceNameMaxLength + 1] = {}; + if (!DeviceLayer::ConfigurationMgr().IsCommissionableDeviceNameEnabled() || + DeviceLayer::ConfigurationMgr().GetCommissionableDeviceName(deviceName, sizeof(deviceName)) != CHIP_NO_ERROR) { ChipLogDetail(AppServer, "Server::SendUserDirectedCommissioningRequest() Device Name not known"); } @@ -743,13 +743,13 @@ CHIP_ERROR Server::SendUserDirectedCommissioningRequest(chip::Transport::PeerAdd if (id.GetRotatingIdLength() == 0) { AdditionalDataPayloadGeneratorParams additionalDataPayloadParams; - uint8_t rotatingDeviceIdUniqueId[chip::DeviceLayer::ConfigurationManager::kRotatingDeviceIDUniqueIDLength]; + uint8_t rotatingDeviceIdUniqueId[DeviceLayer::ConfigurationManager::kRotatingDeviceIDUniqueIDLength]; MutableByteSpan rotatingDeviceIdUniqueIdSpan(rotatingDeviceIdUniqueId); ReturnErrorOnFailure( - chip::DeviceLayer::GetDeviceInstanceInfoProvider()->GetRotatingDeviceIdUniqueId(rotatingDeviceIdUniqueIdSpan)); + DeviceLayer::GetDeviceInstanceInfoProvider()->GetRotatingDeviceIdUniqueId(rotatingDeviceIdUniqueIdSpan)); ReturnErrorOnFailure( - chip::DeviceLayer::ConfigurationMgr().GetLifetimeCounter(additionalDataPayloadParams.rotatingDeviceIdLifetimeCounter)); + DeviceLayer::ConfigurationMgr().GetLifetimeCounter(additionalDataPayloadParams.rotatingDeviceIdLifetimeCounter)); additionalDataPayloadParams.rotatingDeviceIdUniqueId = rotatingDeviceIdUniqueIdSpan; uint8_t rotatingDeviceIdInternalBuffer[RotatingDeviceId::kMaxLength]; @@ -784,7 +784,7 @@ CHIP_ERROR Server::SendUserDirectedCommissioningRequest(chip::Transport::PeerAdd #if CHIP_CONFIG_PERSIST_SUBSCRIPTIONS void Server::ResumeSubscriptions() { - CHIP_ERROR err = chip::app::InteractionModelEngine::GetInstance()->ResumeSubscriptions(); + CHIP_ERROR err = app::InteractionModelEngine::GetInstance()->ResumeSubscriptions(); if (err != CHIP_NO_ERROR) { ChipLogError(AppServer, "Error when trying to resume subscriptions : %" CHIP_ERROR_FORMAT, err.Format());