@@ -53,27 +53,41 @@ class ClusterServer
53
53
*
54
54
* @param cluster Pointer to the cluster object being added
55
55
*/
56
- CHIP_ERROR
57
- AddCluster (Cluster * cluster) { return mEndpoints .AddCluster (cluster); }
56
+ CHIP_ERROR AddCluster (Cluster * cluster) { return mEndpoints .AddCluster (cluster); }
58
57
59
58
/* *
60
59
* @brief
61
60
* Add a new endpoint to this Cluster Server
62
61
*
63
62
* @param cluster Pointer to the endpoint object being added
64
63
*/
65
- CHIP_ERROR
66
- AddEndpoint (Endpoint * endpoint)
64
+ CHIP_ERROR AddEndpoint (Endpoint * endpoint)
67
65
{
68
66
mEndpoints .Insert (endpoint);
69
67
return CHIP_NO_ERROR;
70
68
}
71
69
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)
73
78
{
74
79
return mEndpoints .Find ([&endPointId](Endpoint * item) -> bool { return (endPointId-- == 0 ); });
75
80
}
76
81
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
+ */
77
91
Cluster * GetCluster (uint8_t endPointId, uint16_t clusterId)
78
92
{
79
93
Cluster * cluster = nullptr ;
@@ -86,6 +100,16 @@ class ClusterServer
86
100
return cluster;
87
101
}
88
102
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
+ */
89
113
Attribute * GetAttribute (uint8_t endPointId, uint16_t clusterId, uint16_t attrId)
90
114
{
91
115
Attribute * attr = nullptr ;
@@ -103,6 +127,17 @@ class ClusterServer
103
127
return attr;
104
128
}
105
129
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
+ */
106
141
CHIP_ERROR SetValue (uint8_t endPointId, uint16_t clusterId, uint16_t attrId, Value & value)
107
142
{
108
143
auto endpoint = GetEndpoint (endPointId-- == 0 );
@@ -125,6 +160,17 @@ class ClusterServer
125
160
return CHIP_ERROR_INTERNAL;
126
161
}
127
162
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
+ */
128
174
CHIP_ERROR GetValue (uint8_t endPointId, uint16_t clusterId, uint16_t attrId, Value & value)
129
175
{
130
176
auto endpoint = mEndpoints .Find ([&endPointId](Endpoint * item) -> bool { return (endPointId-- == 0 ); });
0 commit comments