temperature_measurement: add FindClusterOnEndpoint and SetMeasuredVal… - #1816
Open
dietolive-tw wants to merge 1 commit into
Open
temperature_measurement: add FindClusterOnEndpoint and SetMeasuredVal…#1816dietolive-tw wants to merge 1 commit into
dietolive-tw wants to merge 1 commit into
Conversation
…ue wrappers The flow_measurement and relative_humidity_measurement integration.cpp files provide namespace-level FindClusterOnEndpoint() and SetMeasuredValue() wrappers so application code can write to codegen cluster storage directly (bypassing esp-matter attribute::update, which desyncs for non-writable attributes on codegen clusters — esp-matter storage vs codegen mMeasuredValue). temperature_measurement was missing these wrappers. Add them following the flow_measurement pattern so apps using TemperatureMeasurement can use SetMeasuredValue() the same way. Refs: pattern from clusters/flow_measurement/integration.cpp
|
dietolive-tw seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
temperature_measurement: add FindClusterOnEndpoint and SetMeasuredValue wrappers
The flow_measurement and relative_humidity_measurement integration.cpp files provide namespace-level FindClusterOnEndpoint() and SetMeasuredValue() wrappers so application code can write to codegen cluster storage directly (bypassing esp-matter attribute::update, which desyncs for non-writable attributes on codegen clusters — esp-matter storage vs codegen mMeasuredValue).
temperature_measurement was missing these wrappers. Add them following the flow_measurement pattern so apps using TemperatureMeasurement can use SetMeasuredValue() the same way.
Refs: pattern from clusters/flow_measurement/integration.cpp
Description
temperature_measurementwas the only measurement cluster incomponents/esp_matter/data_model_provider/clusters/withoutnamespace-level
FindClusterOnEndpoint()andSetMeasuredValue()wrappers in its
integration.cpp.flow_measurementandrelative_humidity_measurementalready provide them.For codegen-backed clusters, writing a non-writable attribute via
esp_matter::attribute::update()desyncs the two stores: it writesthe esp-matter storage, but
ReadAttributereads from the codegenmMeasuredValue. Application code that wants to updateMeasuredValuemust call the codegenSetMeasuredValue()method onthe cluster instance.
The cluster instance is looked up via
FindClusterOnEndpoint(endpointId),which exists in
CodegenIntegration.h— but the matchingCodegenIntegration.cppis excluded from the esp-matter build byCMakeLists.txt(EXCLUDE_SRCS_LISTforCodegen*.cpp). The othermeasurement clusters solve this by re-declaring the wrapper in
integration.cpp(the file actually compiled).Without this wrapper, apps that call
TemperatureMeasurement::SetMeasuredValue()get a link error.Changes
components/esp_matter/data_model_provider/clusters/temperature_measurement/integration.cppFindClusterOnEndpoint(EndpointId)(matchesflow_measurementpattern)SetMeasuredValue(EndpointId, DataModel::Nullable<int16_t>)convenience wrapperRelated
components/esp_matter/data_model_provider/clusters/flow_measurement/integration.cppcomponents/esp_matter/data_model_provider/clusters/relative_humidity_measurement/integration.cppcomponents/esp_matter/data_model_provider/CMakeLists.txt(EXCLUDE_SRCS_LISTforCodegen*.cpp)Testing
flow_measurement/integration.cppandrelative_humidity_measurement/integration.cppexactly — no behaviorchange for apps that do not call the new wrappers.
TemperatureMeasurement::SetMeasuredValue(); without this wrapper the linkstep fails with an undefined reference to
FindClusterOnEndpoint(EndpointId), with it the link succeeds and theattribute reads back the value set via the codegen path.
Checklist
Before submitting a Pull Request, please ensure the following: