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