Skip to content

Commit

Permalink
Merge branch 'master' into lowercase_standard_types
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 committed Oct 11, 2023
2 parents b14be07 + 78eb271 commit 83a8164
Show file tree
Hide file tree
Showing 18 changed files with 173 additions and 170 deletions.
4 changes: 2 additions & 2 deletions src/app/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ static_library("app") {
":app_config",
"${chip_root}/src/access",
"${chip_root}/src/app/icd:notifier",
"${chip_root}/src/app/icd:observer-srcs",
"${chip_root}/src/app/icd:observer",
"${chip_root}/src/lib/address_resolve",
"${chip_root}/src/lib/support",
"${chip_root}/src/messaging",
Expand All @@ -248,7 +248,7 @@ static_library("app") {
]

if (chip_enable_icd_server) {
public_deps += [ "${chip_root}/src/app/icd:manager-srcs" ]
public_deps += [ "${chip_root}/src/app/icd:manager" ]
}

cflags = [ "-Wconversion" ]
Expand Down
4 changes: 2 additions & 2 deletions src/app/ReadHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <app/reporting/Engine.h>

#if CHIP_CONFIG_ENABLE_ICD_SERVER
#include <app/icd/IcdManagementServer.h> // nogncheck
#include <app/icd/ICDManagementServer.h> // nogncheck
#endif

namespace chip {
Expand All @@ -45,7 +45,7 @@ using Status = Protocols::InteractionModel::Status;
uint16_t ReadHandler::GetPublisherSelectedIntervalLimit()
{
#if CHIP_CONFIG_ENABLE_ICD_SERVER
return static_cast<uint16_t>(IcdManagementServer::GetInstance().GetIdleModeIntervalSec());
return static_cast<uint16_t>(ICDManagementServer::GetInstance().GetIdleModeIntervalSec());
#else
return kSubscriptionMaxIntervalPublisherLimit;
#endif
Expand Down
93 changes: 48 additions & 45 deletions src/app/chip_data_model.cmake
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#
# Copyright (c) 2020 Project CHIP Authors
# Copyright (c) 2020 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

set(CHIP_APP_BASE_DIR ${CMAKE_CURRENT_LIST_DIR})
Expand All @@ -32,7 +32,7 @@ function(chip_configure_zap_file APP_TARGET ZAP_FILE EXTERNAL_CLUSTERS)
find_package(Python3 REQUIRED)
set(args --zap_file ${ZAP_FILE})

if (EXTERNAL_CLUSTERS)
if(EXTERNAL_CLUSTERS)
list(APPEND args --external-clusters ${EXTERNAL_CLUSTERS})
endif()

Expand All @@ -42,11 +42,13 @@ function(chip_configure_zap_file APP_TARGET ZAP_FILE EXTERNAL_CLUSTERS)
ERROR_VARIABLE ERROR_MESSAGE
RESULT_VARIABLE RC
)
if (NOT RC EQUAL 0)

if(NOT RC EQUAL 0)
message(FATAL_ERROR "Failed to execute zap_cluster_list.py: ${ERROR_MESSAGE}")
endif()

string(REPLACE "\n" ";" CLUSTER_LIST "${CLUSTER_LIST}")

foreach(CLUSTER ${CLUSTER_LIST})
chip_configure_cluster(${APP_TARGET} ${CLUSTER})
endforeach()
Expand All @@ -55,26 +57,26 @@ endfunction()
#
# Configure ${APP_TARGET} based on the selected data model configuration.
# Available options are:
# SCOPE CMake scope keyword that defines the scope of included sources.
# The default is PRIVATE scope.
# INCLUDE_SERVER Include source files from src/app/server directory.
# ZAP_FILE Path to the ZAP file, used to determine the list of clusters
# supported by the application.
# IDL .matter IDL file to use for codegen. Inferred from ZAP_FILE
# if not provided
# EXTERNAL_CLUSTERS Clusters with external implementations. The default implementations
# will not be used nor required for these clusters.
# Format: MY_CUSTOM_CLUSTER'.
# SCOPE CMake scope keyword that defines the scope of included sources.
# The default is PRIVATE scope.
# INCLUDE_SERVER Include source files from src/app/server directory.
# ZAP_FILE Path to the ZAP file, used to determine the list of clusters
# supported by the application.
# IDL .matter IDL file to use for codegen. Inferred from ZAP_FILE
# if not provided
# EXTERNAL_CLUSTERS Clusters with external implementations. The default implementations
# will not be used nor required for these clusters.
# Format: MY_CUSTOM_CLUSTER'.
#
function(chip_configure_data_model APP_TARGET)
set(SCOPE PRIVATE)
cmake_parse_arguments(ARG "INCLUDE_SERVER" "SCOPE;ZAP_FILE;IDL" "EXTERNAL_CLUSTERS" ${ARGN})

if (ARG_SCOPE)
if(ARG_SCOPE)
set(SCOPE ${ARG_SCOPE})
endif()

if (ARG_INCLUDE_SERVER)
if(ARG_INCLUDE_SERVER)
target_sources(${APP_TARGET} ${SCOPE}
${CHIP_APP_BASE_DIR}/server/AclStorage.cpp
${CHIP_APP_BASE_DIR}/server/DefaultAclStorage.cpp
Expand All @@ -86,26 +88,27 @@ function(chip_configure_data_model APP_TARGET)
)

target_compile_options(${APP_TARGET} ${SCOPE}
"-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>"
"-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>"
)
endif()

if (ARG_ZAP_FILE)
if(ARG_ZAP_FILE)
chip_configure_zap_file(${APP_TARGET} ${ARG_ZAP_FILE} "${ARG_EXTERNAL_CLUSTERS}")
if (NOT ARG_IDL)

if(NOT ARG_IDL)
string(REPLACE ".zap" ".matter" ARG_IDL ${ARG_ZAP_FILE})
endif()
endif()

if (ARG_IDL)
if(ARG_IDL)
chip_codegen(${APP_TARGET}-codegen
INPUT "${ARG_IDL}"
GENERATOR "cpp-app"
OUTPUTS
"app/PluginApplicationCallbacks.h"
"app/callback-stub.cpp"
OUTPUT_PATH APP_GEN_DIR
OUTPUT_FILES APP_GEN_FILES
INPUT "${ARG_IDL}"
GENERATOR "cpp-app"
OUTPUTS
"app/PluginApplicationCallbacks.h"
"app/callback-stub.cpp"
OUTPUT_PATH APP_GEN_DIR
OUTPUT_FILES APP_GEN_FILES
)

target_include_directories(${APP_TARGET} ${SCOPE} "${APP_GEN_DIR}")
Expand All @@ -115,16 +118,16 @@ function(chip_configure_data_model APP_TARGET)
endif()

chip_zapgen(${APP_TARGET}-zapgen
INPUT "${ARG_ZAP_FILE}"
INPUT "${ARG_ZAP_FILE}"
GENERATOR "app-templates"
OUTPUTS
"zap-generated/access.h"
"zap-generated/CHIPClusters.h"
"zap-generated/endpoint_config.h"
"zap-generated/gen_config.h"
"zap-generated/IMClusterCommandHandler.cpp"
OUTPUT_PATH APP_TEMPLATES_GEN_DIR
OUTPUT_FILES APP_TEMPLATES_GEN_FILES
"zap-generated/access.h"
"zap-generated/CHIPClusters.h"
"zap-generated/endpoint_config.h"
"zap-generated/gen_config.h"
"zap-generated/IMClusterCommandHandler.cpp"
OUTPUT_PATH APP_TEMPLATES_GEN_DIR
OUTPUT_FILES APP_TEMPLATES_GEN_FILES
)
target_include_directories(${APP_TARGET} ${SCOPE} "${APP_TEMPLATES_GEN_DIR}")
add_dependencies(${APP_TARGET} ${APP_TARGET}-zapgen)
Expand All @@ -136,8 +139,8 @@ function(chip_configure_data_model APP_TARGET)
${CHIP_APP_BASE_DIR}/util/attribute-storage.cpp
${CHIP_APP_BASE_DIR}/util/attribute-table.cpp
${CHIP_APP_BASE_DIR}/util/binding-table.cpp
${CHIP_APP_BASE_DIR}/icd/IcdMonitoringTable.cpp
${CHIP_APP_BASE_DIR}/icd/IcdManagementServer.cpp
${CHIP_APP_BASE_DIR}/icd/ICDMonitoringTable.cpp
${CHIP_APP_BASE_DIR}/icd/ICDManagementServer.cpp
${CHIP_APP_BASE_DIR}/util/DataModelHandler.cpp
${CHIP_APP_BASE_DIR}/util/ember-compatibility-functions.cpp
${CHIP_APP_BASE_DIR}/util/generic-callback-stubs.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/app/chip_data_model.gni
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ template("chip_data_model") {
} else if (cluster == "icd-management-server") {
sources += [ "${_app_root}/clusters/${cluster}/${cluster}.cpp" ]

deps += [ "${chip_root}/src/app/icd:cluster-srcs" ]
deps += [ "${chip_root}/src/app/icd:cluster" ]
} else if (cluster == "resource-monitoring-server") {
sources += [
"${_app_root}/clusters/${cluster}/${cluster}.cpp",
Expand Down
32 changes: 16 additions & 16 deletions src/app/clusters/icd-management-server/icd-management-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
#include <app/AttributeAccessInterface.h>
#include <app/CommandHandler.h>
#include <app/ConcreteAttributePath.h>
#include <app/icd/IcdManagementServer.h>
#include <app/icd/IcdMonitoringTable.h>
#include <app/icd/ICDManagementServer.h>
#include <app/icd/ICDMonitoringTable.h>
#include <app/server/Server.h>
#include <app/util/af.h>
#include <app/util/attribute-storage.h>
Expand Down Expand Up @@ -89,31 +89,31 @@ CHIP_ERROR IcdManagementAttributeAccess::Read(const ConcreteReadAttributePath &

CHIP_ERROR IcdManagementAttributeAccess::ReadIdleModeInterval(EndpointId endpoint, AttributeValueEncoder & encoder)
{
return encoder.Encode(IcdManagementServer::GetInstance().GetIdleModeIntervalSec());
return encoder.Encode(ICDManagementServer::GetInstance().GetIdleModeIntervalSec());
}

CHIP_ERROR IcdManagementAttributeAccess::ReadActiveModeInterval(EndpointId endpoint, AttributeValueEncoder & encoder)
{
return encoder.Encode(IcdManagementServer::GetInstance().GetActiveModeIntervalMs());
return encoder.Encode(ICDManagementServer::GetInstance().GetActiveModeIntervalMs());
}

CHIP_ERROR IcdManagementAttributeAccess::ReadActiveModeThreshold(EndpointId endpoint, AttributeValueEncoder & encoder)
{
return encoder.Encode(IcdManagementServer::GetInstance().GetActiveModeThresholdMs());
return encoder.Encode(ICDManagementServer::GetInstance().GetActiveModeThresholdMs());
}

CHIP_ERROR IcdManagementAttributeAccess::ReadRegisteredClients(EndpointId endpoint, AttributeValueEncoder & encoder)
{
uint16_t supported_clients = IcdManagementServer::GetInstance().GetClientsSupportedPerFabric();
uint16_t supported_clients = ICDManagementServer::GetInstance().GetClientsSupportedPerFabric();

return encoder.EncodeList([supported_clients](const auto & subEncoder) -> CHIP_ERROR {
IcdMonitoringEntry e;
ICDMonitoringEntry e;

const auto & fabricTable = Server::GetInstance().GetFabricTable();
for (const auto & fabricInfo : fabricTable)
{
PersistentStorageDelegate & storage = chip::Server::GetInstance().GetPersistentStorage();
IcdMonitoringTable table(storage, fabricInfo.GetFabricIndex(), supported_clients);
ICDMonitoringTable table(storage, fabricInfo.GetFabricIndex(), supported_clients);
for (uint16_t i = 0; i < table.Limit(); ++i)
{
CHIP_ERROR err = table.Get(i, e);
Expand All @@ -136,12 +136,12 @@ CHIP_ERROR IcdManagementAttributeAccess::ReadRegisteredClients(EndpointId endpoi

CHIP_ERROR IcdManagementAttributeAccess::ReadICDCounter(EndpointId endpoint, AttributeValueEncoder & encoder)
{
return encoder.Encode(IcdManagementServer::GetInstance().GetICDCounter());
return encoder.Encode(ICDManagementServer::GetInstance().GetICDCounter());
}

CHIP_ERROR IcdManagementAttributeAccess::ReadClientsSupportedPerFabric(EndpointId endpoint, AttributeValueEncoder & encoder)
{
return encoder.Encode(IcdManagementServer::GetInstance().GetClientsSupportedPerFabric());
return encoder.Encode(ICDManagementServer::GetInstance().GetClientsSupportedPerFabric());
}

CHIP_ERROR CheckAdmin(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, bool & is_admin)
Expand All @@ -164,8 +164,8 @@ class IcdManagementFabricDelegate : public chip::FabricTable::Delegate
{
void OnFabricRemoved(const FabricTable & fabricTable, FabricIndex fabricIndex) override
{
uint16_t supported_clients = IcdManagementServer::GetInstance().GetClientsSupportedPerFabric();
IcdMonitoringTable table(chip::Server::GetInstance().GetPersistentStorage(), fabricIndex, supported_clients);
uint16_t supported_clients = ICDManagementServer::GetInstance().GetClientsSupportedPerFabric();
ICDMonitoringTable table(chip::Server::GetInstance().GetPersistentStorage(), fabricIndex, supported_clients);
table.RemoveAll();
}
};
Expand Down Expand Up @@ -194,7 +194,7 @@ bool emberAfIcdManagementClusterRegisterClientCallback(chip::app::CommandHandler
{
PersistentStorageDelegate & storage = chip::Server::GetInstance().GetPersistentStorage();
FabricIndex fabric = commandObj->GetAccessingFabricIndex();
status = IcdManagementServer::GetInstance().RegisterClient(storage, fabric, commandData.checkInNodeID,
status = ICDManagementServer::GetInstance().RegisterClient(storage, fabric, commandData.checkInNodeID,
commandData.monitoredSubject, commandData.key,
commandData.verificationKey, is_admin);
}
Expand All @@ -203,7 +203,7 @@ bool emberAfIcdManagementClusterRegisterClientCallback(chip::app::CommandHandler
{
// Response
IcdManagement::Commands::RegisterClientResponse::Type response{ .ICDCounter =
IcdManagementServer::GetInstance().GetICDCounter() };
ICDManagementServer::GetInstance().GetICDCounter() };
commandObj->AddResponse(commandPath, response);
return true;
}
Expand All @@ -227,7 +227,7 @@ bool emberAfIcdManagementClusterUnregisterClientCallback(chip::app::CommandHandl
{
PersistentStorageDelegate & storage = chip::Server::GetInstance().GetPersistentStorage();
FabricIndex fabric = commandObj->GetAccessingFabricIndex();
status = IcdManagementServer::GetInstance().UnregisterClient(storage, fabric, commandData.checkInNodeID,
status = ICDManagementServer::GetInstance().UnregisterClient(storage, fabric, commandData.checkInNodeID,
commandData.verificationKey, is_admin);
}

Expand All @@ -242,7 +242,7 @@ bool emberAfIcdManagementClusterStayActiveRequestCallback(chip::app::CommandHand
const chip::app::ConcreteCommandPath & commandPath,
const Commands::StayActiveRequest::DecodableType & commandData)
{
InteractionModel::Status status = IcdManagementServer::GetInstance().StayActiveRequest(commandObj->GetAccessingFabricIndex());
InteractionModel::Status status = ICDManagementServer::GetInstance().StayActiveRequest(commandObj->GetAccessingFabricIndex());

commandObj->AddStatus(commandPath, status);
return true;
Expand Down
18 changes: 9 additions & 9 deletions src/app/icd/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import("//build_overrides/chip.gni")
import("icd.gni")

# ICD Server sources and configurations
source_set("observer-srcs") {
source_set("observer") {
sources = [ "ICDStateObserver.h" ]
}

Expand All @@ -32,28 +32,28 @@ source_set("notifier") {

# ICD Manager source-set is broken out of the main source-set to enable unit tests
# All sources and configurations used by the ICDManager need to go in this source-set
source_set("manager-srcs") {
source_set("manager") {
sources = [
"ICDManager.cpp",
"ICDManager.h",
]

public_deps = [
":cluster-srcs",
":cluster",
":notifier",
":observer-srcs",
":observer",
"${chip_root}/src/credentials:credentials",
]
}

# ICD management cluster source-set is broken out of the main source-set to enable unit tests
# All sources and configurations used by the ICD management cluster need to go in this source-set
source_set("cluster-srcs") {
source_set("cluster") {
sources = [
"IcdManagementServer.cpp",
"IcdManagementServer.h",
"IcdMonitoringTable.cpp",
"IcdMonitoringTable.h",
"ICDManagementServer.cpp",
"ICDManagementServer.h",
"ICDMonitoringTable.cpp",
"ICDMonitoringTable.h",
]

public_deps = [
Expand Down

0 comments on commit 83a8164

Please sign in to comment.