6b284ee368dc37a14818857c86159dc086f29fe1
[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 Basic Cluster ResetToFactoryDefaults Command callback
276  */
277
278 bool emberAfBasicClusterResetToFactoryDefaultsCallback();
279
280 /**
281  * @brief Level Control Cluster Move Command callback
282  * @param moveMode
283  * @param rate
284  * @param optionMask
285  * @param optionOverride
286  */
287
288 bool emberAfLevelControlClusterMoveCallback(uint8_t moveMode, uint8_t rate, uint8_t optionMask, uint8_t optionOverride);
289
290 /**
291  * @brief Level Control Cluster MoveToLevel Command callback
292  * @param level
293  * @param transitionTime
294  * @param optionMask
295  * @param optionOverride
296  */
297
298 bool emberAfLevelControlClusterMoveToLevelCallback(uint8_t level, uint16_t transitionTime, uint8_t optionMask,
299                                                    uint8_t optionOverride);
300
301 /**
302  * @brief Level Control Cluster MoveToLevelWithOnOff Command callback
303  * @param level
304  * @param transitionTime
305  */
306
307 bool emberAfLevelControlClusterMoveToLevelWithOnOffCallback(uint8_t level, uint16_t transitionTime);
308
309 /**
310  * @brief Level Control Cluster MoveWithOnOff Command callback
311  * @param moveMode
312  * @param rate
313  */
314
315 bool emberAfLevelControlClusterMoveWithOnOffCallback(uint8_t moveMode, uint8_t rate);
316
317 /**
318  * @brief Level Control Cluster Step Command callback
319  * @param stepMode
320  * @param stepSize
321  * @param transitionTime
322  * @param optionMask
323  * @param optionOverride
324  */
325
326 bool emberAfLevelControlClusterStepCallback(uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime, uint8_t optionMask,
327                                             uint8_t optionOverride);
328
329 /**
330  * @brief Level Control Cluster StepWithOnOff Command callback
331  * @param stepMode
332  * @param stepSize
333  * @param transitionTime
334  */
335
336 bool emberAfLevelControlClusterStepWithOnOffCallback(uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime);
337
338 /**
339  * @brief Level Control Cluster Stop Command callback
340  * @param optionMask
341  * @param optionOverride
342  */
343
344 bool emberAfLevelControlClusterStopCallback(uint8_t optionMask, uint8_t optionOverride);
345
346 /**
347  * @brief Level Control Cluster StopWithOnOff Command callback
348  */
349
350 bool emberAfLevelControlClusterStopWithOnOffCallback();
351
352 /**
353  * @brief On/off Cluster Off Command callback
354  */
355
356 bool emberAfOnOffClusterOffCallback();
357
358 /**
359  * @brief On/off Cluster On Command callback
360  */
361
362 bool emberAfOnOffClusterOnCallback();
363
364 /**
365  * @brief On/off Cluster Toggle Command callback
366  */
367
368 bool emberAfOnOffClusterToggleCallback();
369
370 //
371 // Non-Cluster Related Callbacks
372 //
373
374 /** @brief Add To Current App Tasks
375  *
376  * This function is only useful to sleepy end devices.  This function will note
377  * the passed item as part of a set of tasks the application has outstanding
378  * (e.g. message sent requiring APS acknwoledgement).  This will affect how the
379  * application behaves with regard to sleeping and polling.  Until the
380  * outstanding task is completed, the device may poll more frequently and sleep
381  * less often.
382  *
383  * @param tasks   Ver.: always
384  */
385 void emberAfAddToCurrentAppTasksCallback(EmberAfApplicationTask tasks);
386
387 /** @brief Remove From Current App Tasks
388  *
389  * This function is only useful to sleepy end devices.  This function will
390  * remove the passed item from the set of tasks the application has outstanding
391  * (e.g. message sent requiring APS acknwoledgement).  This will affect how the
392  * application behaves with regard to sleeping and polling.  Removing the item
393  * from the list of outstanding tasks may allow the device to sleep longer and
394  * poll less frequently.  If there are other outstanding tasks the system may
395  * still have to stay away and poll more often.
396  *
397  * @param tasks   Ver.: always
398  */
399 void emberAfRemoveFromCurrentAppTasksCallback(EmberAfApplicationTask tasks);
400
401 /** @brief Allow Network Write Attribute
402  *
403  * This function is called by the application framework before it writes an
404  * attribute in response to a write attribute request from an external device.
405  * The value passed into this callback is the value to which the attribute is to
406  * be set by the framework.
407         Example:        In mirroring simple metering data
408  * on an Energy Services Interface (ESI) (formerly called Energy Service Portal
409  * (ESP) in SE 1.0).), a mirrored simple meter needs to write read-only
410  * attributes on its mirror. The-meter-mirror sample application, located in
411  * app/framework/sample-apps, uses this callback to allow the mirrored device to
412  * write simple metering attributes on the mirror regardless of the fact that
413  * most simple metering attributes are defined as read-only by the ZigBee
414  * specification.
415         Note:   The ZCL specification does not (as of this
416  * writing) specify any permission-level security for writing writeable
417  * attributes. As far as the ZCL specification is concerned, if an attribute is
418  * writeable, any device that has a link key for the device should be able to
419  * write that attribute. Furthermore if an attribute is read only, it should not
420  * be written over the air. Thus, if you implement permissions for writing
421  * attributes as a feature, you MAY be operating outside the specification. This
422  * is unlikely to be a problem for writing read-only attributes, but it may be a
423  * problem for attributes that are writeable according to the specification but
424  * restricted by the application implementing this callback.
425  *
426  * @param endpoint   Ver.: always
427  * @param clusterId   Ver.: always
428  * @param attributeId   Ver.: always
429  * @param mask   Ver.: always
430  * @param manufacturerCode   Ver.: always
431  * @param value   Ver.: always
432  * @param type   Ver.: always
433  */
434 EmberAfAttributeWritePermission emberAfAllowNetworkWriteAttributeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
435                                                                           chip::AttributeId attributeId, uint8_t mask,
436                                                                           uint16_t manufacturerCode, uint8_t * value, uint8_t type);
437
438 /** @brief Attribute Read Access
439  *
440  * This function is called whenever the Application Framework needs to check
441  * access permission for an attribute read.
442  *
443  * @param endpoint   Ver.: always
444  * @param clusterId   Ver.: always
445  * @param manufacturerCode   Ver.: always
446  * @param attributeId   Ver.: always
447  */
448 bool emberAfAttributeReadAccessCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, uint16_t manufacturerCode,
449                                         chip::AttributeId attributeId);
450
451 /** @brief Attribute Write Access
452  *
453  * This function is called whenever the Application Framework needs to check
454  * access permission for an attribute write.
455  *
456  * @param endpoint   Ver.: always
457  * @param clusterId   Ver.: always
458  * @param manufacturerCode   Ver.: always
459  * @param attributeId   Ver.: always
460  */
461 bool emberAfAttributeWriteAccessCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, uint16_t manufacturerCode,
462                                          chip::AttributeId attributeId);
463
464 /** @brief Default Response
465  *
466  * This function is called by the application framework when a Default Response
467  * command is received from an external device.  The application should return
468  * true if the message was processed or false if it was not.
469  *
470  * @param clusterId The cluster identifier of this response.  Ver.: always
471  * @param commandId The command identifier to which this is a response.  Ver.:
472  * always
473  * @param status Specifies either SUCCESS or the nature of the error that was
474  * detected in the received command.  Ver.: always
475  */
476 bool emberAfDefaultResponseCallback(chip::ClusterId clusterId, chip::CommandId commandId, EmberAfStatus status);
477
478 /** @brief Configure Reporting Response
479  *
480  * This function is called by the application framework when a Configure
481  * Reporting Response command is received from an external device.  The
482  * application should return true if the message was processed or false if it
483  * was not.
484  *
485  * @param clusterId The cluster identifier of this response.  Ver.: always
486  * @param buffer Buffer containing the list of attribute status records.  Ver.:
487  * always
488  * @param bufLen The length in bytes of the list.  Ver.: always
489  */
490 bool emberAfConfigureReportingResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
491
492 /** @brief Read Reporting Configuration Response
493  *
494  * This function is called by the application framework when a Read Reporting
495  * Configuration Response command is received from an external device.  The
496  * application should return true if the message was processed or false if it
497  * was not.
498  *
499  * @param clusterId The cluster identifier of this response.  Ver.: always
500  * @param buffer Buffer containing the list of attribute reporting configuration
501  * records.  Ver.: always
502  * @param bufLen The length in bytes of the list.  Ver.: always
503  */
504 bool emberAfReadReportingConfigurationResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
505
506 /** @brief Discover Attributes Response
507  *
508  * This function is called by the application framework when a Discover
509  * Attributes Response or Discover Attributes Extended Response command is
510  * received from an external device.  The Discover Attributes Response command
511  * contains a bool indicating if discovery is complete and a list of zero or
512  * more attribute identifier/type records. The final argument indicates whether
513  * the response is in the extended format or not.  The application should return
514  * true if the message was processed or false if it was not.
515  *
516  * @param clusterId The cluster identifier of this response.  Ver.: always
517  * @param discoveryComplete Indicates whether there are more attributes to be
518  * discovered.  true if there are no more attributes to be discovered.  Ver.:
519  * always
520  * @param buffer Buffer containing the list of attribute identifier/type
521  * records.  Ver.: always
522  * @param bufLen The length in bytes of the list.  Ver.: always
523  * @param extended Indicates whether the response is in the extended format or
524  * not.  Ver.: always
525  */
526 bool emberAfDiscoverAttributesResponseCallback(chip::ClusterId clusterId, bool discoveryComplete, uint8_t * buffer, uint16_t bufLen,
527                                                bool extended);
528
529 /** @brief Discover Commands Generated Response
530  *
531  * This function is called by the framework when Discover Commands Generated
532  * Response is received.
533  *
534  * @param clusterId The cluster identifier of this response.  Ver.: always
535  * @param manufacturerCode Manufacturer code  Ver.: always
536  * @param discoveryComplete Indicates whether there are more commands to be
537  * discovered.  Ver.: always
538  * @param commandIds Buffer containing the list of command identifiers.  Ver.:
539  * always
540  * @param commandIdCount The length of bytes of the list, whish is the same as
541  * the number of identifiers.  Ver.: always
542  */
543 bool emberAfDiscoverCommandsGeneratedResponseCallback(chip::ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete,
544                                                       chip::CommandId * commandIds, uint16_t commandIdCount);
545
546 /** @brief Discover Commands Received Response
547  *
548  * This function is called by the framework when Discover Commands Received
549  * Response is received.
550  *
551  * @param clusterId The cluster identifier of this response.  Ver.: always
552  * @param manufacturerCode Manufacturer code  Ver.: always
553  * @param discoveryComplete Indicates whether there are more commands to be
554  * discovered.  Ver.: always
555  * @param commandIds Buffer containing the list of command identifiers.  Ver.:
556  * always
557  * @param commandIdCount The length of bytes of the list, whish is the same as
558  * the number of identifiers.  Ver.: always
559  */
560 bool emberAfDiscoverCommandsReceivedResponseCallback(chip::ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete,
561                                                      chip::CommandId * commandIds, uint16_t commandIdCount);
562
563 /** @brief Pre Command Received
564  *
565  * This callback is the second in the Application Framework's message processing
566  * chain. At this point in the processing of incoming over-the-air messages, the
567  * application has determined that the incoming message is a ZCL command. It
568  * parses enough of the message to populate an EmberAfClusterCommand struct. The
569  * Application Framework defines this struct value in a local scope to the
570  * command processing but also makes it available through a global pointer
571  * called emberAfCurrentCommand, in app/framework/util/util.c. When command
572  * processing is complete, this pointer is cleared.
573  *
574  * @param cmd   Ver.: always
575  */
576 bool emberAfPreCommandReceivedCallback(EmberAfClusterCommand * cmd);
577
578 /** @brief Pre Message Send
579  *
580  * This function is called by the framework when it is about to pass a message
581  * to the stack primitives for sending.   This message may or may not be ZCL,
582  * ZDO, or some other protocol.  This is called prior to
583         any ZigBee
584  * fragmentation that may be done.  If the function returns true it is assumed
585  * the callback has consumed and processed the message.  The callback must also
586  * set the EmberStatus status code to be passed back to the caller.  The
587  * framework will do no further processing on the message.
588         If the
589  * function returns false then it is assumed that the callback has not processed
590  * the mesasge and the framework will continue to process accordingly.
591  *
592  * @param messageStruct The structure containing the parameters of the APS
593  * message to be sent.  Ver.: always
594  * @param status A pointer to the status code value that will be returned to the
595  * caller.  Ver.: always
596  */
597 bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberStatus * status);
598
599 /** @brief Message Sent
600  *
601  * This function is called by the application framework from the message sent
602  * handler, when it is informed by the stack regarding the message sent status.
603  * All of the values passed to the emberMessageSentHandler are passed on to this
604  * callback. This provides an opportunity for the application to verify that its
605  * message has been sent successfully and take the appropriate action. This
606  * callback should return a bool value of true or false. A value of true
607  * indicates that the message sent notification has been handled and should not
608  * be handled by the application framework.
609  *
610  * @param type   Ver.: always
611  * @param indexOrDestination   Ver.: always
612  * @param apsFrame   Ver.: always
613  * @param msgLen   Ver.: always
614  * @param message   Ver.: always
615  * @param status   Ver.: always
616  */
617 bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame,
618                                 uint16_t msgLen, uint8_t * message, EmberStatus status);
619
620 /** @brief Pre Attribute Change
621  *
622  * This function is called by the application framework before it changes an
623  * attribute value.  The value passed into this callback is the value to which
624  * the attribute is to be set by the framework.  The application should return
625  * ::EMBER_ZCL_STATUS_SUCCESS to permit the change or any other ::EmberAfStatus
626  * to reject it.
627  *
628  * @param endpoint   Ver.: always
629  * @param clusterId   Ver.: always
630  * @param attributeId   Ver.: always
631  * @param mask   Ver.: always
632  * @param manufacturerCode   Ver.: always
633  * @param type   Ver.: always
634  * @param size   Ver.: always
635  * @param value   Ver.: always
636  */
637 EmberAfStatus emberAfPreAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
638                                                 uint8_t mask, uint16_t manufacturerCode, uint8_t type, uint8_t size,
639                                                 uint8_t * value);
640
641 /** @brief Post Attribute Change
642  *
643  * This function is called by the application framework after it changes an
644  * attribute value. The value passed into this callback is the value to which
645  * the attribute was set by the framework.
646  *
647  * @param endpoint   Ver.: always
648  * @param clusterId   Ver.: always
649  * @param attributeId   Ver.: always
650  * @param mask   Ver.: always
651  * @param manufacturerCode   Ver.: always
652  * @param type   Ver.: always
653  * @param size   Ver.: always
654  * @param value   Ver.: always
655  */
656 void emberAfPostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
657                                         uint8_t mask, uint16_t manufacturerCode, uint8_t type, uint8_t size, uint8_t * value);
658
659 /** @brief Read Attributes Response
660  *
661  * This function is called by the application framework when a Read Attributes
662  * Response command is received from an external device.  The application should
663  * return true if the message was processed or false if it was not.
664  *
665  * @param clusterId The cluster identifier of this response.  Ver.: always
666  * @param buffer Buffer containing the list of read attribute status records.
667  * Ver.: always
668  * @param bufLen The length in bytes of the list.  Ver.: always
669  */
670 bool emberAfReadAttributesResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
671
672 /** @brief External Attribute Read
673  *
674  * Like emberAfExternalAttributeWriteCallback above, this function is called
675  * when the framework needs to read an attribute that is not stored within the
676  * Application Framework's data structures.
677         All of the important
678  * information about the attribute itself is passed as a pointer to an
679  * EmberAfAttributeMetadata struct, which is stored within the application and
680  * used to manage the attribute. A complete description of the
681  * EmberAfAttributeMetadata struct is provided in
682  * app/framework/include/af-types.h
683         This function assumes that the
684  * application is able to read the attribute, write it into the passed buffer,
685  * and return immediately. Any attributes that require a state machine for
686  * reading and writing are not really candidates for externalization at the
687  * present time. The Application Framework does not currently include a state
688  * machine for reading or writing attributes that must take place across a
689  * series of application ticks. Attributes that cannot be read in a timely
690  * manner should be stored within the Application Framework and updated
691  * occasionally by the application code from within the
692  * emberAfMainTickCallback.
693         If the application was successfully able to
694  * read the attribute and write it into the passed buffer, it should return a
695  * value of EMBER_ZCL_STATUS_SUCCESS. Ensure that the size of the externally
696  * managed attribute value is smaller than what the buffer can hold. In the case
697  * of a buffer overflow throw an appropriate error such as
698  * EMBER_ZCL_STATUS_INSUFFICIENT_SPACE. Any other return value indicates the
699  * application was not able to read the attribute.
700  *
701  * @param endpoint   Ver.: always
702  * @param clusterId   Ver.: always
703  * @param attributeMetadata   Ver.: always
704  * @param manufacturerCode   Ver.: always
705  * @param buffer   Ver.: always
706  * @param maxReadLength   Ver.: always
707  */
708 EmberAfStatus emberAfExternalAttributeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
709                                                    EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
710                                                    uint8_t * buffer, uint16_t maxReadLength);
711
712 /** @brief Write Attributes Response
713  *
714  * This function is called by the application framework when a Write Attributes
715  * Response command is received from an external device.  The application should
716  * return true if the message was processed or false if it was not.
717  *
718  * @param clusterId The cluster identifier of this response.  Ver.: always
719  * @param buffer Buffer containing the list of write attribute status records.
720  * Ver.: always
721  * @param bufLen The length in bytes of the list.  Ver.: always
722  */
723 bool emberAfWriteAttributesResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
724
725 /** @brief External Attribute Write
726  *
727  * This function is called whenever the Application Framework needs to write an
728  * attribute which is not stored within the data structures of the Application
729  * Framework itself. One of the new features in Version 2 is the ability to
730  * store attributes outside the Framework. This is particularly useful for
731  * attributes that do not need to be stored because they can be read off the
732  * hardware when they are needed, or are stored in some central location used by
733  * many modules within the system. In this case, you can indicate that the
734  * attribute is stored externally. When the framework needs to write an external
735  * attribute, it makes a call to this callback.
736         This callback is very
737  * useful for host micros which need to store attributes in persistent memory.
738  * Because each host micro (used with an Ember NCP) has its own type of
739  * persistent memory storage, the Application Framework does not include the
740  * ability to mark attributes as stored in flash the way that it does for Ember
741  * SoCs like the EM35x. On a host micro, any attributes that need to be stored
742  * in persistent memory should be marked as external and accessed through the
743  * external read and write callbacks. Any host code associated with the
744  * persistent storage should be implemented within this callback.
745         All of
746  * the important information about the attribute itself is passed as a pointer
747  * to an EmberAfAttributeMetadata struct, which is stored within the application
748  * and used to manage the attribute. A complete description of the
749  * EmberAfAttributeMetadata struct is provided in
750  * app/framework/include/af-types.h.
751         This function assumes that the
752  * application is able to write the attribute and return immediately. Any
753  * attributes that require a state machine for reading and writing are not
754  * candidates for externalization at the present time. The Application Framework
755  * does not currently include a state machine for reading or writing attributes
756  * that must take place across a series of application ticks. Attributes that
757  * cannot be written immediately should be stored within the Application
758  * Framework and updated occasionally by the application code from within the
759  * emberAfMainTickCallback.
760         If the application was successfully able to
761  * write the attribute, it returns a value of EMBER_ZCL_STATUS_SUCCESS. Any
762  * other return value indicates the application was not able to write the
763  * attribute.
764  *
765  * @param endpoint   Ver.: always
766  * @param clusterId   Ver.: always
767  * @param attributeMetadata   Ver.: always
768  * @param manufacturerCode   Ver.: always
769  * @param buffer   Ver.: always
770  */
771 EmberAfStatus emberAfExternalAttributeWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
772                                                     EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
773                                                     uint8_t * buffer);
774
775 /** @brief Report Attributes
776  *
777  * This function is called by the application framework when a Report Attributes
778  * command is received from an external device.  The application should return
779  * true if the message was processed or false if it was not.
780  *
781  * @param clusterId The cluster identifier of this command.  Ver.: always
782  * @param buffer Buffer containing the list of attribute report records.  Ver.:
783  * always
784  * @param bufLen The length in bytes of the list.  Ver.: always
785  */
786 bool emberAfReportAttributesCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
787
788 /** @brief Get Current Time
789  *
790  * This callback is called when device attempts to get current time from the
791  * hardware. If this device has means to retrieve exact time, then this method
792  * should implement it. If the callback can't provide the exact time it should
793  * return 0 to indicate failure. Default action is to return 0, which indicates
794  * that device does not have access to real time.
795  *
796  */
797 uint32_t emberAfGetCurrentTimeCallback();
798
799 /** @brief Get Endpoint Info
800  *
801  * This function is a callback to an application implemented endpoint that
802  * operates outside the normal application framework.  When the framework wishes
803  * to perform operations with that endpoint it uses this callback to retrieve
804  * the endpoint's information.  If the endpoint exists and the application can
805  * provide data then true shall be returned.  Otherwise the callback must return
806  * false.
807  *
808  * @param endpoint The endpoint to retrieve data for.  Ver.: always
809  * @param returnNetworkIndex The index corresponding to the ZigBee network the
810  * endpoint belongs to.  If not using a multi-network device, 0 must be
811  * returned.  Otherwise on a multi-network device the stack will switch to this
812  * network before sending the message.  Ver.: always
813  * @param returnEndpointInfo A pointer to a data struct that will be written
814  * with information about the endpoint.  Ver.: always
815  */
816 bool emberAfGetEndpointInfoCallback(chip::EndpointId endpoint, uint8_t * returnNetworkIndex,
817                                     EmberAfEndpointInfoStruct * returnEndpointInfo);
818
819 /** @brief Get Source Route Overhead
820  *
821  * This function is called by the framework to determine the overhead required
822  * in the network frame for source routing to a particular destination.
823  *
824  * @param destination The node id of the destination  Ver.: always
825  */
826 uint8_t emberAfGetSourceRouteOverheadCallback(chip::NodeId destination);
827
828 /** @brief Registration Abort
829  *
830  * This callback is called when the device should abort the registration
831  * process.
832  *
833  */
834 void emberAfRegistrationAbortCallback();
835
836 /** @brief Interpan Send Message
837  *
838  * This function will send a raw MAC message with interpan frame format using
839  * the passed parameters.
840  *
841  * @param header Interpan header info  Ver.: always
842  * @param messageLength The length of the message received or to send  Ver.:
843  * always
844  * @param message The message data received or to send.  Ver.: always
845  */
846 EmberStatus emberAfInterpanSendMessageCallback(EmberAfInterpanHeader * header, uint16_t messageLength, uint8_t * message);
847
848 /** @brief Start Move
849  *
850  * This function is called to initiate the process for a device to move (rejoin)
851  * to a new parent.
852  *
853  */
854 bool emberAfStartMoveCallback();