diff --git a/.clang-format b/.clang-format deleted file mode 100644 index 20f9da872..000000000 --- a/.clang-format +++ /dev/null @@ -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 -... - diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 73a9a2ef0..47097e4b0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,5 @@ stages: - - check_typos + - pre_check - cleanup - docker_build - build @@ -250,6 +250,7 @@ build_image: - job: build_image optional: true - job: check_typos + - job: pre_commit_check tags: - build # runner: `sudo mkdir -p /cache/matter_build/` @@ -616,6 +617,7 @@ build_managed_component_light: - job: build_image optional: true - job: check_typos + - job: pre_commit_check script: - cd ${ESP_MATTER_PATH}/examples/managed_component_light - idf.py set-target esp32c3 @@ -649,6 +651,7 @@ build_esp_rainmaker_apps: - job: build_image optional: true - job: check_typos + - job: pre_commit_check artifacts: paths: @@ -754,7 +757,7 @@ deploy_docs_production: check_typos: image: $CI_DOCKER_REGISTRY/esp-env-v6.0:1 - stage: check_typos + stage: pre_check script: - pip install codespell - git fetch origin main @@ -766,3 +769,29 @@ check_typos: fi tags: - 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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3b48821b9..f6b7e2cda 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,8 @@ repos: -- repo: https://github.com/pre-commit/mirrors-clang-format - rev: '0f8362ad84fe4a446b807ffbfc9e65d078ecf732' +- repo: https://github.com/espressif/astyle_py.git + rev: v1.0.5 hooks: - - id: clang-format - exclude: '^.*/zap-generated/.*$' + - id: astyle_py + args: ['--astyle-version=3.4.7', '--rules=tools/ci/astyle-rules.yml'] diff --git a/components/esp_matter/data_model/esp_matter_attribute.cpp b/components/esp_matter/data_model/esp_matter_attribute.cpp index a090bdb50..5ac89cf6c 100644 --- a/components/esp_matter/data_model/esp_matter_attribute.cpp +++ b/components/esp_matter/data_model/esp_matter_attribute.cpp @@ -310,7 +310,6 @@ attribute_t *create_configuration_version(cluster_t *cluster, uint32_t value) ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_uint32(value)); } - } /* attribute */ } /* basic_information */ @@ -558,7 +557,6 @@ attribute_t *create_test_event_triggers_enabled(cluster_t *cluster, bool value) } /* attribute */ } /* general_diagnostics */ - namespace software_diagnostics { 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) { 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) @@ -1253,25 +1251,25 @@ namespace attribute { attribute_t *create_phy_rate(cluster_t *cluster, nullable value) { 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 value) { 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) { 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) { 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) @@ -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) { 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) { 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 value) { 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) { 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 */ @@ -1454,7 +1452,7 @@ namespace attribute { attribute_t *create_identify_time(cluster_t *cluster, uint16_t value) { 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) @@ -1554,7 +1552,7 @@ attribute_t *create_on_level(cluster_t *cluster, nullable value) attribute_t *create_options(cluster_t *cluster, uint8_t value) { 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) @@ -1636,13 +1634,13 @@ namespace attribute { attribute_t *create_current_hue(cluster_t *cluster, uint8_t value) { 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) { 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) @@ -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) { 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) { 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) { 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) { 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 value) { return esp_matter::attribute::create(cluster, ColorControl::Attributes::StartUpColorTemperatureMireds::Id, - ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, - esp_matter_nullable_uint16(value)); + ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, + esp_matter_nullable_uint16(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) { - return esp_matter::attribute::create(cluster, ColorControl::Attributes::DriftCompensation::Id, - ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + return esp_matter::attribute::create(cluster, ColorControl::Attributes::DriftCompensation::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); } 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) { case 1: return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary1X::Id, ATTRIBUTE_FLAG_NONE, - esp_matter_uint16(value)); - break; + esp_matter_uint16(value)); + break; case 2: return esp_matter::attribute::create(cluster, ColorControl::Attributes::Primary2X::Id, ATTRIBUTE_FLAG_NONE, 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) { 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)); break; case 2: @@ -1882,7 +1880,7 @@ namespace attribute { attribute_t *create_fan_mode(cluster_t *cluster, uint8_t value) { 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) @@ -1912,7 +1910,7 @@ attribute_t *create_speed_max(cluster_t *cluster, uint8_t value) attribute_t *create_speed_setting(cluster_t *cluster, nullable value) { 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) @@ -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) { 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) { 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) @@ -2272,7 +2270,7 @@ attribute_t *create_active_preset_handle(cluster_t *cluster, uint8_t *value, uin return NULL; } 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) @@ -2282,19 +2280,19 @@ attribute_t *create_active_schedule_handle(cluster_t *cluster, uint8_t *value, u return NULL; } 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) { 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) { 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 value) @@ -2312,19 +2310,19 @@ namespace attribute { attribute_t *create_temperature_display_mode(cluster_t *cluster, uint8_t value) { 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) { 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) { 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 */ @@ -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) { 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 value) { return esp_matter::attribute::create(cluster, HepaFilterMonitoring::Attributes::LastChangedTime::Id, 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) @@ -2390,67 +2388,67 @@ namespace attribute { attribute_t *create_measured_value(cluster_t *cluster, nullable value) { 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 value) { 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 value) { 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 value) { 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) { 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 value) { 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) { 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) { 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) { 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) { 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) { - return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::LevelValue::Id, - ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); + return esp_matter::attribute::create(cluster, CarbonMonoxideConcentrationMeasurement::Attributes::LevelValue::Id, + ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value)); } } /* 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 value) { 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 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 value) { 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)); } @@ -2533,13 +2531,13 @@ namespace attribute { 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, - 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 value) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { return esp_matter::attribute::create(cluster, SmokeCoAlarm::Attributes::ContaminationState::Id, ATTRIBUTE_FLAG_NONE, - esp_matter_uint32(value)); + esp_matter_uint32(value)); } } /* 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_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)); 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_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)); 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_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)); 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_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)); 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) { 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) { 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) @@ -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) { 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) { 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) @@ -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) { 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) { 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 */ @@ -3340,7 +3338,7 @@ namespace attribute { attribute_t *create_measured_value(cluster_t *cluster, nullable value, nullable min, nullable max) { 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)); return attribute; } @@ -3348,7 +3346,7 @@ attribute_t *create_measured_value(cluster_t *cluster, nullable value, attribute_t *create_min_measured_value(cluster_t *cluster, nullable value, nullable min, nullable max) { 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)); return attribute; } @@ -3356,7 +3354,7 @@ attribute_t *create_min_measured_value(cluster_t *cluster, nullable va attribute_t *create_max_measured_value(cluster_t *cluster, nullable value, nullable min, nullable max) { 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)); return attribute; } @@ -3364,15 +3362,15 @@ attribute_t *create_max_measured_value(cluster_t *cluster, nullable va 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)); - 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)); - return attribute; + 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)); + return attribute; } attribute_t *create_light_sensor_type(cluster_t *cluster, nullable value, nullable min, nullable max) { 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)); return attribute; } @@ -3385,12 +3383,12 @@ namespace attribute { attribute_t *create_measured_value(cluster_t *cluster, nullable 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 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 value) @@ -3401,7 +3399,7 @@ attribute_t *create_max_measured_value(cluster_t *cluster, nullable val 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)); - 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)); return attribute; } @@ -3424,7 +3422,7 @@ attribute_t *create_max_scaled_value(cluster_t *cluster, nullable value 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)); - 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)); return attribute; } @@ -3458,7 +3456,7 @@ attribute_t *create_max_measured_value(cluster_t *cluster, nullable va 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)); - 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)); 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 *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)); 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 value, nullable min, nullable max) { 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)); return attribute; } @@ -3658,7 +3656,7 @@ attribute_t *create_wired_assessed_input_voltage(cluster_t *cluster, nullable value, nullable min, nullable max) { 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)); 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 value, nullable min, nullable max) { 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)); return attribute; } @@ -3679,7 +3677,7 @@ attribute_t *create_wired_assessed_current(cluster_t *cluster, nullable value, nullable min, nullable max) { 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)); return attribute; } @@ -3714,7 +3712,7 @@ attribute_t *create_bat_voltage(cluster_t *cluster, nullable value, nu attribute_t *create_bat_percent_remaining(cluster_t *cluster, nullable value, nullable min, nullable max) { 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)); return attribute; } @@ -3722,7 +3720,7 @@ attribute_t *create_bat_percent_remaining(cluster_t *cluster, nullable attribute_t *create_bat_time_remaining(cluster_t *cluster, nullable< uint32_t> value, nullable min, nullable max) { 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)); 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 *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)); 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 *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)); 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 *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)); 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 *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)); 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 value, nullable min, nullable max) { 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)); 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 value, nullable min, nullable max) { 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)); 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) { 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) { 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) { 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) { 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) { 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) { 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 */ @@ -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")); return esp_matter::attribute::create(cluster, ApplicationBasic::Attributes::ApplicationVersion::Id, - ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_char_str(value, length), - k_max_application_version_length); + ATTRIBUTE_FLAG_MANAGED_INTERNALLY, esp_matter_char_str(value, length), + k_max_application_version_length); } 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 */ }/*webrtc transport requestor*/ - namespace chime { namespace attribute { attribute_t *create_installed_chime_sounds(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count) diff --git a/components/esp_matter/data_model/esp_matter_attribute.h b/components/esp_matter/data_model/esp_matter_attribute.h index 693e57f69..0e8600402 100644 --- a/components/esp_matter/data_model/esp_matter_attribute.h +++ b/components/esp_matter/data_model/esp_matter_attribute.h @@ -570,7 +570,6 @@ namespace activated_carbon_filter_monitoring { namespace attribute = resource_monitoring::attribute; } /* activated_carbon_filter_monitoring */ - namespace concentration_measurement { namespace attribute { attribute_t *create_measured_value(cluster_t *cluster, nullable value); @@ -1257,14 +1256,14 @@ attribute_t *create_status_light_brightness(cluster_t *cluster, uint8_t value); } /*camera av stream management*/ 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 */ }/*webrtc transport provider*/ 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 */ diff --git a/components/esp_matter/data_model/esp_matter_attribute_bounds.cpp b/components/esp_matter/data_model/esp_matter_attribute_bounds.cpp index 1bc1af070..5a996bd14 100644 --- a/components/esp_matter/data_model/esp_matter_attribute_bounds.cpp +++ b/components/esp_matter/data_model/esp_matter_attribute_bounds.cpp @@ -38,16 +38,16 @@ void add_bounds_cb(cluster_t *cluster) VerifyOrReturn(cluster != nullptr, ESP_LOGE(TAG, "Cluster is NULL. Add bounds Failed!!")); attribute_t *current_attribute = esp_matter::attribute::get_first(cluster); VerifyOrReturn(current_attribute != nullptr, ESP_LOGE(TAG, "Attribute is NULL.")); - while(current_attribute) { - switch(esp_matter::attribute::get_id(current_attribute)) { + while (current_attribute) { + switch (esp_matter::attribute::get_id(current_attribute)) { - case ScenesManagement::Attributes::SceneTableSize::Id: { - uint16_t min = 16, max = UINT16_MAX; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint16(min), esp_matter_uint16(max)); - break; - } - default: - break; + case ScenesManagement::Attributes::SceneTableSize::Id: { + uint16_t min = 16, max = UINT16_MAX; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint16(min), esp_matter_uint16(max)); + break; + } + default: + break; } current_attribute = esp_matter::attribute::get_next(current_attribute); } @@ -61,16 +61,16 @@ void add_bounds_cb(cluster_t *cluster) VerifyOrReturn(cluster != nullptr, ESP_LOGE(TAG, "Cluster is NULL. Add bounds Failed!!")); attribute_t *current_attribute = esp_matter::attribute::get_first(cluster); VerifyOrReturn(current_attribute != nullptr, ESP_LOGE(TAG, "Attribute is NULL.")); - while(current_attribute) { - switch(esp_matter::attribute::get_id(current_attribute)) { + while (current_attribute) { + switch (esp_matter::attribute::get_id(current_attribute)) { - case OnOff::Attributes::StartUpOnOff::Id: { - uint8_t min = 0, max = 2; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_enum8(min), esp_matter_nullable_enum8(max)); - break; - } - default: - break; + case OnOff::Attributes::StartUpOnOff::Id: { + uint8_t min = 0, max = 2; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_enum8(min), esp_matter_nullable_enum8(max)); + break; + } + default: + break; } current_attribute = esp_matter::attribute::get_next(current_attribute); } @@ -85,105 +85,96 @@ void add_bounds_cb(cluster_t *cluster) VerifyOrReturn(cluster != nullptr, ESP_LOGE(TAG, "Cluster is NULL. Add bounds Failed!!")); attribute_t *current_attribute = esp_matter::attribute::get_first(cluster); VerifyOrReturn(current_attribute != nullptr, ESP_LOGE(TAG, "Attribute is NULL.")); - while(current_attribute) { - switch(esp_matter::attribute::get_id(current_attribute)) { + while (current_attribute) { + switch (esp_matter::attribute::get_id(current_attribute)) { - case LevelControl::Attributes::CurrentLevel::Id: { - esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); - esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); - uint16_t min = 0, max = UINT16_MAX; - if(cluster::get_attribute_value(cluster, LevelControl::Attributes::MinLevel::Id, - &min_val) == ESP_OK) - { - min = min_val.val.u16; - } - if(cluster::get_attribute_value(cluster, LevelControl::Attributes::MaxLevel::Id, - &max_val) == ESP_OK) - { - max = max_val.val.u16; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); - break; + case LevelControl::Attributes::CurrentLevel::Id: { + esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); + esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); + uint16_t min = 0, max = UINT16_MAX; + if (cluster::get_attribute_value(cluster, LevelControl::Attributes::MinLevel::Id, + &min_val) == ESP_OK) { + min = min_val.val.u16; } - case LevelControl::Attributes::MinLevel::Id: { - uint8_t min = 1, max = 254; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint8(min), esp_matter_uint8(max)); - break; + if (cluster::get_attribute_value(cluster, LevelControl::Attributes::MaxLevel::Id, + &max_val) == ESP_OK) { + max = max_val.val.u16; } - case LevelControl::Attributes::MaxLevel::Id: { - esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); - uint8_t min = 1, max = UINT8_MAX; - if(cluster::get_attribute_value(cluster, LevelControl::Attributes::MinLevel::Id, - &min_val) == ESP_OK) - { - min = min_val.val.u8; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint8(min), esp_matter_uint8(max)); - break; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); + break; + } + case LevelControl::Attributes::MinLevel::Id: { + uint8_t min = 1, max = 254; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint8(min), esp_matter_uint8(max)); + break; + } + case LevelControl::Attributes::MaxLevel::Id: { + esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); + uint8_t min = 1, max = UINT8_MAX; + if (cluster::get_attribute_value(cluster, LevelControl::Attributes::MinLevel::Id, + &min_val) == ESP_OK) { + min = min_val.val.u8; } - case LevelControl::Attributes::CurrentFrequency::Id: { - esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); - esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); - uint16_t min = 0, max = UINT16_MAX; - if(cluster::get_attribute_value(cluster, LevelControl::Attributes::MinFrequency::Id, - &min_val) == ESP_OK) - { - min = min_val.val.u16; - } - if(cluster::get_attribute_value(cluster, LevelControl::Attributes::MaxFrequency::Id, - &max_val) == ESP_OK) - { - max = max_val.val.u16; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint16(min), esp_matter_uint16(max)); - break; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint8(min), esp_matter_uint8(max)); + break; + } + case LevelControl::Attributes::CurrentFrequency::Id: { + esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); + esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); + uint16_t min = 0, max = UINT16_MAX; + if (cluster::get_attribute_value(cluster, LevelControl::Attributes::MinFrequency::Id, + &min_val) == ESP_OK) { + min = min_val.val.u16; } - case LevelControl::Attributes::MinFrequency::Id: { - esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); - uint16_t min = 0, max = UINT16_MAX; - if(cluster::get_attribute_value(cluster, LevelControl::Attributes::MaxFrequency::Id, - &max_val) == ESP_OK) - { - max = max_val.val.u16; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint16(min), esp_matter_uint16(max)); - break; + if (cluster::get_attribute_value(cluster, LevelControl::Attributes::MaxFrequency::Id, + &max_val) == ESP_OK) { + max = max_val.val.u16; } - case LevelControl::Attributes::MaxFrequency::Id: { - esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); - uint16_t min = 0, max = UINT16_MAX; - if(cluster::get_attribute_value(cluster, LevelControl::Attributes::MinFrequency::Id, - &min_val) == ESP_OK) - { - min = min_val.val.u16; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint16(min), esp_matter_uint16(max)); - break; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint16(min), esp_matter_uint16(max)); + break; + } + case LevelControl::Attributes::MinFrequency::Id: { + esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); + uint16_t min = 0, max = UINT16_MAX; + if (cluster::get_attribute_value(cluster, LevelControl::Attributes::MaxFrequency::Id, + &max_val) == ESP_OK) { + max = max_val.val.u16; } - case LevelControl::Attributes::OnLevel::Id: { - esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); - esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); - uint8_t min = 0, max = UINT8_MAX; - if(cluster::get_attribute_value(cluster, LevelControl::Attributes::MinLevel::Id, - &min_val) == ESP_OK) - { - min = min_val.val.u8; - } - if(cluster::get_attribute_value(cluster, LevelControl::Attributes::MaxLevel::Id, - &max_val) == ESP_OK) - { - max = max_val.val.u8; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); - break; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint16(min), esp_matter_uint16(max)); + break; + } + case LevelControl::Attributes::MaxFrequency::Id: { + esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); + uint16_t min = 0, max = UINT16_MAX; + if (cluster::get_attribute_value(cluster, LevelControl::Attributes::MinFrequency::Id, + &min_val) == ESP_OK) { + min = min_val.val.u16; } - case LevelControl::Attributes::Options::Id: { - uint8_t min = 0, max = 3; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_bitmap8(min), esp_matter_bitmap8(max)); - break; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint16(min), esp_matter_uint16(max)); + break; + } + case LevelControl::Attributes::OnLevel::Id: { + esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); + esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); + uint8_t min = 0, max = UINT8_MAX; + if (cluster::get_attribute_value(cluster, LevelControl::Attributes::MinLevel::Id, + &min_val) == ESP_OK) { + min = min_val.val.u8; } - default: - break; + if (cluster::get_attribute_value(cluster, LevelControl::Attributes::MaxLevel::Id, + &max_val) == ESP_OK) { + max = max_val.val.u8; + } + esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); + break; + } + case LevelControl::Attributes::Options::Id: { + uint8_t min = 0, max = 3; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_bitmap8(min), esp_matter_bitmap8(max)); + break; + } + default: + break; } current_attribute = esp_matter::attribute::get_next(current_attribute); } @@ -198,109 +189,107 @@ void add_bounds_cb(cluster_t *cluster) VerifyOrReturn(cluster != nullptr, ESP_LOGE(TAG, "Cluster is NULL. Add bounds Failed!!")); attribute_t *current_attribute = esp_matter::attribute::get_first(cluster); VerifyOrReturn(current_attribute != nullptr, ESP_LOGE(TAG, "Attribute is NULL.")); - while(current_attribute) { - switch(esp_matter::attribute::get_id(current_attribute)) { + while (current_attribute) { + switch (esp_matter::attribute::get_id(current_attribute)) { - case ColorControl::Attributes::CurrentHue::Id: - case ColorControl::Attributes::CurrentSaturation::Id: { - uint8_t min = 0, max = 254; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint8(min), esp_matter_uint8(max)); - break; + case ColorControl::Attributes::CurrentHue::Id: + case ColorControl::Attributes::CurrentSaturation::Id: { + uint8_t min = 0, max = 254; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint8(min), esp_matter_uint8(max)); + break; + } + case ColorControl::Attributes::RemainingTime::Id: { + uint16_t min = 0, max = 65534; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint16(min), esp_matter_uint16(max)); + break; + } + case ColorControl::Attributes::CurrentX::Id: + case ColorControl::Attributes::CurrentY::Id: + case ColorControl::Attributes::ColorTemperatureMireds::Id: + case ColorControl::Attributes::Primary1X::Id: + case ColorControl::Attributes::Primary1Y::Id: + case ColorControl::Attributes::Primary2X::Id: + case ColorControl::Attributes::Primary2Y::Id: + case ColorControl::Attributes::Primary3X::Id: + case ColorControl::Attributes::Primary3Y::Id: + case ColorControl::Attributes::Primary4X::Id: + case ColorControl::Attributes::Primary4Y::Id: + case ColorControl::Attributes::Primary5X::Id: + case ColorControl::Attributes::Primary5Y::Id: + case ColorControl::Attributes::Primary6X::Id: + case ColorControl::Attributes::Primary6Y::Id: + case ColorControl::Attributes::WhitePointX::Id: + case ColorControl::Attributes::WhitePointY::Id: + case ColorControl::Attributes::ColorPointRX::Id: + case ColorControl::Attributes::ColorPointRY::Id: + case ColorControl::Attributes::ColorPointGX::Id: + case ColorControl::Attributes::ColorPointGY::Id: + case ColorControl::Attributes::ColorPointBX::Id: + case ColorControl::Attributes::ColorPointBY::Id: + case ColorControl::Attributes::ColorTempPhysicalMinMireds::Id: + case ColorControl::Attributes::ColorTempPhysicalMaxMireds::Id: { + uint16_t min = 0, max = 65279; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint16(min), esp_matter_uint16(max)); + break; + } + case ColorControl::Attributes::DriftCompensation::Id: { + uint8_t min = 0, max = 4; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); + break; + } + case ColorControl::Attributes::ColorMode::Id: { + uint8_t min = 0, max = 2; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); + break; + } + case ColorControl::Attributes::Options::Id: { + uint8_t min = 0, max = 1; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_bitmap8(min), esp_matter_bitmap8(max)); + break; + } + case ColorControl::Attributes::NumberOfPrimaries::Id: { + uint8_t min = 0, max = 6; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); + break; + } + case ColorControl::Attributes::EnhancedColorMode::Id: { + uint8_t min = 0, max = 3; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); + break; + } + case ColorControl::Attributes::ColorLoopActive::Id: + case ColorControl::Attributes::ColorLoopDirection::Id: { + uint8_t min = 0, max = 1; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint8(min), esp_matter_uint8(max)); + break; + } + case ColorControl::Attributes::ColorCapabilities::Id: { + uint8_t min = 0, max = 31; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_bitmap16(min), esp_matter_bitmap16(max)); + break; + } + case ColorControl::Attributes::StartUpColorTemperatureMireds::Id: { + uint16_t min = 0, max = 65279; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint16(min), esp_matter_nullable_uint16(max)); + break; + } + case ColorControl::Attributes::CoupleColorTempToLevelMinMireds::Id: { + esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); + esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); + uint16_t min = 0, max = UINT16_MAX; + if (cluster::get_attribute_value(cluster, ColorControl::Attributes::ColorTempPhysicalMinMireds::Id, + &min_val) == ESP_OK) { + min = min_val.val.u16; } - case ColorControl::Attributes::RemainingTime::Id: { - uint16_t min = 0, max = 65534; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint16(min), esp_matter_uint16(max)); - break; + if (cluster::get_attribute_value(cluster, ColorControl::Attributes::ColorTemperatureMireds::Id, + &max_val) == ESP_OK) { + max = max_val.val.u16; } - case ColorControl::Attributes::CurrentX::Id: - case ColorControl::Attributes::CurrentY::Id: - case ColorControl::Attributes::ColorTemperatureMireds::Id: - case ColorControl::Attributes::Primary1X::Id: - case ColorControl::Attributes::Primary1Y::Id: - case ColorControl::Attributes::Primary2X::Id: - case ColorControl::Attributes::Primary2Y::Id: - case ColorControl::Attributes::Primary3X::Id: - case ColorControl::Attributes::Primary3Y::Id: - case ColorControl::Attributes::Primary4X::Id: - case ColorControl::Attributes::Primary4Y::Id: - case ColorControl::Attributes::Primary5X::Id: - case ColorControl::Attributes::Primary5Y::Id: - case ColorControl::Attributes::Primary6X::Id: - case ColorControl::Attributes::Primary6Y::Id: - case ColorControl::Attributes::WhitePointX::Id: - case ColorControl::Attributes::WhitePointY::Id: - case ColorControl::Attributes::ColorPointRX::Id: - case ColorControl::Attributes::ColorPointRY::Id: - case ColorControl::Attributes::ColorPointGX::Id: - case ColorControl::Attributes::ColorPointGY::Id: - case ColorControl::Attributes::ColorPointBX::Id: - case ColorControl::Attributes::ColorPointBY::Id: - case ColorControl::Attributes::ColorTempPhysicalMinMireds::Id: - case ColorControl::Attributes::ColorTempPhysicalMaxMireds::Id: { - uint16_t min = 0, max = 65279; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint16(min), esp_matter_uint16(max)); - break; - } - case ColorControl::Attributes::DriftCompensation::Id: { - uint8_t min = 0, max = 4; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); - break; - } - case ColorControl::Attributes::ColorMode::Id: { - uint8_t min = 0, max = 2; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); - break; - } - case ColorControl::Attributes::Options::Id: { - uint8_t min = 0, max = 1; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_bitmap8(min), esp_matter_bitmap8(max)); - break; - } - case ColorControl::Attributes::NumberOfPrimaries::Id: { - uint8_t min = 0, max = 6; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); - break; - } - case ColorControl::Attributes::EnhancedColorMode::Id: { - uint8_t min = 0, max = 3; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); - break; - } - case ColorControl::Attributes::ColorLoopActive::Id: - case ColorControl::Attributes::ColorLoopDirection::Id: { - uint8_t min = 0, max = 1; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint8(min), esp_matter_uint8(max)); - break; - } - case ColorControl::Attributes::ColorCapabilities::Id: { - uint8_t min = 0, max = 31; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_bitmap16(min), esp_matter_bitmap16(max)); - break; - } - case ColorControl::Attributes::StartUpColorTemperatureMireds::Id: { - uint16_t min = 0, max = 65279; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint16(min), esp_matter_nullable_uint16(max)); - break; - } - case ColorControl::Attributes::CoupleColorTempToLevelMinMireds::Id: { - esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); - esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); - uint16_t min = 0, max = UINT16_MAX; - if(cluster::get_attribute_value(cluster, ColorControl::Attributes::ColorTempPhysicalMinMireds::Id, - &min_val) == ESP_OK) - { - min = min_val.val.u16; - } - if(cluster::get_attribute_value(cluster, ColorControl::Attributes::ColorTemperatureMireds::Id, - &max_val) == ESP_OK) - { - max = max_val.val.u16; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint16(min), esp_matter_uint16(max)); - break; - } - default: - break; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint16(min), esp_matter_uint16(max)); + break; + } + default: + break; } current_attribute = esp_matter::attribute::get_next(current_attribute); } @@ -315,63 +304,61 @@ void add_bounds_cb(cluster_t *cluster) VerifyOrReturn(cluster != nullptr, ESP_LOGE(TAG, "Cluster is NULL. Add bounds Failed!!")); attribute_t *current_attribute = esp_matter::attribute::get_first(cluster); VerifyOrReturn(current_attribute != nullptr, ESP_LOGE(TAG, "Attribute is NULL.")); - while(current_attribute) { - switch(esp_matter::attribute::get_id(current_attribute)) { + while (current_attribute) { + switch (esp_matter::attribute::get_id(current_attribute)) { - case FanControl::Attributes::FanMode::Id: { - uint8_t min = 0, max = 6; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); - break; + case FanControl::Attributes::FanMode::Id: { + uint8_t min = 0, max = 6; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); + break; + } + case FanControl::Attributes::FanModeSequence::Id: { + uint8_t min = 0, max = 5; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); + break; + } + case FanControl::Attributes::PercentSetting::Id: { + nullable min = 0, max = 100; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); + break; + } + case FanControl::Attributes::PercentCurrent::Id: { + uint8_t min = 0, max = 100; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint8(min), esp_matter_uint8(max)); + break; + } + case FanControl::Attributes::SpeedMax::Id: { + uint8_t min = 1, max = 100; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint8(min), esp_matter_uint8(max)); + break; + } + case FanControl::Attributes::SpeedSetting::Id: { + esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); + nullable min = 0, max = 100; + if (cluster::get_attribute_value(cluster, FanControl::Attributes::SpeedMax::Id, + &max_val) == ESP_OK) { + max = max_val.val.u8; } - case FanControl::Attributes::FanModeSequence::Id: { - uint8_t min = 0, max = 5; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); - break; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); + break; + } + case FanControl::Attributes::SpeedCurrent::Id: { + esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); + uint8_t min = 0, max = 100; + if (cluster::get_attribute_value(cluster, FanControl::Attributes::SpeedMax::Id, + &max_val) == ESP_OK) { + max = max_val.val.u8; } - case FanControl::Attributes::PercentSetting::Id: { - nullable min = 0, max = 100; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); - break; - } - case FanControl::Attributes::PercentCurrent::Id: { - uint8_t min = 0, max = 100; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint8(min), esp_matter_uint8(max)); - break; - } - case FanControl::Attributes::SpeedMax::Id: { - uint8_t min = 1, max = 100; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint8(min), esp_matter_uint8(max)); - break; - } - case FanControl::Attributes::SpeedSetting::Id: { - esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); - nullable min = 0, max = 100; - if(cluster::get_attribute_value(cluster, FanControl::Attributes::SpeedMax::Id, - &max_val) == ESP_OK) - { - max = max_val.val.u8; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); - break; - } - case FanControl::Attributes::SpeedCurrent::Id: { - esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); - uint8_t min = 0, max = 100; - if(cluster::get_attribute_value(cluster, FanControl::Attributes::SpeedMax::Id, - &max_val) == ESP_OK) - { - max = max_val.val.u8; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint8(min), esp_matter_uint8(max)); - break; - } - case FanControl::Attributes::AirflowDirection::Id: { - uint8_t min = 0, max = 1; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); - break; - } - default: - break; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint8(min), esp_matter_uint8(max)); + break; + } + case FanControl::Attributes::AirflowDirection::Id: { + uint8_t min = 0, max = 1; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); + break; + } + default: + break; } current_attribute = esp_matter::attribute::get_next(current_attribute); } @@ -386,252 +373,232 @@ void add_bounds_cb(cluster_t *cluster) VerifyOrReturn(cluster != nullptr, ESP_LOGE(TAG, "Cluster is NULL. Add bounds Failed!!")); attribute_t *current_attribute = esp_matter::attribute::get_first(cluster); VerifyOrReturn(current_attribute != nullptr, ESP_LOGE(TAG, "Attribute is NULL.")); - while(current_attribute) { - switch(esp_matter::attribute::get_id(current_attribute)) { + while (current_attribute) { + switch (esp_matter::attribute::get_id(current_attribute)) { - case Thermostat::Attributes::PICoolingDemand::Id: - case Thermostat::Attributes::PIHeatingDemand::Id: { - uint8_t min = 0, max = 100; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint8(min), esp_matter_uint8(max)); - break; + case Thermostat::Attributes::PICoolingDemand::Id: + case Thermostat::Attributes::PIHeatingDemand::Id: { + uint8_t min = 0, max = 100; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint8(min), esp_matter_uint8(max)); + break; + } + case Thermostat::Attributes::OccupiedCoolingSetpoint::Id: + case Thermostat::Attributes::UnoccupiedCoolingSetpoint::Id: { + esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); + esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); + int16_t min = 1600, max = 3200; + if (cluster::get_attribute_value(cluster, Thermostat::Attributes::MinCoolSetpointLimit::Id, + &min_val) == ESP_OK) { + min = min_val.val.i16; } - case Thermostat::Attributes::OccupiedCoolingSetpoint::Id: - case Thermostat::Attributes::UnoccupiedCoolingSetpoint::Id: { - esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); - esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); - int16_t min = 1600, max = 3200; - if(cluster::get_attribute_value(cluster, Thermostat::Attributes::MinCoolSetpointLimit::Id, - &min_val) == ESP_OK) - { - min = min_val.val.i16; - } - if(cluster::get_attribute_value(cluster, Thermostat::Attributes::MaxCoolSetpointLimit::Id, - &max_val) == ESP_OK) - { - max = max_val.val.i16; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); - break; + if (cluster::get_attribute_value(cluster, Thermostat::Attributes::MaxCoolSetpointLimit::Id, + &max_val) == ESP_OK) { + max = max_val.val.i16; } - case Thermostat::Attributes::OccupiedHeatingSetpoint::Id: - case Thermostat::Attributes::UnoccupiedHeatingSetpoint::Id: { - esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); - esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); - int16_t min = 700, max = 3000; - if(cluster::get_attribute_value(cluster, Thermostat::Attributes::MinHeatSetpointLimit::Id, - &min_val) == ESP_OK) - { - min = min_val.val.i16; - } - if(cluster::get_attribute_value(cluster, Thermostat::Attributes::MaxHeatSetpointLimit::Id, - &max_val) == ESP_OK) - { - max = max_val.val.i16; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); - break; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); + break; + } + case Thermostat::Attributes::OccupiedHeatingSetpoint::Id: + case Thermostat::Attributes::UnoccupiedHeatingSetpoint::Id: { + esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); + esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); + int16_t min = 700, max = 3000; + if (cluster::get_attribute_value(cluster, Thermostat::Attributes::MinHeatSetpointLimit::Id, + &min_val) == ESP_OK) { + min = min_val.val.i16; } - case Thermostat::Attributes::MinHeatSetpointLimit::Id: { - esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); - esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); - int16_t min = 700, max = 3000; - if(cluster::get_attribute_value(cluster, Thermostat::Attributes::AbsMinHeatSetpointLimit::Id, - &min_val) == ESP_OK) - { - min = min_val.val.i16; - } - if(cluster::get_attribute_value(cluster, Thermostat::Attributes::MaxHeatSetpointLimit::Id, - &max_val) == ESP_OK) - { - max = max_val.val.i16; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); - break; + if (cluster::get_attribute_value(cluster, Thermostat::Attributes::MaxHeatSetpointLimit::Id, + &max_val) == ESP_OK) { + max = max_val.val.i16; } - case Thermostat::Attributes::MaxHeatSetpointLimit::Id: { - esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); - esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); - int16_t min = 1600, max = 3200; - if(cluster::get_attribute_value(cluster, Thermostat::Attributes::MinHeatSetpointLimit::Id, - &min_val) == ESP_OK) - { - min = min_val.val.i16; - } - if(cluster::get_attribute_value(cluster, Thermostat::Attributes::AbsMaxHeatSetpointLimit::Id, - &max_val) == ESP_OK) - { - max = max_val.val.i16; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); - break; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); + break; + } + case Thermostat::Attributes::MinHeatSetpointLimit::Id: { + esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); + esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); + int16_t min = 700, max = 3000; + if (cluster::get_attribute_value(cluster, Thermostat::Attributes::AbsMinHeatSetpointLimit::Id, + &min_val) == ESP_OK) { + min = min_val.val.i16; } - case Thermostat::Attributes::MinCoolSetpointLimit::Id: { - esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); - esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); - int16_t min = 700, max = 3000; - if(cluster::get_attribute_value(cluster, Thermostat::Attributes::AbsMinCoolSetpointLimit::Id, - &min_val) == ESP_OK) - { - min = min_val.val.i16; - } - if(cluster::get_attribute_value(cluster, Thermostat::Attributes::MaxCoolSetpointLimit::Id, - &max_val) == ESP_OK) - { - max = max_val.val.i16; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); - break; + if (cluster::get_attribute_value(cluster, Thermostat::Attributes::MaxHeatSetpointLimit::Id, + &max_val) == ESP_OK) { + max = max_val.val.i16; } - case Thermostat::Attributes::MaxCoolSetpointLimit::Id: { - esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); - esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); - int16_t min = 700, max = 3000; - if(cluster::get_attribute_value(cluster, Thermostat::Attributes::MinCoolSetpointLimit::Id, - &min_val) == ESP_OK) - { - min = min_val.val.i16; - } - if(cluster::get_attribute_value(cluster, Thermostat::Attributes::AbsMaxCoolSetpointLimit::Id, - &max_val) == ESP_OK) - { - max = max_val.val.i16; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); - break; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); + break; + } + case Thermostat::Attributes::MaxHeatSetpointLimit::Id: { + esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); + esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); + int16_t min = 1600, max = 3200; + if (cluster::get_attribute_value(cluster, Thermostat::Attributes::MinHeatSetpointLimit::Id, + &min_val) == ESP_OK) { + min = min_val.val.i16; } - case Thermostat::Attributes::MinSetpointDeadBand::Id: { - int16_t min = 0, max = 1270; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); - break; + if (cluster::get_attribute_value(cluster, Thermostat::Attributes::AbsMaxHeatSetpointLimit::Id, + &max_val) == ESP_OK) { + max = max_val.val.i16; } - case Thermostat::Attributes::ControlSequenceOfOperation::Id: { - uint8_t min = 0, max = 5; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); - break; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); + break; + } + case Thermostat::Attributes::MinCoolSetpointLimit::Id: { + esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); + esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); + int16_t min = 700, max = 3000; + if (cluster::get_attribute_value(cluster, Thermostat::Attributes::AbsMinCoolSetpointLimit::Id, + &min_val) == ESP_OK) { + min = min_val.val.i16; } - case Thermostat::Attributes::SystemMode::Id: { - uint8_t min = 0, max = 9; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); - break; + if (cluster::get_attribute_value(cluster, Thermostat::Attributes::MaxCoolSetpointLimit::Id, + &max_val) == ESP_OK) { + max = max_val.val.i16; } - case Thermostat::Attributes::ThermostatRunningMode::Id: - case Thermostat::Attributes::ACType::Id: { - // TODO: The valid values for ThermostatRunningMode are: 0, 3, 4. But there is no way to set the bounds for it. - uint8_t min = 0, max = 4; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); - break; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); + break; + } + case Thermostat::Attributes::MaxCoolSetpointLimit::Id: { + esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); + esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); + int16_t min = 700, max = 3000; + if (cluster::get_attribute_value(cluster, Thermostat::Attributes::MinCoolSetpointLimit::Id, + &min_val) == ESP_OK) { + min = min_val.val.i16; } - case Thermostat::Attributes::StartOfWeek::Id: { - uint8_t min = 0, max = 6; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); - break; + if (cluster::get_attribute_value(cluster, Thermostat::Attributes::AbsMaxCoolSetpointLimit::Id, + &max_val) == ESP_OK) { + max = max_val.val.i16; } - case Thermostat::Attributes::TemperatureSetpointHold::Id: { - uint8_t min = 0, max = 1; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); - break; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); + break; + } + case Thermostat::Attributes::MinSetpointDeadBand::Id: { + int16_t min = 0, max = 1270; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); + break; + } + case Thermostat::Attributes::ControlSequenceOfOperation::Id: { + uint8_t min = 0, max = 5; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); + break; + } + case Thermostat::Attributes::SystemMode::Id: { + uint8_t min = 0, max = 9; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); + break; + } + case Thermostat::Attributes::ThermostatRunningMode::Id: + case Thermostat::Attributes::ACType::Id: { + // TODO: The valid values for ThermostatRunningMode are: 0, 3, 4. But there is no way to set the bounds for it. + uint8_t min = 0, max = 4; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); + break; + } + case Thermostat::Attributes::StartOfWeek::Id: { + uint8_t min = 0, max = 6; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); + break; + } + case Thermostat::Attributes::TemperatureSetpointHold::Id: { + uint8_t min = 0, max = 1; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); + break; + } + case Thermostat::Attributes::TemperatureSetpointHoldDuration::Id: { + nullable min = 0, max = 1440; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint16(min), esp_matter_nullable_uint16(max)); + break; + } + case Thermostat::Attributes::SetpointChangeSource::Id: { + uint8_t min = 0, max = 2; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); + break; + } + case Thermostat::Attributes::OccupiedSetback::Id: { + esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); + esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); + nullable min = 0, max = 254; + if (cluster::get_attribute_value(cluster, Thermostat::Attributes::OccupiedSetbackMin::Id, + &min_val) == ESP_OK) { + min = min_val.val.u8; } - case Thermostat::Attributes::TemperatureSetpointHoldDuration::Id: { - nullable min = 0, max = 1440; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint16(min), esp_matter_nullable_uint16(max)); - break; + if (cluster::get_attribute_value(cluster, Thermostat::Attributes::OccupiedSetbackMax::Id, + &max_val) == ESP_OK) { + max = max_val.val.u8; } - case Thermostat::Attributes::SetpointChangeSource::Id: { - uint8_t min = 0, max = 2; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); - break; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); + break; + } + case Thermostat::Attributes::OccupiedSetbackMin::Id: { + esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); + nullable min = 0, max = 254; + if (cluster::get_attribute_value(cluster, Thermostat::Attributes::OccupiedSetbackMax::Id, + &max_val) == ESP_OK) { + max = max_val.val.u8; } - case Thermostat::Attributes::OccupiedSetback::Id: { - esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); - esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); - nullable min = 0, max = 254; - if(cluster::get_attribute_value(cluster, Thermostat::Attributes::OccupiedSetbackMin::Id, - &min_val) == ESP_OK) - { - min = min_val.val.u8; - } - if(cluster::get_attribute_value(cluster, Thermostat::Attributes::OccupiedSetbackMax::Id, - &max_val) == ESP_OK) - { - max = max_val.val.u8; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); - break; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); + break; + } + case Thermostat::Attributes::OccupiedSetbackMax::Id: { + esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); + nullable min = 0, max = 254; + if (cluster::get_attribute_value(cluster, Thermostat::Attributes::OccupiedSetbackMin::Id, + &min_val) == ESP_OK) { + min = min_val.val.u8; } - case Thermostat::Attributes::OccupiedSetbackMin::Id: { - esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); - nullable min = 0, max = 254; - if(cluster::get_attribute_value(cluster, Thermostat::Attributes::OccupiedSetbackMax::Id, - &max_val) == ESP_OK) - { - max = max_val.val.u8; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); - break; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); + break; + } + case Thermostat::Attributes::UnoccupiedSetback::Id: { + esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); + esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); + nullable min = 0, max = 254; + if (cluster::get_attribute_value(cluster, Thermostat::Attributes::UnoccupiedSetbackMin::Id, + &min_val) == ESP_OK) { + min = min_val.val.u8; } - case Thermostat::Attributes::OccupiedSetbackMax::Id: { - esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); - nullable min = 0, max = 254; - if(cluster::get_attribute_value(cluster, Thermostat::Attributes::OccupiedSetbackMin::Id, - &min_val) == ESP_OK) - { - min = min_val.val.u8; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); - break; + if (cluster::get_attribute_value(cluster, Thermostat::Attributes::UnoccupiedSetbackMax::Id, + &max_val) == ESP_OK) { + max = max_val.val.u8; } - case Thermostat::Attributes::UnoccupiedSetback::Id: { - esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); - esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); - nullable min = 0, max = 254; - if(cluster::get_attribute_value(cluster, Thermostat::Attributes::UnoccupiedSetbackMin::Id, - &min_val) == ESP_OK) - { - min = min_val.val.u8; - } - if(cluster::get_attribute_value(cluster, Thermostat::Attributes::UnoccupiedSetbackMax::Id, - &max_val) == ESP_OK) - { - max = max_val.val.u8; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); - break; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); + break; + } + case Thermostat::Attributes::UnoccupiedSetbackMin::Id: { + esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); + nullable min = 0, max = 254; + if (cluster::get_attribute_value(cluster, Thermostat::Attributes::UnoccupiedSetbackMax::Id, + &max_val) == ESP_OK) { + max = max_val.val.u8; } - case Thermostat::Attributes::UnoccupiedSetbackMin::Id: { - esp_matter_attr_val_t max_val = esp_matter_invalid(NULL); - nullable min = 0, max = 254; - if(cluster::get_attribute_value(cluster, Thermostat::Attributes::UnoccupiedSetbackMax::Id, - &max_val) == ESP_OK) - { - max = max_val.val.u8; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); - break; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); + break; + } + case Thermostat::Attributes::UnoccupiedSetbackMax::Id: { + esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); + nullable min = 0, max = 254; + if (cluster::get_attribute_value(cluster, Thermostat::Attributes::UnoccupiedSetbackMin::Id, + &min_val) == ESP_OK) { + min = min_val.val.u8; } - case Thermostat::Attributes::UnoccupiedSetbackMax::Id: { - esp_matter_attr_val_t min_val = esp_matter_invalid(NULL); - nullable min = 0, max = 254; - if(cluster::get_attribute_value(cluster, Thermostat::Attributes::UnoccupiedSetbackMin::Id, - &min_val) == ESP_OK) - { - min = min_val.val.u8; - } - esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); - break; - } - case Thermostat::Attributes::ACRefrigerantType::Id: - case Thermostat::Attributes::ACCompressorType::Id: { - uint8_t min = 0, max = 3; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); - break; - } - case Thermostat::Attributes::ACLouverPosition::Id: { - uint8_t min = 1, max = 5; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); - break; - } - default: - break; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_nullable_uint8(min), esp_matter_nullable_uint8(max)); + break; + } + case Thermostat::Attributes::ACRefrigerantType::Id: + case Thermostat::Attributes::ACCompressorType::Id: { + uint8_t min = 0, max = 3; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); + break; + } + case Thermostat::Attributes::ACLouverPosition::Id: { + uint8_t min = 1, max = 5; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); + break; + } + default: + break; } current_attribute = esp_matter::attribute::get_next(current_attribute); } @@ -646,26 +613,26 @@ void add_bounds_cb(cluster_t *cluster) VerifyOrReturn(cluster != nullptr, ESP_LOGE(TAG, "Cluster is NULL. Add bounds Failed!!")); attribute_t *current_attribute = esp_matter::attribute::get_first(cluster); VerifyOrReturn(current_attribute != nullptr, ESP_LOGE(TAG, "Attribute is NULL.")); - while(current_attribute) { - switch(esp_matter::attribute::get_id(current_attribute)) { + while (current_attribute) { + switch (esp_matter::attribute::get_id(current_attribute)) { - case ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id: { - uint8_t min = 0, max = 1; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); - break; - } - case ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id: { - uint8_t min = 0, max = 5; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); - break; - } - case ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id: { - uint8_t min = 0, max = 1; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); - break; - } - default: - break; + case ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id: { + uint8_t min = 0, max = 1; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); + break; + } + case ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id: { + uint8_t min = 0, max = 5; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); + break; + } + case ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id: { + uint8_t min = 0, max = 1; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_enum8(min), esp_matter_enum8(max)); + break; + } + default: + break; } current_attribute = esp_matter::attribute::get_next(current_attribute); } @@ -680,35 +647,35 @@ void add_bounds_cb(cluster_t *cluster) VerifyOrReturn(cluster != nullptr, ESP_LOGE(TAG, "Cluster is NULL. Add bounds Failed!!")); attribute_t *current_attribute = esp_matter::attribute::get_first(cluster); VerifyOrReturn(current_attribute != nullptr, ESP_LOGE(TAG, "Attribute is NULL.")); - while(current_attribute) { - switch(esp_matter::attribute::get_id(current_attribute)) { - case CameraAvSettingsUserLevelManagement::Attributes::ZoomMax::Id: { - uint8_t min = 2, max = 100; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint8(min), esp_matter_uint8(max)); - break; - } - case CameraAvSettingsUserLevelManagement::Attributes::TiltMin::Id: { - int16_t min = -180, max = 179; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); - break; - } - case CameraAvSettingsUserLevelManagement::Attributes::TiltMax::Id: { - int16_t min = -179, max = 180; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); - break; - } - case CameraAvSettingsUserLevelManagement::Attributes::PanMin::Id: { - int16_t min = -180, max = 179; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); - break; - } - case CameraAvSettingsUserLevelManagement::Attributes::PanMax::Id: { - int16_t min = -179, max = 180; - esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); - break; - } - default: - break; + while (current_attribute) { + switch (esp_matter::attribute::get_id(current_attribute)) { + case CameraAvSettingsUserLevelManagement::Attributes::ZoomMax::Id: { + uint8_t min = 2, max = 100; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_uint8(min), esp_matter_uint8(max)); + break; + } + case CameraAvSettingsUserLevelManagement::Attributes::TiltMin::Id: { + int16_t min = -180, max = 179; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); + break; + } + case CameraAvSettingsUserLevelManagement::Attributes::TiltMax::Id: { + int16_t min = -179, max = 180; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); + break; + } + case CameraAvSettingsUserLevelManagement::Attributes::PanMin::Id: { + int16_t min = -180, max = 179; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); + break; + } + case CameraAvSettingsUserLevelManagement::Attributes::PanMax::Id: { + int16_t min = -179, max = 180; + esp_matter::attribute::add_bounds(current_attribute, esp_matter_int16(min), esp_matter_int16(max)); + break; + } + default: + break; } current_attribute = esp_matter::attribute::get_next(current_attribute); } diff --git a/components/esp_matter/data_model/esp_matter_attribute_utils.cpp b/components/esp_matter/data_model/esp_matter_attribute_utils.cpp index e7531cfa8..439ba8439 100644 --- a/components/esp_matter/data_model/esp_matter_attribute_utils.cpp +++ b/components/esp_matter/data_model/esp_matter_attribute_utils.cpp @@ -78,13 +78,12 @@ esp_matter_attr_val_t esp_matter_int(int val) esp_matter_attr_val_t esp_matter_nullable_bool(nullable 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()) { - chip::app::NumericAttributeTraits::SetNull(*(uint8_t *)(&(attr_val.val.b))); - } - else { - attr_val.val.b = val.value(); + chip::app::NumericAttributeTraits::SetNull(*(uint8_t *)(&(attr_val.val.b))); + } else { + attr_val.val.b = val.value(); } 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 attribute { - bool val_is_null(esp_matter_attr_val_t *val) { switch (val->type) { case ESP_MATTER_VAL_TYPE_NULLABLE_BOOLEAN: - return chip::app::NumericAttributeTraits::IsNullValue(*(uint8_t *)(&(val->val.b))); - break; + return chip::app::NumericAttributeTraits::IsNullValue(*(uint8_t *)(&(val->val.b))); + break; case ESP_MATTER_VAL_TYPE_NULLABLE_INTEGER: return chip::app::NumericAttributeTraits::IsNullValue(val->val.i); 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) { - 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, - endpoint_id, cluster_id, attribute_id)); + endpoint_id, cluster_id, attribute_id)); 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, @@ -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, 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 - || 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_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) { 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); } 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, 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 - || 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_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) { 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); - } 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, 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 @@ -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_LONG_CHAR_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; if (val1->val.a.s != val2->val.a.s) { return false; diff --git a/components/esp_matter/data_model/esp_matter_attribute_utils.h b/components/esp_matter/data_model/esp_matter_attribute_utils.h index 684f51ba6..960ab6cda 100644 --- a/components/esp_matter/data_model/esp_matter_attribute_utils.h +++ b/components/esp_matter/data_model/esp_matter_attribute_utils.h @@ -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_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_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_t; @@ -148,7 +148,7 @@ typedef struct esp_matter_attr_bounds { template 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: template ::value, int> = 0> static constexpr T GetNullValue() @@ -223,8 +223,7 @@ private: /** Template specialization for bool */ template <> -class nullable -{ +class nullable { using Traits = chip::app::NumericAttributeTraits; using StorageType = typename Traits::StorageType; // Resolves to uint8_t @@ -233,12 +232,21 @@ class nullable public: /** Constructors */ - nullable() { Traits::SetNull(storage); } - nullable(std::nullptr_t) { Traits::SetNull(storage); } + nullable() + { + Traits::SetNull(storage); + } + nullable(std::nullptr_t) + { + Traits::SetNull(storage); + } constexpr nullable(bool v) : storage(static_cast(v)) {} /** 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. @@ -255,13 +263,25 @@ public: * ``` * @return `true` if storage is non-zero (includes null state), `false` if storage is zero. */ - constexpr bool value() const { return static_cast(storage); } + constexpr bool value() const + { + return static_cast(storage); + } - constexpr bool value_or(bool d) const { return is_null() ? d : static_cast(storage); } + constexpr bool value_or(bool d) const + { + return is_null() ? d : static_cast(storage); + } /** Modifiers */ - void operator=(std::nullptr_t) { Traits::SetNull(storage); } - void operator=(bool v) { storage = static_cast(v); } + void operator=(std::nullptr_t) + { + Traits::SetNull(storage); + } + void operator=(bool v) + { + storage = static_cast(v); + } private: StorageType storage; // 1‑byte payload holding 0 / 1 / 0xFF diff --git a/components/esp_matter/data_model/esp_matter_cluster.cpp b/components/esp_matter/data_model/esp_matter_cluster.cpp index e1b744f13..cfaa0dda5 100644 --- a/components/esp_matter/data_model/esp_matter_cluster.cpp +++ b/components/esp_matter/data_model/esp_matter_cluster.cpp @@ -54,8 +54,7 @@ namespace { // this space is for feature validation functions -enum class feature_policy -{ +enum class feature_policy { k_exact_one = 0, // O.a k_at_least_one = 1, // 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()); 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_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); cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterWiFiNetworkDiagnosticsClusterServerInitCallback, - ESPMatterWiFiNetworkDiagnosticsClusterServerShutdownCallback); + ESPMatterWiFiNetworkDiagnosticsClusterServerShutdownCallback); } return cluster; @@ -768,7 +767,6 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) /* Attributes managed internally */ global::attribute::create_feature_map(cluster, 0); - /* Attributes not managed internally */ global::attribute::create_cluster_revision(cluster, cluster_revision); 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 */ command::create_set_utc_time(cluster); cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterTimeSynchronizationClusterServerInitCallback, - ESPMatterTimeSynchronizationClusterServerShutdownCallback); + ESPMatterTimeSynchronizationClusterServerShutdownCallback); } 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 */ global::attribute::create_cluster_revision(cluster, cluster_revision); cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterUnitLocalizationClusterServerInitCallback, - ESPMatterUnitLocalizationClusterServerShutdownCallback); + ESPMatterUnitLocalizationClusterServerShutdownCallback); } 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."); } cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterScenesManagementClusterServerInitCallback, - ESPMatterScenesManagementClusterServerShutdownCallback); + ESPMatterScenesManagementClusterServerShutdownCallback); } /* Commands */ @@ -1358,9 +1356,9 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) } else { // HEAT and COOL must be checked against O.a+ 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)); } 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 { cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = resource_monitoring::create(endpoint, config, flags,HepaFilterMonitoring::Id, cluster_revision); + cluster_t *cluster = resource_monitoring::create(endpoint, config, flags, HepaFilterMonitoring::Id, cluster_revision); if (cluster && (flags & CLUSTER_FLAG_SERVER)) { cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterHepaFilterMonitoringClusterServerInitCallback, ESPMatterHepaFilterMonitoringClusterServerShutdownCallback); @@ -1517,7 +1515,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) namespace activated_carbon_filter_monitoring { cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) { - cluster_t *cluster = resource_monitoring::create(endpoint, config, flags,ActivatedCarbonFilterMonitoring::Id, cluster_revision); + cluster_t *cluster = resource_monitoring::create(endpoint, config, flags, ActivatedCarbonFilterMonitoring::Id, cluster_revision); if (cluster && (flags & CLUSTER_FLAG_SERVER)) { cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterActivatedCarbonFilterMonitoringClusterServerInitCallback, 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 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)); if (has(feature::peak_measurement::get_id())) { 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 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())) { 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 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())) { feature::smoke_alarm::add(cluster); @@ -1962,7 +1960,7 @@ const function_generic_t function_list[] = { (function_generic_t)MatterDoorLockClusterServerPreAttributeChangedCallback, }; 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) { @@ -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 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())) { feature::lift::add(cluster); @@ -2077,7 +2075,6 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) } } /* window_covering */ - namespace switch_cluster { const function_generic_t *function_list = NULL; 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 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())) { 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 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::ultrasonic::get_id(), feature::physical_contact::get_id(), - feature::active_infrared::get_id(), feature::radar::get_id(), - feature::rf_sensing::get_id(), feature::vision::get_id()); + feature::other::get_id(), feature::passive_infrared::get_id(), + feature::ultrasonic::get_id(), feature::physical_contact::get_id(), + feature::active_infrared::get_id(), feature::radar::get_id(), + feature::rf_sensing::get_id(), feature::vision::get_id()); if (has(feature::other::get_id())) { feature::other::add(cluster); @@ -2355,7 +2352,8 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) namespace localization_configuration { const function_generic_t function_list[] = { (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; 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 { const function_generic_t function_list[] = { (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; 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) { attribute::create_measured_value(cluster, config->measured_value, 0x0000, 0xFFFF); attribute::create_min_measured_value(cluster, config->min_measured_value, 0x0001, - 0xFFFD); + 0xFFFD); attribute::create_max_measured_value(cluster, config->max_measured_value, 0x0002, - 0xFFFE); + 0xFFFE); } else { 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 VALIDATE_FEATURES_AT_LEAST_ONE("ConstantPressure,CompensatedPressure,ConstantFlow,ConstantSpeed,ConstantTemperature", - feature::constant_pressure::get_id(), feature::compensated_pressure::get_id(), - feature::constant_flow::get_id(), feature::constant_speed::get_id(), - feature::constant_temperature::get_id()); + feature::constant_pressure::get_id(), feature::compensated_pressure::get_id(), + feature::constant_flow::get_id(), feature::constant_speed::get_id(), + feature::constant_temperature::get_id()); if (has(feature::constant_pressure::get_id())) { 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 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())) { 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 */ 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 */ 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 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())) { 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 */ global::attribute::create_feature_map(cluster, 0); - /* Attributes not managed internally */ 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 VALIDATE_FEATURES_EXACT_ONE("NodeTopology,TreeTopology,SetTopology", - feature::node_topology::get_id(), feature::tree_topology::get_id(), - feature::set_topology::get_id()); + feature::node_topology::get_id(), feature::tree_topology::get_id(), + feature::set_topology::get_id()); if (has(feature::node_topology::get_id())) { 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 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())) { 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 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", - 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())) { 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 */ 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_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 **/ 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 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())) { 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_stream_usage_priorities(cluster, NULL, 0, 0); - // check against at least one feature conformance 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())) { VerifyOrReturnValue(feature::audio::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); 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)); } - 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())) { 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); - command::create_solicit_offer(cluster); command::create_solicit_offer_response(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_end_session(cluster); cluster::set_init_and_shutdown_callbacks(cluster, ESPMatterWebRTCTransportProviderClusterServerInitCallback, - ESPMatterWebRTCTransportProviderClusterServerShutdownCallback); + ESPMatterWebRTCTransportProviderClusterServerShutdownCallback); } 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); - command::create_offer(cluster); command::create_answer(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*/ - // namespace binary_input_basic { // // ToDo // } /* 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 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())) { VerifyOrReturnValue(feature::positioning::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); 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 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())) { VerifyOrReturnValue(feature::positioning::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); 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())) { 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 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())) { 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 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())) { VerifyOrReturnValue(feature::pricing::add(cluster) == ESP_OK, ABORT_CLUSTER_CREATE(cluster)); } diff --git a/components/esp_matter/data_model/esp_matter_cluster.h b/components/esp_matter/data_model/esp_matter_cluster.h index ad00fea32..c23b1216f 100644 --- a/components/esp_matter/data_model/esp_matter_cluster.h +++ b/components/esp_matter/data_model/esp_matter_cluster.h @@ -208,7 +208,7 @@ typedef struct config { feature::replaceable::config_t replaceable; } features; 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; cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); } /* power_source */ @@ -281,7 +281,7 @@ typedef struct config { uint16_t color_capabilities; nullable number_of_primaries; 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; 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; uint32_t feature_flags; 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; 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); }/*webrtc transport requestor*/ - namespace chime { typedef struct config { void *delegate; diff --git a/components/esp_matter/data_model/esp_matter_command.cpp b/components/esp_matter/data_model/esp_matter_command.cpp index e11323449..64f4cf138 100644 --- a/components/esp_matter/data_model/esp_matter_command.cpp +++ b/components/esp_matter/data_model/esp_matter_command.cpp @@ -62,7 +62,7 @@ void dispatch_single_cluster_command(const ConcreteCommandPath &command_path, TL return; } 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, - void *opaque_ptr) + void *opaque_ptr) { chip::app::Clusters::SmokeCoAlarm::Commands::SelfTestRequest::DecodableType 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, - void *opaque_ptr) + void *opaque_ptr) { chip::app::Clusters::DoorLock::Commands::SetAliroReaderConfig::DecodableType 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, - void *opaque_ptr) + void *opaque_ptr) { chip::app::Clusters::DoorLock::Commands::ClearAliroReaderConfig::DecodableType 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, - TLVReader &tlv_data, void *opaque_ptr) + TLVReader &tlv_data, void *opaque_ptr) { chip::app::Clusters::Thermostat::Commands::SetActiveScheduleRequest::DecodableType 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, - TLVReader &tlv_data, void *opaque_ptr) + TLVReader &tlv_data, void *opaque_ptr) { chip::app::Clusters::Thermostat::Commands::AtomicRequest::DecodableType 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, - TLVReader &tlv_data, void *opaque_ptr) + TLVReader &tlv_data, void *opaque_ptr) { chip::app::Clusters::Thermostat::Commands::SetActivePresetRequest::DecodableType 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, - void *opaque_ptr) + void *opaque_ptr) { chip::app::Clusters::WindowCovering::Commands::UpOrOpen::DecodableType 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, - void *opaque_ptr) + void *opaque_ptr) { chip::app::Clusters::WindowCovering::Commands::DownOrClose::DecodableType 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, - void *opaque_ptr) + void *opaque_ptr) { chip::app::Clusters::WindowCovering::Commands::StopMotion::DecodableType 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, - void *opaque_ptr) + void *opaque_ptr) { chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::DecodableType 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, - void *opaque_ptr) + void *opaque_ptr) { chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::DecodableType command_data; CHIP_ERROR error = Decode(tlv_data, command_data); @@ -1179,7 +1179,7 @@ command_t *create_review_fabric_restrictions(cluster_t *cluster) #else NULL #endif - ); + ); } command_t *create_review_fabric_restrictions_response(cluster_t *cluster) @@ -1195,7 +1195,7 @@ namespace command { command_t *create_keep_active(cluster_t *cluster) { 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); } @@ -1231,7 +1231,7 @@ namespace command { command_t *create_reset_counts(cluster_t *cluster) { return esp_matter::command::create(cluster, EthernetNetworkDiagnostics::Commands::ResetCounts::Id, COMMAND_FLAG_ACCEPTED, - NULL); + NULL); } } /* command */ @@ -1249,7 +1249,7 @@ command_t *create_retrieve_logs_request(cluster_t *cluster) command_t *create_retrieve_logs_response(cluster_t *cluster) { return esp_matter::command::create(cluster, DiagnosticLogs::Commands::RetrieveLogsResponse::Id, - COMMAND_FLAG_GENERATED, NULL); + COMMAND_FLAG_GENERATED, NULL); } } /* command */ @@ -1271,7 +1271,7 @@ command_t *create_time_snap_shot(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, - NULL); + NULL); } command_t *create_payload_test_request(cluster_t *cluster) { @@ -1291,7 +1291,7 @@ namespace command { command_t *create_reset_watermarks(cluster_t *cluster) { return esp_matter::command::create(cluster, SoftwareDiagnostics::Commands::ResetWatermarks::Id, - COMMAND_FLAG_ACCEPTED, NULL); + COMMAND_FLAG_ACCEPTED, NULL); } } /* command */ @@ -1731,7 +1731,7 @@ command_t *create_stay_active_request(cluster_t *cluster) command_t *create_stay_active_response(cluster_t *cluster) { return esp_matter::command::create(cluster, IcdManagement::Commands::StayActiveResponse::Id, - COMMAND_FLAG_GENERATED, NULL); + COMMAND_FLAG_GENERATED, NULL); } } /* 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) { 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); } @@ -2104,7 +2104,7 @@ command_t *create_resume(cluster_t *cluster) command_t *create_operational_command_response(cluster_t *cluster) { return esp_matter::command::create(cluster, OperationalState::Commands::OperationalCommandResponse::Id, - COMMAND_FLAG_GENERATED, NULL); + COMMAND_FLAG_GENERATED, NULL); } } /* command */ } /* operational_state */ @@ -2115,7 +2115,7 @@ namespace command { command_t *create_self_test_request(cluster_t *cluster) { 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 */ @@ -2545,8 +2545,8 @@ namespace command { command_t *create_get_active_dataset_request(cluster_t *cluster) { - return esp_matter::command::create(cluster, ThreadBorderRouterManagement::Commands::GetActiveDatasetRequest::Id, - COMMAND_FLAG_ACCEPTED, NULL); + return esp_matter::command::create(cluster, ThreadBorderRouterManagement::Commands::GetActiveDatasetRequest::Id, + COMMAND_FLAG_ACCEPTED, NULL); } command_t *create_get_pending_dataset_request(cluster_t *cluster) @@ -2811,8 +2811,6 @@ command_t *create_capture_snapshot_response(cluster_t *cluster) } /* command */ } /*camera av stream management*/ - - namespace webrtc_transport_provider { namespace command { @@ -2843,7 +2841,7 @@ command_t *create_provide_answer(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) @@ -2855,38 +2853,37 @@ command_t *create_end_session(cluster_t *cluster) }/*webrtc_transport_provider*/ namespace webrtc_transport_requestor { - namespace command { +namespace command { - command_t *create_offer(cluster_t *cluster) - { - return esp_matter::command::create(cluster, WebRTCTransportRequestor::Commands::Offer::Id, COMMAND_FLAG_ACCEPTED, NULL); - } +command_t *create_offer(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, WebRTCTransportRequestor::Commands::Offer::Id, COMMAND_FLAG_ACCEPTED, NULL); +} - command_t *create_answer(cluster_t *cluster) - { - return esp_matter::command::create(cluster, WebRTCTransportRequestor::Commands::Answer::Id, COMMAND_FLAG_ACCEPTED, NULL); - } +command_t *create_answer(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, WebRTCTransportRequestor::Commands::Answer::Id, COMMAND_FLAG_ACCEPTED, NULL); +} - command_t *create_ice_candidates(cluster_t *cluster) - { - return esp_matter::command::create(cluster, WebRTCTransportRequestor::Commands::ICECandidates::Id, COMMAND_FLAG_ACCEPTED, NULL); - } +command_t *create_ice_candidates(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, WebRTCTransportRequestor::Commands::ICECandidates::Id, COMMAND_FLAG_ACCEPTED, NULL); +} - command_t *create_end(cluster_t *cluster) - { - return esp_matter::command::create(cluster, WebRTCTransportRequestor::Commands::End::Id, COMMAND_FLAG_ACCEPTED, NULL); - } +command_t *create_end(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, WebRTCTransportRequestor::Commands::End::Id, COMMAND_FLAG_ACCEPTED, NULL); +} } /* command */ }/*webrtc_transport_requestor*/ - namespace chime { namespace command { command_t *create_play_chime_sound(cluster_t *cluster) { return esp_matter::command::create(cluster, Chime::Commands::PlayChimeSound::Id, - COMMAND_FLAG_ACCEPTED, NULL); + COMMAND_FLAG_ACCEPTED, NULL); } } /* command */ @@ -2897,19 +2894,19 @@ namespace command { command_t *create_stop(cluster_t *cluster) { 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) { 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) { return esp_matter::command::create(cluster, ClosureControl::Commands::Calibrate::Id, - COMMAND_FLAG_ACCEPTED, NULL); + COMMAND_FLAG_ACCEPTED, NULL); } } /* command */ @@ -2920,13 +2917,13 @@ namespace command { command_t *create_set_target(cluster_t *cluster) { 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) { return esp_matter::command::create(cluster, ClosureDimension::Commands::Step::Id, - COMMAND_FLAG_ACCEPTED, NULL); + COMMAND_FLAG_ACCEPTED, NULL); } } /* command */ @@ -2937,43 +2934,43 @@ namespace command { command_t *create_mptz_set_position(cluster_t *cluster) { 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) { 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) { 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) { 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) { 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) { 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) { return esp_matter::command::create(cluster, CameraAvSettingsUserLevelManagement::Commands::DPTZRelativeMove::Id, - COMMAND_FLAG_ACCEPTED, NULL); + COMMAND_FLAG_ACCEPTED, NULL); } } /* command */ @@ -2984,49 +2981,49 @@ namespace command { command_t *create_allocate_push_transport(cluster_t *cluster) { 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) { 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) { 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) { 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) { 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) { 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) { 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) { return esp_matter::command::create(cluster, PushAvStreamTransport::Commands::FindTransportResponse::Id, - COMMAND_FLAG_GENERATED, NULL); + COMMAND_FLAG_GENERATED, NULL); } } /* command */ @@ -3037,25 +3034,25 @@ namespace command { command_t *create_get_tariff_component(cluster_t *cluster) { 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) { 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) { 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) { return esp_matter::command::create(cluster, CommodityTariff::Commands::GetDayEntryResponse::Id, - COMMAND_FLAG_GENERATED, NULL); + COMMAND_FLAG_GENERATED, NULL); } } /* command */ @@ -3066,25 +3063,25 @@ namespace command { command_t *create_get_detailed_price_request(cluster_t *cluster) { 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) { 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) { 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) { return esp_matter::command::create(cluster, CommodityPrice::Commands::GetDetailedForecastResponse::Id, - COMMAND_FLAG_GENERATED, NULL); + COMMAND_FLAG_GENERATED, NULL); } } /* command */ diff --git a/components/esp_matter/data_model/esp_matter_command.h b/components/esp_matter/data_model/esp_matter_command.h index 7ad3345c9..4e9cf3942 100644 --- a/components/esp_matter/data_model/esp_matter_command.h +++ b/components/esp_matter/data_model/esp_matter_command.h @@ -382,7 +382,6 @@ namespace activated_carbon_filter_monitoring { namespace command = resource_monitoring::command; } /* activated_carbon_filter_monitoring */ - namespace mode_base { namespace command { command_t *create_change_to_mode(cluster_t *cluster); @@ -545,7 +544,6 @@ command_t *create_end(cluster_t *cluster); } /* command */ }/*webrtc transport requestor*/ - namespace chime { namespace command { command_t *create_play_chime_sound(cluster_t *cluster); diff --git a/components/esp_matter/data_model/esp_matter_data_model.cpp b/components/esp_matter/data_model/esp_matter_data_model.cpp index ad4849724..cb4f8994e 100644 --- a/components/esp_matter/data_model/esp_matter_data_model.cpp +++ b/components/esp_matter/data_model/esp_matter_data_model.cpp @@ -229,7 +229,7 @@ static esp_err_t init_identification(endpoint_t *endpoint) /* Init identify if exists and not initialized */ if (identify_cluster != nullptr && current_endpoint->identify == NULL) { _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) { return identification::init(current_endpoint->endpoint_id, identify_type_attr->attribute_val.u8); } 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->attribute_val_type = val.type; 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; 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 */ 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_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_LONG_CHAR_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_ARRAY) { /* Free buf */ 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, 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, - {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) @@ -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, 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 (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 */ if (call_callbacks) { 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"); } // 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 || - 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 = (val->type == ESP_MATTER_VAL_TYPE_CHAR_STRING || val->type == ESP_MATTER_VAL_TYPE_OCTET_STRING) ? 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) { 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) { @@ -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 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 - || 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) { // 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 static esp_err_t find_cluster_and_endpoint_id_for_internally_managed_attribute(const _attribute_base_t *attribute_base, - uint16_t &out_endpoint_id, - uint32_t &out_cluster_id) + uint16_t &out_endpoint_id, + uint32_t &out_cluster_id) { VerifyOrReturnError(attribute_base, ESP_ERR_INVALID_ARG); _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, - uint32_t &cluster_id, uint32_t &attribute_id) + uint32_t &cluster_id, uint32_t &attribute_id) { attribute_id = attribute->attribute_id; 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) 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 tlv_buffer; 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 */ 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_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_BOOLEAN) { + 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_LONG_OCTET_STRING || + current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_ARRAY || + current_attribute->attribute_val_type == ESP_MATTER_VAL_TYPE_BOOLEAN) { ESP_LOGE(TAG, "Bounds cannot be set for string/array/boolean type attributes"); 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"); 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_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_OCTET_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_OCTET_STRING) { // 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 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 auto get_count_on_all_clusters = [&check_cluster_flags](endpoint_t *endpoint) -> uint32_t { uint32_t result = 0; - if (!endpoint) + if (!endpoint) { return result; + } cluster_t *cluster = cluster::get_first(endpoint); - while (cluster) { + while (cluster) + { result += check_cluster_flags(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 auto get_count_on_specific_cluster = [&check_cluster_flags](const endpoint_t *endpoint, - uint32_t cluster_id) -> uint32_t { - if (!endpoint) + uint32_t cluster_id) -> uint32_t { + if (!endpoint) { return 0; + } cluster_t *cluster = cluster::get((endpoint_t *)endpoint, cluster_id); return check_cluster_flags(cluster); }; diff --git a/components/esp_matter/data_model/esp_matter_data_model.h b/components/esp_matter/data_model/esp_matter_data_model.h index 7fe49906e..1dd044591 100644 --- a/components/esp_matter/data_model/esp_matter_data_model.h +++ b/components/esp_matter/data_model/esp_matter_data_model.h @@ -442,7 +442,6 @@ esp_err_t set_identify(uint16_t endpoint_id, void *identify); */ esp_err_t enable(endpoint_t *endpoint); - /** Check if attribute is enabled * * 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. */ -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 * * This function is called before an attribute changes. */ -typedef chip::Protocols::InteractionModel::Status (*function_pre_attribute_change_t)( - const chip::app::ConcreteAttributePath & attributePath, EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); +typedef chip::Protocols::InteractionModel::Status(*function_pre_attribute_change_t)( + const chip::app::ConcreteAttributePath &attributePath, EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); /** 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); - /** Get first attribute * * 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. */ 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 * diff --git a/components/esp_matter/data_model/esp_matter_delegate_callbacks.cpp b/components/esp_matter/data_model/esp_matter_delegate_callbacks.cpp index 9213fba01..f1be0b390 100644 --- a/components/esp_matter/data_model/esp_matter_delegate_callbacks.cpp +++ b/components/esp_matter/data_model/esp_matter_delegate_callbacks.cpp @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. - #include #include #include @@ -81,79 +80,79 @@ static uint32_t get_feature_map_value(uint16_t endpoint_id, uint32_t cluster_id) chip::BitMask get_energy_evse_enabled_optional_attributes(uint16_t endpoint_id) { chip::BitMask optional_attrs = 0; - + if (endpoint::is_attribute_enabled(endpoint_id, EnergyEvse::Id, EnergyEvse::Attributes::UserMaximumChargeCurrent::Id)) { optional_attrs.Set(EnergyEvse::OptionalAttributes::kSupportsUserMaximumChargingCurrent); } - + if (endpoint::is_attribute_enabled(endpoint_id, EnergyEvse::Id, EnergyEvse::Attributes::RandomizationDelayWindow::Id)) { optional_attrs.Set(EnergyEvse::OptionalAttributes::kSupportsRandomizationWindow); } - + if (endpoint::is_attribute_enabled(endpoint_id, EnergyEvse::Id, EnergyEvse::Attributes::ApproximateEVEfficiency::Id)) { optional_attrs.Set(EnergyEvse::OptionalAttributes::kSupportsApproximateEvEfficiency); } - + return optional_attrs; } chip::BitMask get_electrical_power_measurement_enabled_optional_attributes(uint16_t endpoint_id) { chip::BitMask optional_attrs = 0; - + // Check for various optional attributes if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::Ranges::Id)) { optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeRanges); } - + if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::Voltage::Id)) { optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeVoltage); } - + if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::ActiveCurrent::Id)) { optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeActiveCurrent); } - + if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::ReactiveCurrent::Id)) { optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeReactiveCurrent); } - + if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::ApparentCurrent::Id)) { optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeApparentCurrent); } - + if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::ReactivePower::Id)) { optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeReactivePower); } - + if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::ApparentPower::Id)) { optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeApparentPower); } - + if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::RMSVoltage::Id)) { optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeRMSVoltage); } - + if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::RMSCurrent::Id)) { optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeRMSCurrent); } - + if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::RMSPower::Id)) { optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeRMSPower); } - + if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::Frequency::Id)) { optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeFrequency); } - + if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::PowerFactor::Id)) { optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributePowerFactor); } - + if (endpoint::is_attribute_enabled(endpoint_id, ElectricalPowerMeasurement::Id, ElectricalPowerMeasurement::Attributes::NeutralCurrent::Id)) { optional_attrs.Set(ElectricalPowerMeasurement::OptionalAttributes::kOptionalAttributeNeutralCurrent); } - + return optional_attrs; } @@ -161,11 +160,11 @@ chip::BitMask get_electrical_pow chip::BitMask get_energy_evse_enabled_optional_commands(uint16_t endpoint_id) { chip::BitMask optional_cmds = 0; - + if (endpoint::is_command_enabled(endpoint_id, EnergyEvse::Id, EnergyEvse::Commands::StartDiagnostics::Id)) { optional_cmds.Set(EnergyEvse::OptionalCommands::kSupportsStartDiagnostics); } - + return optional_cmds; } @@ -222,8 +221,7 @@ void MicrowaveOvenModeDelegateInitCB(void *delegate, uint16_t endpoint_id) ModeBase::Delegate *mode_delegate = static_cast(delegate); ModeBase::Instance * modeInstance = nullptr; // 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); modeInstance = new ModeBase::Instance(mode_delegate, endpoint_id, MicrowaveOvenMode::Id, feature_map); s_microwave_oven_mode_instances[endpoint_id] = modeInstance; @@ -251,7 +249,7 @@ void EnergyEvseDelegateInitCB(void *delegate, uint16_t endpoint_id) chip::BitMask optional_attrs = get_energy_evse_enabled_optional_attributes(endpoint_id); chip::BitMask optional_cmds = get_energy_evse_enabled_optional_commands(endpoint_id); energyEvseInstance = new EnergyEvse::Instance(endpoint_id, *energy_evse_delegate, chip::BitMask(feature_map), - optional_attrs, optional_cmds); + optional_attrs, optional_cmds); (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); ModeBase::Instance* microwaveOvenModeInstance = nullptr; OperationalState::Instance* operationalStateInstance = nullptr; - + // 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); microwaveOvenModeInstance = new ModeBase::Instance(microwave_oven_mode_delegate, endpoint_id, MicrowaveOvenMode::Id, feature_map); s_microwave_oven_mode_instances[endpoint_id] = microwaveOvenModeInstance; } else { microwaveOvenModeInstance = s_microwave_oven_mode_instances[endpoint_id]; } - + // 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); s_operational_state_instances[endpoint_id] = operationalStateInstance; } else { operationalStateInstance = s_operational_state_instances[endpoint_id]; } - + // Create MicrowaveOvenControl instance static MicrowaveOvenControl::Instance * microwaveOvenControlInstance = nullptr; MicrowaveOvenControl::Delegate *microwave_oven_control_delegate = static_cast(delegate); 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, - *operationalStateInstance, *microwaveOvenModeInstance); + *operationalStateInstance, *microwaveOvenModeInstance); (void)microwaveOvenControlInstance->Init(); } @@ -300,8 +296,7 @@ void OperationalStateDelegateInitCB(void *delegate, uint16_t endpoint_id) static OperationalState::Instance * operationalStateInstance = nullptr; OperationalState::Delegate *operational_state_delegate = static_cast(delegate); // 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); s_operational_state_instances[endpoint_id] = operationalStateInstance; } else { @@ -403,7 +398,7 @@ void ElectricalPowerMeasurementDelegateInitCB(void *delegate, uint16_t endpoint_ uint32_t feature_map = get_feature_map_value(endpoint_id, ElectricalPowerMeasurement::Id); chip::BitMask optional_attrs = get_electrical_power_measurement_enabled_optional_attributes(endpoint_id); electricalPowerMeasurementInstance = new ElectricalPowerMeasurement::Instance(endpoint_id, *electrical_power_measurement_delegate, - chip::BitMask(feature_map), optional_attrs); + chip::BitMask(feature_map), optional_attrs); (void)electricalPowerMeasurementInstance->Init(); } @@ -466,8 +461,7 @@ void ServiceAreaDelegateInitCB(void *delegate, uint16_t endpoint_id) void WaterHeaterManagementDelegateInitCB(void *delegate, uint16_t endpoint_id) { - if(delegate == nullptr) - { + if (delegate == nullptr) { return; } 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) { - if(delegate == nullptr) - { + if (delegate == nullptr) { return; } EnergyPreference::Delegate *energy_preference_delegate = static_cast(delegate); @@ -489,8 +482,7 @@ void EnergyPreferenceDelegateInitCB(void *delegate, uint16_t endpoint_id) void CommissionerControlDelegateInitCB(void *delegate, uint16_t endpoint_id) { - if(delegate == nullptr) - { + if (delegate == nullptr) { return; } CommissionerControl::Delegate *commissioner_control_delegate = static_cast(delegate); @@ -509,7 +501,6 @@ void ActionsDelegateInitCB(void *delegate, uint16_t endpoint_id) (void)actionsServer->Init(); } - void ThermostatDelegateInitCB(void *delegate, uint16_t endpoint_id) { VerifyOrReturn(delegate != nullptr); @@ -548,7 +539,6 @@ void ClosureControlDelegateInitCB(void *delegate, uint16_t endpoint_id) (void)server_interface->Init(); } - void ClosureDimensionDelegateInitCB(void *delegate, uint16_t endpoint_id) { VerifyOrReturn(delegate != nullptr); @@ -559,7 +549,6 @@ void ClosureDimensionDelegateInitCB(void *delegate, uint16_t endpoint_id) (void)server_interface->Init(); } - void PushAvStreamTransportDelegateInitCB(void *delegate, uint16_t endpoint_id) { 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); } - void CommodityTariffDelegateInitCB(void *delegate, uint16_t endpoint_id) { VerifyOrReturn(delegate != nullptr); @@ -577,7 +565,6 @@ void CommodityTariffDelegateInitCB(void *delegate, uint16_t endpoint_id) (void)commodity_tariff_instance->Init(); } - void CommodityPriceDelegateInitCB(void *delegate, uint16_t endpoint_id) { VerifyOrReturn(delegate != nullptr); @@ -587,7 +574,6 @@ void CommodityPriceDelegateInitCB(void *delegate, uint16_t endpoint_id) (void)commodity_price_instance->Init(); } - void ElectricalGridConditionsDelegateInitCB(void *delegate, uint16_t endpoint_id) { VerifyOrReturn(delegate != nullptr); diff --git a/components/esp_matter/data_model/esp_matter_endpoint.cpp b/components/esp_matter/data_model/esp_matter_endpoint.cpp index b710bd0ee..c8a611af1 100644 --- a/components/esp_matter/data_model/esp_matter_endpoint.cpp +++ b/components/esp_matter/data_model/esp_matter_endpoint.cpp @@ -77,14 +77,14 @@ esp_err_t add(endpoint_t *endpoint, config_t *config) group_key_management::create(endpoint, CLUSTER_FLAG_SERVER); #if CHIP_CONFIG_ENABLE_ICD_SERVER 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 - 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 - 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 #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_LIT } @@ -172,7 +172,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config) } /** ota_provider **/ -namespace power_source{ +namespace power_source { uint32_t get_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; } - endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) { return common::create(node, config, flags, priv_data, add); @@ -1283,7 +1282,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config) } } /** room_air_conditioner **/ -namespace temperature_controlled_cabinet{ +namespace temperature_controlled_cabinet { uint32_t get_device_type_id() { @@ -1311,7 +1310,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config) } } /** temperature_controlled_cabinet**/ -namespace refrigerator{ +namespace refrigerator { 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()); VerifyOrReturnError(err == ESP_OK, err); cluster_t *camera_av_stream_management_cluster = cluster::camera_av_stream_management::create( - endpoint, - &(config->camera_av_stream_management), - CLUSTER_FLAG_SERVER - ); + endpoint, + &(config->camera_av_stream_management), + CLUSTER_FLAG_SERVER + ); 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::snapshot::add(camera_av_stream_management_cluster); diff --git a/components/esp_matter/data_model/esp_matter_endpoint.h b/components/esp_matter/data_model/esp_matter_endpoint.h index 50f82e26c..5abf5589b 100644 --- a/components/esp_matter/data_model/esp_matter_endpoint.h +++ b/components/esp_matter/data_model/esp_matter_endpoint.h @@ -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); } /* ota_provider */ -namespace power_source{ +namespace power_source { typedef struct config { cluster::descriptor::config_t descriptor; 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 { typedef struct config : on_off_with_lighting_config { - config() { + config() + { /* For lighting product, the default identify type should be 0x01: LightOutput*/ 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 { typedef struct config : app_client_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); } } config_t; @@ -345,7 +347,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config); namespace dimmer_switch { typedef struct config : app_client_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); } } config_t; @@ -359,7 +362,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config); namespace color_dimmer_switch { typedef struct config : app_client_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); } } config_t; @@ -372,7 +376,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config); namespace generic_switch { typedef struct config : app_base_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); } 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 { typedef struct config : on_off_with_lighting_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); - } + } } config_t; uint32_t get_device_type_id(); @@ -412,7 +418,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config); namespace fan { typedef struct config : app_with_group_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); } cluster::fan_control::config_t fan_control; @@ -426,7 +433,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config); namespace thermostat { typedef struct config : app_with_group_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); } 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 { typedef struct config : app_base_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); } cluster::air_quality::config_t air_quality; @@ -455,7 +464,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config); namespace air_purifier { typedef struct config : app_base_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); } 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 { typedef struct config : app_base_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kAudibleBeep); } 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 { typedef struct config : app_base_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kAudibleBeep); } cluster::door_lock::config_t door_lock; @@ -558,8 +570,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config); namespace window_covering { typedef struct config : app_with_group_config { cluster::window_covering::config_t window_covering; - config(uint8_t end_product_type = 0) : window_covering(end_product_type) { - identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); + config(uint8_t end_product_type = 0) : window_covering(end_product_type) + { + identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); } } config_t; @@ -571,7 +584,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config); namespace temperature_sensor { typedef struct config : app_base_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); } cluster::temperature_measurement::config_t temperature_measurement; @@ -585,7 +599,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config); namespace humidity_sensor { typedef struct config : app_base_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); } 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 { typedef struct config : app_base_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kAudibleBeep); } cluster::occupancy_sensing::config_t occupancy_sensing; @@ -614,7 +630,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config); namespace contact_sensor { typedef struct config : app_with_bool_state_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); } } config_t; @@ -627,7 +644,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config); namespace light_sensor { typedef struct config : app_base_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); } cluster::illuminance_measurement::config_t illuminance_measurement; @@ -641,7 +659,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config); namespace pressure_sensor { typedef struct config : app_base_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); } cluster::pressure_measurement::config_t pressure_measurement; @@ -655,7 +674,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config); namespace flow_sensor { typedef struct config : app_base_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); } cluster::flow_measurement::config_t flow_measurement; @@ -675,7 +695,8 @@ typedef struct config : app_base_config { nullable max_pressure = nullable(), nullable max_speed = nullable(), nullable max_flow = nullable() - ) : 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); } } config_t; @@ -688,7 +709,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config); namespace pump_controller { typedef struct config : app_client_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); } } config_t; @@ -713,7 +735,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config); namespace room_air_conditioner { typedef struct config : app_base_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); } 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 { typedef struct config : app_base_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); } 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 { typedef struct config : app_with_bool_state_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); } } config_t; @@ -792,7 +817,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config); namespace water_freeze_detector { typedef struct config : app_with_bool_state_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); } } config_t; @@ -806,7 +832,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config); namespace rain_sensor { typedef struct config : app_with_bool_state_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator); } } config_t; @@ -895,7 +922,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config); namespace water_valve { typedef struct config : app_base_config { 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); } } config_t; @@ -946,7 +974,8 @@ esp_err_t add(endpoint_t *endpoint, config_t *config); namespace mounted_on_off_control { typedef struct config : on_off_with_lighting_config { - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); } } config_t; @@ -1071,7 +1100,6 @@ esp_err_t add(endpoint_t *endpoint, config_t *config); } /* chime */ - namespace thermostat_controller { using config_t = app_client_config; @@ -1094,7 +1122,8 @@ namespace closure { typedef struct config : app_base_config { cluster::closure_control::config_t closure_control; - config() { + config() + { identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator); } } config_t; diff --git a/components/esp_matter/data_model/esp_matter_event.h b/components/esp_matter/data_model/esp_matter_event.h index a2e1bf94a..bcb94a5cb 100644 --- a/components/esp_matter/data_model/esp_matter_event.h +++ b/components/esp_matter/data_model/esp_matter_event.h @@ -107,7 +107,6 @@ event_t *create_reachable_changed(cluster_t *cluster); } // namespace event } // namespace bridged_device_basic_information - namespace power_source { namespace event { event_t *create_wired_fault_change(cluster_t *cluster); diff --git a/components/esp_matter/data_model/esp_matter_feature.cpp b/components/esp_matter/data_model/esp_matter_feature.cpp index d0f8257f0..318c2a024 100644 --- a/components/esp_matter/data_model/esp_matter_feature.cpp +++ b/components/esp_matter/data_model/esp_matter_feature.cpp @@ -1064,7 +1064,6 @@ esp_err_t add(cluster_t *cluster) } /* feature */ } /* ethernet_network_diagnostics */ - namespace air_quality { namespace feature { @@ -1835,7 +1834,6 @@ esp_err_t add(cluster_t *cluster, config_t *config) } /* feature */ } /* mode_select */ - namespace pressure_measurement { namespace feature { @@ -2400,7 +2398,6 @@ esp_err_t add(cluster_t *cluster) return ESP_ERR_NOT_SUPPORTED; } - return ESP_OK; } } /* polyphase_power */ @@ -2426,7 +2423,6 @@ esp_err_t add(cluster_t *cluster) return ESP_ERR_NOT_SUPPORTED; } - return ESP_OK; } } /* harmonics */ @@ -2452,7 +2448,6 @@ esp_err_t add(cluster_t *cluster) return ESP_ERR_NOT_SUPPORTED; } - return ESP_OK; } } /* power_quality */ @@ -3208,7 +3203,6 @@ esp_err_t add(cluster_t *cluster) event::create_power_adjust_start(cluster); event::create_power_adjust_end(cluster); - return ESP_OK; } } /* power_adjustment */ @@ -3260,7 +3254,6 @@ esp_err_t add(cluster_t *cluster) return ESP_ERR_NOT_SUPPORTED; } - return ESP_OK; } } /* state_forecast_reporting */ @@ -3494,7 +3487,6 @@ esp_err_t add(cluster_t *cluster) return ESP_OK; } - } /* tank_percent */ } /* feature */ @@ -4075,7 +4067,6 @@ esp_err_t add(cluster_t *cluster) attribute::create_soft_recording_privacy_mode_enabled(cluster, 0); attribute::create_soft_livestream_privacy_mode_enabled(cluster, 0); - return ESP_OK; } @@ -4099,7 +4090,6 @@ esp_err_t add(cluster_t *cluster) attribute::create_speaker_max_level(cluster, 0); attribute::create_speaker_min_level(cluster, 0); - 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_snapshot_recording_enabled(cluster, 0); - return ESP_OK; } @@ -4220,7 +4209,6 @@ namespace webrtc_transport_provider { namespace webrtc_transport_requestor { }/*webrtc_transport_requestor*/ - namespace closure_control { namespace feature { namespace positioning { diff --git a/components/esp_matter/data_model/esp_matter_feature.h b/components/esp_matter/data_model/esp_matter_feature.h index 668ba51f9..79dac9caf 100644 --- a/components/esp_matter/data_model/esp_matter_feature.h +++ b/components/esp_matter/data_model/esp_matter_feature.h @@ -301,8 +301,8 @@ typedef struct config { uint16_t couple_color_temp_to_level_min_mireds; nullable start_up_color_temperature_mireds; 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), - start_up_color_temperature_mireds(0x00fa) {} + color_temp_physical_max_mireds(0xfeff), couple_color_temp_to_level_min_mireds(1), + start_up_color_temperature_mireds(0x00fa) {} } config_t; uint32_t get_id(); @@ -350,7 +350,7 @@ typedef struct config { uint16_t color_loop_start_enhanced_hue; uint16_t color_loop_stored_enhanced_hue; 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; uint32_t get_id(); @@ -491,9 +491,9 @@ namespace feature { namespace heating { 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; uint32_t get_id(); @@ -503,9 +503,9 @@ esp_err_t add(cluster_t *cluster, config_t *config); namespace cooling { 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; uint32_t get_id(); @@ -517,14 +517,14 @@ esp_err_t add(cluster_t *cluster, config_t *config); namespace occupancy { typedef struct config { - uint8_t occupancy; - int16_t unoccupied_cooling_setpoint; - int16_t unoccupied_heating_setpoint; - nullable unoccupied_setback; - nullable unoccupied_setback_min; - nullable unoccupied_setback_max; + uint8_t occupancy; + int16_t unoccupied_cooling_setpoint; + int16_t unoccupied_heating_setpoint; + nullable unoccupied_setback; + nullable unoccupied_setback_min; + nullable 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; uint32_t get_id(); @@ -534,11 +534,11 @@ esp_err_t add(cluster_t *cluster, config_t *config); namespace setback { typedef struct config { - nullable occupied_setback; - nullable occupied_setback_min; - nullable occupied_setback_max; + nullable occupied_setback; + nullable occupied_setback_min; + nullable occupied_setback_max; - config (): occupied_setback(), occupied_setback_min(), occupied_setback_max() {} + config(): occupied_setback(), occupied_setback_min(), occupied_setback_max() {} } config_t; uint32_t get_id(); @@ -551,9 +551,9 @@ esp_err_t add(cluster_t *cluster, config_t *config); namespace auto_mode { 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; uint32_t get_id(); @@ -565,7 +565,7 @@ namespace local_temperature_not_exposed { typedef struct config { int16_t local_temperature_calibration; - config (): local_temperature_calibration(0) {} + config(): local_temperature_calibration(0) {} } config_t; uint32_t get_id(); @@ -580,7 +580,7 @@ typedef struct config { nullable number_of_schedule_transition_per_day; 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; uint32_t get_id(); @@ -1158,7 +1158,6 @@ esp_err_t add(cluster_t *cluster, config_t *config); } /* feature */ } /* boolean_state_configuration */ - namespace power_topology { namespace feature { @@ -1267,8 +1266,8 @@ typedef struct config { uint8_t user_code_temporary_disable_time; bool require_pin_for_remote_operation; 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), - require_pin_for_remote_operation(true) {} + wrong_code_entry_limit(5), user_code_temporary_disable_time(5), + require_pin_for_remote_operation(true) {} } config_t; uint32_t get_id(); @@ -1283,7 +1282,7 @@ typedef struct config { uint8_t wrong_code_entry_limit; uint8_t user_code_temporary_disable_time; 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; uint32_t get_id(); @@ -1370,7 +1369,7 @@ uint32_t get_id(); esp_err_t add(cluster_t *cluster); } /* aliro_provisioning */ -namespace aliro_bleuwb{ +namespace aliro_bleuwb { uint32_t get_id(); esp_err_t add(cluster_t *cluster); @@ -1608,11 +1607,11 @@ namespace feature { namespace extended { typedef struct config { - nullable scaled_value; - nullable min_scaled_value; - nullable max_scaled_value; - uint8_t scale; - config() : scaled_value(), min_scaled_value(), max_scaled_value(), scale(0) {} + nullable scaled_value; + nullable min_scaled_value; + nullable max_scaled_value; + uint8_t scale; + config() : scaled_value(), min_scaled_value(), max_scaled_value(), scale(0) {} } config_t; uint32_t get_id(); @@ -1891,7 +1890,6 @@ namespace webrtc_transport_provider { namespace webrtc_transport_requestor { }/*webrtc_transport_requestor*/ - namespace closure_control { namespace feature { diff --git a/components/esp_matter/data_model/private/esp_matter_cluster_revisions.h b/components/esp_matter/data_model/private/esp_matter_cluster_revisions.h index 765135d90..2e686d697 100644 --- a/components/esp_matter/data_model/private/esp_matter_cluster_revisions.h +++ b/components/esp_matter/data_model/private/esp_matter_cluster_revisions.h @@ -424,4 +424,3 @@ constexpr uint16_t cluster_revision = 1; } // namespace soil_measurement } // namespace cluster } // namespace esp_matter - diff --git a/components/esp_matter/data_model/private/esp_matter_data_model_priv.h b/components/esp_matter/data_model/private/esp_matter_data_model_priv.h index 3dab3679c..8f55761d2 100644 --- a/components/esp_matter/data_model/private/esp_matter_data_model_priv.h +++ b/components/esp_matter/data_model/private/esp_matter_data_model_priv.h @@ -108,34 +108,34 @@ esp_err_t destroy(cluster_t *cluster, attribute_t *attribute); namespace command { - /** Destroy command - * - * This function destroys a command that was created and added to a cluster. - * It removes the command from the cluster's command list. - * - * @param[in] cluster Cluster handle. - * @param[in] command Command handle. - * - * @return ESP_OK on success. - * @return error in case of failure. - */ +/** Destroy command +* +* This function destroys a command that was created and added to a cluster. +* It removes the command from the cluster's command list. +* +* @param[in] cluster Cluster handle. +* @param[in] command Command handle. +* +* @return ESP_OK on success. +* @return error in case of failure. +*/ esp_err_t destroy(cluster_t *cluster, command_t *command); } // namespace command namespace event { - /** Destroy event - * - * This function destroys an event that was created and added to a cluster. - * It removes the event from the cluster's event list. - * - * @param[in] cluster Cluster handle. - * @param[in] event Event handle. - * - * @return ESP_OK on success. - * @return error in case of failure. - */ +/** Destroy event +* +* This function destroys an event that was created and added to a cluster. +* It removes the event from the cluster's event list. +* +* @param[in] cluster Cluster handle. +* @param[in] event Event handle. +* +* @return ESP_OK on success. +* @return error in case of failure. +*/ esp_err_t destroy(cluster_t *cluster, event_t *event); } // namespace event diff --git a/components/esp_matter/data_model/private/esp_matter_nvs.cpp b/components/esp_matter/data_model/private/esp_matter_nvs.cpp index 0221615fa..de40e0ae0 100644 --- a/components/esp_matter/data_model/private/esp_matter_nvs.cpp +++ b/components/esp_matter/data_model/private/esp_matter_nvs.cpp @@ -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) { - // Convert the the endpoint_id, cluster_id, attribute_id to base64 string - uint8_t encode_buf[10] = {0}; - char base64_str[17] = {0}; - memcpy(&encode_buf[0], &endpoint_id, sizeof(endpoint_id)); - memcpy(&encode_buf[2], &cluster_id, sizeof(cluster_id)); - memcpy(&encode_buf[6], &attribute_id, sizeof(attribute_id)); - chip::Base64Encode(encode_buf, 10, base64_str); - // The last two character must be '=' - assert(base64_str[14] == '=' && base64_str[15] == '='); - // Copy the string before '=' - strncpy(attribute_key, base64_str, 14); - attribute_key[14] = 0; + // Convert the the endpoint_id, cluster_id, attribute_id to base64 string + uint8_t encode_buf[10] = {0}; + char base64_str[17] = {0}; + memcpy(&encode_buf[0], &endpoint_id, sizeof(endpoint_id)); + memcpy(&encode_buf[2], &cluster_id, sizeof(cluster_id)); + memcpy(&encode_buf[6], &attribute_id, sizeof(attribute_id)); + chip::Base64Encode(encode_buf, 10, base64_str); + // The last two character must be '=' + assert(base64_str[14] == '=' && base64_str[15] == '='); + // Copy the string before '=' + strncpy(attribute_key, base64_str, 14); + 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_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; 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 || - 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_ARRAY) { + 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_ARRAY) { size_t len = 0; 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 @@ -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 // if value is stored as primitive data type return it, else check if its stored as blob // and convert it to primitive data type - switch (val.type) - { - case ESP_MATTER_VAL_TYPE_BOOLEAN: - { - uint8_t b_val; - if ((err = nvs_get_u8(handle, attribute_key, &b_val)) == ESP_OK) - { - val.val.b = (b_val != 0); - } - break; + switch (val.type) { + case ESP_MATTER_VAL_TYPE_BOOLEAN: { + uint8_t b_val; + if ((err = nvs_get_u8(handle, attribute_key, &b_val)) == ESP_OK) { + val.val.b = (b_val != 0); } + break; + } - case ESP_MATTER_VAL_TYPE_INTEGER: - case ESP_MATTER_VAL_TYPE_NULLABLE_INTEGER: - { - err = nvs_get_i32(handle, attribute_key, reinterpret_cast(&val.val.i)); - break; - } + case ESP_MATTER_VAL_TYPE_INTEGER: + case ESP_MATTER_VAL_TYPE_NULLABLE_INTEGER: { + err = nvs_get_i32(handle, attribute_key, reinterpret_cast(&val.val.i)); + break; + } - // 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_NULLABLE_FLOAT: - { - size_t length = sizeof(val.val.f); - err = nvs_get_blob(handle, attribute_key, &val.val.f, &length); - break; - } + // 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_NULLABLE_FLOAT: { + size_t length = sizeof(val.val.f); + err = nvs_get_blob(handle, attribute_key, &val.val.f, &length); + break; + } - case ESP_MATTER_VAL_TYPE_INT8: - case ESP_MATTER_VAL_TYPE_NULLABLE_INT8: - { - err = nvs_get_i8(handle, attribute_key, &val.val.i8); - break; - } + case ESP_MATTER_VAL_TYPE_INT8: + case ESP_MATTER_VAL_TYPE_NULLABLE_INT8: { + err = nvs_get_i8(handle, attribute_key, &val.val.i8); + break; + } - case ESP_MATTER_VAL_TYPE_UINT8: - case ESP_MATTER_VAL_TYPE_ENUM8: - case ESP_MATTER_VAL_TYPE_BITMAP8: - case ESP_MATTER_VAL_TYPE_NULLABLE_UINT8: - case ESP_MATTER_VAL_TYPE_NULLABLE_ENUM8: - case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP8: - { - err = nvs_get_u8(handle, attribute_key, &val.val.u8); - break; - } + case ESP_MATTER_VAL_TYPE_UINT8: + case ESP_MATTER_VAL_TYPE_ENUM8: + case ESP_MATTER_VAL_TYPE_BITMAP8: + case ESP_MATTER_VAL_TYPE_NULLABLE_UINT8: + case ESP_MATTER_VAL_TYPE_NULLABLE_ENUM8: + case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP8: { + err = nvs_get_u8(handle, attribute_key, &val.val.u8); + break; + } - case ESP_MATTER_VAL_TYPE_INT16: - case ESP_MATTER_VAL_TYPE_NULLABLE_INT16: - { - err = nvs_get_i16(handle, attribute_key, &val.val.i16); - break; - } + case ESP_MATTER_VAL_TYPE_INT16: + case ESP_MATTER_VAL_TYPE_NULLABLE_INT16: { + err = nvs_get_i16(handle, attribute_key, &val.val.i16); + break; + } - case ESP_MATTER_VAL_TYPE_UINT16: - case ESP_MATTER_VAL_TYPE_BITMAP16: - case ESP_MATTER_VAL_TYPE_NULLABLE_UINT16: - case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP16: - { - err = nvs_get_u16(handle, attribute_key, &val.val.u16); - break; - } + case ESP_MATTER_VAL_TYPE_UINT16: + case ESP_MATTER_VAL_TYPE_BITMAP16: + case ESP_MATTER_VAL_TYPE_NULLABLE_UINT16: + case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP16: { + err = nvs_get_u16(handle, attribute_key, &val.val.u16); + break; + } - case ESP_MATTER_VAL_TYPE_INT32: - case ESP_MATTER_VAL_TYPE_NULLABLE_INT32: - { - err = nvs_get_i32(handle, attribute_key, &val.val.i32); - break; - } + case ESP_MATTER_VAL_TYPE_INT32: + case ESP_MATTER_VAL_TYPE_NULLABLE_INT32: { + err = nvs_get_i32(handle, attribute_key, &val.val.i32); + break; + } - case ESP_MATTER_VAL_TYPE_UINT32: - case ESP_MATTER_VAL_TYPE_BITMAP32: - case ESP_MATTER_VAL_TYPE_NULLABLE_UINT32: - case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP32: - { - err = nvs_get_u32(handle, attribute_key, &val.val.u32); - break; - } + case ESP_MATTER_VAL_TYPE_UINT32: + case ESP_MATTER_VAL_TYPE_BITMAP32: + case ESP_MATTER_VAL_TYPE_NULLABLE_UINT32: + case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP32: { + err = nvs_get_u32(handle, attribute_key, &val.val.u32); + break; + } - case ESP_MATTER_VAL_TYPE_INT64: - case ESP_MATTER_VAL_TYPE_NULLABLE_INT64: - { - err = nvs_get_i64(handle, attribute_key, &val.val.i64); - break; - } + case ESP_MATTER_VAL_TYPE_INT64: + case ESP_MATTER_VAL_TYPE_NULLABLE_INT64: { + err = nvs_get_i64(handle, attribute_key, &val.val.i64); + break; + } - case ESP_MATTER_VAL_TYPE_UINT64: - case ESP_MATTER_VAL_TYPE_NULLABLE_UINT64: - { - err = nvs_get_u64(handle, attribute_key, &val.val.u64); - break; - } + case ESP_MATTER_VAL_TYPE_UINT64: + case ESP_MATTER_VAL_TYPE_NULLABLE_UINT64: { + err = nvs_get_u64(handle, attribute_key, &val.val.u64); + break; + } - default: - { - // handle the case where the type is not recognized - nvs_close(handle); - ESP_LOGE(TAG, "Invalid attribute type: %u", val.type); - return ESP_ERR_INVALID_ARG; - } + default: { + // handle the case where the type is not recognized + nvs_close(handle); + ESP_LOGE(TAG, "Invalid attribute type: %u", val.type); + return ESP_ERR_INVALID_ARG; + } } // 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; } -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; 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 || - 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_ARRAY) { + 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_ARRAY) { /* Store only if value is not NULL */ if (val.val.a.b) { 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 { // This switch case handles primitive data types // always store values as primitive data type - switch (val.type) - { - case ESP_MATTER_VAL_TYPE_BOOLEAN: - { - err = nvs_set_u8(handle, attribute_key, val.val.b != 0); - break; - } + switch (val.type) { + case ESP_MATTER_VAL_TYPE_BOOLEAN: { + err = nvs_set_u8(handle, attribute_key, val.val.b != 0); + break; + } - case ESP_MATTER_VAL_TYPE_INTEGER: - case ESP_MATTER_VAL_TYPE_NULLABLE_INTEGER: - { - err = nvs_set_i32(handle, attribute_key, val.val.i); - break; - } + case ESP_MATTER_VAL_TYPE_INTEGER: + case ESP_MATTER_VAL_TYPE_NULLABLE_INTEGER: { + err = nvs_set_i32(handle, attribute_key, val.val.i); + break; + } - // no nvs api to store float, storing as blob - case ESP_MATTER_VAL_TYPE_FLOAT: - case ESP_MATTER_VAL_TYPE_NULLABLE_FLOAT: - { - err = nvs_set_blob(handle, attribute_key, &val.val.f, sizeof(val.val.f)); - break; - } + // no nvs api to store float, storing as blob + case ESP_MATTER_VAL_TYPE_FLOAT: + case ESP_MATTER_VAL_TYPE_NULLABLE_FLOAT: { + err = nvs_set_blob(handle, attribute_key, &val.val.f, sizeof(val.val.f)); + break; + } - case ESP_MATTER_VAL_TYPE_INT8: - case ESP_MATTER_VAL_TYPE_NULLABLE_INT8: - { - err = nvs_set_i8(handle, attribute_key, val.val.i8); - break; - } + case ESP_MATTER_VAL_TYPE_INT8: + case ESP_MATTER_VAL_TYPE_NULLABLE_INT8: { + err = nvs_set_i8(handle, attribute_key, val.val.i8); + break; + } - case ESP_MATTER_VAL_TYPE_UINT8: - case ESP_MATTER_VAL_TYPE_ENUM8: - case ESP_MATTER_VAL_TYPE_BITMAP8: - case ESP_MATTER_VAL_TYPE_NULLABLE_UINT8: - case ESP_MATTER_VAL_TYPE_NULLABLE_ENUM8: - case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP8: - { - err = nvs_set_u8(handle, attribute_key, val.val.u8); - break; - } + case ESP_MATTER_VAL_TYPE_UINT8: + case ESP_MATTER_VAL_TYPE_ENUM8: + case ESP_MATTER_VAL_TYPE_BITMAP8: + case ESP_MATTER_VAL_TYPE_NULLABLE_UINT8: + case ESP_MATTER_VAL_TYPE_NULLABLE_ENUM8: + case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP8: { + err = nvs_set_u8(handle, attribute_key, val.val.u8); + break; + } - case ESP_MATTER_VAL_TYPE_INT16: - case ESP_MATTER_VAL_TYPE_NULLABLE_INT16: - { - err = nvs_set_i16(handle, attribute_key, val.val.i16); - break; - } + case ESP_MATTER_VAL_TYPE_INT16: + case ESP_MATTER_VAL_TYPE_NULLABLE_INT16: { + err = nvs_set_i16(handle, attribute_key, val.val.i16); + break; + } - case ESP_MATTER_VAL_TYPE_UINT16: - case ESP_MATTER_VAL_TYPE_BITMAP16: - case ESP_MATTER_VAL_TYPE_NULLABLE_UINT16: - case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP16: - { - err = nvs_set_u16(handle, attribute_key, val.val.u16); - break; - } + case ESP_MATTER_VAL_TYPE_UINT16: + case ESP_MATTER_VAL_TYPE_BITMAP16: + case ESP_MATTER_VAL_TYPE_NULLABLE_UINT16: + case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP16: { + err = nvs_set_u16(handle, attribute_key, val.val.u16); + break; + } - case ESP_MATTER_VAL_TYPE_INT32: - case ESP_MATTER_VAL_TYPE_NULLABLE_INT32: - { - err = nvs_set_i32(handle, attribute_key, val.val.i32); - break; - } + case ESP_MATTER_VAL_TYPE_INT32: + case ESP_MATTER_VAL_TYPE_NULLABLE_INT32: { + err = nvs_set_i32(handle, attribute_key, val.val.i32); + break; + } - case ESP_MATTER_VAL_TYPE_UINT32: - case ESP_MATTER_VAL_TYPE_BITMAP32: - case ESP_MATTER_VAL_TYPE_NULLABLE_UINT32: - case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP32: - { - err = nvs_set_u32(handle, attribute_key, val.val.u32); - break; - } + case ESP_MATTER_VAL_TYPE_UINT32: + case ESP_MATTER_VAL_TYPE_BITMAP32: + case ESP_MATTER_VAL_TYPE_NULLABLE_UINT32: + case ESP_MATTER_VAL_TYPE_NULLABLE_BITMAP32: { + err = nvs_set_u32(handle, attribute_key, val.val.u32); + break; + } - case ESP_MATTER_VAL_TYPE_INT64: - case ESP_MATTER_VAL_TYPE_NULLABLE_INT64: - { - err = nvs_set_i64(handle, attribute_key, val.val.i64); - break; - } + case ESP_MATTER_VAL_TYPE_INT64: + case ESP_MATTER_VAL_TYPE_NULLABLE_INT64: { + err = nvs_set_i64(handle, attribute_key, val.val.i64); + break; + } - case ESP_MATTER_VAL_TYPE_UINT64: - case ESP_MATTER_VAL_TYPE_NULLABLE_UINT64: - { - err = nvs_set_u64(handle, attribute_key, val.val.u64); - break; - } + case ESP_MATTER_VAL_TYPE_UINT64: + case ESP_MATTER_VAL_TYPE_NULLABLE_UINT64: { + err = nvs_set_u64(handle, attribute_key, val.val.u64); + break; + } - default: - { - // handle the case where the type is not recognized - err = ESP_ERR_INVALID_ARG; - ESP_LOGE(TAG, "Invalid attribute type: %u", val.type); - break; - } + default: { + // handle the case where the type is not recognized + err = ESP_ERR_INVALID_ARG; + ESP_LOGE(TAG, "Invalid attribute type: %u", val.type); + break; + } } } nvs_commit(handle); @@ -350,14 +323,14 @@ static esp_err_t nvs_erase_val(const char *nvs_namespace, const char *attribute_ 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 */ char attribute_key[16] = {0}; 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 "," - " 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); 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 @@ -381,7 +354,7 @@ esp_err_t get_val_from_nvs(uint16_t endpoint_id, uint32_t cluster_id, uint32_t a 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 */ char attribute_key[16] = {0}; diff --git a/components/esp_matter/data_model/private/esp_matter_nvs.h b/components/esp_matter/data_model/private/esp_matter_nvs.h index b8b46e591..f75358080 100644 --- a/components/esp_matter/data_model/private/esp_matter_nvs.h +++ b/components/esp_matter/data_model/private/esp_matter_nvs.h @@ -31,7 +31,7 @@ namespace attribute { * * @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. @@ -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 */ -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. diff --git a/components/esp_matter/data_model_provider/clusters/basic_information/integration.cpp b/components/esp_matter/data_model_provider/clusters/basic_information/integration.cpp index 4d035fea3..8ff9e29da 100644 --- a/components/esp_matter/data_model_provider/clusters/basic_information/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/basic_information/integration.cpp @@ -36,14 +36,14 @@ BasicInformationCluster::OptionalAttributesSet GetOptionalAttrsSet() { BasicInformationCluster::OptionalAttributesSet attrsSet; return attrsSet.Set(IsAttrEnabled(ManufacturingDate::Id)) - .Set(IsAttrEnabled(PartNumber::Id)) - .Set(IsAttrEnabled(ProductURL::Id)) - .Set(IsAttrEnabled(ProductLabel::Id)) - .Set(IsAttrEnabled(SerialNumber::Id)) - .Set(IsAttrEnabled(LocalConfigDisabled::Id)) - .Set(IsAttrEnabled(Reachable::Id)) - .Set(IsAttrEnabled(ProductAppearance::Id)) - .Set(IsAttrEnabled(UniqueID::Id)); + .Set(IsAttrEnabled(PartNumber::Id)) + .Set(IsAttrEnabled(ProductURL::Id)) + .Set(IsAttrEnabled(ProductLabel::Id)) + .Set(IsAttrEnabled(SerialNumber::Id)) + .Set(IsAttrEnabled(LocalConfigDisabled::Id)) + .Set(IsAttrEnabled(Reachable::Id)) + .Set(IsAttrEnabled(ProductAppearance::Id)) + .Set(IsAttrEnabled(UniqueID::Id)); } } // namespace diff --git a/components/esp_matter/data_model_provider/clusters/boolean_state_configuration/integration.cpp b/components/esp_matter/data_model_provider/clusters/boolean_state_configuration/integration.cpp index eb7e1a7ce..fe472b209 100644 --- a/components/esp_matter/data_model_provider/clusters/boolean_state_configuration/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/boolean_state_configuration/integration.cpp @@ -50,23 +50,23 @@ CHIP_ERROR GetClusterConfig(EndpointId endpointId, BitMask &featureMap, } esp_matter_attr_val_t tmp_attr_val; 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); featureMap = BitMask(tmp_attr_val.val.u32); if (featureMap.Has(Feature::kSensitivityLevel)) { 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); supportedSensitivityLevels = tmp_attr_val.val.u8; 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; optionalAttrSet.Set(); } } if (featureMap.Has(Feature::kAudible) || featureMap.Has(Feature::kVisual)) { 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); alarmsSupported = AlarmModeBitmap(tmp_attr_val.val.u8); if (esp_matter::attribute::get(cluster, Attributes::AlarmsEnabled::Id)) { @@ -109,11 +109,11 @@ void ESPMatterBooleanStateConfigurationClusterServerInitCallback(EndpointId endp return; } gServers[endpointId].Create(endpointId, featureMap, optionalAttrSet, - BooleanStateConfigurationCluster::StartupConfiguration{ - .supportedSensitivityLevels = supportedSensitivityLevels, - .defaultSensitivityLevel = defaultSensitivityLevel, - .alarmsSupported = alarmsSupported, - }); + BooleanStateConfigurationCluster::StartupConfiguration{ + .supportedSensitivityLevels = supportedSensitivityLevels, + .defaultSensitivityLevel = defaultSensitivityLevel, + .alarmsSupported = alarmsSupported, + }); err = esp_matter::data_model::provider::get_instance().registry().Register(gServers[endpointId].Registration()); if (err != CHIP_NO_ERROR) { ChipLogError(AppServer, "Failed to register BooleanStateConfiguration - Error %" CHIP_ERROR_FORMAT, @@ -128,7 +128,7 @@ void ESPMatterBooleanStateConfigurationClusterServerShutdownCallback(EndpointId return; } 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) { ChipLogError(AppServer, "Failed to unregister BooleanStateConfiguration - Error %" CHIP_ERROR_FORMAT, err.Format()); diff --git a/components/esp_matter/data_model_provider/clusters/boolean_state_configuration/integration.h b/components/esp_matter/data_model_provider/clusters/boolean_state_configuration/integration.h index 40955b213..cb97bed5a 100644 --- a/components/esp_matter/data_model_provider/clusters/boolean_state_configuration/integration.h +++ b/components/esp_matter/data_model_provider/clusters/boolean_state_configuration/integration.h @@ -48,7 +48,7 @@ inline CHIP_ERROR SetAlarmsActive(EndpointId ep, BitMask alarms VerifyOrReturnError(cluster != nullptr, CHIP_ERROR_NO_ENDPOINT); auto status = cluster->SetAlarmsActive(alarms); 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) @@ -57,7 +57,7 @@ inline CHIP_ERROR SetAllEnabledAlarmsActive(EndpointId ep) VerifyOrReturnError(cluster != nullptr, CHIP_ERROR_NO_ENDPOINT); auto status = cluster->SetAllEnabledAlarmsActive(); 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) @@ -74,7 +74,7 @@ inline CHIP_ERROR SuppressAlarms(EndpointId ep, BitMaskSuppressAlarms(alarms); 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) diff --git a/components/esp_matter/data_model_provider/clusters/chime/integration.h b/components/esp_matter/data_model_provider/clusters/chime/integration.h index 2e3e3bb39..aa3d063a3 100644 --- a/components/esp_matter/data_model_provider/clusters/chime/integration.h +++ b/components/esp_matter/data_model_provider/clusters/chime/integration.h @@ -54,23 +54,35 @@ public: * 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. */ - Protocols::InteractionModel::Status SetEnabled(bool enabled) { return mCluster.Cluster().SetEnabled(enabled); } + Protocols::InteractionModel::Status SetEnabled(bool enabled) + { + return mCluster.Cluster().SetEnabled(enabled); + } // Attribute Getters /** * @return The Current SelectedChime. */ - uint8_t GetSelectedChime() const { return mCluster.Cluster().GetSelectedChime(); } + uint8_t GetSelectedChime() const + { + return mCluster.Cluster().GetSelectedChime(); + } /** * @return The Enabled attribute.. */ - bool GetEnabled() const { return mCluster.Cluster().GetEnabled(); } + bool GetEnabled() const + { + return mCluster.Cluster().GetEnabled(); + } /** * @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 static constexpr uint8_t kMaxChimeSoundNameSize = ChimeCluster::kMaxChimeSoundNameSize; diff --git a/components/esp_matter/data_model_provider/clusters/descriptor/integration.cpp b/components/esp_matter/data_model_provider/clusters/descriptor/integration.cpp index c525c5c9a..4fd8edf2d 100644 --- a/components/esp_matter/data_model_provider/clusters/descriptor/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/descriptor/integration.cpp @@ -35,28 +35,25 @@ namespace { * 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. */ -class ESPMatterDescriptorCluster : public DescriptorCluster -{ +class ESPMatterDescriptorCluster : public DescriptorCluster { public: ESPMatterDescriptorCluster(EndpointId endpointId, DescriptorCluster::OptionalAttributesSet optionalAttributeSet) : DescriptorCluster(endpointId, optionalAttributeSet, Span()) {} - CHIP_ERROR Attributes(const ConcreteClusterPath & path, ReadOnlyBufferBuilder & builder) override + CHIP_ERROR Attributes(const ConcreteClusterPath &path, ReadOnlyBufferBuilder &builder) override { - if (!mFetchedSemanticTags) - { + if (!mFetchedSemanticTags) { ReturnErrorOnFailure(GetSemanticTag(path.mEndpointId, mSemanticTags)); mFetchedSemanticTags = true; } return DescriptorCluster::Attributes(path, builder); } - DataModel::ActionReturnStatus ReadAttribute(const DataModel::ReadAttributeRequest & request, - AttributeValueEncoder & encoder) override + DataModel::ActionReturnStatus ReadAttribute(const DataModel::ReadAttributeRequest &request, + AttributeValueEncoder &encoder) override { - if (!mFetchedSemanticTags) - { + if (!mFetchedSemanticTags) { ReturnErrorOnFailure(GetSemanticTag(request.path.mEndpointId, mSemanticTags)); mFetchedSemanticTags = true; } diff --git a/components/esp_matter/data_model_provider/clusters/device_energy_management/integration.cpp b/components/esp_matter/data_model_provider/clusters/device_energy_management/integration.cpp index a7f8c15c2..ec2fba829 100644 --- a/components/esp_matter/data_model_provider/clusters/device_energy_management/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/device_energy_management/integration.cpp @@ -23,7 +23,7 @@ namespace app { namespace Clusters { namespace DeviceEnergyManagement { -Instance::Instance(EndpointId aEndpointId, Delegate & aDelegate, BitMask aFeature) : +Instance::Instance(EndpointId aEndpointId, Delegate &aDelegate, BitMask aFeature) : 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()); - if (err != CHIP_NO_ERROR) - { + if (err != CHIP_NO_ERROR) { ChipLogError(AppServer, "Failed to register cluster %u/" ChipLogFormatMEI ": %" CHIP_ERROR_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()); - if (err != CHIP_NO_ERROR) - { + if (err != CHIP_NO_ERROR) { ChipLogError(AppServer, "Failed to unregister cluster %u/" ChipLogFormatMEI ": %" CHIP_ERROR_FORMAT, mCluster.Cluster().GetPaths()[0].mEndpointId, ChipLogValueMEI(DeviceEnergyManagement::Id), err.Format()); } diff --git a/components/esp_matter/data_model_provider/clusters/device_energy_management/integration.h b/components/esp_matter/data_model_provider/clusters/device_energy_management/integration.h index ee9304c5c..357f851c2 100644 --- a/components/esp_matter/data_model_provider/clusters/device_energy_management/integration.h +++ b/components/esp_matter/data_model_provider/clusters/device_energy_management/integration.h @@ -19,10 +19,9 @@ namespace chip::app::Clusters::DeviceEnergyManagement { -class Instance -{ +class Instance { public: - Instance(EndpointId aEndpointId, Delegate & aDelegate, BitMask aFeature); + Instance(EndpointId aEndpointId, Delegate &aDelegate, BitMask aFeature); CHIP_ERROR Init(); void Shutdown(); diff --git a/components/esp_matter/data_model_provider/clusters/electrical_energy_measurement/integration.cpp b/components/esp_matter/data_model_provider/clusters/electrical_energy_measurement/integration.cpp index 9e5512749..0e3a9a654 100644 --- a/components/esp_matter/data_model_provider/clusters/electrical_energy_measurement/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/electrical_energy_measurement/integration.cpp @@ -35,7 +35,7 @@ uint32_t get_feature_map(esp_matter::cluster_t *cluster) if (attribute) { esp_matter_attr_val_t val = esp_matter_invalid(nullptr); 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; } } @@ -136,7 +136,7 @@ void ESPMatterElectricalEnergyMeasurementClusterServerShutdownCallback(EndpointI { VerifyOrReturn(gServers[endpointId].IsConstructed()); 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) { ChipLogError(AppServer, "Failed to unregister AccessControl - Error %" CHIP_ERROR_FORMAT, err.Format()); } diff --git a/components/esp_matter/data_model_provider/clusters/electrical_energy_measurement/integration.h b/components/esp_matter/data_model_provider/clusters/electrical_energy_measurement/integration.h index 8e3ea7653..8b13661b0 100644 --- a/components/esp_matter/data_model_provider/clusters/electrical_energy_measurement/integration.h +++ b/components/esp_matter/data_model_provider/clusters/electrical_energy_measurement/integration.h @@ -18,15 +18,15 @@ namespace chip::app::Clusters::ElectricalEnergyMeasurement { -bool NotifyCumulativeEnergyMeasured(EndpointId endpointId, const Optional & energyImported, - const Optional & energyExported); +bool NotifyCumulativeEnergyMeasured(EndpointId endpointId, const Optional &energyImported, + const Optional &energyExported); -bool NotifyPeriodicEnergyMeasured(EndpointId endpointId, const Optional & energyImported, - const Optional & energyExported); +bool NotifyPeriodicEnergyMeasured(EndpointId endpointId, const Optional &energyImported, + const Optional &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 & cumulativeReset); +CHIP_ERROR SetCumulativeReset(EndpointId endpointId, const Optional &cumulativeReset); const ElectricalEnergyMeasurement::MeasurementData * MeasurementDataForEndpoint(EndpointId endpointId); diff --git a/components/esp_matter/data_model_provider/clusters/electrical_power_measurement/integration.cpp b/components/esp_matter/data_model_provider/clusters/electrical_power_measurement/integration.cpp index 9b3088631..1d6e1f051 100644 --- a/components/esp_matter/data_model_provider/clusters/electrical_power_measurement/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/electrical_power_measurement/integration.cpp @@ -28,22 +28,22 @@ ElectricalPowerMeasurementCluster::OptionalAttributesSet Instance::FromLegacyOpt attrs.Set(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeRanges)); attrs.Set(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeVoltage)); attrs.Set( - aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeActiveCurrent)); + aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeActiveCurrent)); attrs.Set( - aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeReactiveCurrent)); + aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeReactiveCurrent)); attrs.Set( - aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeApparentCurrent)); + aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeApparentCurrent)); attrs.Set( - aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeReactivePower)); + aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeReactivePower)); attrs.Set( - aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeApparentPower)); + aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeApparentPower)); attrs.Set(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeRMSVoltage)); attrs.Set(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeRMSCurrent)); attrs.Set(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeRMSPower)); attrs.Set(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeFrequency)); attrs.Set(aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributePowerFactor)); attrs.Set( - aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeNeutralCurrent)); + aOptionalAttributes.Has(OptionalAttributes::kOptionalAttributeNeutralCurrent)); return attrs; } diff --git a/components/esp_matter/data_model_provider/clusters/electrical_power_measurement/integration.h b/components/esp_matter/data_model_provider/clusters/electrical_power_measurement/integration.h index a64a425e4..62baad9f2 100644 --- a/components/esp_matter/data_model_provider/clusters/electrical_power_measurement/integration.h +++ b/components/esp_matter/data_model_provider/clusters/electrical_power_measurement/integration.h @@ -20,8 +20,7 @@ namespace chip::app::Clusters::ElectricalPowerMeasurement { -enum class OptionalAttributes : uint32_t -{ +enum class OptionalAttributes : uint32_t { kOptionalAttributeRanges = 0x1, kOptionalAttributeVoltage = 0x2, kOptionalAttributeActiveCurrent = 0x4, @@ -37,17 +36,16 @@ enum class OptionalAttributes : uint32_t kOptionalAttributeNeutralCurrent = 0x1000, }; -class Instance -{ +class Instance { public: - Instance(EndpointId aEndpointId, Delegate & aDelegate, BitMask aFeature, + Instance(EndpointId aEndpointId, Delegate &aDelegate, BitMask aFeature, BitMask aOptionalAttributes) : mCluster(ElectricalPowerMeasurementCluster::Config{ - .endpointId = aEndpointId, - .delegate = aDelegate, - .features = aFeature, - .optionalAttributes = FromLegacyOptionalAttributes(aOptionalAttributes), - }) + .endpointId = aEndpointId, + .delegate = aDelegate, + .features = aFeature, + .optionalAttributes = FromLegacyOptionalAttributes(aOptionalAttributes), + }) {} CHIP_ERROR Init(); diff --git a/components/esp_matter/data_model_provider/clusters/ethernet_network_diagnostics/integration.cpp b/components/esp_matter/data_model_provider/clusters/ethernet_network_diagnostics/integration.cpp index c89cf43b3..d74106468 100644 --- a/components/esp_matter/data_model_provider/clusters/ethernet_network_diagnostics/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/ethernet_network_diagnostics/integration.cpp @@ -32,7 +32,7 @@ uint32_t get_feature_map(esp_matter::cluster_t *cluster) if (attribute) { esp_matter_attr_val_t val = esp_matter_invalid(nullptr); 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; } } @@ -82,7 +82,7 @@ void ESPMatterEthernetNetworkDiagnosticsClusterServerShutdownCallback(EndpointId ClusterShutdownType shutdownType) { 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) { ChipLogError(AppServer, "Failed to unregister EthernetNetworkDiagnostics on endpoint %u - Error: %" CHIP_ERROR_FORMAT, diff --git a/components/esp_matter/data_model_provider/clusters/general_commissioning/integration.cpp b/components/esp_matter/data_model_provider/clusters/general_commissioning/integration.cpp index e4b538b97..a4a75f3d3 100644 --- a/components/esp_matter/data_model_provider/clusters/general_commissioning/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/general_commissioning/integration.cpp @@ -44,18 +44,18 @@ GeneralCommissioningCluster * Instance() if (!gServer.IsConstructed()) { gServer.Create( - GeneralCommissioningCluster::Context { - .commissioningWindowManager = Server::GetInstance().GetCommissioningWindowManager(), // - .configurationManager = DeviceLayer::ConfigurationMgr(), // - .deviceControlServer = DeviceLayer::DeviceControlServer::DeviceControlSvr(), // - .fabricTable = Server::GetInstance().GetFabricTable(), // - .failsafeContext = Server::GetInstance().GetFailSafeContext(), // - .platformManager = DeviceLayer::PlatformMgr(), // + GeneralCommissioningCluster::Context { + .commissioningWindowManager = Server::GetInstance().GetCommissioningWindowManager(), // + .configurationManager = DeviceLayer::ConfigurationMgr(), // + .deviceControlServer = DeviceLayer::DeviceControlServer::DeviceControlSvr(), // + .fabricTable = Server::GetInstance().GetFabricTable(), // + .failsafeContext = Server::GetInstance().GetFailSafeContext(), // + .platformManager = DeviceLayer::PlatformMgr(), // #if CHIP_CONFIG_TERMS_AND_CONDITIONS_REQUIRED - .termsAndConditionsProvider = TermsAndConditionsManager::GetInstance(), + .termsAndConditionsProvider = TermsAndConditionsManager::GetInstance(), #endif // CHIP_CONFIG_TERMS_AND_CONDITIONS_REQUIRED - }, - optionalAttrs); + }, + optionalAttrs); } return &gServer.Cluster(); @@ -75,18 +75,18 @@ void ESPMatterGeneralCommissioningClusterServerInitCallback(EndpointId endpointI if (!gServer.IsConstructed()) { gServer.Create( - GeneralCommissioningCluster::Context { - .commissioningWindowManager = Server::GetInstance().GetCommissioningWindowManager(), // - .configurationManager = DeviceLayer::ConfigurationMgr(), // - .deviceControlServer = DeviceLayer::DeviceControlServer::DeviceControlSvr(), // - .fabricTable = Server::GetInstance().GetFabricTable(), // - .failsafeContext = Server::GetInstance().GetFailSafeContext(), // - .platformManager = DeviceLayer::PlatformMgr(), // + GeneralCommissioningCluster::Context { + .commissioningWindowManager = Server::GetInstance().GetCommissioningWindowManager(), // + .configurationManager = DeviceLayer::ConfigurationMgr(), // + .deviceControlServer = DeviceLayer::DeviceControlServer::DeviceControlSvr(), // + .fabricTable = Server::GetInstance().GetFabricTable(), // + .failsafeContext = Server::GetInstance().GetFailSafeContext(), // + .platformManager = DeviceLayer::PlatformMgr(), // #if CHIP_CONFIG_TERMS_AND_CONDITIONS_REQUIRED - .termsAndConditionsProvider = TermsAndConditionsManager::GetInstance(), + .termsAndConditionsProvider = TermsAndConditionsManager::GetInstance(), #endif // CHIP_CONFIG_TERMS_AND_CONDITIONS_REQUIRED - }, - optionalAttrs); + }, + optionalAttrs); } CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Register(gServer.Registration()); diff --git a/components/esp_matter/data_model_provider/clusters/general_diagnostics/integration.cpp b/components/esp_matter/data_model_provider/clusters/general_diagnostics/integration.cpp index 042c230b1..73953a366 100644 --- a/components/esp_matter/data_model_provider/clusters/general_diagnostics/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/general_diagnostics/integration.cpp @@ -103,7 +103,7 @@ void ESPMatterGeneralDiagnosticsClusterServerInitCallback(EndpointId endpointId) CHIP_ERROR err = CHIP_NO_ERROR; if (IsCommandEnabled(endpointId, GeneralDiagnostics::Commands::PayloadTestRequest::Id, COMMAND_FLAG_ACCEPTED) || - IsClusterEnabled(endpointId, TimeSynchronization::Id)) { + IsClusterEnabled(endpointId, TimeSynchronization::Id)) { gServer.isFullConfigurable = true; GeneralDiagnosticsFunctionsConfig functionsConfig{ /* @@ -114,9 +114,9 @@ void ESPMatterGeneralDiagnosticsClusterServerInitCallback(EndpointId endpointId) 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( - gServer.fullConfigurableServer.Registration()); + gServer.fullConfigurableServer.Registration()); } else { gServer.server.Create(attrSet, featureFlags, InteractionModelEngine::GetInstance()); 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; if (gServer.isFullConfigurable) { err = esp_matter::data_model::provider::get_instance().registry().Unregister( - &gServer.fullConfigurableServer.Cluster()); + &gServer.fullConfigurableServer.Cluster()); gServer.fullConfigurableServer.Destroy(); } else { err = esp_matter::data_model::provider::get_instance().registry().Unregister(&gServer.server.Cluster()); diff --git a/components/esp_matter/data_model_provider/clusters/general_diagnostics/integration.h b/components/esp_matter/data_model_provider/clusters/general_diagnostics/integration.h index a0432cf23..63a79418c 100644 --- a/components/esp_matter/data_model_provider/clusters/general_diagnostics/integration.h +++ b/components/esp_matter/data_model_provider/clusters/general_diagnostics/integration.h @@ -19,12 +19,12 @@ namespace chip::app::Clusters::GeneralDiagnostics { void GlobalNotifyDeviceReboot(GeneralDiagnostics::BootReasonEnum bootReason); -void GlobalNotifyHardwareFaultsDetect(const DeviceLayer::GeneralFaults & previous, - const DeviceLayer::GeneralFaults & current); +void GlobalNotifyHardwareFaultsDetect(const DeviceLayer::GeneralFaults &previous, + const DeviceLayer::GeneralFaults ¤t); -void GlobalNotifyRadioFaultsDetect(const DeviceLayer::GeneralFaults & previous, - const DeviceLayer::GeneralFaults & current); +void GlobalNotifyRadioFaultsDetect(const DeviceLayer::GeneralFaults &previous, + const DeviceLayer::GeneralFaults ¤t); -void GlobalNotifyNetworkFaultsDetect(const DeviceLayer::GeneralFaults & previous, - const DeviceLayer::GeneralFaults & current); +void GlobalNotifyNetworkFaultsDetect(const DeviceLayer::GeneralFaults &previous, + const DeviceLayer::GeneralFaults ¤t); } // namespace chip::app::Clusters::GeneralDiagnostics diff --git a/components/esp_matter/data_model_provider/clusters/groupcast/integration.cpp b/components/esp_matter/data_model_provider/clusters/groupcast/integration.cpp index 445ac37a3..da2a46822 100644 --- a/components/esp_matter/data_model_provider/clusters/groupcast/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/groupcast/integration.cpp @@ -31,7 +31,7 @@ LazyRegisteredServerCluster gServer; void ESPMatterGroupcastClusterServerInitCallback(chip::EndpointId endpointId) { VerifyOrDie(endpointId == chip::kRootEndpointId); - + // 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. chip::BitFlags feature; diff --git a/components/esp_matter/data_model_provider/clusters/icd_management/integration.cpp b/components/esp_matter/data_model_provider/clusters/icd_management/integration.cpp index 37e8e609b..eba9c0061 100644 --- a/components/esp_matter/data_model_provider/clusters/icd_management/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/icd_management/integration.cpp @@ -62,10 +62,10 @@ CHIP_ERROR GetClusterConfig(EndpointId endpointId, ICDManagementCluster::Optiona } esp_matter_attr_val_t attr_val; 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(attr_val.val.u32); 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); instructionSpan.reduce_size(attr_val.val.a.s); optionalAttrSet.Set(); diff --git a/components/esp_matter/data_model_provider/clusters/identify/integration.cpp b/components/esp_matter/data_model_provider/clusters/identify/integration.cpp index c1936ac67..a84414166 100644 --- a/components/esp_matter/data_model_provider/clusters/identify/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/identify/integration.cpp @@ -86,7 +86,10 @@ public: } } } - bool IsTriggerEffectEnabled() const override { return true; } + bool IsTriggerEffectEnabled() const override + { + return true; + } }; IdentifyLegacyDelegate gLegacyDelegate; @@ -140,16 +143,16 @@ Identify::Identify(EndpointId endpoint, onIdentifyStartCb onIdentifyStart, onIde , mCurrentEffectIdentifier(effectIdentifier) , mEffectVariant(effectVariant) , mCluster( - chip::app::Clusters::IdentifyCluster::Config(endpoint, timerDelegate ? *timerDelegate : sDefaultTimerDelegate) - .WithIdentifyType(identifyType) - .WithDelegate(&gLegacyDelegate) - .WithEffectIdentifier(effectIdentifier) - .WithEffectVariant(effectVariant)) + chip::app::Clusters::IdentifyCluster::Config(endpoint, timerDelegate ? * timerDelegate : sDefaultTimerDelegate) + .WithIdentifyType(identifyType) + .WithDelegate(&gLegacyDelegate) + .WithEffectIdentifier(effectIdentifier) + .WithEffectVariant(effectVariant)) { RegisterLegacyIdentify(this); 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); } }; @@ -157,7 +160,7 @@ Identify::Identify(EndpointId endpoint, onIdentifyStartCb onIdentifyStart, onIde Identify::~Identify() { 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"); } UnregisterLegacyIdentify(this); @@ -165,7 +168,7 @@ Identify::~Identify() 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) diff --git a/components/esp_matter/data_model_provider/clusters/localization_configuration/integration.cpp b/components/esp_matter/data_model_provider/clusters/localization_configuration/integration.cpp index 61cdc5e3c..90d8d8c3a 100644 --- a/components/esp_matter/data_model_provider/clusters/localization_configuration/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/localization_configuration/integration.cpp @@ -36,11 +36,11 @@ void ESPMatterLocalizationConfigurationClusterServerInitCallback(EndpointId endp return; } 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; 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.val.a.s <= LocalizationConfiguration::Attributes::ActiveLocale::TypeInfo::MaxLength()) { + attr_val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING && + attr_val.val.a.s <= LocalizationConfiguration::Attributes::ActiveLocale::TypeInfo::MaxLength()) { 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)); diff --git a/components/esp_matter/data_model_provider/clusters/network_commissioning/integration.cpp b/components/esp_matter/data_model_provider/clusters/network_commissioning/integration.cpp index d9477aee3..a170a4b7b 100644 --- a/components/esp_matter/data_model_provider/clusters/network_commissioning/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/network_commissioning/integration.cpp @@ -46,14 +46,13 @@ constexpr size_t kEthernetNetworkCommissioningClusterCount = 0; #endif constexpr size_t kNetworkCommissioningClusterCount = kThreadNetworkCommissioningClusterCount + - kWifiNetworkCommissioningClusterCount + kEthernetNetworkCommissioningClusterCount; + kWifiNetworkCommissioningClusterCount + kEthernetNetworkCommissioningClusterCount; static_assert(kNetworkCommissioningClusterCount > 0, "NetworkCommissioningCluster count must be more than 0"); LazyRegisteredServerCluster gServers[kNetworkCommissioningClusterCount]; -class ESPMatterGeneralCommissioningBreadcrumbTracker : public BreadCrumbTracker -{ +class ESPMatterGeneralCommissioningBreadcrumbTracker : public BreadCrumbTracker { public: void SetBreadCrumb(uint64_t value) override { diff --git a/components/esp_matter/data_model_provider/clusters/occupancy_sensing/integration.cpp b/components/esp_matter/data_model_provider/clusters/occupancy_sensing/integration.cpp index fa98bf557..d8c2de46d 100644 --- a/components/esp_matter/data_model_provider/clusters/occupancy_sensing/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/occupancy_sensing/integration.cpp @@ -45,7 +45,7 @@ OccupancySensing::Feature getFeature(EndpointId endpointId) esp_matter::attribute::get(endpointId, OccupancySensing::Id, Globals::Attributes::FeatureMap::Id); esp_matter_attr_val_t val = esp_matter_invalid(nullptr); 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(val.val.u32); } return static_cast(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 // market. 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); // Show deprecated attributes if enabled in Zap config.WithDeprecatedAttributes( - esp_matter::endpoint::is_attribute_enabled(endpointId, OccupancySensing::Id, - Attributes::PIROccupiedToUnoccupiedDelay::Id) || - esp_matter::endpoint::is_attribute_enabled(endpointId, OccupancySensing::Id, - Attributes::UltrasonicOccupiedToUnoccupiedDelay::Id) || - esp_matter::endpoint::is_attribute_enabled(endpointId, OccupancySensing::Id, - Attributes::PhysicalContactOccupiedToUnoccupiedDelay::Id)); + esp_matter::endpoint::is_attribute_enabled(endpointId, OccupancySensing::Id, + Attributes::PIROccupiedToUnoccupiedDelay::Id) || + esp_matter::endpoint::is_attribute_enabled(endpointId, OccupancySensing::Id, + Attributes::UltrasonicOccupiedToUnoccupiedDelay::Id) || + esp_matter::endpoint::is_attribute_enabled(endpointId, OccupancySensing::Id, + Attributes::PhysicalContactOccupiedToUnoccupiedDelay::Id)); } gServers[endpointId].Create(config); CHIP_ERROR err = @@ -93,7 +94,7 @@ void ESPMatterOccupancySensingClusterServerShutdownCallback(EndpointId endpointI return; } 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) { ChipLogError(AppServer, "Failed to unregister OccupancySensing - Error %" CHIP_ERROR_FORMAT, err.Format()); } diff --git a/components/esp_matter/data_model_provider/clusters/operational_credentials/integration.cpp b/components/esp_matter/data_model_provider/clusters/operational_credentials/integration.cpp index 4abdb7d8c..4393df5dc 100644 --- a/components/esp_matter/data_model_provider/clusters/operational_credentials/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/operational_credentials/integration.cpp @@ -34,7 +34,8 @@ void ESPMatterOperationalCredentialsClusterServerInitCallback(EndpointId endpoin .sessionManager = Server::GetInstance().GetSecureSessionManager(), .dnssdServer = app::DnssdServer::Instance(), .commissioningWindowManager = - Server::GetInstance().GetCommissioningWindowManager()}; + Server::GetInstance().GetCommissioningWindowManager() + }; gServer.Create(endpoint, context); CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Register(gServer.Registration()); if (err != CHIP_NO_ERROR) { diff --git a/components/esp_matter/data_model_provider/clusters/power_topology/integration.cpp b/components/esp_matter/data_model_provider/clusters/power_topology/integration.cpp index c7606defb..933c0c83c 100644 --- a/components/esp_matter/data_model_provider/clusters/power_topology/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/power_topology/integration.cpp @@ -38,8 +38,7 @@ CHIP_ERROR Instance::Init() void Instance::Shutdown() { 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()); } } diff --git a/components/esp_matter/data_model_provider/clusters/power_topology/integration.h b/components/esp_matter/data_model_provider/clusters/power_topology/integration.h index 61071e5c4..c50e8eebb 100644 --- a/components/esp_matter/data_model_provider/clusters/power_topology/integration.h +++ b/components/esp_matter/data_model_provider/clusters/power_topology/integration.h @@ -20,17 +20,19 @@ namespace chip::app::Clusters::PowerTopology { -class Instance -{ +class Instance { public: - Instance(EndpointId aEndpointId, Delegate & aDelegate, BitMask aFeature) : + Instance(EndpointId aEndpointId, Delegate &aDelegate, BitMask aFeature) : mCluster(PowerTopologyCluster::Config{ - .endpointId = aEndpointId, - .delegate = aDelegate, - .features = aFeature, - }) + .endpointId = aEndpointId, + .delegate = aDelegate, + .features = aFeature, + }) {} - ~Instance() { Shutdown(); } + ~Instance() + { + Shutdown(); + } CHIP_ERROR Init(); void Shutdown(); diff --git a/components/esp_matter/data_model_provider/clusters/scenes_management/attribute_value_pair_validator.cpp b/components/esp_matter/data_model_provider/clusters/scenes_management/attribute_value_pair_validator.cpp index c22bcc0e3..1c17528ff 100644 --- a/components/esp_matter/data_model_provider/clusters/scenes_management/attribute_value_pair_validator.cpp +++ b/components/esp_matter/data_model_provider/clusters/scenes_management/attribute_value_pair_validator.cpp @@ -65,22 +65,30 @@ typename app::NumericAttributeTraits::WorkingType ConvertDefaultValueToWor bool IsExactlyOneValuePopulated(const AttributeValuePairType &type) { int count = 0; - if (type.valueUnsigned8.HasValue()) + if (type.valueUnsigned8.HasValue()) { count++; - if (type.valueSigned8.HasValue()) + } + if (type.valueSigned8.HasValue()) { count++; - if (type.valueUnsigned16.HasValue()) + } + if (type.valueUnsigned16.HasValue()) { count++; - if (type.valueSigned16.HasValue()) + } + if (type.valueSigned16.HasValue()) { count++; - if (type.valueUnsigned32.HasValue()) + } + if (type.valueUnsigned32.HasValue()) { count++; - if (type.valueSigned32.HasValue()) + } + if (type.valueSigned32.HasValue()) { count++; - if (type.valueUnsigned64.HasValue()) + } + if (type.valueUnsigned64.HasValue()) { count++; - if (type.valueSigned64.HasValue()) + } + if (type.valueSigned64.HasValue()) { count++; + } return count == 1; } diff --git a/components/esp_matter/data_model_provider/clusters/scenes_management/integration.cpp b/components/esp_matter/data_model_provider/clusters/scenes_management/integration.cpp index 88c78aec2..f4a132046 100644 --- a/components/esp_matter/data_model_provider/clusters/scenes_management/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/scenes_management/integration.cpp @@ -40,9 +40,15 @@ public: mEndpointId = endpointId; 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 {} private: @@ -189,13 +195,13 @@ void ESPMatterScenesManagementClusterServerInitCallback(EndpointId endpointId) } gTableProviders[endpointId].SetParameters(endpointId, tableSize); gServers[endpointId].Create(endpointId, - ScenesManagementCluster::Context{ - .groupDataProvider = Credentials::GetGroupDataProvider(), - .fabricTable = &Server::GetInstance().GetFabricTable(), - .features = featureMap, - .sceneTableProvider = gTableProviders[endpointId], - .supportsCopyScene = supportsCopyScene, - }); + ScenesManagementCluster::Context{ + .groupDataProvider = Credentials::GetGroupDataProvider(), + .fabricTable = &Server::GetInstance().GetFabricTable(), + .features = featureMap, + .sceneTableProvider = gTableProviders[endpointId], + .supportsCopyScene = supportsCopyScene, + }); CHIP_ERROR err = esp_matter::data_model::provider::get_instance().registry().Register(gServers[endpointId].Registration()); if (err != CHIP_NO_ERROR) { @@ -210,7 +216,7 @@ void ESPMatterScenesManagementClusterServerShutdownCallback(EndpointId endpointI return; } 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) { ChipLogError(AppServer, "Failed to register Scenes on endpoint %u - Error: %" CHIP_ERROR_FORMAT, endpointId, err.Format()); diff --git a/components/esp_matter/data_model_provider/clusters/scenes_management/integration.h b/components/esp_matter/data_model_provider/clusters/scenes_management/integration.h index 25ab19e3e..e91a3df7c 100644 --- a/components/esp_matter/data_model_provider/clusters/scenes_management/integration.h +++ b/components/esp_matter/data_model_provider/clusters/scenes_management/integration.h @@ -21,8 +21,7 @@ namespace chip::app::Clusters::ScenesManagement { -class ScenesServer -{ +class ScenesServer { public: static constexpr SceneId kGlobalSceneId = 0x00; static constexpr GroupId kGlobalSceneGroupId = 0x0000; @@ -30,7 +29,7 @@ public: ScenesServer() = default; ~ScenesServer() = default; - static ScenesServer & Instance(); + static ScenesServer &Instance(); // Callbacks void GroupWillBeRemoved(FabricIndex aFabricIx, EndpointId aEndpointId, GroupId aGroupId); diff --git a/components/esp_matter/data_model_provider/clusters/time_format_localization/integration.cpp b/components/esp_matter/data_model_provider/clusters/time_format_localization/integration.cpp index 5eccb5817..120e30eb4 100644 --- a/components/esp_matter/data_model_provider/clusters/time_format_localization/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/time_format_localization/integration.cpp @@ -32,7 +32,7 @@ uint32_t get_feature_map(esp_matter::cluster_t *cluster) if (attribute) { esp_matter_attr_val_t val = esp_matter_invalid(nullptr); 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; } } @@ -46,7 +46,7 @@ TimeFormatLocalization::HourFormatEnum get_default_hour_format(esp_matter::clust if (attribute) { esp_matter_attr_val_t val = esp_matter_invalid(nullptr); 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); } } @@ -60,7 +60,7 @@ TimeFormatLocalization::CalendarTypeEnum get_default_calendar_type(esp_matter::c if (attribute) { esp_matter_attr_val_t val = esp_matter_invalid(nullptr); 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); } } diff --git a/components/esp_matter/data_model_provider/clusters/time_synchronization/integration.cpp b/components/esp_matter/data_model_provider/clusters/time_synchronization/integration.cpp index 8dd8173f6..256908a1e 100644 --- a/components/esp_matter/data_model_provider/clusters/time_synchronization/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/time_synchronization/integration.cpp @@ -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); if (!attr) { - return ESP_FAIL; + return ESP_FAIL; } 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_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); featureMap = BitFlags(feature_val.val.u32); esp_matter_attr_val_t attr_val; if (featureMap.Has(Feature::kNTPClient) || featureMap.Has(Feature::kNTPServer)) { 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); if (featureMap.Has(Feature::kNTPClient)) { startupConfig.supportsDNSResolve = attr_val.val.b; @@ -69,14 +69,14 @@ esp_err_t GetClusterConfig(EndpointId endpointId, TimeSynchronizationCluster::Op } if (featureMap.Has(Feature::kTimeZone)) { 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); - 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 && - attr_val.type == ESP_MATTER_VAL_TYPE_ENUM8) { + if (get_attr_val(cluster, Attributes::TimeSource::Id, attr_val) == ESP_OK && + attr_val.type == ESP_MATTER_VAL_TYPE_ENUM8) { attrSet.Set(); - startupConfig.timeSource = (TimeSourceEnum)attr_val.val.u8; + startupConfig.timeSource = (TimeSourceEnum)attr_val.val.u8; } startupConfig.delegate = GetDefaultDelegate(); return ESP_OK; @@ -123,8 +123,7 @@ void SetDefaultDelegate(Delegate * delegate) VerifyOrReturn(delegate != nullptr); gDelegate = delegate; auto timeSynchronization = GetClusterInstance(); - if (timeSynchronization != nullptr) - { + if (timeSynchronization != nullptr) { timeSynchronization->SetDelegate(gDelegate); } } @@ -132,12 +131,10 @@ void SetDefaultDelegate(Delegate * delegate) Delegate * GetDefaultDelegate() { auto timeSynchronization = GetClusterInstance(); - if (timeSynchronization != nullptr) - { + if (timeSynchronization != nullptr) { return timeSynchronization->GetDelegate(); } - if (gDelegate == nullptr) - { + if (gDelegate == nullptr) { static DefaultTimeSyncDelegate delegate; gDelegate = &delegate; } diff --git a/components/esp_matter/data_model_provider/clusters/unit_localization/integration.cpp b/components/esp_matter/data_model_provider/clusters/unit_localization/integration.cpp index 281ccf4bb..29243aaa2 100644 --- a/components/esp_matter/data_model_provider/clusters/unit_localization/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/unit_localization/integration.cpp @@ -23,7 +23,7 @@ using namespace chip::app::Clusters::UnitLocalization; namespace chip::app::Clusters::UnitLocalization { -UnitLocalizationServer & UnitLocalizationServer::Instance() +UnitLocalizationServer &UnitLocalizationServer::Instance() { static UnitLocalizationServer mInstance; return mInstance; diff --git a/components/esp_matter/data_model_provider/clusters/unit_localization/integration.h b/components/esp_matter/data_model_provider/clusters/unit_localization/integration.h index 8126462fd..69ce0abed 100644 --- a/components/esp_matter/data_model_provider/clusters/unit_localization/integration.h +++ b/components/esp_matter/data_model_provider/clusters/unit_localization/integration.h @@ -18,10 +18,9 @@ namespace chip::app::Clusters::UnitLocalization { -class UnitLocalizationServer : public UnitLocalizationCluster -{ +class UnitLocalizationServer : public UnitLocalizationCluster { public: - static UnitLocalizationServer & Instance(); + static UnitLocalizationServer &Instance(); }; } diff --git a/components/esp_matter/data_model_provider/clusters/webrtc_transport_provider/integration.cpp b/components/esp_matter/data_model_provider/clusters/webrtc_transport_provider/integration.cpp index b99af25a4..c71e6ca85 100644 --- a/components/esp_matter/data_model_provider/clusters/webrtc_transport_provider/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/webrtc_transport_provider/integration.cpp @@ -21,7 +21,7 @@ void ESPMatterWebRTCTransportProviderClusterServerInitCallback(chip::EndpointId } void ESPMatterWebRTCTransportProviderClusterServerShutdownCallback( - chip::EndpointId endpointId, chip::app::ClusterShutdownType shutdownType) + chip::EndpointId endpointId, chip::app::ClusterShutdownType shutdownType) { } diff --git a/components/esp_matter/data_model_provider/clusters/wifi_network_diagnostic/integration.cpp b/components/esp_matter/data_model_provider/clusters/wifi_network_diagnostic/integration.cpp index ca8cf7981..2e5374d06 100644 --- a/components/esp_matter/data_model_provider/clusters/wifi_network_diagnostic/integration.cpp +++ b/components/esp_matter/data_model_provider/clusters/wifi_network_diagnostic/integration.cpp @@ -57,7 +57,7 @@ uint32_t GetFeatureMap(EndpointId endpointId) void ESPMatterWiFiNetworkDiagnosticsClusterServerInitCallback(EndpointId endpointId) { if (!IsClusterEnabled(endpointId) && gServers[endpointId].IsConstructed()) { - return; + return; } WiFiDiagnosticsServerCluster::OptionalAttributeSet attrSet; if (IsAttributeEnabled(endpointId, WiFiNetworkDiagnostics::Attributes::CurrentMaxRate::Id)) { @@ -71,8 +71,7 @@ void ESPMatterWiFiNetworkDiagnosticsClusterServerInitCallback(EndpointId endpoin BitFlags(GetFeatureMap(endpointId))); 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, 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); - if (err != CHIP_NO_ERROR) - { + if (err != CHIP_NO_ERROR) { ChipLogError(AppServer, "Failed to unregister WiFiNetworkDiagnostics on endpoint %u - Error: %" CHIP_ERROR_FORMAT, endpointId, err.Format()); } diff --git a/components/esp_matter/data_model_provider/esp_matter_attr_data_buffer.cpp b/components/esp_matter/data_model_provider/esp_matter_attr_data_buffer.cpp index 9bd7a212b..862ca187e 100644 --- a/components/esp_matter/data_model_provider/esp_matter_attr_data_buffer.cpp +++ b/components/esp_matter/data_model_provider/esp_matter_attr_data_buffer.cpp @@ -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_LONG_CHAR_STRING: { 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)); 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_LONG_OCTET_STRING: { 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)); break; } diff --git a/components/esp_matter/data_model_provider/esp_matter_attr_data_buffer.h b/components/esp_matter/data_model_provider/esp_matter_attr_data_buffer.h index 4b5032360..cb3b88146 100644 --- a/components/esp_matter/data_model_provider/esp_matter_attr_data_buffer.h +++ b/components/esp_matter/data_model_provider/esp_matter_attr_data_buffer.h @@ -35,16 +35,19 @@ public: ~attribute_data_decode_buffer() { 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_CHAR_STRING || - m_attr_val.type == ESP_MATTER_VAL_TYPE_LONG_CHAR_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_LONG_CHAR_STRING) { if (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); diff --git a/components/esp_matter/data_model_provider/esp_matter_data_model_provider.cpp b/components/esp_matter/data_model_provider/esp_matter_data_model_provider.cpp index da6935032..f90726c44 100644 --- a/components/esp_matter/data_model_provider/esp_matter_data_model_provider.cpp +++ b/components/esp_matter/data_model_provider/esp_matter_data_model_provider.cpp @@ -47,15 +47,17 @@ namespace app { * Accessor class for AttributeValueDecoder to get the TLV reader. * This leverages the existing friend declaration in the SDK's AttributeValueDecoder. */ -class TestOnlyAttributeValueDecoderAccessor -{ +class TestOnlyAttributeValueDecoderAccessor { 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: - AttributeValueDecoder & mDecoder; + AttributeValueDecoder &mDecoder; }; } // namespace app @@ -125,7 +127,7 @@ constexpr ClusterId kCluster[] = GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER; constexpr AttributeId kAttribute[] = GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE; constexpr chip::Access::Privilege kPrivilege[] = GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE; 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"); } // namespace GeneratedAccessReadAttribute #endif @@ -136,7 +138,7 @@ constexpr ClusterId kCluster[] = GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER; constexpr AttributeId kAttribute[] = GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE; constexpr chip::Access::Privilege kPrivilege[] = GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE; 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"); } // namespace GeneratedAccessWriteAttribute #endif @@ -147,7 +149,7 @@ constexpr ClusterId kCluster[] = GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER; constexpr CommandId kCommand[] = GENERATED_ACCESS_INVOKE_COMMAND__COMMAND; constexpr chip::Access::Privilege kPrivilege[] = GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE; 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"); } // namespace GeneratedAccessInvokeCommand #endif @@ -158,7 +160,7 @@ constexpr ClusterId kCluster[] = GENERATED_ACCESS_READ_EVENT__CLUSTER; constexpr EventId kEvent[] = GENERATED_ACCESS_READ_EVENT__EVENT; constexpr chip::Access::Privilege kPrivilege[] = GENERATED_ACCESS_READ_EVENT__PRIVILEGE; 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"); } // namespace GeneratedAccessReadEvent #endif @@ -286,8 +288,8 @@ ActionReturnStatus provider::ReadAttribute(const ReadAttributeRequest &request, attribute::get(request.path.mEndpointId, request.path.mClusterId, request.path.mAttributeId); std::optional aai_result = TryReadViaAccessInterface( - request.path, - AttributeAccessInterfaceRegistry::Instance().Get(request.path.mEndpointId, request.path.mClusterId), encoder); + request.path, + AttributeAccessInterfaceRegistry::Instance().Get(request.path.mEndpointId, request.path.mClusterId), encoder); VerifyOrReturnError(!aai_result.has_value(), *aai_result); 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 esp_matter_attr_val_t new_val = esp_matter_invalid(nullptr); - + VerifyOrReturnValue(attribute, Protocols::InteractionModel::Status::UnsupportedAttribute); - + esp_matter_val_type_t current_val_type = attribute::get_val_type(attribute); - + TestOnlyAttributeValueDecoderAccessor accessor(decoder); TLV::TLVReader reader_copy; reader_copy.Init(accessor.GetReader()); @@ -325,9 +327,9 @@ ActionReturnStatus provider::WriteAttribute(const WriteAttributeRequest &request // Helper to execute POST_UPDATE callback auto execute_post_update = [&]() { - + 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 @@ -415,7 +417,7 @@ std::optional provider::InvokeCommand(const InvokeRequest &r VerifyOrReturnValue(status == Protocols::InteractionModel::Status::Success, CHIP_ERROR_IM_GLOBAL_STATUS_VALUE(status)); CommandHandlerInterface *handler_interface = CommandHandlerInterfaceRegistry::Instance().GetCommandHandler( - request.path.mEndpointId, request.path.mClusterId); + request.path.mEndpointId, request.path.mClusterId); if (handler_interface) { CommandHandlerInterface::HandlerContext context(*handler, request.path, input_arguments); @@ -461,7 +463,7 @@ CHIP_ERROR provider::DeviceTypes(EndpointId endpointId, ReadOnlyBufferBuilderRetrieveAcceptedCommands(path, builder); // 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); BitMask quality_flags; quality_flags - .Set(DataModel::CommandQualityFlags::kFabricScoped, CommandIsFabricScoped(path.mClusterId, command_id)) - .Set(DataModel::CommandQualityFlags::kTimed, CommandNeedsTimedInvoke(path.mClusterId, command_id)) - .Set(DataModel::CommandQualityFlags::kLargeMessage, - CommandHasLargePayload(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::kLargeMessage, + CommandHasLargePayload(path.mClusterId, command_id)); AcceptedCommandEntry entry(command_id, quality_flags, MatterGetAccessPrivilegeForInvokeCommand(path.mClusterId, command_id)); ReturnErrorOnFailure(builder.Append(entry)); @@ -597,7 +599,8 @@ CHIP_ERROR provider::AcceptedCommands(const ConcreteClusterPath &path, static constexpr AttributeId k_global_attributes_not_in_metadata[] = { 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 = 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); chip::Access::Privilege read_privilege = MatterGetAccessPrivilegeForReadAttribute(path.mClusterId, id); auto write_privilege = (flags & ATTRIBUTE_FLAG_WRITABLE) - ? std::make_optional(MatterGetAccessPrivilegeForWriteAttribute(path.mClusterId, id)) - : std::nullopt; + ? std::make_optional(MatterGetAccessPrivilegeForWriteAttribute(path.mClusterId, id)) + : std::nullopt; AttributeEntry entry(id, attr_quality_flags, read_privilege, write_privilege); ReturnErrorOnFailure(builder.Append(entry)); attribute = attribute::get_next(attribute); } // 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], - chip::BitFlags(), chip::Access::Privilege::kView, - std::nullopt); + chip::BitFlags(), chip::Access::Privilege::kView, + std::nullopt); ReturnErrorOnFailure(builder.Append(entry)); } diff --git a/components/esp_matter/data_model_provider/esp_matter_data_model_provider.h b/components/esp_matter/data_model_provider/esp_matter_data_model_provider.h index d3b81402f..0be8837e8 100644 --- a/components/esp_matter/data_model_provider/esp_matter_data_model_provider.h +++ b/components/esp_matter/data_model_provider/esp_matter_data_model_provider.h @@ -68,7 +68,10 @@ public: // access to the typed global singleton of this class. static provider &get_instance(); - chip::app::ServerClusterInterfaceRegistry ®istry() { return mRegistry; } + chip::app::ServerClusterInterfaceRegistry ®istry() + { + return mRegistry; + } /// Generic model implementations CHIP_ERROR Startup(InteractionModelContext context) override; diff --git a/components/esp_matter/data_model_provider/esp_matter_ember_stubs.cpp b/components/esp_matter/data_model_provider/esp_matter_ember_stubs.cpp index fc099fc26..15ca04492 100644 --- a/components/esp_matter/data_model_provider/esp_matter_ember_stubs.cpp +++ b/components/esp_matter/data_model_provider/esp_matter_ember_stubs.cpp @@ -881,7 +881,7 @@ Status emberAfWriteAttribute(const chip::app::ConcreteAttributePath &path, const esp_matter_attr_val_t val = esp_matter_invalid(nullptr); Status status = get_attr_val_from_raw_data_buffer(input.dataPtr, input.dataType, val, esp_matter::attribute::get_flags(attribute) & - esp_matter::ATTRIBUTE_FLAG_NULLABLE); + esp_matter::ATTRIBUTE_FLAG_NULLABLE); if (status != Status::Success) { return status; } @@ -891,10 +891,10 @@ Status emberAfWriteAttribute(const chip::app::ConcreteAttributePath &path, const } if (status == Status::Success) { 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) { input.changeListener->MarkDirty( - chip::app::AttributePathParams(path.mEndpointId, path.mClusterId, path.mAttributeId)); + chip::app::AttributePathParams(path.mEndpointId, path.mClusterId, path.mAttributeId)); } else { chip::app::InteractionModelEngine::GetInstance()->GetReportingEngine().MarkDirty( 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 EmberAfAttributeMinMaxValue sMinMaxValue{EmberAfDefaultAttributeValue(nullptr), - EmberAfDefaultAttributeValue(nullptr), - EmberAfDefaultAttributeValue(nullptr)}; + EmberAfDefaultAttributeValue(nullptr), + EmberAfDefaultAttributeValue(nullptr)}; static EmberAfAttributeMetadata s_metadata{EmberAfDefaultOrMinMaxAttributeValue((uint32_t)0), attributeId, 0, 0, 0}; esp_matter::attribute_t *attribute = esp_matter::attribute::get(endpointId, clusterId, attributeId); diff --git a/components/esp_matter/data_model_provider/esp_matter_plugin_server_init_callbacks.cpp b/components/esp_matter/data_model_provider/esp_matter_plugin_server_init_callbacks.cpp index 81272dcc7..9ffc63add 100644 --- a/components/esp_matter/data_model_provider/esp_matter_plugin_server_init_callbacks.cpp +++ b/components/esp_matter/data_model_provider/esp_matter_plugin_server_init_callbacks.cpp @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. - // Cluster init functions that don't have a cluster implementation to define // them in. void MatterBallastConfigurationPluginServerInitCallback() {} diff --git a/components/esp_matter/esp_matter.h b/components/esp_matter/esp_matter.h index ac69fac11..1bf88eab8 100644 --- a/components/esp_matter/esp_matter.h +++ b/components/esp_matter/esp_matter.h @@ -45,8 +45,7 @@ namespace DeviceEventType { /** * Enumerates platform-specific event types that are visible to the application. */ -enum -{ +enum { /** Signals that Commissioning session has started */ kCommissioningSessionStarted = kRange_PublicPlatformSpecific + 0x1000, /** Signals that Commissioning session has stopped */ diff --git a/components/esp_matter/esp_matter_client.cpp b/components/esp_matter/esp_matter_client.cpp index 131fa2bf0..5ddbe0ea1 100644 --- a/components/esp_matter/esp_matter_client.cpp +++ b/components/esp_matter/esp_matter_client.cpp @@ -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); if (CHIP_NO_ERROR != - chip::app::Clusters::Binding::Manager::GetInstance().NotifyBoundClusterChanged(local_endpoint_id, notified_cluster_id, - static_cast(context))) { + chip::app::Clusters::Binding::Manager::GetInstance().NotifyBoundClusterChanged(local_endpoint_id, notified_cluster_id, + static_cast(context))) { chip::Platform::Delete(context); ESP_LOGE(TAG, "failed to notify the bound cluster changed"); 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(ctx, on_success, on_error); 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(raw_decoder_ptr); }; @@ -294,9 +294,18 @@ public: } private: - void OnReportBegin() override { m_callback.OnReportBegin(); } - void OnReportEnd() override { m_callback.OnReportEnd(); } - void OnError(CHIP_ERROR aError) override { m_callback.OnError(aError); } + void OnReportBegin() override + { + 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 { @@ -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((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()); params.mpAttributePathParamsList = attr_path; 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->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 client.release(); @@ -399,9 +408,9 @@ esp_err_t send_request(client::peer_device_t *remote_device, AttributePathParams ReadClient::Callback &callback) { 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), - 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()); params.mpAttributePathParamsList = attr_path; 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); } 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 client.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); 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, - ESP_FAIL, ESP_LOGE(TAG, "Failed to finalize TLV writer")); + ESP_FAIL, ESP_LOGE(TAG, "Failed to finalize TLV writer")); encoded_len = writer.GetLengthWritten(); reader.Init(encoded_buf, encoded_len); 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, - 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, - 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, - ESP_FAIL, ESP_LOGE(TAG, "Failed to read next")); + ESP_FAIL, ESP_LOGE(TAG, "Failed to read next")); 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; 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(), 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; err = encode_attribute_value(encoded_buf.Get(), k_encoded_buf_size, encodable, attr_val_reader); 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, 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, @@ -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, ESP_LOGE(TAG, "The attr_values array length should be the same as the attr_paths array length")); 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")); auto client_deleter_callback = chip::Platform::MakeUnique(callback); VerifyOrReturnError(client_deleter_callback, ESP_ERR_NO_MEM, diff --git a/components/esp_matter/esp_matter_client.h b/components/esp_matter/esp_matter_client.h index 8eb56fd40..eaf936bf7 100644 --- a/components/esp_matter/esp_matter_client.h +++ b/components/esp_matter/esp_matter_client.h @@ -53,7 +53,7 @@ typedef struct request_handle { */ void *request_data; 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) { command_path = req.command_path; @@ -178,8 +178,7 @@ using chip::TLV::TLVReader; using client::peer_device_t; using chip::app::DataModel::EncodableToTLV; -class custom_encodable_type : public EncodableToTLV -{ +class custom_encodable_type : public EncodableToTLV { public: const char *k_empty_command_data = "{}"; const char *k_null_attribute_data = "null"; @@ -202,9 +201,12 @@ public: 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) { return CHIP_ERROR_INTERNAL; @@ -215,15 +217,17 @@ private: char *m_json_str = NULL; }; -class multiple_write_encodable_type -{ +class multiple_write_encodable_type { public: multiple_write_encodable_type(const char *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) { @@ -242,7 +246,10 @@ public: return CHIP_NO_ERROR; } - size_t GetJsonArraySize() { return static_cast(cJSON_GetArraySize(json)); } + size_t GetJsonArraySize() + { + return static_cast(cJSON_GetArraySize(json)); + } private: cJSON *json = NULL; @@ -269,7 +276,10 @@ public: , 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: 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 &timed_invoke_timeout_ms, const Optional &response_timeout = chip::NullOptional); - esp_err_t send_group_request(const uint8_t fabric_index, const CommandPathParams &command_path, const chip::app::DataModel::EncodableToTLV &encodable); diff --git a/components/esp_matter/esp_matter_core.cpp b/components/esp_matter/esp_matter_core.cpp index 40ec31371..ed0221388 100644 --- a/components/esp_matter/esp_matter_core.cpp +++ b/components/esp_matter/esp_matter_core.cpp @@ -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())); } -class AppDelegateImpl : public AppDelegate -{ +class AppDelegateImpl : public AppDelegate { public: void OnCommissioningSessionStarted() { @@ -108,25 +107,24 @@ public: } }; -class FabricDelegateImpl : public chip::FabricTable::Delegate -{ +class FabricDelegateImpl : public chip::FabricTable::Delegate { public: - void FabricWillBeRemoved(const chip::FabricTable & fabricTable,chip::FabricIndex fabricIndex) + void FabricWillBeRemoved(const chip::FabricTable &fabricTable, chip::FabricIndex fabricIndex) { 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); } - void OnFabricCommitted(const chip::FabricTable & fabricTable, chip::FabricIndex fabricIndex) + void OnFabricCommitted(const chip::FabricTable &fabricTable, chip::FabricIndex fabricIndex) { 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); } @@ -171,7 +169,7 @@ esp_err_t ScopedChipStackLock::chip_stack_unlock() static void deinit_ble_if_commissioned(intptr_t unused) { #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(); } #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; 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, - CHIP_CONFIG_MAX_GROUP_KEYS_PER_FABRIC); + CHIP_CONFIG_MAX_GROUP_KEYS_PER_FABRIC); groupDataProvider.SetStorageDelegate(initParams.persistentStorageDelegate); groupDataProvider.SetSessionKeystore(initParams.sessionKeystore); 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 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()); } 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) { - switch (event->Type) - { + switch (event->Type) { case chip::DeviceLayer::DeviceEventType::kInterfaceIpAddressChanged: #if CHIP_DEVICE_CONFIG_ENABLE_WIFI || CHIP_DEVICE_CONFIG_ENABLE_ETHERNET 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"); return ESP_FAIL; } - if(callback) { + if (callback) { if (PlatformMgr().AddEventHandler(callback, callback_arg) != CHIP_NO_ERROR) { (void)PlatformMgr().StopEventLoopTask(); chip::Platform::MemoryShutdown(); ESP_LOGE(TAG, "Failed to add user callback"); return ESP_FAIL; - } + } } init_thread_stack_and_start_thread_task(); #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 Thread is Provisioned, publish the dns service if (chip::DeviceLayer::ConnectivityMgr().IsThreadProvisioned() && - (chip::Server::GetInstance().GetFabricTable().FabricCount() != 0)) { - PlatformMgr().ScheduleWork([](intptr_t){ chip::app::DnssdServer::Instance().StartServer(); }, - reinterpret_cast(nullptr)); + (chip::Server::GetInstance().GetFabricTable().FabricCount() != 0)) { + PlatformMgr().ScheduleWork([](intptr_t) { + chip::app::DnssdServer::Instance().StartServer(); + }, + reinterpret_cast(nullptr)); } #endif // CONFIG_ESP_MATTER_ENABLE_OPENTHREAD #endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD diff --git a/components/esp_matter/esp_matter_core.h b/components/esp_matter/esp_matter_core.h index 72d28d465..9dfac1f7b 100644 --- a/components/esp_matter/esp_matter_core.h +++ b/components/esp_matter/esp_matter_core.h @@ -134,10 +134,12 @@ typedef enum status { */ class ScopedChipStackLock { public: - ScopedChipStackLock(uint32_t ticks_to_wait) { + ScopedChipStackLock(uint32_t ticks_to_wait) + { status = chip_stack_lock(ticks_to_wait); } - ~ScopedChipStackLock() { + ~ScopedChipStackLock() + { if (status == SUCCESS) { chip_stack_unlock(); } @@ -171,7 +173,7 @@ private: * @return error in case of failure. */ esp_err_t chip_stack_unlock(); -}; +}; } /* lock */ diff --git a/components/esp_matter/esp_matter_icd_configuration.cpp b/components/esp_matter/esp_matter_icd_configuration.cpp index 8c03d9c3e..264587ca4 100644 --- a/components/esp_matter/esp_matter_icd_configuration.cpp +++ b/components/esp_matter/esp_matter_icd_configuration.cpp @@ -62,7 +62,7 @@ public: static esp_err_t SetActiveThreshold(Milliseconds32 activeThreshold) { if (ICDConfigurationData::GetInstance().GetICDMode() == ICDConfigurationData::ICDMode::LIT && - activeThreshold < Milliseconds32(5000)) { + activeThreshold < Milliseconds32(5000)) { return ESP_ERR_INVALID_ARG; } ICDConfigurationData::GetInstance().mActiveThreshold = activeThreshold; @@ -96,13 +96,13 @@ static esp_err_t set_mode_durations(std::optional active_mode_duration std::optional idle_mode_duration_s) { Milliseconds32 active_mode_duration = active_mode_duration_ms.has_value() - ? Milliseconds32(active_mode_duration_ms.value()) - : chip::ICDConfigurationData::GetInstance().GetActiveModeDuration(); + ? Milliseconds32(active_mode_duration_ms.value()) + : chip::ICDConfigurationData::GetInstance().GetActiveModeDuration(); Seconds32 idle_mode_duration = idle_mode_duration_s.has_value() - ? Seconds32(idle_mode_duration_s.value()) - : chip::ICDConfigurationData::GetInstance().GetIdleModeDuration(); + ? Seconds32(idle_mode_duration_s.value()) + : chip::ICDConfigurationData::GetInstance().GetIdleModeDuration(); 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) diff --git a/components/esp_matter/esp_matter_icd_configuration.h b/components/esp_matter/esp_matter_icd_configuration.h index 550d713a6..d6f801e53 100644 --- a/components/esp_matter/esp_matter_icd_configuration.h +++ b/components/esp_matter/esp_matter_icd_configuration.h @@ -34,7 +34,7 @@ typedef struct config { bool get_icd_server_enabled(); /** 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. */ esp_err_t set_configuration_data(config_t *config); diff --git a/components/esp_matter/esp_matter_identify.cpp b/components/esp_matter/esp_matter_identify.cpp index 8e366f3e1..70a18bdbb 100644 --- a/components/esp_matter/esp_matter_identify.cpp +++ b/components/esp_matter/esp_matter_identify.cpp @@ -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) { Identify *identify = chip::Platform::New( - endpoint_id, start_cb, stop_cb, (chip::app::Clusters::Identify::IdentifyTypeEnum)identify_type, effect_cb, - static_cast(effect_identifier), - static_cast(effect_variant)); + endpoint_id, start_cb, stop_cb, (chip::app::Clusters::Identify::IdentifyTypeEnum)identify_type, effect_cb, + static_cast(effect_identifier), + static_cast(effect_variant)); VerifyOrReturnError(identify, ESP_FAIL, ESP_LOGE(TAG, "Fail to create identify object")); #ifdef CONFIG_ESP_MATTER_ENABLE_DATA_MODEL endpoint::set_identify(endpoint_id, (void *)identify); diff --git a/components/esp_matter/esp_matter_identify.h b/components/esp_matter/esp_matter_identify.h index 1d4bc9a88..c81ebf5ef 100644 --- a/components/esp_matter/esp_matter_identify.h +++ b/components/esp_matter/esp_matter_identify.h @@ -42,7 +42,7 @@ typedef enum callback_type { * @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, - void *priv_data); + void *priv_data); /** Set identification callback * @@ -70,8 +70,8 @@ esp_err_t set_callback(callback_t callback); * @return error in case of failure. */ esp_err_t init(uint16_t endpoint_id, uint8_t identify_type, - uint8_t effect_identifier = static_cast(chip::app::Clusters::Identify::EffectIdentifierEnum::kBlink), - uint8_t effect_variant = static_cast(chip::app::Clusters::Identify::EffectVariantEnum::kDefault)); + uint8_t effect_identifier = static_cast(chip::app::Clusters::Identify::EffectIdentifierEnum::kBlink), + uint8_t effect_variant = static_cast(chip::app::Clusters::Identify::EffectVariantEnum::kDefault)); } /* identification */ } /* esp_matter */ diff --git a/components/esp_matter/esp_matter_ota.cpp b/components/esp_matter/esp_matter_ota.cpp index 1e2b3bfdb..58e7ae808 100644 --- a/components/esp_matter/esp_matter_ota.cpp +++ b/components/esp_matter/esp_matter_ota.cpp @@ -120,8 +120,7 @@ esp_err_t esp_matter_ota_requestor_encrypted_init(const char *key, uint16_t size } #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.periodic_query_timeout) { diff --git a/components/esp_matter/esp_matter_ota.h b/components/esp_matter/esp_matter_ota.h index 0721258c4..e358088b1 100644 --- a/components/esp_matter/esp_matter_ota.h +++ b/components/esp_matter/esp_matter_ota.h @@ -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. */ -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); diff --git a/components/esp_matter/utils/esp_matter_mem.cpp b/components/esp_matter/utils/esp_matter_mem.cpp index fa5b4c2b9..c37e8f5ea 100644 --- a/components/esp_matter/utils/esp_matter_mem.cpp +++ b/components/esp_matter/utils/esp_matter_mem.cpp @@ -19,11 +19,11 @@ IRAM_ATTR void *esp_matter_mem_calloc(size_t n, size_t size) { #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 - 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 - 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 return calloc(n, size); #endif diff --git a/components/esp_matter/weak_functions.cpp b/components/esp_matter/weak_functions.cpp index 0d98d1509..2eee1363c 100644 --- a/components/esp_matter/weak_functions.cpp +++ b/components/esp_matter/weak_functions.cpp @@ -34,21 +34,19 @@ __attribute__((weak)) const SupportedModesManager * getSupportedModesManager(voi } /* namespace Clusters */ } /* namespace ModeSelect */ - // Provide weak defaults for attribute changed callbacks so apps // Strong definitions in an app will override these. __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", attributePath.mEndpointId, attributePath.mClusterId, attributePath.mAttributeId); } __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", attributePath.mEndpointId, attributePath.mClusterId, attributePath.mAttributeId); } - diff --git a/components/esp_matter_bridge/esp_matter_bridge.cpp b/components/esp_matter_bridge/esp_matter_bridge.cpp index dc898c59e..1351b0622 100644 --- a/components/esp_matter_bridge/esp_matter_bridge.cpp +++ b/components/esp_matter_bridge/esp_matter_bridge.cpp @@ -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; } err = device_type_callback(bridged_device->endpoint, device_type_id, priv_data); - if (err != ESP_OK) + if (err != ESP_OK) { return err; + } 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; uint8_t 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; } } diff --git a/components/esp_matter_bridge/esp_matter_console_bridge.cpp b/components/esp_matter_bridge/esp_matter_console_bridge.cpp index cdaf4b56e..2442c0754 100644 --- a/components/esp_matter_bridge/esp_matter_console_bridge.cpp +++ b/components/esp_matter_bridge/esp_matter_console_bridge.cpp @@ -61,7 +61,8 @@ const device_type_handler device_handlers[] = { {"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) { if (handler.device_type_id == device_type_id) { 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"); 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"); ESP_LOGI(TAG, "Bridged endpoint id:"); uint8_t count = 0; @@ -252,7 +253,7 @@ esp_err_t bridge_register_commands() { .name = "add", .description = - "Add matter bridged device. Usage: matter esp bridge add .", + "Add matter bridged device. Usage: matter esp bridge add .", .handler = add_bridge_device_handler, }, { @@ -274,7 +275,8 @@ esp_err_t bridge_register_commands() .name = "reset", .description = "reset bridge. Usage: matter esp bridge reset.", .handler = reset_bridge_handler, - }}; + } + }; bridge_console.register_commands(bridge_commands, sizeof(bridge_commands) / sizeof(command_t)); return add_commands(&command, 1); } diff --git a/components/esp_matter_console/esp_matter_console.cpp b/components/esp_matter_console/esp_matter_console.cpp index 719896086..3b003c20d 100644 --- a/components/esp_matter_console/esp_matter_console.cpp +++ b/components/esp_matter_console/esp_matter_console.cpp @@ -88,7 +88,6 @@ esp_err_t print_description(const command_t *command, void *arg) return ESP_OK; } - static esp_err_t help_handler(int argc, char **argv) { 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 const command_t command= { + static const command_t command = { .name = "help", .description = "Print help", .handler = help_handler, diff --git a/components/esp_matter_console/esp_matter_console.h b/components/esp_matter_console/esp_matter_console.h index e0d76c36f..16a0dc7ea 100644 --- a/components/esp_matter_console/esp_matter_console.h +++ b/components/esp_matter_console/esp_matter_console.h @@ -50,8 +50,7 @@ typedef struct { */ typedef esp_err_t command_iterator_t(const command_t *command, void *arg); -class engine -{ +class engine { protected: const command_t *_command_set[CONSOLE_MAX_COMMAND_SETS]; unsigned _command_set_size[CONSOLE_MAX_COMMAND_SETS]; diff --git a/components/esp_matter_console/esp_matter_console_attribute.cpp b/components/esp_matter_console/esp_matter_console_attribute.cpp index 99d5d9a73..f4cd66866 100644 --- a/components/esp_matter_console/esp_matter_console_attribute.cpp +++ b/components/esp_matter_console/esp_matter_console_attribute.cpp @@ -194,15 +194,15 @@ esp_err_t attribute_register_commands() { .name = "set", .description = "Set an attribute value of a cluster on an endpoint. " - "Usage: matter esp attribute set . " - "Example: matter esp attribute set 0x0001 0x0006 0x0000 1.", + "Usage: matter esp attribute set . " + "Example: matter esp attribute set 0x0001 0x0006 0x0000 1.", .handler = console_set_handler, }, { .name = "get", .description = "Get an attribute value of a cluster on an endpoint. " - "Usage: matter esp attribute get . " - "Example: matter esp attribute get 0x0001 0x0006 0x0000.", + "Usage: matter esp attribute get . " + "Example: matter esp attribute get 0x0001 0x0006 0x0000.", .handler = console_get_handler, }, }; @@ -215,5 +215,3 @@ esp_err_t attribute_register_commands() } // namespace console } // namespace esp_matter - - diff --git a/components/esp_matter_console/esp_matter_console_diagnostics.cpp b/components/esp_matter_console/esp_matter_console_diagnostics.cpp index 1e91aa343..98bb3d569 100644 --- a/components/esp_matter_console/esp_matter_console_diagnostics.cpp +++ b/components/esp_matter_console/esp_matter_console_diagnostics.cpp @@ -72,7 +72,7 @@ esp_err_t diagnostics_register_commands() .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); } diff --git a/components/esp_matter_controller/attestation_store/esp_matter_attestation_trust_store.cpp b/components/esp_matter_controller/attestation_store/esp_matter_attestation_trust_store.cpp index c7841e822..84a38a748 100644 --- a/components/esp_matter_controller/attestation_store/esp_matter_attestation_trust_store.cpp +++ b/components/esp_matter_controller/attestation_store/esp_matter_attestation_trust_store.cpp @@ -102,7 +102,8 @@ void paa_der_cert_iterator::release() esp_err_t spiffs_attestation_trust_store::init() { 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"); size_t total = 0, used = 0; 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}; MutableByteSpan skid_span{skid_buf}; 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; } @@ -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_arr_get_object(&jctx, 0) == 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_pem_buffer[paa_str_len] = 0; remove_backslash_n(paa_pem_buffer); diff --git a/components/esp_matter_controller/attestation_store/esp_matter_attestation_trust_store.h b/components/esp_matter_controller/attestation_store/esp_matter_attestation_trust_store.h index c0b7906ac..48cfa0f3e 100644 --- a/components/esp_matter_controller/attestation_store/esp_matter_attestation_trust_store.h +++ b/components/esp_matter_controller/attestation_store/esp_matter_attestation_trust_store.h @@ -31,8 +31,14 @@ typedef struct paa_der_cert { class paa_der_cert_iterator { public: paa_der_cert_iterator(const char *path); - ~paa_der_cert_iterator() { release(); }; - size_t count() { return m_count; } + ~paa_der_cert_iterator() + { + release(); + }; + size_t count() + { + return m_count; + } bool next(paa_der_cert_t &item); void release(); @@ -84,7 +90,10 @@ public: CHIP_ERROR GetProductAttestationAuthorityCert(const ByteSpan &skid, 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: dcl_net_type_t dcl_net_type = DCL_MAIN_NET; diff --git a/components/esp_matter_controller/commands/esp_matter_controller_cluster_command.cpp b/components/esp_matter_controller/commands/esp_matter_controller_cluster_command.cpp index fed548298..980fbda3b 100644 --- a/components/esp_matter_controller/commands/esp_matter_controller_cluster_command.cpp +++ b/components/esp_matter_controller/commands/esp_matter_controller_cluster_command.cpp @@ -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(command_path.mClusterId == CommandResponseObjectT::GetClusterId() && - command_path.mCommandId == CommandResponseObjectT::GetCommandId(), - ESP_ERR_INVALID_ARG, TAG, "Wrong command to decode"); + command_path.mCommandId == CommandResponseObjectT::GetCommandId(), + ESP_ERR_INVALID_ARG, TAG, "Wrong command to decode"); DataModelLogger::LogCommand(command_path, reader); return ESP_OK; } @@ -147,7 +147,8 @@ void cluster_command::on_device_connected_fcn(void *context, ExchangeManager &ex cluster_command *cmd = reinterpret_cast(context); 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::CommandPathFlags::kEndpointIdValid}; + chip::app::CommandPathFlags::kEndpointIdValid + }; 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); 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, - "Some commands of specific clusters will have a reponse which is not NullObject, so we need to handle the " - "response data for those commands. Here we print the reponse data."); + "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 response data."); ESP_LOGI(TAG, - "If your command's reponse is not printed here, please register another success callback when creating " - "the cluster_command object to handle the reponse data."); + "If your command's response is not printed here, please register another success callback when creating " + "the cluster_command object to handle the response data."); switch (command_path.mClusterId) { case GroupKeyManagement::Id: 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(); #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::CommandPathFlags::kGroupIdValid}; + chip::app::CommandPathFlags::kGroupIdValid + }; err = interaction::invoke::send_group_request(fabric_index, command_path, cmd->m_command_data_field); chip::Platform::Delete(cmd); return err; @@ -228,14 +230,14 @@ esp_err_t cluster_command::send_command() auto &controller_instance = esp_matter::controller::matter_controller_client::get_instance(); #ifdef CONFIG_ESP_MATTER_COMMISSIONER_ENABLE if (CHIP_NO_ERROR == - controller_instance.get_commissioner()->GetConnectedDevice(m_destination_id, &on_device_connected_cb, - &on_device_connection_failure_cb)) { + controller_instance.get_commissioner()->GetConnectedDevice(m_destination_id, &on_device_connected_cb, + &on_device_connection_failure_cb)) { return ESP_OK; } #else if (CHIP_NO_ERROR == - controller_instance.get_controller()->GetConnectedDevice(m_destination_id, &on_device_connected_cb, - &on_device_connection_failure_cb)) { + controller_instance.get_controller()->GetConnectedDevice(m_destination_id, &on_device_connected_cb, + &on_device_connection_failure_cb)) { return ESP_OK; } #endif // CONFIG_ESP_MATTER_COMMISSIONER_ENABLE diff --git a/components/esp_matter_controller/commands/esp_matter_controller_cluster_command.h b/components/esp_matter_controller/commands/esp_matter_controller_cluster_command.h index 1dfd66ac0..80ae97eff 100644 --- a/components/esp_matter_controller/commands/esp_matter_controller_cluster_command.h +++ b/components/esp_matter_controller/commands/esp_matter_controller_cluster_command.h @@ -58,7 +58,10 @@ public: 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: uint64_t m_destination_id; diff --git a/components/esp_matter_controller/commands/esp_matter_controller_commissioning_window_opener.cpp b/components/esp_matter_controller/commands/esp_matter_controller_commissioning_window_opener.cpp index 6d2a9b711..89d769faa 100644 --- a/components/esp_matter_controller/commands/esp_matter_controller_commissioning_window_opener.cpp +++ b/components/esp_matter_controller/commands/esp_matter_controller_commissioning_window_opener.cpp @@ -44,7 +44,7 @@ esp_err_t commissioning_window_opener::send_open_commissioning_window_command(ui return ESP_ERR_INVALID_ARG; } m_is_enhanced = is_enhanced; - m_timout = timeout; + m_timeout = timeout; m_iteration = iteration; m_discriminator = discriminator; 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(); #ifdef CONFIG_ESP_MATTER_COMMISSIONER_ENABLE if (CHIP_NO_ERROR == - controller_instance.get_commissioner()->GetConnectedDevice(node_id, &on_device_connected_cb, - &on_device_connection_failure_cb)) { + controller_instance.get_commissioner()->GetConnectedDevice(node_id, &on_device_connected_cb, + &on_device_connection_failure_cb)) { return ESP_OK; } #else if (CHIP_NO_ERROR == - controller_instance.get_controller()->GetConnectedDevice(node_id, &on_device_connected_cb, - &on_device_connection_failure_cb)) { + controller_instance.get_controller()->GetConnectedDevice(node_id, &on_device_connected_cb, + &on_device_connection_failure_cb)) { return ESP_OK; } #endif // CONFIG_ESP_MATTER_COMMISSIONER_ENABLE @@ -125,7 +125,7 @@ void commissioning_window_opener::on_device_connected_fcn(void *context, Exchang return; } 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.discriminator = window_opener->m_discriminator; 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)); } else { 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); cluster.InvokeCommand(command_data, window_opener, send_command_success_callback, send_command_failure_callback, 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(context); 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"); } } @@ -176,7 +176,7 @@ void commissioning_window_opener::send_command_failure_callback(void *context, C { commissioning_window_opener *window_opener = reinterpret_cast(context); 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"); } } diff --git a/components/esp_matter_controller/commands/esp_matter_controller_commissioning_window_opener.h b/components/esp_matter_controller/commands/esp_matter_controller_commissioning_window_opener.h index dbe7af9dd..7a1a17b72 100644 --- a/components/esp_matter_controller/commands/esp_matter_controller_commissioning_window_opener.h +++ b/components/esp_matter_controller/commands/esp_matter_controller_commissioning_window_opener.h @@ -38,7 +38,10 @@ public: 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, uint32_t iteration, uint16_t discriminator, @@ -68,7 +71,7 @@ private: uint32_t m_discriminator = 0; bool m_is_enhanced = false; uint32_t m_pincode = 0; - uint16_t m_timout = 0; + uint16_t m_timeout = 0; uint32_t m_iteration = 0; uint16_t m_timed_invoke_timeout_ms = 0; commissioning_window_open_callback_t m_callback = nullptr; diff --git a/components/esp_matter_controller/commands/esp_matter_controller_pairing_command.cpp b/components/esp_matter_controller/commands/esp_matter_controller_pairing_command.cpp index 68a37e314..05394a8fc 100644 --- a/components/esp_matter_controller/commands/esp_matter_controller_pairing_command.cpp +++ b/components/esp_matter_controller/commands/esp_matter_controller_pairing_command.cpp @@ -51,7 +51,7 @@ void pairing_command::OnCommissioningSuccess(chip::PeerId peerId) controller_instance.get_commissioner()->RegisterPairingDelegate(nullptr); if (m_callbacks.commissioning_success_callback) { auto fabric = controller_instance.get_commissioner()->GetFabricTable()->FindFabricWithCompressedId( - peerId.GetCompressedFabricId()); + peerId.GetCompressedFabricId()); m_callbacks.commissioning_success_callback(ScopedNodeId(peerId.GetNodeId(), fabric->GetFabricIndex())); } } @@ -66,14 +66,14 @@ void pairing_command::OnCommissioningFailure( controller_instance.get_commissioner()->RegisterPairingDelegate(nullptr); if (m_callbacks.commissioning_failure_callback) { auto fabric = controller_instance.get_commissioner()->GetFabricTable()->FindFabricWithCompressedId( - peerId.GetCompressedFabricId()); + peerId.GetCompressedFabricId()); m_callbacks.commissioning_failure_callback( - ScopedNodeId(peerId.GetNodeId(), fabric->GetFabricIndex()), error, stageFailed, - additionalErrorInfo.HasValue() ? std::make_optional(additionalErrorInfo.Value()) : std::nullopt); + ScopedNodeId(peerId.GetNodeId(), fabric->GetFabricIndex()), error, stageFailed, + additionalErrorInfo.HasValue() ? std::make_optional(additionalErrorInfo.Value()) : std::nullopt); } if (m_device_is_icd) { 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) { m_device_is_icd = false; commissioning_params.SetICDRegistrationStrategy(m_icd_registration_strategy) - .SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent) - .SetICDCheckInNodeId(commissioner_node_id) - .SetICDMonitoredSubject(commissioner_node_id) - .SetICDSymmetricKey(m_icd_symmetric_key); + .SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent) + .SetICDCheckInNodeId(commissioner_node_id) + .SetICDMonitoredSubject(commissioner_node_id) + .SetICDSymmetricKey(m_icd_symmetric_key); } 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) { 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(); ESP_RETURN_ON_FALSE(controller_instance.get_commissioner()->GetPairingDelegate() == nullptr, ESP_ERR_INVALID_STATE, 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) { 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(); ESP_RETURN_ON_FALSE(controller_instance.get_commissioner()->GetPairingDelegate() == nullptr, ESP_ERR_INVALID_STATE, 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) { pairing_command::get_instance().m_device_is_icd = false; commissioning_params.SetICDRegistrationStrategy(pairing_command::get_instance().m_icd_registration_strategy) - .SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent) - .SetICDCheckInNodeId(commissioner_node_id) - .SetICDMonitoredSubject(commissioner_node_id) - .SetICDSymmetricKey(pairing_command::get_instance().m_icd_symmetric_key); + .SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent) + .SetICDCheckInNodeId(commissioner_node_id) + .SetICDMonitoredSubject(commissioner_node_id) + .SetICDSymmetricKey(pairing_command::get_instance().m_icd_symmetric_key); } controller_instance.get_commissioner()->PairDevice(node_id, params, commissioning_params); 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) { pairing_command::get_instance().m_device_is_icd = false; commissioning_params.SetICDRegistrationStrategy(pairing_command::get_instance().m_icd_registration_strategy) - .SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent) - .SetICDCheckInNodeId(commissioner_node_id) - .SetICDMonitoredSubject(commissioner_node_id) - .SetICDSymmetricKey(pairing_command::get_instance().m_icd_symmetric_key); + .SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent) + .SetICDCheckInNodeId(commissioner_node_id) + .SetICDMonitoredSubject(commissioner_node_id) + .SetICDSymmetricKey(pairing_command::get_instance().m_icd_symmetric_key); } controller_instance.get_commissioner()->RegisterPairingDelegate(&pairing_command::get_instance()); 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) { pairing_command::get_instance().m_device_is_icd = false; commissioning_params.SetICDRegistrationStrategy(pairing_command::get_instance().m_icd_registration_strategy) - .SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent) - .SetICDCheckInNodeId(commissioner_node_id) - .SetICDMonitoredSubject(commissioner_node_id) - .SetICDSymmetricKey(pairing_command::get_instance().m_icd_symmetric_key); + .SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent) + .SetICDCheckInNodeId(commissioner_node_id) + .SetICDMonitoredSubject(commissioner_node_id) + .SetICDSymmetricKey(pairing_command::get_instance().m_icd_symmetric_key); } controller_instance.get_commissioner()->RegisterPairingDelegate(&pairing_command::get_instance()); 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() - .SetWiFiCredentials(Controller::WiFiCredentials(nameSpan, pwdSpan)) - .SetThreadOperationalDataset(dataset_span); + .SetWiFiCredentials(Controller::WiFiCredentials(nameSpan, pwdSpan)) + .SetThreadOperationalDataset(dataset_span); 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, 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) { pairing_command::get_instance().m_device_is_icd = false; commissioning_params.SetICDRegistrationStrategy(pairing_command::get_instance().m_icd_registration_strategy) - .SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent) - .SetICDCheckInNodeId(commissioner_node_id) - .SetICDMonitoredSubject(commissioner_node_id) - .SetICDSymmetricKey(pairing_command::get_instance().m_icd_symmetric_key); + .SetICDClientType(app::Clusters::IcdManagement::ClientTypeEnum::kPermanent) + .SetICDCheckInNodeId(commissioner_node_id) + .SetICDMonitoredSubject(commissioner_node_id) + .SetICDSymmetricKey(pairing_command::get_instance().m_icd_symmetric_key); } controller_instance.get_commissioner()->RegisterPairingDelegate(&pairing_command::get_instance()); controller_instance.get_commissioner()->PairDevice(nodeId, payload, commissioning_params, DiscoveryType::kAll); diff --git a/components/esp_matter_controller/commands/esp_matter_controller_pairing_command.h b/components/esp_matter_controller/commands/esp_matter_controller_pairing_command.h index c10af4d75..b0f84554a 100644 --- a/components/esp_matter_controller/commands/esp_matter_controller_pairing_command.h +++ b/components/esp_matter_controller/commands/esp_matter_controller_pairing_command.h @@ -44,7 +44,7 @@ typedef struct { /** Pairing command class to finish commissioning with Matter end-devices **/ class pairing_command : public chip::Controller::DevicePairingDelegate, - public chip::Controller::DeviceDiscoveryDelegate { + public chip::Controller::DeviceDiscoveryDelegate { public: /****************** DevicePairingDelegate Interface *****************/ // 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; } - 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 diff --git a/components/esp_matter_controller/commands/esp_matter_controller_read_command.cpp b/components/esp_matter_controller/commands/esp_matter_controller_read_command.cpp index 7e6bc3569..db54c4b3a 100644 --- a/components/esp_matter_controller/commands/esp_matter_controller_read_command.cpp +++ b/components/esp_matter_controller/commands/esp_matter_controller_read_command.cpp @@ -66,14 +66,14 @@ esp_err_t read_command::send_command() auto &controller_instance = esp_matter::controller::matter_controller_client::get_instance(); #ifdef CONFIG_ESP_MATTER_COMMISSIONER_ENABLE if (CHIP_NO_ERROR == - controller_instance.get_commissioner()->GetConnectedDevice(m_node_id, &on_device_connected_cb, - &on_device_connection_failure_cb)) { + controller_instance.get_commissioner()->GetConnectedDevice(m_node_id, &on_device_connected_cb, + &on_device_connection_failure_cb)) { return ESP_OK; } #else if (CHIP_NO_ERROR == - controller_instance.get_controller()->GetConnectedDevice(m_node_id, &on_device_connected_cb, - &on_device_connection_failure_cb)) { + controller_instance.get_controller()->GetConnectedDevice(m_node_id, &on_device_connected_cb, + &on_device_connection_failure_cb)) { return ESP_OK; } #endif // CONFIG_ESP_MATTER_COMMISSIONER_ENABLE @@ -160,7 +160,7 @@ esp_err_t send_read_attr_command(uint64_t node_id, ScopedMemoryBufferWithSize &attribute_ids) { if (endpoint_ids.AllocatedSize() != cluster_ids.AllocatedSize() || - endpoint_ids.AllocatedSize() != attribute_ids.AllocatedSize()) { + endpoint_ids.AllocatedSize() != attribute_ids.AllocatedSize()) { ESP_LOGE(TAG, "The endpoint_id array length should be the same as the cluster_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 &event_ids) { if (endpoint_ids.AllocatedSize() != cluster_ids.AllocatedSize() || - endpoint_ids.AllocatedSize() != event_ids.AllocatedSize()) { + endpoint_ids.AllocatedSize() != event_ids.AllocatedSize()) { ESP_LOGE(TAG, "The endpoint_id array length should be the same as the cluster_ids array length" "and the attribute_ids array length"); diff --git a/components/esp_matter_controller/commands/esp_matter_controller_subscribe_command.cpp b/components/esp_matter_controller/commands/esp_matter_controller_subscribe_command.cpp index c02370cb9..786b2354f 100644 --- a/components/esp_matter_controller/commands/esp_matter_controller_subscribe_command.cpp +++ b/components/esp_matter_controller/commands/esp_matter_controller_subscribe_command.cpp @@ -41,9 +41,9 @@ void subscribe_command::on_device_connected_fcn(void *context, ExchangeManager & subscribe_command *cmd = (subscribe_command *)context; chip::OperationalDeviceProxy device_proxy(&exchangeMgr, sessionHandle); 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(), - 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); + &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_auto_resubscribe, cmd->m_buffered_read_cb); if (err != ESP_OK) { 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; - if (cmd->subscribe_failure_cb) + if (cmd->subscribe_failure_cb) { cmd->subscribe_failure_cb((void *)cmd); + } chip::Platform::Delete(cmd); return; @@ -72,14 +73,14 @@ esp_err_t subscribe_command::send_command() auto &controller_instance = esp_matter::controller::matter_controller_client::get_instance(); #ifdef CONFIG_ESP_MATTER_COMMISSIONER_ENABLE if (CHIP_NO_ERROR == - controller_instance.get_commissioner()->GetConnectedDevice(m_node_id, &on_device_connected_cb, - &on_device_connection_failure_cb)) { + controller_instance.get_commissioner()->GetConnectedDevice(m_node_id, &on_device_connected_cb, + &on_device_connection_failure_cb)) { return ESP_OK; } #else if (CHIP_NO_ERROR == - controller_instance.get_controller()->GetConnectedDevice(m_node_id, &on_device_connected_cb, - &on_device_connection_failure_cb)) { + controller_instance.get_controller()->GetConnectedDevice(m_node_id, &on_device_connected_cb, + &on_device_connection_failure_cb)) { return ESP_OK; } #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) { if (endpoint_ids.AllocatedSize() != cluster_ids.AllocatedSize() || - endpoint_ids.AllocatedSize() != attribute_ids.AllocatedSize()) { + endpoint_ids.AllocatedSize() != attribute_ids.AllocatedSize()) { ESP_LOGE(TAG, "The endpoint_id array length should be the same as the cluster_ids array length and the " "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( - node_id, std::move(attr_paths), std::move(event_paths), min_interval, max_interval, auto_resubscribe, nullptr, - nullptr, nullptr, nullptr, keep_subscription); + node_id, std::move(attr_paths), std::move(event_paths), min_interval, max_interval, auto_resubscribe, nullptr, + nullptr, nullptr, nullptr, keep_subscription); if (!cmd) { ESP_LOGE(TAG, "Failed to alloc memory for subscribe_command"); 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) { if (endpoint_ids.AllocatedSize() != cluster_ids.AllocatedSize() || - endpoint_ids.AllocatedSize() != event_ids.AllocatedSize()) { + endpoint_ids.AllocatedSize() != event_ids.AllocatedSize()) { ESP_LOGE(TAG, "The endpoint_id array length should be the same as the cluster_ids array length and the " "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( - node_id, std::move(attr_paths), std::move(event_paths), min_interval, max_interval, auto_resubscribe, nullptr, - nullptr, nullptr, nullptr, keep_subscription); + node_id, std::move(attr_paths), std::move(event_paths), min_interval, max_interval, auto_resubscribe, nullptr, + nullptr, nullptr, nullptr, keep_subscription); if (!cmd) { ESP_LOGE(TAG, "Failed to alloc memory for subscribe_command"); 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(); #endif if (CHIP_NO_ERROR != - InteractionModelEngine::GetInstance()->ShutdownSubscription(ScopedNodeId(node_id, fabric_index), - subscription_id)) { + InteractionModelEngine::GetInstance()->ShutdownSubscription(ScopedNodeId(node_id, fabric_index), + subscription_id)) { ESP_LOGE(TAG, "Shutdown Subscription Failed"); return ESP_FAIL; } diff --git a/components/esp_matter_controller/commands/esp_matter_controller_subscribe_command.h b/components/esp_matter_controller/commands/esp_matter_controller_subscribe_command.h index 2ec64db58..e32188886 100644 --- a/components/esp_matter_controller/commands/esp_matter_controller_subscribe_command.h +++ b/components/esp_matter_controller/commands/esp_matter_controller_subscribe_command.h @@ -120,7 +120,10 @@ public: 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: 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] endpoint_id EndpointId 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] max_interval Maximum interval of the subscription * @param[in] auto_resubscribe Auto re-subscribe flag diff --git a/components/esp_matter_controller/commands/esp_matter_controller_write_command.cpp b/components/esp_matter_controller/commands/esp_matter_controller_write_command.cpp index 2a6bc7594..c33d7c653 100644 --- a/components/esp_matter_controller/commands/esp_matter_controller_write_command.cpp +++ b/components/esp_matter_controller/commands/esp_matter_controller_write_command.cpp @@ -71,14 +71,14 @@ esp_err_t write_command::send_command() auto &controller_instance = esp_matter::controller::matter_controller_client::get_instance(); #ifdef CONFIG_ESP_MATTER_COMMISSIONER_ENABLE if (CHIP_NO_ERROR == - controller_instance.get_commissioner()->GetConnectedDevice(m_node_id, &on_device_connected_cb, - &on_device_connection_failure_cb)) { + controller_instance.get_commissioner()->GetConnectedDevice(m_node_id, &on_device_connected_cb, + &on_device_connection_failure_cb)) { return ESP_OK; } #else if (CHIP_NO_ERROR == - controller_instance.get_controller()->GetConnectedDevice(m_node_id, &on_device_connected_cb, - &on_device_connection_failure_cb)) { + controller_instance.get_controller()->GetConnectedDevice(m_node_id, &on_device_connected_cb, + &on_device_connection_failure_cb)) { return ESP_OK; } #endif // CONFIG_ESP_MATTER_COMMISSIONER_ENABLE @@ -111,7 +111,7 @@ esp_err_t send_write_attr_command(uint64_t node_id, ScopedMemoryBufferWithSize timed_write_timeout_ms) { if (endpoint_ids.AllocatedSize() != cluster_ids.AllocatedSize() || - endpoint_ids.AllocatedSize() != attribute_ids.AllocatedSize()) { + endpoint_ids.AllocatedSize() != attribute_ids.AllocatedSize()) { ESP_LOGE(TAG, "The endpoint_id array length should be the same as the cluster_ids array length" "and the attribute_ids array length"); diff --git a/components/esp_matter_controller/core/esp_matter_controller_client.cpp b/components/esp_matter_controller/core/esp_matter_controller_client.cpp index cd46c6261..e6e91168e 100644 --- a/components/esp_matter_controller/core/esp_matter_controller_client.cpp +++ b/components/esp_matter_controller/core/esp_matter_controller_client.cpp @@ -89,7 +89,7 @@ esp_err_t matter_controller_client::init(NodeId node_id, FabricId fabric_id, uin reinterpret_cast(&m_group_data_provider); chip::Credentials::SetGroupDataProvider(factory_init_params.groupDataProvider); 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"); auto *system_state = chip::Controller::DeviceControllerFactory::GetInstance().GetSystemState(); 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 = reinterpret_cast(&m_group_data_provider); 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"); chip::ByteSpan default_ipk = chip::GroupTesting::DefaultIpkValue::GetDefaultIpk(); 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; 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) == - CHIP_NO_ERROR, + CHIP_NO_ERROR, ESP_FAIL, TAG, "Failed to set ipk for commissioner fabric"); } diff --git a/components/esp_matter_controller/core/esp_matter_controller_client.h b/components/esp_matter_controller/core/esp_matter_controller_client.h index e4b0a3b74..79a21e74c 100644 --- a/components/esp_matter_controller/core/esp_matter_controller_client.h +++ b/components/esp_matter_controller/core/esp_matter_controller_client.h @@ -170,7 +170,10 @@ public: } 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, controller_check_in_delegate::key_refresh_done_callback key_refresh_done_cb) { @@ -179,17 +182,26 @@ public: #ifdef CONFIG_ESP_MATTER_COMMISSIONER_ENABLE 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) { return auto_fabric_remover::remove_fabric(&m_device_commissioner, remote_node, callback); } #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 #else esp_err_t setup_controller(chip::MutableByteSpan &ipk); - MatterDeviceController *get_controller() { return &m_device_controller; } + MatterDeviceController *get_controller() + { + return &m_device_controller; + } #endif chip::FabricIndex get_fabric_index() { @@ -228,8 +240,8 @@ private: } if (mSystemState->TransportMgr()->MulticastGroupJoinLeave( - chip::Transport::PeerAddress::Multicast(fabric->GetFabricId(), new_group.group_id), true) != - CHIP_NO_ERROR) { + chip::Transport::PeerAddress::Multicast(fabric->GetFabricId(), new_group.group_id), true) != + CHIP_NO_ERROR) { ChipLogError(AppServer, "Unable to listen to group"); } }; @@ -264,7 +276,7 @@ private: chip::Credentials::PersistentStorageOpCertStore m_operational_cert_store; chip::Crypto::RawKeySessionKeystore m_session_key_store; 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; credentials_issuer *m_credentials_issuer; NodeId m_controller_node_id; @@ -291,9 +303,9 @@ class ESPCommissionerCallback : public CommissionerCallback { { NodeId gRemoteId = chip::kTestDeviceNodeId; chip::RendezvousParameters params = chip::RendezvousParameters() - .SetSetupPINCode(pincode) - .SetDiscriminator(longDiscriminator) - .SetPeerAddress(peerAddress); + .SetSetupPINCode(pincode) + .SetDiscriminator(longDiscriminator) + .SetPeerAddress(peerAddress); do { chip::Crypto::DRBG_get_bytes(reinterpret_cast(&gRemoteId), sizeof(gRemoteId)); } while (!chip::IsOperationalNodeId(gRemoteId)); diff --git a/components/esp_matter_controller/core/esp_matter_controller_console.cpp b/components/esp_matter_controller/core/esp_matter_controller_console.cpp index dac8c120c..59aa43fc3 100644 --- a/components/esp_matter_controller/core/esp_matter_controller_console.cpp +++ b/components/esp_matter_controller/core/esp_matter_controller_console.cpp @@ -284,17 +284,17 @@ static esp_err_t controller_udc_handler(int argc, char **argv) return ESP_ERR_INVALID_ARG; } controller::matter_controller_client::get_instance() - .get_commissioner() - ->GetUserDirectedCommissioningServer() - ->ResetUDCClientProcessingStates(); + .get_commissioner() + ->GetUserDirectedCommissioningServer() + ->ResetUDCClientProcessingStates(); } else if (strncmp(argv[0], "print", sizeof("print")) == 0) { if (argc != 1) { return ESP_ERR_INVALID_ARG; } controller::matter_controller_client::get_instance() - .get_commissioner() - ->GetUserDirectedCommissioningServer() - ->PrintUDCClients(); + .get_commissioner() + ->GetUserDirectedCommissioningServer() + ->PrintUDCClients(); } else if (strncmp(argv[0], "commission", sizeof("commission")) == 0) { if (argc != 3) { 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::RendezvousParameters params = chip::RendezvousParameters() - .SetSetupPINCode(pincode) - .SetDiscriminator(state->GetLongDiscriminator()) - .SetPeerAddress(state->GetPeerAddress()); + .SetSetupPINCode(pincode) + .SetDiscriminator(state->GetLongDiscriminator()) + .SetPeerAddress(state->GetPeerAddress()); do { chip::Crypto::DRBG_get_bytes(reinterpret_cast(&gRemoteId), sizeof(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); 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) @@ -620,30 +620,30 @@ esp_err_t controller_register_commands() { .name = "pairing", .description = "Commands for commissioning/unpair nodes.\n" - "\tUsage: controller pairing onnetwork OR\n" - "\tcontroller pairing ble-wifi OR\n" - "\tcontroller pairing ble-thread OR\n" - "\tcontroller pairing ble-thread OR\n" - "\tcontroller pairing code OR\n" - "\tcontroller pairing code-wifi OR\n" - "\tcontroller pairing code-thread OR\n" - "\tcontroller pairing code-wifi-thread OR\n" - "\tcontroller pairing unpair ", + "\tUsage: controller pairing onnetwork OR\n" + "\tcontroller pairing ble-wifi OR\n" + "\tcontroller pairing ble-thread OR\n" + "\tcontroller pairing ble-thread OR\n" + "\tcontroller pairing code OR\n" + "\tcontroller pairing code-wifi OR\n" + "\tcontroller pairing code-thread OR\n" + "\tcontroller pairing code-wifi-thread OR\n" + "\tcontroller pairing unpair ", .handler = controller_pairing_handler, }, { .name = "icd", .description = "icd client management.\n" - "\tUsage: controller icd list", + "\tUsage: controller icd list", .handler = controller_icd_list_handler, }, #if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY { .name = "udc", .description = "UDC command.\n" - "\tUsage: controller udc reset OR\n" - "\tcontroller udc print OR\n" - "\tcontroller udc commission ", + "\tUsage: controller udc reset OR\n" + "\tcontroller udc print OR\n" + "\tcontroller udc commission ", .handler = controller_udc_handler, }, #endif @@ -652,95 +652,95 @@ esp_err_t controller_register_commands() { .name = "group-settings", .description = "Managing the groups and keysets of the controller.\n" - "\tUsage: controller group-settings ", + "\tUsage: controller group-settings ", .handler = controller_group_settings_handler, }, #endif // !CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER { .name = "open-commissioning-window", .description = - "Send command to open basic/enhanced commissioning window\n" - "\tUsage: controller open-commissioning-window