Skip to content

Commit

Permalink
Merge branch 'master' of github.com:selissia/connectedhomeip into req…
Browse files Browse the repository at this point in the history
…uestor_refactoring
  • Loading branch information
selissia committed Nov 10, 2021
2 parents 9d09e67 + 125ad20 commit b0090d1
Show file tree
Hide file tree
Showing 277 changed files with 17,947 additions and 12,640 deletions.
1 change: 1 addition & 0 deletions .github/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ hciconfig
hdlc
HKDF
hoc
homebrew
hostapd
hostname
href
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/examples-mbed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
/tmp/bloat_reports/
- name: Build pigweed-app example
timeout-minutes: 10
timeout-minutes: 15
run: |
scripts/examples/mbed_example.sh -a=pigweed-app -b=$APP_TARGET -p=$APP_PROFILE
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,12 @@
* limitations under the License.
*/

// THIS FILE IS GENERATED BY ZAP
/**
* @file
* chip::System project configuration for standalone builds on iOS
*
*/
#ifndef SYSTEMPROJECTCONFIG_H
#define SYSTEMPROJECTCONFIG_H

#endif /* SYSTEMPROJECTCONFIG_H */
4 changes: 4 additions & 0 deletions config/standalone/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,8 @@

#define CHIP_CONFIG_DATA_MANAGEMENT_CLIENT_EXPERIMENTAL 1

#ifndef DYNAMIC_ENDPOINT_COUNT
#define DYNAMIC_ENDPOINT_COUNT 4
#endif

#endif /* CHIPPROJECTCONFIG_H */
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[the build guide](guides/BUILDING.md)
- Documentation about running [cirque](https://github.com/openweave/cirque)
tests can be found in
[the cirque test guide](src/test_driver/linux-cirque/README.md)
[the cirque test guide](../src/test_driver/linux-cirque/README.md)
- Documentation about standard build & development flows using
[Visual Studio Code](https://code.visualstudio.com/) can be found in
[the development guide](./VSCODE_DEVELOPMENT.md)
Expand Down
8 changes: 8 additions & 0 deletions docs/guides/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ brew install openssl pkg-config
However, that does not expose the package to `pkg-config`. To fix that, one
needs to run something like the following:

Intel:

```
cd /usr/local/lib/pkgconfig
ln -s ../../Cellar/[email protected]/1.1.1g/lib/pkgconfig/* .
Expand All @@ -68,6 +70,12 @@ ln -s ../../Cellar/[email protected]/1.1.1g/lib/pkgconfig/* .
where `[email protected]/1.1.1g` may need to be replaced with the actual version of
OpenSSL installed by Brew.

Apple Silicon:

```
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:"/opt/homebrew/opt/openssl@3/lib/pkgconfig"
```

Note: If using MacPorts, `port install openssl` is sufficient to satisfy this
dependency.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
*
* Copyright (c) 2021 Project CHIP Authors
* All rights reserved.
*
* 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
*
* 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.
*/

#pragma once

#include <app/clusters/mode-select-server/supported-modes-manager.h>
#include <app/util/af.h>
#include <cstring>

namespace chip {
namespace app {
namespace Clusters {
namespace ModeSelect {

/**
* This implementation statically defines the options.
*/

class StaticSupportedModesManager : public chip::app::Clusters::ModeSelect::SupportedModesManager
{
using ModeOptionStructType = Structs::ModeOptionStruct::Type;
using storage_value_type = const ModeOptionStructType;

struct EndpointSpanPair
{
const EndpointId mEndpointId;
const Span<storage_value_type> mSpan;

EndpointSpanPair(const EndpointId aEndpointId, const Span<storage_value_type> && aSpan) :
mEndpointId(aEndpointId), mSpan(aSpan)
{}

EndpointSpanPair() : mEndpointId(0), mSpan(Span<storage_value_type>()) {}
};

static storage_value_type coffeeOptions[];
static const EndpointSpanPair supportedOptionsByEndpoints[EMBER_AF_MODE_SELECT_CLUSTER_SERVER_ENDPOINT_COUNT];

public:
static const StaticSupportedModesManager instance;

const SupportedModesManager::ModeOptionsProvider getModeOptionsProvider(EndpointId endpointId) const override;

EmberAfStatus getModeOptionByMode(EndpointId endpointId, uint8_t mode, const ModeOptionStructType ** dataPtr) const override;

~StaticSupportedModesManager(){};

StaticSupportedModesManager() {}

static inline const StaticSupportedModesManager & getStaticSupportedModesManagerInstance() { return instance; }
};

const SupportedModesManager * getSupportedModesManager();

} // namespace ModeSelect
} // namespace Clusters
} // namespace app
} // namespace chip
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#include <static-supported-modes-manager.h>

using namespace std;
using namespace chip;
using namespace chip::app::Clusters;
using namespace chip::app::Clusters::ModeSelect;

using ModeOptionStructType = Structs::ModeOptionStruct::Type;
using storage_value_type = const ModeOptionStructType;
namespace {
Structs::ModeOptionStruct::Type buildModeOptionStruct(const char * label, uint8_t mode, uint32_t semanticTag)
{
Structs::ModeOptionStruct::Type option;
option.label = CharSpan(label, strlen(label));
option.mode = mode;
option.semanticTag = semanticTag;
return option;
}
} // namespace

// TODO: Configure your options for each endpoint
storage_value_type StaticSupportedModesManager::coffeeOptions[] = { buildModeOptionStruct("Black", 0, 0),
buildModeOptionStruct("Cappuccino", 4, 0),
buildModeOptionStruct("Espresso", 7, 0) };
const StaticSupportedModesManager::EndpointSpanPair
StaticSupportedModesManager::supportedOptionsByEndpoints[EMBER_AF_MODE_SELECT_CLUSTER_SERVER_ENDPOINT_COUNT] = {
EndpointSpanPair(1, Span<storage_value_type>(StaticSupportedModesManager::coffeeOptions)) // Options for Endpoint 1
};

const StaticSupportedModesManager StaticSupportedModesManager::instance = StaticSupportedModesManager();

const SupportedModesManager::ModeOptionsProvider StaticSupportedModesManager::getModeOptionsProvider(EndpointId endpointId) const
{
for (auto & endpointSpanPair : supportedOptionsByEndpoints)
{
if (endpointSpanPair.mEndpointId == endpointId)
{
return ModeOptionsProvider(endpointSpanPair.mSpan.data(), endpointSpanPair.mSpan.end());
}
}
return ModeOptionsProvider(nullptr, nullptr);
}

EmberAfStatus StaticSupportedModesManager::getModeOptionByMode(unsigned short endpointId, unsigned char mode,
const ModeOptionStructType ** dataPtr) const
{
auto modeOptionsProvider = this->getModeOptionsProvider(endpointId);
if (modeOptionsProvider.begin() == nullptr)
{
return EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER;
}
auto * begin = this->getModeOptionsProvider(endpointId).begin();
auto * end = this->getModeOptionsProvider(endpointId).end();

for (auto * it = begin; it != end; ++it)
{
auto & modeOption = *it;
if (modeOption.mode == mode)
{
*dataPtr = &modeOption;
return EMBER_ZCL_STATUS_SUCCESS;
}
}
emberAfPrintln(EMBER_AF_PRINT_DEBUG, "Cannot find the mode %" PRIu8, mode);
return EMBER_ZCL_STATUS_INVALID_ARGUMENT;
}

const ModeSelect::SupportedModesManager * ModeSelect::getSupportedModesManager()
{
return &StaticSupportedModesManager::instance;
}
2 changes: 2 additions & 0 deletions examples/all-clusters-app/ameba/chip_main.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ list(
${chip_dir}/zzz_generated/all-clusters-app/zap-generated/CHIPClusters.cpp

${chip_dir}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp
${chip_dir}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp

${chip_dir}/examples/all-clusters-app/ameba/main/chipinterface.cpp
${chip_dir}/examples/all-clusters-app/ameba/main/DeviceCallbacks.cpp
Expand Down Expand Up @@ -63,6 +64,7 @@ target_include_directories(
${chip_dir}/zzz_generated/all-clusters-app/zap-generated
${chip_dir}/zzz_generated/app-common
${chip_dir}/examples/all-clusters-app/all-clusters-common
${chip_dir}/examples/all-clusters-app/all-clusters-common/include
${chip_dir}/examples/all-clusters-app/ameba/main/include
${chip_dir_output}/gen/include
${chip_dir}/src/include/
Expand Down
4 changes: 3 additions & 1 deletion examples/all-clusters-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# The list of src and include dirs must be in sync with that in all-clusters-app/esp32/main/component.mk
set(PRIV_INCLUDE_DIRS_LIST
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/zzz_generated/all-clusters-app"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/include"
"${CMAKE_CURRENT_LIST_DIR}/include"
)
set(SRC_DIRS_LIST
Expand Down Expand Up @@ -55,7 +56,8 @@ set(SRC_DIRS_LIST
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/media-playback-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-provider"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/target-navigator-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thermostat-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thermostat-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thermostat-user-interface-configuration-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thread_network_diagnostics_server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/tv-channel-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/scenes"
Expand Down
4 changes: 4 additions & 0 deletions examples/all-clusters-app/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import("//build_overrides/chip.gni")
executable("chip-all-clusters-app") {
sources = [
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp",
"include/tv-callbacks.cpp",
"main.cpp",
]
Expand All @@ -28,6 +29,9 @@ executable("chip-all-clusters-app") {
"${chip_root}/src/lib",
]

include_dirs =
[ "${chip_root}/examples/all-clusters-app/all-clusters-common/include" ]

cflags = [ "-Wconversion" ]

output_dir = root_out_dir
Expand Down
5 changes: 4 additions & 1 deletion examples/all-clusters-app/mbed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ target_include_directories(${APP_TARGET} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/main/include/
${APP_ROOT}/all-clusters-common
${APP_ROOT}/all-clusters-common/include
${APP_CLUSTERS}
${MBED_COMMON}/util/include
${CHIP_ROOT}/src/app
${CHIP_ROOT}/third_party/nlio/repo/include
Expand Down Expand Up @@ -67,6 +69,7 @@ target_sources(${APP_TARGET} PRIVATE
${CHIP_ROOT}/src/app/server/CommissioningWindowManager.cpp

${CHIP_ROOT}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp
${CHIP_ROOT}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp

${APP_UTIL}/DataModelHandler.cpp
${APP_UTIL}/af-event.cpp
Expand Down Expand Up @@ -112,14 +115,14 @@ target_sources(${APP_TARGET} PRIVATE
${APP_CLUSTERS}/media-input-server/media-input-server.cpp
${APP_CLUSTERS}/media-playback-server/media-playback-server.cpp
${APP_CLUSTERS}/mode-select-server/mode-select-server.cpp
${APP_CLUSTERS}/mode-select-server/static-supported-modes-manager.cpp
${APP_CLUSTERS}/network-commissioning/network-commissioning-ember.cpp
${APP_CLUSTERS}/network-commissioning/network-commissioning.cpp
${APP_CLUSTERS}/on-off-server/on-off-server.cpp
${APP_CLUSTERS}/ota-provider/ota-provider.cpp
${APP_CLUSTERS}/scenes/scenes.cpp
${APP_CLUSTERS}/target-navigator-server/target-navigator-server.cpp
${APP_CLUSTERS}/thermostat-server/thermostat-server.cpp
${APP_CLUSTERS}/thermostat-user-interface-configuration-server/thermostat-user-interface-configuration-server.cpp
${APP_CLUSTERS}/tv-channel-server/tv-channel-server.cpp
${APP_CLUSTERS}/operational-credentials-server/operational-credentials-server.cpp
${APP_CLUSTERS}/test-cluster-server/test-cluster-server.cpp
Expand Down
2 changes: 2 additions & 0 deletions examples/all-clusters-app/p6/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ p6_executable("clusters_app") {

sources = [
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/bridged-actions-stub.cpp",
"${chip_root}/examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp",
"${examples_plat_dir}/LEDWidget.cpp",
"${examples_plat_dir}/init_p6Platform.cpp",
"src/AppTask.cpp",
Expand All @@ -82,6 +83,7 @@ p6_executable("clusters_app") {
"include",
"${examples_plat_dir}",
"${p6_project_dir}/include",
"${chip_root}/examples/all-clusters-app/all-clusters-common/include",
]

defines = []
Expand Down
12 changes: 6 additions & 6 deletions examples/bridge-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,27 +74,27 @@ static Device gLight4("Light 4", "Den");

// Declare On/Off cluster attributes
DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(onOffAttrs)
DECLARE_DYNAMIC_ATTRIBUTE(ZCL_ON_OFF_ATTRIBUTE_ID, BOOLEAN, 1, 0) /* on/off */
DECLARE_DYNAMIC_ATTRIBUTE_LIST_END();
DECLARE_DYNAMIC_ATTRIBUTE(ZCL_ON_OFF_ATTRIBUTE_ID, BOOLEAN, 1, 0), /* on/off */
DECLARE_DYNAMIC_ATTRIBUTE_LIST_END();

// Declare Descriptor cluster attributes
DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(descriptorAttrs)
DECLARE_DYNAMIC_ATTRIBUTE(ZCL_DEVICE_LIST_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0), /* device list */
DECLARE_DYNAMIC_ATTRIBUTE(ZCL_SERVER_LIST_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0), /* server list */
DECLARE_DYNAMIC_ATTRIBUTE(ZCL_CLIENT_LIST_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0), /* client list */
DECLARE_DYNAMIC_ATTRIBUTE(ZCL_PARTS_LIST_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0) /* parts list */
DECLARE_DYNAMIC_ATTRIBUTE(ZCL_PARTS_LIST_ATTRIBUTE_ID, ARRAY, kDescriptorAttributeArraySize, 0), /* parts list */
DECLARE_DYNAMIC_ATTRIBUTE_LIST_END();

// Declare Bridged Device Basic information cluster attributes
DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(bridgedDeviceBasicAttrs)
DECLARE_DYNAMIC_ATTRIBUTE(ZCL_USER_LABEL_ATTRIBUTE_ID, CHAR_STRING, kUserLabelSize, 0), /* UserLabel */
DECLARE_DYNAMIC_ATTRIBUTE(ZCL_REACHABLE_ATTRIBUTE_ID, BOOLEAN, 1, 0) /* Reachable */
DECLARE_DYNAMIC_ATTRIBUTE(ZCL_REACHABLE_ATTRIBUTE_ID, BOOLEAN, 1, 0), /* Reachable */
DECLARE_DYNAMIC_ATTRIBUTE_LIST_END();

// Declare Fixed Label cluster attributes
DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(fixedLabelAttrs)
DECLARE_DYNAMIC_ATTRIBUTE(ZCL_LABEL_LIST_ATTRIBUTE_ID, ARRAY, kFixedLabelAttributeArraySize, 0) /* label list */
DECLARE_DYNAMIC_ATTRIBUTE_LIST_END();
DECLARE_DYNAMIC_ATTRIBUTE(ZCL_LABEL_LIST_ATTRIBUTE_ID, ARRAY, kFixedLabelAttributeArraySize, 0), /* label list */
DECLARE_DYNAMIC_ATTRIBUTE_LIST_END();

// Declare Cluster List for Bridged Light endpoint
DECLARE_DYNAMIC_CLUSTER_LIST_BEGIN(bridgedLightClusters)
Expand Down
Loading

0 comments on commit b0090d1

Please sign in to comment.