Skip to content

Commit d649618

Browse files
author
Rob Walker
committed
add documentation
1 parent e009edd commit d649618

File tree

1 file changed

+51
-5
lines changed

1 file changed

+51
-5
lines changed

src/lib/datamodel/ClusterServer.h

+51-5
Original file line numberDiff line numberDiff line change
@@ -53,27 +53,41 @@ class ClusterServer
5353
*
5454
* @param cluster Pointer to the cluster object being added
5555
*/
56-
CHIP_ERROR
57-
AddCluster(Cluster * cluster) { return mEndpoints.AddCluster(cluster); }
56+
CHIP_ERROR AddCluster(Cluster * cluster) { return mEndpoints.AddCluster(cluster); }
5857

5958
/**
6059
* @brief
6160
* Add a new endpoint to this Cluster Server
6261
*
6362
* @param cluster Pointer to the endpoint object being added
6463
*/
65-
CHIP_ERROR
66-
AddEndpoint(Endpoint * endpoint)
64+
CHIP_ERROR AddEndpoint(Endpoint * endpoint)
6765
{
6866
mEndpoints.Insert(endpoint);
6967
return CHIP_NO_ERROR;
7068
}
7169

72-
Endpoint * GetEndpoint(uint8_t endPointId)
70+
/**
71+
* @brief
72+
* Retrieve a pointer to the corresponding Endpoint, if any
73+
*
74+
* @param endpointId the index of the desired Endpoint
75+
* @return pointer to the Endpoint or null if not found
76+
*/
77+
Endpoint * GetEndpoint(uint8_t endpointId)
7378
{
7479
return mEndpoints.Find([&endPointId](Endpoint * item) -> bool { return (endPointId-- == 0); });
7580
}
7681

82+
/**
83+
* @brief
84+
* Retrieve a pointer to the corresponding Cluster, if any
85+
*
86+
* @param endpointId the index of the Endpoint with the Cluster
87+
* @param clusterId the id of desired Cluster
88+
*
89+
* @return pointer to the Cluster or null if not found
90+
*/
7791
Cluster * GetCluster(uint8_t endPointId, uint16_t clusterId)
7892
{
7993
Cluster * cluster = nullptr;
@@ -86,6 +100,16 @@ class ClusterServer
86100
return cluster;
87101
}
88102

103+
/**
104+
* @brief
105+
* Retrieve a pointer to the corresponding Attribute, if any
106+
*
107+
* @param endpointId the index of the desired Endpoint
108+
* @param clusterId the id of desired Cluster
109+
* @param attrId the id of desired Attribute
110+
*
111+
* @return pointer to the Attribute or null if not found
112+
*/
89113
Attribute * GetAttribute(uint8_t endPointId, uint16_t clusterId, uint16_t attrId)
90114
{
91115
Attribute * attr = nullptr;
@@ -103,6 +127,17 @@ class ClusterServer
103127
return attr;
104128
}
105129

130+
/**
131+
* @brief
132+
* Find and set an Attribute's Value
133+
*
134+
* @param endpointId the index of the desired Endpoint
135+
* @param clusterId the id of desired Cluster
136+
* @param attrId the id of desired Attribute
137+
* @param value the Value to set
138+
*
139+
* @return CHIP_NO_ERROR on success or a failure-specific error code otherwise
140+
*/
106141
CHIP_ERROR SetValue(uint8_t endPointId, uint16_t clusterId, uint16_t attrId, Value & value)
107142
{
108143
auto endpoint = GetEndpoint(endPointId-- == 0);
@@ -125,6 +160,17 @@ class ClusterServer
125160
return CHIP_ERROR_INTERNAL;
126161
}
127162

163+
/**
164+
* @brief
165+
* Find and read an Attribute's Value
166+
*
167+
* @param endpointId the index of the desired Endpoint
168+
* @param clusterId the id of desired Cluster
169+
* @param attrId the id of desired Attribute
170+
* @param value the Value to populate with the Attribute's value
171+
*
172+
* @return CHIP_NO_ERROR on success or a failure-specific error code otherwise
173+
*/
128174
CHIP_ERROR GetValue(uint8_t endPointId, uint16_t clusterId, uint16_t attrId, Value & value)
129175
{
130176
auto endpoint = mEndpoints.Find([&endPointId](Endpoint * item) -> bool { return (endPointId-- == 0); });

0 commit comments

Comments
 (0)