Skip to content

Commit 066dde5

Browse files
Add documentation and fix pipeline
1 parent c402e92 commit 066dde5

File tree

2 files changed

+137
-0
lines changed

2 files changed

+137
-0
lines changed

src/app/clusters/actions-server/actions-server.h

+136
Original file line numberDiff line numberDiff line change
@@ -84,21 +84,157 @@ class Delegate
8484
public:
8585
virtual ~Delegate() = default;
8686

87+
/**
88+
* Get the action at the Nth index from list of actions.
89+
* @param index The index of the action to be returned. It is assumed that actions are indexable from 0 and with no gaps.
90+
* @param action A reference to the action struct which copies existing and initialised buffer at index.
91+
* @return Returns a CHIP_NO_ERROR if there was no error and the action was returned successfully.
92+
* CHIP_ERROR_PROVIDER_LIST_EXHAUSTED if the index in beyond the list of available actions.
93+
*/
8794
virtual CHIP_ERROR ReadActionAtIndex(uint16_t index, Structs::ActionStruct::Type & action);
95+
96+
/**
97+
* Get the EndpointList at the Nth index from list of endpointList.
98+
* @param index The index of the endpointList to be returned. It is assumed that actions are indexable from 0 and with no gaps.
99+
* @param epList A reference to the endpointList struct which copies existing and initialised buffer at index.
100+
* @return Returns a CHIP_NO_ERROR if there was no error and the epList was returned successfully.
101+
* CHIP_ERROR_PROVIDER_LIST_EXHAUSTED if the index in beyond the list of available endpointList.
102+
*/
88103
virtual CHIP_ERROR ReadEndpointListAtIndex(uint16_t index, Structs::EndpointListStruct::Type & epList);
104+
105+
/**
106+
* Find the action with matching actionId in the list of action.
107+
* @param actionId The action to be find in the list of action.
108+
* @return Returns a CHIP_NO_ERROR if matching action is found.
109+
* CHIP_ERROR_NOT_FOUND if the matching action does not found in the list of action.
110+
*/
89111
virtual CHIP_ERROR FindActionIdInActionList(uint16_t actionId);
90112

113+
/**
114+
* On reciept of each and every command,
115+
* if the InvokeID data field is provided by the client when invoking a command, the server SHALL generate a StateChanged event
116+
* when the action changes to a new state or an ActionFailed event when execution of the action fails.
117+
*
118+
* @return If the command refers to an action which currently is not in a state where the command applies, a response SHALL be
119+
* generated with the StatusCode INVALID_COMMAND.
120+
*/
121+
122+
/**
123+
* When an InstantAction command is recieved, an action (state change) on the involved endpoints shall trigger,
124+
* in a "fire and forget" manner. Afterwards, the action’s state SHALL be Inactive.
125+
*
126+
* @param actionId The id of an action on which an action shall takes place.
127+
* @return Returns a Success if an action took place successfully otherwise, suitable error.
128+
*/
91129
virtual Status HandleInstantAction(uint16_t actionId, Optional<uint32_t> invokeId);
130+
131+
/**
132+
* When an InstantActionWithTransition command is recieved, an action (state change) on the involved endpoints shall trigger,
133+
* with a specified time to transition from the current state to the new state. During the transition, the action’s state SHALL
134+
* be Active. Afterwards, the action’s state SHALL be Inactive.
135+
*
136+
* @param actionId The id of an action on which an action shall takes place.
137+
* @param transitionTime The time for transition from the current state to the new state.
138+
* @return Returns a Success if an action took place successfully otherwise, suitable error.
139+
*/
92140
virtual Status HandleInstantActionWithTransition(uint16_t actionId, uint16_t transitionTime, Optional<uint32_t> invokeId);
141+
142+
/**
143+
* When a StartAction command is recieved, the commencement of an action on the involved endpoints shall trigger. Afterwards,
144+
* the action’s state SHALL be Inactive.
145+
*
146+
* @param actionId The id of an action on which an action shall takes place.
147+
* @return Returns a Success if an action took place successfully otherwise, suitable error.
148+
*/
93149
virtual Status HandleStartAction(uint16_t actionId, Optional<uint32_t> invokeId);
150+
151+
/**
152+
* When a StartActionWithDuration command is recieved, the commencement of an action on the involved endpoints shall trigger,
153+
* and SHALL change the action’s state to Active. After the specified Duration, the action will stop, and the action’s state
154+
* SHALL change to Inactive.
155+
*
156+
* @param actionId The id of an action on which an action shall takes place.
157+
* @param duration The time for which an action shall be in start state.
158+
* @return Returns a Success if an action took place successfully otherwise, suitable error.
159+
*/
94160
virtual Status HandleStartActionWithDuration(uint16_t actionId, uint32_t duration, Optional<uint32_t> invokeId);
161+
162+
/**
163+
* When a StopAction command is recieved, the ongoing action on the involved endpoints shall stop. Afterwards, the action’s
164+
* state SHALL be Inactive.
165+
*
166+
* @param actionId The id of an action on which an action shall takes place.
167+
* @return Returns a Success if an action took place successfully otherwise, suitable error.
168+
*/
95169
virtual Status HandleStopAction(uint16_t actionId, Optional<uint32_t> invokeId);
170+
171+
/**
172+
* When a PauseAction command is recieved, the ongoing action on the involved endpoints shall pause and SHALL change the
173+
* action’s state to Paused.
174+
*
175+
* @param actionId The id of an action on which an action shall takes place.
176+
* @return Returns a Success if an action took place successfully otherwise, suitable error.
177+
*/
96178
virtual Status HandlePauseAction(uint16_t actionId, Optional<uint32_t> invokeId);
179+
180+
/**
181+
* When a PauseActionWithDuration command is recieved, pauses an ongoing action, and SHALL change the action’s state to Paused.
182+
* After the specified Duration, the ongoing action will be automatically resumed. which SHALL change the action’s state to
183+
* Active.
184+
*
185+
* @param actionId The id of an action on which an action shall takes place.
186+
* @param duration The time for which an action shall be in pause state.
187+
* @return Returns a Success if an action took place successfully otherwise, suitable error.
188+
*/
97189
virtual Status HandlePauseActionWithDuration(uint16_t actionId, uint32_t duration, Optional<uint32_t> invokeId);
190+
191+
/**
192+
* When a ResumeAction command is recieved, the previously paused action shall resume and SHALL change the action’s state to
193+
* Active.
194+
*
195+
* @param actionId The id of an action on which an action shall takes place.
196+
* @return Returns a Success if an action took place successfully otherwise, suitable error.
197+
*/
98198
virtual Status HandleResumeAction(uint16_t actionId, Optional<uint32_t> invokeId);
199+
200+
/**
201+
* When an EnableAction command is recieved, it enables a certain action or automation. Afterwards, the action’s state SHALL be
202+
* Active.
203+
*
204+
* @param actionId The id of an action on which an action shall takes place.
205+
* @return Returns a Success if an action took place successfully otherwise, suitable error.
206+
*/
99207
virtual Status HandleEnableAction(uint16_t actionId, Optional<uint32_t> invokeId);
208+
209+
/**
210+
* When an EnableActionWithDuration command is recieved, it enables a certain action or automation, and SHALL change the
211+
* action’s state to be Active. After the specified Duration, the action or automation will stop, and the action’s state SHALL
212+
* change to Disabled.
213+
*
214+
* @param actionId The id of an action on which an action shall takes place.
215+
* @param duration The time for which an action shall be in active state.
216+
* @return Returns a Success if an action took place successfully otherwise, suitable error.
217+
*/
100218
virtual Status HandleEnableActionWithDuration(uint16_t actionId, uint32_t duration, Optional<uint32_t> invokeId);
219+
220+
/**
221+
* When a DisableAction command is recieved, it disables a certain action or automation, and SHALL change the action’s state to
222+
* Inactive.
223+
*
224+
* @param actionId The id of an action on which an action shall takes place.
225+
* @return Returns a Success if an action took place successfully otherwise, suitable error.
226+
*/
101227
virtual Status HandleDisableAction(uint16_t actionId, Optional<uint32_t> invokeId);
228+
229+
/**
230+
* When a DisableActionWithDuration command is recieved, it disables a certain action or automation, and SHALL change the
231+
* action’s state to Disabled. After the specified Duration, the action or automation will re-start, and the action’s state
232+
* SHALL change to either Inactive or Active, depending on the actions.
233+
*
234+
* @param actionId The id of an action on which an action shall takes place.
235+
* @param duration The time for which an action shall be in disable state.
236+
* @return Returns a Success if an action took place successfully otherwise, suitable error.
237+
*/
102238
virtual Status HandleDisableActionWithDuration(uint16_t actionId, uint32_t duration, Optional<uint32_t> invokeId);
103239
};
104240

src/app/zap_cluster_list.json

+1
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@
324324
"WINDOW_COVERING_CLUSTER": ["window-covering-server"],
325325
"WATER_HEATER_MANAGEMENT_CLUSTER": ["water-heater-management-server"],
326326
"WATER_HEATER_MODE_CLUSTER": ["mode-base-server"],
327+
"ACTIONS_CLUSTER": ["actions-server"],
327328
"ZLL_COMMISSIONING_CLUSTER": []
328329
}
329330
}

0 commit comments

Comments
 (0)