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