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