@@ -23,13 +23,13 @@ class MatterTemperatureSensor : public MatterEndPoint {
23
23
public:
24
24
MatterTemperatureSensor ();
25
25
~MatterTemperatureSensor ();
26
- // default initial raw temperature
26
+ // begin Matter Temperature Sensor endpoint
27
27
virtual bool begin (int16_t _rawTemperature = 0 );
28
28
bool begin (double temperatureCelcius) {
29
29
int16_t rawValue = static_cast <int16_t >(temperatureCelcius * 100 .0f );
30
30
return begin (rawValue);
31
31
}
32
- // this will just stop processing Temperature Sensor Matter events
32
+ // this will stop processing Temperature Sensor Matter events
33
33
void end ();
34
34
35
35
// set the reported raw temperature
@@ -38,23 +38,25 @@ class MatterTemperatureSensor : public MatterEndPoint {
38
38
int16_t rawValue = static_cast <int16_t >(temperatureCelcius * 100 .0f );
39
39
return setRawTemperature (rawValue);
40
40
}
41
- int16_t getRawTemperature () { // returns the reported raw temperature
41
+ // returns the reported raw temperature (in 1/100th of a degree)
42
+ int16_t getRawTemperature () {
42
43
return rawTemperature;
43
44
}
44
- double getTemperatureCelsius () { // returns the reported temperature in Celcius
45
+ // returns the reported temperature in Celcius
46
+ double getTemperatureCelsius () {
45
47
return (double )rawTemperature / 100.0 ;
46
48
}
47
- void operator =(double temperatureCelcius) { // sets the reported temperature in Celcius
49
+ // sets the reported temperature in Celcius
50
+ void operator =(double temperatureCelcius) {
48
51
int16_t rawValue = static_cast <int16_t >(temperatureCelcius * 100 .0f );
49
52
setRawTemperature (rawValue);
50
53
}
51
- operator double () { // returns the reported temperature in Celcius
54
+ operator double () {
52
55
return (double ) getTemperatureCelsius ();
53
56
}
54
57
55
58
// this function is called by Matter internal event processor. It could be overwritten by the application, if necessary.
56
59
bool attributeChangeCB (uint16_t endpoint_id, uint32_t cluster_id, uint32_t attribute_id, esp_matter_attr_val_t *val);
57
- // User Callback for whenever the Light state is changed by the Matter Controller
58
60
59
61
protected:
60
62
bool started = false ;
0 commit comments