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