-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:selissia/connectedhomeip into req…
…uestor_refactoring
- Loading branch information
Showing
277 changed files
with
17,947 additions
and
12,640 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -435,6 +435,7 @@ hciconfig | |
hdlc | ||
HKDF | ||
hoc | ||
homebrew | ||
hostapd | ||
hostname | ||
href | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/* . | ||
|
@@ -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. | ||
|
||
|
73 changes: 73 additions & 0 deletions
73
examples/all-clusters-app/all-clusters-common/include/static-supported-modes-manager.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
71 changes: 71 additions & 0 deletions
71
examples/all-clusters-app/all-clusters-common/src/static-supported-modes-manager.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.