Skip to content

Commit ca36028

Browse files
committed
Updates based on comments
1 parent de3e0a6 commit ca36028

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

examples/all-clusters-app/all-clusters-common/src/power-topology-stub.cpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,18 @@ namespace PowerTopology {
3030
class PowerTopologyDelegate : public Delegate
3131
{
3232
public:
33-
PowerTopologyDelegate(EndpointId aEndpointId) : Delegate(aEndpointId) {}
3433
~PowerTopologyDelegate() = default;
3534

36-
const CHIP_ERROR GetAvailableEndpointAtIndex(size_t index, EndpointId & endpointId) override;
37-
const CHIP_ERROR GetActiveEndpointAtIndex(size_t index, EndpointId & endpointId) override;
35+
CHIP_ERROR GetAvailableEndpointAtIndex(size_t index, EndpointId & endpointId) override;
36+
CHIP_ERROR GetActiveEndpointAtIndex(size_t index, EndpointId & endpointId) override;
3837
};
3938

40-
const CHIP_ERROR PowerTopologyDelegate::GetAvailableEndpointAtIndex(size_t index, EndpointId & endpointId)
39+
CHIP_ERROR PowerTopologyDelegate::GetAvailableEndpointAtIndex(size_t index, EndpointId & endpointId)
4140
{
4241
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
4342
}
4443

45-
const CHIP_ERROR PowerTopologyDelegate::GetActiveEndpointAtIndex(size_t index, EndpointId & endpointId)
44+
CHIP_ERROR PowerTopologyDelegate::GetActiveEndpointAtIndex(size_t index, EndpointId & endpointId)
4645
{
4746
return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED;
4847
}
@@ -60,7 +59,7 @@ void emberAfPowerTopologyClusterInitCallback(chip::EndpointId endpointId)
6059
VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
6160
VerifyOrDie(!gInstance);
6261

63-
gDelegate = std::make_unique<PowerTopologyDelegate>(endpointId);
62+
gDelegate = std::make_unique<PowerTopologyDelegate>();
6463
if (gDelegate)
6564
{
6665
gInstance = std::make_unique<Instance>(

src/app/clusters/power-topology-server/power-topology-server.h

+16-7
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,30 @@ namespace app {
2828
namespace Clusters {
2929
namespace PowerTopology {
3030

31-
using namespace chip::app::Clusters::PowerTopology::Attributes;
32-
3331
using chip::Protocols::InteractionModel::Status;
3432

3533
class Delegate
3634
{
3735
public:
38-
Delegate(EndpointId aEndpointId) : mEndpointId(aEndpointId) {}
3936
virtual ~Delegate() = default;
4037

41-
virtual CHIP_ERROR const GetAvailableEndpointAtIndex(size_t index, EndpointId & endpointId) = 0;
42-
virtual CHIP_ERROR const GetActiveEndpointAtIndex(size_t index, EndpointId & endpointId) = 0;
38+
/**
39+
* Get the Nth EndpointId in the list of available endpoints.
40+
* @param index The index of the EndpointId to be returned.
41+
* @param endpointId A reference to the EndpointId.
42+
* @return Returns a CHIP_NO_ERROR if there was no error and the EndpointId was returned successfully.
43+
* CHIP_ERROR_PROVIDER_LIST_EXHAUSTED if the index is greater than or equal to the length of the list of available endpoints.
44+
*/
45+
virtual CHIP_ERROR GetAvailableEndpointAtIndex(size_t index, EndpointId & endpointId) = 0;
4346

44-
protected:
45-
EndpointId mEndpointId = 0;
47+
/**
48+
* Get the Nth EndpointId in the list of active endpoints.
49+
* @param index The index of the EndpointId to be returned.
50+
* @param endpointId A reference to the EndpointId.
51+
* @return Returns a CHIP_NO_ERROR if there was no error and the EndpointId was returned successfully.
52+
* CHIP_ERROR_PROVIDER_LIST_EXHAUSTED if the index is greater than or equal to the length of the list of active endpoints.
53+
*/
54+
virtual CHIP_ERROR GetActiveEndpointAtIndex(size_t index, EndpointId & endpointId) = 0;
4655
};
4756

4857
enum class OptionalAttributes : uint32_t

0 commit comments

Comments
 (0)