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