project-chip / connectedhomeip

Matter (formerly Project CHIP) creates more connections between more objects, simplifying development for manufacturers and increasing compatibility for consumers, guided by the Connectivity Standards Alliance.
https://buildwithmatter.com
Apache License 2.0
7.49k stars 2.01k forks source link

[1.1] [FanControl] set FanMode to Auto, value of PercentSetting is 0xFF #29986

Closed mmt-10 closed 1 year ago

mmt-10 commented 1 year ago

Reproduction steps

  1. set FanMode Attribute on FanControl Cluster to Auto(0x05)
  2. FanMode was set to Auto, then void MatterFanControlClusterServerAttributeChangedCallback(const app::ConcreteAttributePath & attributePath) set PercentSetting to NULL. However, void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, uint8_t * value) *value is 0xFF.

As my understanding, *value should be 0x00. How do I resolve it?

Bug prevalence

always

GitHub hash of the SDK that was being used

commit 8f66f4215bc0708efc8cc73bda80620e67d8955f (HEAD, tag: v1.1.0.1)

Platform

core

Platform Version(s)

No response

Type

Common Cluster Logic

Anything else?

No response

bzbarsky-apple commented 1 year ago

@mmt-10 The representation of spec "null" for an 8-bit unsigned integer/enum value in MatterPostAttributeChangeCallback is 0xFF.

"null" does not mean "0"; it means "not a value". The spec reserves some value space of this purpose, note: 0xFF is not a valid value for a nullable enum8 or uint8 or anything derived from them.

mmt-10 commented 1 year ago

@bzbarsky-apple Thank you for your reply. I understand it.

When I read PercentSetting after FanMode was set Auto, PercentSetting is 0. However, MatterPostAttributeChangeCallback is 0xFF. So, I confused.

bzbarsky-apple commented 1 year ago

When I read PercentSetting after FanMode was set Auto, PercentSetting is 0.

That is strange... How are you reading it, exactly?