Skip to content

Commit 6d7a389

Browse files
committed
Add and use a Energy_mWh type
1 parent 658e1c0 commit 6d7a389

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

examples/all-clusters-app/all-clusters-common/include/WhmDelegate.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class WaterHeaterManagementDelegate : public WaterHeaterManagement::Delegate
121121
BitMask<WaterHeaterHeatSourceBitmap> GetHeaterTypes() override;
122122
BitMask<WaterHeaterHeatSourceBitmap> GetHeatDemand() override;
123123
uint16_t GetTankVolume() override;
124-
int64_t GetEstimatedHeatRequired() override;
124+
Energy_mWh GetEstimatedHeatRequired() override;
125125
Percent GetTankPercentage() override;
126126
BoostStateEnum GetBoostState() override;
127127

@@ -130,7 +130,7 @@ class WaterHeaterManagementDelegate : public WaterHeaterManagement::Delegate
130130
void SetHeaterTypes(BitMask<WaterHeaterHeatSourceBitmap> heaterTypes);
131131
void SetHeatDemand(BitMask<WaterHeaterHeatSourceBitmap> heatDemand);
132132
void SetTankVolume(uint16_t tankVolume);
133-
void SetEstimatedHeatRequired(int64_t estimatedHeatRequired);
133+
void SetEstimatedHeatRequired(Energy_mWh estimatedHeatRequired);
134134
void SetTankPercentage(Percent tankPercentage);
135135
void SetBoostState(BoostStateEnum boostState);
136136

@@ -327,7 +327,7 @@ class WaterHeaterManagementDelegate : public WaterHeaterManagement::Delegate
327327
// taking the specific heat capacity of water (4182 J/kg °C) and by knowing
328328
// the current temperature of the water, the tank volume and target
329329
// temperature.
330-
int64_t mEstimatedHeatRequired;
330+
Energy_mWh mEstimatedHeatRequired;
331331

332332
// This attribute SHALL indicate an approximate level of hot water stored in
333333
// the tank, which may help consumers understand the amount of hot water

examples/all-clusters-app/all-clusters-common/src/WhmDelegateImpl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ uint16_t WaterHeaterManagementDelegate::GetTankVolume()
6767
return mTankVolume;
6868
}
6969

70-
int64_t WaterHeaterManagementDelegate::GetEstimatedHeatRequired()
70+
Energy_mWh WaterHeaterManagementDelegate::GetEstimatedHeatRequired()
7171
{
7272
return mEstimatedHeatRequired;
7373
}
@@ -112,7 +112,7 @@ void WaterHeaterManagementDelegate::SetTankVolume(uint16_t tankVolume)
112112
}
113113
}
114114

115-
void WaterHeaterManagementDelegate::SetEstimatedHeatRequired(int64_t estimatedHeatRequired)
115+
void WaterHeaterManagementDelegate::SetEstimatedHeatRequired(Energy_mWh estimatedHeatRequired)
116116
{
117117
if (mEstimatedHeatRequired != estimatedHeatRequired)
118118
{

src/app/clusters/water-heater-management-server/water-heater-management-server.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class Delegate
108108
virtual BitMask<WaterHeaterHeatSourceBitmap> GetHeaterTypes() = 0;
109109
virtual BitMask<WaterHeaterHeatSourceBitmap> GetHeatDemand() = 0;
110110
virtual uint16_t GetTankVolume() = 0;
111-
virtual int64_t GetEstimatedHeatRequired() = 0;
111+
virtual Energy_mWh GetEstimatedHeatRequired() = 0;
112112
virtual Percent GetTankPercentage() = 0;
113113
virtual BoostStateEnum GetBoostState() = 0;
114114

src/app/util/basic-types.h

+1
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@ namespace chip {
3232

3333
typedef uint8_t Percent;
3434
typedef uint16_t Percent100ths;
35+
typedef int64_t Energy_mWh;
3536

3637
} // namespace chip

0 commit comments

Comments
 (0)