Apply Upstream code (2021-03-15)
[platform/upstream/connectedhomeip.git] / examples / bridge-app / bridge-common / gen / callback.h
1 /*
2  *
3  *    Copyright (c) 2021 Project CHIP Authors
4  *
5  *    Licensed under the Apache License, Version 2.0 (the "License");
6  *    you may not use this file except in compliance with the License.
7  *    You may obtain a copy of the License at
8  *
9  *        http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *    Unless required by applicable law or agreed to in writing, software
12  *    distributed under the License is distributed on an "AS IS" BASIS,
13  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *    See the License for the specific language governing permissions and
15  *    limitations under the License.
16  */
17
18 // THIS FILE IS GENERATED BY ZAP
19
20 // Prevent multiple inclusion
21 #pragma once
22
23 #include "af-structs.h"
24 #include "af-types.h"
25 #include "basic-types.h"
26
27 /** @brief Cluster Init
28  *
29  * This function is called when a specific cluster is initialized. It gives the
30  * application an opportunity to take care of cluster initialization procedures.
31  * It is called exactly once for each endpoint where cluster is present.
32  *
33  * @param endpoint   Ver.: always
34  * @param clusterId   Ver.: always
35  */
36 void emberAfClusterInitCallback(chip::EndpointId endpoint, chip::ClusterId clusterId);
37
38 // Cluster Init Functions
39
40 /** @brief Basic Cluster Init
41  *
42  * Cluster Init
43  *
44  * @param endpoint    Endpoint that is being initialized
45  */
46 void emberAfBasicClusterInitCallback(chip::EndpointId endpoint);
47
48 /** @brief Level Control Cluster Init
49  *
50  * Cluster Init
51  *
52  * @param endpoint    Endpoint that is being initialized
53  */
54 void emberAfLevelControlClusterInitCallback(chip::EndpointId endpoint);
55
56 /** @brief On/off Cluster Init
57  *
58  * Cluster Init
59  *
60  * @param endpoint    Endpoint that is being initialized
61  */
62 void emberAfOnOffClusterInitCallback(chip::EndpointId endpoint);
63
64 // Cluster Server/Client Init Functions
65
66 //
67 // Basic Cluster server
68 //
69
70 /** @brief Basic Cluster Server Init
71  *
72  * Server Init
73  *
74  * @param endpoint    Endpoint that is being initialized
75  */
76 void emberAfBasicClusterServerInitCallback(chip::EndpointId endpoint);
77
78 /** @brief Basic Cluster Server Attribute Changed
79  *
80  * Server Attribute Changed
81  *
82  * @param endpoint    Endpoint that is being initialized
83  * @param attributeId Attribute that changed
84  */
85 void emberAfBasicClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
86
87 /** @brief Basic Cluster Server Manufacturer Specific Attribute Changed
88  *
89  * Server Manufacturer Specific Attribute Changed
90  *
91  * @param endpoint          Endpoint that is being initialized
92  * @param attributeId       Attribute that changed
93  * @param manufacturerCode  Manufacturer Code of the attribute that changed
94  */
95 void emberAfBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
96                                                                            uint16_t manufacturerCode);
97
98 /** @brief Basic Cluster Server Message Sent
99  *
100  * Server Message Sent
101  *
102  * @param type               The type of message sent
103  * @param indexOrDestination The destination or address to which the message was sent
104  * @param apsFrame           The APS frame for the message
105  * @param msgLen             The length of the message
106  * @param message            The message that was sent
107  * @param status             The status of the sent message
108  */
109 void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
110                                                   EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status);
111
112 /** @brief Basic Cluster Server Pre Attribute Changed
113  *
114  * server Pre Attribute Changed
115  *
116  * @param endpoint      Endpoint that is being initialized
117  * @param attributeId   Attribute to be changed
118  * @param attributeType Attribute type
119  * @param size          Attribute size
120  * @param value         Attribute value
121  */
122 EmberAfStatus emberAfBasicClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
123                                                                    EmberAfAttributeType attributeType, uint8_t size,
124                                                                    uint8_t * value);
125
126 /** @brief Basic Cluster Server Tick
127  *
128  * server Tick
129  *
130  * @param endpoint  Endpoint that is being served
131  */
132 void emberAfBasicClusterServerTickCallback(chip::EndpointId endpoint);
133
134 //
135 // Level Control Cluster server
136 //
137
138 /** @brief Level Control Cluster Server Init
139  *
140  * Server Init
141  *
142  * @param endpoint    Endpoint that is being initialized
143  */
144 void emberAfLevelControlClusterServerInitCallback(chip::EndpointId endpoint);
145
146 /** @brief Level Control Cluster Server Attribute Changed
147  *
148  * Server Attribute Changed
149  *
150  * @param endpoint    Endpoint that is being initialized
151  * @param attributeId Attribute that changed
152  */
153 void emberAfLevelControlClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
154
155 /** @brief Level Control Cluster Server Manufacturer Specific Attribute Changed
156  *
157  * Server Manufacturer Specific Attribute Changed
158  *
159  * @param endpoint          Endpoint that is being initialized
160  * @param attributeId       Attribute that changed
161  * @param manufacturerCode  Manufacturer Code of the attribute that changed
162  */
163 void emberAfLevelControlClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
164                                                                                   chip::AttributeId attributeId,
165                                                                                   uint16_t manufacturerCode);
166
167 /** @brief Level Control Cluster Server Message Sent
168  *
169  * Server Message Sent
170  *
171  * @param type               The type of message sent
172  * @param indexOrDestination The destination or address to which the message was sent
173  * @param apsFrame           The APS frame for the message
174  * @param msgLen             The length of the message
175  * @param message            The message that was sent
176  * @param status             The status of the sent message
177  */
178 void emberAfLevelControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
179                                                          EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
180                                                          EmberStatus status);
181
182 /** @brief Level Control Cluster Server Pre Attribute Changed
183  *
184  * server Pre Attribute Changed
185  *
186  * @param endpoint      Endpoint that is being initialized
187  * @param attributeId   Attribute to be changed
188  * @param attributeType Attribute type
189  * @param size          Attribute size
190  * @param value         Attribute value
191  */
192 EmberAfStatus emberAfLevelControlClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
193                                                                           EmberAfAttributeType attributeType, uint8_t size,
194                                                                           uint8_t * value);
195
196 /** @brief Level Control Cluster Server Tick
197  *
198  * server Tick
199  *
200  * @param endpoint  Endpoint that is being served
201  */
202 void emberAfLevelControlClusterServerTickCallback(chip::EndpointId endpoint);
203
204 //
205 // On/off Cluster server
206 //
207
208 /** @brief On/off Cluster Server Init
209  *
210  * Server Init
211  *
212  * @param endpoint    Endpoint that is being initialized
213  */
214 void emberAfOnOffClusterServerInitCallback(chip::EndpointId endpoint);
215
216 /** @brief On/off Cluster Server Attribute Changed
217  *
218  * Server Attribute Changed
219  *
220  * @param endpoint    Endpoint that is being initialized
221  * @param attributeId Attribute that changed
222  */
223 void emberAfOnOffClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
224
225 /** @brief On/off Cluster Server Manufacturer Specific Attribute Changed
226  *
227  * Server Manufacturer Specific Attribute Changed
228  *
229  * @param endpoint          Endpoint that is being initialized
230  * @param attributeId       Attribute that changed
231  * @param manufacturerCode  Manufacturer Code of the attribute that changed
232  */
233 void emberAfOnOffClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
234                                                                            uint16_t manufacturerCode);
235
236 /** @brief On/off Cluster Server Message Sent
237  *
238  * Server Message Sent
239  *
240  * @param type               The type of message sent
241  * @param indexOrDestination The destination or address to which the message was sent
242  * @param apsFrame           The APS frame for the message
243  * @param msgLen             The length of the message
244  * @param message            The message that was sent
245  * @param status             The status of the sent message
246  */
247 void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
248                                                   EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status);
249
250 /** @brief On/off Cluster Server Pre Attribute Changed
251  *
252  * server Pre Attribute Changed
253  *
254  * @param endpoint      Endpoint that is being initialized
255  * @param attributeId   Attribute to be changed
256  * @param attributeType Attribute type
257  * @param size          Attribute size
258  * @param value         Attribute value
259  */
260 EmberAfStatus emberAfOnOffClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
261                                                                    EmberAfAttributeType attributeType, uint8_t size,
262                                                                    uint8_t * value);
263
264 /** @brief On/off Cluster Server Tick
265  *
266  * server Tick
267  *
268  * @param endpoint  Endpoint that is being served
269  */
270 void emberAfOnOffClusterServerTickCallback(chip::EndpointId endpoint);
271
272 // Cluster Commands Callback
273
274 /**
275  * @brief Level Control Cluster Move Command callback
276  * @param moveMode
277  * @param rate
278  * @param optionMask
279  * @param optionOverride
280  */
281
282 bool emberAfLevelControlClusterMoveCallback(uint8_t moveMode, uint8_t rate, uint8_t optionMask, uint8_t optionOverride);
283
284 /**
285  * @brief Level Control Cluster MoveToLevel Command callback
286  * @param level
287  * @param transitionTime
288  * @param optionMask
289  * @param optionOverride
290  */
291
292 bool emberAfLevelControlClusterMoveToLevelCallback(uint8_t level, uint16_t transitionTime, uint8_t optionMask,
293                                                    uint8_t optionOverride);
294
295 /**
296  * @brief Level Control Cluster MoveToLevelWithOnOff Command callback
297  * @param level
298  * @param transitionTime
299  */
300
301 bool emberAfLevelControlClusterMoveToLevelWithOnOffCallback(uint8_t level, uint16_t transitionTime);
302
303 /**
304  * @brief Level Control Cluster MoveWithOnOff Command callback
305  * @param moveMode
306  * @param rate
307  */
308
309 bool emberAfLevelControlClusterMoveWithOnOffCallback(uint8_t moveMode, uint8_t rate);
310
311 /**
312  * @brief Level Control Cluster Step Command callback
313  * @param stepMode
314  * @param stepSize
315  * @param transitionTime
316  * @param optionMask
317  * @param optionOverride
318  */
319
320 bool emberAfLevelControlClusterStepCallback(uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime, uint8_t optionMask,
321                                             uint8_t optionOverride);
322
323 /**
324  * @brief Level Control Cluster StepWithOnOff Command callback
325  * @param stepMode
326  * @param stepSize
327  * @param transitionTime
328  */
329
330 bool emberAfLevelControlClusterStepWithOnOffCallback(uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime);
331
332 /**
333  * @brief Level Control Cluster Stop Command callback
334  * @param optionMask
335  * @param optionOverride
336  */
337
338 bool emberAfLevelControlClusterStopCallback(uint8_t optionMask, uint8_t optionOverride);
339
340 /**
341  * @brief Level Control Cluster StopWithOnOff Command callback
342  */
343
344 bool emberAfLevelControlClusterStopWithOnOffCallback();
345
346 /**
347  * @brief On/off Cluster Off Command callback
348  */
349
350 bool emberAfOnOffClusterOffCallback();
351
352 /**
353  * @brief On/off Cluster On Command callback
354  */
355
356 bool emberAfOnOffClusterOnCallback();
357
358 /**
359  * @brief On/off Cluster Toggle Command callback
360  */
361
362 bool emberAfOnOffClusterToggleCallback();
363
364 //
365 // Non-Cluster Related Callbacks
366 //
367
368 /** @brief Add To Current App Tasks
369  *
370  * This function is only useful to sleepy end devices.  This function will note
371  * the passed item as part of a set of tasks the application has outstanding
372  * (e.g. message sent requiring APS acknwoledgement).  This will affect how the
373  * application behaves with regard to sleeping and polling.  Until the
374  * outstanding task is completed, the device may poll more frequently and sleep
375  * less often.
376  *
377  * @param tasks   Ver.: always
378  */
379 void emberAfAddToCurrentAppTasksCallback(EmberAfApplicationTask tasks);
380
381 /** @brief Remove From Current App Tasks
382  *
383  * This function is only useful to sleepy end devices.  This function will
384  * remove the passed item from the set of tasks the application has outstanding
385  * (e.g. message sent requiring APS acknwoledgement).  This will affect how the
386  * application behaves with regard to sleeping and polling.  Removing the item
387  * from the list of outstanding tasks may allow the device to sleep longer and
388  * poll less frequently.  If there are other outstanding tasks the system may
389  * still have to stay away and poll more often.
390  *
391  * @param tasks   Ver.: always
392  */
393 void emberAfRemoveFromCurrentAppTasksCallback(EmberAfApplicationTask tasks);
394
395 /** @brief Allow Network Write Attribute
396  *
397  * This function is called by the application framework before it writes an
398  * attribute in response to a write attribute request from an external device.
399  * The value passed into this callback is the value to which the attribute is to
400  * be set by the framework.
401         Example:        In mirroring simple metering data
402  * on an Energy Services Interface (ESI) (formerly called Energy Service Portal
403  * (ESP) in SE 1.0).), a mirrored simple meter needs to write read-only
404  * attributes on its mirror. The-meter-mirror sample application, located in
405  * app/framework/sample-apps, uses this callback to allow the mirrored device to
406  * write simple metering attributes on the mirror regardless of the fact that
407  * most simple metering attributes are defined as read-only by the ZigBee
408  * specification.
409         Note:   The ZCL specification does not (as of this
410  * writing) specify any permission-level security for writing writeable
411  * attributes. As far as the ZCL specification is concerned, if an attribute is
412  * writeable, any device that has a link key for the device should be able to
413  * write that attribute. Furthermore if an attribute is read only, it should not
414  * be written over the air. Thus, if you implement permissions for writing
415  * attributes as a feature, you MAY be operating outside the specification. This
416  * is unlikely to be a problem for writing read-only attributes, but it may be a
417  * problem for attributes that are writeable according to the specification but
418  * restricted by the application implementing this callback.
419  *
420  * @param endpoint   Ver.: always
421  * @param clusterId   Ver.: always
422  * @param attributeId   Ver.: always
423  * @param mask   Ver.: always
424  * @param manufacturerCode   Ver.: always
425  * @param value   Ver.: always
426  * @param type   Ver.: always
427  */
428 EmberAfAttributeWritePermission emberAfAllowNetworkWriteAttributeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
429                                                                           chip::AttributeId attributeId, uint8_t mask,
430                                                                           uint16_t manufacturerCode, uint8_t * value, uint8_t type);
431
432 /** @brief Attribute Read Access
433  *
434  * This function is called whenever the Application Framework needs to check
435  * access permission for an attribute read.
436  *
437  * @param endpoint   Ver.: always
438  * @param clusterId   Ver.: always
439  * @param manufacturerCode   Ver.: always
440  * @param attributeId   Ver.: always
441  */
442 bool emberAfAttributeReadAccessCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, uint16_t manufacturerCode,
443                                         chip::AttributeId attributeId);
444
445 /** @brief Attribute Write Access
446  *
447  * This function is called whenever the Application Framework needs to check
448  * access permission for an attribute write.
449  *
450  * @param endpoint   Ver.: always
451  * @param clusterId   Ver.: always
452  * @param manufacturerCode   Ver.: always
453  * @param attributeId   Ver.: always
454  */
455 bool emberAfAttributeWriteAccessCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, uint16_t manufacturerCode,
456                                          chip::AttributeId attributeId);
457
458 /** @brief Default Response
459  *
460  * This function is called by the application framework when a Default Response
461  * command is received from an external device.  The application should return
462  * true if the message was processed or false if it was not.
463  *
464  * @param clusterId The cluster identifier of this response.  Ver.: always
465  * @param commandId The command identifier to which this is a response.  Ver.:
466  * always
467  * @param status Specifies either SUCCESS or the nature of the error that was
468  * detected in the received command.  Ver.: always
469  */
470 bool emberAfDefaultResponseCallback(chip::ClusterId clusterId, chip::CommandId commandId, EmberAfStatus status);
471
472 /** @brief Configure Reporting Response
473  *
474  * This function is called by the application framework when a Configure
475  * Reporting Response command is received from an external device.  The
476  * application should return true if the message was processed or false if it
477  * was not.
478  *
479  * @param clusterId The cluster identifier of this response.  Ver.: always
480  * @param buffer Buffer containing the list of attribute status records.  Ver.:
481  * always
482  * @param bufLen The length in bytes of the list.  Ver.: always
483  */
484 bool emberAfConfigureReportingResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
485
486 /** @brief Read Reporting Configuration Response
487  *
488  * This function is called by the application framework when a Read Reporting
489  * Configuration Response command is received from an external device.  The
490  * application should return true if the message was processed or false if it
491  * was not.
492  *
493  * @param clusterId The cluster identifier of this response.  Ver.: always
494  * @param buffer Buffer containing the list of attribute reporting configuration
495  * records.  Ver.: always
496  * @param bufLen The length in bytes of the list.  Ver.: always
497  */
498 bool emberAfReadReportingConfigurationResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
499
500 /** @brief Discover Attributes Response
501  *
502  * This function is called by the application framework when a Discover
503  * Attributes Response or Discover Attributes Extended Response command is
504  * received from an external device.  The Discover Attributes Response command
505  * contains a bool indicating if discovery is complete and a list of zero or
506  * more attribute identifier/type records. The final argument indicates whether
507  * the response is in the extended format or not.  The application should return
508  * true if the message was processed or false if it was not.
509  *
510  * @param clusterId The cluster identifier of this response.  Ver.: always
511  * @param discoveryComplete Indicates whether there are more attributes to be
512  * discovered.  true if there are no more attributes to be discovered.  Ver.:
513  * always
514  * @param buffer Buffer containing the list of attribute identifier/type
515  * records.  Ver.: always
516  * @param bufLen The length in bytes of the list.  Ver.: always
517  * @param extended Indicates whether the response is in the extended format or
518  * not.  Ver.: always
519  */
520 bool emberAfDiscoverAttributesResponseCallback(chip::ClusterId clusterId, bool discoveryComplete, uint8_t * buffer, uint16_t bufLen,
521                                                bool extended);
522
523 /** @brief Discover Commands Generated Response
524  *
525  * This function is called by the framework when Discover Commands Generated
526  * Response is received.
527  *
528  * @param clusterId The cluster identifier of this response.  Ver.: always
529  * @param manufacturerCode Manufacturer code  Ver.: always
530  * @param discoveryComplete Indicates whether there are more commands to be
531  * discovered.  Ver.: always
532  * @param commandIds Buffer containing the list of command identifiers.  Ver.:
533  * always
534  * @param commandIdCount The length of bytes of the list, whish is the same as
535  * the number of identifiers.  Ver.: always
536  */
537 bool emberAfDiscoverCommandsGeneratedResponseCallback(chip::ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete,
538                                                       chip::CommandId * commandIds, uint16_t commandIdCount);
539
540 /** @brief Discover Commands Received Response
541  *
542  * This function is called by the framework when Discover Commands Received
543  * Response is received.
544  *
545  * @param clusterId The cluster identifier of this response.  Ver.: always
546  * @param manufacturerCode Manufacturer code  Ver.: always
547  * @param discoveryComplete Indicates whether there are more commands to be
548  * discovered.  Ver.: always
549  * @param commandIds Buffer containing the list of command identifiers.  Ver.:
550  * always
551  * @param commandIdCount The length of bytes of the list, whish is the same as
552  * the number of identifiers.  Ver.: always
553  */
554 bool emberAfDiscoverCommandsReceivedResponseCallback(chip::ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete,
555                                                      chip::CommandId * commandIds, uint16_t commandIdCount);
556
557 /** @brief Pre Command Received
558  *
559  * This callback is the second in the Application Framework's message processing
560  * chain. At this point in the processing of incoming over-the-air messages, the
561  * application has determined that the incoming message is a ZCL command. It
562  * parses enough of the message to populate an EmberAfClusterCommand struct. The
563  * Application Framework defines this struct value in a local scope to the
564  * command processing but also makes it available through a global pointer
565  * called emberAfCurrentCommand, in app/framework/util/util.c. When command
566  * processing is complete, this pointer is cleared.
567  *
568  * @param cmd   Ver.: always
569  */
570 bool emberAfPreCommandReceivedCallback(EmberAfClusterCommand * cmd);
571
572 /** @brief Pre Message Send
573  *
574  * This function is called by the framework when it is about to pass a message
575  * to the stack primitives for sending.   This message may or may not be ZCL,
576  * ZDO, or some other protocol.  This is called prior to
577         any ZigBee
578  * fragmentation that may be done.  If the function returns true it is assumed
579  * the callback has consumed and processed the message.  The callback must also
580  * set the EmberStatus status code to be passed back to the caller.  The
581  * framework will do no further processing on the message.
582         If the
583  * function returns false then it is assumed that the callback has not processed
584  * the mesasge and the framework will continue to process accordingly.
585  *
586  * @param messageStruct The structure containing the parameters of the APS
587  * message to be sent.  Ver.: always
588  * @param status A pointer to the status code value that will be returned to the
589  * caller.  Ver.: always
590  */
591 bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberStatus * status);
592
593 /** @brief Message Sent
594  *
595  * This function is called by the application framework from the message sent
596  * handler, when it is informed by the stack regarding the message sent status.
597  * All of the values passed to the emberMessageSentHandler are passed on to this
598  * callback. This provides an opportunity for the application to verify that its
599  * message has been sent successfully and take the appropriate action. This
600  * callback should return a bool value of true or false. A value of true
601  * indicates that the message sent notification has been handled and should not
602  * be handled by the application framework.
603  *
604  * @param type   Ver.: always
605  * @param indexOrDestination   Ver.: always
606  * @param apsFrame   Ver.: always
607  * @param msgLen   Ver.: always
608  * @param message   Ver.: always
609  * @param status   Ver.: always
610  */
611 bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame,
612                                 uint16_t msgLen, uint8_t * message, EmberStatus status);
613
614 /** @brief Pre Attribute Change
615  *
616  * This function is called by the application framework before it changes an
617  * attribute value.  The value passed into this callback is the value to which
618  * the attribute is to be set by the framework.  The application should return
619  * ::EMBER_ZCL_STATUS_SUCCESS to permit the change or any other ::EmberAfStatus
620  * to reject it.
621  *
622  * @param endpoint   Ver.: always
623  * @param clusterId   Ver.: always
624  * @param attributeId   Ver.: always
625  * @param mask   Ver.: always
626  * @param manufacturerCode   Ver.: always
627  * @param type   Ver.: always
628  * @param size   Ver.: always
629  * @param value   Ver.: always
630  */
631 EmberAfStatus emberAfPreAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
632                                                 uint8_t mask, uint16_t manufacturerCode, uint8_t type, uint8_t size,
633                                                 uint8_t * value);
634
635 /** @brief Post Attribute Change
636  *
637  * This function is called by the application framework after it changes an
638  * attribute value. The value passed into this callback is the value to which
639  * the attribute was set by the framework.
640  *
641  * @param endpoint   Ver.: always
642  * @param clusterId   Ver.: always
643  * @param attributeId   Ver.: always
644  * @param mask   Ver.: always
645  * @param manufacturerCode   Ver.: always
646  * @param type   Ver.: always
647  * @param size   Ver.: always
648  * @param value   Ver.: always
649  */
650 void emberAfPostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
651                                         uint8_t mask, uint16_t manufacturerCode, uint8_t type, uint8_t size, uint8_t * value);
652
653 /** @brief Read Attributes Response
654  *
655  * This function is called by the application framework when a Read Attributes
656  * Response command is received from an external device.  The application should
657  * return true if the message was processed or false if it was not.
658  *
659  * @param clusterId The cluster identifier of this response.  Ver.: always
660  * @param buffer Buffer containing the list of read attribute status records.
661  * Ver.: always
662  * @param bufLen The length in bytes of the list.  Ver.: always
663  */
664 bool emberAfReadAttributesResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
665
666 /** @brief External Attribute Read
667  *
668  * Like emberAfExternalAttributeWriteCallback above, this function is called
669  * when the framework needs to read an attribute that is not stored within the
670  * Application Framework's data structures.
671         All of the important
672  * information about the attribute itself is passed as a pointer to an
673  * EmberAfAttributeMetadata struct, which is stored within the application and
674  * used to manage the attribute. A complete description of the
675  * EmberAfAttributeMetadata struct is provided in
676  * app/framework/include/af-types.h
677         This function assumes that the
678  * application is able to read the attribute, write it into the passed buffer,
679  * and return immediately. Any attributes that require a state machine for
680  * reading and writing are not really candidates for externalization at the
681  * present time. The Application Framework does not currently include a state
682  * machine for reading or writing attributes that must take place across a
683  * series of application ticks. Attributes that cannot be read in a timely
684  * manner should be stored within the Application Framework and updated
685  * occasionally by the application code from within the
686  * emberAfMainTickCallback.
687         If the application was successfully able to
688  * read the attribute and write it into the passed buffer, it should return a
689  * value of EMBER_ZCL_STATUS_SUCCESS. Ensure that the size of the externally
690  * managed attribute value is smaller than what the buffer can hold. In the case
691  * of a buffer overflow throw an appropriate error such as
692  * EMBER_ZCL_STATUS_INSUFFICIENT_SPACE. Any other return value indicates the
693  * application was not able to read the attribute.
694  *
695  * @param endpoint   Ver.: always
696  * @param clusterId   Ver.: always
697  * @param attributeMetadata   Ver.: always
698  * @param manufacturerCode   Ver.: always
699  * @param buffer   Ver.: always
700  * @param maxReadLength   Ver.: always
701  */
702 EmberAfStatus emberAfExternalAttributeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
703                                                    EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
704                                                    uint8_t * buffer, uint16_t maxReadLength);
705
706 /** @brief Write Attributes Response
707  *
708  * This function is called by the application framework when a Write Attributes
709  * Response command is received from an external device.  The application should
710  * return true if the message was processed or false if it was not.
711  *
712  * @param clusterId The cluster identifier of this response.  Ver.: always
713  * @param buffer Buffer containing the list of write attribute status records.
714  * Ver.: always
715  * @param bufLen The length in bytes of the list.  Ver.: always
716  */
717 bool emberAfWriteAttributesResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
718
719 /** @brief External Attribute Write
720  *
721  * This function is called whenever the Application Framework needs to write an
722  * attribute which is not stored within the data structures of the Application
723  * Framework itself. One of the new features in Version 2 is the ability to
724  * store attributes outside the Framework. This is particularly useful for
725  * attributes that do not need to be stored because they can be read off the
726  * hardware when they are needed, or are stored in some central location used by
727  * many modules within the system. In this case, you can indicate that the
728  * attribute is stored externally. When the framework needs to write an external
729  * attribute, it makes a call to this callback.
730         This callback is very
731  * useful for host micros which need to store attributes in persistent memory.
732  * Because each host micro (used with an Ember NCP) has its own type of
733  * persistent memory storage, the Application Framework does not include the
734  * ability to mark attributes as stored in flash the way that it does for Ember
735  * SoCs like the EM35x. On a host micro, any attributes that need to be stored
736  * in persistent memory should be marked as external and accessed through the
737  * external read and write callbacks. Any host code associated with the
738  * persistent storage should be implemented within this callback.
739         All of
740  * the important information about the attribute itself is passed as a pointer
741  * to an EmberAfAttributeMetadata struct, which is stored within the application
742  * and used to manage the attribute. A complete description of the
743  * EmberAfAttributeMetadata struct is provided in
744  * app/framework/include/af-types.h.
745         This function assumes that the
746  * application is able to write the attribute and return immediately. Any
747  * attributes that require a state machine for reading and writing are not
748  * candidates for externalization at the present time. The Application Framework
749  * does not currently include a state machine for reading or writing attributes
750  * that must take place across a series of application ticks. Attributes that
751  * cannot be written immediately should be stored within the Application
752  * Framework and updated occasionally by the application code from within the
753  * emberAfMainTickCallback.
754         If the application was successfully able to
755  * write the attribute, it returns a value of EMBER_ZCL_STATUS_SUCCESS. Any
756  * other return value indicates the application was not able to write the
757  * attribute.
758  *
759  * @param endpoint   Ver.: always
760  * @param clusterId   Ver.: always
761  * @param attributeMetadata   Ver.: always
762  * @param manufacturerCode   Ver.: always
763  * @param buffer   Ver.: always
764  */
765 EmberAfStatus emberAfExternalAttributeWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
766                                                     EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
767                                                     uint8_t * buffer);
768
769 /** @brief Report Attributes
770  *
771  * This function is called by the application framework when a Report Attributes
772  * command is received from an external device.  The application should return
773  * true if the message was processed or false if it was not.
774  *
775  * @param clusterId The cluster identifier of this command.  Ver.: always
776  * @param buffer Buffer containing the list of attribute report records.  Ver.:
777  * always
778  * @param bufLen The length in bytes of the list.  Ver.: always
779  */
780 bool emberAfReportAttributesCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
781
782 /** @brief Get Current Time
783  *
784  * This callback is called when device attempts to get current time from the
785  * hardware. If this device has means to retrieve exact time, then this method
786  * should implement it. If the callback can't provide the exact time it should
787  * return 0 to indicate failure. Default action is to return 0, which indicates
788  * that device does not have access to real time.
789  *
790  */
791 uint32_t emberAfGetCurrentTimeCallback();
792
793 /** @brief Get Endpoint Info
794  *
795  * This function is a callback to an application implemented endpoint that
796  * operates outside the normal application framework.  When the framework wishes
797  * to perform operations with that endpoint it uses this callback to retrieve
798  * the endpoint's information.  If the endpoint exists and the application can
799  * provide data then true shall be returned.  Otherwise the callback must return
800  * false.
801  *
802  * @param endpoint The endpoint to retrieve data for.  Ver.: always
803  * @param returnNetworkIndex The index corresponding to the ZigBee network the
804  * endpoint belongs to.  If not using a multi-network device, 0 must be
805  * returned.  Otherwise on a multi-network device the stack will switch to this
806  * network before sending the message.  Ver.: always
807  * @param returnEndpointInfo A pointer to a data struct that will be written
808  * with information about the endpoint.  Ver.: always
809  */
810 bool emberAfGetEndpointInfoCallback(chip::EndpointId endpoint, uint8_t * returnNetworkIndex,
811                                     EmberAfEndpointInfoStruct * returnEndpointInfo);
812
813 /** @brief Get Source Route Overhead
814  *
815  * This function is called by the framework to determine the overhead required
816  * in the network frame for source routing to a particular destination.
817  *
818  * @param destination The node id of the destination  Ver.: always
819  */
820 uint8_t emberAfGetSourceRouteOverheadCallback(chip::NodeId destination);
821
822 /** @brief Registration Abort
823  *
824  * This callback is called when the device should abort the registration
825  * process.
826  *
827  */
828 void emberAfRegistrationAbortCallback();
829
830 /** @brief Interpan Send Message
831  *
832  * This function will send a raw MAC message with interpan frame format using
833  * the passed parameters.
834  *
835  * @param header Interpan header info  Ver.: always
836  * @param messageLength The length of the message received or to send  Ver.:
837  * always
838  * @param message The message data received or to send.  Ver.: always
839  */
840 EmberStatus emberAfInterpanSendMessageCallback(EmberAfInterpanHeader * header, uint16_t messageLength, uint8_t * message);
841
842 /** @brief Start Move
843  *
844  * This function is called to initiate the process for a device to move (rejoin)
845  * to a new parent.
846  *
847  */
848 bool emberAfStartMoveCallback();