Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[WIP] Allow setting Matter TagList attribute #11516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
lboue wants to merge 1 commit into espressif:master
base: master
Choose a base branch
Loading
from lboue:NamespaceSwitches
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions libraries/Matter/src/MatterEndpoints/MatterGenericSwitch.cpp
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,37 @@

#include <Matter.h>
#include <app/server/Server.h>
#include <app/util/attribute-storage.h>
#include <MatterEndpoints/MatterGenericSwitch.h>

using namespace esp_matter;
using namespace esp_matter::endpoint;
using namespace esp_matter::cluster;
using namespace chip::app::Clusters;

namespace {
// Please refer to https://github.com/CHIP-Specifications/connectedhomeip-spec/blob/master/src/namespaces
constexpr const uint8_t kNamespaceSwitches = 0x43;
// Switches Namespace: 67, tag 0 (SwitchOn)
constexpr const uint8_t kTagSwitchOn = 0;
// Switches Namespace: 67, tag 1 (SwitchOff)
constexpr const uint8_t kTagSwitchOff = 1;

constexpr const uint8_t kNamespacePosition = 8;
// Common Position Namespace: 8, tag: 0 (Left)
constexpr const uint8_t kTagPositionLeft = 0;
// Common Position Namespace: 8, tag: 1 (Right)
constexpr const uint8_t kTagPositionRight = 1;

const Descriptor::Structs::SemanticTagStruct::Type gEp1TagList[] = {
{.namespaceID = kNamespaceSwitches, .tag = kTagSwitchOn},
{.namespaceID = kNamespacePosition, .tag = kTagPositionRight}};
const Descriptor::Structs::SemanticTagStruct::Type gEp2TagList[] = {
{.namespaceID = kNamespaceSwitches, .tag = kTagSwitchOff},
{.namespaceID = kNamespacePosition, .tag = kTagPositionLeft}};

}

MatterGenericSwitch::MatterGenericSwitch() {}

MatterGenericSwitch::~MatterGenericSwitch() {
Expand Down Expand Up @@ -76,10 +100,15 @@ bool MatterGenericSwitch::begin() {

switch_cluster::attribute::create_current_position(aCluster, 0);
switch_cluster::attribute::create_number_of_positions(aCluster, 2);

descriptor::attribute::create_tag_list(aCluster, NULL, 0, 0);

setEndPointId(endpoint::get_id(endpoint));
log_i("Generic Switch created with endpoint_id %d", getEndPointId());
started = true;

// TODO: Make it dynamic
SetTagList(getEndPointId(), chip::Span<const Descriptor::Structs::SemanticTagStruct::Type>(gEp1TagList));
return true;
}

Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /