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