CI: add astyle pre-commit hook

This commit is contained in:
WanqQixiang
2026-02-03 15:30:42 +08:00
parent cb27fe763d
commit 968ff042a8
199 changed files with 4422 additions and 4726 deletions
-109
View File
@@ -1,109 +0,0 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeCategories:
- Regex: '^<'
Priority: 2
- Regex: '^".*/'
Priority: 5
- Regex: '^"'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 1000
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never
...
+31 -2
View File
@@ -1,5 +1,5 @@
stages: stages:
- check_typos - pre_check
- cleanup - cleanup
- docker_build - docker_build
- build - build
@@ -250,6 +250,7 @@ build_image:
- job: build_image - job: build_image
optional: true optional: true
- job: check_typos - job: check_typos
- job: pre_commit_check
tags: tags:
- build - build
# runner: `sudo mkdir -p /cache/matter_build/` # runner: `sudo mkdir -p /cache/matter_build/`
@@ -616,6 +617,7 @@ build_managed_component_light:
- job: build_image - job: build_image
optional: true optional: true
- job: check_typos - job: check_typos
- job: pre_commit_check
script: script:
- cd ${ESP_MATTER_PATH}/examples/managed_component_light - cd ${ESP_MATTER_PATH}/examples/managed_component_light
- idf.py set-target esp32c3 - idf.py set-target esp32c3
@@ -649,6 +651,7 @@ build_esp_rainmaker_apps:
- job: build_image - job: build_image
optional: true optional: true
- job: check_typos - job: check_typos
- job: pre_commit_check
artifacts: artifacts:
paths: paths:
@@ -754,7 +757,7 @@ deploy_docs_production:
check_typos: check_typos:
image: $CI_DOCKER_REGISTRY/esp-env-v6.0:1 image: $CI_DOCKER_REGISTRY/esp-env-v6.0:1
stage: check_typos stage: pre_check
script: script:
- pip install codespell - pip install codespell
- git fetch origin main - git fetch origin main
@@ -766,3 +769,29 @@ check_typos:
fi fi
tags: tags:
- build - build
pre_commit_check:
image: $CI_DOCKER_REGISTRY/esp-env-v6.0:1
stage: pre_check
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push" || $CI_COMMIT_BRANCH == "main"
script:
- pip install pre-commit
- git fetch origin main
- pre-commit install-hooks
- |
# Get the base commit for comparison
BASE_COMMIT=$(git merge-base origin/main HEAD)
# Run pre-commit on changed files
FILES=$(git diff --name-only --diff-filter=ACMRT ${BASE_COMMIT}...HEAD)
if [ -n "$FILES" ]; then
echo "Running pre-commit on changed files:"
echo "$FILES"
# Convert newline-separated files to space-separated and pass to pre-commit
echo "$FILES" | xargs pre-commit run --files
else
echo "No files changed, skipping pre-commit"
fi
tags:
- build
+4 -4
View File
@@ -1,8 +1,8 @@
repos: repos:
- repo: https://github.com/pre-commit/mirrors-clang-format - repo: https://github.com/espressif/astyle_py.git
rev: '0f8362ad84fe4a446b807ffbfc9e65d078ecf732' rev: v1.0.5
hooks: hooks:
- id: clang-format - id: astyle_py
exclude: '^.*/zap-generated/.*$' args: ['--astyle-version=3.4.7', '--rules=tools/ci/astyle-rules.yml']
@@ -310,7 +310,6 @@ attribute_t *create_configuration_version(cluster_t *cluster, uint32_t value)
ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value));
} }
} /* attribute */ } /* attribute */
} /* basic_information */ } /* basic_information */
@@ -558,7 +557,6 @@ attribute_t *create_test_event_triggers_enabled(cluster_t *cluster, bool value)
} /* attribute */ } /* attribute */
} /* general_diagnostics */ } /* general_diagnostics */
namespace software_diagnostics { namespace software_diagnostics {
namespace attribute { namespace attribute {
@@ -709,7 +707,7 @@ attribute_t *create_active_mode_threshold(cluster_t *cluster, uint16_t value)
attribute_t *create_registered_clients(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) attribute_t *create_registered_clients(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count)
{ {
return esp_matter::attribute::create(cluster, IcdManagement::Attributes::RegisteredClients::Id, return esp_matter::attribute::create(cluster, IcdManagement::Attributes::RegisteredClients::Id,
ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value,length, count)); ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_array(value, length, count));
} }
attribute_t *create_icd_counter(cluster_t *cluster, uint32_t value) attribute_t *create_icd_counter(cluster_t *cluster, uint32_t value)
@@ -1253,25 +1251,25 @@ namespace attribute {
attribute_t *create_phy_rate(cluster_t *cluster, nullable<uint8_t> value) attribute_t *create_phy_rate(cluster_t *cluster, nullable<uint8_t> value)
{ {
return esp_matter::attribute::create(cluster, EthernetNetworkDiagnostics::Attributes::PHYRate::Id, return esp_matter::attribute::create(cluster, EthernetNetworkDiagnostics::Attributes::PHYRate::Id,
ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value));
} }
attribute_t *create_full_duplex(cluster_t *cluster, nullable<bool> value) attribute_t *create_full_duplex(cluster_t *cluster, nullable<bool> value)
{ {
return esp_matter::attribute::create(cluster, EthernetNetworkDiagnostics::Attributes::FullDuplex::Id, return esp_matter::attribute::create(cluster, EthernetNetworkDiagnostics::Attributes::FullDuplex::Id,
ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_bool(value)); ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_bool(value));
} }
attribute_t *create_packet_rx_count(cluster_t *cluster, uint64_t value) attribute_t *create_packet_rx_count(cluster_t *cluster, uint64_t value)
{ {
return esp_matter::attribute::create(cluster, EthernetNetworkDiagnostics::Attributes::PacketRxCount::Id, return esp_matter::attribute::create(cluster, EthernetNetworkDiagnostics::Attributes::PacketRxCount::Id,
ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint64(value)); ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint64(value));
} }
attribute_t *create_packet_tx_count(cluster_t *cluster, uint64_t value) attribute_t *create_packet_tx_count(cluster_t *cluster, uint64_t value)
{ {
return esp_matter::attribute::create(cluster, EthernetNetworkDiagnostics::Attributes::PacketTxCount::Id, return esp_matter::attribute::create(cluster, EthernetNetworkDiagnostics::Attributes::PacketTxCount::Id,
ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint64(value)); ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint64(value));
} }
attribute_t *create_tx_err_count(cluster_t *cluster, uint64_t value) attribute_t *create_tx_err_count(cluster_t *cluster, uint64_t value)
@@ -1283,25 +1281,25 @@ attribute_t *create_tx_err_count(cluster_t *cluster, uint64_t value)
attribute_t *create_collision_count(cluster_t *cluster, uint64_t value) attribute_t *create_collision_count(cluster_t *cluster, uint64_t value)
{ {
return esp_matter::attribute::create(cluster, EthernetNetworkDiagnostics::Attributes::CollisionCount::Id, return esp_matter::attribute::create(cluster, EthernetNetworkDiagnostics::Attributes::CollisionCount::Id,
ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint64(value)); ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint64(value));
} }
attribute_t *create_overrun_count(cluster_t *cluster, uint64_t value) attribute_t *create_overrun_count(cluster_t *cluster, uint64_t value)
{ {
return esp_matter::attribute::create(cluster, EthernetNetworkDiagnostics::Attributes::OverrunCount::Id, return esp_matter::attribute::create(cluster, EthernetNetworkDiagnostics::Attributes::OverrunCount::Id,
ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint64(value)); ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint64(value));
} }
attribute_t *create_carrier_detect(cluster_t *cluster, nullable<bool> value) attribute_t *create_carrier_detect(cluster_t *cluster, nullable<bool> value)
{ {
return esp_matter::attribute::create(cluster, EthernetNetworkDiagnostics::Attributes::CarrierDetect::Id, return esp_matter::attribute::create(cluster, EthernetNetworkDiagnostics::Attributes::CarrierDetect::Id,
ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_bool(value)); ATTRIBUTE_FLAG_MANAGED_INTERNALLY | ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_bool(value));
} }
attribute_t *create_time_since_reset(cluster_t *cluster, uint64_t value) attribute_t *create_time_since_reset(cluster_t *cluster, uint64_t value)
{ {
return esp_matter::attribute::create(cluster, EthernetNetworkDiagnostics::Attributes::TimeSinceReset::Id, return esp_matter::attribute::create(cluster, EthernetNetworkDiagnostics::Attributes::TimeSinceReset::Id,
ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint64(value)); ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint64(value));
} }
} /* attribute */ } /* attribute */
@@ -1454,7 +1452,7 @@ namespace attribute {
attribute_t *create_identify_time(cluster_t *cluster, uint16_t value) attribute_t *create_identify_time(cluster_t *cluster, uint16_t value)
{ {
return esp_matter::attribute::create(cluster, Identify::Attributes::IdentifyTime::Id, return esp_matter::attribute::create(cluster, Identify::Attributes::IdentifyTime::Id,
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value)); ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint16(value));
} }
attribute_t *create_identify_type(cluster_t *cluster, uint8_t value) attribute_t *create_identify_type(cluster_t *cluster, uint8_t value)
@@ -1554,7 +1552,7 @@ attribute_t *create_on_level(cluster_t *cluster, nullable<uint8_t> value)
attribute_t *create_options(cluster_t *cluster, uint8_t value) attribute_t *create_options(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, LevelControl::Attributes::Options::Id, return esp_matter::attribute::create(cluster, LevelControl::Attributes::Options::Id,
ATTRIBUTE_FLAG_WRITABLE, esp_matter_bitmap8(value)); ATTRIBUTE_FLAG_WRITABLE, esp_matter_bitmap8(value));
} }
attribute_t *create_remaining_time(cluster_t *cluster, uint16_t value) attribute_t *create_remaining_time(cluster_t *cluster, uint16_t value)
@@ -1636,13 +1634,13 @@ namespace attribute {
attribute_t *create_current_hue(cluster_t *cluster, uint8_t value) attribute_t *create_current_hue(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, ColorControl::Attributes::CurrentHue::Id, return esp_matter::attribute::create(cluster, ColorControl::Attributes::CurrentHue::Id,
ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value));
} }
attribute_t *create_current_saturation(cluster_t *cluster, uint8_t value) attribute_t *create_current_saturation(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, ColorControl::Attributes::CurrentSaturation::Id, return esp_matter::attribute::create(cluster, ColorControl::Attributes::CurrentSaturation::Id,
ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value));
} }
attribute_t *create_remaining_time(cluster_t *cluster, uint16_t value) attribute_t *create_remaining_time(cluster_t *cluster, uint16_t value)
@@ -1678,32 +1676,32 @@ attribute_t *create_color_capabilities(cluster_t *cluster, uint16_t value)
attribute_t *create_color_temperature_mireds(cluster_t *cluster, uint16_t value) attribute_t *create_color_temperature_mireds(cluster_t *cluster, uint16_t value)
{ {
return esp_matter::attribute::create(cluster, ColorControl::Attributes::ColorTemperatureMireds::Id, return esp_matter::attribute::create(cluster, ColorControl::Attributes::ColorTemperatureMireds::Id,
ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value)); ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value));
} }
attribute_t *create_color_temp_physical_min_mireds(cluster_t *cluster, uint16_t value) attribute_t *create_color_temp_physical_min_mireds(cluster_t *cluster, uint16_t value)
{ {
return esp_matter::attribute::create(cluster, ColorControl::Attributes::ColorTempPhysicalMinMireds::Id, return esp_matter::attribute::create(cluster, ColorControl::Attributes::ColorTempPhysicalMinMireds::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value));
} }
attribute_t *create_color_temp_physical_max_mireds(cluster_t *cluster, uint16_t value) attribute_t *create_color_temp_physical_max_mireds(cluster_t *cluster, uint16_t value)
{ {
return esp_matter::attribute::create(cluster, ColorControl::Attributes::ColorTempPhysicalMaxMireds::Id, return esp_matter::attribute::create(cluster, ColorControl::Attributes::ColorTempPhysicalMaxMireds::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value));
} }
attribute_t *create_couple_color_temp_to_level_min_mireds(cluster_t *cluster, uint16_t value) attribute_t *create_couple_color_temp_to_level_min_mireds(cluster_t *cluster, uint16_t value)
{ {
return esp_matter::attribute::create(cluster, ColorControl::Attributes::CoupleColorTempToLevelMinMireds::Id, return esp_matter::attribute::create(cluster, ColorControl::Attributes::CoupleColorTempToLevelMinMireds::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value));
} }
attribute_t *create_start_up_color_temperature_mireds(cluster_t *cluster, nullable<uint16_t> value) attribute_t *create_start_up_color_temperature_mireds(cluster_t *cluster, nullable<uint16_t> value)
{ {
return esp_matter::attribute::create(cluster, ColorControl::Attributes::StartUpColorTemperatureMireds::Id, return esp_matter::attribute::create(cluster, ColorControl::Attributes::StartUpColorTemperatureMireds::Id,
ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE,
esp_matter_nullable_uint16(value)); esp_matter_nullable_uint16(value));
} }
attribute_t *create_current_x(cluster_t *cluster, uint16_t value) attribute_t *create_current_x(cluster_t *cluster, uint16_t value)
@@ -1720,8 +1718,8 @@ attribute_t *create_current_y(cluster_t *cluster, uint16_t value)
attribute_t *create_drift_compensation(cluster_t *cluster, uint8_t value) attribute_t *create_drift_compensation(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, ColorControl::Attributes::DriftCompensation::Id, return esp_matter::attribute::create(cluster, ColorControl::Attributes::DriftCompensation::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value));
} }
attribute_t *create_compensation_text(cluster_t *cluster, char *value, uint16_t length) attribute_t *create_compensation_text(cluster_t *cluster, char *value, uint16_t length)
@@ -1778,8 +1776,8 @@ attribute_t *create_primary_n_x(cluster_t *cluster, uint16_t value, uint8_t inde
switch (index) { switch (index) {
case 1: case 1:
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary1X::Id, ATTRIBUTE_FLAG_NONE, return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary1X::Id, ATTRIBUTE_FLAG_NONE,
esp_matter_uint16(value)); esp_matter_uint16(value));
break; break;
case 2: case 2:
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary2X::Id, ATTRIBUTE_FLAG_NONE, return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary2X::Id, ATTRIBUTE_FLAG_NONE,
esp_matter_uint16(value)); esp_matter_uint16(value));
@@ -1811,7 +1809,7 @@ attribute_t *create_primary_n_y(cluster_t *cluster, uint16_t value, uint8_t inde
{ {
switch (index) { switch (index) {
case 1: case 1:
return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary1Y::Id, ATTRIBUTE_FLAG_NONE, return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary1Y::Id, ATTRIBUTE_FLAG_NONE,
esp_matter_uint16(value)); esp_matter_uint16(value));
break; break;
case 2: case 2:
@@ -1882,7 +1880,7 @@ namespace attribute {
attribute_t *create_fan_mode(cluster_t *cluster, uint8_t value) attribute_t *create_fan_mode(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, FanControl::Attributes::FanMode::Id, return esp_matter::attribute::create(cluster, FanControl::Attributes::FanMode::Id,
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value)); ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
} }
attribute_t *create_fan_mode_sequence(cluster_t *cluster, const uint8_t value) attribute_t *create_fan_mode_sequence(cluster_t *cluster, const uint8_t value)
@@ -1912,7 +1910,7 @@ attribute_t *create_speed_max(cluster_t *cluster, uint8_t value)
attribute_t *create_speed_setting(cluster_t *cluster, nullable<uint8_t> value) attribute_t *create_speed_setting(cluster_t *cluster, nullable<uint8_t> value)
{ {
return esp_matter::attribute::create(cluster, FanControl::Attributes::SpeedSetting::Id, return esp_matter::attribute::create(cluster, FanControl::Attributes::SpeedSetting::Id,
ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_nullable_uint8(value)); ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_nullable_uint8(value));
} }
attribute_t *create_speed_current(cluster_t *cluster, uint8_t value) attribute_t *create_speed_current(cluster_t *cluster, uint8_t value)
@@ -2079,13 +2077,13 @@ attribute_t *create_remote_sensing(cluster_t *cluster, uint8_t value)
attribute_t *create_control_sequence_of_operation(cluster_t *cluster, uint8_t value) attribute_t *create_control_sequence_of_operation(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, Thermostat::Attributes::ControlSequenceOfOperation::Id, return esp_matter::attribute::create(cluster, Thermostat::Attributes::ControlSequenceOfOperation::Id,
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value)); ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
} }
attribute_t *create_system_mode(cluster_t *cluster, uint8_t value) attribute_t *create_system_mode(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, Thermostat::Attributes::SystemMode::Id, return esp_matter::attribute::create(cluster, Thermostat::Attributes::SystemMode::Id,
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value)); ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
} }
attribute_t *create_thermostat_running_mode(cluster_t *cluster, uint8_t value) attribute_t *create_thermostat_running_mode(cluster_t *cluster, uint8_t value)
@@ -2272,7 +2270,7 @@ attribute_t *create_active_preset_handle(cluster_t *cluster, uint8_t *value, uin
return NULL; return NULL;
} }
return esp_matter::attribute::create(cluster, Thermostat::Attributes::ActivePresetHandle::Id, ATTRIBUTE_FLAG_NULLABLE | return esp_matter::attribute::create(cluster, Thermostat::Attributes::ActivePresetHandle::Id, ATTRIBUTE_FLAG_NULLABLE |
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_octet_str(value, length), k_max_active_preset_handle); ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_octet_str(value, length), k_max_active_preset_handle);
} }
attribute_t *create_active_schedule_handle(cluster_t *cluster, uint8_t *value, uint16_t length) attribute_t *create_active_schedule_handle(cluster_t *cluster, uint8_t *value, uint16_t length)
@@ -2282,19 +2280,19 @@ attribute_t *create_active_schedule_handle(cluster_t *cluster, uint8_t *value, u
return NULL; return NULL;
} }
return esp_matter::attribute::create(cluster, Thermostat::Attributes::ActiveScheduleHandle::Id, ATTRIBUTE_FLAG_NULLABLE | return esp_matter::attribute::create(cluster, Thermostat::Attributes::ActiveScheduleHandle::Id, ATTRIBUTE_FLAG_NULLABLE |
ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_octet_str(value, length), k_max_active_schedule_handle); ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_octet_str(value, length), k_max_active_schedule_handle);
} }
attribute_t *create_presets(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count) attribute_t *create_presets(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count)
{ {
return esp_matter::attribute::create(cluster, Thermostat::Attributes::Presets::Id, ATTRIBUTE_FLAG_NONVOLATILE | return esp_matter::attribute::create(cluster, Thermostat::Attributes::Presets::Id, ATTRIBUTE_FLAG_NONVOLATILE |
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count));
} }
attribute_t *create_schedules(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count) attribute_t *create_schedules(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count)
{ {
return esp_matter::attribute::create(cluster, Thermostat::Attributes::Schedules::Id, ATTRIBUTE_FLAG_NONVOLATILE | return esp_matter::attribute::create(cluster, Thermostat::Attributes::Schedules::Id, ATTRIBUTE_FLAG_NONVOLATILE |
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count));
} }
attribute_t *create_setpoint_hold_expiry_timestamp(cluster_t *cluster, nullable<uint32_t> value) attribute_t *create_setpoint_hold_expiry_timestamp(cluster_t *cluster, nullable<uint32_t> value)
@@ -2312,19 +2310,19 @@ namespace attribute {
attribute_t *create_temperature_display_mode(cluster_t *cluster, uint8_t value) attribute_t *create_temperature_display_mode(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id, return esp_matter::attribute::create(cluster, ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id,
ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value)); ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
} }
attribute_t *create_keypad_lockout(cluster_t *cluster, uint8_t value) attribute_t *create_keypad_lockout(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id, return esp_matter::attribute::create(cluster, ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id,
ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value)); ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
} }
attribute_t *create_schedule_programming_visibility(cluster_t *cluster, uint8_t value) attribute_t *create_schedule_programming_visibility(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id, return esp_matter::attribute::create(cluster, ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id,
ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value)); ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
} }
} /* attribute */ } /* attribute */
@@ -2366,14 +2364,14 @@ attribute_t *create_change_indication(cluster_t *cluster, uint8_t value)
attribute_t *create_in_place_indicator(cluster_t *cluster, bool value) attribute_t *create_in_place_indicator(cluster_t *cluster, bool value)
{ {
return esp_matter::attribute::create(cluster, HepaFilterMonitoring::Attributes::InPlaceIndicator::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY, return esp_matter::attribute::create(cluster, HepaFilterMonitoring::Attributes::InPlaceIndicator::Id, ATTRIBUTE_FLAG_MANAGED_INTERNALLY,
esp_matter_bool(value)); esp_matter_bool(value));
} }
attribute_t *create_last_change_time(cluster_t *cluster, nullable<uint8_t> value) attribute_t *create_last_change_time(cluster_t *cluster, nullable<uint8_t> value)
{ {
return esp_matter::attribute::create(cluster, HepaFilterMonitoring::Attributes::LastChangedTime::Id, return esp_matter::attribute::create(cluster, HepaFilterMonitoring::Attributes::LastChangedTime::Id,
ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY,
esp_matter_nullable_uint8(value)); esp_matter_nullable_uint8(value));
} }
attribute_t *create_replacement_product_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) attribute_t *create_replacement_product_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count)
@@ -2390,67 +2388,67 @@ namespace attribute {
attribute_t *create_measured_value(cluster_t *cluster, nullable<float> value) attribute_t *create_measured_value(cluster_t *cluster, nullable<float> value)
{ {
return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::MeasuredValue::Id, return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::MeasuredValue::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value));
} }
attribute_t *create_min_measured_value(cluster_t *cluster, nullable<float> value) attribute_t *create_min_measured_value(cluster_t *cluster, nullable<float> value)
{ {
return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::MinMeasuredValue::Id, return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::MinMeasuredValue::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value));
} }
attribute_t *create_max_measured_value(cluster_t *cluster, nullable<float> value) attribute_t *create_max_measured_value(cluster_t *cluster, nullable<float> value)
{ {
return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::MaxMeasuredValue::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value));
} }
attribute_t *create_peak_measured_value(cluster_t *cluster, nullable<float> value) attribute_t *create_peak_measured_value(cluster_t *cluster, nullable<float> value)
{ {
return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::PeakMeasuredValue::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value));
} }
attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value) attribute_t *create_peak_measured_value_window(cluster_t *cluster, uint32_t value)
{ {
return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value));
} }
attribute_t *create_average_measured_value(cluster_t *cluster, nullable<float> value) attribute_t *create_average_measured_value(cluster_t *cluster, nullable<float> value)
{ {
return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::AverageMeasuredValue::Id,
ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value)); ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_float(value));
} }
attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value) attribute_t *create_average_measured_value_window(cluster_t *cluster, uint32_t value)
{ {
return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value));
} }
attribute_t *create_uncertainty(cluster_t *cluster, float value) attribute_t *create_uncertainty(cluster_t *cluster, float value)
{ {
return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::Uncertainty::Id, return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::Uncertainty::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_float(value)); ATTRIBUTE_FLAG_NONE, esp_matter_float(value));
} }
attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value) attribute_t *create_measurement_unit(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::MeasurementUnit::Id, return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::MeasurementUnit::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value));
} }
attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value) attribute_t *create_measurement_medium(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::MeasurementMedium::Id, return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::MeasurementMedium::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value));
} }
attribute_t *create_level_value(cluster_t *cluster, uint8_t value) attribute_t *create_level_value(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::LevelValue::Id, return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::LevelValue::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value));
} }
} /* attribute */ } /* attribute */
@@ -2467,7 +2465,7 @@ attribute_t *create_phase_list(cluster_t *cluster, uint8_t *value, uint16_t leng
attribute_t *create_current_phase(cluster_t *cluster, nullable<uint8_t> value) attribute_t *create_current_phase(cluster_t *cluster, nullable<uint8_t> value)
{ {
return esp_matter::attribute::create(cluster, OperationalState::Attributes::CurrentPhase::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, return esp_matter::attribute::create(cluster, OperationalState::Attributes::CurrentPhase::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY,
esp_matter_nullable_uint8(value)); esp_matter_nullable_uint8(value));
} }
attribute_t *create_countdown_time(cluster_t *cluster, nullable<uint32_t> value) attribute_t *create_countdown_time(cluster_t *cluster, nullable<uint32_t> value)
@@ -2509,7 +2507,7 @@ attribute_t *create_spin_speeds(cluster_t *cluster, uint8_t *value, uint16_t len
attribute_t *create_spin_speed_current(cluster_t *cluster, nullable<uint8_t> value) attribute_t *create_spin_speed_current(cluster_t *cluster, nullable<uint8_t> value)
{ {
return esp_matter::attribute::create(cluster, LaundryWasherControls::Attributes::SpinSpeedCurrent::Id, return esp_matter::attribute::create(cluster, LaundryWasherControls::Attributes::SpinSpeedCurrent::Id,
ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_WRITABLE, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_WRITABLE,
esp_matter_nullable_uint8(value)); esp_matter_nullable_uint8(value));
} }
@@ -2533,13 +2531,13 @@ namespace attribute {
attribute_t *create_supported_dryness_levels(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) attribute_t *create_supported_dryness_levels(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count)
{ {
return esp_matter::attribute::create(cluster, LaundryDryerControls::Attributes::SupportedDrynessLevels::Id, return esp_matter::attribute::create(cluster, LaundryDryerControls::Attributes::SupportedDrynessLevels::Id,
ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count)); ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array(value, length, count));
} }
attribute_t *create_selected_dryness_level(cluster_t *cluster, nullable<uint8_t> value) attribute_t *create_selected_dryness_level(cluster_t *cluster, nullable<uint8_t> value)
{ {
return esp_matter::attribute::create(cluster, LaundryDryerControls::Attributes::SelectedDrynessLevel::Id, return esp_matter::attribute::create(cluster, LaundryDryerControls::Attributes::SelectedDrynessLevel::Id,
ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_nullable_enum8(value)); ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_nullable_enum8(value));
} }
@@ -2551,79 +2549,79 @@ namespace attribute {
attribute_t *create_expressed_state(cluster_t *cluster, uint8_t value) attribute_t *create_expressed_state(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::ExpressedState::Id, ATTRIBUTE_FLAG_NONVOLATILE, return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::ExpressedState::Id, ATTRIBUTE_FLAG_NONVOLATILE,
esp_matter_enum8(value)); esp_matter_enum8(value));
} }
attribute_t *create_smoke_state(cluster_t *cluster, uint8_t value) attribute_t *create_smoke_state(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::SmokeState::Id, ATTRIBUTE_FLAG_NONVOLATILE, return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::SmokeState::Id, ATTRIBUTE_FLAG_NONVOLATILE,
esp_matter_enum8(value)); esp_matter_enum8(value));
} }
attribute_t *create_co_state(cluster_t *cluster, uint8_t value) attribute_t *create_co_state(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::COState::Id, ATTRIBUTE_FLAG_NONVOLATILE, return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::COState::Id, ATTRIBUTE_FLAG_NONVOLATILE,
esp_matter_enum8(value)); esp_matter_enum8(value));
} }
attribute_t *create_battery_alert(cluster_t *cluster, uint8_t value) attribute_t *create_battery_alert(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::BatteryAlert::Id, ATTRIBUTE_FLAG_NONVOLATILE, return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::BatteryAlert::Id, ATTRIBUTE_FLAG_NONVOLATILE,
esp_matter_enum8(value)); esp_matter_enum8(value));
} }
attribute_t *create_device_muted(cluster_t *cluster, uint8_t value) attribute_t *create_device_muted(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::DeviceMuted::Id, ATTRIBUTE_FLAG_NONVOLATILE, return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::DeviceMuted::Id, ATTRIBUTE_FLAG_NONVOLATILE,
esp_matter_enum8(value)); esp_matter_enum8(value));
} }
attribute_t *create_test_in_progress(cluster_t *cluster, bool value) attribute_t *create_test_in_progress(cluster_t *cluster, bool value)
{ {
return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::TestInProgress::Id, ATTRIBUTE_FLAG_NONE, return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::TestInProgress::Id, ATTRIBUTE_FLAG_NONE,
esp_matter_bool(value)); esp_matter_bool(value));
} }
attribute_t *create_hardware_fault_alert(cluster_t *cluster, bool value) attribute_t *create_hardware_fault_alert(cluster_t *cluster, bool value)
{ {
return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::HardwareFaultAlert::Id, ATTRIBUTE_FLAG_NONVOLATILE, return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::HardwareFaultAlert::Id, ATTRIBUTE_FLAG_NONVOLATILE,
esp_matter_bool(value)); esp_matter_bool(value));
} }
attribute_t *create_end_of_service_alert(cluster_t *cluster, uint8_t value) attribute_t *create_end_of_service_alert(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::EndOfServiceAlert::Id, ATTRIBUTE_FLAG_NONVOLATILE, return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::EndOfServiceAlert::Id, ATTRIBUTE_FLAG_NONVOLATILE,
esp_matter_enum8(value)); esp_matter_enum8(value));
} }
attribute_t *create_interconnect_smoke_alarm(cluster_t *cluster, uint8_t value) attribute_t *create_interconnect_smoke_alarm(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::InterconnectSmokeAlarm::Id, ATTRIBUTE_FLAG_NONE, return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::InterconnectSmokeAlarm::Id, ATTRIBUTE_FLAG_NONE,
esp_matter_enum8(value)); esp_matter_enum8(value));
} }
attribute_t *create_interconnect_co_alarm(cluster_t *cluster, uint8_t value) attribute_t *create_interconnect_co_alarm(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::InterconnectCOAlarm::Id, ATTRIBUTE_FLAG_NONE, return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::InterconnectCOAlarm::Id, ATTRIBUTE_FLAG_NONE,
esp_matter_enum8(value)); esp_matter_enum8(value));
} }
attribute_t *create_contamination_state(cluster_t *cluster, uint8_t value) attribute_t *create_contamination_state(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::ContaminationState::Id, ATTRIBUTE_FLAG_NONE, return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::ContaminationState::Id, ATTRIBUTE_FLAG_NONE,
esp_matter_enum8(value)); esp_matter_enum8(value));
} }
attribute_t *create_smoke_sensitivity_level(cluster_t *cluster, uint8_t value) attribute_t *create_smoke_sensitivity_level(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::SmokeSensitivityLevel::Id, ATTRIBUTE_FLAG_WRITABLE, return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::SmokeSensitivityLevel::Id, ATTRIBUTE_FLAG_WRITABLE,
esp_matter_enum8(value)); esp_matter_enum8(value));
} }
attribute_t *create_expiry_date(cluster_t *cluster, uint32_t value) attribute_t *create_expiry_date(cluster_t *cluster, uint32_t value)
{ {
return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::ContaminationState::Id, ATTRIBUTE_FLAG_NONE, return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::ContaminationState::Id, ATTRIBUTE_FLAG_NONE,
esp_matter_uint32(value)); esp_matter_uint32(value));
} }
} /* attribute */ } /* attribute */
@@ -2776,7 +2774,7 @@ attribute_t *create_operating_mode(cluster_t *cluster, uint8_t value, uint8_t mi
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, DoorLock::Attributes::OperatingMode::Id, attribute_t *attribute = esp_matter::attribute::create(cluster, DoorLock::Attributes::OperatingMode::Id,
ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value)); ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), DoorLock::Attributes::OperatingMode::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), DoorLock::Attributes::OperatingMode::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(min), esp_matter_enum8(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(min), esp_matter_enum8(max));
return attribute; return attribute;
} }
@@ -2827,7 +2825,7 @@ attribute_t *create_wrong_code_entry_limit(cluster_t *cluster, uint8_t value)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, DoorLock::Attributes::WrongCodeEntryLimit::Id, attribute_t *attribute = esp_matter::attribute::create(cluster, DoorLock::Attributes::WrongCodeEntryLimit::Id,
ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value)); ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), DoorLock::Attributes::WrongCodeEntryLimit::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), DoorLock::Attributes::WrongCodeEntryLimit::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(1), esp_matter_uint8(255)); esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(1), esp_matter_uint8(255));
return attribute; return attribute;
} }
@@ -2836,7 +2834,7 @@ attribute_t *create_user_code_temporary_disable_time(cluster_t *cluster, uint8_t
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, DoorLock::Attributes::UserCodeTemporaryDisableTime::Id, attribute_t *attribute = esp_matter::attribute::create(cluster, DoorLock::Attributes::UserCodeTemporaryDisableTime::Id,
ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value)); ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), DoorLock::Attributes::UserCodeTemporaryDisableTime::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), DoorLock::Attributes::UserCodeTemporaryDisableTime::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(1), esp_matter_uint8(255)); esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(1), esp_matter_uint8(255));
return attribute; return attribute;
} }
@@ -2857,7 +2855,7 @@ attribute_t *create_expiring_user_timeout(cluster_t *cluster, uint16_t value)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, DoorLock::Attributes::ExpiringUserTimeout::Id, attribute_t *attribute = esp_matter::attribute::create(cluster, DoorLock::Attributes::ExpiringUserTimeout::Id,
ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(value)); ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), DoorLock::Attributes::ExpiringUserTimeout::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), DoorLock::Attributes::ExpiringUserTimeout::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(1), esp_matter_uint16(2880)); esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(1), esp_matter_uint16(2880));
return attribute; return attribute;
} }
@@ -3156,13 +3154,13 @@ attribute_t *create_pir_occupied_to_unoccupied_delay(cluster_t *cluster, uint16_
attribute_t *create_pir_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value) attribute_t *create_pir_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value)
{ {
return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::PIRUnoccupiedToOccupiedDelay::Id, return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::PIRUnoccupiedToOccupiedDelay::Id,
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE , esp_matter_uint16(value)); ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(value));
} }
attribute_t *create_pir_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value) attribute_t *create_pir_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::PIRUnoccupiedToOccupiedThreshold::Id, return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::PIRUnoccupiedToOccupiedThreshold::Id,
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE , esp_matter_uint8(value)); ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value));
} }
attribute_t *create_ultrasonic_occupied_to_unoccupied_delay(cluster_t *cluster, uint16_t value) attribute_t *create_ultrasonic_occupied_to_unoccupied_delay(cluster_t *cluster, uint16_t value)
@@ -3174,13 +3172,13 @@ attribute_t *create_ultrasonic_occupied_to_unoccupied_delay(cluster_t *cluster,
attribute_t *create_ultrasonic_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value) attribute_t *create_ultrasonic_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value)
{ {
return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::UltrasonicUnoccupiedToOccupiedDelay::Id, return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::UltrasonicUnoccupiedToOccupiedDelay::Id,
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE , esp_matter_uint16(value)); ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(value));
} }
attribute_t *create_ultrasonic_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value) attribute_t *create_ultrasonic_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::UltrasonicUnoccupiedToOccupiedThreshold::Id, return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::UltrasonicUnoccupiedToOccupiedThreshold::Id,
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE , esp_matter_uint8(value)); ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value));
} }
attribute_t *create_physical_contact_occupied_to_unoccupied_delay(cluster_t *cluster, uint16_t value) attribute_t *create_physical_contact_occupied_to_unoccupied_delay(cluster_t *cluster, uint16_t value)
@@ -3192,13 +3190,13 @@ attribute_t *create_physical_contact_occupied_to_unoccupied_delay(cluster_t *clu
attribute_t *create_physical_contact_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value) attribute_t *create_physical_contact_unoccupied_to_occupied_delay(cluster_t *cluster, uint16_t value)
{ {
return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::PhysicalContactUnoccupiedToOccupiedDelay::Id, return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::PhysicalContactUnoccupiedToOccupiedDelay::Id,
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE , esp_matter_uint16(value)); ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(value));
} }
attribute_t *create_physical_contact_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value) attribute_t *create_physical_contact_unoccupied_to_occupied_threshold(cluster_t *cluster, uint8_t value)
{ {
return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::PhysicalContactUnoccupiedToOccupiedThreshold::Id, return esp_matter::attribute::create(cluster, OccupancySensing::Attributes::PhysicalContactUnoccupiedToOccupiedThreshold::Id,
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE , esp_matter_uint8(value)); ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint8(value));
} }
} /* attribute */ } /* attribute */
@@ -3340,7 +3338,7 @@ namespace attribute {
attribute_t *create_measured_value(cluster_t *cluster, nullable<uint16_t> value, nullable<uint16_t> min, nullable<uint16_t> max) attribute_t *create_measured_value(cluster_t *cluster, nullable<uint16_t> value, nullable<uint16_t> min, nullable<uint16_t> max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, IlluminanceMeasurement::Attributes::MeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, IlluminanceMeasurement::Attributes::MeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), IlluminanceMeasurement::Attributes::MeasuredValue::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), IlluminanceMeasurement::Attributes::MeasuredValue::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(min), esp_matter_nullable_uint16(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(min), esp_matter_nullable_uint16(max));
return attribute; return attribute;
} }
@@ -3348,7 +3346,7 @@ attribute_t *create_measured_value(cluster_t *cluster, nullable<uint16_t> value,
attribute_t *create_min_measured_value(cluster_t *cluster, nullable<uint16_t> value, nullable<uint16_t> min, nullable<uint16_t> max) attribute_t *create_min_measured_value(cluster_t *cluster, nullable<uint16_t> value, nullable<uint16_t> min, nullable<uint16_t> max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, IlluminanceMeasurement::Attributes::MinMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, IlluminanceMeasurement::Attributes::MinMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), IlluminanceMeasurement::Attributes::MinMeasuredValue::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), IlluminanceMeasurement::Attributes::MinMeasuredValue::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(min), esp_matter_nullable_uint16(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(min), esp_matter_nullable_uint16(max));
return attribute; return attribute;
} }
@@ -3356,7 +3354,7 @@ attribute_t *create_min_measured_value(cluster_t *cluster, nullable<uint16_t> va
attribute_t *create_max_measured_value(cluster_t *cluster, nullable<uint16_t> value, nullable<uint16_t> min, nullable<uint16_t> max) attribute_t *create_max_measured_value(cluster_t *cluster, nullable<uint16_t> value, nullable<uint16_t> min, nullable<uint16_t> max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, IlluminanceMeasurement::Attributes::MaxMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, IlluminanceMeasurement::Attributes::MaxMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), IlluminanceMeasurement::Attributes::MaxMeasuredValue::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), IlluminanceMeasurement::Attributes::MaxMeasuredValue::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(min), esp_matter_nullable_uint16(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(min), esp_matter_nullable_uint16(max));
return attribute; return attribute;
} }
@@ -3364,15 +3362,15 @@ attribute_t *create_max_measured_value(cluster_t *cluster, nullable<uint16_t> va
attribute_t *create_tolerance(cluster_t *cluster, uint16_t value, uint16_t min, uint16_t max) attribute_t *create_tolerance(cluster_t *cluster, uint16_t value, uint16_t min, uint16_t max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, IlluminanceMeasurement::Attributes::Tolerance::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, IlluminanceMeasurement::Attributes::Tolerance::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), IlluminanceMeasurement::Attributes::Tolerance::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), IlluminanceMeasurement::Attributes::Tolerance::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(min), esp_matter_uint16(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(min), esp_matter_uint16(max));
return attribute; return attribute;
} }
attribute_t *create_light_sensor_type(cluster_t *cluster, nullable<uint8_t> value, nullable<uint8_t> min, nullable<uint8_t> max) attribute_t *create_light_sensor_type(cluster_t *cluster, nullable<uint8_t> value, nullable<uint8_t> min, nullable<uint8_t> max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, IlluminanceMeasurement::Attributes::LightSensorType::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, IlluminanceMeasurement::Attributes::LightSensorType::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_enum8(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), IlluminanceMeasurement::Attributes::LightSensorType::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), IlluminanceMeasurement::Attributes::LightSensorType::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_enum8(min), esp_matter_nullable_enum8(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_enum8(min), esp_matter_nullable_enum8(max));
return attribute; return attribute;
} }
@@ -3385,12 +3383,12 @@ namespace attribute {
attribute_t *create_measured_value(cluster_t *cluster, nullable<int16_t> value) attribute_t *create_measured_value(cluster_t *cluster, nullable<int16_t> value)
{ {
return esp_matter::attribute::create(cluster, PressureMeasurement::Attributes::MeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); return esp_matter::attribute::create(cluster, PressureMeasurement::Attributes::MeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value));
} }
attribute_t *create_min_measured_value(cluster_t *cluster, nullable<int16_t> value) attribute_t *create_min_measured_value(cluster_t *cluster, nullable<int16_t> value)
{ {
return esp_matter::attribute::create(cluster, PressureMeasurement::Attributes::MinMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value)); return esp_matter::attribute::create(cluster, PressureMeasurement::Attributes::MinMeasuredValue::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value));
} }
attribute_t *create_max_measured_value(cluster_t *cluster, nullable<int16_t> value) attribute_t *create_max_measured_value(cluster_t *cluster, nullable<int16_t> value)
@@ -3401,7 +3399,7 @@ attribute_t *create_max_measured_value(cluster_t *cluster, nullable<int16_t> val
attribute_t *create_tolerance(cluster_t *cluster, uint16_t value, uint16_t min, uint16_t max) attribute_t *create_tolerance(cluster_t *cluster, uint16_t value, uint16_t min, uint16_t max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, PressureMeasurement::Attributes::Tolerance::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, PressureMeasurement::Attributes::Tolerance::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), PressureMeasurement::Attributes::Tolerance::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), PressureMeasurement::Attributes::Tolerance::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(min), esp_matter_uint16(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(min), esp_matter_uint16(max));
return attribute; return attribute;
} }
@@ -3424,7 +3422,7 @@ attribute_t *create_max_scaled_value(cluster_t *cluster, nullable<int16_t> value
attribute_t *create_scaled_tolerance(cluster_t *cluster, uint16_t value, uint16_t min, uint16_t max) attribute_t *create_scaled_tolerance(cluster_t *cluster, uint16_t value, uint16_t min, uint16_t max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, PressureMeasurement::Attributes::ScaledTolerance::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, PressureMeasurement::Attributes::ScaledTolerance::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), PressureMeasurement::Attributes::ScaledTolerance::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), PressureMeasurement::Attributes::ScaledTolerance::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(min), esp_matter_uint16(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(min), esp_matter_uint16(max));
return attribute; return attribute;
} }
@@ -3458,7 +3456,7 @@ attribute_t *create_max_measured_value(cluster_t *cluster, nullable<uint16_t> va
attribute_t *create_tolerance(cluster_t *cluster, uint16_t value, uint16_t min, uint16_t max) attribute_t *create_tolerance(cluster_t *cluster, uint16_t value, uint16_t min, uint16_t max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, FlowMeasurement::Attributes::Tolerance::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, FlowMeasurement::Attributes::Tolerance::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), FlowMeasurement::Attributes::Tolerance::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), FlowMeasurement::Attributes::Tolerance::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(min), esp_matter_uint16(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_uint16(min), esp_matter_uint16(max));
return attribute; return attribute;
} }
@@ -3635,7 +3633,7 @@ attribute_t *create_status(cluster_t *cluster, uint8_t value)
attribute_t *create_order(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max) attribute_t *create_order(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::Order::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::Order::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint8(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), PowerSource::Attributes::Order::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), PowerSource::Attributes::Order::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(min), esp_matter_uint8(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(min), esp_matter_uint8(max));
return attribute; return attribute;
} }
@@ -3650,7 +3648,7 @@ attribute_t *create_description(cluster_t *cluster, const char * value, uint16_t
attribute_t *create_wired_assessed_input_voltage(cluster_t *cluster, nullable<uint32_t> value, nullable<uint32_t> min, nullable<uint32_t> max) attribute_t *create_wired_assessed_input_voltage(cluster_t *cluster, nullable<uint32_t> value, nullable<uint32_t> min, nullable<uint32_t> max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::WiredAssessedInputVoltage::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::WiredAssessedInputVoltage::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), PowerSource::Attributes::WiredAssessedInputVoltage::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), PowerSource::Attributes::WiredAssessedInputVoltage::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(min), esp_matter_nullable_uint32(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(min), esp_matter_nullable_uint32(max));
return attribute; return attribute;
} }
@@ -3658,7 +3656,7 @@ attribute_t *create_wired_assessed_input_voltage(cluster_t *cluster, nullable<ui
attribute_t *create_wired_assessed_input_frequency(cluster_t *cluster, nullable<uint16_t> value, nullable<uint16_t> min, nullable<uint16_t> max) attribute_t *create_wired_assessed_input_frequency(cluster_t *cluster, nullable<uint16_t> value, nullable<uint16_t> min, nullable<uint16_t> max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::WiredAssessedInputFrequency::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::WiredAssessedInputFrequency::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), PowerSource::Attributes::WiredAssessedInputFrequency::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), PowerSource::Attributes::WiredAssessedInputFrequency::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(min), esp_matter_nullable_uint16(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint16(min), esp_matter_nullable_uint16(max));
return attribute; return attribute;
} }
@@ -3671,7 +3669,7 @@ attribute_t *create_wired_current_type(cluster_t *cluster, const uint8_t value)
attribute_t *create_wired_assessed_current(cluster_t *cluster, nullable<uint32_t> value, nullable<uint32_t> min, nullable<uint32_t> max) attribute_t *create_wired_assessed_current(cluster_t *cluster, nullable<uint32_t> value, nullable<uint32_t> min, nullable<uint32_t> max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::WiredAssessedCurrent::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::WiredAssessedCurrent::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), PowerSource::Attributes::WiredAssessedCurrent::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), PowerSource::Attributes::WiredAssessedCurrent::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(min), esp_matter_nullable_uint32(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(min), esp_matter_nullable_uint32(max));
return attribute; return attribute;
} }
@@ -3679,7 +3677,7 @@ attribute_t *create_wired_assessed_current(cluster_t *cluster, nullable<uint32_t
attribute_t *create_wired_nominal_voltage(cluster_t *cluster, const uint32_t value, uint32_t min, uint32_t max) attribute_t *create_wired_nominal_voltage(cluster_t *cluster, const uint32_t value, uint32_t min, uint32_t max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::WiredNominalVoltage::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::WiredNominalVoltage::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), PowerSource::Attributes::WiredNominalVoltage::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), PowerSource::Attributes::WiredNominalVoltage::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(min), esp_matter_uint32(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(min), esp_matter_uint32(max));
return attribute; return attribute;
} }
@@ -3687,7 +3685,7 @@ attribute_t *create_wired_nominal_voltage(cluster_t *cluster, const uint32_t val
attribute_t *create_wired_maximum_current(cluster_t *cluster, const uint32_t value, uint32_t min, uint32_t max) attribute_t *create_wired_maximum_current(cluster_t *cluster, const uint32_t value, uint32_t min, uint32_t max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::WiredMaximumCurrent::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::WiredMaximumCurrent::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), PowerSource::Attributes::WiredMaximumCurrent::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), PowerSource::Attributes::WiredMaximumCurrent::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(min), esp_matter_uint32(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(min), esp_matter_uint32(max));
return attribute; return attribute;
} }
@@ -3706,7 +3704,7 @@ attribute_t *create_active_wired_faults(cluster_t *cluster, uint8_t * value, uin
attribute_t *create_bat_voltage(cluster_t *cluster, nullable<uint32_t> value, nullable<uint32_t> min, nullable<uint32_t> max) attribute_t *create_bat_voltage(cluster_t *cluster, nullable<uint32_t> value, nullable<uint32_t> min, nullable<uint32_t> max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::BatVoltage::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::BatVoltage::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), PowerSource::Attributes::BatVoltage::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), PowerSource::Attributes::BatVoltage::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(min), esp_matter_nullable_uint32(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(min), esp_matter_nullable_uint32(max));
return attribute; return attribute;
} }
@@ -3714,7 +3712,7 @@ attribute_t *create_bat_voltage(cluster_t *cluster, nullable<uint32_t> value, nu
attribute_t *create_bat_percent_remaining(cluster_t *cluster, nullable<uint8_t> value, nullable<uint8_t> min, nullable<uint8_t> max) attribute_t *create_bat_percent_remaining(cluster_t *cluster, nullable<uint8_t> value, nullable<uint8_t> min, nullable<uint8_t> max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::BatPercentRemaining::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::BatPercentRemaining::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint8(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), PowerSource::Attributes::BatPercentRemaining::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), PowerSource::Attributes::BatPercentRemaining::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max));
return attribute; return attribute;
} }
@@ -3722,7 +3720,7 @@ attribute_t *create_bat_percent_remaining(cluster_t *cluster, nullable<uint8_t>
attribute_t *create_bat_time_remaining(cluster_t *cluster, nullable< uint32_t> value, nullable<uint32_t> min, nullable<uint32_t> max) attribute_t *create_bat_time_remaining(cluster_t *cluster, nullable< uint32_t> value, nullable<uint32_t> min, nullable<uint32_t> max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::BatTimeRemaining::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::BatTimeRemaining::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), PowerSource::Attributes::BatTimeRemaining::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), PowerSource::Attributes::BatTimeRemaining::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(min), esp_matter_nullable_uint32(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(min), esp_matter_nullable_uint32(max));
return attribute; return attribute;
} }
@@ -3764,7 +3762,7 @@ attribute_t *create_bat_replacement_description(cluster_t *cluster, const char *
attribute_t *create_bat_common_designation(cluster_t *cluster, const uint8_t value, uint8_t min, uint8_t max) attribute_t *create_bat_common_designation(cluster_t *cluster, const uint8_t value, uint8_t min, uint8_t max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::BatCommonDesignation::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::BatCommonDesignation::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), PowerSource::Attributes::BatCommonDesignation::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), PowerSource::Attributes::BatCommonDesignation::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(min), esp_matter_enum8(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(min), esp_matter_enum8(max));
return attribute; return attribute;
} }
@@ -3784,7 +3782,7 @@ attribute_t *create_bat_iec_designation(cluster_t *cluster, const char * value,
attribute_t *create_bat_approved_chemistry(cluster_t *cluster, const uint8_t value, uint8_t min, uint8_t max) attribute_t *create_bat_approved_chemistry(cluster_t *cluster, const uint8_t value, uint8_t min, uint8_t max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::BatApprovedChemistry::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::BatApprovedChemistry::Id, ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), PowerSource::Attributes::BatApprovedChemistry::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), PowerSource::Attributes::BatApprovedChemistry::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(min), esp_matter_enum8(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_enum8(min), esp_matter_enum8(max));
return attribute; return attribute;
} }
@@ -3792,7 +3790,7 @@ attribute_t *create_bat_approved_chemistry(cluster_t *cluster, const uint8_t val
attribute_t *create_bat_capacity(cluster_t *cluster, const uint32_t value, uint32_t min, uint32_t max) attribute_t *create_bat_capacity(cluster_t *cluster, const uint32_t value, uint32_t min, uint32_t max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::BatCapacity::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::BatCapacity::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint32(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), PowerSource::Attributes::BatCapacity::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), PowerSource::Attributes::BatCapacity::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(min), esp_matter_uint32(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_uint32(min), esp_matter_uint32(max));
return attribute; return attribute;
} }
@@ -3800,7 +3798,7 @@ attribute_t *create_bat_capacity(cluster_t *cluster, const uint32_t value, uint3
attribute_t *create_bat_quantity(cluster_t *cluster, const uint8_t value, uint8_t min, uint8_t max) attribute_t *create_bat_quantity(cluster_t *cluster, const uint8_t value, uint8_t min, uint8_t max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::BatQuantity::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::BatQuantity::Id, ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), PowerSource::Attributes::BatQuantity::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), PowerSource::Attributes::BatQuantity::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(min), esp_matter_uint8(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(min), esp_matter_uint8(max));
return attribute; return attribute;
} }
@@ -3813,7 +3811,7 @@ attribute_t *create_bat_charge_state(cluster_t *cluster, uint8_t value)
attribute_t *create_bat_time_to_full_charge(cluster_t *cluster, nullable<uint32_t> value, nullable<uint32_t> min, nullable<uint32_t> max) attribute_t *create_bat_time_to_full_charge(cluster_t *cluster, nullable<uint32_t> value, nullable<uint32_t> min, nullable<uint32_t> max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::BatTimeToFullCharge::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::BatTimeToFullCharge::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), PowerSource::Attributes::BatTimeToFullCharge::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), PowerSource::Attributes::BatTimeToFullCharge::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(min), esp_matter_nullable_uint32(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(min), esp_matter_nullable_uint32(max));
return attribute; return attribute;
} }
@@ -3826,7 +3824,7 @@ attribute_t *create_bat_functional_while_charging(cluster_t *cluster, bool value
attribute_t *create_bat_charging_current(cluster_t *cluster, nullable<uint32_t> value, nullable<uint32_t> min, nullable<uint32_t> max) attribute_t *create_bat_charging_current(cluster_t *cluster, nullable<uint32_t> value, nullable<uint32_t> min, nullable<uint32_t> max)
{ {
attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::BatChargingCurrent::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value)); attribute_t *attribute = esp_matter::attribute::create(cluster, PowerSource::Attributes::BatChargingCurrent::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value));
VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32 , cluster::get_id(cluster), PowerSource::Attributes::BatChargingCurrent::Id)); VerifyOrReturnValue(attribute, NULL, ESP_LOGE(TAG, "Could not create attribute. cluster_id: 0x%08" PRIX32 "'s attribute_id: 0x%08" PRIX32, cluster::get_id(cluster), PowerSource::Attributes::BatChargingCurrent::Id));
esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(min), esp_matter_nullable_uint32(max)); esp_matter::attribute::add_bounds(attribute, esp_matter_nullable_uint32(min), esp_matter_nullable_uint32(max));
return attribute; return attribute;
} }
@@ -4048,37 +4046,37 @@ namespace attribute {
attribute_t *create_accuracy(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count) attribute_t *create_accuracy(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count)
{ {
return esp_matter::attribute::create(cluster, ElectricalEnergyMeasurement::Attributes::Accuracy::Id, return esp_matter::attribute::create(cluster, ElectricalEnergyMeasurement::Attributes::Accuracy::Id,
ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array((uint8_t*)value, length, count)); ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array((uint8_t*)value, length, count));
} }
attribute_t *create_cumulative_energy_imported(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count) attribute_t *create_cumulative_energy_imported(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count)
{ {
return esp_matter::attribute::create(cluster, ElectricalEnergyMeasurement::Attributes:: return esp_matter::attribute::create(cluster, ElectricalEnergyMeasurement::Attributes::
CumulativeEnergyImported::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array((uint8_t*)value, length, count)); CumulativeEnergyImported::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array((uint8_t*)value, length, count));
} }
attribute_t *create_cumulative_energy_exported(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count) attribute_t *create_cumulative_energy_exported(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count)
{ {
return esp_matter::attribute::create(cluster, ElectricalEnergyMeasurement::Attributes:: return esp_matter::attribute::create(cluster, ElectricalEnergyMeasurement::Attributes::
CumulativeEnergyExported::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array((uint8_t*)value, length, count)); CumulativeEnergyExported::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array((uint8_t*)value, length, count));
} }
attribute_t *create_periodic_energy_imported(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count) attribute_t *create_periodic_energy_imported(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count)
{ {
return esp_matter::attribute::create(cluster, ElectricalEnergyMeasurement::Attributes:: return esp_matter::attribute::create(cluster, ElectricalEnergyMeasurement::Attributes::
PeriodicEnergyImported::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array((uint8_t*)value, length, count)); PeriodicEnergyImported::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array((uint8_t*)value, length, count));
} }
attribute_t *create_periodic_energy_exported(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count) attribute_t *create_periodic_energy_exported(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count)
{ {
return esp_matter::attribute::create(cluster, ElectricalEnergyMeasurement::Attributes:: return esp_matter::attribute::create(cluster, ElectricalEnergyMeasurement::Attributes::
PeriodicEnergyExported::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array((uint8_t*)value, length, count)); PeriodicEnergyExported::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array((uint8_t*)value, length, count));
} }
attribute_t *create_cumulative_energy_reset(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count) attribute_t *create_cumulative_energy_reset(cluster_t *cluster, const uint8_t* value, uint16_t length, uint16_t count)
{ {
return esp_matter::attribute::create(cluster, ElectricalEnergyMeasurement::Attributes:: return esp_matter::attribute::create(cluster, ElectricalEnergyMeasurement::Attributes::
CumulativeEnergyReset::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array((uint8_t*)value, length, count)); CumulativeEnergyReset::Id, ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_array((uint8_t*)value, length, count));
} }
} /* attribute */ } /* attribute */
@@ -4404,8 +4402,8 @@ attribute_t *create_application_version(cluster_t *cluster, char *value, uint16_
{ {
VerifyOrReturnValue(length <= k_max_application_version_length, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound")); VerifyOrReturnValue(length <= k_max_application_version_length, NULL, ESP_LOGE(TAG, "Could not create attribute, string length out of bound"));
return esp_matter::attribute::create(cluster, ApplicationBasic::Attributes::ApplicationVersion::Id, return esp_matter::attribute::create(cluster, ApplicationBasic::Attributes::ApplicationVersion::Id,
ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_char_str(value, length), ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_char_str(value, length),
k_max_application_version_length); k_max_application_version_length);
} }
attribute_t *create_allowed_vendor_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) attribute_t *create_allowed_vendor_list(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count)
@@ -4920,7 +4918,6 @@ attribute_t *create_current_sessions(cluster_t *cluster, uint8_t *value, uint16_
} /* attribute */ } /* attribute */
}/*webrtc transport requestor*/ }/*webrtc transport requestor*/
namespace chime { namespace chime {
namespace attribute { namespace attribute {
attribute_t *create_installed_chime_sounds(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) attribute_t *create_installed_chime_sounds(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count)
@@ -570,7 +570,6 @@ namespace activated_carbon_filter_monitoring {
namespace attribute = resource_monitoring::attribute; namespace attribute = resource_monitoring::attribute;
} /* activated_carbon_filter_monitoring */ } /* activated_carbon_filter_monitoring */
namespace concentration_measurement { namespace concentration_measurement {
namespace attribute { namespace attribute {
attribute_t *create_measured_value(cluster_t *cluster, nullable<float> value); attribute_t *create_measured_value(cluster_t *cluster, nullable<float> value);
@@ -1257,14 +1256,14 @@ attribute_t *create_status_light_brightness(cluster_t *cluster, uint8_t value);
} /*camera av stream management*/ } /*camera av stream management*/
namespace webrtc_transport_provider { namespace webrtc_transport_provider {
namespace attribute { namespace attribute {
attribute_t *create_current_sessions(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); attribute_t *create_current_sessions(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count);
} /* attribute */ } /* attribute */
}/*webrtc transport provider*/ }/*webrtc transport provider*/
namespace webrtc_transport_requestor { namespace webrtc_transport_requestor {
namespace attribute { namespace attribute {
attribute_t *create_current_sessions(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count); attribute_t *create_current_sessions(cluster_t *cluster, uint8_t * value, uint16_t length, uint16_t count);
} /* attribute */ } /* attribute */
File diff suppressed because it is too large Load Diff
@@ -78,13 +78,12 @@ esp_matter_attr_val_t esp_matter_int(int val)
esp_matter_attr_val_t esp_matter_nullable_bool(nullable<bool> val) esp_matter_attr_val_t esp_matter_nullable_bool(nullable<bool> val)
{ {
esp_matter_attr_val_t attr_val = { esp_matter_attr_val_t attr_val = {
.type = ESP_MATTER_VAL_TYPE_NULLABLE_BOOLEAN, .type = ESP_MATTER_VAL_TYPE_NULLABLE_BOOLEAN,
}; };
if (val.is_null()) { if (val.is_null()) {
chip::app::NumericAttributeTraits<bool>::SetNull(*(uint8_t *)(&(attr_val.val.b))); chip::app::NumericAttributeTraits<bool>::SetNull(*(uint8_t *)(&(attr_val.val.b)));
} } else {
else { attr_val.val.b = val.value();
attr_val.val.b = val.value();
} }
return attr_val; return attr_val;
} }
@@ -521,13 +520,12 @@ esp_matter_attr_val_t esp_matter_array(uint8_t *val, uint16_t data_size, uint16_
namespace esp_matter { namespace esp_matter {
namespace attribute { namespace attribute {
bool val_is_null(esp_matter_attr_val_t *val) bool val_is_null(esp_matter_attr_val_t *val)
{ {
switch (val->type) { switch (val->type) {
case ESP_MATTER_VAL_TYPE_NULLABLE_BOOLEAN: case ESP_MATTER_VAL_TYPE_NULLABLE_BOOLEAN:
return chip::app::NumericAttributeTraits<bool>::IsNullValue(*(uint8_t *)(&(val->val.b))); return chip::app::NumericAttributeTraits<bool>::IsNullValue(*(uint8_t *)(&(val->val.b)));
break; break;
case ESP_MATTER_VAL_TYPE_NULLABLE_INTEGER: case ESP_MATTER_VAL_TYPE_NULLABLE_INTEGER:
return chip::app::NumericAttributeTraits<int>::IsNullValue(val->val.i); return chip::app::NumericAttributeTraits<int>::IsNullValue(val->val.i);
break; break;
@@ -572,9 +570,9 @@ bool val_is_null(esp_matter_attr_val_t *val)
void val_print(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val, bool is_read) void val_print(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val, bool is_read)
{ {
char action = (is_read) ? 'R' :'W'; char action = (is_read) ? 'R' : 'W';
VerifyOrReturn(!val_is_null(val), ESP_LOGI(TAG, "********** %c : Endpoint 0x%04" PRIX16 "'s Cluster 0x%08" PRIX32 "'s Attribute 0x%08" PRIX32 " is null **********", action, VerifyOrReturn(!val_is_null(val), ESP_LOGI(TAG, "********** %c : Endpoint 0x%04" PRIX16 "'s Cluster 0x%08" PRIX32 "'s Attribute 0x%08" PRIX32 " is null **********", action,
endpoint_id, cluster_id, attribute_id)); endpoint_id, cluster_id, attribute_id));
if (val->type == ESP_MATTER_VAL_TYPE_BOOLEAN) { if (val->type == ESP_MATTER_VAL_TYPE_BOOLEAN) {
ESP_LOGI(TAG, "********** %c : Endpoint 0x%04" PRIX16 "'s Cluster 0x%08" PRIX32 "'s Attribute 0x%08" PRIX32 " is %d **********", action, ESP_LOGI(TAG, "********** %c : Endpoint 0x%04" PRIX16 "'s Cluster 0x%08" PRIX32 "'s Attribute 0x%08" PRIX32 " is %d **********", action,
@@ -589,19 +587,19 @@ void val_print(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id,
ESP_LOGI(TAG, "********** %c : Endpoint 0x%04" PRIX16 "'s Cluster 0x%08" PRIX32 "'s Attribute 0x%08" PRIX32 " is %i **********", action, ESP_LOGI(TAG, "********** %c : Endpoint 0x%04" PRIX16 "'s Cluster 0x%08" PRIX32 "'s Attribute 0x%08" PRIX32 " is %i **********", action,
endpoint_id, cluster_id, attribute_id, val->val.i8); endpoint_id, cluster_id, attribute_id, val->val.i8);
} else if (val->type == ESP_MATTER_VAL_TYPE_UINT8 || val->type == ESP_MATTER_VAL_TYPE_BITMAP8 } else if (val->type == ESP_MATTER_VAL_TYPE_UINT8 || val->type == ESP_MATTER_VAL_TYPE_BITMAP8
|| val->type == ESP_MATTER_VAL_TYPE_ENUM8 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_UINT8 || val->type == ESP_MATTER_VAL_TYPE_ENUM8 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_UINT8
|| val->type == ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP8 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_ENUM8) { || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP8 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_ENUM8) {
ESP_LOGI(TAG, "********** %c : Endpoint 0x%04" PRIX16 "'s Cluster 0x%08" PRIX32 "'s Attribute 0x%08" PRIX32 " is %u **********", action, ESP_LOGI(TAG, "********** %c : Endpoint 0x%04" PRIX16 "'s Cluster 0x%08" PRIX32 "'s Attribute 0x%08" PRIX32 " is %u **********", action,
endpoint_id, cluster_id, attribute_id, val->val.u8); endpoint_id, cluster_id, attribute_id, val->val.u8);
} else if (val->type == ESP_MATTER_VAL_TYPE_INT16 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_INT16) { } else if (val->type == ESP_MATTER_VAL_TYPE_INT16 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_INT16) {
ESP_LOGI(TAG, "********** %c : Endpoint 0x%04" PRIX16 "'s Cluster 0x%08" PRIX32 "'s Attribute 0x%08" PRIX32 " is %" PRIi16 " **********", action, ESP_LOGI(TAG, "********** %c : Endpoint 0x%04" PRIX16 "'s Cluster 0x%08" PRIX32 "'s Attribute 0x%08" PRIX32 " is %" PRIi16 " **********", action,
endpoint_id, cluster_id, attribute_id, val->val.i16); endpoint_id, cluster_id, attribute_id, val->val.i16);
} else if (val->type == ESP_MATTER_VAL_TYPE_UINT16 || val->type == ESP_MATTER_VAL_TYPE_BITMAP16 } else if (val->type == ESP_MATTER_VAL_TYPE_UINT16 || val->type == ESP_MATTER_VAL_TYPE_BITMAP16
|| val->type == ESP_MATTER_VAL_TYPE_ENUM16 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_UINT16 || val->type == ESP_MATTER_VAL_TYPE_ENUM16 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_UINT16
|| val->type == ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP16 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_ENUM16) { || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP16 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_ENUM16) {
ESP_LOGI(TAG, "********** %c : Endpoint 0x%04" PRIX16 "'s Cluster 0x%08" PRIX32 "'s Attribute 0x%08" PRIX32 " is %" PRIu16 " **********", action, ESP_LOGI(TAG, "********** %c : Endpoint 0x%04" PRIX16 "'s Cluster 0x%08" PRIX32 "'s Attribute 0x%08" PRIX32 " is %" PRIu16 " **********", action,
endpoint_id, cluster_id, attribute_id, val->val.u16); endpoint_id, cluster_id, attribute_id, val->val.u16);
} else if (val->type == ESP_MATTER_VAL_TYPE_INT32|| val->type == ESP_MATTER_VAL_TYPE_NULLABLE_INT32) { } else if (val->type == ESP_MATTER_VAL_TYPE_INT32 || val->type == ESP_MATTER_VAL_TYPE_NULLABLE_INT32) {
ESP_LOGI(TAG, "********** %c : Endpoint 0x%04" PRIX16 "'s Cluster 0x%08" PRIX32 "'s Attribute 0x%08" PRIX32 " is %" PRIi32 " **********", action, ESP_LOGI(TAG, "********** %c : Endpoint 0x%04" PRIX16 "'s Cluster 0x%08" PRIX32 "'s Attribute 0x%08" PRIX32 " is %" PRIi32 " **********", action,
endpoint_id, cluster_id, attribute_id, val->val.i32); endpoint_id, cluster_id, attribute_id, val->val.i32);
} else if (val->type == ESP_MATTER_VAL_TYPE_UINT32 || val->type == ESP_MATTER_VAL_TYPE_BITMAP32 } else if (val->type == ESP_MATTER_VAL_TYPE_UINT32 || val->type == ESP_MATTER_VAL_TYPE_BITMAP32
@@ -684,7 +682,7 @@ bool val_compare(const esp_matter_attr_val_t *val1, const esp_matter_attr_val_t
case ESP_MATTER_VAL_TYPE_OCTET_STRING: case ESP_MATTER_VAL_TYPE_OCTET_STRING:
case ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING: case ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING:
case ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING: { case ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING: {
uint16_t null_len = uint16_t null_len =
(val1->type == ESP_MATTER_VAL_TYPE_CHAR_STRING || val1->type == ESP_MATTER_VAL_TYPE_OCTET_STRING) ? UINT8_MAX : UINT16_MAX; (val1->type == ESP_MATTER_VAL_TYPE_CHAR_STRING || val1->type == ESP_MATTER_VAL_TYPE_OCTET_STRING) ? UINT8_MAX : UINT16_MAX;
if (val1->val.a.s != val2->val.a.s) { if (val1->val.a.s != val2->val.a.s) {
return false; return false;
@@ -85,7 +85,7 @@ typedef enum {
ESP_MATTER_VAL_TYPE_NULLABLE_ENUM8 = ESP_MATTER_VAL_TYPE_ENUM8 + ESP_MATTER_VAL_NULLABLE_BASE, ESP_MATTER_VAL_TYPE_NULLABLE_ENUM8 = ESP_MATTER_VAL_TYPE_ENUM8 + ESP_MATTER_VAL_NULLABLE_BASE,
ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP8 = ESP_MATTER_VAL_TYPE_BITMAP8 + ESP_MATTER_VAL_NULLABLE_BASE, ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP8 = ESP_MATTER_VAL_TYPE_BITMAP8 + ESP_MATTER_VAL_NULLABLE_BASE,
ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP16 = ESP_MATTER_VAL_TYPE_BITMAP16 + ESP_MATTER_VAL_NULLABLE_BASE, ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP16 = ESP_MATTER_VAL_TYPE_BITMAP16 + ESP_MATTER_VAL_NULLABLE_BASE,
ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP32= ESP_MATTER_VAL_TYPE_BITMAP32 + ESP_MATTER_VAL_NULLABLE_BASE, ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP32 = ESP_MATTER_VAL_TYPE_BITMAP32 + ESP_MATTER_VAL_NULLABLE_BASE,
ESP_MATTER_VAL_TYPE_NULLABLE_ENUM16 = ESP_MATTER_VAL_TYPE_ENUM16 + ESP_MATTER_VAL_NULLABLE_BASE, ESP_MATTER_VAL_TYPE_NULLABLE_ENUM16 = ESP_MATTER_VAL_TYPE_ENUM16 + ESP_MATTER_VAL_NULLABLE_BASE,
} esp_matter_val_type_t; } esp_matter_val_type_t;
@@ -148,7 +148,7 @@ typedef struct esp_matter_attr_bounds {
template <typename T> template <typename T>
class nullable { class nullable {
/** NOTE: GetNullValue is taken from src/app/util/attribute-storage-null-handling.h */ /** NOTE: GetNullValue is taken from src/app/util/attribute-storage-null-handling.h */
private: private:
template <typename U = T, typename std::enable_if_t<std::is_floating_point<U>::value, int> = 0> template <typename U = T, typename std::enable_if_t<std::is_floating_point<U>::value, int> = 0>
static constexpr T GetNullValue() static constexpr T GetNullValue()
@@ -223,8 +223,7 @@ private:
/** Template specialization for bool */ /** Template specialization for bool */
template <> template <>
class nullable<bool> class nullable<bool> {
{
using Traits = chip::app::NumericAttributeTraits<bool>; using Traits = chip::app::NumericAttributeTraits<bool>;
using StorageType = typename Traits::StorageType; // Resolves to uint8_t using StorageType = typename Traits::StorageType; // Resolves to uint8_t
@@ -233,12 +232,21 @@ class nullable<bool>
public: public:
/** Constructors */ /** Constructors */
nullable() { Traits::SetNull(storage); } nullable()
nullable(std::nullptr_t) { Traits::SetNull(storage); } {
Traits::SetNull(storage);
}
nullable(std::nullptr_t)
{
Traits::SetNull(storage);
}
constexpr nullable(bool v) : storage(static_cast<StorageType>(v)) {} constexpr nullable(bool v) : storage(static_cast<StorageType>(v)) {}
/** Observers */ /** Observers */
constexpr bool is_null() const { return Traits::IsNullValue(storage); } constexpr bool is_null() const
{
return Traits::IsNullValue(storage);
}
/** /**
* @brief Gets the stored bool value. * @brief Gets the stored bool value.
@@ -255,13 +263,25 @@ public:
* ``` * ```
* @return `true` if storage is non-zero (includes null state), `false` if storage is zero. * @return `true` if storage is non-zero (includes null state), `false` if storage is zero.
*/ */
constexpr bool value() const { return static_cast<bool>(storage); } constexpr bool value() const
{
return static_cast<bool>(storage);
}
constexpr bool value_or(bool d) const { return is_null() ? d : static_cast<bool>(storage); } constexpr bool value_or(bool d) const
{
return is_null() ? d : static_cast<bool>(storage);
}
/** Modifiers */ /** Modifiers */
void operator=(std::nullptr_t) { Traits::SetNull(storage); } void operator=(std::nullptr_t)
void operator=(bool v) { storage = static_cast<StorageType>(v); } {
Traits::SetNull(storage);
}
void operator=(bool v)
{
storage = static_cast<StorageType>(v);
}
private: private:
StorageType storage; // 1byte payload holding 0 / 1 / 0xFF StorageType storage; // 1byte payload holding 0 / 1 / 0xFF
@@ -54,8 +54,7 @@ namespace {
// this space is for feature validation functions // this space is for feature validation functions
enum class feature_policy enum class feature_policy {
{
k_exact_one = 0, // O.a k_exact_one = 0, // O.a
k_at_least_one = 1, // 0.a+ k_at_least_one = 1, // 0.a+
k_at_most_one = 2, // 0.a- k_at_most_one = 2, // 0.a-
@@ -471,7 +470,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
attribute::create_last_connect_error_value(cluster, nullable<int32_t>()); attribute::create_last_connect_error_value(cluster, nullable<int32_t>());
if (config->feature_map & chip::to_underlying(NetworkCommissioning::Feature::kWiFiNetworkInterface) || if (config->feature_map & chip::to_underlying(NetworkCommissioning::Feature::kWiFiNetworkInterface) ||
config->feature_map & chip::to_underlying(NetworkCommissioning::Feature::kThreadNetworkInterface)) { config->feature_map & chip::to_underlying(NetworkCommissioning::Feature::kThreadNetworkInterface)) {
attribute::create_scan_max_time_seconds(cluster, 0); attribute::create_scan_max_time_seconds(cluster, 0);
attribute::create_connect_max_time_seconds(cluster, 0); attribute::create_connect_max_time_seconds(cluster, 0);
} }
@@ -702,7 +701,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
global::attribute::create_cluster_revision(cluster, cluster_revision); global::attribute::create_cluster_revision(cluster, cluster_revision);
cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterWiFiNetworkDiagnosticsClusterServerInitCallback, cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterWiFiNetworkDiagnosticsClusterServerInitCallback,
ESPMatterWiFiNetworkDiagnosticsClusterServerShutdownCallback); ESPMatterWiFiNetworkDiagnosticsClusterServerShutdownCallback);
} }
return cluster; return cluster;
@@ -768,7 +767,6 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
/* Attributes managed internally */ /* Attributes managed internally */
global::attribute::create_feature_map(cluster, 0); global::attribute::create_feature_map(cluster, 0);
/* Attributes not managed internally */ /* Attributes not managed internally */
global::attribute::create_cluster_revision(cluster, cluster_revision); global::attribute::create_cluster_revision(cluster, cluster_revision);
cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterEthernetNetworkDiagnosticsClusterServerInitCallback, cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterEthernetNetworkDiagnosticsClusterServerInitCallback,
@@ -809,7 +807,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
/* Commands */ /* Commands */
command::create_set_utc_time(cluster); command::create_set_utc_time(cluster);
cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterTimeSynchronizationClusterServerInitCallback, cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterTimeSynchronizationClusterServerInitCallback,
ESPMatterTimeSynchronizationClusterServerShutdownCallback); ESPMatterTimeSynchronizationClusterServerShutdownCallback);
} }
event::create_time_failure(cluster); event::create_time_failure(cluster);
@@ -838,7 +836,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
/* Attributes not managed internally */ /* Attributes not managed internally */
global::attribute::create_cluster_revision(cluster, cluster_revision); global::attribute::create_cluster_revision(cluster, cluster_revision);
cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterUnitLocalizationClusterServerInitCallback, cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterUnitLocalizationClusterServerInitCallback,
ESPMatterUnitLocalizationClusterServerShutdownCallback); ESPMatterUnitLocalizationClusterServerShutdownCallback);
} }
return cluster; return cluster;
@@ -1122,7 +1120,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
ESP_LOGE(TAG, "Config is NULL. Cannot add some attributes."); ESP_LOGE(TAG, "Config is NULL. Cannot add some attributes.");
} }
cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterScenesManagementClusterServerInitCallback, cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterScenesManagementClusterServerInitCallback,
ESPMatterScenesManagementClusterServerShutdownCallback); ESPMatterScenesManagementClusterServerShutdownCallback);
} }
/* Commands */ /* Commands */
@@ -1358,9 +1356,9 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
} else { } else {
// HEAT and COOL must be checked against O.a+ // HEAT and COOL must be checked against O.a+
VALIDATE_FEATURES_AT_LEAST_ONE("Heat,Cool", VALIDATE_FEATURES_AT_LEAST_ONE("Heat,Cool",
feature::heating::get_id(), feature::cooling::get_id()); feature::heating::get_id(), feature::cooling::get_id());
if(has(feature::heating::get_id())) { if (has(feature::heating::get_id())) {
feature::heating::add(cluster, &(config->features.heating)); feature::heating::add(cluster, &(config->features.heating));
} }
if (has(feature::cooling::get_id())) { if (has(feature::cooling::get_id())) {
@@ -1505,7 +1503,7 @@ static cluster_t *create(endpoint_t *endpoint, T *config, uint8_t flags, uint32_
namespace hepa_filter_monitoring { namespace hepa_filter_monitoring {
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
{ {
cluster_t *cluster = resource_monitoring::create<config_t, HepaFilterMonitoringDelegateInitCB>(endpoint, config, flags,HepaFilterMonitoring::Id, cluster_revision); cluster_t *cluster = resource_monitoring::create<config_t, HepaFilterMonitoringDelegateInitCB>(endpoint, config, flags, HepaFilterMonitoring::Id, cluster_revision);
if (cluster && (flags & CLUSTER_FLAG_SERVER)) { if (cluster && (flags & CLUSTER_FLAG_SERVER)) {
cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterHepaFilterMonitoringClusterServerInitCallback, cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterHepaFilterMonitoringClusterServerInitCallback,
ESPMatterHepaFilterMonitoringClusterServerShutdownCallback); ESPMatterHepaFilterMonitoringClusterServerShutdownCallback);
@@ -1517,7 +1515,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
namespace activated_carbon_filter_monitoring { namespace activated_carbon_filter_monitoring {
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
{ {
cluster_t *cluster = resource_monitoring::create<config_t, ActivatedCarbonFilterMonitoringDelegateInitCB>(endpoint, config, flags,ActivatedCarbonFilterMonitoring::Id, cluster_revision); cluster_t *cluster = resource_monitoring::create<config_t, ActivatedCarbonFilterMonitoringDelegateInitCB>(endpoint, config, flags, ActivatedCarbonFilterMonitoring::Id, cluster_revision);
if (cluster && (flags & CLUSTER_FLAG_SERVER)) { if (cluster && (flags & CLUSTER_FLAG_SERVER)) {
cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterActivatedCarbonFilterMonitoringClusterServerInitCallback, cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterActivatedCarbonFilterMonitoringClusterServerInitCallback,
ESPMatterActivatedCarbonFilterMonitoringClusterServerShutdownCallback); ESPMatterActivatedCarbonFilterMonitoringClusterServerShutdownCallback);
@@ -1550,9 +1548,9 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_
// check against O.a+ feature conformance for Numeric Measurement and Level Indication // check against O.a+ feature conformance for Numeric Measurement and Level Indication
VALIDATE_FEATURES_AT_LEAST_ONE("NumericMeasurement,LevelIndication", VALIDATE_FEATURES_AT_LEAST_ONE("NumericMeasurement,LevelIndication",
feature::numeric_measurement::get_id(), feature::level_indication::get_id()); feature::numeric_measurement::get_id(), feature::level_indication::get_id());
if(has(feature::numeric_measurement::get_id())) { if (has(feature::numeric_measurement::get_id())) {
feature::numeric_measurement::add(cluster, &(config->features.numeric_measurement)); feature::numeric_measurement::add(cluster, &(config->features.numeric_measurement));
if (has(feature::peak_measurement::get_id())) { if (has(feature::peak_measurement::get_id())) {
feature::peak_measurement::add(cluster, &(config->features.peak_measurement)); feature::peak_measurement::add(cluster, &(config->features.peak_measurement));
@@ -1777,7 +1775,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
// check against O.a+ feature conformance for Spin and Rinse // check against O.a+ feature conformance for Spin and Rinse
VALIDATE_FEATURES_AT_LEAST_ONE("Spin,Rinse", VALIDATE_FEATURES_AT_LEAST_ONE("Spin,Rinse",
feature::spin::get_id(), feature::rinse::get_id()); feature::spin::get_id(), feature::rinse::get_id());
if (has(feature::spin::get_id())) { if (has(feature::spin::get_id())) {
feature::spin::add(cluster, &(config->features.spin)); feature::spin::add(cluster, &(config->features.spin));
@@ -1930,7 +1928,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
// check against O.a+ feature conformance for Smoke Alarm and CO Alarm // check against O.a+ feature conformance for Smoke Alarm and CO Alarm
VALIDATE_FEATURES_AT_LEAST_ONE("Smoke Alarm,CO Alarm", VALIDATE_FEATURES_AT_LEAST_ONE("Smoke Alarm,CO Alarm",
feature::smoke_alarm::get_id(), feature::co_alarm::get_id()); feature::smoke_alarm::get_id(), feature::co_alarm::get_id());
if (has(feature::smoke_alarm::get_id())) { if (has(feature::smoke_alarm::get_id())) {
feature::smoke_alarm::add(cluster); feature::smoke_alarm::add(cluster);
@@ -1962,7 +1960,7 @@ const function_generic_t function_list[] = {
(function_generic_t)MatterDoorLockClusterServerPreAttributeChangedCallback, (function_generic_t)MatterDoorLockClusterServerPreAttributeChangedCallback,
}; };
const int function_flags = CLUSTER_FLAG_INIT_FUNCTION | CLUSTER_FLAG_ATTRIBUTE_CHANGED_FUNCTION | CLUSTER_FLAG_SHUTDOWN_FUNCTION | const int function_flags = CLUSTER_FLAG_INIT_FUNCTION | CLUSTER_FLAG_ATTRIBUTE_CHANGED_FUNCTION | CLUSTER_FLAG_SHUTDOWN_FUNCTION |
CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION; CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
{ {
@@ -2046,7 +2044,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
// check against O.a+ feature conformance for Lift and Tilt // check against O.a+ feature conformance for Lift and Tilt
VALIDATE_FEATURES_AT_LEAST_ONE("Lift,Tilt", VALIDATE_FEATURES_AT_LEAST_ONE("Lift,Tilt",
feature::lift::get_id(), feature::tilt::get_id()); feature::lift::get_id(), feature::tilt::get_id());
if (has(feature::lift::get_id())) { if (has(feature::lift::get_id())) {
feature::lift::add(cluster); feature::lift::add(cluster);
@@ -2077,7 +2075,6 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
} }
} /* window_covering */ } /* window_covering */
namespace switch_cluster { namespace switch_cluster {
const function_generic_t *function_list = NULL; const function_generic_t *function_list = NULL;
const int function_flags = CLUSTER_FLAG_NONE; const int function_flags = CLUSTER_FLAG_NONE;
@@ -2104,7 +2101,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
// check against O.a feature conformance Latching and Momentary Switch // check against O.a feature conformance Latching and Momentary Switch
VALIDATE_FEATURES_EXACT_ONE("Latching Switch,Momentary Switch", VALIDATE_FEATURES_EXACT_ONE("Latching Switch,Momentary Switch",
feature::latching_switch::get_id(), feature::momentary_switch::get_id()); feature::latching_switch::get_id(), feature::momentary_switch::get_id());
if (has(feature::latching_switch::get_id())) { if (has(feature::latching_switch::get_id())) {
feature::latching_switch::add(cluster); feature::latching_switch::add(cluster);
@@ -2240,10 +2237,10 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
// check against O.a+ feature conformance for occupancy sensing // check against O.a+ feature conformance for occupancy sensing
VALIDATE_FEATURES_AT_LEAST_ONE("Other,Passive Infrared,Ultrasonic,Physical Contact,Active Infrared,Radar,RF Sensing,Vision", VALIDATE_FEATURES_AT_LEAST_ONE("Other,Passive Infrared,Ultrasonic,Physical Contact,Active Infrared,Radar,RF Sensing,Vision",
feature::other::get_id(), feature::passive_infrared::get_id(), feature::other::get_id(), feature::passive_infrared::get_id(),
feature::ultrasonic::get_id(), feature::physical_contact::get_id(), feature::ultrasonic::get_id(), feature::physical_contact::get_id(),
feature::active_infrared::get_id(), feature::radar::get_id(), feature::active_infrared::get_id(), feature::radar::get_id(),
feature::rf_sensing::get_id(), feature::vision::get_id()); feature::rf_sensing::get_id(), feature::vision::get_id());
if (has(feature::other::get_id())) { if (has(feature::other::get_id())) {
feature::other::add(cluster); feature::other::add(cluster);
@@ -2355,7 +2352,8 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
namespace localization_configuration { namespace localization_configuration {
const function_generic_t function_list[] = { const function_generic_t function_list[] = {
(function_generic_t)emberAfLocalizationConfigurationClusterServerInitCallback, (function_generic_t)emberAfLocalizationConfigurationClusterServerInitCallback,
(function_generic_t)MatterLocalizationConfigurationClusterServerPreAttributeChangedCallback}; (function_generic_t)MatterLocalizationConfigurationClusterServerPreAttributeChangedCallback
};
const int function_flags = CLUSTER_FLAG_INIT_FUNCTION | CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION; const int function_flags = CLUSTER_FLAG_INIT_FUNCTION | CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
@@ -2393,7 +2391,8 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
namespace time_format_localization { namespace time_format_localization {
const function_generic_t function_list[] = { const function_generic_t function_list[] = {
(function_generic_t)emberAfTimeFormatLocalizationClusterServerInitCallback, (function_generic_t)emberAfTimeFormatLocalizationClusterServerInitCallback,
(function_generic_t)MatterTimeFormatLocalizationClusterServerPreAttributeChangedCallback}; (function_generic_t)MatterTimeFormatLocalizationClusterServerPreAttributeChangedCallback
};
const int function_flags = CLUSTER_FLAG_INIT_FUNCTION | CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION; const int function_flags = CLUSTER_FLAG_INIT_FUNCTION | CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
@@ -2447,9 +2446,9 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
if (config) { if (config) {
attribute::create_measured_value(cluster, config->measured_value, 0x0000, 0xFFFF); attribute::create_measured_value(cluster, config->measured_value, 0x0000, 0xFFFF);
attribute::create_min_measured_value(cluster, config->min_measured_value, 0x0001, attribute::create_min_measured_value(cluster, config->min_measured_value, 0x0001,
0xFFFD); 0xFFFD);
attribute::create_max_measured_value(cluster, config->max_measured_value, 0x0002, attribute::create_max_measured_value(cluster, config->max_measured_value, 0x0002,
0xFFFE); 0xFFFE);
} else { } else {
ESP_LOGE(TAG, "Config is NULL. Cannot add some attributes."); ESP_LOGE(TAG, "Config is NULL. Cannot add some attributes.");
} }
@@ -2568,9 +2567,9 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
// check against O.a+ feature conformance for pump configuration and control // check against O.a+ feature conformance for pump configuration and control
VALIDATE_FEATURES_AT_LEAST_ONE("ConstantPressure,CompensatedPressure,ConstantFlow,ConstantSpeed,ConstantTemperature", VALIDATE_FEATURES_AT_LEAST_ONE("ConstantPressure,CompensatedPressure,ConstantFlow,ConstantSpeed,ConstantTemperature",
feature::constant_pressure::get_id(), feature::compensated_pressure::get_id(), feature::constant_pressure::get_id(), feature::compensated_pressure::get_id(),
feature::constant_flow::get_id(), feature::constant_speed::get_id(), feature::constant_flow::get_id(), feature::constant_speed::get_id(),
feature::constant_temperature::get_id()); feature::constant_temperature::get_id());
if (has(feature::constant_pressure::get_id())) { if (has(feature::constant_pressure::get_id())) {
feature::constant_pressure::add(cluster, &config->features.constant_pressure); feature::constant_pressure::add(cluster, &config->features.constant_pressure);
@@ -2738,7 +2737,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
// check against O.a feature conformance for TN, TL // check against O.a feature conformance for TN, TL
VALIDATE_FEATURES_EXACT_ONE("TemperatureNumber,TemperatureLevel", VALIDATE_FEATURES_EXACT_ONE("TemperatureNumber,TemperatureLevel",
feature::temperature_number::get_id(), feature::temperature_level::get_id()); feature::temperature_number::get_id(), feature::temperature_level::get_id());
if (has(feature::temperature_number::get_id())) { if (has(feature::temperature_number::get_id())) {
feature::temperature_number::add(cluster, &(config->features.temperature_number)); feature::temperature_number::add(cluster, &(config->features.temperature_number));
@@ -2809,7 +2808,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
/* Attributes managed internally */ /* Attributes managed internally */
global::attribute::create_feature_map(cluster, 0); global::attribute::create_feature_map(cluster, 0);
mode_base::attribute::create_supported_modes(cluster, NULL, 0, 0); mode_base::attribute::create_supported_modes(cluster, NULL, 0, 0);
/* Attributes not managed internally */ /* Attributes not managed internally */
global::attribute::create_cluster_revision(cluster, cluster_revision); global::attribute::create_cluster_revision(cluster, cluster_revision);
@@ -2966,7 +2965,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
// check against O.a feature conformance for microwave oven control // check against O.a feature conformance for microwave oven control
VALIDATE_FEATURES_EXACT_ONE("PowerAsNumber,PowerInWatts", VALIDATE_FEATURES_EXACT_ONE("PowerAsNumber,PowerInWatts",
feature::power_as_number::get_id(), feature::power_in_watts::get_id()); feature::power_as_number::get_id(), feature::power_in_watts::get_id());
if (has(feature::power_as_number::get_id())) { if (has(feature::power_as_number::get_id())) {
feature::power_as_number::add(cluster); feature::power_as_number::add(cluster);
@@ -3044,7 +3043,6 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
/* Attributes managed internally */ /* Attributes managed internally */
global::attribute::create_feature_map(cluster, 0); global::attribute::create_feature_map(cluster, 0);
/* Attributes not managed internally */ /* Attributes not managed internally */
global::attribute::create_cluster_revision(cluster, cluster_revision); global::attribute::create_cluster_revision(cluster, cluster_revision);
} }
@@ -3083,8 +3081,8 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
// check against O.a feature conformance for power topology // check against O.a feature conformance for power topology
VALIDATE_FEATURES_EXACT_ONE("NodeTopology,TreeTopology,SetTopology", VALIDATE_FEATURES_EXACT_ONE("NodeTopology,TreeTopology,SetTopology",
feature::node_topology::get_id(), feature::tree_topology::get_id(), feature::node_topology::get_id(), feature::tree_topology::get_id(),
feature::set_topology::get_id()); feature::set_topology::get_id());
if (has(feature::node_topology::get_id())) { if (has(feature::node_topology::get_id())) {
feature::node_topology::add(cluster); feature::node_topology::add(cluster);
@@ -3136,7 +3134,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
// check against O.a+ feature conformance for electrical power measurement // check against O.a+ feature conformance for electrical power measurement
VALIDATE_FEATURES_AT_LEAST_ONE("Direct Current,Alternating Current", VALIDATE_FEATURES_AT_LEAST_ONE("Direct Current,Alternating Current",
feature::direct_current::get_id(), feature::alternating_current::get_id()); feature::direct_current::get_id(), feature::alternating_current::get_id());
if (has(feature::direct_current::get_id())) { if (has(feature::direct_current::get_id())) {
feature::direct_current::add(cluster); feature::direct_current::add(cluster);
@@ -3186,9 +3184,9 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
// check against O.a+ feature conformance for electrical energy measurement // check against O.a+ feature conformance for electrical energy measurement
VALIDATE_FEATURES_AT_LEAST_ONE("ImportedEnergy,ExportedEnergy", VALIDATE_FEATURES_AT_LEAST_ONE("ImportedEnergy,ExportedEnergy",
feature::imported_energy::get_id(), feature::exported_energy::get_id()); feature::imported_energy::get_id(), feature::exported_energy::get_id());
VALIDATE_FEATURES_AT_LEAST_ONE("CumulativeEnergy,PeriodicEnergy", VALIDATE_FEATURES_AT_LEAST_ONE("CumulativeEnergy,PeriodicEnergy",
feature::cumulative_energy::get_id(), feature::periodic_energy::get_id()); feature::cumulative_energy::get_id(), feature::periodic_energy::get_id());
if (has(feature::imported_energy::get_id())) { if (has(feature::imported_energy::get_id())) {
feature::imported_energy::add(cluster); feature::imported_energy::add(cluster);
@@ -3433,10 +3431,10 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
/* Attributes should managed by application */ /* Attributes should managed by application */
attribute::create_application_name(cluster, NULL, 0); attribute::create_application_name(cluster, NULL, 0);
attribute::create_application(cluster, NULL, 0 , 0); attribute::create_application(cluster, NULL, 0, 0);
attribute::create_status(cluster, 0); attribute::create_status(cluster, 0);
attribute::create_application_version(cluster, NULL, 0); attribute::create_application_version(cluster, NULL, 0);
attribute::create_allowed_vendor_list(cluster, NULL, 0 , 0); attribute::create_allowed_vendor_list(cluster, NULL, 0, 0);
/** Attributes not managed internally **/ /** Attributes not managed internally **/
global::attribute::create_cluster_revision(cluster, cluster_revision); global::attribute::create_cluster_revision(cluster, cluster_revision);
} }
@@ -3708,7 +3706,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
// check against O.a+ feature conformance for energy preference // check against O.a+ feature conformance for energy preference
VALIDATE_FEATURES_AT_LEAST_ONE("EnergyBalance,LowPowerModeSensitivity", VALIDATE_FEATURES_AT_LEAST_ONE("EnergyBalance,LowPowerModeSensitivity",
feature::energy_balance::get_id(), feature::low_power_mode_sensitivity::get_id()); feature::energy_balance::get_id(), feature::low_power_mode_sensitivity::get_id());
if (has(feature::energy_balance::get_id())) { if (has(feature::energy_balance::get_id())) {
feature::energy_balance::add(cluster, &(config->features.energy_balance)); feature::energy_balance::add(cluster, &(config->features.energy_balance));
@@ -3827,10 +3825,9 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
attribute::create_supported_stream_usages(cluster, NULL, 0, 0); attribute::create_supported_stream_usages(cluster, NULL, 0, 0);
attribute::create_stream_usage_priorities(cluster, NULL, 0, 0); attribute::create_stream_usage_priorities(cluster, NULL, 0, 0);
// check against at least one feature conformance // check against at least one feature conformance
VALIDATE_FEATURES_AT_LEAST_ONE("Audio,Video,Snapshot", VALIDATE_FEATURES_AT_LEAST_ONE("Audio,Video,Snapshot",
feature::audio::get_id(), feature::video::get_id(), feature::snapshot::get_id()); feature::audio::get_id(), feature::video::get_id(), feature::snapshot::get_id());
if (has(feature::audio::get_id())) { if (has(feature::audio::get_id())) {
VerifyOrReturnValue(feature::audio::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); VerifyOrReturnValue(feature::audio::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster));
if (has(feature::speaker::get_id())) { if (has(feature::speaker::get_id())) {
@@ -3848,7 +3845,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
VerifyOrReturnValue(feature::local_storage::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); VerifyOrReturnValue(feature::local_storage::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster));
} }
if (has(feature::video::get_id())|| has(feature::snapshot::get_id())) { if (has(feature::video::get_id()) || has(feature::snapshot::get_id())) {
if (has(feature::image_control::get_id())) { if (has(feature::image_control::get_id())) {
VerifyOrReturnValue(feature::image_control::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); VerifyOrReturnValue(feature::image_control::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster));
} }
@@ -3902,7 +3899,6 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
attribute::create_current_sessions(cluster, NULL, 0, 0); attribute::create_current_sessions(cluster, NULL, 0, 0);
command::create_solicit_offer(cluster); command::create_solicit_offer(cluster);
command::create_solicit_offer_response(cluster); command::create_solicit_offer_response(cluster);
command::create_provide_offer(cluster); command::create_provide_offer(cluster);
@@ -3911,7 +3907,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
command::create_provide_ice_candidates(cluster); command::create_provide_ice_candidates(cluster);
command::create_end_session(cluster); command::create_end_session(cluster);
cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterWebRTCTransportProviderClusterServerInitCallback, cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterWebRTCTransportProviderClusterServerInitCallback,
ESPMatterWebRTCTransportProviderClusterServerShutdownCallback); ESPMatterWebRTCTransportProviderClusterServerShutdownCallback);
} }
if (flags & CLUSTER_FLAG_CLIENT) { if (flags & CLUSTER_FLAG_CLIENT) {
@@ -3944,7 +3940,6 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
attribute::create_current_sessions(cluster, NULL, 0, 0); attribute::create_current_sessions(cluster, NULL, 0, 0);
command::create_offer(cluster); command::create_offer(cluster);
command::create_answer(cluster); command::create_answer(cluster);
command::create_ice_candidates(cluster); command::create_ice_candidates(cluster);
@@ -3959,7 +3954,6 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
} }
} /*webrtc transport requestor*/ } /*webrtc transport requestor*/
// namespace binary_input_basic { // namespace binary_input_basic {
// // ToDo // // ToDo
// } /* binary_input_basic */ // } /* binary_input_basic */
@@ -4094,7 +4088,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
// check against O.a+ feature conformance // check against O.a+ feature conformance
VALIDATE_FEATURES_AT_LEAST_ONE("Positioning,MotionLatching", VALIDATE_FEATURES_AT_LEAST_ONE("Positioning,MotionLatching",
feature::positioning::get_id(), feature::motion_latching::get_id()); feature::positioning::get_id(), feature::motion_latching::get_id());
if (has(feature::positioning::get_id())) { if (has(feature::positioning::get_id())) {
VerifyOrReturnValue(feature::positioning::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); VerifyOrReturnValue(feature::positioning::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster));
if (has(feature::ventilation::get_id())) { if (has(feature::ventilation::get_id())) {
@@ -4175,12 +4169,12 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
// check against O.a+ feature conformance // check against O.a+ feature conformance
VALIDATE_FEATURES_AT_LEAST_ONE("Positioning,MotionLatching", VALIDATE_FEATURES_AT_LEAST_ONE("Positioning,MotionLatching",
feature::positioning::get_id(), feature::motion_latching::get_id()); feature::positioning::get_id(), feature::motion_latching::get_id());
if (has(feature::positioning::get_id())) { if (has(feature::positioning::get_id())) {
VerifyOrReturnValue(feature::positioning::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); VerifyOrReturnValue(feature::positioning::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster));
VALIDATE_FEATURES_AT_MOST_ONE("Translation, Rotation, Modulation", VALIDATE_FEATURES_AT_MOST_ONE("Translation, Rotation, Modulation",
feature::translation::get_id(), feature::rotation::get_id(), feature::modulation::get_id()); feature::translation::get_id(), feature::rotation::get_id(), feature::modulation::get_id());
if (has(feature::translation::get_id())) { if (has(feature::translation::get_id())) {
VerifyOrReturnValue(feature::translation::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); VerifyOrReturnValue(feature::translation::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster));
} }
@@ -4243,7 +4237,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
// check against O.a+ feature conformance // check against O.a+ feature conformance
VALIDATE_FEATURES_AT_LEAST_ONE("DigitalPTZ,MechanicalPan,MechanicalTilt,MechanicalZoom", VALIDATE_FEATURES_AT_LEAST_ONE("DigitalPTZ,MechanicalPan,MechanicalTilt,MechanicalZoom",
feature::digital_ptz::get_id(), feature::mechanical_pan::get_id(), feature::mechanical_tilt::get_id(), feature::mechanical_zoom::get_id()); feature::digital_ptz::get_id(), feature::mechanical_pan::get_id(), feature::mechanical_tilt::get_id(), feature::mechanical_zoom::get_id());
if (has(feature::digital_ptz::get_id())) { if (has(feature::digital_ptz::get_id())) {
VerifyOrReturnValue(feature::digital_ptz::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); VerifyOrReturnValue(feature::digital_ptz::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster));
} }
@@ -4365,7 +4359,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
// check against O.a+ feature conformance // check against O.a+ feature conformance
VALIDATE_FEATURES_AT_LEAST_ONE("Pricing,FriendlyCredit,AuxiliaryLoad", VALIDATE_FEATURES_AT_LEAST_ONE("Pricing,FriendlyCredit,AuxiliaryLoad",
feature::pricing::get_id(), feature::friendly_credit::get_id(), feature::auxiliary_load::get_id()); feature::pricing::get_id(), feature::friendly_credit::get_id(), feature::auxiliary_load::get_id());
if (has(feature::pricing::get_id())) { if (has(feature::pricing::get_id())) {
VerifyOrReturnValue(feature::pricing::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); VerifyOrReturnValue(feature::pricing::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster));
} }
@@ -208,7 +208,7 @@ typedef struct config {
feature::replaceable::config_t replaceable; feature::replaceable::config_t replaceable;
} features; } features;
uint32_t feature_flags; uint32_t feature_flags;
config() : status(0), order(0), description{0}, feature_flags(0) {} config() : status(0), order(0), description{0}, feature_flags(0) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* power_source */ } /* power_source */
@@ -281,7 +281,7 @@ typedef struct config {
uint16_t color_capabilities; uint16_t color_capabilities;
nullable<uint8_t> number_of_primaries; nullable<uint8_t> number_of_primaries;
config() : color_mode(1), color_control_options(0), enhanced_color_mode(1), config() : color_mode(1), color_control_options(0), enhanced_color_mode(1),
color_capabilities(0), number_of_primaries(0) {} color_capabilities(0), number_of_primaries(0) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -570,7 +570,7 @@ typedef struct config {
uint8_t occupancy_sensor_type_bitmap; uint8_t occupancy_sensor_type_bitmap;
uint32_t feature_flags; uint32_t feature_flags;
config() : occupancy(0), occupancy_sensor_type(0), config() : occupancy(0), occupancy_sensor_type(0),
occupancy_sensor_type_bitmap(0), feature_flags(0) {} occupancy_sensor_type_bitmap(0), feature_flags(0) {}
} config_t; } config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
@@ -969,7 +969,6 @@ using config_t = common::config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
}/*webrtc transport requestor*/ }/*webrtc transport requestor*/
namespace chime { namespace chime {
typedef struct config { typedef struct config {
void *delegate; void *delegate;
@@ -62,7 +62,7 @@ void dispatch_single_cluster_command(const ConcreteCommandPath &command_path, TL
return; return;
} }
command_obj->AddStatus(command_path, err == ESP_OK ? chip::Protocols::InteractionModel::Status::Success : command_obj->AddStatus(command_path, err == ESP_OK ? chip::Protocols::InteractionModel::Status::Success :
chip::Protocols::InteractionModel::Status::Failure); chip::Protocols::InteractionModel::Status::Failure);
} }
} }
} }
@@ -534,7 +534,7 @@ static esp_err_t esp_matter_command_callback_step_color(const ConcreteCommandPat
} }
static esp_err_t esp_matter_command_callback_self_test_request(const ConcreteCommandPath &command_path, TLVReader &tlv_data, static esp_err_t esp_matter_command_callback_self_test_request(const ConcreteCommandPath &command_path, TLVReader &tlv_data,
void *opaque_ptr) void *opaque_ptr)
{ {
chip::app::Clusters::SmokeCoAlarm::Commands::SelfTestRequest::DecodableType command_data; chip::app::Clusters::SmokeCoAlarm::Commands::SelfTestRequest::DecodableType command_data;
CHIP_ERROR error = Decode(tlv_data, command_data); CHIP_ERROR error = Decode(tlv_data, command_data);
@@ -754,7 +754,7 @@ static esp_err_t esp_matter_command_callback_unbolt_door(const ConcreteCommandPa
} }
static esp_err_t esp_matter_command_callback_set_aliro_reader_config(const ConcreteCommandPath &command_path, TLVReader &tlv_data, static esp_err_t esp_matter_command_callback_set_aliro_reader_config(const ConcreteCommandPath &command_path, TLVReader &tlv_data,
void *opaque_ptr) void *opaque_ptr)
{ {
chip::app::Clusters::DoorLock::Commands::SetAliroReaderConfig::DecodableType command_data; chip::app::Clusters::DoorLock::Commands::SetAliroReaderConfig::DecodableType command_data;
CHIP_ERROR error = Decode(tlv_data, command_data); CHIP_ERROR error = Decode(tlv_data, command_data);
@@ -765,7 +765,7 @@ static esp_err_t esp_matter_command_callback_set_aliro_reader_config(const Concr
} }
static esp_err_t esp_matter_command_callback_clear_aliro_reader_config(const ConcreteCommandPath &command_path, TLVReader &tlv_data, static esp_err_t esp_matter_command_callback_clear_aliro_reader_config(const ConcreteCommandPath &command_path, TLVReader &tlv_data,
void *opaque_ptr) void *opaque_ptr)
{ {
chip::app::Clusters::DoorLock::Commands::ClearAliroReaderConfig::DecodableType command_data; chip::app::Clusters::DoorLock::Commands::ClearAliroReaderConfig::DecodableType command_data;
CHIP_ERROR error = Decode(tlv_data, command_data); CHIP_ERROR error = Decode(tlv_data, command_data);
@@ -787,7 +787,7 @@ static esp_err_t esp_matter_command_callback_setpoint_raise_lower(const Concrete
} }
static esp_err_t esp_matter_command_callback_set_active_schedule_request(const ConcreteCommandPath &command_path, static esp_err_t esp_matter_command_callback_set_active_schedule_request(const ConcreteCommandPath &command_path,
TLVReader &tlv_data, void *opaque_ptr) TLVReader &tlv_data, void *opaque_ptr)
{ {
chip::app::Clusters::Thermostat::Commands::SetActiveScheduleRequest::DecodableType command_data; chip::app::Clusters::Thermostat::Commands::SetActiveScheduleRequest::DecodableType command_data;
CHIP_ERROR error = Decode(tlv_data, command_data); CHIP_ERROR error = Decode(tlv_data, command_data);
@@ -798,7 +798,7 @@ static esp_err_t esp_matter_command_callback_set_active_schedule_request(const C
} }
static esp_err_t esp_matter_command_callback_thermostat_atomic_request(const ConcreteCommandPath &command_path, static esp_err_t esp_matter_command_callback_thermostat_atomic_request(const ConcreteCommandPath &command_path,
TLVReader &tlv_data, void *opaque_ptr) TLVReader &tlv_data, void *opaque_ptr)
{ {
chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType command_data; chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType command_data;
CHIP_ERROR error = Decode(tlv_data, command_data); CHIP_ERROR error = Decode(tlv_data, command_data);
@@ -809,7 +809,7 @@ static esp_err_t esp_matter_command_callback_thermostat_atomic_request(const Con
} }
static esp_err_t esp_matter_command_callback_set_active_preset_request(const ConcreteCommandPath &command_path, static esp_err_t esp_matter_command_callback_set_active_preset_request(const ConcreteCommandPath &command_path,
TLVReader &tlv_data, void *opaque_ptr) TLVReader &tlv_data, void *opaque_ptr)
{ {
chip::app::Clusters::Thermostat::Commands::SetActivePresetRequest::DecodableType command_data; chip::app::Clusters::Thermostat::Commands::SetActivePresetRequest::DecodableType command_data;
CHIP_ERROR error = Decode(tlv_data, command_data); CHIP_ERROR error = Decode(tlv_data, command_data);
@@ -831,7 +831,7 @@ static esp_err_t esp_matter_command_callback_thread_reset_counts(const ConcreteC
} }
static esp_err_t esp_matter_command_callback_up_or_open(const ConcreteCommandPath &command_path, TLVReader &tlv_data, static esp_err_t esp_matter_command_callback_up_or_open(const ConcreteCommandPath &command_path, TLVReader &tlv_data,
void *opaque_ptr) void *opaque_ptr)
{ {
chip::app::Clusters::WindowCovering::Commands::UpOrOpen::DecodableType command_data; chip::app::Clusters::WindowCovering::Commands::UpOrOpen::DecodableType command_data;
CHIP_ERROR error = Decode(tlv_data, command_data); CHIP_ERROR error = Decode(tlv_data, command_data);
@@ -842,7 +842,7 @@ static esp_err_t esp_matter_command_callback_up_or_open(const ConcreteCommandPat
} }
static esp_err_t esp_matter_command_callback_down_or_close(const ConcreteCommandPath &command_path, TLVReader &tlv_data, static esp_err_t esp_matter_command_callback_down_or_close(const ConcreteCommandPath &command_path, TLVReader &tlv_data,
void *opaque_ptr) void *opaque_ptr)
{ {
chip::app::Clusters::WindowCovering::Commands::DownOrClose::DecodableType command_data; chip::app::Clusters::WindowCovering::Commands::DownOrClose::DecodableType command_data;
CHIP_ERROR error = Decode(tlv_data, command_data); CHIP_ERROR error = Decode(tlv_data, command_data);
@@ -853,7 +853,7 @@ static esp_err_t esp_matter_command_callback_down_or_close(const ConcreteCommand
} }
static esp_err_t esp_matter_command_callback_stop_motion(const ConcreteCommandPath &command_path, TLVReader &tlv_data, static esp_err_t esp_matter_command_callback_stop_motion(const ConcreteCommandPath &command_path, TLVReader &tlv_data,
void *opaque_ptr) void *opaque_ptr)
{ {
chip::app::Clusters::WindowCovering::Commands::StopMotion::DecodableType command_data; chip::app::Clusters::WindowCovering::Commands::StopMotion::DecodableType command_data;
CHIP_ERROR error = Decode(tlv_data, command_data); CHIP_ERROR error = Decode(tlv_data, command_data);
@@ -864,7 +864,7 @@ static esp_err_t esp_matter_command_callback_stop_motion(const ConcreteCommandPa
} }
static esp_err_t esp_matter_command_callback_go_to_lift_percentage(const ConcreteCommandPath &command_path, TLVReader &tlv_data, static esp_err_t esp_matter_command_callback_go_to_lift_percentage(const ConcreteCommandPath &command_path, TLVReader &tlv_data,
void *opaque_ptr) void *opaque_ptr)
{ {
chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::DecodableType command_data; chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::DecodableType command_data;
CHIP_ERROR error = Decode(tlv_data, command_data); CHIP_ERROR error = Decode(tlv_data, command_data);
@@ -875,7 +875,7 @@ static esp_err_t esp_matter_command_callback_go_to_lift_percentage(const Concret
} }
static esp_err_t esp_matter_command_callback_go_to_tilt_percentage(const ConcreteCommandPath &command_path, TLVReader &tlv_data, static esp_err_t esp_matter_command_callback_go_to_tilt_percentage(const ConcreteCommandPath &command_path, TLVReader &tlv_data,
void *opaque_ptr) void *opaque_ptr)
{ {
chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::DecodableType command_data; chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::DecodableType command_data;
CHIP_ERROR error = Decode(tlv_data, command_data); CHIP_ERROR error = Decode(tlv_data, command_data);
@@ -1179,7 +1179,7 @@ command_t *create_review_fabric_restrictions(cluster_t *cluster)
#else #else
NULL NULL
#endif #endif
); );
} }
command_t *create_review_fabric_restrictions_response(cluster_t *cluster) command_t *create_review_fabric_restrictions_response(cluster_t *cluster)
@@ -1195,7 +1195,7 @@ namespace command {
command_t *create_keep_active(cluster_t *cluster) command_t *create_keep_active(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, BridgedDeviceBasicInformation::Commands::KeepActive::Id, COMMAND_FLAG_ACCEPTED, return esp_matter::command::create(cluster, BridgedDeviceBasicInformation::Commands::KeepActive::Id, COMMAND_FLAG_ACCEPTED,
// Command callback not implemented in connectedhomeip. // Command callback not implemented in connectedhomeip.
NULL); NULL);
} }
@@ -1231,7 +1231,7 @@ namespace command {
command_t *create_reset_counts(cluster_t *cluster) command_t *create_reset_counts(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, EthernetNetworkDiagnostics::Commands::ResetCounts::Id, COMMAND_FLAG_ACCEPTED, return esp_matter::command::create(cluster, EthernetNetworkDiagnostics::Commands::ResetCounts::Id, COMMAND_FLAG_ACCEPTED,
NULL); NULL);
} }
} /* command */ } /* command */
@@ -1249,7 +1249,7 @@ command_t *create_retrieve_logs_request(cluster_t *cluster)
command_t *create_retrieve_logs_response(cluster_t *cluster) command_t *create_retrieve_logs_response(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, DiagnosticLogs::Commands::RetrieveLogsResponse::Id, return esp_matter::command::create(cluster, DiagnosticLogs::Commands::RetrieveLogsResponse::Id,
COMMAND_FLAG_GENERATED, NULL); COMMAND_FLAG_GENERATED, NULL);
} }
} /* command */ } /* command */
@@ -1271,7 +1271,7 @@ command_t *create_time_snap_shot(cluster_t *cluster)
command_t *create_time_snap_shot_response(cluster_t *cluster) command_t *create_time_snap_shot_response(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, GeneralDiagnostics::Commands::TimeSnapshotResponse::Id, COMMAND_FLAG_GENERATED, return esp_matter::command::create(cluster, GeneralDiagnostics::Commands::TimeSnapshotResponse::Id, COMMAND_FLAG_GENERATED,
NULL); NULL);
} }
command_t *create_payload_test_request(cluster_t *cluster) command_t *create_payload_test_request(cluster_t *cluster)
{ {
@@ -1291,7 +1291,7 @@ namespace command {
command_t *create_reset_watermarks(cluster_t *cluster) command_t *create_reset_watermarks(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, SoftwareDiagnostics::Commands::ResetWatermarks::Id, return esp_matter::command::create(cluster, SoftwareDiagnostics::Commands::ResetWatermarks::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
} /* command */ } /* command */
@@ -1731,7 +1731,7 @@ command_t *create_stay_active_request(cluster_t *cluster)
command_t *create_stay_active_response(cluster_t *cluster) command_t *create_stay_active_response(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, IcdManagement::Commands::StayActiveResponse::Id, return esp_matter::command::create(cluster, IcdManagement::Commands::StayActiveResponse::Id,
COMMAND_FLAG_GENERATED, NULL); COMMAND_FLAG_GENERATED, NULL);
} }
} /* command */ } /* command */
@@ -1917,7 +1917,7 @@ command_t *create_stop_with_on_off(cluster_t *cluster)
command_t *create_move_to_closest_frequency(cluster_t *cluster) command_t *create_move_to_closest_frequency(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, LevelControl::Commands::MoveToClosestFrequency::Id, COMMAND_FLAG_ACCEPTED, return esp_matter::command::create(cluster, LevelControl::Commands::MoveToClosestFrequency::Id, COMMAND_FLAG_ACCEPTED,
// Command callback not implemented in connectedhomeip. // Command callback not implemented in connectedhomeip.
NULL); NULL);
} }
@@ -2104,7 +2104,7 @@ command_t *create_resume(cluster_t *cluster)
command_t *create_operational_command_response(cluster_t *cluster) command_t *create_operational_command_response(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, OperationalState::Commands::OperationalCommandResponse::Id, return esp_matter::command::create(cluster, OperationalState::Commands::OperationalCommandResponse::Id,
COMMAND_FLAG_GENERATED, NULL); COMMAND_FLAG_GENERATED, NULL);
} }
} /* command */ } /* command */
} /* operational_state */ } /* operational_state */
@@ -2115,7 +2115,7 @@ namespace command {
command_t *create_self_test_request(cluster_t *cluster) command_t *create_self_test_request(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, SmokeCoAlarm::Commands::SelfTestRequest::Id, COMMAND_FLAG_ACCEPTED, return esp_matter::command::create(cluster, SmokeCoAlarm::Commands::SelfTestRequest::Id, COMMAND_FLAG_ACCEPTED,
esp_matter_command_callback_self_test_request); esp_matter_command_callback_self_test_request);
} }
} /* command */ } /* command */
@@ -2545,8 +2545,8 @@ namespace command {
command_t *create_get_active_dataset_request(cluster_t *cluster) command_t *create_get_active_dataset_request(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, ThreadBorderRouterManagement::Commands::GetActiveDatasetRequest::Id, return esp_matter::command::create(cluster, ThreadBorderRouterManagement::Commands::GetActiveDatasetRequest::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_get_pending_dataset_request(cluster_t *cluster) command_t *create_get_pending_dataset_request(cluster_t *cluster)
@@ -2811,8 +2811,6 @@ command_t *create_capture_snapshot_response(cluster_t *cluster)
} /* command */ } /* command */
} /*camera av stream management*/ } /*camera av stream management*/
namespace webrtc_transport_provider { namespace webrtc_transport_provider {
namespace command { namespace command {
@@ -2843,7 +2841,7 @@ command_t *create_provide_answer(cluster_t *cluster)
command_t *create_provide_ice_candidates(cluster_t *cluster) command_t *create_provide_ice_candidates(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, WebRTCTransportProvider::Commands::ProvideICECandidates::Id, COMMAND_FLAG_ACCEPTED,NULL); return esp_matter::command::create(cluster, WebRTCTransportProvider::Commands::ProvideICECandidates::Id, COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_end_session(cluster_t *cluster) command_t *create_end_session(cluster_t *cluster)
@@ -2855,38 +2853,37 @@ command_t *create_end_session(cluster_t *cluster)
}/*webrtc_transport_provider*/ }/*webrtc_transport_provider*/
namespace webrtc_transport_requestor { namespace webrtc_transport_requestor {
namespace command { namespace command {
command_t *create_offer(cluster_t *cluster) command_t *create_offer(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, WebRTCTransportRequestor::Commands::Offer::Id, COMMAND_FLAG_ACCEPTED, NULL); return esp_matter::command::create(cluster, WebRTCTransportRequestor::Commands::Offer::Id, COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_answer(cluster_t *cluster) command_t *create_answer(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, WebRTCTransportRequestor::Commands::Answer::Id, COMMAND_FLAG_ACCEPTED, NULL); return esp_matter::command::create(cluster, WebRTCTransportRequestor::Commands::Answer::Id, COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_ice_candidates(cluster_t *cluster) command_t *create_ice_candidates(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, WebRTCTransportRequestor::Commands::ICECandidates::Id, COMMAND_FLAG_ACCEPTED, NULL); return esp_matter::command::create(cluster, WebRTCTransportRequestor::Commands::ICECandidates::Id, COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_end(cluster_t *cluster) command_t *create_end(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, WebRTCTransportRequestor::Commands::End::Id, COMMAND_FLAG_ACCEPTED, NULL); return esp_matter::command::create(cluster, WebRTCTransportRequestor::Commands::End::Id, COMMAND_FLAG_ACCEPTED, NULL);
} }
} /* command */ } /* command */
}/*webrtc_transport_requestor*/ }/*webrtc_transport_requestor*/
namespace chime { namespace chime {
namespace command { namespace command {
command_t *create_play_chime_sound(cluster_t *cluster) command_t *create_play_chime_sound(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, Chime::Commands::PlayChimeSound::Id, return esp_matter::command::create(cluster, Chime::Commands::PlayChimeSound::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
} /* command */ } /* command */
@@ -2897,19 +2894,19 @@ namespace command {
command_t *create_stop(cluster_t *cluster) command_t *create_stop(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, ClosureControl::Commands::Stop::Id, return esp_matter::command::create(cluster, ClosureControl::Commands::Stop::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_move_to(cluster_t *cluster) command_t *create_move_to(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, ClosureControl::Commands::MoveTo::Id, return esp_matter::command::create(cluster, ClosureControl::Commands::MoveTo::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_calibrate(cluster_t *cluster) command_t *create_calibrate(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, ClosureControl::Commands::Calibrate::Id, return esp_matter::command::create(cluster, ClosureControl::Commands::Calibrate::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
} /* command */ } /* command */
@@ -2920,13 +2917,13 @@ namespace command {
command_t *create_set_target(cluster_t *cluster) command_t *create_set_target(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, ClosureDimension::Commands::SetTarget::Id, return esp_matter::command::create(cluster, ClosureDimension::Commands::SetTarget::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_step(cluster_t *cluster) command_t *create_step(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, ClosureDimension::Commands::Step::Id, return esp_matter::command::create(cluster, ClosureDimension::Commands::Step::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
} /* command */ } /* command */
@@ -2937,43 +2934,43 @@ namespace command {
command_t *create_mptz_set_position(cluster_t *cluster) command_t *create_mptz_set_position(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::MPTZSetPosition::Id, return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::MPTZSetPosition::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_mptz_relative_move(cluster_t *cluster) command_t *create_mptz_relative_move(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::MPTZRelativeMove::Id, return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::MPTZRelativeMove::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_mptz_move_to_preset(cluster_t *cluster) command_t *create_mptz_move_to_preset(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::MPTZMoveToPreset::Id, return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::MPTZMoveToPreset::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_mptz_save_preset(cluster_t *cluster) command_t *create_mptz_save_preset(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::MPTZSavePreset::Id, return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::MPTZSavePreset::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_mptz_remove_preset(cluster_t *cluster) command_t *create_mptz_remove_preset(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::MPTZRemovePreset::Id, return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::MPTZRemovePreset::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_dptz_set_viewport(cluster_t *cluster) command_t *create_dptz_set_viewport(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::DPTZSetViewport::Id, return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::DPTZSetViewport::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_dptz_relative_move(cluster_t *cluster) command_t *create_dptz_relative_move(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::DPTZRelativeMove::Id, return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::DPTZRelativeMove::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
} /* command */ } /* command */
@@ -2984,49 +2981,49 @@ namespace command {
command_t *create_allocate_push_transport(cluster_t *cluster) command_t *create_allocate_push_transport(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::AllocatePushTransport::Id, return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::AllocatePushTransport::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_allocate_push_transport_response(cluster_t *cluster) command_t *create_allocate_push_transport_response(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::AllocatePushTransportResponse::Id, return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::AllocatePushTransportResponse::Id,
COMMAND_FLAG_GENERATED, NULL); COMMAND_FLAG_GENERATED, NULL);
} }
command_t *create_deallocate_push_transport(cluster_t *cluster) command_t *create_deallocate_push_transport(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::DeallocatePushTransport::Id, return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::DeallocatePushTransport::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_modify_push_transport(cluster_t *cluster) command_t *create_modify_push_transport(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::ModifyPushTransport::Id, return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::ModifyPushTransport::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_set_transport_status(cluster_t *cluster) command_t *create_set_transport_status(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::SetTransportStatus::Id, return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::SetTransportStatus::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_manually_trigger_transport(cluster_t *cluster) command_t *create_manually_trigger_transport(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::ManuallyTriggerTransport::Id, return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::ManuallyTriggerTransport::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_find_transport(cluster_t *cluster) command_t *create_find_transport(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::FindTransport::Id, return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::FindTransport::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_find_transport_response(cluster_t *cluster) command_t *create_find_transport_response(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::FindTransportResponse::Id, return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::FindTransportResponse::Id,
COMMAND_FLAG_GENERATED, NULL); COMMAND_FLAG_GENERATED, NULL);
} }
} /* command */ } /* command */
@@ -3037,25 +3034,25 @@ namespace command {
command_t *create_get_tariff_component(cluster_t *cluster) command_t *create_get_tariff_component(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, CommodityTariff::Commands::GetTariffComponent::Id, return esp_matter::command::create(cluster, CommodityTariff::Commands::GetTariffComponent::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_get_tariff_component_response(cluster_t *cluster) command_t *create_get_tariff_component_response(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, CommodityTariff::Commands::GetTariffComponentResponse::Id, return esp_matter::command::create(cluster, CommodityTariff::Commands::GetTariffComponentResponse::Id,
COMMAND_FLAG_GENERATED, NULL); COMMAND_FLAG_GENERATED, NULL);
} }
command_t *create_get_day_entry(cluster_t *cluster) command_t *create_get_day_entry(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, CommodityTariff::Commands::GetDayEntry::Id, return esp_matter::command::create(cluster, CommodityTariff::Commands::GetDayEntry::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_get_day_entry_response(cluster_t *cluster) command_t *create_get_day_entry_response(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, CommodityTariff::Commands::GetDayEntryResponse::Id, return esp_matter::command::create(cluster, CommodityTariff::Commands::GetDayEntryResponse::Id,
COMMAND_FLAG_GENERATED, NULL); COMMAND_FLAG_GENERATED, NULL);
} }
} /* command */ } /* command */
@@ -3066,25 +3063,25 @@ namespace command {
command_t *create_get_detailed_price_request(cluster_t *cluster) command_t *create_get_detailed_price_request(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, CommodityPrice::Commands::GetDetailedPriceRequest::Id, return esp_matter::command::create(cluster, CommodityPrice::Commands::GetDetailedPriceRequest::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_get_detailed_price_response(cluster_t *cluster) command_t *create_get_detailed_price_response(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, CommodityPrice::Commands::GetDetailedPriceResponse::Id, return esp_matter::command::create(cluster, CommodityPrice::Commands::GetDetailedPriceResponse::Id,
COMMAND_FLAG_GENERATED, NULL); COMMAND_FLAG_GENERATED, NULL);
} }
command_t *create_get_detailed_forecast_request(cluster_t *cluster) command_t *create_get_detailed_forecast_request(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, CommodityPrice::Commands::GetDetailedForecastRequest::Id, return esp_matter::command::create(cluster, CommodityPrice::Commands::GetDetailedForecastRequest::Id,
COMMAND_FLAG_ACCEPTED, NULL); COMMAND_FLAG_ACCEPTED, NULL);
} }
command_t *create_get_detailed_forecast_response(cluster_t *cluster) command_t *create_get_detailed_forecast_response(cluster_t *cluster)
{ {
return esp_matter::command::create(cluster, CommodityPrice::Commands::GetDetailedForecastResponse::Id, return esp_matter::command::create(cluster, CommodityPrice::Commands::GetDetailedForecastResponse::Id,
COMMAND_FLAG_GENERATED, NULL); COMMAND_FLAG_GENERATED, NULL);
} }
} /* command */ } /* command */
@@ -382,7 +382,6 @@ namespace activated_carbon_filter_monitoring {
namespace command = resource_monitoring::command; namespace command = resource_monitoring::command;
} /* activated_carbon_filter_monitoring */ } /* activated_carbon_filter_monitoring */
namespace mode_base { namespace mode_base {
namespace command { namespace command {
command_t *create_change_to_mode(cluster_t *cluster); command_t *create_change_to_mode(cluster_t *cluster);
@@ -545,7 +544,6 @@ command_t *create_end(cluster_t *cluster);
} /* command */ } /* command */
}/*webrtc transport requestor*/ }/*webrtc transport requestor*/
namespace chime { namespace chime {
namespace command { namespace command {
command_t *create_play_chime_sound(cluster_t *cluster); command_t *create_play_chime_sound(cluster_t *cluster);
@@ -229,7 +229,7 @@ static esp_err_t init_identification(endpoint_t *endpoint)
/* Init identify if exists and not initialized */ /* Init identify if exists and not initialized */
if (identify_cluster != nullptr && current_endpoint->identify == NULL) { if (identify_cluster != nullptr && current_endpoint->identify == NULL) {
_attribute_t *identify_type_attr = (_attribute_t *)attribute::get( _attribute_t *identify_type_attr = (_attribute_t *)attribute::get(
identify_cluster, chip::app::Clusters::Identify::Attributes::IdentifyType::Id); identify_cluster, chip::app::Clusters::Identify::Attributes::IdentifyType::Id);
if (identify_type_attr) { if (identify_type_attr) {
return identification::init(current_endpoint->endpoint_id, identify_type_attr->attribute_val.u8); return identification::init(current_endpoint->endpoint_id, identify_type_attr->attribute_val.u8);
} else { } else {
@@ -560,7 +560,7 @@ attribute_t *create(cluster_t *cluster, uint32_t attribute_id, uint16_t flags, e
attribute->endpoint_id = current_cluster->endpoint_id; attribute->endpoint_id = current_cluster->endpoint_id;
attribute->attribute_val_type = val.type; attribute->attribute_val_type = val.type;
if (val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING || val.type == ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING || if (val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING || val.type == ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING ||
val.type == ESP_MATTER_VAL_TYPE_OCTET_STRING || val.type == ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING) { val.type == ESP_MATTER_VAL_TYPE_OCTET_STRING || val.type == ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING) {
attribute->attribute_val.a.max = max_val_size; attribute->attribute_val.a.max = max_val_size;
val.val.a.max = max_val_size; val.val.a.max = max_val_size;
} }
@@ -599,10 +599,10 @@ static esp_err_t free_attribute(attribute_t *attribute)
/* Delete val here, if required */ /* Delete val here, if required */
if (current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_CHAR_STRING || if (current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_CHAR_STRING ||
current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING || current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING ||
current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_OCTET_STRING || current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_OCTET_STRING ||
current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING || current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING ||
current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_ARRAY) { current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_ARRAY) {
/* Free buf */ /* Free buf */
esp_matter_mem_free(current_attribute->attribute_val.a.b); esp_matter_mem_free(current_attribute->attribute_val.a.b);
} }
@@ -684,7 +684,7 @@ static void deferred_attribute_write(chip::System::Layer *layer, void *attribute
ESP_LOGI(TAG, "Store the deferred attribute 0x%" PRIx32 " of cluster 0x%" PRIX32 " on endpoint 0x%" PRIx16, ESP_LOGI(TAG, "Store the deferred attribute 0x%" PRIx32 " of cluster 0x%" PRIX32 " on endpoint 0x%" PRIx16,
current_attribute->attribute_id, current_attribute->cluster_id, current_attribute->endpoint_id); current_attribute->attribute_id, current_attribute->cluster_id, current_attribute->endpoint_id);
store_val_in_nvs(current_attribute->endpoint_id, current_attribute->cluster_id, current_attribute->attribute_id, store_val_in_nvs(current_attribute->endpoint_id, current_attribute->cluster_id, current_attribute->attribute_id,
{current_attribute->attribute_val_type, current_attribute->attribute_val}); {current_attribute->attribute_val_type, current_attribute->attribute_val});
} }
esp_err_t set_val_internal(attribute_t *attribute, esp_matter_attr_val_t *val, bool call_callbacks) esp_err_t set_val_internal(attribute_t *attribute, esp_matter_attr_val_t *val, bool call_callbacks)
@@ -701,7 +701,7 @@ esp_err_t set_val_internal(attribute_t *attribute, esp_matter_attr_val_t *val, b
VerifyOrReturnError(current_attribute->attribute_val_type == val->type, ESP_ERR_INVALID_ARG, VerifyOrReturnError(current_attribute->attribute_val_type == val->type, ESP_ERR_INVALID_ARG,
ESP_LOGE(TAG, "Different value type : Expected Type : %u Attempted Type: %u", ESP_LOGE(TAG, "Different value type : Expected Type : %u Attempted Type: %u",
current_attribute->attribute_val_type, val->type)); current_attribute->attribute_val_type, val->type));
if ((current_attribute->flags & ATTRIBUTE_FLAG_MIN_MAX) && current_attribute->bounds) { if ((current_attribute->flags & ATTRIBUTE_FLAG_MIN_MAX) && current_attribute->bounds) {
if (compare_attr_val_with_bounds(*val, *current_attribute->bounds) != 0) { if (compare_attr_val_with_bounds(*val, *current_attribute->bounds) != 0) {
@@ -718,12 +718,12 @@ esp_err_t set_val_internal(attribute_t *attribute, esp_matter_attr_val_t *val, b
/* Callback to application */ /* Callback to application */
if (call_callbacks) { if (call_callbacks) {
ESP_RETURN_ON_ERROR(execute_callback(attribute::PRE_UPDATE, current_attribute->endpoint_id, ESP_RETURN_ON_ERROR(execute_callback(attribute::PRE_UPDATE, current_attribute->endpoint_id,
current_attribute->cluster_id, current_attribute->attribute_id, val), current_attribute->cluster_id, current_attribute->attribute_id, val),
TAG, "Failed to execute pre update callback"); TAG, "Failed to execute pre update callback");
} }
// TODO: call pre attribute change function is the cluster has the flag // TODO: call pre attribute change function is the cluster has the flag
if (val->type == ESP_MATTER_VAL_TYPE_CHAR_STRING || val->type == ESP_MATTER_VAL_TYPE_OCTET_STRING || if (val->type == ESP_MATTER_VAL_TYPE_CHAR_STRING || val->type == ESP_MATTER_VAL_TYPE_OCTET_STRING ||
val->type == ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING || val->type == ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING) { val->type == ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING || val->type == ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING) {
uint16_t null_len = uint16_t null_len =
(val->type == ESP_MATTER_VAL_TYPE_CHAR_STRING || val->type == ESP_MATTER_VAL_TYPE_OCTET_STRING) (val->type == ESP_MATTER_VAL_TYPE_CHAR_STRING || val->type == ESP_MATTER_VAL_TYPE_OCTET_STRING)
? UINT8_MAX ? UINT8_MAX
@@ -766,7 +766,7 @@ esp_err_t set_val_internal(attribute_t *attribute, esp_matter_attr_val_t *val, b
if (attr_change_function) { if (attr_change_function) {
attr_change_function(chip::app::ConcreteAttributePath( attr_change_function(chip::app::ConcreteAttributePath(
current_attribute->endpoint_id, current_attribute->cluster_id, current_attribute->attribute_id)); current_attribute->endpoint_id, current_attribute->cluster_id, current_attribute->attribute_id));
} }
} }
if (current_attribute->flags & ATTRIBUTE_FLAG_NONVOLATILE) { if (current_attribute->flags & ATTRIBUTE_FLAG_NONVOLATILE) {
@@ -850,9 +850,9 @@ static esp_err_t get_val_from_tlv_data(const uint8_t *tlv_data, uint32_t tlv_len
// and pass on to the user. This is only required for string and octet string types // and pass on to the user. This is only required for string and octet string types
bool is_type_string = (val->type == ESP_MATTER_VAL_TYPE_CHAR_STRING bool is_type_string = (val->type == ESP_MATTER_VAL_TYPE_CHAR_STRING
|| val->type == ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING); || val->type == ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING);
bool is_type_octet_string = (val->type == ESP_MATTER_VAL_TYPE_OCTET_STRING bool is_type_octet_string = (val->type == ESP_MATTER_VAL_TYPE_OCTET_STRING
|| val->type == ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING); || val->type == ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING);
if (is_type_string || is_type_octet_string) { if (is_type_string || is_type_octet_string) {
// for empty strings, we need to copy at least null terminator // for empty strings, we need to copy at least null terminator
@@ -872,8 +872,8 @@ static esp_err_t get_val_from_tlv_data(const uint8_t *tlv_data, uint32_t tlv_len
// Helper function to find the cluster_id and attribute_id for internally managed attributes // Helper function to find the cluster_id and attribute_id for internally managed attributes
static esp_err_t find_cluster_and_endpoint_id_for_internally_managed_attribute(const _attribute_base_t *attribute_base, static esp_err_t find_cluster_and_endpoint_id_for_internally_managed_attribute(const _attribute_base_t *attribute_base,
uint16_t &out_endpoint_id, uint16_t &out_endpoint_id,
uint32_t &out_cluster_id) uint32_t &out_cluster_id)
{ {
VerifyOrReturnError(attribute_base, ESP_ERR_INVALID_ARG); VerifyOrReturnError(attribute_base, ESP_ERR_INVALID_ARG);
_node_t *node = (_node_t *)node::get(); _node_t *node = (_node_t *)node::get();
@@ -938,7 +938,7 @@ esp_err_t get_val(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_
} }
static esp_err_t get_path_from_attribute_handle(const _attribute_t *attribute, uint16_t &endpoint_id, static esp_err_t get_path_from_attribute_handle(const _attribute_t *attribute, uint16_t &endpoint_id,
uint32_t &cluster_id, uint32_t &attribute_id) uint32_t &cluster_id, uint32_t &attribute_id)
{ {
attribute_id = attribute->attribute_id; attribute_id = attribute->attribute_id;
if (attribute->flags & ATTRIBUTE_FLAG_MANAGED_INTERNALLY) { if (attribute->flags & ATTRIBUTE_FLAG_MANAGED_INTERNALLY) {
@@ -993,7 +993,7 @@ esp_matter_val_type_t get_val_type(uint16_t endpoint_id, uint32_t cluster_id, ui
// Helper function: Set value via WriteAttribute with kInternal flag (for SCI/AAI writable attributes) // Helper function: Set value via WriteAttribute with kInternal flag (for SCI/AAI writable attributes)
static esp_err_t set_val_via_write_attribute(uint16_t endpoint_id, uint32_t cluster_id, static esp_err_t set_val_via_write_attribute(uint16_t endpoint_id, uint32_t cluster_id,
uint32_t attribute_id, esp_matter_attr_val_t *val) uint32_t attribute_id, esp_matter_attr_val_t *val)
{ {
chip::Platform::ScopedMemoryBuffer<uint8_t> tlv_buffer; chip::Platform::ScopedMemoryBuffer<uint8_t> tlv_buffer;
tlv_buffer.Calloc(k_max_tlv_size_to_write_attribute_value); tlv_buffer.Calloc(k_max_tlv_size_to_write_attribute_value);
@@ -1094,11 +1094,11 @@ esp_err_t add_bounds(attribute_t *attribute, esp_matter_attr_val_t min, esp_matt
/* Check if bounds can be set */ /* Check if bounds can be set */
if (current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_CHAR_STRING || if (current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_CHAR_STRING ||
current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING || current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING ||
current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_OCTET_STRING || current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_OCTET_STRING ||
current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING || current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING ||
current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_ARRAY || current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_ARRAY ||
current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_BOOLEAN) { current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_BOOLEAN) {
ESP_LOGE(TAG, "Bounds cannot be set for string/array/boolean type attributes"); ESP_LOGE(TAG, "Bounds cannot be set for string/array/boolean type attributes");
return ESP_ERR_INVALID_ARG; return ESP_ERR_INVALID_ARG;
} }
@@ -1155,10 +1155,10 @@ esp_err_t set_override_callback(attribute_t *attribute, callback_t callback)
"Attribute is not managed by esp matter data model"); "Attribute is not managed by esp matter data model");
if (current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_ARRAY || if (current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_ARRAY ||
current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_OCTET_STRING || current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_OCTET_STRING ||
current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_CHAR_STRING || current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_CHAR_STRING ||
current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING || current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING ||
current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING) { current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING) {
// The override callback might allocate memory and we have no way to free the memory // The override callback might allocate memory and we have no way to free the memory
// TODO: Add memory-safe override callback for these attribute types // TODO: Add memory-safe override callback for these attribute types
ESP_LOGE(TAG, "Cannot set override callback for attribute 0x%" PRIX32, current_attribute->attribute_id); ESP_LOGE(TAG, "Cannot set override callback for attribute 0x%" PRIX32, current_attribute->attribute_id);
@@ -1921,11 +1921,13 @@ uint32_t get_cluster_count(uint32_t endpoint_id, uint32_t cluster_id, uint8_t cl
// lambda to count all matching clusters for an endpoint // lambda to count all matching clusters for an endpoint
auto get_count_on_all_clusters = [&check_cluster_flags](endpoint_t *endpoint) -> uint32_t { auto get_count_on_all_clusters = [&check_cluster_flags](endpoint_t *endpoint) -> uint32_t {
uint32_t result = 0; uint32_t result = 0;
if (!endpoint) if (!endpoint) {
return result; return result;
}
cluster_t *cluster = cluster::get_first(endpoint); cluster_t *cluster = cluster::get_first(endpoint);
while (cluster) { while (cluster)
{
result += check_cluster_flags(cluster); result += check_cluster_flags(cluster);
cluster = cluster::get_next(cluster); cluster = cluster::get_next(cluster);
} }
@@ -1934,9 +1936,10 @@ uint32_t get_cluster_count(uint32_t endpoint_id, uint32_t cluster_id, uint8_t cl
// lambda to find and count a specific cluster // lambda to find and count a specific cluster
auto get_count_on_specific_cluster = [&check_cluster_flags](const endpoint_t *endpoint, auto get_count_on_specific_cluster = [&check_cluster_flags](const endpoint_t *endpoint,
uint32_t cluster_id) -> uint32_t { uint32_t cluster_id) -> uint32_t {
if (!endpoint) if (!endpoint) {
return 0; return 0;
}
cluster_t *cluster = cluster::get((endpoint_t *)endpoint, cluster_id); cluster_t *cluster = cluster::get((endpoint_t *)endpoint, cluster_id);
return check_cluster_flags(cluster); return check_cluster_flags(cluster);
}; };
@@ -442,7 +442,6 @@ esp_err_t set_identify(uint16_t endpoint_id, void *identify);
*/ */
esp_err_t enable(endpoint_t *endpoint); esp_err_t enable(endpoint_t *endpoint);
/** Check if attribute is enabled /** Check if attribute is enabled
* *
* Check if the attribute of a cluster is enabled on an endpoint. * Check if the attribute of a cluster is enabled on an endpoint.
@@ -532,14 +531,14 @@ typedef void (*function_cluster_shutdown_t)(uint16_t endpoint_id);
* *
* This will be called when attributes are change for the cluster. * This will be called when attributes are change for the cluster.
*/ */
typedef void (*function_attribute_change_t)(const chip::app::ConcreteAttributePath & attributePath); typedef void (*function_attribute_change_t)(const chip::app::ConcreteAttributePath &attributePath);
/** Pre attribute change function /** Pre attribute change function
* *
* This function is called before an attribute changes. * This function is called before an attribute changes.
*/ */
typedef chip::Protocols::InteractionModel::Status (*function_pre_attribute_change_t)( typedef chip::Protocols::InteractionModel::Status(*function_pre_attribute_change_t)(
const chip::app::ConcreteAttributePath & attributePath, EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); const chip::app::ConcreteAttributePath &attributePath, EmberAfAttributeType attributeType, uint16_t size, uint8_t * value);
/** Initialization callback /** Initialization callback
* *
@@ -851,7 +850,6 @@ attribute_t *get(cluster_t *cluster, uint32_t attribute_id);
*/ */
attribute_t *get(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id); attribute_t *get(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id);
/** Get first attribute /** Get first attribute
* *
* Get the first attribute present on the cluster. * Get the first attribute present on the cluster.
@@ -913,7 +911,7 @@ uint32_t get_id(attribute_t *attribute);
* @return error in case of failure. * @return error in case of failure.
*/ */
esp_err_t set_val(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_err_t set_val(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id,
esp_matter_attr_val_t *val, bool call_callbacks = true); esp_matter_attr_val_t *val, bool call_callbacks = true);
/** Set attribute val, similar to set_val but with attribute handle /** Set attribute val, similar to set_val but with attribute handle
* *
@@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include <inttypes.h> #include <inttypes.h>
#include <esp_matter_delegate_callbacks.h> #include <esp_matter_delegate_callbacks.h>
#include <esp_matter_core.h> #include <esp_matter_core.h>
@@ -81,79 +80,79 @@ static uint32_t get_feature_map_value(uint16_t endpoint_id, uint32_t cluster_id)
chip::BitMask<EnergyEvse::OptionalAttributes> get_energy_evse_enabled_optional_attributes(uint16_t endpoint_id) chip::BitMask<EnergyEvse::OptionalAttributes> get_energy_evse_enabled_optional_attributes(uint16_t endpoint_id)
{ {
chip::BitMask<EnergyEvse::OptionalAttributes> optional_attrs = 0; chip::BitMask<EnergyEvse::OptionalAttributes> optional_attrs = 0;
if (endpoint::is_attribute_enabled(endpoint_id, EnergyEvse::Id, EnergyEvse::Attributes::UserMaximumChargeCurrent::Id)) { if (endpoint::is_attribute_enabled(endpoint_id, EnergyEvse::Id, EnergyEvse::Attributes::UserMaximumChargeCurrent::Id)) {
optional_attrs.Set(EnergyEvse::OptionalAttributes::kSupportsUserMaximumChargingCurrent); optional_attrs.Set(EnergyEvse::OptionalAttributes::kSupportsUserMaximumChargingCurrent);
} }
if (endpoint::is_attribute_enabled(endpoint_id, EnergyEvse::Id, EnergyEvse::Attributes::RandomizationDelayWindow::Id)) { if (endpoint::is_attribute_enabled(endpoint_id, EnergyEvse::Id, EnergyEvse::Attributes::RandomizationDelayWindow::Id)) {
optional_attrs.Set(EnergyEvse::OptionalAttributes::kSupportsRandomizationWindow); optional_attrs.Set(EnergyEvse::OptionalAttributes::kSupportsRandomizationWindow);
} }
if (endpoint::is_attribute_enabled(endpoint_id, EnergyEvse::Id, EnergyEvse::Attributes::ApproximateEVEfficiency::Id)) { if (endpoint::is_attribute_enabled(endpoint_id, EnergyEvse::Id, EnergyEvse::Attributes::ApproximateEVEfficiency::Id)) {
optional_attrs.Set(EnergyEvse::OptionalAttributes::kSupportsApproximateEvEfficiency); optional_attrs.Set(EnergyEvse::OptionalAttributes::kSupportsApproximateEvEfficiency);
} }
return optional_attrs; return optional_attrs;
} }
chip::BitMask<ElectricalPowerMeasurement::OptionalAttributes> get_electrical_power_measurement_enabled_optional_attributes(uint16_t endpoint_id) chip::BitMask<ElectricalPowerMeasurement::OptionalAttributes> get_electrical_power_measurement_enabled_optional_attributes(uint16_t endpoint_id)
{ {
chip::BitMask<ElectricalPowerMeasurement::OptionalAttributes> optional_attrs = 0; chip::BitMask<ElectricalPowerMeasurement::OptionalAttributes> optional_attrs = 0;
// Check for various optional attributes // Check for various optional attributes
if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::Ranges::Id)) { if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::Ranges::Id)) {
optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeRanges); optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeRanges);
} }
if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::Voltage::Id)) { if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::Voltage::Id)) {
optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeVoltage); optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeVoltage);
} }
if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::ActiveCurrent::Id)) { if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::ActiveCurrent::Id)) {
optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeActiveCurrent); optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeActiveCurrent);
} }
if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::ReactiveCurrent::Id)) { if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::ReactiveCurrent::Id)) {
optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeReactiveCurrent); optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeReactiveCurrent);
} }
if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::ApparentCurrent::Id)) { if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::ApparentCurrent::Id)) {
optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeApparentCurrent); optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeApparentCurrent);
} }
if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::ReactivePower::Id)) { if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::ReactivePower::Id)) {
optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeReactivePower); optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeReactivePower);
} }
if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::ApparentPower::Id)) { if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::ApparentPower::Id)) {
optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeApparentPower); optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeApparentPower);
} }
if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::RMSVoltage::Id)) { if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::RMSVoltage::Id)) {
optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeRMSVoltage); optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeRMSVoltage);
} }
if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::RMSCurrent::Id)) { if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::RMSCurrent::Id)) {
optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeRMSCurrent); optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeRMSCurrent);
} }
if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::RMSPower::Id)) { if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::RMSPower::Id)) {
optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeRMSPower); optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeRMSPower);
} }
if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::Frequency::Id)) { if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::Frequency::Id)) {
optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeFrequency); optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeFrequency);
} }
if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::PowerFactor::Id)) { if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::PowerFactor::Id)) {
optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributePowerFactor); optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributePowerFactor);
} }
if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::NeutralCurrent::Id)) { if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::NeutralCurrent::Id)) {
optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeNeutralCurrent); optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeNeutralCurrent);
} }
return optional_attrs; return optional_attrs;
} }
@@ -161,11 +160,11 @@ chip::BitMask<ElectricalPowerMeasurement::OptionalAttributes> get_electrical_pow
chip::BitMask<EnergyEvse::OptionalCommands> get_energy_evse_enabled_optional_commands(uint16_t endpoint_id) chip::BitMask<EnergyEvse::OptionalCommands> get_energy_evse_enabled_optional_commands(uint16_t endpoint_id)
{ {
chip::BitMask<EnergyEvse::OptionalCommands> optional_cmds = 0; chip::BitMask<EnergyEvse::OptionalCommands> optional_cmds = 0;
if (endpoint::is_command_enabled(endpoint_id, EnergyEvse::Id, EnergyEvse::Commands::StartDiagnostics::Id)) { if (endpoint::is_command_enabled(endpoint_id, EnergyEvse::Id, EnergyEvse::Commands::StartDiagnostics::Id)) {
optional_cmds.Set(EnergyEvse::OptionalCommands::kSupportsStartDiagnostics); optional_cmds.Set(EnergyEvse::OptionalCommands::kSupportsStartDiagnostics);
} }
return optional_cmds; return optional_cmds;
} }
@@ -222,8 +221,7 @@ void MicrowaveOvenModeDelegateInitCB(void *delegate, uint16_t endpoint_id)
ModeBase::Delegate *mode_delegate = static_cast<ModeBase::Delegate*>(delegate); ModeBase::Delegate *mode_delegate = static_cast<ModeBase::Delegate*>(delegate);
ModeBase::Instance * modeInstance = nullptr; ModeBase::Instance * modeInstance = nullptr;
// Create new instance of MicrowaveOvenMode if not found in the map, otherwise use existing instance. // Create new instance of MicrowaveOvenMode if not found in the map, otherwise use existing instance.
if(s_microwave_oven_mode_instances.find(endpoint_id) == s_microwave_oven_mode_instances.end()) if (s_microwave_oven_mode_instances.find(endpoint_id) == s_microwave_oven_mode_instances.end()) {
{
uint32_t feature_map = get_feature_map_value(endpoint_id, MicrowaveOvenMode::Id); uint32_t feature_map = get_feature_map_value(endpoint_id, MicrowaveOvenMode::Id);
modeInstance = new ModeBase::Instance(mode_delegate, endpoint_id, MicrowaveOvenMode::Id, feature_map); modeInstance = new ModeBase::Instance(mode_delegate, endpoint_id, MicrowaveOvenMode::Id, feature_map);
s_microwave_oven_mode_instances[endpoint_id] = modeInstance; s_microwave_oven_mode_instances[endpoint_id] = modeInstance;
@@ -251,7 +249,7 @@ void EnergyEvseDelegateInitCB(void *delegate, uint16_t endpoint_id)
chip::BitMask<EnergyEvse::OptionalAttributes> optional_attrs = get_energy_evse_enabled_optional_attributes(endpoint_id); chip::BitMask<EnergyEvse::OptionalAttributes> optional_attrs = get_energy_evse_enabled_optional_attributes(endpoint_id);
chip::BitMask<EnergyEvse::OptionalCommands> optional_cmds = get_energy_evse_enabled_optional_commands(endpoint_id); chip::BitMask<EnergyEvse::OptionalCommands> optional_cmds = get_energy_evse_enabled_optional_commands(endpoint_id);
energyEvseInstance = new EnergyEvse::Instance(endpoint_id, *energy_evse_delegate, chip::BitMask<EnergyEvse::Feature, uint32_t>(feature_map), energyEvseInstance = new EnergyEvse::Instance(endpoint_id, *energy_evse_delegate, chip::BitMask<EnergyEvse::Feature, uint32_t>(feature_map),
optional_attrs, optional_cmds); optional_attrs, optional_cmds);
(void)energyEvseInstance->Init(); (void)energyEvseInstance->Init();
} }
@@ -265,32 +263,30 @@ void MicrowaveOvenControlDelegateInitCB(void *delegate, uint16_t endpoint_id)
VerifyOrReturn(delegate != nullptr && microwave_oven_mode_delegate != nullptr && operational_state_delegate != nullptr); VerifyOrReturn(delegate != nullptr && microwave_oven_mode_delegate != nullptr && operational_state_delegate != nullptr);
ModeBase::Instance* microwaveOvenModeInstance = nullptr; ModeBase::Instance* microwaveOvenModeInstance = nullptr;
OperationalState::Instance* operationalStateInstance = nullptr; OperationalState::Instance* operationalStateInstance = nullptr;
// Create new instance of MicrowaveOvenMode if not found in the map, otherwise use existing instance. // Create new instance of MicrowaveOvenMode if not found in the map, otherwise use existing instance.
if(s_microwave_oven_mode_instances.find(endpoint_id) == s_microwave_oven_mode_instances.end()) if (s_microwave_oven_mode_instances.find(endpoint_id) == s_microwave_oven_mode_instances.end()) {
{
uint32_t feature_map = get_feature_map_value(endpoint_id, MicrowaveOvenMode::Id); uint32_t feature_map = get_feature_map_value(endpoint_id, MicrowaveOvenMode::Id);
microwaveOvenModeInstance = new ModeBase::Instance(microwave_oven_mode_delegate, endpoint_id, MicrowaveOvenMode::Id, feature_map); microwaveOvenModeInstance = new ModeBase::Instance(microwave_oven_mode_delegate, endpoint_id, MicrowaveOvenMode::Id, feature_map);
s_microwave_oven_mode_instances[endpoint_id] = microwaveOvenModeInstance; s_microwave_oven_mode_instances[endpoint_id] = microwaveOvenModeInstance;
} else { } else {
microwaveOvenModeInstance = s_microwave_oven_mode_instances[endpoint_id]; microwaveOvenModeInstance = s_microwave_oven_mode_instances[endpoint_id];
} }
// Create new instance of OperationalState if not found in the map, otherwise use existing instance. // Create new instance of OperationalState if not found in the map, otherwise use existing instance.
if(s_operational_state_instances.find(endpoint_id) == s_operational_state_instances.end()) if (s_operational_state_instances.find(endpoint_id) == s_operational_state_instances.end()) {
{
operationalStateInstance = new OperationalState::Instance(operational_state_delegate, endpoint_id); operationalStateInstance = new OperationalState::Instance(operational_state_delegate, endpoint_id);
s_operational_state_instances[endpoint_id] = operationalStateInstance; s_operational_state_instances[endpoint_id] = operationalStateInstance;
} else { } else {
operationalStateInstance = s_operational_state_instances[endpoint_id]; operationalStateInstance = s_operational_state_instances[endpoint_id];
} }
// Create MicrowaveOvenControl instance // Create MicrowaveOvenControl instance
static MicrowaveOvenControl::Instance * microwaveOvenControlInstance = nullptr; static MicrowaveOvenControl::Instance * microwaveOvenControlInstance = nullptr;
MicrowaveOvenControl::Delegate *microwave_oven_control_delegate = static_cast<MicrowaveOvenControl::Delegate*>(delegate); MicrowaveOvenControl::Delegate *microwave_oven_control_delegate = static_cast<MicrowaveOvenControl::Delegate*>(delegate);
uint32_t feature_map = get_feature_map_value(endpoint_id, MicrowaveOvenControl::Id); uint32_t feature_map = get_feature_map_value(endpoint_id, MicrowaveOvenControl::Id);
microwaveOvenControlInstance = new MicrowaveOvenControl::Instance(microwave_oven_control_delegate, endpoint_id, MicrowaveOvenControl::Id, feature_map, microwaveOvenControlInstance = new MicrowaveOvenControl::Instance(microwave_oven_control_delegate, endpoint_id, MicrowaveOvenControl::Id, feature_map,
*operationalStateInstance, *microwaveOvenModeInstance); *operationalStateInstance, *microwaveOvenModeInstance);
(void)microwaveOvenControlInstance->Init(); (void)microwaveOvenControlInstance->Init();
} }
@@ -300,8 +296,7 @@ void OperationalStateDelegateInitCB(void *delegate, uint16_t endpoint_id)
static OperationalState::Instance * operationalStateInstance = nullptr; static OperationalState::Instance * operationalStateInstance = nullptr;
OperationalState::Delegate *operational_state_delegate = static_cast<OperationalState::Delegate*>(delegate); OperationalState::Delegate *operational_state_delegate = static_cast<OperationalState::Delegate*>(delegate);
// Create new instance of OperationalState if not found in the map, otherwise use existing instance. // Create new instance of OperationalState if not found in the map, otherwise use existing instance.
if(s_operational_state_instances.find(endpoint_id) == s_operational_state_instances.end()) if (s_operational_state_instances.find(endpoint_id) == s_operational_state_instances.end()) {
{
operationalStateInstance = new OperationalState::Instance(operational_state_delegate, endpoint_id); operationalStateInstance = new OperationalState::Instance(operational_state_delegate, endpoint_id);
s_operational_state_instances[endpoint_id] = operationalStateInstance; s_operational_state_instances[endpoint_id] = operationalStateInstance;
} else { } else {
@@ -403,7 +398,7 @@ void ElectricalPowerMeasurementDelegateInitCB(void *delegate, uint16_t endpoint_
uint32_t feature_map = get_feature_map_value(endpoint_id, ElectricalPowerMeasurement::Id); uint32_t feature_map = get_feature_map_value(endpoint_id, ElectricalPowerMeasurement::Id);
chip::BitMask<ElectricalPowerMeasurement::OptionalAttributes> optional_attrs = get_electrical_power_measurement_enabled_optional_attributes(endpoint_id); chip::BitMask<ElectricalPowerMeasurement::OptionalAttributes> optional_attrs = get_electrical_power_measurement_enabled_optional_attributes(endpoint_id);
electricalPowerMeasurementInstance = new ElectricalPowerMeasurement::Instance(endpoint_id, *electrical_power_measurement_delegate, electricalPowerMeasurementInstance = new ElectricalPowerMeasurement::Instance(endpoint_id, *electrical_power_measurement_delegate,
chip::BitMask<ElectricalPowerMeasurement::Feature, uint32_t>(feature_map), optional_attrs); chip::BitMask<ElectricalPowerMeasurement::Feature, uint32_t>(feature_map), optional_attrs);
(void)electricalPowerMeasurementInstance->Init(); (void)electricalPowerMeasurementInstance->Init();
} }
@@ -466,8 +461,7 @@ void ServiceAreaDelegateInitCB(void *delegate, uint16_t endpoint_id)
void WaterHeaterManagementDelegateInitCB(void *delegate, uint16_t endpoint_id) void WaterHeaterManagementDelegateInitCB(void *delegate, uint16_t endpoint_id)
{ {
if(delegate == nullptr) if (delegate == nullptr) {
{
return; return;
} }
static WaterHeaterManagement::Instance * wHtrInstance = nullptr; static WaterHeaterManagement::Instance * wHtrInstance = nullptr;
@@ -479,8 +473,7 @@ void WaterHeaterManagementDelegateInitCB(void *delegate, uint16_t endpoint_id)
void EnergyPreferenceDelegateInitCB(void *delegate, uint16_t endpoint_id) void EnergyPreferenceDelegateInitCB(void *delegate, uint16_t endpoint_id)
{ {
if(delegate == nullptr) if (delegate == nullptr) {
{
return; return;
} }
EnergyPreference::Delegate *energy_preference_delegate = static_cast<EnergyPreference::Delegate*>(delegate); EnergyPreference::Delegate *energy_preference_delegate = static_cast<EnergyPreference::Delegate*>(delegate);
@@ -489,8 +482,7 @@ void EnergyPreferenceDelegateInitCB(void *delegate, uint16_t endpoint_id)
void CommissionerControlDelegateInitCB(void *delegate, uint16_t endpoint_id) void CommissionerControlDelegateInitCB(void *delegate, uint16_t endpoint_id)
{ {
if(delegate == nullptr) if (delegate == nullptr) {
{
return; return;
} }
CommissionerControl::Delegate *commissioner_control_delegate = static_cast<CommissionerControl::Delegate*>(delegate); CommissionerControl::Delegate *commissioner_control_delegate = static_cast<CommissionerControl::Delegate*>(delegate);
@@ -509,7 +501,6 @@ void ActionsDelegateInitCB(void *delegate, uint16_t endpoint_id)
(void)actionsServer->Init(); (void)actionsServer->Init();
} }
void ThermostatDelegateInitCB(void *delegate, uint16_t endpoint_id) void ThermostatDelegateInitCB(void *delegate, uint16_t endpoint_id)
{ {
VerifyOrReturn(delegate != nullptr); VerifyOrReturn(delegate != nullptr);
@@ -548,7 +539,6 @@ void ClosureControlDelegateInitCB(void *delegate, uint16_t endpoint_id)
(void)server_interface->Init(); (void)server_interface->Init();
} }
void ClosureDimensionDelegateInitCB(void *delegate, uint16_t endpoint_id) void ClosureDimensionDelegateInitCB(void *delegate, uint16_t endpoint_id)
{ {
VerifyOrReturn(delegate != nullptr); VerifyOrReturn(delegate != nullptr);
@@ -559,7 +549,6 @@ void ClosureDimensionDelegateInitCB(void *delegate, uint16_t endpoint_id)
(void)server_interface->Init(); (void)server_interface->Init();
} }
void PushAvStreamTransportDelegateInitCB(void *delegate, uint16_t endpoint_id) void PushAvStreamTransportDelegateInitCB(void *delegate, uint16_t endpoint_id)
{ {
VerifyOrReturn(delegate != nullptr); VerifyOrReturn(delegate != nullptr);
@@ -567,7 +556,6 @@ void PushAvStreamTransportDelegateInitCB(void *delegate, uint16_t endpoint_id)
chip::app::Clusters::PushAvStreamTransport::SetDelegate(endpoint_id, push_av_stream_transport_delegate); chip::app::Clusters::PushAvStreamTransport::SetDelegate(endpoint_id, push_av_stream_transport_delegate);
} }
void CommodityTariffDelegateInitCB(void *delegate, uint16_t endpoint_id) void CommodityTariffDelegateInitCB(void *delegate, uint16_t endpoint_id)
{ {
VerifyOrReturn(delegate != nullptr); VerifyOrReturn(delegate != nullptr);
@@ -577,7 +565,6 @@ void CommodityTariffDelegateInitCB(void *delegate, uint16_t endpoint_id)
(void)commodity_tariff_instance->Init(); (void)commodity_tariff_instance->Init();
} }
void CommodityPriceDelegateInitCB(void *delegate, uint16_t endpoint_id) void CommodityPriceDelegateInitCB(void *delegate, uint16_t endpoint_id)
{ {
VerifyOrReturn(delegate != nullptr); VerifyOrReturn(delegate != nullptr);
@@ -587,7 +574,6 @@ void CommodityPriceDelegateInitCB(void *delegate, uint16_t endpoint_id)
(void)commodity_price_instance->Init(); (void)commodity_price_instance->Init();
} }
void ElectricalGridConditionsDelegateInitCB(void *delegate, uint16_t endpoint_id) void ElectricalGridConditionsDelegateInitCB(void *delegate, uint16_t endpoint_id)
{ {
VerifyOrReturn(delegate != nullptr); VerifyOrReturn(delegate != nullptr);
@@ -77,14 +77,14 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
group_key_management::create(endpoint, CLUSTER_FLAG_SERVER); group_key_management::create(endpoint, CLUSTER_FLAG_SERVER);
#if CHIP_CONFIG_ENABLE_ICD_SERVER #if CHIP_CONFIG_ENABLE_ICD_SERVER
if (icd::get_icd_server_enabled()) { if (icd::get_icd_server_enabled()) {
cluster_t *icd_management_cluster = icd_management::create(endpoint, &(config->icd_management), CLUSTER_FLAG_SERVER); cluster_t *icd_management_cluster = icd_management::create(endpoint, &(config->icd_management), CLUSTER_FLAG_SERVER);
#if CHIP_CONFIG_ENABLE_ICD_LIT #if CHIP_CONFIG_ENABLE_ICD_LIT
icd_management::feature::long_idle_time_support::add(icd_management_cluster); icd_management::feature::long_idle_time_support::add(icd_management_cluster);
#if CHIP_CONFIG_ENABLE_ICD_CIP #if CHIP_CONFIG_ENABLE_ICD_CIP
icd_management::feature::check_in_protocol_support::add(icd_management_cluster); icd_management::feature::check_in_protocol_support::add(icd_management_cluster);
#endif // CHIP_CONFIG_ENABLE_ICD_CIP #endif // CHIP_CONFIG_ENABLE_ICD_CIP
#if CHIP_CONFIG_ENABLE_ICD_UAT #if CHIP_CONFIG_ENABLE_ICD_UAT
icd_management::feature::user_active_mode_trigger::add(icd_management_cluster, &(config->icd_user_active_mode_trigger)); icd_management::feature::user_active_mode_trigger::add(icd_management_cluster, &(config->icd_user_active_mode_trigger));
#endif // CHIP_CONFIG_ENABLE_ICD_UAT #endif // CHIP_CONFIG_ENABLE_ICD_UAT
#endif // CHIP_CONFIG_ENABLE_ICD_LIT #endif // CHIP_CONFIG_ENABLE_ICD_LIT
} }
@@ -172,7 +172,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
} /** ota_provider **/ } /** ota_provider **/
namespace power_source{ namespace power_source {
uint32_t get_device_type_id() uint32_t get_device_type_id()
{ {
return ESP_MATTER_POWER_SOURCE_DEVICE_TYPE_ID; return ESP_MATTER_POWER_SOURCE_DEVICE_TYPE_ID;
@@ -1260,7 +1260,6 @@ uint8_t get_device_type_version()
return ESP_MATTER_ROOM_AIR_CONDITIONER_DEVICE_TYPE_VERSION; return ESP_MATTER_ROOM_AIR_CONDITIONER_DEVICE_TYPE_VERSION;
} }
endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data)
{ {
return common::create<config_t>(node, config, flags, priv_data, add); return common::create<config_t>(node, config, flags, priv_data, add);
@@ -1283,7 +1282,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
} }
} /** room_air_conditioner **/ } /** room_air_conditioner **/
namespace temperature_controlled_cabinet{ namespace temperature_controlled_cabinet {
uint32_t get_device_type_id() uint32_t get_device_type_id()
{ {
@@ -1311,7 +1310,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
} }
} /** temperature_controlled_cabinet**/ } /** temperature_controlled_cabinet**/
namespace refrigerator{ namespace refrigerator {
uint32_t get_device_type_id() uint32_t get_device_type_id()
{ {
@@ -2037,10 +2036,10 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
esp_err_t err = esp_matter::endpoint::add_device_type(endpoint, get_device_type_id(), get_device_type_version()); esp_err_t err = esp_matter::endpoint::add_device_type(endpoint, get_device_type_id(), get_device_type_version());
VerifyOrReturnError(err == ESP_OK, err); VerifyOrReturnError(err == ESP_OK, err);
cluster_t *camera_av_stream_management_cluster = cluster::camera_av_stream_management::create( cluster_t *camera_av_stream_management_cluster = cluster::camera_av_stream_management::create(
endpoint, endpoint,
&(config->camera_av_stream_management), &(config->camera_av_stream_management),
CLUSTER_FLAG_SERVER CLUSTER_FLAG_SERVER
); );
camera_av_stream_management::feature::video::add(camera_av_stream_management_cluster); camera_av_stream_management::feature::video::add(camera_av_stream_management_cluster);
camera_av_stream_management::feature::audio::add(camera_av_stream_management_cluster); camera_av_stream_management::feature::audio::add(camera_av_stream_management_cluster);
camera_av_stream_management::feature::snapshot::add(camera_av_stream_management_cluster); camera_av_stream_management::feature::snapshot::add(camera_av_stream_management_cluster);
@@ -259,7 +259,7 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_dat
esp_err_t add(endpoint_t *endpoint, config_t *config); esp_err_t add(endpoint_t *endpoint, config_t *config);
} /* ota_provider */ } /* ota_provider */
namespace power_source{ namespace power_source {
typedef struct config { typedef struct config {
cluster::descriptor::config_t descriptor; cluster::descriptor::config_t descriptor;
cluster::power_source::config_t power_source; cluster::power_source::config_t power_source;
@@ -274,7 +274,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace on_off_light { namespace on_off_light {
typedef struct config : on_off_with_lighting_config { typedef struct config : on_off_with_lighting_config {
config() { config()
{
/* For lighting product, the default identify type should be 0x01: LightOutput*/ /* For lighting product, the default identify type should be 0x01: LightOutput*/
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kLightOutput); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kLightOutput);
} }
@@ -331,7 +332,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace on_off_light_switch { namespace on_off_light_switch {
typedef struct config : app_client_config { typedef struct config : app_client_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
} }
} config_t; } config_t;
@@ -345,7 +347,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace dimmer_switch { namespace dimmer_switch {
typedef struct config : app_client_config { typedef struct config : app_client_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
} }
} config_t; } config_t;
@@ -359,7 +362,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace color_dimmer_switch { namespace color_dimmer_switch {
typedef struct config : app_client_config { typedef struct config : app_client_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
} }
} config_t; } config_t;
@@ -372,7 +376,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace generic_switch { namespace generic_switch {
typedef struct config : app_base_config { typedef struct config : app_base_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
} }
cluster::switch_cluster::config_t switch_cluster; cluster::switch_cluster::config_t switch_cluster;
@@ -387,9 +392,10 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace on_off_plug_in_unit { namespace on_off_plug_in_unit {
typedef struct config : on_off_with_lighting_config { typedef struct config : on_off_with_lighting_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
} }
} config_t; } config_t;
uint32_t get_device_type_id(); uint32_t get_device_type_id();
@@ -412,7 +418,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace fan { namespace fan {
typedef struct config : app_with_group_config { typedef struct config : app_with_group_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
} }
cluster::fan_control::config_t fan_control; cluster::fan_control::config_t fan_control;
@@ -426,7 +433,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace thermostat { namespace thermostat {
typedef struct config : app_with_group_config { typedef struct config : app_with_group_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
} }
cluster::scenes_management::config_t scenes_management; cluster::scenes_management::config_t scenes_management;
@@ -441,7 +449,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace air_quality_sensor { namespace air_quality_sensor {
typedef struct config : app_base_config { typedef struct config : app_base_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
} }
cluster::air_quality::config_t air_quality; cluster::air_quality::config_t air_quality;
@@ -455,7 +464,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace air_purifier { namespace air_purifier {
typedef struct config : app_base_config { typedef struct config : app_base_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
} }
cluster::fan_control::config_t fan_control; cluster::fan_control::config_t fan_control;
@@ -496,7 +506,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace smoke_co_alarm { namespace smoke_co_alarm {
typedef struct config : app_base_config { typedef struct config : app_base_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kAudibleBeep); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kAudibleBeep);
} }
cluster::smoke_co_alarm::config_t smoke_co_alarm; cluster::smoke_co_alarm::config_t smoke_co_alarm;
@@ -543,7 +554,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace door_lock { namespace door_lock {
typedef struct config : app_base_config { typedef struct config : app_base_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kAudibleBeep); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kAudibleBeep);
} }
cluster::door_lock::config_t door_lock; cluster::door_lock::config_t door_lock;
@@ -558,8 +570,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace window_covering { namespace window_covering {
typedef struct config : app_with_group_config { typedef struct config : app_with_group_config {
cluster::window_covering::config_t window_covering; cluster::window_covering::config_t window_covering;
config(uint8_t end_product_type = 0) : window_covering(end_product_type) { config(uint8_t end_product_type = 0) : window_covering(end_product_type)
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); {
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
} }
} config_t; } config_t;
@@ -571,7 +584,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace temperature_sensor { namespace temperature_sensor {
typedef struct config : app_base_config { typedef struct config : app_base_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
} }
cluster::temperature_measurement::config_t temperature_measurement; cluster::temperature_measurement::config_t temperature_measurement;
@@ -585,7 +599,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace humidity_sensor { namespace humidity_sensor {
typedef struct config : app_base_config { typedef struct config : app_base_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
} }
cluster::relative_humidity_measurement::config_t relative_humidity_measurement; cluster::relative_humidity_measurement::config_t relative_humidity_measurement;
@@ -599,7 +614,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace occupancy_sensor { namespace occupancy_sensor {
typedef struct config : app_base_config { typedef struct config : app_base_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kAudibleBeep); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kAudibleBeep);
} }
cluster::occupancy_sensing::config_t occupancy_sensing; cluster::occupancy_sensing::config_t occupancy_sensing;
@@ -614,7 +630,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace contact_sensor { namespace contact_sensor {
typedef struct config : app_with_bool_state_config { typedef struct config : app_with_bool_state_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
} }
} config_t; } config_t;
@@ -627,7 +644,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace light_sensor { namespace light_sensor {
typedef struct config : app_base_config { typedef struct config : app_base_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
} }
cluster::illuminance_measurement::config_t illuminance_measurement; cluster::illuminance_measurement::config_t illuminance_measurement;
@@ -641,7 +659,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace pressure_sensor { namespace pressure_sensor {
typedef struct config : app_base_config { typedef struct config : app_base_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
} }
cluster::pressure_measurement::config_t pressure_measurement; cluster::pressure_measurement::config_t pressure_measurement;
@@ -655,7 +674,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace flow_sensor { namespace flow_sensor {
typedef struct config : app_base_config { typedef struct config : app_base_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
} }
cluster::flow_measurement::config_t flow_measurement; cluster::flow_measurement::config_t flow_measurement;
@@ -675,7 +695,8 @@ typedef struct config : app_base_config {
nullable<int16_t> max_pressure = nullable<int16_t>(), nullable<int16_t> max_pressure = nullable<int16_t>(),
nullable<uint16_t> max_speed = nullable<uint16_t>(), nullable<uint16_t> max_speed = nullable<uint16_t>(),
nullable<uint16_t> max_flow = nullable<uint16_t>() nullable<uint16_t> max_flow = nullable<uint16_t>()
) : pump_configuration_and_control(max_pressure, max_speed, max_flow) { ) : pump_configuration_and_control(max_pressure, max_speed, max_flow)
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
} }
} config_t; } config_t;
@@ -688,7 +709,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace pump_controller { namespace pump_controller {
typedef struct config : app_client_config { typedef struct config : app_client_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
} }
} config_t; } config_t;
@@ -713,7 +735,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace room_air_conditioner { namespace room_air_conditioner {
typedef struct config : app_base_config { typedef struct config : app_base_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
} }
cluster::on_off::config_t on_off; cluster::on_off::config_t on_off;
@@ -762,7 +785,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace robotic_vacuum_cleaner { namespace robotic_vacuum_cleaner {
typedef struct config : app_base_config { typedef struct config : app_base_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
} }
cluster::rvc_run_mode::config_t rvc_run_mode; cluster::rvc_run_mode::config_t rvc_run_mode;
@@ -778,7 +802,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace water_leak_detector { namespace water_leak_detector {
typedef struct config : app_with_bool_state_config { typedef struct config : app_with_bool_state_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
} }
} config_t; } config_t;
@@ -792,7 +817,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace water_freeze_detector { namespace water_freeze_detector {
typedef struct config : app_with_bool_state_config { typedef struct config : app_with_bool_state_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
} }
} config_t; } config_t;
@@ -806,7 +832,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace rain_sensor { namespace rain_sensor {
typedef struct config : app_with_bool_state_config { typedef struct config : app_with_bool_state_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
} }
} config_t; } config_t;
@@ -895,7 +922,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace water_valve { namespace water_valve {
typedef struct config : app_base_config { typedef struct config : app_base_config {
cluster::valve_configuration_and_control::config_t valve_configuration_and_control; cluster::valve_configuration_and_control::config_t valve_configuration_and_control;
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
} }
} config_t; } config_t;
@@ -946,7 +974,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
namespace mounted_on_off_control { namespace mounted_on_off_control {
typedef struct config : on_off_with_lighting_config { typedef struct config : on_off_with_lighting_config {
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
} }
} config_t; } config_t;
@@ -1071,7 +1100,6 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
} /* chime */ } /* chime */
namespace thermostat_controller { namespace thermostat_controller {
using config_t = app_client_config; using config_t = app_client_config;
@@ -1094,7 +1122,8 @@ namespace closure {
typedef struct config : app_base_config { typedef struct config : app_base_config {
cluster::closure_control::config_t closure_control; cluster::closure_control::config_t closure_control;
config() { config()
{
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
} }
} config_t; } config_t;
@@ -107,7 +107,6 @@ event_t *create_reachable_changed(cluster_t *cluster);
} // namespace event } // namespace event
} // namespace bridged_device_basic_information } // namespace bridged_device_basic_information
namespace power_source { namespace power_source {
namespace event { namespace event {
event_t *create_wired_fault_change(cluster_t *cluster); event_t *create_wired_fault_change(cluster_t *cluster);
@@ -1064,7 +1064,6 @@ esp_err_t add(cluster_t *cluster)
} /* feature */ } /* feature */
} /* ethernet_network_diagnostics */ } /* ethernet_network_diagnostics */
namespace air_quality { namespace air_quality {
namespace feature { namespace feature {
@@ -1835,7 +1834,6 @@ esp_err_t add(cluster_t *cluster, config_t *config)
} /* feature */ } /* feature */
} /* mode_select */ } /* mode_select */
namespace pressure_measurement { namespace pressure_measurement {
namespace feature { namespace feature {
@@ -2400,7 +2398,6 @@ esp_err_t add(cluster_t *cluster)
return ESP_ERR_NOT_SUPPORTED; return ESP_ERR_NOT_SUPPORTED;
} }
return ESP_OK; return ESP_OK;
} }
} /* polyphase_power */ } /* polyphase_power */
@@ -2426,7 +2423,6 @@ esp_err_t add(cluster_t *cluster)
return ESP_ERR_NOT_SUPPORTED; return ESP_ERR_NOT_SUPPORTED;
} }
return ESP_OK; return ESP_OK;
} }
} /* harmonics */ } /* harmonics */
@@ -2452,7 +2448,6 @@ esp_err_t add(cluster_t *cluster)
return ESP_ERR_NOT_SUPPORTED; return ESP_ERR_NOT_SUPPORTED;
} }
return ESP_OK; return ESP_OK;
} }
} /* power_quality */ } /* power_quality */
@@ -3208,7 +3203,6 @@ esp_err_t add(cluster_t *cluster)
event::create_power_adjust_start(cluster); event::create_power_adjust_start(cluster);
event::create_power_adjust_end(cluster); event::create_power_adjust_end(cluster);
return ESP_OK; return ESP_OK;
} }
} /* power_adjustment */ } /* power_adjustment */
@@ -3260,7 +3254,6 @@ esp_err_t add(cluster_t *cluster)
return ESP_ERR_NOT_SUPPORTED; return ESP_ERR_NOT_SUPPORTED;
} }
return ESP_OK; return ESP_OK;
} }
} /* state_forecast_reporting */ } /* state_forecast_reporting */
@@ -3494,7 +3487,6 @@ esp_err_t add(cluster_t *cluster)
return ESP_OK; return ESP_OK;
} }
} /* tank_percent */ } /* tank_percent */
} /* feature */ } /* feature */
@@ -4075,7 +4067,6 @@ esp_err_t add(cluster_t *cluster)
attribute::create_soft_recording_privacy_mode_enabled(cluster, 0); attribute::create_soft_recording_privacy_mode_enabled(cluster, 0);
attribute::create_soft_livestream_privacy_mode_enabled(cluster, 0); attribute::create_soft_livestream_privacy_mode_enabled(cluster, 0);
return ESP_OK; return ESP_OK;
} }
@@ -4099,7 +4090,6 @@ esp_err_t add(cluster_t *cluster)
attribute::create_speaker_max_level(cluster, 0); attribute::create_speaker_max_level(cluster, 0);
attribute::create_speaker_min_level(cluster, 0); attribute::create_speaker_min_level(cluster, 0);
return ESP_OK; return ESP_OK;
} }
@@ -4169,7 +4159,6 @@ esp_err_t add(cluster_t *cluster)
attribute::create_local_video_recording_enabled(cluster, 0); attribute::create_local_video_recording_enabled(cluster, 0);
attribute::create_local_snapshot_recording_enabled(cluster, 0); attribute::create_local_snapshot_recording_enabled(cluster, 0);
return ESP_OK; return ESP_OK;
} }
@@ -4220,7 +4209,6 @@ namespace webrtc_transport_provider {
namespace webrtc_transport_requestor { namespace webrtc_transport_requestor {
}/*webrtc_transport_requestor*/ }/*webrtc_transport_requestor*/
namespace closure_control { namespace closure_control {
namespace feature { namespace feature {
namespace positioning { namespace positioning {
@@ -301,8 +301,8 @@ typedef struct config {
uint16_t couple_color_temp_to_level_min_mireds; uint16_t couple_color_temp_to_level_min_mireds;
nullable<uint16_t> start_up_color_temperature_mireds; nullable<uint16_t> start_up_color_temperature_mireds;
config() : color_temperature_mireds(0x00fa), color_temp_physical_min_mireds(1), config() : color_temperature_mireds(0x00fa), color_temp_physical_min_mireds(1),
color_temp_physical_max_mireds(0xfeff), couple_color_temp_to_level_min_mireds(1), color_temp_physical_max_mireds(0xfeff), couple_color_temp_to_level_min_mireds(1),
start_up_color_temperature_mireds(0x00fa) {} start_up_color_temperature_mireds(0x00fa) {}
} config_t; } config_t;
uint32_t get_id(); uint32_t get_id();
@@ -350,7 +350,7 @@ typedef struct config {
uint16_t color_loop_start_enhanced_hue; uint16_t color_loop_start_enhanced_hue;
uint16_t color_loop_stored_enhanced_hue; uint16_t color_loop_stored_enhanced_hue;
config() : color_loop_active(0), color_loop_direction(0), color_loop_time(0x19), config() : color_loop_active(0), color_loop_direction(0), color_loop_time(0x19),
color_loop_start_enhanced_hue(0x2300), color_loop_stored_enhanced_hue(0) {} color_loop_start_enhanced_hue(0x2300), color_loop_stored_enhanced_hue(0) {}
} config_t; } config_t;
uint32_t get_id(); uint32_t get_id();
@@ -491,9 +491,9 @@ namespace feature {
namespace heating { namespace heating {
typedef struct config { typedef struct config {
int16_t occupied_heating_setpoint; int16_t occupied_heating_setpoint;
config (): occupied_heating_setpoint(2000) {} config(): occupied_heating_setpoint(2000) {}
} config_t; } config_t;
uint32_t get_id(); uint32_t get_id();
@@ -503,9 +503,9 @@ esp_err_t add(cluster_t *cluster, config_t *config);
namespace cooling { namespace cooling {
typedef struct config { typedef struct config {
int16_t occupied_cooling_setpoint; int16_t occupied_cooling_setpoint;
config (): occupied_cooling_setpoint(2600) {} config(): occupied_cooling_setpoint(2600) {}
} config_t; } config_t;
uint32_t get_id(); uint32_t get_id();
@@ -517,14 +517,14 @@ esp_err_t add(cluster_t *cluster, config_t *config);
namespace occupancy { namespace occupancy {
typedef struct config { typedef struct config {
uint8_t occupancy; uint8_t occupancy;
int16_t unoccupied_cooling_setpoint; int16_t unoccupied_cooling_setpoint;
int16_t unoccupied_heating_setpoint; int16_t unoccupied_heating_setpoint;
nullable<uint8_t> unoccupied_setback; nullable<uint8_t> unoccupied_setback;
nullable<uint8_t> unoccupied_setback_min; nullable<uint8_t> unoccupied_setback_min;
nullable<uint8_t> unoccupied_setback_max; nullable<uint8_t> unoccupied_setback_max;
config (): occupancy(1), unoccupied_cooling_setpoint(2600), unoccupied_heating_setpoint(2000), unoccupied_setback(), unoccupied_setback_min(), unoccupied_setback_max() {} config(): occupancy(1), unoccupied_cooling_setpoint(2600), unoccupied_heating_setpoint(2000), unoccupied_setback(), unoccupied_setback_min(), unoccupied_setback_max() {}
} config_t; } config_t;
uint32_t get_id(); uint32_t get_id();
@@ -534,11 +534,11 @@ esp_err_t add(cluster_t *cluster, config_t *config);
namespace setback { namespace setback {
typedef struct config { typedef struct config {
nullable<uint8_t> occupied_setback; nullable<uint8_t> occupied_setback;
nullable<uint8_t> occupied_setback_min; nullable<uint8_t> occupied_setback_min;
nullable<uint8_t> occupied_setback_max; nullable<uint8_t> occupied_setback_max;
config (): occupied_setback(), occupied_setback_min(), occupied_setback_max() {} config(): occupied_setback(), occupied_setback_min(), occupied_setback_max() {}
} config_t; } config_t;
uint32_t get_id(); uint32_t get_id();
@@ -551,9 +551,9 @@ esp_err_t add(cluster_t *cluster, config_t *config);
namespace auto_mode { namespace auto_mode {
typedef struct config { typedef struct config {
int8_t min_setpoint_dead_band; int8_t min_setpoint_dead_band;
config (): min_setpoint_dead_band(2) {} config(): min_setpoint_dead_band(2) {}
} config_t; } config_t;
uint32_t get_id(); uint32_t get_id();
@@ -565,7 +565,7 @@ namespace local_temperature_not_exposed {
typedef struct config { typedef struct config {
int16_t local_temperature_calibration; int16_t local_temperature_calibration;
config (): local_temperature_calibration(0) {} config(): local_temperature_calibration(0) {}
} config_t; } config_t;
uint32_t get_id(); uint32_t get_id();
@@ -580,7 +580,7 @@ typedef struct config {
nullable<uint8_t> number_of_schedule_transition_per_day; nullable<uint8_t> number_of_schedule_transition_per_day;
uint8_t active_schedule_handle[k_max_active_schedule_handle]; uint8_t active_schedule_handle[k_max_active_schedule_handle];
config (): number_of_schedules(0), number_of_schedule_transitions(0), number_of_schedule_transition_per_day() {} config(): number_of_schedules(0), number_of_schedule_transitions(0), number_of_schedule_transition_per_day() {}
} config_t; } config_t;
uint32_t get_id(); uint32_t get_id();
@@ -1158,7 +1158,6 @@ esp_err_t add(cluster_t *cluster, config_t *config);
} /* feature */ } /* feature */
} /* boolean_state_configuration */ } /* boolean_state_configuration */
namespace power_topology { namespace power_topology {
namespace feature { namespace feature {
@@ -1267,8 +1266,8 @@ typedef struct config {
uint8_t user_code_temporary_disable_time; uint8_t user_code_temporary_disable_time;
bool require_pin_for_remote_operation; bool require_pin_for_remote_operation;
config() : number_pin_users_supported(5), max_pin_code_length(16), min_pin_code_length(4), config() : number_pin_users_supported(5), max_pin_code_length(16), min_pin_code_length(4),
wrong_code_entry_limit(5), user_code_temporary_disable_time(5), wrong_code_entry_limit(5), user_code_temporary_disable_time(5),
require_pin_for_remote_operation(true) {} require_pin_for_remote_operation(true) {}
} config_t; } config_t;
uint32_t get_id(); uint32_t get_id();
@@ -1283,7 +1282,7 @@ typedef struct config {
uint8_t wrong_code_entry_limit; uint8_t wrong_code_entry_limit;
uint8_t user_code_temporary_disable_time; uint8_t user_code_temporary_disable_time;
config() : number_rfid_users_supported(5), max_rfid_code_length(16), min_rfid_code_length(4), config() : number_rfid_users_supported(5), max_rfid_code_length(16), min_rfid_code_length(4),
wrong_code_entry_limit(5), user_code_temporary_disable_time(5) {} wrong_code_entry_limit(5), user_code_temporary_disable_time(5) {}
} config_t; } config_t;
uint32_t get_id(); uint32_t get_id();
@@ -1370,7 +1369,7 @@ uint32_t get_id();
esp_err_t add(cluster_t *cluster); esp_err_t add(cluster_t *cluster);
} /* aliro_provisioning */ } /* aliro_provisioning */
namespace aliro_bleuwb{ namespace aliro_bleuwb {
uint32_t get_id(); uint32_t get_id();
esp_err_t add(cluster_t *cluster); esp_err_t add(cluster_t *cluster);
@@ -1608,11 +1607,11 @@ namespace feature {
namespace extended { namespace extended {
typedef struct config { typedef struct config {
nullable<int16_t> scaled_value; nullable<int16_t> scaled_value;
nullable<int16_t> min_scaled_value; nullable<int16_t> min_scaled_value;
nullable<int16_t> max_scaled_value; nullable<int16_t> max_scaled_value;
uint8_t scale; uint8_t scale;
config() : scaled_value(), min_scaled_value(), max_scaled_value(), scale(0) {} config() : scaled_value(), min_scaled_value(), max_scaled_value(), scale(0) {}
} config_t; } config_t;
uint32_t get_id(); uint32_t get_id();
@@ -1891,7 +1890,6 @@ namespace webrtc_transport_provider {
namespace webrtc_transport_requestor { namespace webrtc_transport_requestor {
}/*webrtc_transport_requestor*/ }/*webrtc_transport_requestor*/
namespace closure_control { namespace closure_control {
namespace feature { namespace feature {
@@ -424,4 +424,3 @@ constexpr uint16_t cluster_revision = 1;
} // namespace soil_measurement } // namespace soil_measurement
} // namespace cluster } // namespace cluster
} // namespace esp_matter } // namespace esp_matter
@@ -108,34 +108,34 @@ esp_err_t destroy(cluster_t *cluster, attribute_t *attribute);
namespace command { namespace command {
/** Destroy command /** Destroy command
* *
* This function destroys a command that was created and added to a cluster. * This function destroys a command that was created and added to a cluster.
* It removes the command from the cluster's command list. * It removes the command from the cluster's command list.
* *
* @param[in] cluster Cluster handle. * @param[in] cluster Cluster handle.
* @param[in] command Command handle. * @param[in] command Command handle.
* *
* @return ESP_OK on success. * @return ESP_OK on success.
* @return error in case of failure. * @return error in case of failure.
*/ */
esp_err_t destroy(cluster_t *cluster, command_t *command); esp_err_t destroy(cluster_t *cluster, command_t *command);
} // namespace command } // namespace command
namespace event { namespace event {
/** Destroy event /** Destroy event
* *
* This function destroys an event that was created and added to a cluster. * This function destroys an event that was created and added to a cluster.
* It removes the event from the cluster's event list. * It removes the event from the cluster's event list.
* *
* @param[in] cluster Cluster handle. * @param[in] cluster Cluster handle.
* @param[in] event Event handle. * @param[in] event Event handle.
* *
* @return ESP_OK on success. * @return ESP_OK on success.
* @return error in case of failure. * @return error in case of failure.
*/ */
esp_err_t destroy(cluster_t *cluster, event_t *event); esp_err_t destroy(cluster_t *cluster, event_t *event);
} // namespace event } // namespace event
@@ -31,24 +31,24 @@ const char * TAG = "mtr_nvs";
static void get_attribute_key(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, char *attribute_key) static void get_attribute_key(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, char *attribute_key)
{ {
// Convert the the endpoint_id, cluster_id, attribute_id to base64 string // Convert the the endpoint_id, cluster_id, attribute_id to base64 string
uint8_t encode_buf[10] = {0}; uint8_t encode_buf[10] = {0};
char base64_str[17] = {0}; char base64_str[17] = {0};
memcpy(&encode_buf[0], &endpoint_id, sizeof(endpoint_id)); memcpy(&encode_buf[0], &endpoint_id, sizeof(endpoint_id));
memcpy(&encode_buf[2], &cluster_id, sizeof(cluster_id)); memcpy(&encode_buf[2], &cluster_id, sizeof(cluster_id));
memcpy(&encode_buf[6], &attribute_id, sizeof(attribute_id)); memcpy(&encode_buf[6], &attribute_id, sizeof(attribute_id));
chip::Base64Encode(encode_buf, 10, base64_str); chip::Base64Encode(encode_buf, 10, base64_str);
// The last two character must be '=' // The last two character must be '='
assert(base64_str[14] == '=' && base64_str[15] == '='); assert(base64_str[14] == '=' && base64_str[15] == '=');
// Copy the string before '=' // Copy the string before '='
strncpy(attribute_key, base64_str, 14); strncpy(attribute_key, base64_str, 14);
attribute_key[14] = 0; attribute_key[14] = 0;
} }
static esp_err_t nvs_store_val(const char *nvs_namespace, const char *attribute_key, const esp_matter_attr_val_t & val); static esp_err_t nvs_store_val(const char *nvs_namespace, const char *attribute_key, const esp_matter_attr_val_t &val);
static esp_err_t nvs_erase_val(const char *nvs_namespace, const char *attribute_key); static esp_err_t nvs_erase_val(const char *nvs_namespace, const char *attribute_key);
static esp_err_t nvs_get_val(const char *nvs_namespace, const char *attribute_key, esp_matter_attr_val_t & val) static esp_err_t nvs_get_val(const char *nvs_namespace, const char *attribute_key, esp_matter_attr_val_t &val)
{ {
nvs_handle_t handle; nvs_handle_t handle;
esp_err_t err = nvs_open_from_partition(ESP_MATTER_NVS_PART_NAME, nvs_namespace, NVS_READONLY, &handle); esp_err_t err = nvs_open_from_partition(ESP_MATTER_NVS_PART_NAME, nvs_namespace, NVS_READONLY, &handle);
@@ -57,10 +57,10 @@ static esp_err_t nvs_get_val(const char *nvs_namespace, const char *attribute_ke
} }
if (val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING || if (val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING ||
val.type == ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING || val.type == ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING ||
val.type == ESP_MATTER_VAL_TYPE_OCTET_STRING || val.type == ESP_MATTER_VAL_TYPE_OCTET_STRING ||
val.type == ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING || val.type == ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING ||
val.type == ESP_MATTER_VAL_TYPE_ARRAY) { val.type == ESP_MATTER_VAL_TYPE_ARRAY) {
size_t len = 0; size_t len = 0;
if ((err = nvs_get_blob(handle, attribute_key, NULL, &len)) == ESP_OK) { if ((err = nvs_get_blob(handle, attribute_key, NULL, &len)) == ESP_OK) {
// This function will only be called when recovering the non-volatile attributes during reboot // This function will only be called when recovering the non-volatile attributes during reboot
@@ -85,105 +85,91 @@ static esp_err_t nvs_get_val(const char *nvs_namespace, const char *attribute_ke
// This switch case handles primitive data types // This switch case handles primitive data types
// if value is stored as primitive data type return it, else check if its stored as blob // if value is stored as primitive data type return it, else check if its stored as blob
// and convert it to primitive data type // and convert it to primitive data type
switch (val.type) switch (val.type) {
{ case ESP_MATTER_VAL_TYPE_BOOLEAN: {
case ESP_MATTER_VAL_TYPE_BOOLEAN: uint8_t b_val;
{ if ((err = nvs_get_u8(handle, attribute_key, &b_val)) == ESP_OK) {
uint8_t b_val; val.val.b = (b_val != 0);
if ((err = nvs_get_u8(handle, attribute_key, &b_val)) == ESP_OK)
{
val.val.b = (b_val != 0);
}
break;
} }
break;
}
case ESP_MATTER_VAL_TYPE_INTEGER: case ESP_MATTER_VAL_TYPE_INTEGER:
case ESP_MATTER_VAL_TYPE_NULLABLE_INTEGER: case ESP_MATTER_VAL_TYPE_NULLABLE_INTEGER: {
{ err = nvs_get_i32(handle, attribute_key, reinterpret_cast<int32_t *>(&val.val.i));
err = nvs_get_i32(handle, attribute_key, reinterpret_cast<int32_t *>(&val.val.i)); break;
break; }
}
// no nvs api to read float, since it is stored as blob, reading as blob // no nvs api to read float, since it is stored as blob, reading as blob
case ESP_MATTER_VAL_TYPE_FLOAT: case ESP_MATTER_VAL_TYPE_FLOAT:
case ESP_MATTER_VAL_TYPE_NULLABLE_FLOAT: case ESP_MATTER_VAL_TYPE_NULLABLE_FLOAT: {
{ size_t length = sizeof(val.val.f);
size_t length = sizeof(val.val.f); err = nvs_get_blob(handle, attribute_key, &val.val.f, &length);
err = nvs_get_blob(handle, attribute_key, &val.val.f, &length); break;
break; }
}
case ESP_MATTER_VAL_TYPE_INT8: case ESP_MATTER_VAL_TYPE_INT8:
case ESP_MATTER_VAL_TYPE_NULLABLE_INT8: case ESP_MATTER_VAL_TYPE_NULLABLE_INT8: {
{ err = nvs_get_i8(handle, attribute_key, &val.val.i8);
err = nvs_get_i8(handle, attribute_key, &val.val.i8); break;
break; }
}
case ESP_MATTER_VAL_TYPE_UINT8: case ESP_MATTER_VAL_TYPE_UINT8:
case ESP_MATTER_VAL_TYPE_ENUM8: case ESP_MATTER_VAL_TYPE_ENUM8:
case ESP_MATTER_VAL_TYPE_BITMAP8: case ESP_MATTER_VAL_TYPE_BITMAP8:
case ESP_MATTER_VAL_TYPE_NULLABLE_UINT8: case ESP_MATTER_VAL_TYPE_NULLABLE_UINT8:
case ESP_MATTER_VAL_TYPE_NULLABLE_ENUM8: case ESP_MATTER_VAL_TYPE_NULLABLE_ENUM8:
case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP8: case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP8: {
{ err = nvs_get_u8(handle, attribute_key, &val.val.u8);
err = nvs_get_u8(handle, attribute_key, &val.val.u8); break;
break; }
}
case ESP_MATTER_VAL_TYPE_INT16: case ESP_MATTER_VAL_TYPE_INT16:
case ESP_MATTER_VAL_TYPE_NULLABLE_INT16: case ESP_MATTER_VAL_TYPE_NULLABLE_INT16: {
{ err = nvs_get_i16(handle, attribute_key, &val.val.i16);
err = nvs_get_i16(handle, attribute_key, &val.val.i16); break;
break; }
}
case ESP_MATTER_VAL_TYPE_UINT16: case ESP_MATTER_VAL_TYPE_UINT16:
case ESP_MATTER_VAL_TYPE_BITMAP16: case ESP_MATTER_VAL_TYPE_BITMAP16:
case ESP_MATTER_VAL_TYPE_NULLABLE_UINT16: case ESP_MATTER_VAL_TYPE_NULLABLE_UINT16:
case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP16: case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP16: {
{ err = nvs_get_u16(handle, attribute_key, &val.val.u16);
err = nvs_get_u16(handle, attribute_key, &val.val.u16); break;
break; }
}
case ESP_MATTER_VAL_TYPE_INT32: case ESP_MATTER_VAL_TYPE_INT32:
case ESP_MATTER_VAL_TYPE_NULLABLE_INT32: case ESP_MATTER_VAL_TYPE_NULLABLE_INT32: {
{ err = nvs_get_i32(handle, attribute_key, &val.val.i32);
err = nvs_get_i32(handle, attribute_key, &val.val.i32); break;
break; }
}
case ESP_MATTER_VAL_TYPE_UINT32: case ESP_MATTER_VAL_TYPE_UINT32:
case ESP_MATTER_VAL_TYPE_BITMAP32: case ESP_MATTER_VAL_TYPE_BITMAP32:
case ESP_MATTER_VAL_TYPE_NULLABLE_UINT32: case ESP_MATTER_VAL_TYPE_NULLABLE_UINT32:
case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP32: case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP32: {
{ err = nvs_get_u32(handle, attribute_key, &val.val.u32);
err = nvs_get_u32(handle, attribute_key, &val.val.u32); break;
break; }
}
case ESP_MATTER_VAL_TYPE_INT64: case ESP_MATTER_VAL_TYPE_INT64:
case ESP_MATTER_VAL_TYPE_NULLABLE_INT64: case ESP_MATTER_VAL_TYPE_NULLABLE_INT64: {
{ err = nvs_get_i64(handle, attribute_key, &val.val.i64);
err = nvs_get_i64(handle, attribute_key, &val.val.i64); break;
break; }
}
case ESP_MATTER_VAL_TYPE_UINT64: case ESP_MATTER_VAL_TYPE_UINT64:
case ESP_MATTER_VAL_TYPE_NULLABLE_UINT64: case ESP_MATTER_VAL_TYPE_NULLABLE_UINT64: {
{ err = nvs_get_u64(handle, attribute_key, &val.val.u64);
err = nvs_get_u64(handle, attribute_key, &val.val.u64); break;
break; }
}
default: default: {
{ // handle the case where the type is not recognized
// handle the case where the type is not recognized nvs_close(handle);
nvs_close(handle); ESP_LOGE(TAG, "Invalid attribute type: %u", val.type);
ESP_LOGE(TAG, "Invalid attribute type: %u", val.type); return ESP_ERR_INVALID_ARG;
return ESP_ERR_INVALID_ARG; }
}
} }
// Found the value as primitive data type // Found the value as primitive data type
@@ -213,7 +199,7 @@ static esp_err_t nvs_get_val(const char *nvs_namespace, const char *attribute_ke
return err; return err;
} }
static esp_err_t nvs_store_val(const char *nvs_namespace, const char *attribute_key, const esp_matter_attr_val_t & val) static esp_err_t nvs_store_val(const char *nvs_namespace, const char *attribute_key, const esp_matter_attr_val_t &val)
{ {
nvs_handle_t handle; nvs_handle_t handle;
esp_err_t err = nvs_open_from_partition(ESP_MATTER_NVS_PART_NAME, nvs_namespace, NVS_READWRITE, &handle); esp_err_t err = nvs_open_from_partition(ESP_MATTER_NVS_PART_NAME, nvs_namespace, NVS_READWRITE, &handle);
@@ -222,10 +208,10 @@ static esp_err_t nvs_store_val(const char *nvs_namespace, const char *attribute_
} }
if (val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING || if (val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING ||
val.type == ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING || val.type == ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING ||
val.type == ESP_MATTER_VAL_TYPE_OCTET_STRING || val.type == ESP_MATTER_VAL_TYPE_OCTET_STRING ||
val.type == ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING || val.type == ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING ||
val.type == ESP_MATTER_VAL_TYPE_ARRAY) { val.type == ESP_MATTER_VAL_TYPE_ARRAY) {
/* Store only if value is not NULL */ /* Store only if value is not NULL */
if (val.val.a.b) { if (val.val.a.b) {
err = nvs_set_blob(handle, attribute_key, val.val.a.b, val.val.a.s); err = nvs_set_blob(handle, attribute_key, val.val.a.b, val.val.a.s);
@@ -236,100 +222,87 @@ static esp_err_t nvs_store_val(const char *nvs_namespace, const char *attribute_
} else { } else {
// This switch case handles primitive data types // This switch case handles primitive data types
// always store values as primitive data type // always store values as primitive data type
switch (val.type) switch (val.type) {
{ case ESP_MATTER_VAL_TYPE_BOOLEAN: {
case ESP_MATTER_VAL_TYPE_BOOLEAN: err = nvs_set_u8(handle, attribute_key, val.val.b != 0);
{ break;
err = nvs_set_u8(handle, attribute_key, val.val.b != 0); }
break;
}
case ESP_MATTER_VAL_TYPE_INTEGER: case ESP_MATTER_VAL_TYPE_INTEGER:
case ESP_MATTER_VAL_TYPE_NULLABLE_INTEGER: case ESP_MATTER_VAL_TYPE_NULLABLE_INTEGER: {
{ err = nvs_set_i32(handle, attribute_key, val.val.i);
err = nvs_set_i32(handle, attribute_key, val.val.i); break;
break; }
}
// no nvs api to store float, storing as blob // no nvs api to store float, storing as blob
case ESP_MATTER_VAL_TYPE_FLOAT: case ESP_MATTER_VAL_TYPE_FLOAT:
case ESP_MATTER_VAL_TYPE_NULLABLE_FLOAT: case ESP_MATTER_VAL_TYPE_NULLABLE_FLOAT: {
{ err = nvs_set_blob(handle, attribute_key, &val.val.f, sizeof(val.val.f));
err = nvs_set_blob(handle, attribute_key, &val.val.f, sizeof(val.val.f)); break;
break; }
}
case ESP_MATTER_VAL_TYPE_INT8: case ESP_MATTER_VAL_TYPE_INT8:
case ESP_MATTER_VAL_TYPE_NULLABLE_INT8: case ESP_MATTER_VAL_TYPE_NULLABLE_INT8: {
{ err = nvs_set_i8(handle, attribute_key, val.val.i8);
err = nvs_set_i8(handle, attribute_key, val.val.i8); break;
break; }
}
case ESP_MATTER_VAL_TYPE_UINT8: case ESP_MATTER_VAL_TYPE_UINT8:
case ESP_MATTER_VAL_TYPE_ENUM8: case ESP_MATTER_VAL_TYPE_ENUM8:
case ESP_MATTER_VAL_TYPE_BITMAP8: case ESP_MATTER_VAL_TYPE_BITMAP8:
case ESP_MATTER_VAL_TYPE_NULLABLE_UINT8: case ESP_MATTER_VAL_TYPE_NULLABLE_UINT8:
case ESP_MATTER_VAL_TYPE_NULLABLE_ENUM8: case ESP_MATTER_VAL_TYPE_NULLABLE_ENUM8:
case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP8: case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP8: {
{ err = nvs_set_u8(handle, attribute_key, val.val.u8);
err = nvs_set_u8(handle, attribute_key, val.val.u8); break;
break; }
}
case ESP_MATTER_VAL_TYPE_INT16: case ESP_MATTER_VAL_TYPE_INT16:
case ESP_MATTER_VAL_TYPE_NULLABLE_INT16: case ESP_MATTER_VAL_TYPE_NULLABLE_INT16: {
{ err = nvs_set_i16(handle, attribute_key, val.val.i16);
err = nvs_set_i16(handle, attribute_key, val.val.i16); break;
break; }
}
case ESP_MATTER_VAL_TYPE_UINT16: case ESP_MATTER_VAL_TYPE_UINT16:
case ESP_MATTER_VAL_TYPE_BITMAP16: case ESP_MATTER_VAL_TYPE_BITMAP16:
case ESP_MATTER_VAL_TYPE_NULLABLE_UINT16: case ESP_MATTER_VAL_TYPE_NULLABLE_UINT16:
case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP16: case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP16: {
{ err = nvs_set_u16(handle, attribute_key, val.val.u16);
err = nvs_set_u16(handle, attribute_key, val.val.u16); break;
break; }
}
case ESP_MATTER_VAL_TYPE_INT32: case ESP_MATTER_VAL_TYPE_INT32:
case ESP_MATTER_VAL_TYPE_NULLABLE_INT32: case ESP_MATTER_VAL_TYPE_NULLABLE_INT32: {
{ err = nvs_set_i32(handle, attribute_key, val.val.i32);
err = nvs_set_i32(handle, attribute_key, val.val.i32); break;
break; }
}
case ESP_MATTER_VAL_TYPE_UINT32: case ESP_MATTER_VAL_TYPE_UINT32:
case ESP_MATTER_VAL_TYPE_BITMAP32: case ESP_MATTER_VAL_TYPE_BITMAP32:
case ESP_MATTER_VAL_TYPE_NULLABLE_UINT32: case ESP_MATTER_VAL_TYPE_NULLABLE_UINT32:
case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP32: case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP32: {
{ err = nvs_set_u32(handle, attribute_key, val.val.u32);
err = nvs_set_u32(handle, attribute_key, val.val.u32); break;
break; }
}
case ESP_MATTER_VAL_TYPE_INT64: case ESP_MATTER_VAL_TYPE_INT64:
case ESP_MATTER_VAL_TYPE_NULLABLE_INT64: case ESP_MATTER_VAL_TYPE_NULLABLE_INT64: {
{ err = nvs_set_i64(handle, attribute_key, val.val.i64);
err = nvs_set_i64(handle, attribute_key, val.val.i64); break;
break; }
}
case ESP_MATTER_VAL_TYPE_UINT64: case ESP_MATTER_VAL_TYPE_UINT64:
case ESP_MATTER_VAL_TYPE_NULLABLE_UINT64: case ESP_MATTER_VAL_TYPE_NULLABLE_UINT64: {
{ err = nvs_set_u64(handle, attribute_key, val.val.u64);
err = nvs_set_u64(handle, attribute_key, val.val.u64); break;
break; }
}
default: default: {
{ // handle the case where the type is not recognized
// handle the case where the type is not recognized err = ESP_ERR_INVALID_ARG;
err = ESP_ERR_INVALID_ARG; ESP_LOGE(TAG, "Invalid attribute type: %u", val.type);
ESP_LOGE(TAG, "Invalid attribute type: %u", val.type); break;
break; }
}
} }
} }
nvs_commit(handle); nvs_commit(handle);
@@ -350,14 +323,14 @@ static esp_err_t nvs_erase_val(const char *nvs_namespace, const char *attribute_
return err; return err;
} }
esp_err_t get_val_from_nvs(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t & val) esp_err_t get_val_from_nvs(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t &val)
{ {
/* Get attribute key */ /* Get attribute key */
char attribute_key[16] = {0}; char attribute_key[16] = {0};
get_attribute_key(endpoint_id, cluster_id, attribute_id, attribute_key); get_attribute_key(endpoint_id, cluster_id, attribute_id, attribute_key);
ESP_LOGD(TAG, "read attribute from nvs: endpoint_id-0x%" PRIx16 ", cluster_id-0x%" PRIx32 "," ESP_LOGD(TAG, "read attribute from nvs: endpoint_id-0x%" PRIx16 ", cluster_id-0x%" PRIx32 ","
" attribute_id-0x%" PRIx32 "", endpoint_id, cluster_id, attribute_id); " attribute_id-0x%" PRIx32 "", endpoint_id, cluster_id, attribute_id);
esp_err_t err = nvs_get_val(ESP_MATTER_KVS_NAMESPACE, attribute_key, val); esp_err_t err = nvs_get_val(ESP_MATTER_KVS_NAMESPACE, attribute_key, val);
if (err == ESP_ERR_NVS_NOT_FOUND) { if (err == ESP_ERR_NVS_NOT_FOUND) {
// If we don't find attribute key in the esp_matter_kvs namespace, we will try to get the attribute value // If we don't find attribute key in the esp_matter_kvs namespace, we will try to get the attribute value
@@ -381,7 +354,7 @@ esp_err_t get_val_from_nvs(uint16_t endpoint_id, uint32_t cluster_id, uint32_t a
return err; return err;
} }
esp_err_t store_val_in_nvs(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, const esp_matter_attr_val_t & val) esp_err_t store_val_in_nvs(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, const esp_matter_attr_val_t &val)
{ {
/* Get attribute key */ /* Get attribute key */
char attribute_key[16] = {0}; char attribute_key[16] = {0};
@@ -31,7 +31,7 @@ namespace attribute {
* *
* @return ESP_OK on success, appropriate error code otherwise * @return ESP_OK on success, appropriate error code otherwise
*/ */
esp_err_t get_val_from_nvs(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t & val); esp_err_t get_val_from_nvs(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t &val);
/** /**
* @brief Stores the attribute value in NVS, it generates the key based on endpoint, cluster, and attribute id. * @brief Stores the attribute value in NVS, it generates the key based on endpoint, cluster, and attribute id.
@@ -42,7 +42,7 @@ esp_err_t get_val_from_nvs(uint16_t endpoint_id, uint32_t cluster_id, uint32_t a
* *
* @return ESP_OK on success, appropriate error code otherwise * @return ESP_OK on success, appropriate error code otherwise
*/ */
esp_err_t store_val_in_nvs(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, const esp_matter_attr_val_t & val); esp_err_t store_val_in_nvs(uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, const esp_matter_attr_val_t &val);
/** /**
* @brief Erases the attribute value in NVS, it generates the key based on endpoint, cluster, and attribute id. * @brief Erases the attribute value in NVS, it generates the key based on endpoint, cluster, and attribute id.
@@ -36,14 +36,14 @@ BasicInformationCluster::OptionalAttributesSet GetOptionalAttrsSet()
{ {
BasicInformationCluster::OptionalAttributesSet attrsSet; BasicInformationCluster::OptionalAttributesSet attrsSet;
return attrsSet.Set<ManufacturingDate::Id>(IsAttrEnabled(ManufacturingDate::Id)) return attrsSet.Set<ManufacturingDate::Id>(IsAttrEnabled(ManufacturingDate::Id))
.Set<PartNumber::Id>(IsAttrEnabled(PartNumber::Id)) .Set<PartNumber::Id>(IsAttrEnabled(PartNumber::Id))
.Set<ProductURL::Id>(IsAttrEnabled(ProductURL::Id)) .Set<ProductURL::Id>(IsAttrEnabled(ProductURL::Id))
.Set<ProductLabel::Id>(IsAttrEnabled(ProductLabel::Id)) .Set<ProductLabel::Id>(IsAttrEnabled(ProductLabel::Id))
.Set<SerialNumber::Id>(IsAttrEnabled(SerialNumber::Id)) .Set<SerialNumber::Id>(IsAttrEnabled(SerialNumber::Id))
.Set<LocalConfigDisabled::Id>(IsAttrEnabled(LocalConfigDisabled::Id)) .Set<LocalConfigDisabled::Id>(IsAttrEnabled(LocalConfigDisabled::Id))
.Set<Reachable::Id>(IsAttrEnabled(Reachable::Id)) .Set<Reachable::Id>(IsAttrEnabled(Reachable::Id))
.Set<ProductAppearance::Id>(IsAttrEnabled(ProductAppearance::Id)) .Set<ProductAppearance::Id>(IsAttrEnabled(ProductAppearance::Id))
.Set<UniqueID::Id>(IsAttrEnabled(UniqueID::Id)); .Set<UniqueID::Id>(IsAttrEnabled(UniqueID::Id));
} }
} // namespace } // namespace
@@ -50,23 +50,23 @@ CHIP_ERROR GetClusterConfig(EndpointId endpointId, BitMask<Feature> &featureMap,
} }
esp_matter_attr_val_t tmp_attr_val; esp_matter_attr_val_t tmp_attr_val;
VerifyOrReturnError(get_attr_val(cluster, Globals::Attributes::FeatureMap::Id, tmp_attr_val) == ESP_OK && VerifyOrReturnError(get_attr_val(cluster, Globals::Attributes::FeatureMap::Id, tmp_attr_val) == ESP_OK &&
tmp_attr_val.type == ESP_MATTER_VAL_TYPE_BITMAP32, tmp_attr_val.type == ESP_MATTER_VAL_TYPE_BITMAP32,
CHIP_ERROR_INTERNAL); CHIP_ERROR_INTERNAL);
featureMap = BitMask<BooleanStateConfiguration::Feature>(tmp_attr_val.val.u32); featureMap = BitMask<BooleanStateConfiguration::Feature>(tmp_attr_val.val.u32);
if (featureMap.Has(Feature::kSensitivityLevel)) { if (featureMap.Has(Feature::kSensitivityLevel)) {
VerifyOrReturnError(get_attr_val(cluster, Attributes::SupportedSensitivityLevels::Id, tmp_attr_val) == ESP_OK && VerifyOrReturnError(get_attr_val(cluster, Attributes::SupportedSensitivityLevels::Id, tmp_attr_val) == ESP_OK &&
tmp_attr_val.type == ESP_MATTER_VAL_TYPE_UINT8, tmp_attr_val.type == ESP_MATTER_VAL_TYPE_UINT8,
CHIP_ERROR_INTERNAL); CHIP_ERROR_INTERNAL);
supportedSensitivityLevels = tmp_attr_val.val.u8; supportedSensitivityLevels = tmp_attr_val.val.u8;
if (get_attr_val(cluster, Attributes::DefaultSensitivityLevel::Id, tmp_attr_val) == ESP_OK && if (get_attr_val(cluster, Attributes::DefaultSensitivityLevel::Id, tmp_attr_val) == ESP_OK &&
tmp_attr_val.type == ESP_MATTER_VAL_TYPE_UINT8) { tmp_attr_val.type == ESP_MATTER_VAL_TYPE_UINT8) {
defaultSensitivityLevel = tmp_attr_val.val.u8; defaultSensitivityLevel = tmp_attr_val.val.u8;
optionalAttrSet.Set<Attributes::DefaultSensitivityLevel::Id>(); optionalAttrSet.Set<Attributes::DefaultSensitivityLevel::Id>();
} }
} }
if (featureMap.Has(Feature::kAudible) || featureMap.Has(Feature::kVisual)) { if (featureMap.Has(Feature::kAudible) || featureMap.Has(Feature::kVisual)) {
VerifyOrReturnError(get_attr_val(cluster, Attributes::AlarmsSupported::Id, tmp_attr_val) == ESP_OK && VerifyOrReturnError(get_attr_val(cluster, Attributes::AlarmsSupported::Id, tmp_attr_val) == ESP_OK &&
tmp_attr_val.type == ESP_MATTER_VAL_TYPE_BITMAP8, tmp_attr_val.type == ESP_MATTER_VAL_TYPE_BITMAP8,
CHIP_ERROR_INTERNAL); CHIP_ERROR_INTERNAL);
alarmsSupported = AlarmModeBitmap(tmp_attr_val.val.u8); alarmsSupported = AlarmModeBitmap(tmp_attr_val.val.u8);
if (esp_matter::attribute::get(cluster, Attributes::AlarmsEnabled::Id)) { if (esp_matter::attribute::get(cluster, Attributes::AlarmsEnabled::Id)) {
@@ -109,11 +109,11 @@ void ESPMatterBooleanStateConfigurationClusterServerInitCallback(EndpointId endp
return; return;
} }
gServers[endpointId].Create(endpointId, featureMap, optionalAttrSet, gServers[endpointId].Create(endpointId, featureMap, optionalAttrSet,
BooleanStateConfigurationCluster::StartupConfiguration{ BooleanStateConfigurationCluster::StartupConfiguration{
.supportedSensitivityLevels = supportedSensitivityLevels, .supportedSensitivityLevels = supportedSensitivityLevels,
.defaultSensitivityLevel = defaultSensitivityLevel, .defaultSensitivityLevel = defaultSensitivityLevel,
.alarmsSupported = alarmsSupported, .alarmsSupported = alarmsSupported,
}); });
err = esp_matter::data_model::provider::get_instance().registry().Register(gServers[endpointId].Registration()); err = esp_matter::data_model::provider::get_instance().registry().Register(gServers[endpointId].Registration());
if (err != CHIP_NO_ERROR) { if (err != CHIP_NO_ERROR) {
ChipLogError(AppServer, "Failed to register BooleanStateConfiguration - Error %" CHIP_ERROR_FORMAT, ChipLogError(AppServer, "Failed to register BooleanStateConfiguration - Error %" CHIP_ERROR_FORMAT,
@@ -128,7 +128,7 @@ void ESPMatterBooleanStateConfigurationClusterServerShutdownCallback(EndpointId
return; return;
} }
CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Unregister( CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Unregister(
&gServers[endpointId].Cluster(), shutdownType); &gServers[endpointId].Cluster(), shutdownType);
if (err != CHIP_NO_ERROR) { if (err != CHIP_NO_ERROR) {
ChipLogError(AppServer, "Failed to unregister BooleanStateConfiguration - Error %" CHIP_ERROR_FORMAT, ChipLogError(AppServer, "Failed to unregister BooleanStateConfiguration - Error %" CHIP_ERROR_FORMAT,
err.Format()); err.Format());
@@ -48,7 +48,7 @@ inline CHIP_ERROR SetAlarmsActive(EndpointId ep, BitMask<AlarmModeBitmap> alarms
VerifyOrReturnError(cluster != nullptr, CHIP_ERROR_NO_ENDPOINT); VerifyOrReturnError(cluster != nullptr, CHIP_ERROR_NO_ENDPOINT);
auto status = cluster->SetAlarmsActive(alarms); auto status = cluster->SetAlarmsActive(alarms);
return (status == Protocols::InteractionModel::Status::Success) ? CHIP_NO_ERROR return (status == Protocols::InteractionModel::Status::Success) ? CHIP_NO_ERROR
: CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(status); : CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(status);
} }
inline CHIP_ERROR SetAllEnabledAlarmsActive(EndpointId ep) inline CHIP_ERROR SetAllEnabledAlarmsActive(EndpointId ep)
@@ -57,7 +57,7 @@ inline CHIP_ERROR SetAllEnabledAlarmsActive(EndpointId ep)
VerifyOrReturnError(cluster != nullptr, CHIP_ERROR_NO_ENDPOINT); VerifyOrReturnError(cluster != nullptr, CHIP_ERROR_NO_ENDPOINT);
auto status = cluster->SetAllEnabledAlarmsActive(); auto status = cluster->SetAllEnabledAlarmsActive();
return (status == Protocols::InteractionModel::Status::Success) ? CHIP_NO_ERROR return (status == Protocols::InteractionModel::Status::Success) ? CHIP_NO_ERROR
: CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(status); : CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(status);
} }
inline CHIP_ERROR ClearAllAlarms(EndpointId ep) inline CHIP_ERROR ClearAllAlarms(EndpointId ep)
@@ -74,7 +74,7 @@ inline CHIP_ERROR SuppressAlarms(EndpointId ep, BitMask<BooleanStateConfiguratio
VerifyOrReturnError(cluster != nullptr, CHIP_ERROR_NO_ENDPOINT); VerifyOrReturnError(cluster != nullptr, CHIP_ERROR_NO_ENDPOINT);
auto status = cluster->SuppressAlarms(alarms); auto status = cluster->SuppressAlarms(alarms);
return (status == Protocols::InteractionModel::Status::Success) ? CHIP_NO_ERROR return (status == Protocols::InteractionModel::Status::Success) ? CHIP_NO_ERROR
: CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(status); : CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(status);
} }
inline CHIP_ERROR SetCurrentSensitivityLevel(EndpointId ep, uint8_t level) inline CHIP_ERROR SetCurrentSensitivityLevel(EndpointId ep, uint8_t level)
@@ -54,23 +54,35 @@ public:
* Sets the Enabled attribute. Note, this also handles writing the new value into non-volatile storage. * Sets the Enabled attribute. Note, this also handles writing the new value into non-volatile storage.
* @param Enabled The value to which the Enabled is to be set. * @param Enabled The value to which the Enabled is to be set.
*/ */
Protocols::InteractionModel::Status SetEnabled(bool enabled) { return mCluster.Cluster().SetEnabled(enabled); } Protocols::InteractionModel::Status SetEnabled(bool enabled)
{
return mCluster.Cluster().SetEnabled(enabled);
}
// Attribute Getters // Attribute Getters
/** /**
* @return The Current SelectedChime. * @return The Current SelectedChime.
*/ */
uint8_t GetSelectedChime() const { return mCluster.Cluster().GetSelectedChime(); } uint8_t GetSelectedChime() const
{
return mCluster.Cluster().GetSelectedChime();
}
/** /**
* @return The Enabled attribute.. * @return The Enabled attribute..
*/ */
bool GetEnabled() const { return mCluster.Cluster().GetEnabled(); } bool GetEnabled() const
{
return mCluster.Cluster().GetEnabled();
}
/** /**
* @return The endpoint ID. * @return The endpoint ID.
*/ */
EndpointId GetEndpointId() { return mCluster.Cluster().GetPaths()[0].mEndpointId; } EndpointId GetEndpointId()
{
return mCluster.Cluster().GetPaths()[0].mEndpointId;
}
// Cluster constants from the spec // Cluster constants from the spec
static constexpr uint8_t kMaxChimeSoundNameSize = ChimeCluster::kMaxChimeSoundNameSize; static constexpr uint8_t kMaxChimeSoundNameSize = ChimeCluster::kMaxChimeSoundNameSize;
@@ -35,28 +35,25 @@ namespace {
* emberAfSetDynamicEndpointWithEpUniqueId() by calling emberAfEndpointEnableDisable(), which calls initializeEndpoint(). The tag * emberAfSetDynamicEndpointWithEpUniqueId() by calling emberAfEndpointEnableDisable(), which calls initializeEndpoint(). The tag
* list is a fixed attribute, but to maintain backwards compatibility we get that information within the functions here. * list is a fixed attribute, but to maintain backwards compatibility we get that information within the functions here.
*/ */
class ESPMatterDescriptorCluster : public DescriptorCluster class ESPMatterDescriptorCluster : public DescriptorCluster {
{
public: public:
ESPMatterDescriptorCluster(EndpointId endpointId, DescriptorCluster::OptionalAttributesSet optionalAttributeSet) : ESPMatterDescriptorCluster(EndpointId endpointId, DescriptorCluster::OptionalAttributesSet optionalAttributeSet) :
DescriptorCluster(endpointId, optionalAttributeSet, Span<const SemanticTag>()) DescriptorCluster(endpointId, optionalAttributeSet, Span<const SemanticTag>())
{} {}
CHIP_ERROR Attributes(const ConcreteClusterPath & path, ReadOnlyBufferBuilder<DataModel::AttributeEntry> & builder) override CHIP_ERROR Attributes(const ConcreteClusterPath &path, ReadOnlyBufferBuilder<DataModel::AttributeEntry> &builder) override
{ {
if (!mFetchedSemanticTags) if (!mFetchedSemanticTags) {
{
ReturnErrorOnFailure(GetSemanticTag(path.mEndpointId, mSemanticTags)); ReturnErrorOnFailure(GetSemanticTag(path.mEndpointId, mSemanticTags));
mFetchedSemanticTags = true; mFetchedSemanticTags = true;
} }
return DescriptorCluster::Attributes(path, builder); return DescriptorCluster::Attributes(path, builder);
} }
DataModel::ActionReturnStatus ReadAttribute(const DataModel::ReadAttributeRequest & request, DataModel::ActionReturnStatus ReadAttribute(const DataModel::ReadAttributeRequest &request,
AttributeValueEncoder & encoder) override AttributeValueEncoder &encoder) override
{ {
if (!mFetchedSemanticTags) if (!mFetchedSemanticTags) {
{
ReturnErrorOnFailure(GetSemanticTag(request.path.mEndpointId, mSemanticTags)); ReturnErrorOnFailure(GetSemanticTag(request.path.mEndpointId, mSemanticTags));
mFetchedSemanticTags = true; mFetchedSemanticTags = true;
} }
@@ -23,7 +23,7 @@ namespace app {
namespace Clusters { namespace Clusters {
namespace DeviceEnergyManagement { namespace DeviceEnergyManagement {
Instance::Instance(EndpointId aEndpointId, Delegate & aDelegate, BitMask<Feature> aFeature) : Instance::Instance(EndpointId aEndpointId, Delegate &aDelegate, BitMask<Feature> aFeature) :
mCluster(DeviceEnergyManagementCluster::Config(aEndpointId, aFeature, aDelegate)) mCluster(DeviceEnergyManagementCluster::Config(aEndpointId, aFeature, aDelegate))
{} {}
@@ -31,8 +31,7 @@ CHIP_ERROR Instance::Init()
{ {
CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Register(mCluster.Registration()); CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Register(mCluster.Registration());
if (err != CHIP_NO_ERROR) if (err != CHIP_NO_ERROR) {
{
ChipLogError(AppServer, "Failed to register cluster %u/" ChipLogFormatMEI ": %" CHIP_ERROR_FORMAT, ChipLogError(AppServer, "Failed to register cluster %u/" ChipLogFormatMEI ": %" CHIP_ERROR_FORMAT,
mCluster.Cluster().GetPaths()[0].mEndpointId, ChipLogValueMEI(DeviceEnergyManagement::Id), err.Format()); mCluster.Cluster().GetPaths()[0].mEndpointId, ChipLogValueMEI(DeviceEnergyManagement::Id), err.Format());
} }
@@ -43,8 +42,7 @@ void Instance::Shutdown()
{ {
CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Unregister(&mCluster.Cluster()); CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Unregister(&mCluster.Cluster());
if (err != CHIP_NO_ERROR) if (err != CHIP_NO_ERROR) {
{
ChipLogError(AppServer, "Failed to unregister cluster %u/" ChipLogFormatMEI ": %" CHIP_ERROR_FORMAT, ChipLogError(AppServer, "Failed to unregister cluster %u/" ChipLogFormatMEI ": %" CHIP_ERROR_FORMAT,
mCluster.Cluster().GetPaths()[0].mEndpointId, ChipLogValueMEI(DeviceEnergyManagement::Id), err.Format()); mCluster.Cluster().GetPaths()[0].mEndpointId, ChipLogValueMEI(DeviceEnergyManagement::Id), err.Format());
} }
@@ -19,10 +19,9 @@
namespace chip::app::Clusters::DeviceEnergyManagement { namespace chip::app::Clusters::DeviceEnergyManagement {
class Instance class Instance {
{
public: public:
Instance(EndpointId aEndpointId, Delegate & aDelegate, BitMask<Feature> aFeature); Instance(EndpointId aEndpointId, Delegate &aDelegate, BitMask<Feature> aFeature);
CHIP_ERROR Init(); CHIP_ERROR Init();
void Shutdown(); void Shutdown();
@@ -35,7 +35,7 @@ uint32_t get_feature_map(esp_matter::cluster_t *cluster)
if (attribute) { if (attribute) {
esp_matter_attr_val_t val = esp_matter_invalid(nullptr); esp_matter_attr_val_t val = esp_matter_invalid(nullptr);
if (esp_matter::attribute::get_val_internal(attribute, &val) == ESP_OK && if (esp_matter::attribute::get_val_internal(attribute, &val) == ESP_OK &&
val.type == ESP_MATTER_VAL_TYPE_BITMAP32) { val.type == ESP_MATTER_VAL_TYPE_BITMAP32) {
return val.val.u32; return val.val.u32;
} }
} }
@@ -136,7 +136,7 @@ void ESPMatterElectricalEnergyMeasurementClusterServerShutdownCallback(EndpointI
{ {
VerifyOrReturn(gServers[endpointId].IsConstructed()); VerifyOrReturn(gServers[endpointId].IsConstructed());
CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Unregister( CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Unregister(
&gServers[endpointId].Cluster(), shutdownType); &gServers[endpointId].Cluster(), shutdownType);
if (err != CHIP_NO_ERROR) { if (err != CHIP_NO_ERROR) {
ChipLogError(AppServer, "Failed to unregister AccessControl - Error %" CHIP_ERROR_FORMAT, err.Format()); ChipLogError(AppServer, "Failed to unregister AccessControl - Error %" CHIP_ERROR_FORMAT, err.Format());
} }
@@ -18,15 +18,15 @@
namespace chip::app::Clusters::ElectricalEnergyMeasurement { namespace chip::app::Clusters::ElectricalEnergyMeasurement {
bool NotifyCumulativeEnergyMeasured(EndpointId endpointId, const Optional<Structs::EnergyMeasurementStruct::Type> & energyImported, bool NotifyCumulativeEnergyMeasured(EndpointId endpointId, const Optional<Structs::EnergyMeasurementStruct::Type> &energyImported,
const Optional<Structs::EnergyMeasurementStruct::Type> & energyExported); const Optional<Structs::EnergyMeasurementStruct::Type> &energyExported);
bool NotifyPeriodicEnergyMeasured(EndpointId endpointId, const Optional<Structs::EnergyMeasurementStruct::Type> & energyImported, bool NotifyPeriodicEnergyMeasured(EndpointId endpointId, const Optional<Structs::EnergyMeasurementStruct::Type> &energyImported,
const Optional<Structs::EnergyMeasurementStruct::Type> & energyExported); const Optional<Structs::EnergyMeasurementStruct::Type> &energyExported);
CHIP_ERROR SetMeasurementAccuracy(EndpointId endpointId, const Structs::MeasurementAccuracyStruct::Type & accuracy); CHIP_ERROR SetMeasurementAccuracy(EndpointId endpointId, const Structs::MeasurementAccuracyStruct::Type &accuracy);
CHIP_ERROR SetCumulativeReset(EndpointId endpointId, const Optional<Structs::CumulativeEnergyResetStruct::Type> & cumulativeReset); CHIP_ERROR SetCumulativeReset(EndpointId endpointId, const Optional<Structs::CumulativeEnergyResetStruct::Type> &cumulativeReset);
const ElectricalEnergyMeasurement::MeasurementData * MeasurementDataForEndpoint(EndpointId endpointId); const ElectricalEnergyMeasurement::MeasurementData * MeasurementDataForEndpoint(EndpointId endpointId);
@@ -28,22 +28,22 @@ ElectricalPowerMeasurementCluster::OptionalAttributesSet Instance::FromLegacyOpt
attrs.Set<Attributes::Ranges::Id>(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeRanges)); attrs.Set<Attributes::Ranges::Id>(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeRanges));
attrs.Set<Attributes::Voltage::Id>(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeVoltage)); attrs.Set<Attributes::Voltage::Id>(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeVoltage));
attrs.Set<Attributes::ActiveCurrent::Id>( attrs.Set<Attributes::ActiveCurrent::Id>(
aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeActiveCurrent)); aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeActiveCurrent));
attrs.Set<Attributes::ReactiveCurrent::Id>( attrs.Set<Attributes::ReactiveCurrent::Id>(
aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeReactiveCurrent)); aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeReactiveCurrent));
attrs.Set<Attributes::ApparentCurrent::Id>( attrs.Set<Attributes::ApparentCurrent::Id>(
aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeApparentCurrent)); aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeApparentCurrent));
attrs.Set<Attributes::ReactivePower::Id>( attrs.Set<Attributes::ReactivePower::Id>(
aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeReactivePower)); aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeReactivePower));
attrs.Set<Attributes::ApparentPower::Id>( attrs.Set<Attributes::ApparentPower::Id>(
aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeApparentPower)); aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeApparentPower));
attrs.Set<Attributes::RMSVoltage::Id>(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeRMSVoltage)); attrs.Set<Attributes::RMSVoltage::Id>(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeRMSVoltage));
attrs.Set<Attributes::RMSCurrent::Id>(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeRMSCurrent)); attrs.Set<Attributes::RMSCurrent::Id>(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeRMSCurrent));
attrs.Set<Attributes::RMSPower::Id>(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeRMSPower)); attrs.Set<Attributes::RMSPower::Id>(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeRMSPower));
attrs.Set<Attributes::Frequency::Id>(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeFrequency)); attrs.Set<Attributes::Frequency::Id>(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeFrequency));
attrs.Set<Attributes::PowerFactor::Id>(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributePowerFactor)); attrs.Set<Attributes::PowerFactor::Id>(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributePowerFactor));
attrs.Set<Attributes::NeutralCurrent::Id>( attrs.Set<Attributes::NeutralCurrent::Id>(
aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeNeutralCurrent)); aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeNeutralCurrent));
return attrs; return attrs;
} }
@@ -20,8 +20,7 @@
namespace chip::app::Clusters::ElectricalPowerMeasurement { namespace chip::app::Clusters::ElectricalPowerMeasurement {
enum class OptionalAttributes : uint32_t enum class OptionalAttributes : uint32_t {
{
kOptionalAttributeRanges = 0x1, kOptionalAttributeRanges = 0x1,
kOptionalAttributeVoltage = 0x2, kOptionalAttributeVoltage = 0x2,
kOptionalAttributeActiveCurrent = 0x4, kOptionalAttributeActiveCurrent = 0x4,
@@ -37,17 +36,16 @@ enum class OptionalAttributes : uint32_t
kOptionalAttributeNeutralCurrent = 0x1000, kOptionalAttributeNeutralCurrent = 0x1000,
}; };
class Instance class Instance {
{
public: public:
Instance(EndpointId aEndpointId, Delegate & aDelegate, BitMask<Feature> aFeature, Instance(EndpointId aEndpointId, Delegate &aDelegate, BitMask<Feature> aFeature,
BitMask<OptionalAttributes> aOptionalAttributes) : BitMask<OptionalAttributes> aOptionalAttributes) :
mCluster(ElectricalPowerMeasurementCluster::Config{ mCluster(ElectricalPowerMeasurementCluster::Config{
.endpointId = aEndpointId, .endpointId = aEndpointId,
.delegate = aDelegate, .delegate = aDelegate,
.features = aFeature, .features = aFeature,
.optionalAttributes = FromLegacyOptionalAttributes(aOptionalAttributes), .optionalAttributes = FromLegacyOptionalAttributes(aOptionalAttributes),
}) })
{} {}
CHIP_ERROR Init(); CHIP_ERROR Init();
@@ -32,7 +32,7 @@ uint32_t get_feature_map(esp_matter::cluster_t *cluster)
if (attribute) { if (attribute) {
esp_matter_attr_val_t val = esp_matter_invalid(nullptr); esp_matter_attr_val_t val = esp_matter_invalid(nullptr);
if (esp_matter::attribute::get_val_internal(attribute, &val) == ESP_OK && if (esp_matter::attribute::get_val_internal(attribute, &val) == ESP_OK &&
val.type == ESP_MATTER_VAL_TYPE_BITMAP32) { val.type == ESP_MATTER_VAL_TYPE_BITMAP32) {
return val.val.u32; return val.val.u32;
} }
} }
@@ -82,7 +82,7 @@ void ESPMatterEthernetNetworkDiagnosticsClusterServerShutdownCallback(EndpointId
ClusterShutdownType shutdownType) ClusterShutdownType shutdownType)
{ {
CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Unregister( CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Unregister(
&gServers[endpointId].Cluster(), shutdownType); &gServers[endpointId].Cluster(), shutdownType);
if (err != CHIP_NO_ERROR) { if (err != CHIP_NO_ERROR) {
ChipLogError(AppServer, ChipLogError(AppServer,
"Failed to unregister EthernetNetworkDiagnostics on endpoint %u - Error: %" CHIP_ERROR_FORMAT, "Failed to unregister EthernetNetworkDiagnostics on endpoint %u - Error: %" CHIP_ERROR_FORMAT,
@@ -44,18 +44,18 @@ GeneralCommissioningCluster * Instance()
if (!gServer.IsConstructed()) { if (!gServer.IsConstructed()) {
gServer.Create( gServer.Create(
GeneralCommissioningCluster::Context { GeneralCommissioningCluster::Context {
.commissioningWindowManager = Server::GetInstance().GetCommissioningWindowManager(), // .commissioningWindowManager = Server::GetInstance().GetCommissioningWindowManager(), //
.configurationManager = DeviceLayer::ConfigurationMgr(), // .configurationManager = DeviceLayer::ConfigurationMgr(), //
.deviceControlServer = DeviceLayer::DeviceControlServer::DeviceControlSvr(), // .deviceControlServer = DeviceLayer::DeviceControlServer::DeviceControlSvr(), //
.fabricTable = Server::GetInstance().GetFabricTable(), // .fabricTable = Server::GetInstance().GetFabricTable(), //
.failsafeContext = Server::GetInstance().GetFailSafeContext(), // .failsafeContext = Server::GetInstance().GetFailSafeContext(), //
.platformManager = DeviceLayer::PlatformMgr(), // .platformManager = DeviceLayer::PlatformMgr(), //
#if CHIP_CONFIG_TERMS_AND_CONDITIONS_REQUIRED #if CHIP_CONFIG_TERMS_AND_CONDITIONS_REQUIRED
.termsAndConditionsProvider = TermsAndConditionsManager::GetInstance(), .termsAndConditionsProvider = TermsAndConditionsManager::GetInstance(),
#endif // CHIP_CONFIG_TERMS_AND_CONDITIONS_REQUIRED #endif // CHIP_CONFIG_TERMS_AND_CONDITIONS_REQUIRED
}, },
optionalAttrs); optionalAttrs);
} }
return &gServer.Cluster(); return &gServer.Cluster();
@@ -75,18 +75,18 @@ void ESPMatterGeneralCommissioningClusterServerInitCallback(EndpointId endpointI
if (!gServer.IsConstructed()) { if (!gServer.IsConstructed()) {
gServer.Create( gServer.Create(
GeneralCommissioningCluster::Context { GeneralCommissioningCluster::Context {
.commissioningWindowManager = Server::GetInstance().GetCommissioningWindowManager(), // .commissioningWindowManager = Server::GetInstance().GetCommissioningWindowManager(), //
.configurationManager = DeviceLayer::ConfigurationMgr(), // .configurationManager = DeviceLayer::ConfigurationMgr(), //
.deviceControlServer = DeviceLayer::DeviceControlServer::DeviceControlSvr(), // .deviceControlServer = DeviceLayer::DeviceControlServer::DeviceControlSvr(), //
.fabricTable = Server::GetInstance().GetFabricTable(), // .fabricTable = Server::GetInstance().GetFabricTable(), //
.failsafeContext = Server::GetInstance().GetFailSafeContext(), // .failsafeContext = Server::GetInstance().GetFailSafeContext(), //
.platformManager = DeviceLayer::PlatformMgr(), // .platformManager = DeviceLayer::PlatformMgr(), //
#if CHIP_CONFIG_TERMS_AND_CONDITIONS_REQUIRED #if CHIP_CONFIG_TERMS_AND_CONDITIONS_REQUIRED
.termsAndConditionsProvider = TermsAndConditionsManager::GetInstance(), .termsAndConditionsProvider = TermsAndConditionsManager::GetInstance(),
#endif // CHIP_CONFIG_TERMS_AND_CONDITIONS_REQUIRED #endif // CHIP_CONFIG_TERMS_AND_CONDITIONS_REQUIRED
}, },
optionalAttrs); optionalAttrs);
} }
CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Register(gServer.Registration()); CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Register(gServer.Registration());
@@ -103,7 +103,7 @@ void ESPMatterGeneralDiagnosticsClusterServerInitCallback(EndpointId endpointId)
CHIP_ERROR err = CHIP_NO_ERROR; CHIP_ERROR err = CHIP_NO_ERROR;
if (IsCommandEnabled(endpointId, GeneralDiagnostics::Commands::PayloadTestRequest::Id, COMMAND_FLAG_ACCEPTED) || if (IsCommandEnabled(endpointId, GeneralDiagnostics::Commands::PayloadTestRequest::Id, COMMAND_FLAG_ACCEPTED) ||
IsClusterEnabled(endpointId, TimeSynchronization::Id)) { IsClusterEnabled(endpointId, TimeSynchronization::Id)) {
gServer.isFullConfigurable = true; gServer.isFullConfigurable = true;
GeneralDiagnosticsFunctionsConfig functionsConfig{ GeneralDiagnosticsFunctionsConfig functionsConfig{
/* /*
@@ -114,9 +114,9 @@ void ESPMatterGeneralDiagnosticsClusterServerInitCallback(EndpointId endpointId)
IsCommandEnabled(endpointId, GeneralDiagnostics::Commands::PayloadTestRequest::Id, COMMAND_FLAG_ACCEPTED), IsCommandEnabled(endpointId, GeneralDiagnostics::Commands::PayloadTestRequest::Id, COMMAND_FLAG_ACCEPTED),
}; };
gServer.fullConfigurableServer.Create(attrSet,featureFlags, InteractionModelEngine::GetInstance(), functionsConfig); gServer.fullConfigurableServer.Create(attrSet, featureFlags, InteractionModelEngine::GetInstance(), functionsConfig);
err = esp_matter::data_model::provider::get_instance().registry().Register( err = esp_matter::data_model::provider::get_instance().registry().Register(
gServer.fullConfigurableServer.Registration()); gServer.fullConfigurableServer.Registration());
} else { } else {
gServer.server.Create(attrSet, featureFlags, InteractionModelEngine::GetInstance()); gServer.server.Create(attrSet, featureFlags, InteractionModelEngine::GetInstance());
err = esp_matter::data_model::provider::get_instance().registry().Register(gServer.server.Registration()); err = esp_matter::data_model::provider::get_instance().registry().Register(gServer.server.Registration());
@@ -132,7 +132,7 @@ void ESPMatterGeneralDiagnosticsClusterServerShutdownCallback(EndpointId endpoin
CHIP_ERROR err = CHIP_NO_ERROR; CHIP_ERROR err = CHIP_NO_ERROR;
if (gServer.isFullConfigurable) { if (gServer.isFullConfigurable) {
err = esp_matter::data_model::provider::get_instance().registry().Unregister( err = esp_matter::data_model::provider::get_instance().registry().Unregister(
&gServer.fullConfigurableServer.Cluster()); &gServer.fullConfigurableServer.Cluster());
gServer.fullConfigurableServer.Destroy(); gServer.fullConfigurableServer.Destroy();
} else { } else {
err = esp_matter::data_model::provider::get_instance().registry().Unregister(&gServer.server.Cluster()); err = esp_matter::data_model::provider::get_instance().registry().Unregister(&gServer.server.Cluster());
@@ -19,12 +19,12 @@
namespace chip::app::Clusters::GeneralDiagnostics { namespace chip::app::Clusters::GeneralDiagnostics {
void GlobalNotifyDeviceReboot(GeneralDiagnostics::BootReasonEnum bootReason); void GlobalNotifyDeviceReboot(GeneralDiagnostics::BootReasonEnum bootReason);
void GlobalNotifyHardwareFaultsDetect(const DeviceLayer::GeneralFaults<DeviceLayer::kMaxHardwareFaults> & previous, void GlobalNotifyHardwareFaultsDetect(const DeviceLayer::GeneralFaults<DeviceLayer::kMaxHardwareFaults> &previous,
const DeviceLayer::GeneralFaults<DeviceLayer::kMaxHardwareFaults> & current); const DeviceLayer::GeneralFaults<DeviceLayer::kMaxHardwareFaults> &current);
void GlobalNotifyRadioFaultsDetect(const DeviceLayer::GeneralFaults<DeviceLayer::kMaxRadioFaults> & previous, void GlobalNotifyRadioFaultsDetect(const DeviceLayer::GeneralFaults<DeviceLayer::kMaxRadioFaults> &previous,
const DeviceLayer::GeneralFaults<DeviceLayer::kMaxRadioFaults> & current); const DeviceLayer::GeneralFaults<DeviceLayer::kMaxRadioFaults> &current);
void GlobalNotifyNetworkFaultsDetect(const DeviceLayer::GeneralFaults<DeviceLayer::kMaxNetworkFaults> & previous, void GlobalNotifyNetworkFaultsDetect(const DeviceLayer::GeneralFaults<DeviceLayer::kMaxNetworkFaults> &previous,
const DeviceLayer::GeneralFaults<DeviceLayer::kMaxNetworkFaults> & current); const DeviceLayer::GeneralFaults<DeviceLayer::kMaxNetworkFaults> &current);
} // namespace chip::app::Clusters::GeneralDiagnostics } // namespace chip::app::Clusters::GeneralDiagnostics
@@ -31,7 +31,7 @@ LazyRegisteredServerCluster<GroupcastCluster> gServer;
void ESPMatterGroupcastClusterServerInitCallback(chip::EndpointId endpointId) void ESPMatterGroupcastClusterServerInitCallback(chip::EndpointId endpointId)
{ {
VerifyOrDie(endpointId == chip::kRootEndpointId); VerifyOrDie(endpointId == chip::kRootEndpointId);
// Currently we don't support groupcast cluster in our data model, create the cluster with LN feature enabled. // Currently we don't support groupcast cluster in our data model, create the cluster with LN feature enabled.
// TODO: We should create the cluster according to the enabled features after we add the cluster. // TODO: We should create the cluster according to the enabled features after we add the cluster.
chip::BitFlags<Groupcast::Feature> feature; chip::BitFlags<Groupcast::Feature> feature;
@@ -62,10 +62,10 @@ CHIP_ERROR GetClusterConfig(EndpointId endpointId, ICDManagementCluster::Optiona
} }
esp_matter_attr_val_t attr_val; esp_matter_attr_val_t attr_val;
if (get_attr_val(cluster, Attributes::UserActiveModeTriggerHint::Id, attr_val) == ESP_OK && if (get_attr_val(cluster, Attributes::UserActiveModeTriggerHint::Id, attr_val) == ESP_OK &&
attr_val.type == ESP_MATTER_VAL_TYPE_BITMAP32) { attr_val.type == ESP_MATTER_VAL_TYPE_BITMAP32) {
uatHint = BitMask<UserActiveModeTriggerBitmap>(attr_val.val.u32); uatHint = BitMask<UserActiveModeTriggerBitmap>(attr_val.val.u32);
if (get_attr_val(cluster, Attributes::UserActiveModeTriggerInstruction::Id, attr_val) == ESP_OK && if (get_attr_val(cluster, Attributes::UserActiveModeTriggerInstruction::Id, attr_val) == ESP_OK &&
attr_val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING && instructionSpan.size() >= attr_val.val.a.s) { attr_val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING && instructionSpan.size() >= attr_val.val.a.s) {
memcpy(instructionSpan.data(), (const char *)attr_val.val.a.b, attr_val.val.a.s); memcpy(instructionSpan.data(), (const char *)attr_val.val.a.b, attr_val.val.a.s);
instructionSpan.reduce_size(attr_val.val.a.s); instructionSpan.reduce_size(attr_val.val.a.s);
optionalAttrSet.Set<Attributes::UserActiveModeTriggerInstruction::Id>(); optionalAttrSet.Set<Attributes::UserActiveModeTriggerInstruction::Id>();
@@ -86,7 +86,10 @@ public:
} }
} }
} }
bool IsTriggerEffectEnabled() const override { return true; } bool IsTriggerEffectEnabled() const override
{
return true;
}
}; };
IdentifyLegacyDelegate gLegacyDelegate; IdentifyLegacyDelegate gLegacyDelegate;
@@ -140,16 +143,16 @@ Identify::Identify(EndpointId endpoint, onIdentifyStartCb onIdentifyStart, onIde
, mCurrentEffectIdentifier(effectIdentifier) , mCurrentEffectIdentifier(effectIdentifier)
, mEffectVariant(effectVariant) , mEffectVariant(effectVariant)
, mCluster( , mCluster(
chip::app::Clusters::IdentifyCluster::Config(endpoint, timerDelegate ? *timerDelegate : sDefaultTimerDelegate) chip::app::Clusters::IdentifyCluster::Config(endpoint, timerDelegate ? * timerDelegate : sDefaultTimerDelegate)
.WithIdentifyType(identifyType) .WithIdentifyType(identifyType)
.WithDelegate(&gLegacyDelegate) .WithDelegate(&gLegacyDelegate)
.WithEffectIdentifier(effectIdentifier) .WithEffectIdentifier(effectIdentifier)
.WithEffectVariant(effectVariant)) .WithEffectVariant(effectVariant))
{ {
RegisterLegacyIdentify(this); RegisterLegacyIdentify(this);
if (esp_matter::data_model::provider::get_instance().registry().Register(mCluster.Registration()) != if (esp_matter::data_model::provider::get_instance().registry().Register(mCluster.Registration()) !=
CHIP_NO_ERROR) { CHIP_NO_ERROR) {
ChipLogError(AppServer, "Failed to registry Identify cluster registration for endpoint %u", endpoint); ChipLogError(AppServer, "Failed to registry Identify cluster registration for endpoint %u", endpoint);
} }
}; };
@@ -157,7 +160,7 @@ Identify::Identify(EndpointId endpoint, onIdentifyStartCb onIdentifyStart, onIde
Identify::~Identify() Identify::~Identify()
{ {
if (esp_matter::data_model::provider::get_instance().registry().Unregister(&(mCluster.Cluster())) != if (esp_matter::data_model::provider::get_instance().registry().Unregister(&(mCluster.Cluster())) !=
CHIP_NO_ERROR) { CHIP_NO_ERROR) {
ChipLogError(AppServer, "Failed to unregistry Identify cluster registration"); ChipLogError(AppServer, "Failed to unregistry Identify cluster registration");
} }
UnregisterLegacyIdentify(this); UnregisterLegacyIdentify(this);
@@ -165,7 +168,7 @@ Identify::~Identify()
void ESPMatterIdentifyClusterServerInitCallback(EndpointId endpointId) void ESPMatterIdentifyClusterServerInitCallback(EndpointId endpointId)
{ {
// Intentionally make this function empty as the identify cluster will be registered when enabling endpoint. // Intentionally make this function empty as the identify cluster will be registered when enabling endpoint.
} }
void ESPMatterIdentifyClusterServerShutdownCallback(EndpointId endpointId, ClusterShutdownType shutdownType) void ESPMatterIdentifyClusterServerShutdownCallback(EndpointId endpointId, ClusterShutdownType shutdownType)
@@ -36,11 +36,11 @@ void ESPMatterLocalizationConfigurationClusterServerInitCallback(EndpointId endp
return; return;
} }
esp_matter::attribute_t *active_locale = esp_matter::attribute::get( esp_matter::attribute_t *active_locale = esp_matter::attribute::get(
endpointId, LocalizationConfiguration::Id, LocalizationConfiguration::Attributes::ActiveLocale::Id); endpointId, LocalizationConfiguration::Id, LocalizationConfiguration::Attributes::ActiveLocale::Id);
esp_matter_attr_val_t attr_val; esp_matter_attr_val_t attr_val;
if (active_locale && esp_matter::attribute::get_val_internal(active_locale, &attr_val) == ESP_OK && if (active_locale && esp_matter::attribute::get_val_internal(active_locale, &attr_val) == ESP_OK &&
attr_val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING && attr_val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING &&
attr_val.val.a.s <= LocalizationConfiguration::Attributes::ActiveLocale::TypeInfo::MaxLength()) { attr_val.val.a.s <= LocalizationConfiguration::Attributes::ActiveLocale::TypeInfo::MaxLength()) {
ChipLogError(AppServer, "Failed to get active locale on endpoint %u", endpointId); ChipLogError(AppServer, "Failed to get active locale on endpoint %u", endpointId);
} }
gServer.Create(*DeviceLayer::GetDeviceInfoProvider(), CharSpan((const char *)attr_val.val.a.b, attr_val.val.a.s)); gServer.Create(*DeviceLayer::GetDeviceInfoProvider(), CharSpan((const char *)attr_val.val.a.b, attr_val.val.a.s));
@@ -46,14 +46,13 @@ constexpr size_t kEthernetNetworkCommissioningClusterCount = 0;
#endif #endif
constexpr size_t kNetworkCommissioningClusterCount = kThreadNetworkCommissioningClusterCount + constexpr size_t kNetworkCommissioningClusterCount = kThreadNetworkCommissioningClusterCount +
kWifiNetworkCommissioningClusterCount + kEthernetNetworkCommissioningClusterCount; kWifiNetworkCommissioningClusterCount + kEthernetNetworkCommissioningClusterCount;
static_assert(kNetworkCommissioningClusterCount > 0, "NetworkCommissioningCluster count must be more than 0"); static_assert(kNetworkCommissioningClusterCount > 0, "NetworkCommissioningCluster count must be more than 0");
LazyRegisteredServerCluster<NetworkCommissioningCluster> gServers[kNetworkCommissioningClusterCount]; LazyRegisteredServerCluster<NetworkCommissioningCluster> gServers[kNetworkCommissioningClusterCount];
class ESPMatterGeneralCommissioningBreadcrumbTracker : public BreadCrumbTracker class ESPMatterGeneralCommissioningBreadcrumbTracker : public BreadCrumbTracker {
{
public: public:
void SetBreadCrumb(uint64_t value) override void SetBreadCrumb(uint64_t value) override
{ {
@@ -45,7 +45,7 @@ OccupancySensing::Feature getFeature(EndpointId endpointId)
esp_matter::attribute::get(endpointId, OccupancySensing::Id, Globals::Attributes::FeatureMap::Id); esp_matter::attribute::get(endpointId, OccupancySensing::Id, Globals::Attributes::FeatureMap::Id);
esp_matter_attr_val_t val = esp_matter_invalid(nullptr); esp_matter_attr_val_t val = esp_matter_invalid(nullptr);
if (attr && esp_matter::attribute::get_val_internal(attr, &val) == ESP_OK && if (attr && esp_matter::attribute::get_val_internal(attr, &val) == ESP_OK &&
val.type == ESP_MATTER_VAL_TYPE_BITMAP32) { val.type == ESP_MATTER_VAL_TYPE_BITMAP32) {
return static_cast<OccupancySensing::Feature>(val.val.u32); return static_cast<OccupancySensing::Feature>(val.val.u32);
} }
return static_cast<OccupancySensing::Feature>(0); return static_cast<OccupancySensing::Feature>(0);
@@ -67,17 +67,18 @@ void ESPMatterOccupancySensingClusterServerInitCallback(EndpointId endpointId)
// SetHoldTime() later to customize. Initial defaults come from typical values found in real devices on the // SetHoldTime() later to customize. Initial defaults come from typical values found in real devices on the
// market. // market.
constexpr chip::app::Clusters::OccupancySensing::Structs::HoldTimeLimitsStruct::Type kDefaultHoldTimeLimits = { constexpr chip::app::Clusters::OccupancySensing::Structs::HoldTimeLimitsStruct::Type kDefaultHoldTimeLimits = {
.holdTimeMin = 1, .holdTimeMax = 300, .holdTimeDefault = 30}; .holdTimeMin = 1, .holdTimeMax = 300, .holdTimeDefault = 30
};
config.WithHoldTime(kDefaultHoldTimeLimits.holdTimeDefault, kDefaultHoldTimeLimits, gDefaultTimerDelegate); config.WithHoldTime(kDefaultHoldTimeLimits.holdTimeDefault, kDefaultHoldTimeLimits, gDefaultTimerDelegate);
// Show deprecated attributes if enabled in Zap // Show deprecated attributes if enabled in Zap
config.WithDeprecatedAttributes( config.WithDeprecatedAttributes(
esp_matter::endpoint::is_attribute_enabled(endpointId, OccupancySensing::Id, esp_matter::endpoint::is_attribute_enabled(endpointId, OccupancySensing::Id,
Attributes::PIROccupiedToUnoccupiedDelay::Id) || Attributes::PIROccupiedToUnoccupiedDelay::Id) ||
esp_matter::endpoint::is_attribute_enabled(endpointId, OccupancySensing::Id, esp_matter::endpoint::is_attribute_enabled(endpointId, OccupancySensing::Id,
Attributes::UltrasonicOccupiedToUnoccupiedDelay::Id) || Attributes::UltrasonicOccupiedToUnoccupiedDelay::Id) ||
esp_matter::endpoint::is_attribute_enabled(endpointId, OccupancySensing::Id, esp_matter::endpoint::is_attribute_enabled(endpointId, OccupancySensing::Id,
Attributes::PhysicalContactOccupiedToUnoccupiedDelay::Id)); Attributes::PhysicalContactOccupiedToUnoccupiedDelay::Id));
} }
gServers[endpointId].Create(config); gServers[endpointId].Create(config);
CHIP_ERROR err = CHIP_ERROR err =
@@ -93,7 +94,7 @@ void ESPMatterOccupancySensingClusterServerShutdownCallback(EndpointId endpointI
return; return;
} }
CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Unregister( CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Unregister(
&gServers[endpointId].Cluster(), shutdownType); &gServers[endpointId].Cluster(), shutdownType);
if (err != CHIP_NO_ERROR) { if (err != CHIP_NO_ERROR) {
ChipLogError(AppServer, "Failed to unregister OccupancySensing - Error %" CHIP_ERROR_FORMAT, err.Format()); ChipLogError(AppServer, "Failed to unregister OccupancySensing - Error %" CHIP_ERROR_FORMAT, err.Format());
} }
@@ -34,7 +34,8 @@ void ESPMatterOperationalCredentialsClusterServerInitCallback(EndpointId endpoin
.sessionManager = Server::GetInstance().GetSecureSessionManager(), .sessionManager = Server::GetInstance().GetSecureSessionManager(),
.dnssdServer = app::DnssdServer::Instance(), .dnssdServer = app::DnssdServer::Instance(),
.commissioningWindowManager = .commissioningWindowManager =
Server::GetInstance().GetCommissioningWindowManager()}; Server::GetInstance().GetCommissioningWindowManager()
};
gServer.Create(endpoint, context); gServer.Create(endpoint, context);
CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Register(gServer.Registration()); CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Register(gServer.Registration());
if (err != CHIP_NO_ERROR) { if (err != CHIP_NO_ERROR) {
@@ -38,8 +38,7 @@ CHIP_ERROR Instance::Init()
void Instance::Shutdown() void Instance::Shutdown()
{ {
CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Unregister(&mCluster.Cluster()); CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Unregister(&mCluster.Cluster());
if (err != CHIP_NO_ERROR) if (err != CHIP_NO_ERROR) {
{
ChipLogError(AppServer, "Failed to unregister Power Topology cluster: %" CHIP_ERROR_FORMAT, err.Format()); ChipLogError(AppServer, "Failed to unregister Power Topology cluster: %" CHIP_ERROR_FORMAT, err.Format());
} }
} }
@@ -20,17 +20,19 @@
namespace chip::app::Clusters::PowerTopology { namespace chip::app::Clusters::PowerTopology {
class Instance class Instance {
{
public: public:
Instance(EndpointId aEndpointId, Delegate & aDelegate, BitMask<Feature> aFeature) : Instance(EndpointId aEndpointId, Delegate &aDelegate, BitMask<Feature> aFeature) :
mCluster(PowerTopologyCluster::Config{ mCluster(PowerTopologyCluster::Config{
.endpointId = aEndpointId, .endpointId = aEndpointId,
.delegate = aDelegate, .delegate = aDelegate,
.features = aFeature, .features = aFeature,
}) })
{} {}
~Instance() { Shutdown(); } ~Instance()
{
Shutdown();
}
CHIP_ERROR Init(); CHIP_ERROR Init();
void Shutdown(); void Shutdown();
@@ -65,22 +65,30 @@ typename app::NumericAttributeTraits<Type>::WorkingType ConvertDefaultValueToWor
bool IsExactlyOneValuePopulated(const AttributeValuePairType &type) bool IsExactlyOneValuePopulated(const AttributeValuePairType &type)
{ {
int count = 0; int count = 0;
if (type.valueUnsigned8.HasValue()) if (type.valueUnsigned8.HasValue()) {
count++; count++;
if (type.valueSigned8.HasValue()) }
if (type.valueSigned8.HasValue()) {
count++; count++;
if (type.valueUnsigned16.HasValue()) }
if (type.valueUnsigned16.HasValue()) {
count++; count++;
if (type.valueSigned16.HasValue()) }
if (type.valueSigned16.HasValue()) {
count++; count++;
if (type.valueUnsigned32.HasValue()) }
if (type.valueUnsigned32.HasValue()) {
count++; count++;
if (type.valueSigned32.HasValue()) }
if (type.valueSigned32.HasValue()) {
count++; count++;
if (type.valueUnsigned64.HasValue()) }
if (type.valueUnsigned64.HasValue()) {
count++; count++;
if (type.valueSigned64.HasValue()) }
if (type.valueSigned64.HasValue()) {
count++; count++;
}
return count == 1; return count == 1;
} }
@@ -40,9 +40,15 @@ public:
mEndpointId = endpointId; mEndpointId = endpointId;
mEndpointTableSize = endpointTableSize; mEndpointTableSize = endpointTableSize;
} }
EndpointId GetEndpointId() const { return mEndpointId; } EndpointId GetEndpointId() const
{
return mEndpointId;
}
ScenesManagementSceneTable *Take() override { return scenes::GetSceneTableImpl(mEndpointId, mEndpointTableSize); } ScenesManagementSceneTable *Take() override
{
return scenes::GetSceneTableImpl(mEndpointId, mEndpointTableSize);
}
void Release(ScenesManagementSceneTable *) override {} void Release(ScenesManagementSceneTable *) override {}
private: private:
@@ -189,13 +195,13 @@ void ESPMatterScenesManagementClusterServerInitCallback(EndpointId endpointId)
} }
gTableProviders[endpointId].SetParameters(endpointId, tableSize); gTableProviders[endpointId].SetParameters(endpointId, tableSize);
gServers[endpointId].Create(endpointId, gServers[endpointId].Create(endpointId,
ScenesManagementCluster::Context{ ScenesManagementCluster::Context{
.groupDataProvider = Credentials::GetGroupDataProvider(), .groupDataProvider = Credentials::GetGroupDataProvider(),
.fabricTable = &Server::GetInstance().GetFabricTable(), .fabricTable = &Server::GetInstance().GetFabricTable(),
.features = featureMap, .features = featureMap,
.sceneTableProvider = gTableProviders[endpointId], .sceneTableProvider = gTableProviders[endpointId],
.supportsCopyScene = supportsCopyScene, .supportsCopyScene = supportsCopyScene,
}); });
CHIP_ERROR err = CHIP_ERROR err =
esp_matter::data_model::provider::get_instance().registry().Register(gServers[endpointId].Registration()); esp_matter::data_model::provider::get_instance().registry().Register(gServers[endpointId].Registration());
if (err != CHIP_NO_ERROR) { if (err != CHIP_NO_ERROR) {
@@ -210,7 +216,7 @@ void ESPMatterScenesManagementClusterServerShutdownCallback(EndpointId endpointI
return; return;
} }
CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Unregister( CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Unregister(
&gServers[endpointId].Cluster(), shutdownType); &gServers[endpointId].Cluster(), shutdownType);
if (err != CHIP_NO_ERROR) { if (err != CHIP_NO_ERROR) {
ChipLogError(AppServer, "Failed to register Scenes on endpoint %u - Error: %" CHIP_ERROR_FORMAT, endpointId, ChipLogError(AppServer, "Failed to register Scenes on endpoint %u - Error: %" CHIP_ERROR_FORMAT, endpointId,
err.Format()); err.Format());
@@ -21,8 +21,7 @@
namespace chip::app::Clusters::ScenesManagement { namespace chip::app::Clusters::ScenesManagement {
class ScenesServer class ScenesServer {
{
public: public:
static constexpr SceneId kGlobalSceneId = 0x00; static constexpr SceneId kGlobalSceneId = 0x00;
static constexpr GroupId kGlobalSceneGroupId = 0x0000; static constexpr GroupId kGlobalSceneGroupId = 0x0000;
@@ -30,7 +29,7 @@ public:
ScenesServer() = default; ScenesServer() = default;
~ScenesServer() = default; ~ScenesServer() = default;
static ScenesServer & Instance(); static ScenesServer &Instance();
// Callbacks // Callbacks
void GroupWillBeRemoved(FabricIndex aFabricIx, EndpointId aEndpointId, GroupId aGroupId); void GroupWillBeRemoved(FabricIndex aFabricIx, EndpointId aEndpointId, GroupId aGroupId);
@@ -32,7 +32,7 @@ uint32_t get_feature_map(esp_matter::cluster_t *cluster)
if (attribute) { if (attribute) {
esp_matter_attr_val_t val = esp_matter_invalid(nullptr); esp_matter_attr_val_t val = esp_matter_invalid(nullptr);
if (esp_matter::attribute::get_val_internal(attribute, &val) == ESP_OK && if (esp_matter::attribute::get_val_internal(attribute, &val) == ESP_OK &&
val.type == ESP_MATTER_VAL_TYPE_BITMAP32) { val.type == ESP_MATTER_VAL_TYPE_BITMAP32) {
return val.val.u32; return val.val.u32;
} }
} }
@@ -46,7 +46,7 @@ TimeFormatLocalization::HourFormatEnum get_default_hour_format(esp_matter::clust
if (attribute) { if (attribute) {
esp_matter_attr_val_t val = esp_matter_invalid(nullptr); esp_matter_attr_val_t val = esp_matter_invalid(nullptr);
if (esp_matter::attribute::get_val_internal(attribute, &val) == ESP_OK && if (esp_matter::attribute::get_val_internal(attribute, &val) == ESP_OK &&
val.type == ESP_MATTER_VAL_TYPE_ENUM8) { val.type == ESP_MATTER_VAL_TYPE_ENUM8) {
return TimeFormatLocalization::HourFormatEnum(val.val.u8); return TimeFormatLocalization::HourFormatEnum(val.val.u8);
} }
} }
@@ -60,7 +60,7 @@ TimeFormatLocalization::CalendarTypeEnum get_default_calendar_type(esp_matter::c
if (attribute) { if (attribute) {
esp_matter_attr_val_t val = esp_matter_invalid(nullptr); esp_matter_attr_val_t val = esp_matter_invalid(nullptr);
if (esp_matter::attribute::get_val_internal(attribute, &val) == ESP_OK && if (esp_matter::attribute::get_val_internal(attribute, &val) == ESP_OK &&
val.type == ESP_MATTER_VAL_TYPE_ENUM8) { val.type == ESP_MATTER_VAL_TYPE_ENUM8) {
return TimeFormatLocalization::CalendarTypeEnum(val.val.u8); return TimeFormatLocalization::CalendarTypeEnum(val.val.u8);
} }
} }
@@ -37,7 +37,7 @@ esp_err_t get_attr_val(esp_matter::cluster_t *cluster, uint32_t attribute_id, es
{ {
esp_matter::attribute_t *attr = esp_matter::attribute::get(cluster, attribute_id); esp_matter::attribute_t *attr = esp_matter::attribute::get(cluster, attribute_id);
if (!attr) { if (!attr) {
return ESP_FAIL; return ESP_FAIL;
} }
return esp_matter::attribute::get_val_internal(attr, &val); return esp_matter::attribute::get_val_internal(attr, &val);
} }
@@ -52,13 +52,13 @@ esp_err_t GetClusterConfig(EndpointId endpointId, TimeSynchronizationCluster::Op
} }
esp_matter_attr_val_t feature_val; esp_matter_attr_val_t feature_val;
ESP_RETURN_ON_ERROR(get_attr_val(cluster, Globals::Attributes::FeatureMap::Id, feature_val), "TimeSync", ESP_RETURN_ON_ERROR(get_attr_val(cluster, Globals::Attributes::FeatureMap::Id, feature_val), "TimeSync",
"Failed to get feature map"); "Failed to get feature map");
VerifyOrReturnError(feature_val.type == ESP_MATTER_VAL_TYPE_BITMAP32, ESP_FAIL); VerifyOrReturnError(feature_val.type == ESP_MATTER_VAL_TYPE_BITMAP32, ESP_FAIL);
featureMap = BitFlags<TimeSynchronization::Feature>(feature_val.val.u32); featureMap = BitFlags<TimeSynchronization::Feature>(feature_val.val.u32);
esp_matter_attr_val_t attr_val; esp_matter_attr_val_t attr_val;
if (featureMap.Has(Feature::kNTPClient) || featureMap.Has(Feature::kNTPServer)) { if (featureMap.Has(Feature::kNTPClient) || featureMap.Has(Feature::kNTPServer)) {
ESP_RETURN_ON_ERROR(get_attr_val(cluster, Attributes::SupportsDNSResolve::Id, attr_val), "TimeSync", ESP_RETURN_ON_ERROR(get_attr_val(cluster, Attributes::SupportsDNSResolve::Id, attr_val), "TimeSync",
"Failed to get SupportsDNSResolve"); "Failed to get SupportsDNSResolve");
VerifyOrReturnError(attr_val.type == ESP_MATTER_VAL_TYPE_BOOLEAN, ESP_FAIL); VerifyOrReturnError(attr_val.type == ESP_MATTER_VAL_TYPE_BOOLEAN, ESP_FAIL);
if (featureMap.Has(Feature::kNTPClient)) { if (featureMap.Has(Feature::kNTPClient)) {
startupConfig.supportsDNSResolve = attr_val.val.b; startupConfig.supportsDNSResolve = attr_val.val.b;
@@ -69,14 +69,14 @@ esp_err_t GetClusterConfig(EndpointId endpointId, TimeSynchronizationCluster::Op
} }
if (featureMap.Has(Feature::kTimeZone)) { if (featureMap.Has(Feature::kTimeZone)) {
ESP_RETURN_ON_ERROR(get_attr_val(cluster, Attributes::TimeZoneDatabase::Id, attr_val), "TimeSync", ESP_RETURN_ON_ERROR(get_attr_val(cluster, Attributes::TimeZoneDatabase::Id, attr_val), "TimeSync",
"Failed to get TimeZoneDatabase"); "Failed to get TimeZoneDatabase");
VerifyOrReturnError(attr_val.type == ESP_MATTER_VAL_TYPE_ENUM8, ESP_FAIL); VerifyOrReturnError(attr_val.type == ESP_MATTER_VAL_TYPE_ENUM8, ESP_FAIL);
startupConfig.timeZoneDatabase = (TimeZoneDatabaseEnum)attr_val.val.u8; startupConfig.timeZoneDatabase = (TimeZoneDatabaseEnum)attr_val.val.u8;
} }
if (get_attr_val(cluster, Attributes::TimeSource::Id, attr_val) == ESP_OK && if (get_attr_val(cluster, Attributes::TimeSource::Id, attr_val) == ESP_OK &&
attr_val.type == ESP_MATTER_VAL_TYPE_ENUM8) { attr_val.type == ESP_MATTER_VAL_TYPE_ENUM8) {
attrSet.Set<Attributes::TimeSource::Id>(); attrSet.Set<Attributes::TimeSource::Id>();
startupConfig.timeSource = (TimeSourceEnum)attr_val.val.u8; startupConfig.timeSource = (TimeSourceEnum)attr_val.val.u8;
} }
startupConfig.delegate = GetDefaultDelegate(); startupConfig.delegate = GetDefaultDelegate();
return ESP_OK; return ESP_OK;
@@ -123,8 +123,7 @@ void SetDefaultDelegate(Delegate * delegate)
VerifyOrReturn(delegate != nullptr); VerifyOrReturn(delegate != nullptr);
gDelegate = delegate; gDelegate = delegate;
auto timeSynchronization = GetClusterInstance(); auto timeSynchronization = GetClusterInstance();
if (timeSynchronization != nullptr) if (timeSynchronization != nullptr) {
{
timeSynchronization->SetDelegate(gDelegate); timeSynchronization->SetDelegate(gDelegate);
} }
} }
@@ -132,12 +131,10 @@ void SetDefaultDelegate(Delegate * delegate)
Delegate * GetDefaultDelegate() Delegate * GetDefaultDelegate()
{ {
auto timeSynchronization = GetClusterInstance(); auto timeSynchronization = GetClusterInstance();
if (timeSynchronization != nullptr) if (timeSynchronization != nullptr) {
{
return timeSynchronization->GetDelegate(); return timeSynchronization->GetDelegate();
} }
if (gDelegate == nullptr) if (gDelegate == nullptr) {
{
static DefaultTimeSyncDelegate delegate; static DefaultTimeSyncDelegate delegate;
gDelegate = &delegate; gDelegate = &delegate;
} }
@@ -23,7 +23,7 @@ using namespace chip::app::Clusters::UnitLocalization;
namespace chip::app::Clusters::UnitLocalization { namespace chip::app::Clusters::UnitLocalization {
UnitLocalizationServer & UnitLocalizationServer::Instance() UnitLocalizationServer &UnitLocalizationServer::Instance()
{ {
static UnitLocalizationServer mInstance; static UnitLocalizationServer mInstance;
return mInstance; return mInstance;
@@ -18,10 +18,9 @@
namespace chip::app::Clusters::UnitLocalization { namespace chip::app::Clusters::UnitLocalization {
class UnitLocalizationServer : public UnitLocalizationCluster class UnitLocalizationServer : public UnitLocalizationCluster {
{
public: public:
static UnitLocalizationServer & Instance(); static UnitLocalizationServer &Instance();
}; };
} }
@@ -21,7 +21,7 @@ void ESPMatterWebRTCTransportProviderClusterServerInitCallback(chip::EndpointId
} }
void ESPMatterWebRTCTransportProviderClusterServerShutdownCallback( void ESPMatterWebRTCTransportProviderClusterServerShutdownCallback(
chip::EndpointId endpointId, chip::app::ClusterShutdownType shutdownType) chip::EndpointId endpointId, chip::app::ClusterShutdownType shutdownType)
{ {
} }
@@ -57,7 +57,7 @@ uint32_t GetFeatureMap(EndpointId endpointId)
void ESPMatterWiFiNetworkDiagnosticsClusterServerInitCallback(EndpointId endpointId) void ESPMatterWiFiNetworkDiagnosticsClusterServerInitCallback(EndpointId endpointId)
{ {
if (!IsClusterEnabled(endpointId) && gServers[endpointId].IsConstructed()) { if (!IsClusterEnabled(endpointId) && gServers[endpointId].IsConstructed()) {
return; return;
} }
WiFiDiagnosticsServerCluster::OptionalAttributeSet attrSet; WiFiDiagnosticsServerCluster::OptionalAttributeSet attrSet;
if (IsAttributeEnabled(endpointId, WiFiNetworkDiagnostics::Attributes::CurrentMaxRate::Id)) { if (IsAttributeEnabled(endpointId, WiFiNetworkDiagnostics::Attributes::CurrentMaxRate::Id)) {
@@ -71,8 +71,7 @@ void ESPMatterWiFiNetworkDiagnosticsClusterServerInitCallback(EndpointId endpoin
BitFlags<WiFiNetworkDiagnostics::Feature>(GetFeatureMap(endpointId))); BitFlags<WiFiNetworkDiagnostics::Feature>(GetFeatureMap(endpointId)));
CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Register(gServers[endpointId].Registration()); CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Register(gServers[endpointId].Registration());
if (err != CHIP_NO_ERROR) if (err != CHIP_NO_ERROR) {
{
ChipLogError(AppServer, "Failed to register WiFiNetworkDiagnostics on endpoint %u - Error: %" CHIP_ERROR_FORMAT, endpointId, ChipLogError(AppServer, "Failed to register WiFiNetworkDiagnostics on endpoint %u - Error: %" CHIP_ERROR_FORMAT, endpointId,
err.Format()); err.Format());
} }
@@ -83,8 +82,7 @@ void ESPMatterWiFiNetworkDiagnosticsClusterServerShutdownCallback(EndpointId end
{ {
CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Unregister(&gServers[endpointId].Cluster(), shutdownType); CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Unregister(&gServers[endpointId].Cluster(), shutdownType);
if (err != CHIP_NO_ERROR) if (err != CHIP_NO_ERROR) {
{
ChipLogError(AppServer, "Failed to unregister WiFiNetworkDiagnostics on endpoint %u - Error: %" CHIP_ERROR_FORMAT, endpointId, ChipLogError(AppServer, "Failed to unregister WiFiNetworkDiagnostics on endpoint %u - Error: %" CHIP_ERROR_FORMAT, endpointId,
err.Format()); err.Format());
} }
@@ -266,7 +266,7 @@ CHIP_ERROR attribute_data_encode_buffer::Encode(chip::TLV::TLVWriter &writer, ch
case ESP_MATTER_VAL_TYPE_CHAR_STRING: case ESP_MATTER_VAL_TYPE_CHAR_STRING:
case ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING: { case ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING: {
if (m_attr_val.val.a.b == nullptr && if (m_attr_val.val.a.b == nullptr &&
m_attr_val.val.a.s == (m_attr_val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING ? 0xFF : 0xFFFF)) { m_attr_val.val.a.s == (m_attr_val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING ? 0xFF : 0xFFFF)) {
ReturnErrorOnFailure(writer.PutNull(tag)); ReturnErrorOnFailure(writer.PutNull(tag));
break; break;
} }
@@ -280,7 +280,7 @@ CHIP_ERROR attribute_data_encode_buffer::Encode(chip::TLV::TLVWriter &writer, ch
case ESP_MATTER_VAL_TYPE_OCTET_STRING: case ESP_MATTER_VAL_TYPE_OCTET_STRING:
case ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING: { case ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING: {
if (m_attr_val.val.a.b == nullptr && if (m_attr_val.val.a.b == nullptr &&
m_attr_val.val.a.s == (m_attr_val.type == ESP_MATTER_VAL_TYPE_OCTET_STRING ? 0xFF : 0xFFFF)) { m_attr_val.val.a.s == (m_attr_val.type == ESP_MATTER_VAL_TYPE_OCTET_STRING ? 0xFF : 0xFFFF)) {
ReturnErrorOnFailure(writer.PutNull(tag)); ReturnErrorOnFailure(writer.PutNull(tag));
break; break;
} }
@@ -35,16 +35,19 @@ public:
~attribute_data_decode_buffer() ~attribute_data_decode_buffer()
{ {
if (m_attr_val.type == ESP_MATTER_VAL_TYPE_OCTET_STRING || if (m_attr_val.type == ESP_MATTER_VAL_TYPE_OCTET_STRING ||
m_attr_val.type == ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING || m_attr_val.type == ESP_MATTER_VAL_TYPE_LONG_OCTET_STRING ||
m_attr_val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING || m_attr_val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING ||
m_attr_val.type == ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING) { m_attr_val.type == ESP_MATTER_VAL_TYPE_LONG_CHAR_STRING) {
if (m_attr_val.val.a.b) { if (m_attr_val.val.a.b) {
esp_matter_mem_free(m_attr_val.val.a.b); esp_matter_mem_free(m_attr_val.val.a.b);
} }
} }
} }
esp_matter_attr_val_t &get_attr_val() { return m_attr_val; } esp_matter_attr_val_t &get_attr_val()
{
return m_attr_val;
}
CHIP_ERROR Decode(chip::TLV::TLVReader &reader); CHIP_ERROR Decode(chip::TLV::TLVReader &reader);
@@ -47,15 +47,17 @@ namespace app {
* Accessor class for AttributeValueDecoder to get the TLV reader. * Accessor class for AttributeValueDecoder to get the TLV reader.
* This leverages the existing friend declaration in the SDK's AttributeValueDecoder. * This leverages the existing friend declaration in the SDK's AttributeValueDecoder.
*/ */
class TestOnlyAttributeValueDecoderAccessor class TestOnlyAttributeValueDecoderAccessor {
{
public: public:
TestOnlyAttributeValueDecoderAccessor(AttributeValueDecoder & decoder) : mDecoder(decoder) {} TestOnlyAttributeValueDecoderAccessor(AttributeValueDecoder &decoder) : mDecoder(decoder) {}
const TLV::TLVReader & GetReader() { return mDecoder.mReader; } const TLV::TLVReader &GetReader()
{
return mDecoder.mReader;
}
private: private:
AttributeValueDecoder & mDecoder; AttributeValueDecoder &mDecoder;
}; };
} // namespace app } // namespace app
@@ -125,7 +127,7 @@ constexpr ClusterId kCluster[] = GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER;
constexpr AttributeId kAttribute[] = GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE; constexpr AttributeId kAttribute[] = GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE;
constexpr chip::Access::Privilege kPrivilege[] = GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE; constexpr chip::Access::Privilege kPrivilege[] = GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE;
static_assert(MATTER_ARRAY_SIZE(kCluster) == MATTER_ARRAY_SIZE(kAttribute) && static_assert(MATTER_ARRAY_SIZE(kCluster) == MATTER_ARRAY_SIZE(kAttribute) &&
MATTER_ARRAY_SIZE(kAttribute) == MATTER_ARRAY_SIZE(kPrivilege), MATTER_ARRAY_SIZE(kAttribute) == MATTER_ARRAY_SIZE(kPrivilege),
"Generated parallel arrays must be same size"); "Generated parallel arrays must be same size");
} // namespace GeneratedAccessReadAttribute } // namespace GeneratedAccessReadAttribute
#endif #endif
@@ -136,7 +138,7 @@ constexpr ClusterId kCluster[] = GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER;
constexpr AttributeId kAttribute[] = GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE; constexpr AttributeId kAttribute[] = GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE;
constexpr chip::Access::Privilege kPrivilege[] = GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE; constexpr chip::Access::Privilege kPrivilege[] = GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE;
static_assert(MATTER_ARRAY_SIZE(kCluster) == MATTER_ARRAY_SIZE(kAttribute) && static_assert(MATTER_ARRAY_SIZE(kCluster) == MATTER_ARRAY_SIZE(kAttribute) &&
MATTER_ARRAY_SIZE(kAttribute) == MATTER_ARRAY_SIZE(kPrivilege), MATTER_ARRAY_SIZE(kAttribute) == MATTER_ARRAY_SIZE(kPrivilege),
"Generated parallel arrays must be same size"); "Generated parallel arrays must be same size");
} // namespace GeneratedAccessWriteAttribute } // namespace GeneratedAccessWriteAttribute
#endif #endif
@@ -147,7 +149,7 @@ constexpr ClusterId kCluster[] = GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER;
constexpr CommandId kCommand[] = GENERATED_ACCESS_INVOKE_COMMAND__COMMAND; constexpr CommandId kCommand[] = GENERATED_ACCESS_INVOKE_COMMAND__COMMAND;
constexpr chip::Access::Privilege kPrivilege[] = GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE; constexpr chip::Access::Privilege kPrivilege[] = GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE;
static_assert(MATTER_ARRAY_SIZE(kCluster) == MATTER_ARRAY_SIZE(kCommand) && static_assert(MATTER_ARRAY_SIZE(kCluster) == MATTER_ARRAY_SIZE(kCommand) &&
MATTER_ARRAY_SIZE(kCommand) == MATTER_ARRAY_SIZE(kPrivilege), MATTER_ARRAY_SIZE(kCommand) == MATTER_ARRAY_SIZE(kPrivilege),
"Generated parallel arrays must be same size"); "Generated parallel arrays must be same size");
} // namespace GeneratedAccessInvokeCommand } // namespace GeneratedAccessInvokeCommand
#endif #endif
@@ -158,7 +160,7 @@ constexpr ClusterId kCluster[] = GENERATED_ACCESS_READ_EVENT__CLUSTER;
constexpr EventId kEvent[] = GENERATED_ACCESS_READ_EVENT__EVENT; constexpr EventId kEvent[] = GENERATED_ACCESS_READ_EVENT__EVENT;
constexpr chip::Access::Privilege kPrivilege[] = GENERATED_ACCESS_READ_EVENT__PRIVILEGE; constexpr chip::Access::Privilege kPrivilege[] = GENERATED_ACCESS_READ_EVENT__PRIVILEGE;
static_assert(MATTER_ARRAY_SIZE(kCluster) == MATTER_ARRAY_SIZE(kEvent) && static_assert(MATTER_ARRAY_SIZE(kCluster) == MATTER_ARRAY_SIZE(kEvent) &&
MATTER_ARRAY_SIZE(kEvent) == MATTER_ARRAY_SIZE(kPrivilege), MATTER_ARRAY_SIZE(kEvent) == MATTER_ARRAY_SIZE(kPrivilege),
"Generated parallel arrays must be same size"); "Generated parallel arrays must be same size");
} // namespace GeneratedAccessReadEvent } // namespace GeneratedAccessReadEvent
#endif #endif
@@ -286,8 +288,8 @@ ActionReturnStatus provider::ReadAttribute(const ReadAttributeRequest &request,
attribute::get(request.path.mEndpointId, request.path.mClusterId, request.path.mAttributeId); attribute::get(request.path.mEndpointId, request.path.mClusterId, request.path.mAttributeId);
std::optional<CHIP_ERROR> aai_result = TryReadViaAccessInterface( std::optional<CHIP_ERROR> aai_result = TryReadViaAccessInterface(
request.path, request.path,
AttributeAccessInterfaceRegistry::Instance().Get(request.path.mEndpointId, request.path.mClusterId), encoder); AttributeAccessInterfaceRegistry::Instance().Get(request.path.mEndpointId, request.path.mClusterId), encoder);
VerifyOrReturnError(!aai_result.has_value(), *aai_result); VerifyOrReturnError(!aai_result.has_value(), *aai_result);
esp_matter_attr_val_t val = esp_matter_invalid(nullptr); esp_matter_attr_val_t val = esp_matter_invalid(nullptr);
@@ -303,11 +305,11 @@ ActionReturnStatus provider::WriteAttribute(const WriteAttributeRequest &request
// Decode the new value once - copy TLV reader to leave original decoder intact for mRegistry/AAI // Decode the new value once - copy TLV reader to leave original decoder intact for mRegistry/AAI
esp_matter_attr_val_t new_val = esp_matter_invalid(nullptr); esp_matter_attr_val_t new_val = esp_matter_invalid(nullptr);
VerifyOrReturnValue(attribute, Protocols::InteractionModel::Status::UnsupportedAttribute); VerifyOrReturnValue(attribute, Protocols::InteractionModel::Status::UnsupportedAttribute);
esp_matter_val_type_t current_val_type = attribute::get_val_type(attribute); esp_matter_val_type_t current_val_type = attribute::get_val_type(attribute);
TestOnlyAttributeValueDecoderAccessor accessor(decoder); TestOnlyAttributeValueDecoderAccessor accessor(decoder);
TLV::TLVReader reader_copy; TLV::TLVReader reader_copy;
reader_copy.Init(accessor.GetReader()); reader_copy.Init(accessor.GetReader());
@@ -325,9 +327,9 @@ ActionReturnStatus provider::WriteAttribute(const WriteAttributeRequest &request
// Helper to execute POST_UPDATE callback // Helper to execute POST_UPDATE callback
auto execute_post_update = [&]() { auto execute_post_update = [&]() {
attribute::execute_callback(attribute::POST_UPDATE, request.path.mEndpointId, attribute::execute_callback(attribute::POST_UPDATE, request.path.mEndpointId,
request.path.mClusterId, request.path.mAttributeId, &new_val); request.path.mClusterId, request.path.mAttributeId, &new_val);
}; };
// mRegistry handles its own storage // mRegistry handles its own storage
@@ -415,7 +417,7 @@ std::optional<ActionReturnStatus> provider::InvokeCommand(const InvokeRequest &r
VerifyOrReturnValue(status == Protocols::InteractionModel::Status::Success, VerifyOrReturnValue(status == Protocols::InteractionModel::Status::Success,
CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(status)); CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(status));
CommandHandlerInterface *handler_interface = CommandHandlerInterfaceRegistry::Instance().GetCommandHandler( CommandHandlerInterface *handler_interface = CommandHandlerInterfaceRegistry::Instance().GetCommandHandler(
request.path.mEndpointId, request.path.mClusterId); request.path.mEndpointId, request.path.mClusterId);
if (handler_interface) { if (handler_interface) {
CommandHandlerInterface::HandlerContext context(*handler, request.path, input_arguments); CommandHandlerInterface::HandlerContext context(*handler, request.path, input_arguments);
@@ -461,7 +463,7 @@ CHIP_ERROR provider::DeviceTypes(EndpointId endpointId, ReadOnlyBufferBuilder<De
for (size_t idx = 0; idx < count; idx++) { for (size_t idx = 0; idx < count; idx++) {
DeviceTypeEntry entry; DeviceTypeEntry entry;
VerifyOrReturnError(endpoint::get_device_type_at_index(ep, idx, entry.deviceTypeId, entry.deviceTypeRevision) == VerifyOrReturnError(endpoint::get_device_type_at_index(ep, idx, entry.deviceTypeId, entry.deviceTypeRevision) ==
ESP_OK, ESP_OK,
CHIP_ERROR_INTERNAL, ESP_LOGE(TAG, "Failed to get device type at %d", idx)); CHIP_ERROR_INTERNAL, ESP_LOGE(TAG, "Failed to get device type at %d", idx));
ReturnErrorOnFailure(builder.Append(entry)); ReturnErrorOnFailure(builder.Append(entry));
} }
@@ -565,7 +567,7 @@ CHIP_ERROR provider::AcceptedCommands(const ConcreteClusterPath &path,
VerifyOrReturnValue(status == Protocols::InteractionModel::Status::Success, VerifyOrReturnValue(status == Protocols::InteractionModel::Status::Success,
CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(status)); CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(status));
CommandHandlerInterface *interface = CommandHandlerInterface *interface =
CommandHandlerInterfaceRegistry::Instance().GetCommandHandler(path.mEndpointId, path.mClusterId); CommandHandlerInterfaceRegistry::Instance().GetCommandHandler(path.mEndpointId, path.mClusterId);
if (interface != nullptr) { if (interface != nullptr) {
CHIP_ERROR err = interface->RetrieveAcceptedCommands(path, builder); CHIP_ERROR err = interface->RetrieveAcceptedCommands(path, builder);
// If retrieving the accepted commands returns CHIP_ERROR_NOT_IMPLEMENTED then continue with normal processing. // If retrieving the accepted commands returns CHIP_ERROR_NOT_IMPLEMENTED then continue with normal processing.
@@ -582,10 +584,10 @@ CHIP_ERROR provider::AcceptedCommands(const ConcreteClusterPath &path,
uint32_t command_id = command::get_id(command); uint32_t command_id = command::get_id(command);
BitMask<DataModel::CommandQualityFlags> quality_flags; BitMask<DataModel::CommandQualityFlags> quality_flags;
quality_flags quality_flags
.Set(DataModel::CommandQualityFlags::kFabricScoped, CommandIsFabricScoped(path.mClusterId, command_id)) .Set(DataModel::CommandQualityFlags::kFabricScoped, CommandIsFabricScoped(path.mClusterId, command_id))
.Set(DataModel::CommandQualityFlags::kTimed, CommandNeedsTimedInvoke(path.mClusterId, command_id)) .Set(DataModel::CommandQualityFlags::kTimed, CommandNeedsTimedInvoke(path.mClusterId, command_id))
.Set(DataModel::CommandQualityFlags::kLargeMessage, .Set(DataModel::CommandQualityFlags::kLargeMessage,
CommandHasLargePayload(path.mClusterId, command_id)); CommandHasLargePayload(path.mClusterId, command_id));
AcceptedCommandEntry entry(command_id, quality_flags, AcceptedCommandEntry entry(command_id, quality_flags,
MatterGetAccessPrivilegeForInvokeCommand(path.mClusterId, command_id)); MatterGetAccessPrivilegeForInvokeCommand(path.mClusterId, command_id));
ReturnErrorOnFailure(builder.Append(entry)); ReturnErrorOnFailure(builder.Append(entry));
@@ -597,7 +599,8 @@ CHIP_ERROR provider::AcceptedCommands(const ConcreteClusterPath &path,
static constexpr AttributeId k_global_attributes_not_in_metadata[] = { static constexpr AttributeId k_global_attributes_not_in_metadata[] = {
Clusters::Globals::Attributes::AttributeList::Id, Clusters::Globals::Attributes::AcceptedCommandList::Id, Clusters::Globals::Attributes::AttributeList::Id, Clusters::Globals::Attributes::AcceptedCommandList::Id,
Clusters::Globals::Attributes::GeneratedCommandList::Id}; Clusters::Globals::Attributes::GeneratedCommandList::Id
};
static constexpr size_t k_global_attributes_count = static constexpr size_t k_global_attributes_count =
sizeof(k_global_attributes_not_in_metadata) / sizeof(k_global_attributes_not_in_metadata[0]); sizeof(k_global_attributes_not_in_metadata) / sizeof(k_global_attributes_not_in_metadata[0]);
@@ -624,18 +627,17 @@ CHIP_ERROR provider::Attributes(const ConcreteClusterPath &path, ReadOnlyBufferB
attr_quality_flags.Set(DataModel::AttributeQualityFlags::kTimed, flags & ATTRIBUTE_FLAG_MUST_USE_TIMED_WRITE); attr_quality_flags.Set(DataModel::AttributeQualityFlags::kTimed, flags & ATTRIBUTE_FLAG_MUST_USE_TIMED_WRITE);
chip::Access::Privilege read_privilege = MatterGetAccessPrivilegeForReadAttribute(path.mClusterId, id); chip::Access::Privilege read_privilege = MatterGetAccessPrivilegeForReadAttribute(path.mClusterId, id);
auto write_privilege = (flags & ATTRIBUTE_FLAG_WRITABLE) auto write_privilege = (flags & ATTRIBUTE_FLAG_WRITABLE)
? std::make_optional(MatterGetAccessPrivilegeForWriteAttribute(path.mClusterId, id)) ? std::make_optional(MatterGetAccessPrivilegeForWriteAttribute(path.mClusterId, id))
: std::nullopt; : std::nullopt;
AttributeEntry entry(id, attr_quality_flags, read_privilege, write_privilege); AttributeEntry entry(id, attr_quality_flags, read_privilege, write_privilege);
ReturnErrorOnFailure(builder.Append(entry)); ReturnErrorOnFailure(builder.Append(entry));
attribute = attribute::get_next(attribute); attribute = attribute::get_next(attribute);
} }
// Append the three Global attributes // Append the three Global attributes
for (size_t index = 0; index < k_global_attributes_count; ++index) for (size_t index = 0; index < k_global_attributes_count; ++index) {
{
AttributeEntry entry(k_global_attributes_not_in_metadata[index], AttributeEntry entry(k_global_attributes_not_in_metadata[index],
chip::BitFlags<DataModel::AttributeQualityFlags>(), chip::Access::Privilege::kView, chip::BitFlags<DataModel::AttributeQualityFlags>(), chip::Access::Privilege::kView,
std::nullopt); std::nullopt);
ReturnErrorOnFailure(builder.Append(entry)); ReturnErrorOnFailure(builder.Append(entry));
} }
@@ -68,7 +68,10 @@ public:
// access to the typed global singleton of this class. // access to the typed global singleton of this class.
static provider &get_instance(); static provider &get_instance();
chip::app::ServerClusterInterfaceRegistry &registry() { return mRegistry; } chip::app::ServerClusterInterfaceRegistry &registry()
{
return mRegistry;
}
/// Generic model implementations /// Generic model implementations
CHIP_ERROR Startup(InteractionModelContext context) override; CHIP_ERROR Startup(InteractionModelContext context) override;
@@ -881,7 +881,7 @@ Status emberAfWriteAttribute(const chip::app::ConcreteAttributePath &path, const
esp_matter_attr_val_t val = esp_matter_invalid(nullptr); esp_matter_attr_val_t val = esp_matter_invalid(nullptr);
Status status = get_attr_val_from_raw_data_buffer(input.dataPtr, input.dataType, val, Status status = get_attr_val_from_raw_data_buffer(input.dataPtr, input.dataType, val,
esp_matter::attribute::get_flags(attribute) & esp_matter::attribute::get_flags(attribute) &
esp_matter::ATTRIBUTE_FLAG_NULLABLE); esp_matter::ATTRIBUTE_FLAG_NULLABLE);
if (status != Status::Success) { if (status != Status::Success) {
return status; return status;
} }
@@ -891,10 +891,10 @@ Status emberAfWriteAttribute(const chip::app::ConcreteAttributePath &path, const
} }
if (status == Status::Success) { if (status == Status::Success) {
if (input.markDirty == chip::app::MarkAttributeDirty::kYes || if (input.markDirty == chip::app::MarkAttributeDirty::kYes ||
((err == ESP_OK) && (input.markDirty != chip::app::MarkAttributeDirty::kNo))) { ((err == ESP_OK) && (input.markDirty != chip::app::MarkAttributeDirty::kNo))) {
if (input.changeListener) { if (input.changeListener) {
input.changeListener->MarkDirty( input.changeListener->MarkDirty(
chip::app::AttributePathParams(path.mEndpointId, path.mClusterId, path.mAttributeId)); chip::app::AttributePathParams(path.mEndpointId, path.mClusterId, path.mAttributeId));
} else { } else {
chip::app::InteractionModelEngine::GetInstance()->GetReportingEngine().MarkDirty( chip::app::InteractionModelEngine::GetInstance()->GetReportingEngine().MarkDirty(
chip::app::AttributePathParams(path.mEndpointId, path.mClusterId, path.mAttributeId)); chip::app::AttributePathParams(path.mEndpointId, path.mClusterId, path.mAttributeId));
@@ -912,8 +912,8 @@ const EmberAfAttributeMetadata *emberAfLocateAttributeMetadata(chip::EndpointId
{ {
static esp_matter_attr_bounds_t sBounds; static esp_matter_attr_bounds_t sBounds;
static EmberAfAttributeMinMaxValue sMinMaxValue{EmberAfDefaultAttributeValue(nullptr), static EmberAfAttributeMinMaxValue sMinMaxValue{EmberAfDefaultAttributeValue(nullptr),
EmberAfDefaultAttributeValue(nullptr), EmberAfDefaultAttributeValue(nullptr),
EmberAfDefaultAttributeValue(nullptr)}; EmberAfDefaultAttributeValue(nullptr)};
static EmberAfAttributeMetadata s_metadata{EmberAfDefaultOrMinMaxAttributeValue((uint32_t)0), attributeId, 0, 0, 0}; static EmberAfAttributeMetadata s_metadata{EmberAfDefaultOrMinMaxAttributeValue((uint32_t)0), attributeId, 0, 0, 0};
esp_matter::attribute_t *attribute = esp_matter::attribute::get(endpointId, clusterId, attributeId); esp_matter::attribute_t *attribute = esp_matter::attribute::get(endpointId, clusterId, attributeId);
@@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// Cluster init functions that don't have a cluster implementation to define // Cluster init functions that don't have a cluster implementation to define
// them in. // them in.
void MatterBallastConfigurationPluginServerInitCallback() {} void MatterBallastConfigurationPluginServerInitCallback() {}
+1 -2
View File
@@ -45,8 +45,7 @@ namespace DeviceEventType {
/** /**
* Enumerates platform-specific event types that are visible to the application. * Enumerates platform-specific event types that are visible to the application.
*/ */
enum enum {
{
/** Signals that Commissioning session has started */ /** Signals that Commissioning session has started */
kCommissioningSessionStarted = kRange_PublicPlatformSpecific + 0x1000, kCommissioningSessionStarted = kRange_PublicPlatformSpecific + 0x1000,
/** Signals that Commissioning session has stopped */ /** Signals that Commissioning session has stopped */
+29 -20
View File
@@ -168,8 +168,8 @@ esp_err_t cluster_update(uint16_t local_endpoint_id, request_handle_t *req_handl
} }
VerifyOrReturnError(notified_cluster_id != chip::kInvalidClusterId, ESP_ERR_INVALID_ARG); VerifyOrReturnError(notified_cluster_id != chip::kInvalidClusterId, ESP_ERR_INVALID_ARG);
if (CHIP_NO_ERROR != if (CHIP_NO_ERROR !=
chip::app::Clusters::Binding::Manager::GetInstance().NotifyBoundClusterChanged(local_endpoint_id, notified_cluster_id, chip::app::Clusters::Binding::Manager::GetInstance().NotifyBoundClusterChanged(local_endpoint_id, notified_cluster_id,
static_cast<void *>(context))) { static_cast<void *>(context))) {
chip::Platform::Delete(context); chip::Platform::Delete(context);
ESP_LOGE(TAG, "failed to notify the bound cluster changed"); ESP_LOGE(TAG, "failed to notify the bound cluster changed");
return ESP_FAIL; return ESP_FAIL;
@@ -243,7 +243,7 @@ esp_err_t send_request(void *ctx, peer_device_t *remote_device, const CommandPat
auto decoder = chip::Platform::MakeUnique<custom_command_callback>(ctx, on_success, on_error); auto decoder = chip::Platform::MakeUnique<custom_command_callback>(ctx, on_success, on_error);
VerifyOrReturnError(decoder != nullptr, ESP_ERR_NO_MEM, ESP_LOGE(TAG, "No memory for command callback")); VerifyOrReturnError(decoder != nullptr, ESP_ERR_NO_MEM, ESP_LOGE(TAG, "No memory for command callback"));
auto on_done = [raw_decoder_ptr = decoder.get()](void *context, CommandSender *command_sender) { auto on_done = [raw_decoder_ptr = decoder.get()](void *context, CommandSender * command_sender) {
chip::Platform::Delete(command_sender); chip::Platform::Delete(command_sender);
chip::Platform::Delete(raw_decoder_ptr); chip::Platform::Delete(raw_decoder_ptr);
}; };
@@ -294,9 +294,18 @@ public:
} }
private: private:
void OnReportBegin() override { m_callback.OnReportBegin(); } void OnReportBegin() override
void OnReportEnd() override { m_callback.OnReportEnd(); } {
void OnError(CHIP_ERROR aError) override { m_callback.OnError(aError); } m_callback.OnReportBegin();
}
void OnReportEnd() override
{
m_callback.OnReportEnd();
}
void OnError(CHIP_ERROR aError) override
{
m_callback.OnError(aError);
}
void OnAttributeData(const ConcreteDataAttributePath &aPath, TLVReader *apData, const StatusIB &aStatus) override void OnAttributeData(const ConcreteDataAttributePath &aPath, TLVReader *apData, const StatusIB &aStatus) override
{ {
@@ -363,7 +372,7 @@ esp_err_t send_request(client::peer_device_t *remote_device, AttributePathParams
{ {
VerifyOrReturnError(remote_device->GetSecureSession().HasValue() && !remote_device->GetSecureSession().Value()->IsGroupSession(), ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Invalid Session Type")); VerifyOrReturnError(remote_device->GetSecureSession().HasValue() && !remote_device->GetSecureSession().Value()->IsGroupSession(), ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Invalid Session Type"));
VerifyOrReturnError((attr_path && attr_path_size != 0) || (event_path && event_path_size != 0), VerifyOrReturnError((attr_path && attr_path_size != 0) || (event_path && event_path_size != 0),
ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Invalid attribute path and event path")); ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Invalid attribute path and event path"));
ReadPrepareParams params(remote_device->GetSecureSession().Value()); ReadPrepareParams params(remote_device->GetSecureSession().Value());
params.mpAttributePathParamsList = attr_path; params.mpAttributePathParamsList = attr_path;
params.mAttributePathParamsListSize = attr_path_size; params.mAttributePathParamsListSize = attr_path_size;
@@ -381,7 +390,7 @@ esp_err_t send_request(client::peer_device_t *remote_device, AttributePathParams
VerifyOrReturnError(client, ESP_ERR_NO_MEM, ESP_LOGE(TAG, "Failed to allocate memory for ReadClient")); VerifyOrReturnError(client, ESP_ERR_NO_MEM, ESP_LOGE(TAG, "Failed to allocate memory for ReadClient"));
VerifyOrReturnError(client->SendRequest(params) == CHIP_NO_ERROR, VerifyOrReturnError(client->SendRequest(params) == CHIP_NO_ERROR,
ESP_FAIL, ESP_LOGE(TAG, "Failed to send read request")); ESP_FAIL, ESP_LOGE(TAG, "Failed to send read request"));
// The memory will be released when OnDone() is called // The memory will be released when OnDone() is called
client.release(); client.release();
@@ -399,9 +408,9 @@ esp_err_t send_request(client::peer_device_t *remote_device, AttributePathParams
ReadClient::Callback &callback) ReadClient::Callback &callback)
{ {
VerifyOrReturnError(remote_device->GetSecureSession().HasValue() && !remote_device->GetSecureSession().Value()->IsGroupSession(), VerifyOrReturnError(remote_device->GetSecureSession().HasValue() && !remote_device->GetSecureSession().Value()->IsGroupSession(),
ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Invalid Session Type")); ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Invalid Session Type"));
VerifyOrReturnError((attr_path && attr_path_size != 0) || (event_path && event_path_size != 0), VerifyOrReturnError((attr_path && attr_path_size != 0) || (event_path && event_path_size != 0),
ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Invalid attribute path and event path")); ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Invalid attribute path and event path"));
ReadPrepareParams params(remote_device->GetSecureSession().Value()); ReadPrepareParams params(remote_device->GetSecureSession().Value());
params.mpAttributePathParamsList = attr_path; params.mpAttributePathParamsList = attr_path;
params.mAttributePathParamsListSize = attr_path_size; params.mAttributePathParamsListSize = attr_path_size;
@@ -428,7 +437,7 @@ esp_err_t send_request(client::peer_device_t *remote_device, AttributePathParams
err = client->SendRequest(params); err = client->SendRequest(params);
} }
VerifyOrReturnError(err == CHIP_NO_ERROR, VerifyOrReturnError(err == CHIP_NO_ERROR,
ESP_FAIL, ESP_LOGE(TAG, "Failed to send subscribe request")); ESP_FAIL, ESP_LOGE(TAG, "Failed to send subscribe request"));
// The memory will be released when OnDone() is called // The memory will be released when OnDone() is called
client.release(); client.release();
client_deleter_callback.release(); client_deleter_callback.release();
@@ -477,19 +486,19 @@ static esp_err_t encode_attribute_value(uint8_t *encoded_buf, size_t encoded_buf
writer.Init(encoded_buf, encoded_buf_size); writer.Init(encoded_buf, encoded_buf_size);
VerifyOrReturnError(encodable.EncodeTo(writer, chip::TLV::AnonymousTag()) == CHIP_NO_ERROR, VerifyOrReturnError(encodable.EncodeTo(writer, chip::TLV::AnonymousTag()) == CHIP_NO_ERROR,
ESP_FAIL, ESP_LOGE(TAG, "Failed to encode attribute value")); ESP_FAIL, ESP_LOGE(TAG, "Failed to encode attribute value"));
VerifyOrReturnError(writer.Finalize() == CHIP_NO_ERROR, VerifyOrReturnError(writer.Finalize() == CHIP_NO_ERROR,
ESP_FAIL, ESP_LOGE(TAG, "Failed to finalize TLV writer")); ESP_FAIL, ESP_LOGE(TAG, "Failed to finalize TLV writer"));
encoded_len = writer.GetLengthWritten(); encoded_len = writer.GetLengthWritten();
reader.Init(encoded_buf, encoded_len); reader.Init(encoded_buf, encoded_len);
VerifyOrReturnError(reader.Next() == CHIP_NO_ERROR, VerifyOrReturnError(reader.Next() == CHIP_NO_ERROR,
ESP_FAIL, ESP_LOGE(TAG, "Failed to read next")); ESP_FAIL, ESP_LOGE(TAG, "Failed to read next"));
VerifyOrReturnError(reader.GetType() == chip::TLV::TLVType::kTLVType_Structure, VerifyOrReturnError(reader.GetType() == chip::TLV::TLVType::kTLVType_Structure,
ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "The TLV type must be structure")); ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "The TLV type must be structure"));
VerifyOrReturnError(reader.OpenContainer(out_reader) == CHIP_NO_ERROR, VerifyOrReturnError(reader.OpenContainer(out_reader) == CHIP_NO_ERROR,
ESP_FAIL, ESP_LOGE(TAG, "Failed to open container")); ESP_FAIL, ESP_LOGE(TAG, "Failed to open container"));
VerifyOrReturnError(out_reader.Next() == CHIP_NO_ERROR, VerifyOrReturnError(out_reader.Next() == CHIP_NO_ERROR,
ESP_FAIL, ESP_LOGE(TAG, "Failed to read next")); ESP_FAIL, ESP_LOGE(TAG, "Failed to read next"));
return ESP_OK; return ESP_OK;
} }
@@ -499,7 +508,7 @@ esp_err_t send_request(client::peer_device_t *remote_device, AttributePathParams
{ {
esp_err_t err = ESP_OK; esp_err_t err = ESP_OK;
VerifyOrReturnError(remote_device->GetSecureSession().HasValue() && !remote_device->GetSecureSession().Value()->IsGroupSession(), VerifyOrReturnError(remote_device->GetSecureSession().HasValue() && !remote_device->GetSecureSession().Value()->IsGroupSession(),
ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Invalid Session Type")); ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Invalid Session Type"));
VerifyOrReturnError(!attr_path.HasWildcardEndpointId(), VerifyOrReturnError(!attr_path.HasWildcardEndpointId(),
ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Endpoint Id Invalid")); ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Endpoint Id Invalid"));
@@ -516,7 +525,7 @@ esp_err_t send_request(client::peer_device_t *remote_device, AttributePathParams
TLVReader attr_val_reader; TLVReader attr_val_reader;
err = encode_attribute_value(encoded_buf.Get(), k_encoded_buf_size, encodable, attr_val_reader); err = encode_attribute_value(encoded_buf.Get(), k_encoded_buf_size, encodable, attr_val_reader);
VerifyOrReturnError(err == ESP_OK, VerifyOrReturnError(err == ESP_OK,
err, ESP_LOGE(TAG, "Failed to encode attribute value to a TLV reader")); err, ESP_LOGE(TAG, "Failed to encode attribute value to a TLV reader"));
VerifyOrReturnError(write_client->PutPreencodedAttribute(path, attr_val_reader) == CHIP_NO_ERROR, VerifyOrReturnError(write_client->PutPreencodedAttribute(path, attr_val_reader) == CHIP_NO_ERROR,
ESP_FAIL, ESP_LOGE(TAG, "Failed to put pre-encoded attribute value to WriteClient")); ESP_FAIL, ESP_LOGE(TAG, "Failed to put pre-encoded attribute value to WriteClient"));
VerifyOrReturnError(write_client->SendWriteRequest(remote_device->GetSecureSession().Value()) == CHIP_NO_ERROR, VerifyOrReturnError(write_client->SendWriteRequest(remote_device->GetSecureSession().Value()) == CHIP_NO_ERROR,
@@ -545,7 +554,7 @@ esp_err_t send_request(client::peer_device_t *remote_device,
json_encodable.GetJsonArraySize() == attr_paths.AllocatedSize(), ESP_ERR_INVALID_ARG, json_encodable.GetJsonArraySize() == attr_paths.AllocatedSize(), ESP_ERR_INVALID_ARG,
ESP_LOGE(TAG, "The attr_values array length should be the same as the attr_paths array length")); ESP_LOGE(TAG, "The attr_values array length should be the same as the attr_paths array length"));
VerifyOrReturnError(remote_device->GetSecureSession().HasValue() && VerifyOrReturnError(remote_device->GetSecureSession().HasValue() &&
!remote_device->GetSecureSession().Value()->IsGroupSession(), !remote_device->GetSecureSession().Value()->IsGroupSession(),
ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Invalid Session Type")); ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Invalid Session Type"));
auto client_deleter_callback = chip::Platform::MakeUnique<client_deleter_write_callback>(callback); auto client_deleter_callback = chip::Platform::MakeUnique<client_deleter_write_callback>(callback);
VerifyOrReturnError(client_deleter_callback, ESP_ERR_NO_MEM, VerifyOrReturnError(client_deleter_callback, ESP_ERR_NO_MEM,
+20 -11
View File
@@ -53,7 +53,7 @@ typedef struct request_handle {
*/ */
void *request_data; void *request_data;
request_handle() : type(INVOKE_CMD), request_data(NULL) {} request_handle() : type(INVOKE_CMD), request_data(NULL) {}
request_handle(struct request_handle& req) : type(req.type), request_data(req.request_data) request_handle(struct request_handle &req) : type(req.type), request_data(req.request_data)
{ {
if (req.type == INVOKE_CMD) { if (req.type == INVOKE_CMD) {
command_path = req.command_path; command_path = req.command_path;
@@ -178,8 +178,7 @@ using chip::TLV::TLVReader;
using client::peer_device_t; using client::peer_device_t;
using chip::app::DataModel::EncodableToTLV; using chip::app::DataModel::EncodableToTLV;
class custom_encodable_type : public EncodableToTLV class custom_encodable_type : public EncodableToTLV {
{
public: public:
const char *k_empty_command_data = "{}"; const char *k_empty_command_data = "{}";
const char *k_null_attribute_data = "null"; const char *k_null_attribute_data = "null";
@@ -202,9 +201,12 @@ public:
assert(m_json_str); assert(m_json_str);
} }
~custom_encodable_type() { free(m_json_str); } ~custom_encodable_type()
{
free(m_json_str);
}
CHIP_ERROR EncodeTo(chip::TLV::TLVWriter & writer, chip::TLV::Tag tag) const override CHIP_ERROR EncodeTo(chip::TLV::TLVWriter &writer, chip::TLV::Tag tag) const override
{ {
if (json_to_tlv(m_json_str, writer, tag) != ESP_OK) { if (json_to_tlv(m_json_str, writer, tag) != ESP_OK) {
return CHIP_ERROR_INTERNAL; return CHIP_ERROR_INTERNAL;
@@ -215,15 +217,17 @@ private:
char *m_json_str = NULL; char *m_json_str = NULL;
}; };
class multiple_write_encodable_type class multiple_write_encodable_type {
{
public: public:
multiple_write_encodable_type(const char *json_str) multiple_write_encodable_type(const char *json_str)
{ {
json = cJSON_Parse(json_str); json = cJSON_Parse(json_str);
} }
~multiple_write_encodable_type() { cJSON_Delete(json); } ~multiple_write_encodable_type()
{
cJSON_Delete(json);
}
CHIP_ERROR EncodeTo(chip::TLV::TLVWriter &writer, chip::TLV::Tag tag, size_t index) CHIP_ERROR EncodeTo(chip::TLV::TLVWriter &writer, chip::TLV::Tag tag, size_t index)
{ {
@@ -242,7 +246,10 @@ public:
return CHIP_NO_ERROR; return CHIP_NO_ERROR;
} }
size_t GetJsonArraySize() { return static_cast<size_t>(cJSON_GetArraySize(json)); } size_t GetJsonArraySize()
{
return static_cast<size_t>(cJSON_GetArraySize(json));
}
private: private:
cJSON *json = NULL; cJSON *json = NULL;
@@ -269,7 +276,10 @@ public:
, context(ctx) , context(ctx)
{ {
} }
void set_on_done_callback(on_done_callback_t on_done) { on_done_cb = on_done; } void set_on_done_callback(on_done_callback_t on_done)
{
on_done_cb = on_done;
}
private: private:
void OnResponse(CommandSender *command_sender, const ConcreteCommandPath &command_path, const StatusIB &status, void OnResponse(CommandSender *command_sender, const ConcreteCommandPath &command_path, const StatusIB &status,
@@ -328,7 +338,6 @@ esp_err_t send_request(void *ctx, peer_device_t *remote_device, const CommandPat
const Optional<uint16_t> &timed_invoke_timeout_ms, const Optional<uint16_t> &timed_invoke_timeout_ms,
const Optional<Timeout> &response_timeout = chip::NullOptional); const Optional<Timeout> &response_timeout = chip::NullOptional);
esp_err_t send_group_request(const uint8_t fabric_index, const CommandPathParams &command_path, esp_err_t send_group_request(const uint8_t fabric_index, const CommandPathParams &command_path,
const chip::app::DataModel::EncodableToTLV &encodable); const chip::app::DataModel::EncodableToTLV &encodable);
+17 -19
View File
@@ -84,8 +84,7 @@ void PostEvent(uint16_t eventType)
VerifyOrReturn(error == CHIP_NO_ERROR, ESP_LOGE(TAG, "Failed to post event for event type:%" PRIu16 ", err:%" CHIP_ERROR_FORMAT, eventType, error.Format())); VerifyOrReturn(error == CHIP_NO_ERROR, ESP_LOGE(TAG, "Failed to post event for event type:%" PRIu16 ", err:%" CHIP_ERROR_FORMAT, eventType, error.Format()));
} }
class AppDelegateImpl : public AppDelegate class AppDelegateImpl : public AppDelegate {
{
public: public:
void OnCommissioningSessionStarted() void OnCommissioningSessionStarted()
{ {
@@ -108,25 +107,24 @@ public:
} }
}; };
class FabricDelegateImpl : public chip::FabricTable::Delegate class FabricDelegateImpl : public chip::FabricTable::Delegate {
{
public: public:
void FabricWillBeRemoved(const chip::FabricTable & fabricTable,chip::FabricIndex fabricIndex) void FabricWillBeRemoved(const chip::FabricTable &fabricTable, chip::FabricIndex fabricIndex)
{ {
PostEvent(chip::DeviceLayer::DeviceEventType::kFabricWillBeRemoved); PostEvent(chip::DeviceLayer::DeviceEventType::kFabricWillBeRemoved);
} }
void OnFabricRemoved(const chip::FabricTable & fabricTable,chip::FabricIndex fabricIndex) void OnFabricRemoved(const chip::FabricTable &fabricTable, chip::FabricIndex fabricIndex)
{ {
PostEvent(chip::DeviceLayer::DeviceEventType::kFabricRemoved); PostEvent(chip::DeviceLayer::DeviceEventType::kFabricRemoved);
} }
void OnFabricCommitted(const chip::FabricTable & fabricTable, chip::FabricIndex fabricIndex) void OnFabricCommitted(const chip::FabricTable &fabricTable, chip::FabricIndex fabricIndex)
{ {
PostEvent(chip::DeviceLayer::DeviceEventType::kFabricCommitted); PostEvent(chip::DeviceLayer::DeviceEventType::kFabricCommitted);
} }
void OnFabricUpdated(const chip::FabricTable & fabricTable, chip::FabricIndex fabricIndex) void OnFabricUpdated(const chip::FabricTable &fabricTable, chip::FabricIndex fabricIndex)
{ {
PostEvent(chip::DeviceLayer::DeviceEventType::kFabricUpdated); PostEvent(chip::DeviceLayer::DeviceEventType::kFabricUpdated);
} }
@@ -171,7 +169,7 @@ esp_err_t ScopedChipStackLock::chip_stack_unlock()
static void deinit_ble_if_commissioned(intptr_t unused) static void deinit_ble_if_commissioned(intptr_t unused)
{ {
#if CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING #if CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING
if(chip::Server::GetInstance().GetFabricTable().FabricCount() > 0) { if (chip::Server::GetInstance().GetFabricTable().FabricCount() > 0) {
chip::DeviceLayer::Internal::BLEMgr().Shutdown(); chip::DeviceLayer::Internal::BLEMgr().Shutdown();
} }
#endif /* CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING */ #endif /* CONFIG_USE_BLE_ONLY_FOR_COMMISSIONING */
@@ -209,7 +207,7 @@ static void esp_matter_chip_init_task(intptr_t context)
uint8_t max_groups_server_cluster_count = CONFIG_ESP_MATTER_MAX_DYNAMIC_ENDPOINT_COUNT - 1; uint8_t max_groups_server_cluster_count = CONFIG_ESP_MATTER_MAX_DYNAMIC_ENDPOINT_COUNT - 1;
uint16_t max_groups_per_fabric = max_groups_server_cluster_count * MAX_GROUPS_PER_FABRIC_PER_ENDPOINT; uint16_t max_groups_per_fabric = max_groups_server_cluster_count * MAX_GROUPS_PER_FABRIC_PER_ENDPOINT;
static chip::Credentials::GroupDataProviderImpl groupDataProvider(max_groups_per_fabric, static chip::Credentials::GroupDataProviderImpl groupDataProvider(max_groups_per_fabric,
CHIP_CONFIG_MAX_GROUP_KEYS_PER_FABRIC); CHIP_CONFIG_MAX_GROUP_KEYS_PER_FABRIC);
groupDataProvider.SetStorageDelegate(initParams.persistentStorageDelegate); groupDataProvider.SetStorageDelegate(initParams.persistentStorageDelegate);
groupDataProvider.SetSessionKeystore(initParams.sessionKeystore); groupDataProvider.SetSessionKeystore(initParams.sessionKeystore);
if (groupDataProvider.Init() != CHIP_NO_ERROR) { if (groupDataProvider.Init() != CHIP_NO_ERROR) {
@@ -220,8 +218,7 @@ static void esp_matter_chip_init_task(intptr_t context)
#endif // CONFIG_ESP_MATTER_ENABLE_DATA_MODEL #endif // CONFIG_ESP_MATTER_ENABLE_DATA_MODEL
CHIP_ERROR ret = chip::Server::GetInstance().GetFabricTable().AddFabricDelegate(&s_fabric_delegate); CHIP_ERROR ret = chip::Server::GetInstance().GetFabricTable().AddFabricDelegate(&s_fabric_delegate);
if (ret != CHIP_NO_ERROR) if (ret != CHIP_NO_ERROR) {
{
ESP_LOGE(TAG, "Failed to add fabric delegate, err:%" CHIP_ERROR_FORMAT, ret.Format()); ESP_LOGE(TAG, "Failed to add fabric delegate, err:%" CHIP_ERROR_FORMAT, ret.Format());
} }
ret = chip::Server::GetInstance().Init(initParams); ret = chip::Server::GetInstance().Init(initParams);
@@ -256,8 +253,7 @@ static void esp_matter_chip_init_task(intptr_t context)
static void device_callback_internal(const ChipDeviceEvent * event, intptr_t arg) static void device_callback_internal(const ChipDeviceEvent * event, intptr_t arg)
{ {
switch (event->Type) switch (event->Type) {
{
case chip::DeviceLayer::DeviceEventType::kInterfaceIpAddressChanged: case chip::DeviceLayer::DeviceEventType::kInterfaceIpAddressChanged:
#if CHIP_DEVICE_CONFIG_ENABLE_WIFI || CHIP_DEVICE_CONFIG_ENABLE_ETHERNET #if CHIP_DEVICE_CONFIG_ENABLE_WIFI || CHIP_DEVICE_CONFIG_ENABLE_ETHERNET
if (event->InterfaceIpAddressChanged.Type == chip::DeviceLayer::InterfaceIpChangeType::kIpV6_Assigned || if (event->InterfaceIpAddressChanged.Type == chip::DeviceLayer::InterfaceIpChangeType::kIpV6_Assigned ||
@@ -336,13 +332,13 @@ static esp_err_t chip_init(event_callback_t callback, intptr_t callback_arg)
ESP_LOGE(TAG, "Failed to add internal device callback"); ESP_LOGE(TAG, "Failed to add internal device callback");
return ESP_FAIL; return ESP_FAIL;
} }
if(callback) { if (callback) {
if (PlatformMgr().AddEventHandler(callback, callback_arg) != CHIP_NO_ERROR) { if (PlatformMgr().AddEventHandler(callback, callback_arg) != CHIP_NO_ERROR) {
(void)PlatformMgr().StopEventLoopTask(); (void)PlatformMgr().StopEventLoopTask();
chip::Platform::MemoryShutdown(); chip::Platform::MemoryShutdown();
ESP_LOGE(TAG, "Failed to add user callback"); ESP_LOGE(TAG, "Failed to add user callback");
return ESP_FAIL; return ESP_FAIL;
} }
} }
init_thread_stack_and_start_thread_task(); init_thread_stack_and_start_thread_task();
#if CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER #if CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER
@@ -392,9 +388,11 @@ esp_err_t start(event_callback_t callback, intptr_t callback_arg)
#if defined(CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER) && defined(CONFIG_ESP_MATTER_ENABLE_OPENTHREAD) #if defined(CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER) && defined(CONFIG_ESP_MATTER_ENABLE_OPENTHREAD)
// If Thread is Provisioned, publish the dns service // If Thread is Provisioned, publish the dns service
if (chip::DeviceLayer::ConnectivityMgr().IsThreadProvisioned() && if (chip::DeviceLayer::ConnectivityMgr().IsThreadProvisioned() &&
(chip::Server::GetInstance().GetFabricTable().FabricCount() != 0)) { (chip::Server::GetInstance().GetFabricTable().FabricCount() != 0)) {
PlatformMgr().ScheduleWork([](intptr_t){ chip::app::DnssdServer::Instance().StartServer(); }, PlatformMgr().ScheduleWork([](intptr_t) {
reinterpret_cast<intptr_t>(nullptr)); chip::app::DnssdServer::Instance().StartServer();
},
reinterpret_cast<intptr_t>(nullptr));
} }
#endif // CONFIG_ESP_MATTER_ENABLE_OPENTHREAD #endif // CONFIG_ESP_MATTER_ENABLE_OPENTHREAD
#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD #endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD
+5 -3
View File
@@ -134,10 +134,12 @@ typedef enum status {
*/ */
class ScopedChipStackLock { class ScopedChipStackLock {
public: public:
ScopedChipStackLock(uint32_t ticks_to_wait) { ScopedChipStackLock(uint32_t ticks_to_wait)
{
status = chip_stack_lock(ticks_to_wait); status = chip_stack_lock(ticks_to_wait);
} }
~ScopedChipStackLock() { ~ScopedChipStackLock()
{
if (status == SUCCESS) { if (status == SUCCESS) {
chip_stack_unlock(); chip_stack_unlock();
} }
@@ -171,7 +173,7 @@ private:
* @return error in case of failure. * @return error in case of failure.
*/ */
esp_err_t chip_stack_unlock(); esp_err_t chip_stack_unlock();
}; };
} /* lock */ } /* lock */
@@ -62,7 +62,7 @@ public:
static esp_err_t SetActiveThreshold(Milliseconds32 activeThreshold) static esp_err_t SetActiveThreshold(Milliseconds32 activeThreshold)
{ {
if (ICDConfigurationData::GetInstance().GetICDMode() == ICDConfigurationData::ICDMode::LIT && if (ICDConfigurationData::GetInstance().GetICDMode() == ICDConfigurationData::ICDMode::LIT &&
activeThreshold < Milliseconds32(5000)) { activeThreshold < Milliseconds32(5000)) {
return ESP_ERR_INVALID_ARG; return ESP_ERR_INVALID_ARG;
} }
ICDConfigurationData::GetInstance().mActiveThreshold = activeThreshold; ICDConfigurationData::GetInstance().mActiveThreshold = activeThreshold;
@@ -96,13 +96,13 @@ static esp_err_t set_mode_durations(std::optional<uint32_t> active_mode_duration
std::optional<uint32_t> idle_mode_duration_s) std::optional<uint32_t> idle_mode_duration_s)
{ {
Milliseconds32 active_mode_duration = active_mode_duration_ms.has_value() Milliseconds32 active_mode_duration = active_mode_duration_ms.has_value()
? Milliseconds32(active_mode_duration_ms.value()) ? Milliseconds32(active_mode_duration_ms.value())
: chip::ICDConfigurationData::GetInstance().GetActiveModeDuration(); : chip::ICDConfigurationData::GetInstance().GetActiveModeDuration();
Seconds32 idle_mode_duration = idle_mode_duration_s.has_value() Seconds32 idle_mode_duration = idle_mode_duration_s.has_value()
? Seconds32(idle_mode_duration_s.value()) ? Seconds32(idle_mode_duration_s.value())
: chip::ICDConfigurationData::GetInstance().GetIdleModeDuration(); : chip::ICDConfigurationData::GetInstance().GetIdleModeDuration();
return chip::Testing::ICDConfigurationDataTestAccess::SetModeDurations(chip::MakeOptional(active_mode_duration), return chip::Testing::ICDConfigurationDataTestAccess::SetModeDurations(chip::MakeOptional(active_mode_duration),
chip::MakeOptional(idle_mode_duration)); chip::MakeOptional(idle_mode_duration));
} }
static esp_err_t set_active_threshold(uint32_t active_threshold_ms) static esp_err_t set_active_threshold(uint32_t active_threshold_ms)
@@ -34,7 +34,7 @@ typedef struct config {
bool get_icd_server_enabled(); bool get_icd_server_enabled();
/** Set ICD configuration data /** Set ICD configuration data
* *
* This function allows the user to enable or disable the ICD server and configure its settings at runtime, before creating the Matter data model. * This function allows the user to enable or disable the ICD server and configure its settings at runtime, before creating the Matter data model.
*/ */
esp_err_t set_configuration_data(config_t *config); esp_err_t set_configuration_data(config_t *config);
@@ -88,9 +88,9 @@ static void effect_cb(Identify *identify)
esp_err_t init(uint16_t endpoint_id, uint8_t identify_type, uint8_t effect_identifier, uint8_t effect_variant) esp_err_t init(uint16_t endpoint_id, uint8_t identify_type, uint8_t effect_identifier, uint8_t effect_variant)
{ {
Identify *identify = chip::Platform::New<Identify>( Identify *identify = chip::Platform::New<Identify>(
endpoint_id, start_cb, stop_cb, (chip::app::Clusters::Identify::IdentifyTypeEnum)identify_type, effect_cb, endpoint_id, start_cb, stop_cb, (chip::app::Clusters::Identify::IdentifyTypeEnum)identify_type, effect_cb,
static_cast<chip::app::Clusters::Identify::EffectIdentifierEnum>(effect_identifier), static_cast<chip::app::Clusters::Identify::EffectIdentifierEnum>(effect_identifier),
static_cast<chip::app::Clusters::Identify::EffectVariantEnum>(effect_variant)); static_cast<chip::app::Clusters::Identify::EffectVariantEnum>(effect_variant));
VerifyOrReturnError(identify, ESP_FAIL, ESP_LOGE(TAG, "Fail to create identify object")); VerifyOrReturnError(identify, ESP_FAIL, ESP_LOGE(TAG, "Fail to create identify object"));
#ifdef CONFIG_ESP_MATTER_ENABLE_DATA_MODEL #ifdef CONFIG_ESP_MATTER_ENABLE_DATA_MODEL
endpoint::set_identify(endpoint_id, (void *)identify); endpoint::set_identify(endpoint_id, (void *)identify);
+3 -3
View File
@@ -42,7 +42,7 @@ typedef enum callback_type {
* @return error in case of failure. * @return error in case of failure.
*/ */
typedef esp_err_t (*callback_t)(callback_type_t type, uint16_t endpoint_id, uint8_t effect_id, uint8_t effect_variant, typedef esp_err_t (*callback_t)(callback_type_t type, uint16_t endpoint_id, uint8_t effect_id, uint8_t effect_variant,
void *priv_data); void *priv_data);
/** Set identification callback /** Set identification callback
* *
@@ -70,8 +70,8 @@ esp_err_t set_callback(callback_t callback);
* @return error in case of failure. * @return error in case of failure.
*/ */
esp_err_t init(uint16_t endpoint_id, uint8_t identify_type, esp_err_t init(uint16_t endpoint_id, uint8_t identify_type,
uint8_t effect_identifier = static_cast<uint8_t>(chip::app::Clusters::Identify::EffectIdentifierEnum::kBlink), uint8_t effect_identifier = static_cast<uint8_t>(chip::app::Clusters::Identify::EffectIdentifierEnum::kBlink),
uint8_t effect_variant = static_cast<uint8_t>(chip::app::Clusters::Identify::EffectVariantEnum::kDefault)); uint8_t effect_variant = static_cast<uint8_t>(chip::app::Clusters::Identify::EffectVariantEnum::kDefault));
} /* identification */ } /* identification */
} /* esp_matter */ } /* esp_matter */
+1 -2
View File
@@ -120,8 +120,7 @@ esp_err_t esp_matter_ota_requestor_encrypted_init(const char *key, uint16_t size
} }
#endif // CONFIG_ENABLE_ENCRYPTED_OTA #endif // CONFIG_ENABLE_ENCRYPTED_OTA
esp_err_t esp_matter_ota_requestor_set_config(const esp_matter_ota_config_t &config)
esp_err_t esp_matter_ota_requestor_set_config(const esp_matter_ota_config_t & config)
{ {
#if CONFIG_ENABLE_OTA_REQUESTOR #if CONFIG_ENABLE_OTA_REQUESTOR
if (config.periodic_query_timeout) { if (config.periodic_query_timeout) {
+1 -1
View File
@@ -85,4 +85,4 @@ esp_err_t esp_matter_ota_requestor_encrypted_init(const char *key, uint16_t size
* *
* @note Ensure that this API is called only after esp_matter::start() has been invoked. * @note Ensure that this API is called only after esp_matter::start() has been invoked.
*/ */
esp_err_t esp_matter_ota_requestor_set_config(const esp_matter_ota_config_t & config); esp_err_t esp_matter_ota_requestor_set_config(const esp_matter_ota_config_t &config);
@@ -19,11 +19,11 @@
IRAM_ATTR void *esp_matter_mem_calloc(size_t n, size_t size) IRAM_ATTR void *esp_matter_mem_calloc(size_t n, size_t size)
{ {
#if CONFIG_ESP_MATTER_MEM_ALLOC_MODE_INTERNAL #if CONFIG_ESP_MATTER_MEM_ALLOC_MODE_INTERNAL
return heap_caps_calloc(n, size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT); return heap_caps_calloc(n, size, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
#elif CONFIG_ESP_MATTER_MEM_ALLOC_MODE_EXTERNAL #elif CONFIG_ESP_MATTER_MEM_ALLOC_MODE_EXTERNAL
return heap_caps_calloc(n, size, MALLOC_CAP_SPIRAM|MALLOC_CAP_8BIT); return heap_caps_calloc(n, size, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
#elif CONFIG_ESP_MATTER_MEM_ALLOC_MODE_IRAM_8BIT #elif CONFIG_ESP_MATTER_MEM_ALLOC_MODE_IRAM_8BIT
return heap_caps_calloc_prefer(n, size, 2, MALLOC_CAP_INTERNAL|MALLOC_CAP_IRAM_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT); return heap_caps_calloc_prefer(n, size, 2, MALLOC_CAP_INTERNAL | MALLOC_CAP_IRAM_8BIT, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
#else #else
return calloc(n, size); return calloc(n, size);
#endif #endif
+2 -4
View File
@@ -34,21 +34,19 @@ __attribute__((weak)) const SupportedModesManager * getSupportedModesManager(voi
} /* namespace Clusters */ } /* namespace Clusters */
} /* namespace ModeSelect */ } /* namespace ModeSelect */
// Provide weak defaults for attribute changed callbacks so apps // Provide weak defaults for attribute changed callbacks so apps
// Strong definitions in an app will override these. // Strong definitions in an app will override these.
__attribute__((weak)) void MatterClosureControlClusterServerAttributeChangedCallback( __attribute__((weak)) void MatterClosureControlClusterServerAttributeChangedCallback(
const chip::app::ConcreteAttributePath & attributePath) const chip::app::ConcreteAttributePath &attributePath)
{ {
ESP_LOGI(TAG, "Attribute Changed Callback: Endpoint: %d, Cluster: %ld, Attribute: %ld", ESP_LOGI(TAG, "Attribute Changed Callback: Endpoint: %d, Cluster: %ld, Attribute: %ld",
attributePath.mEndpointId, attributePath.mClusterId, attributePath.mAttributeId); attributePath.mEndpointId, attributePath.mClusterId, attributePath.mAttributeId);
} }
__attribute__((weak)) void MatterClosureDimensionClusterServerAttributeChangedCallback( __attribute__((weak)) void MatterClosureDimensionClusterServerAttributeChangedCallback(
const chip::app::ConcreteAttributePath & attributePath) const chip::app::ConcreteAttributePath &attributePath)
{ {
ESP_LOGI(TAG, "Attribute Changed Callback: Endpoint: %d, Cluster: %ld, Attribute: %ld", ESP_LOGI(TAG, "Attribute Changed Callback: Endpoint: %d, Cluster: %ld, Attribute: %ld",
attributePath.mEndpointId, attributePath.mClusterId, attributePath.mAttributeId); attributePath.mEndpointId, attributePath.mClusterId, attributePath.mAttributeId);
} }
@@ -256,8 +256,9 @@ esp_err_t set_device_type(device_t *bridged_device, uint32_t device_type_id, voi
return ESP_ERR_INVALID_ARG; return ESP_ERR_INVALID_ARG;
} }
err = device_type_callback(bridged_device->endpoint, device_type_id, priv_data); err = device_type_callback(bridged_device->endpoint, device_type_id, priv_data);
if (err != ESP_OK) if (err != ESP_OK) {
return err; return err;
}
return plugin_init_callback_endpoint(bridged_device->endpoint); return plugin_init_callback_endpoint(bridged_device->endpoint);
} }
@@ -277,7 +278,7 @@ static bool parent_endpoint_is_valid(node_t *node, uint16_t parent_endpoint_id)
uint32_t dev_type_id; uint32_t dev_type_id;
uint8_t dev_type_ver; uint8_t dev_type_ver;
if ((ESP_OK == get_device_type_at_index(parent_endpoint, i, dev_type_id, dev_type_ver)) && if ((ESP_OK == get_device_type_at_index(parent_endpoint, i, dev_type_id, dev_type_ver)) &&
(dev_type_id == endpoint::aggregator::get_device_type_id())) { (dev_type_id == endpoint::aggregator::get_device_type_id())) {
return true; return true;
} }
} }
@@ -61,7 +61,8 @@ const device_type_handler device_handlers[] = {
{"temperature_sensor", ESP_MATTER_TEMPERATURE_SENSOR_DEVICE_TYPE_ID, ADD_DEVICE_FUN(temperature_sensor)}, {"temperature_sensor", ESP_MATTER_TEMPERATURE_SENSOR_DEVICE_TYPE_ID, ADD_DEVICE_FUN(temperature_sensor)},
}; };
static bool is_device_type_supported(uint32_t device_type_id) { static bool is_device_type_supported(uint32_t device_type_id)
{
for (const auto &handler : device_handlers) { for (const auto &handler : device_handlers) {
if (handler.device_type_id == device_type_id) { if (handler.device_type_id == device_type_id) {
return true; return true;
@@ -82,7 +83,7 @@ static esp_err_t list_endpoint_handler(int argc, char *argv[])
{ {
ESP_RETURN_ON_FALSE(argc == 0, ESP_ERR_INVALID_ARG, TAG, "Incorrect arguments"); ESP_RETURN_ON_FALSE(argc == 0, ESP_ERR_INVALID_ARG, TAG, "Incorrect arguments");
uint16_t matter_endpoint_id_array[MAX_BRIDGED_DEVICE_COUNT]; uint16_t matter_endpoint_id_array[MAX_BRIDGED_DEVICE_COUNT];
ESP_RETURN_ON_ERROR(esp_matter_bridge::get_bridged_endpoint_ids(matter_endpoint_id_array), TAG, ESP_RETURN_ON_ERROR(esp_matter_bridge::get_bridged_endpoint_ids(matter_endpoint_id_array), TAG,
"Failed to get bridged endpoint id"); "Failed to get bridged endpoint id");
ESP_LOGI(TAG, "Bridged endpoint id:"); ESP_LOGI(TAG, "Bridged endpoint id:");
uint8_t count = 0; uint8_t count = 0;
@@ -252,7 +253,7 @@ esp_err_t bridge_register_commands()
{ {
.name = "add", .name = "add",
.description = .description =
"Add matter bridged device. Usage: matter esp bridge add <parent_endpoint_id> <device_type_id>.", "Add matter bridged device. Usage: matter esp bridge add <parent_endpoint_id> <device_type_id>.",
.handler = add_bridge_device_handler, .handler = add_bridge_device_handler,
}, },
{ {
@@ -274,7 +275,8 @@ esp_err_t bridge_register_commands()
.name = "reset", .name = "reset",
.description = "reset bridge. Usage: matter esp bridge reset.", .description = "reset bridge. Usage: matter esp bridge reset.",
.handler = reset_bridge_handler, .handler = reset_bridge_handler,
}}; }
};
bridge_console.register_commands(bridge_commands, sizeof(bridge_commands) / sizeof(command_t)); bridge_console.register_commands(bridge_commands, sizeof(bridge_commands) / sizeof(command_t));
return add_commands(&command, 1); return add_commands(&command, 1);
} }
@@ -88,7 +88,6 @@ esp_err_t print_description(const command_t *command, void *arg)
return ESP_OK; return ESP_OK;
} }
static esp_err_t help_handler(int argc, char **argv) static esp_err_t help_handler(int argc, char **argv)
{ {
base_engine.for_each_command(print_description, NULL); base_engine.for_each_command(print_description, NULL);
@@ -97,7 +96,7 @@ static esp_err_t help_handler(int argc, char **argv)
static esp_err_t register_default_commands() static esp_err_t register_default_commands()
{ {
static const command_t command= { static const command_t command = {
.name = "help", .name = "help",
.description = "Print help", .description = "Print help",
.handler = help_handler, .handler = help_handler,
@@ -50,8 +50,7 @@ typedef struct {
*/ */
typedef esp_err_t command_iterator_t(const command_t *command, void *arg); typedef esp_err_t command_iterator_t(const command_t *command, void *arg);
class engine class engine {
{
protected: protected:
const command_t *_command_set[CONSOLE_MAX_COMMAND_SETS]; const command_t *_command_set[CONSOLE_MAX_COMMAND_SETS];
unsigned _command_set_size[CONSOLE_MAX_COMMAND_SETS]; unsigned _command_set_size[CONSOLE_MAX_COMMAND_SETS];
@@ -194,15 +194,15 @@ esp_err_t attribute_register_commands()
{ {
.name = "set", .name = "set",
.description = "Set an attribute value of a cluster on an endpoint. " .description = "Set an attribute value of a cluster on an endpoint. "
"Usage: matter esp attribute set <endpoint_id> <cluster_id> <attribute_id> <value>. " "Usage: matter esp attribute set <endpoint_id> <cluster_id> <attribute_id> <value>. "
"Example: matter esp attribute set 0x0001 0x0006 0x0000 1.", "Example: matter esp attribute set 0x0001 0x0006 0x0000 1.",
.handler = console_set_handler, .handler = console_set_handler,
}, },
{ {
.name = "get", .name = "get",
.description = "Get an attribute value of a cluster on an endpoint. " .description = "Get an attribute value of a cluster on an endpoint. "
"Usage: matter esp attribute get <endpoint_id> <cluster_id> <attribute_id>. " "Usage: matter esp attribute get <endpoint_id> <cluster_id> <attribute_id>. "
"Example: matter esp attribute get 0x0001 0x0006 0x0000.", "Example: matter esp attribute get 0x0001 0x0006 0x0000.",
.handler = console_get_handler, .handler = console_get_handler,
}, },
}; };
@@ -215,5 +215,3 @@ esp_err_t attribute_register_commands()
} // namespace console } // namespace console
} // namespace esp_matter } // namespace esp_matter
@@ -72,7 +72,7 @@ esp_err_t diagnostics_register_commands()
.handler = up_time_console_handler, .handler = up_time_console_handler,
}, },
}; };
diagnostics_console.register_commands(diagnostics_commands, sizeof(diagnostics_commands)/sizeof(command_t)); diagnostics_console.register_commands(diagnostics_commands, sizeof(diagnostics_commands) / sizeof(command_t));
return add_commands(&command, 1); return add_commands(&command, 1);
} }
@@ -102,7 +102,8 @@ void paa_der_cert_iterator::release()
esp_err_t spiffs_attestation_trust_store::init() esp_err_t spiffs_attestation_trust_store::init()
{ {
esp_vfs_spiffs_conf_t conf = { esp_vfs_spiffs_conf_t conf = {
.base_path = "/paa", .partition_label = nullptr, .max_files = 5, .format_if_mount_failed = false}; .base_path = "/paa", .partition_label = nullptr, .max_files = 5, .format_if_mount_failed = false
};
ESP_RETURN_ON_ERROR(esp_vfs_spiffs_register(&conf), TAG, "Failed to initialize SPIFFS"); ESP_RETURN_ON_ERROR(esp_vfs_spiffs_register(&conf), TAG, "Failed to initialize SPIFFS");
size_t total = 0, used = 0; size_t total = 0, used = 0;
ESP_RETURN_ON_ERROR(esp_spiffs_info(conf.partition_label, &total, &used), TAG, "Failed to get SPIFFS info"); ESP_RETURN_ON_ERROR(esp_spiffs_info(conf.partition_label, &total, &used), TAG, "Failed to get SPIFFS info");
@@ -124,7 +125,7 @@ CHIP_ERROR spiffs_attestation_trust_store::GetProductAttestationAuthorityCert(co
uint8_t skid_buf[Crypto::kSubjectKeyIdentifierLength] = {0}; uint8_t skid_buf[Crypto::kSubjectKeyIdentifierLength] = {0};
MutableByteSpan skid_span{skid_buf}; MutableByteSpan skid_span{skid_buf};
if (CHIP_NO_ERROR != if (CHIP_NO_ERROR !=
Crypto::ExtractSKIDFromX509Cert(ByteSpan{paa_cert.m_buffer, paa_cert.m_len}, skid_span)) { Crypto::ExtractSKIDFromX509Cert(ByteSpan{paa_cert.m_buffer, paa_cert.m_len}, skid_span)) {
continue; continue;
} }
@@ -273,7 +274,7 @@ CHIP_ERROR dcl_attestation_trust_store::GetProductAttestationAuthorityCert(const
if (json_obj_get_array(&jctx, "certs", &certs_count) == 0 && certs_count == 1) { if (json_obj_get_array(&jctx, "certs", &certs_count) == 0 && certs_count == 1) {
if (json_arr_get_object(&jctx, 0) == 0) { if (json_arr_get_object(&jctx, 0) == 0) {
if (json_obj_get_strlen(&jctx, "pemCert", &paa_str_len) == 0 && if (json_obj_get_strlen(&jctx, "pemCert", &paa_str_len) == 0 &&
json_obj_get_string(&jctx, "pemCert", paa_pem_buffer, paa_pem_size) == 0) { json_obj_get_string(&jctx, "pemCert", paa_pem_buffer, paa_pem_size) == 0) {
paa_str_len = paa_str_len < paa_pem_size - 1 ? paa_str_len : paa_pem_size - 1; paa_str_len = paa_str_len < paa_pem_size - 1 ? paa_str_len : paa_pem_size - 1;
paa_pem_buffer[paa_str_len] = 0; paa_pem_buffer[paa_str_len] = 0;
remove_backslash_n(paa_pem_buffer); remove_backslash_n(paa_pem_buffer);
@@ -31,8 +31,14 @@ typedef struct paa_der_cert {
class paa_der_cert_iterator { class paa_der_cert_iterator {
public: public:
paa_der_cert_iterator(const char *path); paa_der_cert_iterator(const char *path);
~paa_der_cert_iterator() { release(); }; ~paa_der_cert_iterator()
size_t count() { return m_count; } {
release();
};
size_t count()
{
return m_count;
}
bool next(paa_der_cert_t &item); bool next(paa_der_cert_t &item);
void release(); void release();
@@ -84,7 +90,10 @@ public:
CHIP_ERROR GetProductAttestationAuthorityCert(const ByteSpan &skid, CHIP_ERROR GetProductAttestationAuthorityCert(const ByteSpan &skid,
MutableByteSpan &outPaaDerBuffer) const override; MutableByteSpan &outPaaDerBuffer) const override;
void SetDCLNetType(dcl_net_type_t type) { dcl_net_type = type; } void SetDCLNetType(dcl_net_type_t type)
{
dcl_net_type = type;
}
private: private:
dcl_net_type_t dcl_net_type = DCL_MAIN_NET; dcl_net_type_t dcl_net_type = DCL_MAIN_NET;
@@ -41,8 +41,8 @@ esp_err_t decode_command_response(const ConcreteCommandPath &command_path, TLVRe
{ {
ESP_RETURN_ON_FALSE(reader, ESP_ERR_INVALID_ARG, TAG, "reader cannot be NULL"); ESP_RETURN_ON_FALSE(reader, ESP_ERR_INVALID_ARG, TAG, "reader cannot be NULL");
ESP_RETURN_ON_FALSE(command_path.mClusterId == CommandResponseObjectT::GetClusterId() && ESP_RETURN_ON_FALSE(command_path.mClusterId == CommandResponseObjectT::GetClusterId() &&
command_path.mCommandId == CommandResponseObjectT::GetCommandId(), command_path.mCommandId == CommandResponseObjectT::GetCommandId(),
ESP_ERR_INVALID_ARG, TAG, "Wrong command to decode"); ESP_ERR_INVALID_ARG, TAG, "Wrong command to decode");
DataModelLogger::LogCommand(command_path, reader); DataModelLogger::LogCommand(command_path, reader);
return ESP_OK; return ESP_OK;
} }
@@ -147,7 +147,8 @@ void cluster_command::on_device_connected_fcn(void *context, ExchangeManager &ex
cluster_command *cmd = reinterpret_cast<cluster_command *>(context); cluster_command *cmd = reinterpret_cast<cluster_command *>(context);
chip::OperationalDeviceProxy device_proxy(&exchangeMgr, sessionHandle); chip::OperationalDeviceProxy device_proxy(&exchangeMgr, sessionHandle);
chip::app::CommandPathParams command_path = {cmd->m_endpoint_id, 0, cmd->m_cluster_id, cmd->m_command_id, chip::app::CommandPathParams command_path = {cmd->m_endpoint_id, 0, cmd->m_cluster_id, cmd->m_command_id,
chip::app::CommandPathFlags::kEndpointIdValid}; chip::app::CommandPathFlags::kEndpointIdValid
};
interaction::invoke::send_request(context, &device_proxy, command_path, cmd->m_command_data_field, interaction::invoke::send_request(context, &device_proxy, command_path, cmd->m_command_data_field,
cmd->on_success_cb, cmd->on_error_cb, cmd->m_timed_invoke_timeout_ms); cmd->on_success_cb, cmd->on_error_cb, cmd->m_timed_invoke_timeout_ms);
chip::Platform::Delete(cmd); chip::Platform::Delete(cmd);
@@ -166,11 +167,11 @@ void cluster_command::default_success_fcn(void *ctx, const ConcreteCommandPath &
{ {
ESP_LOGI(TAG, "Send command success"); ESP_LOGI(TAG, "Send command success");
ESP_LOGI(TAG, ESP_LOGI(TAG,
"Some commands of specific clusters will have a reponse which is not NullObject, so we need to handle the " "Some commands of specific clusters will have a response which is not NullObject, so we need to handle the "
"response data for those commands. Here we print the reponse data."); "response data for those commands. Here we print the response data.");
ESP_LOGI(TAG, ESP_LOGI(TAG,
"If your command's reponse is not printed here, please register another success callback when creating " "If your command's response is not printed here, please register another success callback when creating "
"the cluster_command object to handle the reponse data."); "the cluster_command object to handle the response data.");
switch (command_path.mClusterId) { switch (command_path.mClusterId) {
case GroupKeyManagement::Id: case GroupKeyManagement::Id:
cluster::group_key_management::command::decode_response(command_path, response_data); cluster::group_key_management::command::decode_response(command_path, response_data);
@@ -208,7 +209,8 @@ esp_err_t cluster_command::dispatch_group_command(void *context)
uint8_t fabric_index = matter_controller_client::get_instance().get_fabric_index(); uint8_t fabric_index = matter_controller_client::get_instance().get_fabric_index();
#endif // CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER #endif // CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER
chip::app::CommandPathParams command_path = {cmd->m_endpoint_id, group_id, cmd->m_cluster_id, cmd->m_command_id, chip::app::CommandPathParams command_path = {cmd->m_endpoint_id, group_id, cmd->m_cluster_id, cmd->m_command_id,
chip::app::CommandPathFlags::kGroupIdValid}; chip::app::CommandPathFlags::kGroupIdValid
};
err = interaction::invoke::send_group_request(fabric_index, command_path, cmd->m_command_data_field); err = interaction::invoke::send_group_request(fabric_index, command_path, cmd->m_command_data_field);
chip::Platform::Delete(cmd); chip::Platform::Delete(cmd);
return err; return err;
@@ -228,14 +230,14 @@ esp_err_t cluster_command::send_command()
auto &controller_instance = esp_matter::controller::matter_controller_client::get_instance(); auto &controller_instance = esp_matter::controller::matter_controller_client::get_instance();
#ifdef CONFIG_ESP_MATTER_COMMISSIONER_ENABLE #ifdef CONFIG_ESP_MATTER_COMMISSIONER_ENABLE
if (CHIP_NO_ERROR == if (CHIP_NO_ERROR ==
controller_instance.get_commissioner()->GetConnectedDevice(m_destination_id, &on_device_connected_cb, controller_instance.get_commissioner()->GetConnectedDevice(m_destination_id, &on_device_connected_cb,
&on_device_connection_failure_cb)) { &on_device_connection_failure_cb)) {
return ESP_OK; return ESP_OK;
} }
#else #else
if (CHIP_NO_ERROR == if (CHIP_NO_ERROR ==
controller_instance.get_controller()->GetConnectedDevice(m_destination_id, &on_device_connected_cb, controller_instance.get_controller()->GetConnectedDevice(m_destination_id, &on_device_connected_cb,
&on_device_connection_failure_cb)) { &on_device_connection_failure_cb)) {
return ESP_OK; return ESP_OK;
} }
#endif // CONFIG_ESP_MATTER_COMMISSIONER_ENABLE #endif // CONFIG_ESP_MATTER_COMMISSIONER_ENABLE
@@ -58,7 +58,10 @@ public:
esp_err_t send_command(); esp_err_t send_command();
bool is_group_command() { return chip::IsGroupId(m_destination_id); } bool is_group_command()
{
return chip::IsGroupId(m_destination_id);
}
private: private:
uint64_t m_destination_id; uint64_t m_destination_id;
@@ -44,7 +44,7 @@ esp_err_t commissioning_window_opener::send_open_commissioning_window_command(ui
return ESP_ERR_INVALID_ARG; return ESP_ERR_INVALID_ARG;
} }
m_is_enhanced = is_enhanced; m_is_enhanced = is_enhanced;
m_timout = timeout; m_timeout = timeout;
m_iteration = iteration; m_iteration = iteration;
m_discriminator = discriminator; m_discriminator = discriminator;
m_timed_invoke_timeout_ms = timed_invoke_timeout_ms; m_timed_invoke_timeout_ms = timed_invoke_timeout_ms;
@@ -57,14 +57,14 @@ esp_err_t commissioning_window_opener::send_open_commissioning_window_command(ui
auto &controller_instance = esp_matter::controller::matter_controller_client::get_instance(); auto &controller_instance = esp_matter::controller::matter_controller_client::get_instance();
#ifdef CONFIG_ESP_MATTER_COMMISSIONER_ENABLE #ifdef CONFIG_ESP_MATTER_COMMISSIONER_ENABLE
if (CHIP_NO_ERROR == if (CHIP_NO_ERROR ==
controller_instance.get_commissioner()->GetConnectedDevice(node_id, &on_device_connected_cb, controller_instance.get_commissioner()->GetConnectedDevice(node_id, &on_device_connected_cb,
&on_device_connection_failure_cb)) { &on_device_connection_failure_cb)) {
return ESP_OK; return ESP_OK;
} }
#else #else
if (CHIP_NO_ERROR == if (CHIP_NO_ERROR ==
controller_instance.get_controller()->GetConnectedDevice(node_id, &on_device_connected_cb, controller_instance.get_controller()->GetConnectedDevice(node_id, &on_device_connected_cb,
&on_device_connection_failure_cb)) { &on_device_connection_failure_cb)) {
return ESP_OK; return ESP_OK;
} }
#endif // CONFIG_ESP_MATTER_COMMISSIONER_ENABLE #endif // CONFIG_ESP_MATTER_COMMISSIONER_ENABLE
@@ -125,7 +125,7 @@ void commissioning_window_opener::on_device_connected_fcn(void *context, Exchang
return; return;
} }
AdministratorCommissioning::Commands::OpenCommissioningWindow::Type command_data; AdministratorCommissioning::Commands::OpenCommissioningWindow::Type command_data;
command_data.commissioningTimeout = window_opener->m_timout; command_data.commissioningTimeout = window_opener->m_timeout;
command_data.PAKEPasscodeVerifier = serialized_verifier_span; command_data.PAKEPasscodeVerifier = serialized_verifier_span;
command_data.discriminator = window_opener->m_discriminator; command_data.discriminator = window_opener->m_discriminator;
command_data.iterations = window_opener->m_iteration; command_data.iterations = window_opener->m_iteration;
@@ -136,7 +136,7 @@ void commissioning_window_opener::on_device_connected_fcn(void *context, Exchang
chip::MakeOptional(window_opener->m_timed_invoke_timeout_ms)); chip::MakeOptional(window_opener->m_timed_invoke_timeout_ms));
} else { } else {
AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type command_data; AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type command_data;
command_data.commissioningTimeout = window_opener->m_timout; command_data.commissioningTimeout = window_opener->m_timeout;
chip::Controller::ClusterBase cluster(exchangeMgr, sessionHandle, window_opener->m_default_remote_endpoint_id); chip::Controller::ClusterBase cluster(exchangeMgr, sessionHandle, window_opener->m_default_remote_endpoint_id);
cluster.InvokeCommand(command_data, window_opener, send_command_success_callback, send_command_failure_callback, cluster.InvokeCommand(command_data, window_opener, send_command_success_callback, send_command_failure_callback,
chip::MakeOptional(window_opener->m_timed_invoke_timeout_ms)); chip::MakeOptional(window_opener->m_timed_invoke_timeout_ms));
@@ -148,7 +148,7 @@ void commissioning_window_opener::on_device_connection_failure_fcn(void *context
{ {
commissioning_window_opener *window_opener = reinterpret_cast<commissioning_window_opener *>(context); commissioning_window_opener *window_opener = reinterpret_cast<commissioning_window_opener *>(context);
if (window_opener) { if (window_opener) {
ESP_LOGE(TAG, "Failed to establish CASE session for open %s commisioning window command", ESP_LOGE(TAG, "Failed to establish CASE session for open %s commissioning window command",
window_opener->m_is_enhanced ? "enhanced" : "basic"); window_opener->m_is_enhanced ? "enhanced" : "basic");
} }
} }
@@ -176,7 +176,7 @@ void commissioning_window_opener::send_command_failure_callback(void *context, C
{ {
commissioning_window_opener *window_opener = reinterpret_cast<commissioning_window_opener *>(context); commissioning_window_opener *window_opener = reinterpret_cast<commissioning_window_opener *>(context);
if (window_opener) { if (window_opener) {
ESP_LOGE(TAG, "Failed to send open %s commisioning window command", ESP_LOGE(TAG, "Failed to send open %s commissioning window command",
window_opener->m_is_enhanced ? "enhanced" : "basic"); window_opener->m_is_enhanced ? "enhanced" : "basic");
} }
} }
@@ -38,7 +38,10 @@ public:
return instance; return instance;
} }
void set_callback(commissioning_window_open_callback_t callback) { m_callback = callback; } void set_callback(commissioning_window_open_callback_t callback)
{
m_callback = callback;
}
esp_err_t send_open_commissioning_window_command(uint64_t node_id, bool is_enhanced, uint16_t timeout, esp_err_t send_open_commissioning_window_command(uint64_t node_id, bool is_enhanced, uint16_t timeout,
uint32_t iteration, uint16_t discriminator, uint32_t iteration, uint16_t discriminator,
@@ -68,7 +71,7 @@ private:
uint32_t m_discriminator = 0; uint32_t m_discriminator = 0;
bool m_is_enhanced = false; bool m_is_enhanced = false;
uint32_t m_pincode = 0; uint32_t m_pincode = 0;
uint16_t m_timout = 0; uint16_t m_timeout = 0;
uint32_t m_iteration = 0; uint32_t m_iteration = 0;
uint16_t m_timed_invoke_timeout_ms = 0; uint16_t m_timed_invoke_timeout_ms = 0;
commissioning_window_open_callback_t m_callback = nullptr; commissioning_window_open_callback_t m_callback = nullptr;
@@ -51,7 +51,7 @@ void pairing_command::OnCommissioningSuccess(chip::PeerId peerId)
controller_instance.get_commissioner()->RegisterPairingDelegate(nullptr); controller_instance.get_commissioner()->RegisterPairingDelegate(nullptr);
if (m_callbacks.commissioning_success_callback) { if (m_callbacks.commissioning_success_callback) {
auto fabric = controller_instance.get_commissioner()->GetFabricTable()->FindFabricWithCompressedId( auto fabric = controller_instance.get_commissioner()->GetFabricTable()->FindFabricWithCompressedId(
peerId.GetCompressedFabricId()); peerId.GetCompressedFabricId());
m_callbacks.commissioning_success_callback(ScopedNodeId(peerId.GetNodeId(), fabric->GetFabricIndex())); m_callbacks.commissioning_success_callback(ScopedNodeId(peerId.GetNodeId(), fabric->GetFabricIndex()));
} }
} }
@@ -66,14 +66,14 @@ void pairing_command::OnCommissioningFailure(
controller_instance.get_commissioner()->RegisterPairingDelegate(nullptr); controller_instance.get_commissioner()->RegisterPairingDelegate(nullptr);
if (m_callbacks.commissioning_failure_callback) { if (m_callbacks.commissioning_failure_callback) {
auto fabric = controller_instance.get_commissioner()->GetFabricTable()->FindFabricWithCompressedId( auto fabric = controller_instance.get_commissioner()->GetFabricTable()->FindFabricWithCompressedId(
peerId.GetCompressedFabricId()); peerId.GetCompressedFabricId());
m_callbacks.commissioning_failure_callback( m_callbacks.commissioning_failure_callback(
ScopedNodeId(peerId.GetNodeId(), fabric->GetFabricIndex()), error, stageFailed, ScopedNodeId(peerId.GetNodeId(), fabric->GetFabricIndex()), error, stageFailed,
additionalErrorInfo.HasValue() ? std::make_optional(additionalErrorInfo.Value()) : std::nullopt); additionalErrorInfo.HasValue() ? std::make_optional(additionalErrorInfo.Value()) : std::nullopt);
} }
if (m_device_is_icd) { if (m_device_is_icd) {
controller_instance.get_icd_client_storage().DeleteEntry( controller_instance.get_icd_client_storage().DeleteEntry(
ScopedNodeId(peerId.GetNodeId(), controller_instance.get_fabric_index())); ScopedNodeId(peerId.GetNodeId(), controller_instance.get_fabric_index()));
} }
} }
@@ -125,10 +125,10 @@ void pairing_command::OnDiscoveredDevice(const Dnssd::CommissionNodeData &nodeDa
if (m_icd_registration) { if (m_icd_registration) {
m_device_is_icd = false; m_device_is_icd = false;
commissioning_params.SetICDRegistrationStrategy(m_icd_registration_strategy) commissioning_params.SetICDRegistrationStrategy(m_icd_registration_strategy)
.SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent) .SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent)
.SetICDCheckInNodeId(commissioner_node_id) .SetICDCheckInNodeId(commissioner_node_id)
.SetICDMonitoredSubject(commissioner_node_id) .SetICDMonitoredSubject(commissioner_node_id)
.SetICDSymmetricKey(m_icd_symmetric_key); .SetICDSymmetricKey(m_icd_symmetric_key);
} }
controller_instance.get_commissioner()->PairDevice(m_remote_node_id, params, commissioning_params); controller_instance.get_commissioner()->PairDevice(m_remote_node_id, params, commissioning_params);
} }
@@ -155,7 +155,7 @@ esp_err_t pairing_command::pairing_ble_wifi(NodeId node_id, uint32_t pincode, ui
const char *pwd) const char *pwd)
{ {
RendezvousParameters params = RendezvousParameters().SetSetupPINCode(pincode).SetDiscriminator(disc).SetPeerAddress( RendezvousParameters params = RendezvousParameters().SetSetupPINCode(pincode).SetDiscriminator(disc).SetPeerAddress(
Transport::PeerAddress::BLE()); Transport::PeerAddress::BLE());
auto &controller_instance = esp_matter::controller::matter_controller_client::get_instance(); auto &controller_instance = esp_matter::controller::matter_controller_client::get_instance();
ESP_RETURN_ON_FALSE(controller_instance.get_commissioner()->GetPairingDelegate() == nullptr, ESP_ERR_INVALID_STATE, ESP_RETURN_ON_FALSE(controller_instance.get_commissioner()->GetPairingDelegate() == nullptr, ESP_ERR_INVALID_STATE,
TAG, "There is already a pairing process"); TAG, "There is already a pairing process");
@@ -173,7 +173,7 @@ esp_err_t pairing_command::pairing_ble_thread(NodeId node_id, uint32_t pincode,
uint8_t dataset_len) uint8_t dataset_len)
{ {
RendezvousParameters params = RendezvousParameters().SetSetupPINCode(pincode).SetDiscriminator(disc).SetPeerAddress( RendezvousParameters params = RendezvousParameters().SetSetupPINCode(pincode).SetDiscriminator(disc).SetPeerAddress(
Transport::PeerAddress::BLE()); Transport::PeerAddress::BLE());
auto &controller_instance = esp_matter::controller::matter_controller_client::get_instance(); auto &controller_instance = esp_matter::controller::matter_controller_client::get_instance();
ESP_RETURN_ON_FALSE(controller_instance.get_commissioner()->GetPairingDelegate() == nullptr, ESP_ERR_INVALID_STATE, ESP_RETURN_ON_FALSE(controller_instance.get_commissioner()->GetPairingDelegate() == nullptr, ESP_ERR_INVALID_STATE,
TAG, "There is already a pairing process"); TAG, "There is already a pairing process");
@@ -184,10 +184,10 @@ esp_err_t pairing_command::pairing_ble_thread(NodeId node_id, uint32_t pincode,
if (pairing_command::get_instance().m_icd_registration) { if (pairing_command::get_instance().m_icd_registration) {
pairing_command::get_instance().m_device_is_icd = false; pairing_command::get_instance().m_device_is_icd = false;
commissioning_params.SetICDRegistrationStrategy(pairing_command::get_instance().m_icd_registration_strategy) commissioning_params.SetICDRegistrationStrategy(pairing_command::get_instance().m_icd_registration_strategy)
.SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent) .SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent)
.SetICDCheckInNodeId(commissioner_node_id) .SetICDCheckInNodeId(commissioner_node_id)
.SetICDMonitoredSubject(commissioner_node_id) .SetICDMonitoredSubject(commissioner_node_id)
.SetICDSymmetricKey(pairing_command::get_instance().m_icd_symmetric_key); .SetICDSymmetricKey(pairing_command::get_instance().m_icd_symmetric_key);
} }
controller_instance.get_commissioner()->PairDevice(node_id, params, commissioning_params); controller_instance.get_commissioner()->PairDevice(node_id, params, commissioning_params);
return ESP_OK; return ESP_OK;
@@ -204,10 +204,10 @@ esp_err_t pairing_command::pairing_code(NodeId nodeId, const char *payload)
if (pairing_command::get_instance().m_icd_registration) { if (pairing_command::get_instance().m_icd_registration) {
pairing_command::get_instance().m_device_is_icd = false; pairing_command::get_instance().m_device_is_icd = false;
commissioning_params.SetICDRegistrationStrategy(pairing_command::get_instance().m_icd_registration_strategy) commissioning_params.SetICDRegistrationStrategy(pairing_command::get_instance().m_icd_registration_strategy)
.SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent) .SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent)
.SetICDCheckInNodeId(commissioner_node_id) .SetICDCheckInNodeId(commissioner_node_id)
.SetICDMonitoredSubject(commissioner_node_id) .SetICDMonitoredSubject(commissioner_node_id)
.SetICDSymmetricKey(pairing_command::get_instance().m_icd_symmetric_key); .SetICDSymmetricKey(pairing_command::get_instance().m_icd_symmetric_key);
} }
controller_instance.get_commissioner()->RegisterPairingDelegate(&pairing_command::get_instance()); controller_instance.get_commissioner()->RegisterPairingDelegate(&pairing_command::get_instance());
controller_instance.get_commissioner()->PairDevice(nodeId, payload, commissioning_params, controller_instance.get_commissioner()->PairDevice(nodeId, payload, commissioning_params,
@@ -228,10 +228,10 @@ esp_err_t pairing_command::pairing_code_thread(NodeId nodeId, const char *payloa
if (pairing_command::get_instance().m_icd_registration) { if (pairing_command::get_instance().m_icd_registration) {
pairing_command::get_instance().m_device_is_icd = false; pairing_command::get_instance().m_device_is_icd = false;
commissioning_params.SetICDRegistrationStrategy(pairing_command::get_instance().m_icd_registration_strategy) commissioning_params.SetICDRegistrationStrategy(pairing_command::get_instance().m_icd_registration_strategy)
.SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent) .SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent)
.SetICDCheckInNodeId(commissioner_node_id) .SetICDCheckInNodeId(commissioner_node_id)
.SetICDMonitoredSubject(commissioner_node_id) .SetICDMonitoredSubject(commissioner_node_id)
.SetICDSymmetricKey(pairing_command::get_instance().m_icd_symmetric_key); .SetICDSymmetricKey(pairing_command::get_instance().m_icd_symmetric_key);
} }
controller_instance.get_commissioner()->RegisterPairingDelegate(&pairing_command::get_instance()); controller_instance.get_commissioner()->RegisterPairingDelegate(&pairing_command::get_instance());
controller_instance.get_commissioner()->PairDevice(nodeId, payload, commissioning_params, DiscoveryType::kAll); controller_instance.get_commissioner()->PairDevice(nodeId, payload, commissioning_params, DiscoveryType::kAll);
@@ -264,8 +264,8 @@ esp_err_t pairing_command::pairing_code_wifi_thread(NodeId nodeId, const char *s
CommissioningParameters commissioning_params = CommissioningParameters commissioning_params =
CommissioningParameters() CommissioningParameters()
.SetWiFiCredentials(Controller::WiFiCredentials(nameSpan, pwdSpan)) .SetWiFiCredentials(Controller::WiFiCredentials(nameSpan, pwdSpan))
.SetThreadOperationalDataset(dataset_span); .SetThreadOperationalDataset(dataset_span);
auto &controller_instance = esp_matter::controller::matter_controller_client::get_instance(); auto &controller_instance = esp_matter::controller::matter_controller_client::get_instance();
ESP_RETURN_ON_FALSE(controller_instance.get_commissioner()->GetPairingDelegate() == nullptr, ESP_ERR_INVALID_STATE, ESP_RETURN_ON_FALSE(controller_instance.get_commissioner()->GetPairingDelegate() == nullptr, ESP_ERR_INVALID_STATE,
TAG, "There is already a pairing process"); TAG, "There is already a pairing process");
@@ -273,10 +273,10 @@ esp_err_t pairing_command::pairing_code_wifi_thread(NodeId nodeId, const char *s
if (pairing_command::get_instance().m_icd_registration) { if (pairing_command::get_instance().m_icd_registration) {
pairing_command::get_instance().m_device_is_icd = false; pairing_command::get_instance().m_device_is_icd = false;
commissioning_params.SetICDRegistrationStrategy(pairing_command::get_instance().m_icd_registration_strategy) commissioning_params.SetICDRegistrationStrategy(pairing_command::get_instance().m_icd_registration_strategy)
.SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent) .SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent)
.SetICDCheckInNodeId(commissioner_node_id) .SetICDCheckInNodeId(commissioner_node_id)
.SetICDMonitoredSubject(commissioner_node_id) .SetICDMonitoredSubject(commissioner_node_id)
.SetICDSymmetricKey(pairing_command::get_instance().m_icd_symmetric_key); .SetICDSymmetricKey(pairing_command::get_instance().m_icd_symmetric_key);
} }
controller_instance.get_commissioner()->RegisterPairingDelegate(&pairing_command::get_instance()); controller_instance.get_commissioner()->RegisterPairingDelegate(&pairing_command::get_instance());
controller_instance.get_commissioner()->PairDevice(nodeId, payload, commissioning_params, DiscoveryType::kAll); controller_instance.get_commissioner()->PairDevice(nodeId, payload, commissioning_params, DiscoveryType::kAll);
@@ -44,7 +44,7 @@ typedef struct {
/** Pairing command class to finish commissioning with Matter end-devices **/ /** Pairing command class to finish commissioning with Matter end-devices **/
class pairing_command : public chip::Controller::DevicePairingDelegate, class pairing_command : public chip::Controller::DevicePairingDelegate,
public chip::Controller::DeviceDiscoveryDelegate { public chip::Controller::DeviceDiscoveryDelegate {
public: public:
/****************** DevicePairingDelegate Interface *****************/ /****************** DevicePairingDelegate Interface *****************/
// This function will be called when the PASE session is established or the commissioner fails to establish // This function will be called when the PASE session is established or the commissioner fails to establish
@@ -68,9 +68,15 @@ public:
return s_instance; return s_instance;
} }
void set_callbacks(pairing_command_callbacks_t callbacks) { m_callbacks = callbacks; } void set_callbacks(pairing_command_callbacks_t callbacks)
{
m_callbacks = callbacks;
}
void set_icd_registration(bool icd_registration) { m_icd_registration = icd_registration; } void set_icd_registration(bool icd_registration)
{
m_icd_registration = icd_registration;
}
/** /**
* Pairing a Matter end-device on the same IP network * Pairing a Matter end-device on the same IP network
@@ -66,14 +66,14 @@ esp_err_t read_command::send_command()
auto &controller_instance = esp_matter::controller::matter_controller_client::get_instance(); auto &controller_instance = esp_matter::controller::matter_controller_client::get_instance();
#ifdef CONFIG_ESP_MATTER_COMMISSIONER_ENABLE #ifdef CONFIG_ESP_MATTER_COMMISSIONER_ENABLE
if (CHIP_NO_ERROR == if (CHIP_NO_ERROR ==
controller_instance.get_commissioner()->GetConnectedDevice(m_node_id, &on_device_connected_cb, controller_instance.get_commissioner()->GetConnectedDevice(m_node_id, &on_device_connected_cb,
&on_device_connection_failure_cb)) { &on_device_connection_failure_cb)) {
return ESP_OK; return ESP_OK;
} }
#else #else
if (CHIP_NO_ERROR == if (CHIP_NO_ERROR ==
controller_instance.get_controller()->GetConnectedDevice(m_node_id, &on_device_connected_cb, controller_instance.get_controller()->GetConnectedDevice(m_node_id, &on_device_connected_cb,
&on_device_connection_failure_cb)) { &on_device_connection_failure_cb)) {
return ESP_OK; return ESP_OK;
} }
#endif // CONFIG_ESP_MATTER_COMMISSIONER_ENABLE #endif // CONFIG_ESP_MATTER_COMMISSIONER_ENABLE
@@ -160,7 +160,7 @@ esp_err_t send_read_attr_command(uint64_t node_id, ScopedMemoryBufferWithSize<ui
ScopedMemoryBufferWithSize<uint32_t> &attribute_ids) ScopedMemoryBufferWithSize<uint32_t> &attribute_ids)
{ {
if (endpoint_ids.AllocatedSize() != cluster_ids.AllocatedSize() || if (endpoint_ids.AllocatedSize() != cluster_ids.AllocatedSize() ||
endpoint_ids.AllocatedSize() != attribute_ids.AllocatedSize()) { endpoint_ids.AllocatedSize() != attribute_ids.AllocatedSize()) {
ESP_LOGE(TAG, ESP_LOGE(TAG,
"The endpoint_id array length should be the same as the cluster_ids array length" "The endpoint_id array length should be the same as the cluster_ids array length"
"and the attribute_ids array length"); "and the attribute_ids array length");
@@ -191,7 +191,7 @@ esp_err_t send_read_event_command(uint64_t node_id, ScopedMemoryBufferWithSize<u
ScopedMemoryBufferWithSize<uint32_t> &event_ids) ScopedMemoryBufferWithSize<uint32_t> &event_ids)
{ {
if (endpoint_ids.AllocatedSize() != cluster_ids.AllocatedSize() || if (endpoint_ids.AllocatedSize() != cluster_ids.AllocatedSize() ||
endpoint_ids.AllocatedSize() != event_ids.AllocatedSize()) { endpoint_ids.AllocatedSize() != event_ids.AllocatedSize()) {
ESP_LOGE(TAG, ESP_LOGE(TAG,
"The endpoint_id array length should be the same as the cluster_ids array length" "The endpoint_id array length should be the same as the cluster_ids array length"
"and the attribute_ids array length"); "and the attribute_ids array length");
@@ -41,9 +41,9 @@ void subscribe_command::on_device_connected_fcn(void *context, ExchangeManager &
subscribe_command *cmd = (subscribe_command *)context; subscribe_command *cmd = (subscribe_command *)context;
chip::OperationalDeviceProxy device_proxy(&exchangeMgr, sessionHandle); chip::OperationalDeviceProxy device_proxy(&exchangeMgr, sessionHandle);
esp_err_t err = interaction::subscribe::send_request( esp_err_t err = interaction::subscribe::send_request(
&device_proxy, cmd->m_attr_paths.Get(), cmd->m_attr_paths.AllocatedSize(), cmd->m_event_paths.Get(), &device_proxy, cmd->m_attr_paths.Get(), cmd->m_attr_paths.AllocatedSize(), cmd->m_event_paths.Get(),
cmd->m_event_paths.AllocatedSize(), cmd->m_min_interval, cmd->m_max_interval, cmd->m_keep_subscription, cmd->m_event_paths.AllocatedSize(), cmd->m_min_interval, cmd->m_max_interval, cmd->m_keep_subscription,
cmd->m_auto_resubscribe, cmd->m_buffered_read_cb); cmd->m_auto_resubscribe, cmd->m_buffered_read_cb);
if (err != ESP_OK) { if (err != ESP_OK) {
chip::Platform::Delete(cmd); chip::Platform::Delete(cmd);
} }
@@ -54,8 +54,9 @@ void subscribe_command::on_device_connection_failure_fcn(void *context, const Sc
{ {
subscribe_command *cmd = (subscribe_command *)context; subscribe_command *cmd = (subscribe_command *)context;
if (cmd->subscribe_failure_cb) if (cmd->subscribe_failure_cb) {
cmd->subscribe_failure_cb((void *)cmd); cmd->subscribe_failure_cb((void *)cmd);
}
chip::Platform::Delete(cmd); chip::Platform::Delete(cmd);
return; return;
@@ -72,14 +73,14 @@ esp_err_t subscribe_command::send_command()
auto &controller_instance = esp_matter::controller::matter_controller_client::get_instance(); auto &controller_instance = esp_matter::controller::matter_controller_client::get_instance();
#ifdef CONFIG_ESP_MATTER_COMMISSIONER_ENABLE #ifdef CONFIG_ESP_MATTER_COMMISSIONER_ENABLE
if (CHIP_NO_ERROR == if (CHIP_NO_ERROR ==
controller_instance.get_commissioner()->GetConnectedDevice(m_node_id, &on_device_connected_cb, controller_instance.get_commissioner()->GetConnectedDevice(m_node_id, &on_device_connected_cb,
&on_device_connection_failure_cb)) { &on_device_connection_failure_cb)) {
return ESP_OK; return ESP_OK;
} }
#else #else
if (CHIP_NO_ERROR == if (CHIP_NO_ERROR ==
controller_instance.get_controller()->GetConnectedDevice(m_node_id, &on_device_connected_cb, controller_instance.get_controller()->GetConnectedDevice(m_node_id, &on_device_connected_cb,
&on_device_connection_failure_cb)) { &on_device_connection_failure_cb)) {
return ESP_OK; return ESP_OK;
} }
#endif // CONFIG_ESP_MATTER_COMMISSIONER_ENABLE #endif // CONFIG_ESP_MATTER_COMMISSIONER_ENABLE
@@ -187,7 +188,7 @@ esp_err_t send_subscribe_attr_command(uint64_t node_id, ScopedMemoryBufferWithSi
uint16_t max_interval, bool auto_resubscribe, bool keep_subscription) uint16_t max_interval, bool auto_resubscribe, bool keep_subscription)
{ {
if (endpoint_ids.AllocatedSize() != cluster_ids.AllocatedSize() || if (endpoint_ids.AllocatedSize() != cluster_ids.AllocatedSize() ||
endpoint_ids.AllocatedSize() != attribute_ids.AllocatedSize()) { endpoint_ids.AllocatedSize() != attribute_ids.AllocatedSize()) {
ESP_LOGE(TAG, ESP_LOGE(TAG,
"The endpoint_id array length should be the same as the cluster_ids array length and the " "The endpoint_id array length should be the same as the cluster_ids array length and the "
"attribute_ids array length"); "attribute_ids array length");
@@ -205,8 +206,8 @@ esp_err_t send_subscribe_attr_command(uint64_t node_id, ScopedMemoryBufferWithSi
} }
subscribe_command *cmd = chip::Platform::New<subscribe_command>( subscribe_command *cmd = chip::Platform::New<subscribe_command>(
node_id, std::move(attr_paths), std::move(event_paths), min_interval, max_interval, auto_resubscribe, nullptr, node_id, std::move(attr_paths), std::move(event_paths), min_interval, max_interval, auto_resubscribe, nullptr,
nullptr, nullptr, nullptr, keep_subscription); nullptr, nullptr, nullptr, keep_subscription);
if (!cmd) { if (!cmd) {
ESP_LOGE(TAG, "Failed to alloc memory for subscribe_command"); ESP_LOGE(TAG, "Failed to alloc memory for subscribe_command");
return ESP_ERR_NO_MEM; return ESP_ERR_NO_MEM;
@@ -220,7 +221,7 @@ esp_err_t send_subscribe_event_command(uint64_t node_id, ScopedMemoryBufferWithS
uint16_t max_interval, bool auto_resubscribe, bool keep_subscription) uint16_t max_interval, bool auto_resubscribe, bool keep_subscription)
{ {
if (endpoint_ids.AllocatedSize() != cluster_ids.AllocatedSize() || if (endpoint_ids.AllocatedSize() != cluster_ids.AllocatedSize() ||
endpoint_ids.AllocatedSize() != event_ids.AllocatedSize()) { endpoint_ids.AllocatedSize() != event_ids.AllocatedSize()) {
ESP_LOGE(TAG, ESP_LOGE(TAG,
"The endpoint_id array length should be the same as the cluster_ids array length and the " "The endpoint_id array length should be the same as the cluster_ids array length and the "
"attribute_ids array length"); "attribute_ids array length");
@@ -238,8 +239,8 @@ esp_err_t send_subscribe_event_command(uint64_t node_id, ScopedMemoryBufferWithS
} }
subscribe_command *cmd = chip::Platform::New<subscribe_command>( subscribe_command *cmd = chip::Platform::New<subscribe_command>(
node_id, std::move(attr_paths), std::move(event_paths), min_interval, max_interval, auto_resubscribe, nullptr, node_id, std::move(attr_paths), std::move(event_paths), min_interval, max_interval, auto_resubscribe, nullptr,
nullptr, nullptr, nullptr, keep_subscription); nullptr, nullptr, nullptr, keep_subscription);
if (!cmd) { if (!cmd) {
ESP_LOGE(TAG, "Failed to alloc memory for subscribe_command"); ESP_LOGE(TAG, "Failed to alloc memory for subscribe_command");
return ESP_ERR_NO_MEM; return ESP_ERR_NO_MEM;
@@ -289,8 +290,8 @@ esp_err_t send_shutdown_subscription(uint64_t node_id, uint32_t subscription_id)
chip::FabricIndex fabric_index = matter_controller_client::get_instance().get_fabric_index(); chip::FabricIndex fabric_index = matter_controller_client::get_instance().get_fabric_index();
#endif #endif
if (CHIP_NO_ERROR != if (CHIP_NO_ERROR !=
InteractionModelEngine::GetInstance()->ShutdownSubscription(ScopedNodeId(node_id, fabric_index), InteractionModelEngine::GetInstance()->ShutdownSubscription(ScopedNodeId(node_id, fabric_index),
subscription_id)) { subscription_id)) {
ESP_LOGE(TAG, "Shutdown Subscription Failed"); ESP_LOGE(TAG, "Shutdown Subscription Failed");
return ESP_FAIL; return ESP_FAIL;
} }
@@ -120,7 +120,10 @@ public:
CHIP_ERROR OnResubscriptionNeeded(ReadClient *apReadClient, CHIP_ERROR aTerminationCause) override; CHIP_ERROR OnResubscriptionNeeded(ReadClient *apReadClient, CHIP_ERROR aTerminationCause) override;
uint32_t get_subscription_id() { return m_subscription_id; } uint32_t get_subscription_id()
{
return m_subscription_id;
}
private: private:
uint64_t m_node_id; uint64_t m_node_id;
@@ -200,7 +203,7 @@ esp_err_t send_subscribe_event_command(uint64_t node_id, ScopedMemoryBufferWithS
* @param[in] node_id Remote NodeId * @param[in] node_id Remote NodeId
* @param[in] endpoint_id EndpointId of the attribute path * @param[in] endpoint_id EndpointId of the attribute path
* @param[in] cluster_id ClusterId of the attribute path * @param[in] cluster_id ClusterId of the attribute path
* @param[in] attribute_id AttributeId of the attribue path * @param[in] attribute_id AttributeId of the attribute path
* @param[in] min_interval Minimum interval of the subscription * @param[in] min_interval Minimum interval of the subscription
* @param[in] max_interval Maximum interval of the subscription * @param[in] max_interval Maximum interval of the subscription
* @param[in] auto_resubscribe Auto re-subscribe flag * @param[in] auto_resubscribe Auto re-subscribe flag
@@ -71,14 +71,14 @@ esp_err_t write_command::send_command()
auto &controller_instance = esp_matter::controller::matter_controller_client::get_instance(); auto &controller_instance = esp_matter::controller::matter_controller_client::get_instance();
#ifdef CONFIG_ESP_MATTER_COMMISSIONER_ENABLE #ifdef CONFIG_ESP_MATTER_COMMISSIONER_ENABLE
if (CHIP_NO_ERROR == if (CHIP_NO_ERROR ==
controller_instance.get_commissioner()->GetConnectedDevice(m_node_id, &on_device_connected_cb, controller_instance.get_commissioner()->GetConnectedDevice(m_node_id, &on_device_connected_cb,
&on_device_connection_failure_cb)) { &on_device_connection_failure_cb)) {
return ESP_OK; return ESP_OK;
} }
#else #else
if (CHIP_NO_ERROR == if (CHIP_NO_ERROR ==
controller_instance.get_controller()->GetConnectedDevice(m_node_id, &on_device_connected_cb, controller_instance.get_controller()->GetConnectedDevice(m_node_id, &on_device_connected_cb,
&on_device_connection_failure_cb)) { &on_device_connection_failure_cb)) {
return ESP_OK; return ESP_OK;
} }
#endif // CONFIG_ESP_MATTER_COMMISSIONER_ENABLE #endif // CONFIG_ESP_MATTER_COMMISSIONER_ENABLE
@@ -111,7 +111,7 @@ esp_err_t send_write_attr_command(uint64_t node_id, ScopedMemoryBufferWithSize<u
chip::Optional<uint16_t> timed_write_timeout_ms) chip::Optional<uint16_t> timed_write_timeout_ms)
{ {
if (endpoint_ids.AllocatedSize() != cluster_ids.AllocatedSize() || if (endpoint_ids.AllocatedSize() != cluster_ids.AllocatedSize() ||
endpoint_ids.AllocatedSize() != attribute_ids.AllocatedSize()) { endpoint_ids.AllocatedSize() != attribute_ids.AllocatedSize()) {
ESP_LOGE(TAG, ESP_LOGE(TAG,
"The endpoint_id array length should be the same as the cluster_ids array length" "The endpoint_id array length should be the same as the cluster_ids array length"
"and the attribute_ids array length"); "and the attribute_ids array length");
@@ -89,7 +89,7 @@ esp_err_t matter_controller_client::init(NodeId node_id, FabricId fabric_id, uin
reinterpret_cast<chip::Credentials::GroupDataProvider *>(&m_group_data_provider); reinterpret_cast<chip::Credentials::GroupDataProvider *>(&m_group_data_provider);
chip::Credentials::SetGroupDataProvider(factory_init_params.groupDataProvider); chip::Credentials::SetGroupDataProvider(factory_init_params.groupDataProvider);
ESP_RETURN_ON_FALSE(chip::Controller::DeviceControllerFactory::GetInstance().Init(factory_init_params) == ESP_RETURN_ON_FALSE(chip::Controller::DeviceControllerFactory::GetInstance().Init(factory_init_params) ==
CHIP_NO_ERROR, CHIP_NO_ERROR,
ESP_FAIL, TAG, "Failed to initialize DeviceControllerFactory"); ESP_FAIL, TAG, "Failed to initialize DeviceControllerFactory");
auto *system_state = chip::Controller::DeviceControllerFactory::GetInstance().GetSystemState(); auto *system_state = chip::Controller::DeviceControllerFactory::GetInstance().GetSystemState();
m_group_data_provider_listener.Init(system_state); m_group_data_provider_listener.Init(system_state);
@@ -177,7 +177,7 @@ esp_err_t matter_controller_client::setup_commissioner()
chip::Credentials::GroupDataProvider *group_data_provider = chip::Credentials::GroupDataProvider *group_data_provider =
reinterpret_cast<chip::Credentials::GroupDataProvider *>(&m_group_data_provider); reinterpret_cast<chip::Credentials::GroupDataProvider *>(&m_group_data_provider);
ESP_RETURN_ON_FALSE(chip::GroupTesting::InitData(group_data_provider, fabric_index, compressed_fabric_id_span) == ESP_RETURN_ON_FALSE(chip::GroupTesting::InitData(group_data_provider, fabric_index, compressed_fabric_id_span) ==
CHIP_NO_ERROR, CHIP_NO_ERROR,
ESP_FAIL, TAG, "Failed to initialize group data"); ESP_FAIL, TAG, "Failed to initialize group data");
chip::ByteSpan default_ipk = chip::GroupTesting::DefaultIpkValue::GetDefaultIpk(); chip::ByteSpan default_ipk = chip::GroupTesting::DefaultIpkValue::GetDefaultIpk();
ESP_RETURN_ON_FALSE(chip::Credentials::SetSingleIpkEpochKey(group_data_provider, fabric_index, default_ipk, ESP_RETURN_ON_FALSE(chip::Credentials::SetSingleIpkEpochKey(group_data_provider, fabric_index, default_ipk,
@@ -264,7 +264,7 @@ esp_err_t matter_controller_client::setup_controller(chip::MutableByteSpan &ipk)
keyset.epoch_keys[0].start_time = 0; keyset.epoch_keys[0].start_time = 0;
memcpy(keyset.epoch_keys[0].key, ipk.data(), chip::Crypto::CHIP_CRYPTO_SYMMETRIC_KEY_LENGTH_BYTES); memcpy(keyset.epoch_keys[0].key, ipk.data(), chip::Crypto::CHIP_CRYPTO_SYMMETRIC_KEY_LENGTH_BYTES);
ESP_RETURN_ON_FALSE(group_data_provider->SetKeySet(fabric_index, compressed_fabric_id_span, keyset) == ESP_RETURN_ON_FALSE(group_data_provider->SetKeySet(fabric_index, compressed_fabric_id_span, keyset) ==
CHIP_NO_ERROR, CHIP_NO_ERROR,
ESP_FAIL, TAG, "Failed to set ipk for commissioner fabric"); ESP_FAIL, TAG, "Failed to set ipk for commissioner fabric");
} }
@@ -170,7 +170,10 @@ public:
} }
esp_err_t init(NodeId node_id, FabricId fabric_id, uint16_t listen_port); esp_err_t init(NodeId node_id, FabricId fabric_id, uint16_t listen_port);
chip::app::DefaultICDClientStorage &get_icd_client_storage() { return m_icd_client_storage; } chip::app::DefaultICDClientStorage &get_icd_client_storage()
{
return m_icd_client_storage;
}
void set_icd_client_callback(controller_check_in_delegate::check_in_complete_callback check_in_complete_cb, void set_icd_client_callback(controller_check_in_delegate::check_in_complete_callback check_in_complete_cb,
controller_check_in_delegate::key_refresh_done_callback key_refresh_done_cb) controller_check_in_delegate::key_refresh_done_callback key_refresh_done_cb)
{ {
@@ -179,17 +182,26 @@ public:
#ifdef CONFIG_ESP_MATTER_COMMISSIONER_ENABLE #ifdef CONFIG_ESP_MATTER_COMMISSIONER_ENABLE
esp_err_t setup_commissioner(); esp_err_t setup_commissioner();
MatterDeviceCommissioner *get_commissioner() { return &m_device_commissioner; } MatterDeviceCommissioner *get_commissioner()
{
return &m_device_commissioner;
}
esp_err_t unpair(NodeId remote_node, remove_fabric_callback callback = nullptr) esp_err_t unpair(NodeId remote_node, remove_fabric_callback callback = nullptr)
{ {
return auto_fabric_remover::remove_fabric(&m_device_commissioner, remote_node, callback); return auto_fabric_remover::remove_fabric(&m_device_commissioner, remote_node, callback);
} }
#if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY #if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY
CommissionerDiscoveryController *get_discovery_controller() { return &m_commissioner_discovery_controller; } CommissionerDiscoveryController *get_discovery_controller()
{
return &m_commissioner_discovery_controller;
}
#endif #endif
#else #else
esp_err_t setup_controller(chip::MutableByteSpan &ipk); esp_err_t setup_controller(chip::MutableByteSpan &ipk);
MatterDeviceController *get_controller() { return &m_device_controller; } MatterDeviceController *get_controller()
{
return &m_device_controller;
}
#endif #endif
chip::FabricIndex get_fabric_index() chip::FabricIndex get_fabric_index()
{ {
@@ -228,8 +240,8 @@ private:
} }
if (mSystemState->TransportMgr()->MulticastGroupJoinLeave( if (mSystemState->TransportMgr()->MulticastGroupJoinLeave(
chip::Transport::PeerAddress::Multicast(fabric->GetFabricId(), new_group.group_id), true) != chip::Transport::PeerAddress::Multicast(fabric->GetFabricId(), new_group.group_id), true) !=
CHIP_NO_ERROR) { CHIP_NO_ERROR) {
ChipLogError(AppServer, "Unable to listen to group"); ChipLogError(AppServer, "Unable to listen to group");
} }
}; };
@@ -264,7 +276,7 @@ private:
chip::Credentials::PersistentStorageOpCertStore m_operational_cert_store; chip::Credentials::PersistentStorageOpCertStore m_operational_cert_store;
chip::Crypto::RawKeySessionKeystore m_session_key_store; chip::Crypto::RawKeySessionKeystore m_session_key_store;
chip::Credentials::GroupDataProviderImpl m_group_data_provider{k_max_groups_per_fabric, chip::Credentials::GroupDataProviderImpl m_group_data_provider{k_max_groups_per_fabric,
k_max_group_keys_per_fabric}; k_max_group_keys_per_fabric};
GroupDataProviderListener m_group_data_provider_listener; GroupDataProviderListener m_group_data_provider_listener;
credentials_issuer *m_credentials_issuer; credentials_issuer *m_credentials_issuer;
NodeId m_controller_node_id; NodeId m_controller_node_id;
@@ -291,9 +303,9 @@ class ESPCommissionerCallback : public CommissionerCallback {
{ {
NodeId gRemoteId = chip::kTestDeviceNodeId; NodeId gRemoteId = chip::kTestDeviceNodeId;
chip::RendezvousParameters params = chip::RendezvousParameters() chip::RendezvousParameters params = chip::RendezvousParameters()
.SetSetupPINCode(pincode) .SetSetupPINCode(pincode)
.SetDiscriminator(longDiscriminator) .SetDiscriminator(longDiscriminator)
.SetPeerAddress(peerAddress); .SetPeerAddress(peerAddress);
do { do {
chip::Crypto::DRBG_get_bytes(reinterpret_cast<uint8_t *>(&gRemoteId), sizeof(gRemoteId)); chip::Crypto::DRBG_get_bytes(reinterpret_cast<uint8_t *>(&gRemoteId), sizeof(gRemoteId));
} while (!chip::IsOperationalNodeId(gRemoteId)); } while (!chip::IsOperationalNodeId(gRemoteId));
@@ -284,17 +284,17 @@ static esp_err_t controller_udc_handler(int argc, char **argv)
return ESP_ERR_INVALID_ARG; return ESP_ERR_INVALID_ARG;
} }
controller::matter_controller_client::get_instance() controller::matter_controller_client::get_instance()
.get_commissioner() .get_commissioner()
->GetUserDirectedCommissioningServer() ->GetUserDirectedCommissioningServer()
->ResetUDCClientProcessingStates(); ->ResetUDCClientProcessingStates();
} else if (strncmp(argv[0], "print", sizeof("print")) == 0) { } else if (strncmp(argv[0], "print", sizeof("print")) == 0) {
if (argc != 1) { if (argc != 1) {
return ESP_ERR_INVALID_ARG; return ESP_ERR_INVALID_ARG;
} }
controller::matter_controller_client::get_instance() controller::matter_controller_client::get_instance()
.get_commissioner() .get_commissioner()
->GetUserDirectedCommissioningServer() ->GetUserDirectedCommissioningServer()
->PrintUDCClients(); ->PrintUDCClients();
} else if (strncmp(argv[0], "commission", sizeof("commission")) == 0) { } else if (strncmp(argv[0], "commission", sizeof("commission")) == 0) {
if (argc != 3) { if (argc != 3) {
return ESP_ERR_INVALID_ARG; return ESP_ERR_INVALID_ARG;
@@ -310,9 +310,9 @@ static esp_err_t controller_udc_handler(int argc, char **argv)
chip::NodeId gRemoteId = chip::kTestDeviceNodeId; chip::NodeId gRemoteId = chip::kTestDeviceNodeId;
chip::RendezvousParameters params = chip::RendezvousParameters() chip::RendezvousParameters params = chip::RendezvousParameters()
.SetSetupPINCode(pincode) .SetSetupPINCode(pincode)
.SetDiscriminator(state->GetLongDiscriminator()) .SetDiscriminator(state->GetLongDiscriminator())
.SetPeerAddress(state->GetPeerAddress()); .SetPeerAddress(state->GetPeerAddress());
do { do {
chip::Crypto::DRBG_get_bytes(reinterpret_cast<uint8_t *>(&gRemoteId), sizeof(gRemoteId)); chip::Crypto::DRBG_get_bytes(reinterpret_cast<uint8_t *>(&gRemoteId), sizeof(gRemoteId));
} while (!chip::IsOperationalNodeId(gRemoteId)); } while (!chip::IsOperationalNodeId(gRemoteId));
@@ -415,7 +415,7 @@ static esp_err_t open_commissioning_window_handler(int argc, char **argv)
controller::commissioning_window_opener::get_instance().set_callback(print_manual_code); controller::commissioning_window_opener::get_instance().set_callback(print_manual_code);
return controller::commissioning_window_opener::get_instance().send_open_commissioning_window_command( return controller::commissioning_window_opener::get_instance().send_open_commissioning_window_command(
node_id, is_enhanced, window_timeout, iteration, discriminator, 10000 /* timed_invoke_timeout_ms */); node_id, is_enhanced, window_timeout, iteration, discriminator, 10000 /* timed_invoke_timeout_ms */);
} }
static esp_err_t controller_invoke_command_handler(int argc, char **argv) static esp_err_t controller_invoke_command_handler(int argc, char **argv)
@@ -620,30 +620,30 @@ esp_err_t controller_register_commands()
{ {
.name = "pairing", .name = "pairing",
.description = "Commands for commissioning/unpair nodes.\n" .description = "Commands for commissioning/unpair nodes.\n"
"\tUsage: controller pairing onnetwork <nodeid> <pincode> OR\n" "\tUsage: controller pairing onnetwork <nodeid> <pincode> OR\n"
"\tcontroller pairing ble-wifi <nodeid> <ssid> <password> <pincode> <discriminator> OR\n" "\tcontroller pairing ble-wifi <nodeid> <ssid> <password> <pincode> <discriminator> OR\n"
"\tcontroller pairing ble-thread <nodeid> <dataset> <pincode> <discriminator> OR\n" "\tcontroller pairing ble-thread <nodeid> <dataset> <pincode> <discriminator> OR\n"
"\tcontroller pairing ble-thread <nodeid> <dataset> <pincode> <discriminator> OR\n" "\tcontroller pairing ble-thread <nodeid> <dataset> <pincode> <discriminator> OR\n"
"\tcontroller pairing code <nodeid> <payload> OR\n" "\tcontroller pairing code <nodeid> <payload> OR\n"
"\tcontroller pairing code-wifi <nodeid> <ssid> <password> <payload> OR\n" "\tcontroller pairing code-wifi <nodeid> <ssid> <password> <payload> OR\n"
"\tcontroller pairing code-thread <nodeid> <dataset> <payload> OR\n" "\tcontroller pairing code-thread <nodeid> <dataset> <payload> OR\n"
"\tcontroller pairing code-wifi-thread <nodeid> <ssid> <password> <dataset> <payload> OR\n" "\tcontroller pairing code-wifi-thread <nodeid> <ssid> <password> <dataset> <payload> OR\n"
"\tcontroller pairing unpair <nodeid>", "\tcontroller pairing unpair <nodeid>",
.handler = controller_pairing_handler, .handler = controller_pairing_handler,
}, },
{ {
.name = "icd", .name = "icd",
.description = "icd client management.\n" .description = "icd client management.\n"
"\tUsage: controller icd list", "\tUsage: controller icd list",
.handler = controller_icd_list_handler, .handler = controller_icd_list_handler,
}, },
#if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY #if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY
{ {
.name = "udc", .name = "udc",
.description = "UDC command.\n" .description = "UDC command.\n"
"\tUsage: controller udc reset OR\n" "\tUsage: controller udc reset OR\n"
"\tcontroller udc print OR\n" "\tcontroller udc print OR\n"
"\tcontroller udc commission <pincode> <udc-entry>", "\tcontroller udc commission <pincode> <udc-entry>",
.handler = controller_udc_handler, .handler = controller_udc_handler,
}, },
#endif #endif
@@ -652,95 +652,95 @@ esp_err_t controller_register_commands()
{ {
.name = "group-settings", .name = "group-settings",
.description = "Managing the groups and keysets of the controller.\n" .description = "Managing the groups and keysets of the controller.\n"
"\tUsage: controller group-settings <sub-commands>", "\tUsage: controller group-settings <sub-commands>",
.handler = controller_group_settings_handler, .handler = controller_group_settings_handler,
}, },
#endif // !CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER #endif // !CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER
{ {
.name = "open-commissioning-window", .name = "open-commissioning-window",
.description = .description =
"Send command to open basic/enhanced commissioning window\n" "Send command to open basic/enhanced commissioning window\n"
"\tUsage: controller open-commissioning-window <node-id> <option> <window-timeout> <iteration> " "\tUsage: controller open-commissioning-window <node-id> <option> <window-timeout> <iteration> "
"<discriminator>\n" "<discriminator>\n"
"\toption: 1 to use enhanced commissioning window. 0 to use basic commissioning window.\n" "\toption: 1 to use enhanced commissioning window. 0 to use basic commissioning window.\n"
"\titeration: Number of PBKDF iterations to use to derive the verifier. Ignored if 'option' is 0.\n" "\titeration: Number of PBKDF iterations to use to derive the verifier. Ignored if 'option' is 0.\n"
"\tdiscriminator: Discriminator to use for advertising. Ignored if 'option' is 0.", "\tdiscriminator: Discriminator to use for advertising. Ignored if 'option' is 0.",
.handler = open_commissioning_window_handler, .handler = open_commissioning_window_handler,
}, },
{ {
.name = "invoke-cmd", .name = "invoke-cmd",
.description = .description =
"Send command to the nodes.\n" "Send command to the nodes.\n"
"\tUsage: controller invoke-cmd <node-id|group-id> <endpoint-id> <cluster-id> <command-id> " "\tUsage: controller invoke-cmd <node-id|group-id> <endpoint-id> <cluster-id> <command-id> "
"[command_data] [timed_invoke_timeout_ms]\n" "[command_data] [timed_invoke_timeout_ms]\n"
"\tNotes: group-id should start with prefix '0xFFFFFFFFFFFF', endpoint-id will be ignored if the fist " "\tNotes: group-id should start with prefix '0xFFFFFFFFFFFF', endpoint-id will be ignored if the fist "
"parameter is group-id.\n" "parameter is group-id.\n"
"\tNotes: The command_data should be a JSON object that includes all the command data fields defined " "\tNotes: The command_data should be a JSON object that includes all the command data fields defined "
"in the " "in the "
"SPEC. You can get the format of the payload from " "SPEC. You can get the format of the payload from "
"https://docs.espressif.com/projects/esp-matter/en/latest/esp32/developing.html#cluster-commands\n" "https://docs.espressif.com/projects/esp-matter/en/latest/esp32/developing.html#cluster-commands\n"
"\tNotes: The timed_invoke_timeout_ms should be used with command_data. If the command has no command " "\tNotes: The timed_invoke_timeout_ms should be used with command_data. If the command has no command "
"data field, please use '\"{}\"' as the command_data ", "data field, please use '\"{}\"' as the command_data ",
.handler = controller_invoke_command_handler, .handler = controller_invoke_command_handler,
}, },
{ {
.name = "read-attr", .name = "read-attr",
.description = "Read attributes of the nodes.\n" .description = "Read attributes of the nodes.\n"
"\tUsage: controller read-attr <node-id> <endpoint-ids> <cluster-ids> <attr-ids>\n" "\tUsage: controller read-attr <node-id> <endpoint-ids> <cluster-ids> <attr-ids>\n"
"\tNotes: endpoint-ids can represent a single or multiple endpoints, e.g. '0' or '0,1'. " "\tNotes: endpoint-ids can represent a single or multiple endpoints, e.g. '0' or '0,1'. "
"And the same applies to cluster-ids, attr-ids, and event-ids.", "And the same applies to cluster-ids, attr-ids, and event-ids.",
.handler = controller_read_attr_handler, .handler = controller_read_attr_handler,
}, },
{ {
.name = "write-attr", .name = "write-attr",
.description = .description =
"Write attributes of the nodes.\n" "Write attributes of the nodes.\n"
"\tUsage: controller write-attr <node-id> <endpoint-ids> <cluster-ids> <attr-ids> <attr-value> [timed_write_timeout_ms]\n" "\tUsage: controller write-attr <node-id> <endpoint-ids> <cluster-ids> <attr-ids> <attr-value> [timed_write_timeout_ms]\n"
"\tNotes: attr-value should be a JSON object that contains the attribute value JSON item." "\tNotes: attr-value should be a JSON object that contains the attribute value JSON item."
"You can get the format of the attr-value from " "You can get the format of the attr-value from "
"https://docs.espressif.com/projects/esp-matter/en/latest/esp32/" "https://docs.espressif.com/projects/esp-matter/en/latest/esp32/"
"developing.html#write-attribute-commands", "developing.html#write-attribute-commands",
.handler = controller_write_attr_handler, .handler = controller_write_attr_handler,
}, },
{ {
.name = "read-event", .name = "read-event",
.description = "Read events of the nodes.\n" .description = "Read events of the nodes.\n"
"\tUsage: controller read-event <node-id> <endpoint-ids> <cluster-ids> <event-ids>", "\tUsage: controller read-event <node-id> <endpoint-ids> <cluster-ids> <event-ids>",
.handler = controller_read_event_handler, .handler = controller_read_event_handler,
}, },
{ {
.name = "subs-attr", .name = "subs-attr",
.description = "Subscribe attributes of the nodes.\n" .description = "Subscribe attributes of the nodes.\n"
"\tUsage: controller subs-attr <node-id> <endpoint-ids> <cluster-ids> <attr-ids> " "\tUsage: controller subs-attr <node-id> <endpoint-ids> <cluster-ids> <attr-ids> "
"<min-interval> <max-interval> [keep-subscription] [auto-resubscribe]\n" "<min-interval> <max-interval> [keep-subscription] [auto-resubscribe]\n"
"\tNotes: If 'keep-subscription' is 'false', existing subscriptions will be terminated for the node. " "\tNotes: If 'keep-subscription' is 'false', existing subscriptions will be terminated for the node. "
"If 'auto-resubscribe' is 'true', controller will auto resubscribe if subscriptions timeout", "If 'auto-resubscribe' is 'true', controller will auto resubscribe if subscriptions timeout",
.handler = controller_subscribe_attr_handler, .handler = controller_subscribe_attr_handler,
}, },
{ {
.name = "subs-event", .name = "subs-event",
.description = "Subscribe events of the nodes.\n" .description = "Subscribe events of the nodes.\n"
"\tUsage: controller subs-event <node-id> <endpoint-ids> <cluster-ids> <event-ids> " "\tUsage: controller subs-event <node-id> <endpoint-ids> <cluster-ids> <event-ids> "
"<min-interval> <max-interval> [keep-subscription] [auto-resubscribe]\n" "<min-interval> <max-interval> [keep-subscription] [auto-resubscribe]\n"
"\tNotes: 'keep-subscription' and 'auto-resubscribe' are the same as 'subs-attr' command", "\tNotes: 'keep-subscription' and 'auto-resubscribe' are the same as 'subs-attr' command",
.handler = controller_subscribe_event_handler, .handler = controller_subscribe_event_handler,
}, },
{ {
.name = "shutdown-subs", .name = "shutdown-subs",
.description = "Shutdown subscription for given node id and subscription id.\n" .description = "Shutdown subscription for given node id and subscription id.\n"
"\tUsage: controller shutdown-subs <node-id> <subscription-id>", "\tUsage: controller shutdown-subs <node-id> <subscription-id>",
.handler = controller_shutdown_subscription_handler, .handler = controller_shutdown_subscription_handler,
}, },
{ {
.name = "shutdown-subss", .name = "shutdown-subss",
.description = "Shutdown all subscriptions for a given node.\n" .description = "Shutdown all subscriptions for a given node.\n"
"\tUsage: controller shutdown-subss <node-id>", "\tUsage: controller shutdown-subss <node-id>",
.handler = controller_shutdown_subscriptions_handler, .handler = controller_shutdown_subscriptions_handler,
}, },
{ {
.name = "shutdown-all-subss", .name = "shutdown-all-subss",
.description = "Shutdown all subscriptions to all nodes.\n" .description = "Shutdown all subscriptions to all nodes.\n"
"\tUsage: controller shutdown-all-subss", "\tUsage: controller shutdown-all-subss",
.handler = controller_shutdown_all_subscriptions_handler, .handler = controller_shutdown_all_subscriptions_handler,
}, },
}; };
@@ -25,14 +25,17 @@ class example_credentials_issuer : public credentials_issuer {
return m_operational_creds_issuer.Initialize(storage) == CHIP_NO_ERROR ? ESP_OK : ESP_FAIL; return m_operational_creds_issuer.Initialize(storage) == CHIP_NO_ERROR ? ESP_OK : ESP_FAIL;
} }
chip::Controller::OperationalCredentialsDelegate *get_delegate() override { return &m_operational_creds_issuer; } chip::Controller::OperationalCredentialsDelegate *get_delegate() override
{
return &m_operational_creds_issuer;
}
esp_err_t generate_controller_noc_chain(chip::NodeId node_id, chip::FabricId fabric_id, esp_err_t generate_controller_noc_chain(chip::NodeId node_id, chip::FabricId fabric_id,
chip::Crypto::P256Keypair &keypair, chip::MutableByteSpan &rcac, chip::Crypto::P256Keypair &keypair, chip::MutableByteSpan &rcac,
chip::MutableByteSpan &icac, chip::MutableByteSpan &noc) override chip::MutableByteSpan &icac, chip::MutableByteSpan &noc) override
{ {
CHIP_ERROR err = m_operational_creds_issuer.GenerateNOCChainAfterValidation( CHIP_ERROR err = m_operational_creds_issuer.GenerateNOCChainAfterValidation(
node_id, fabric_id, chip::kUndefinedCATs, keypair.Pubkey(), rcac, icac, noc); node_id, fabric_id, chip::kUndefinedCATs, keypair.Pubkey(), rcac, icac, noc);
return err == CHIP_NO_ERROR ? ESP_OK : ESP_FAIL; return err == CHIP_NO_ERROR ? ESP_OK : ESP_FAIL;
} }
@@ -114,7 +114,7 @@ esp_err_t show_keysets()
while (iter->Next(keyset)) { while (iter->Next(keyset)) {
ESP_LOGI(TAG, " | 0x%-12x %-66s |", keyset.keyset_id, ESP_LOGI(TAG, " | 0x%-12x %-66s |", keyset.keyset_id,
(keyset.policy == GroupDataProvider::SecurityPolicy::kCacheAndSync) ? "Cache and Sync" (keyset.policy == GroupDataProvider::SecurityPolicy::kCacheAndSync) ? "Cache and Sync"
: "Trust First"); : "Trust First");
} }
iter->Release(); iter->Release();
} }
@@ -133,8 +133,8 @@ esp_err_t bind_keyset(uint16_t group_id, uint16_t keyset_id)
iter->Release(); iter->Release();
if (CHIP_NO_ERROR != if (CHIP_NO_ERROR !=
group_data_provider->SetGroupKeyAt(fabric_index, current_count, group_data_provider->SetGroupKeyAt(fabric_index, current_count,
GroupDataProvider::GroupKey(group_id, keyset_id))) { GroupDataProvider::GroupKey(group_id, keyset_id))) {
ESP_LOGE(TAG, "Failed to bind keyset"); ESP_LOGE(TAG, "Failed to bind keyset");
return ESP_FAIL; return ESP_FAIL;
} }
@@ -173,9 +173,9 @@ esp_err_t add_keyset(uint16_t keyset_id, uint8_t key_policy, uint64_t validity_t
chip::MutableByteSpan compressed_fabric_id_span(compressed_fabric_id); chip::MutableByteSpan compressed_fabric_id_span(compressed_fabric_id);
if (CHIP_NO_ERROR != if (CHIP_NO_ERROR !=
#ifdef CONFIG_ESP_MATTER_COMMISSIONER_ENABLE #ifdef CONFIG_ESP_MATTER_COMMISSIONER_ENABLE
controller_instance.get_commissioner()->GetCompressedFabricIdBytes(compressed_fabric_id_span)) { controller_instance.get_commissioner()->GetCompressedFabricIdBytes(compressed_fabric_id_span)) {
#else #else
controller_instance.get_controller()->GetCompressedFabricIdBytes(compressed_fabric_id_span)) { controller_instance.get_controller()->GetCompressedFabricIdBytes(compressed_fabric_id_span)) {
#endif #endif
ESP_LOGE(TAG, "Failed to get the compressed fabric_id"); ESP_LOGE(TAG, "Failed to get the compressed fabric_id");
return ESP_FAIL; return ESP_FAIL;
@@ -44,14 +44,14 @@ esp_err_t list_registered_icd()
while (iter->Next(info)) { while (iter->Next(info)) {
ESP_LOGI(TAG, " | " ChipLogFormatX64 " | " ChipLogFormatX64 " | %13" PRIu32 " | %14" PRIu32 ESP_LOGI(TAG, " | " ChipLogFormatX64 " | " ChipLogFormatX64 " | %13" PRIu32 " | %14" PRIu32
" | " ChipLogFormatX64 " | %10u |", ChipLogValueX64(info.peer_node.GetNodeId()), " | " ChipLogFormatX64 " | %10u |", ChipLogValueX64(info.peer_node.GetNodeId()),
ChipLogValueX64(info.check_in_node.GetNodeId()),info.start_icd_counter, info.offset, ChipLogValueX64(info.check_in_node.GetNodeId()), info.start_icd_counter, info.offset,
ChipLogValueX64(info.monitored_subject), static_cast<uint8_t>(info.client_type)); ChipLogValueX64(info.monitored_subject), static_cast<uint8_t>(info.client_type));
Encoding::BytesToHex(info.aes_key_handle.As<Crypto::Symmetric128BitsKeyByteArray>(), Crypto::kAES_CCM128_Key_Length, Encoding::BytesToHex(info.aes_key_handle.As<Crypto::Symmetric128BitsKeyByteArray>(), Crypto::kAES_CCM128_Key_Length,
icd_aes_key_hex, sizeof(icd_aes_key_hex), Encoding::HexFlags::kNullTerminate); icd_aes_key_hex, sizeof(icd_aes_key_hex), Encoding::HexFlags::kNullTerminate);
ESP_LOGI(TAG," | aes key: %60s |", icd_aes_key_hex); ESP_LOGI(TAG, " | aes key: %60s |", icd_aes_key_hex);
Encoding::BytesToHex(info.hmac_key_handle.As<Crypto::Symmetric128BitsKeyByteArray>(), Crypto::kHMAC_CCM128_Key_Length, Encoding::BytesToHex(info.hmac_key_handle.As<Crypto::Symmetric128BitsKeyByteArray>(), Crypto::kHMAC_CCM128_Key_Length,
icd_hmac_key_hex, sizeof(icd_hmac_key_hex), Encoding::HexFlags::kNullTerminate); icd_hmac_key_hex, sizeof(icd_hmac_key_hex), Encoding::HexFlags::kNullTerminate);
ESP_LOGI(TAG," | hmac key: %60s |", icd_hmac_key_hex); ESP_LOGI(TAG, " | hmac key: %60s |", icd_hmac_key_hex);
ESP_LOGI(TAG, " +------------------------------------------------------------------------------------------------------+"); ESP_LOGI(TAG, " +------------------------------------------------------------------------------------------------------+");
} }
return ESP_OK; return ESP_OK;

Some files were not shown because too many files have changed in this diff Show More