Coverage Report

Created: 2025-06-24 06:17

/src/connectedhomeip/examples/energy-management-app/energy-management-common/device-energy-management/include/DEMManufacturerDelegate.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 *
3
 *    Copyright (c) 2024 Project CHIP Authors
4
 *    All rights reserved.
5
 *
6
 *    Licensed under the Apache License, Version 2.0 (the "License");
7
 *    you may not use this file except in compliance with the License.
8
 *    You may obtain a copy of the License at
9
 *
10
 *        http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 *    Unless required by applicable law or agreed to in writing, software
13
 *    distributed under the License is distributed on an "AS IS" BASIS,
14
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 *    See the License for the specific language governing permissions and
16
 *    limitations under the License.
17
 */
18
19
#pragma once
20
21
#include <app-common/zap-generated/cluster-objects.h>
22
#include <lib/core/DataModelTypes.h>
23
24
namespace chip {
25
namespace app {
26
namespace Clusters {
27
namespace DeviceEnergyManagement {
28
29
/**
30
 * Class to abstract manufacturer specific functionality
31
 */
32
class DEMManufacturerDelegate
33
{
34
public:
35
1
    DEMManufacturerDelegate() {}
36
37
1
    virtual ~DEMManufacturerDelegate() {}
38
39
    // The PowerAdjustEnd event needs to report the approximate energy used by the ESA during the session.
40
    virtual int64_t GetApproxEnergyDuringSession() = 0;
41
42
    virtual CHIP_ERROR HandleDeviceEnergyManagementPowerAdjustRequest(const int64_t powerMw, const uint32_t durationS,
43
                                                                      AdjustmentCauseEnum cause)
44
0
    {
45
0
        return CHIP_NO_ERROR;
46
0
    }
47
48
0
    virtual CHIP_ERROR HandleDeviceEnergyManagementPowerAdjustCompletion() { return CHIP_NO_ERROR; }
49
50
0
    virtual CHIP_ERROR HandleDeviceEnergyManagementCancelPowerAdjustRequest(CauseEnum cause) { return CHIP_NO_ERROR; }
51
52
    virtual CHIP_ERROR HandleDeviceEnergyManagementStartTimeAdjustRequest(const uint32_t requestedStartTimeUtc,
53
                                                                          AdjustmentCauseEnum cause)
54
0
    {
55
0
        return CHIP_NO_ERROR;
56
0
    }
57
58
    virtual CHIP_ERROR HandleDeviceEnergyManagementPauseRequest(const uint32_t durationS, AdjustmentCauseEnum cause)
59
0
    {
60
0
        return CHIP_NO_ERROR;
61
0
    }
62
63
0
    virtual CHIP_ERROR HandleDeviceEnergyManagementPauseCompletion() { return CHIP_NO_ERROR; }
64
65
0
    virtual CHIP_ERROR HandleDeviceEnergyManagementCancelPauseRequest(CauseEnum cause) { return CHIP_NO_ERROR; }
66
67
0
    virtual CHIP_ERROR HandleDeviceEnergyManagementCancelRequest() { return CHIP_NO_ERROR; }
68
69
    virtual CHIP_ERROR
70
    HandleModifyForecastRequest(const uint32_t forecastID,
71
                                const DataModel::DecodableList<Structs::SlotAdjustmentStruct::DecodableType> & slotAdjustments,
72
                                AdjustmentCauseEnum cause)
73
0
    {
74
0
        return CHIP_NO_ERROR;
75
0
    }
76
77
    virtual CHIP_ERROR RequestConstraintBasedForecast(
78
        const DataModel::DecodableList<DeviceEnergyManagement::Structs::ConstraintsStruct::DecodableType> & constraints,
79
        AdjustmentCauseEnum cause)
80
0
    {
81
0
        return CHIP_NO_ERROR;
82
0
    }
83
84
    /**
85
     * @brief   Allows a client application to send in power readings into the system
86
     *
87
     * @param[in]  aEndpointId       - Endpoint to send to EPM Cluster
88
     * @param[in]  aActivePower_mW   - ActivePower measured in milli-watts
89
     * @param[in]  aVoltage_mV       - Voltage measured in milli-volts
90
     * @param[in]  aActiveCurrent_mA - ActiveCurrent measured in milli-amps
91
     */
92
    virtual CHIP_ERROR SendPowerReading(EndpointId aEndpointId, int64_t aActivePower_mW, int64_t aVoltage_mV, int64_t aCurrent_mA)
93
0
    {
94
0
        return CHIP_NO_ERROR;
95
0
    }
96
    /**
97
     * @brief   Allows a client application to send cumulative energy readings into the system
98
     *
99
     *          This is a helper function to add timestamps to the readings
100
     *
101
     * @param[in]  aCumulativeEnergyImported -total energy imported in milli-watthours
102
     * @param[in]  aCumulativeEnergyExported -total energy exported in milli-watthours
103
     */
104
    virtual CHIP_ERROR SendCumulativeEnergyReading(EndpointId aEndpointId, int64_t aCumulativeEnergyImported,
105
                                                   int64_t aCumulativeEnergyExported)
106
0
    {
107
0
        return CHIP_NO_ERROR;
108
0
    }
109
    /**
110
     * @brief   Allows a client application to send periodic energy readings into the system
111
     *
112
     *          This is a helper function to add timestamps to the readings
113
     *
114
     * @param[in]  aPeriodicEnergyImported - energy imported in milli-watthours in last period
115
     * @param[in]  aPeriodicEnergyExported - energy exported in milli-watthours in last period
116
     */
117
    virtual CHIP_ERROR SendPeriodicEnergyReading(EndpointId aEndpointId, int64_t aCumulativeEnergyImported,
118
                                                 int64_t aCumulativeEnergyExported)
119
0
    {
120
0
        return CHIP_NO_ERROR;
121
0
    }
122
};
123
124
} // namespace DeviceEnergyManagement
125
} // namespace Clusters
126
} // namespace app
127
} // namespace chip