3 * Copyright (c) 2021 Project CHIP Authors
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 // THIS FILE IS GENERATED BY ZAP
20 // Prevent multiple inclusion
23 #include "af-structs.h"
25 #include "basic-types.h"
27 /** @brief Cluster Init
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.
33 * @param endpoint Ver.: always
34 * @param clusterId Ver.: always
36 void emberAfClusterInitCallback(chip::EndpointId endpoint, chip::ClusterId clusterId);
38 // Cluster Init Functions
40 /** @brief Basic Cluster Init
44 * @param endpoint Endpoint that is being initialized
46 void emberAfBasicClusterInitCallback(chip::EndpointId endpoint);
48 /** @brief Level Control Cluster Init
52 * @param endpoint Endpoint that is being initialized
54 void emberAfLevelControlClusterInitCallback(chip::EndpointId endpoint);
56 /** @brief On/off Cluster Init
60 * @param endpoint Endpoint that is being initialized
62 void emberAfOnOffClusterInitCallback(chip::EndpointId endpoint);
64 // Cluster Server/Client Init Functions
67 // Basic Cluster server
70 /** @brief Basic Cluster Server Init
74 * @param endpoint Endpoint that is being initialized
76 void emberAfBasicClusterServerInitCallback(chip::EndpointId endpoint);
78 /** @brief Basic Cluster Server Attribute Changed
80 * Server Attribute Changed
82 * @param endpoint Endpoint that is being initialized
83 * @param attributeId Attribute that changed
85 void emberAfBasicClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
87 /** @brief Basic Cluster Server Manufacturer Specific Attribute Changed
89 * Server Manufacturer Specific Attribute Changed
91 * @param endpoint Endpoint that is being initialized
92 * @param attributeId Attribute that changed
93 * @param manufacturerCode Manufacturer Code of the attribute that changed
95 void emberAfBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
96 uint16_t manufacturerCode);
98 /** @brief Basic Cluster Server Message Sent
100 * Server Message Sent
102 * @param type The type of message sent
103 * @param indexOrDestination The destination or address to which the message was sent
104 * @param apsFrame The APS frame for the message
105 * @param msgLen The length of the message
106 * @param message The message that was sent
107 * @param status The status of the sent message
109 void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
110 EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status);
112 /** @brief Basic Cluster Server Pre Attribute Changed
114 * server Pre Attribute Changed
116 * @param endpoint Endpoint that is being initialized
117 * @param attributeId Attribute to be changed
118 * @param attributeType Attribute type
119 * @param size Attribute size
120 * @param value Attribute value
122 EmberAfStatus emberAfBasicClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
123 EmberAfAttributeType attributeType, uint8_t size,
126 /** @brief Basic Cluster Server Tick
130 * @param endpoint Endpoint that is being served
132 void emberAfBasicClusterServerTickCallback(chip::EndpointId endpoint);
135 // Level Control Cluster server
138 /** @brief Level Control Cluster Server Init
142 * @param endpoint Endpoint that is being initialized
144 void emberAfLevelControlClusterServerInitCallback(chip::EndpointId endpoint);
146 /** @brief Level Control Cluster Server Attribute Changed
148 * Server Attribute Changed
150 * @param endpoint Endpoint that is being initialized
151 * @param attributeId Attribute that changed
153 void emberAfLevelControlClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
155 /** @brief Level Control Cluster Server Manufacturer Specific Attribute Changed
157 * Server Manufacturer Specific Attribute Changed
159 * @param endpoint Endpoint that is being initialized
160 * @param attributeId Attribute that changed
161 * @param manufacturerCode Manufacturer Code of the attribute that changed
163 void emberAfLevelControlClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
164 chip::AttributeId attributeId,
165 uint16_t manufacturerCode);
167 /** @brief Level Control Cluster Server Message Sent
169 * Server Message Sent
171 * @param type The type of message sent
172 * @param indexOrDestination The destination or address to which the message was sent
173 * @param apsFrame The APS frame for the message
174 * @param msgLen The length of the message
175 * @param message The message that was sent
176 * @param status The status of the sent message
178 void emberAfLevelControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
179 EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
182 /** @brief Level Control Cluster Server Pre Attribute Changed
184 * server Pre Attribute Changed
186 * @param endpoint Endpoint that is being initialized
187 * @param attributeId Attribute to be changed
188 * @param attributeType Attribute type
189 * @param size Attribute size
190 * @param value Attribute value
192 EmberAfStatus emberAfLevelControlClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
193 EmberAfAttributeType attributeType, uint8_t size,
196 /** @brief Level Control Cluster Server Tick
200 * @param endpoint Endpoint that is being served
202 void emberAfLevelControlClusterServerTickCallback(chip::EndpointId endpoint);
205 // On/off Cluster server
208 /** @brief On/off Cluster Server Init
212 * @param endpoint Endpoint that is being initialized
214 void emberAfOnOffClusterServerInitCallback(chip::EndpointId endpoint);
216 /** @brief On/off Cluster Server Attribute Changed
218 * Server Attribute Changed
220 * @param endpoint Endpoint that is being initialized
221 * @param attributeId Attribute that changed
223 void emberAfOnOffClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
225 /** @brief On/off Cluster Server Manufacturer Specific Attribute Changed
227 * Server Manufacturer Specific Attribute Changed
229 * @param endpoint Endpoint that is being initialized
230 * @param attributeId Attribute that changed
231 * @param manufacturerCode Manufacturer Code of the attribute that changed
233 void emberAfOnOffClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
234 uint16_t manufacturerCode);
236 /** @brief On/off Cluster Server Message Sent
238 * Server Message Sent
240 * @param type The type of message sent
241 * @param indexOrDestination The destination or address to which the message was sent
242 * @param apsFrame The APS frame for the message
243 * @param msgLen The length of the message
244 * @param message The message that was sent
245 * @param status The status of the sent message
247 void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
248 EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status);
250 /** @brief On/off Cluster Server Pre Attribute Changed
252 * server Pre Attribute Changed
254 * @param endpoint Endpoint that is being initialized
255 * @param attributeId Attribute to be changed
256 * @param attributeType Attribute type
257 * @param size Attribute size
258 * @param value Attribute value
260 EmberAfStatus emberAfOnOffClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
261 EmberAfAttributeType attributeType, uint8_t size,
264 /** @brief On/off Cluster Server Tick
268 * @param endpoint Endpoint that is being served
270 void emberAfOnOffClusterServerTickCallback(chip::EndpointId endpoint);
272 // Cluster Commands Callback
275 * @brief Basic Cluster ResetToFactoryDefaults Command callback
278 bool emberAfBasicClusterResetToFactoryDefaultsCallback();
281 * @brief Level Control Cluster Move Command callback
285 * @param optionOverride
288 bool emberAfLevelControlClusterMoveCallback(uint8_t moveMode, uint8_t rate, uint8_t optionMask, uint8_t optionOverride);
291 * @brief Level Control Cluster MoveToLevel Command callback
293 * @param transitionTime
295 * @param optionOverride
298 bool emberAfLevelControlClusterMoveToLevelCallback(uint8_t level, uint16_t transitionTime, uint8_t optionMask,
299 uint8_t optionOverride);
302 * @brief Level Control Cluster MoveToLevelWithOnOff Command callback
304 * @param transitionTime
307 bool emberAfLevelControlClusterMoveToLevelWithOnOffCallback(uint8_t level, uint16_t transitionTime);
310 * @brief Level Control Cluster MoveWithOnOff Command callback
315 bool emberAfLevelControlClusterMoveWithOnOffCallback(uint8_t moveMode, uint8_t rate);
318 * @brief Level Control Cluster Step Command callback
321 * @param transitionTime
323 * @param optionOverride
326 bool emberAfLevelControlClusterStepCallback(uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime, uint8_t optionMask,
327 uint8_t optionOverride);
330 * @brief Level Control Cluster StepWithOnOff Command callback
333 * @param transitionTime
336 bool emberAfLevelControlClusterStepWithOnOffCallback(uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime);
339 * @brief Level Control Cluster Stop Command callback
341 * @param optionOverride
344 bool emberAfLevelControlClusterStopCallback(uint8_t optionMask, uint8_t optionOverride);
347 * @brief Level Control Cluster StopWithOnOff Command callback
350 bool emberAfLevelControlClusterStopWithOnOffCallback();
353 * @brief On/off Cluster Off Command callback
356 bool emberAfOnOffClusterOffCallback();
359 * @brief On/off Cluster On Command callback
362 bool emberAfOnOffClusterOnCallback();
365 * @brief On/off Cluster Toggle Command callback
368 bool emberAfOnOffClusterToggleCallback();
371 // Non-Cluster Related Callbacks
374 /** @brief Add To Current App Tasks
376 * This function is only useful to sleepy end devices. This function will note
377 * the passed item as part of a set of tasks the application has outstanding
378 * (e.g. message sent requiring APS acknwoledgement). This will affect how the
379 * application behaves with regard to sleeping and polling. Until the
380 * outstanding task is completed, the device may poll more frequently and sleep
383 * @param tasks Ver.: always
385 void emberAfAddToCurrentAppTasksCallback(EmberAfApplicationTask tasks);
387 /** @brief Remove From Current App Tasks
389 * This function is only useful to sleepy end devices. This function will
390 * remove the passed item from the set of tasks the application has outstanding
391 * (e.g. message sent requiring APS acknwoledgement). This will affect how the
392 * application behaves with regard to sleeping and polling. Removing the item
393 * from the list of outstanding tasks may allow the device to sleep longer and
394 * poll less frequently. If there are other outstanding tasks the system may
395 * still have to stay away and poll more often.
397 * @param tasks Ver.: always
399 void emberAfRemoveFromCurrentAppTasksCallback(EmberAfApplicationTask tasks);
401 /** @brief Allow Network Write Attribute
403 * This function is called by the application framework before it writes an
404 * attribute in response to a write attribute request from an external device.
405 * The value passed into this callback is the value to which the attribute is to
406 * be set by the framework.
407 Example: In mirroring simple metering data
408 * on an Energy Services Interface (ESI) (formerly called Energy Service Portal
409 * (ESP) in SE 1.0).), a mirrored simple meter needs to write read-only
410 * attributes on its mirror. The-meter-mirror sample application, located in
411 * app/framework/sample-apps, uses this callback to allow the mirrored device to
412 * write simple metering attributes on the mirror regardless of the fact that
413 * most simple metering attributes are defined as read-only by the ZigBee
415 Note: The ZCL specification does not (as of this
416 * writing) specify any permission-level security for writing writeable
417 * attributes. As far as the ZCL specification is concerned, if an attribute is
418 * writeable, any device that has a link key for the device should be able to
419 * write that attribute. Furthermore if an attribute is read only, it should not
420 * be written over the air. Thus, if you implement permissions for writing
421 * attributes as a feature, you MAY be operating outside the specification. This
422 * is unlikely to be a problem for writing read-only attributes, but it may be a
423 * problem for attributes that are writeable according to the specification but
424 * restricted by the application implementing this callback.
426 * @param endpoint Ver.: always
427 * @param clusterId Ver.: always
428 * @param attributeId Ver.: always
429 * @param mask Ver.: always
430 * @param manufacturerCode Ver.: always
431 * @param value Ver.: always
432 * @param type Ver.: always
434 EmberAfAttributeWritePermission emberAfAllowNetworkWriteAttributeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
435 chip::AttributeId attributeId, uint8_t mask,
436 uint16_t manufacturerCode, uint8_t * value, uint8_t type);
438 /** @brief Attribute Read Access
440 * This function is called whenever the Application Framework needs to check
441 * access permission for an attribute read.
443 * @param endpoint Ver.: always
444 * @param clusterId Ver.: always
445 * @param manufacturerCode Ver.: always
446 * @param attributeId Ver.: always
448 bool emberAfAttributeReadAccessCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, uint16_t manufacturerCode,
449 chip::AttributeId attributeId);
451 /** @brief Attribute Write Access
453 * This function is called whenever the Application Framework needs to check
454 * access permission for an attribute write.
456 * @param endpoint Ver.: always
457 * @param clusterId Ver.: always
458 * @param manufacturerCode Ver.: always
459 * @param attributeId Ver.: always
461 bool emberAfAttributeWriteAccessCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, uint16_t manufacturerCode,
462 chip::AttributeId attributeId);
464 /** @brief Default Response
466 * This function is called by the application framework when a Default Response
467 * command is received from an external device. The application should return
468 * true if the message was processed or false if it was not.
470 * @param clusterId The cluster identifier of this response. Ver.: always
471 * @param commandId The command identifier to which this is a response. Ver.:
473 * @param status Specifies either SUCCESS or the nature of the error that was
474 * detected in the received command. Ver.: always
476 bool emberAfDefaultResponseCallback(chip::ClusterId clusterId, chip::CommandId commandId, EmberAfStatus status);
478 /** @brief Configure Reporting Response
480 * This function is called by the application framework when a Configure
481 * Reporting Response command is received from an external device. The
482 * application should return true if the message was processed or false if it
485 * @param clusterId The cluster identifier of this response. Ver.: always
486 * @param buffer Buffer containing the list of attribute status records. Ver.:
488 * @param bufLen The length in bytes of the list. Ver.: always
490 bool emberAfConfigureReportingResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
492 /** @brief Read Reporting Configuration Response
494 * This function is called by the application framework when a Read Reporting
495 * Configuration Response command is received from an external device. The
496 * application should return true if the message was processed or false if it
499 * @param clusterId The cluster identifier of this response. Ver.: always
500 * @param buffer Buffer containing the list of attribute reporting configuration
501 * records. Ver.: always
502 * @param bufLen The length in bytes of the list. Ver.: always
504 bool emberAfReadReportingConfigurationResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
506 /** @brief Discover Attributes Response
508 * This function is called by the application framework when a Discover
509 * Attributes Response or Discover Attributes Extended Response command is
510 * received from an external device. The Discover Attributes Response command
511 * contains a bool indicating if discovery is complete and a list of zero or
512 * more attribute identifier/type records. The final argument indicates whether
513 * the response is in the extended format or not. The application should return
514 * true if the message was processed or false if it was not.
516 * @param clusterId The cluster identifier of this response. Ver.: always
517 * @param discoveryComplete Indicates whether there are more attributes to be
518 * discovered. true if there are no more attributes to be discovered. Ver.:
520 * @param buffer Buffer containing the list of attribute identifier/type
521 * records. Ver.: always
522 * @param bufLen The length in bytes of the list. Ver.: always
523 * @param extended Indicates whether the response is in the extended format or
526 bool emberAfDiscoverAttributesResponseCallback(chip::ClusterId clusterId, bool discoveryComplete, uint8_t * buffer, uint16_t bufLen,
529 /** @brief Discover Commands Generated Response
531 * This function is called by the framework when Discover Commands Generated
532 * Response is received.
534 * @param clusterId The cluster identifier of this response. Ver.: always
535 * @param manufacturerCode Manufacturer code Ver.: always
536 * @param discoveryComplete Indicates whether there are more commands to be
537 * discovered. Ver.: always
538 * @param commandIds Buffer containing the list of command identifiers. Ver.:
540 * @param commandIdCount The length of bytes of the list, whish is the same as
541 * the number of identifiers. Ver.: always
543 bool emberAfDiscoverCommandsGeneratedResponseCallback(chip::ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete,
544 chip::CommandId * commandIds, uint16_t commandIdCount);
546 /** @brief Discover Commands Received Response
548 * This function is called by the framework when Discover Commands Received
549 * Response is received.
551 * @param clusterId The cluster identifier of this response. Ver.: always
552 * @param manufacturerCode Manufacturer code Ver.: always
553 * @param discoveryComplete Indicates whether there are more commands to be
554 * discovered. Ver.: always
555 * @param commandIds Buffer containing the list of command identifiers. Ver.:
557 * @param commandIdCount The length of bytes of the list, whish is the same as
558 * the number of identifiers. Ver.: always
560 bool emberAfDiscoverCommandsReceivedResponseCallback(chip::ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete,
561 chip::CommandId * commandIds, uint16_t commandIdCount);
563 /** @brief Pre Command Received
565 * This callback is the second in the Application Framework's message processing
566 * chain. At this point in the processing of incoming over-the-air messages, the
567 * application has determined that the incoming message is a ZCL command. It
568 * parses enough of the message to populate an EmberAfClusterCommand struct. The
569 * Application Framework defines this struct value in a local scope to the
570 * command processing but also makes it available through a global pointer
571 * called emberAfCurrentCommand, in app/framework/util/util.c. When command
572 * processing is complete, this pointer is cleared.
574 * @param cmd Ver.: always
576 bool emberAfPreCommandReceivedCallback(EmberAfClusterCommand * cmd);
578 /** @brief Pre Message Send
580 * This function is called by the framework when it is about to pass a message
581 * to the stack primitives for sending. This message may or may not be ZCL,
582 * ZDO, or some other protocol. This is called prior to
584 * fragmentation that may be done. If the function returns true it is assumed
585 * the callback has consumed and processed the message. The callback must also
586 * set the EmberStatus status code to be passed back to the caller. The
587 * framework will do no further processing on the message.
589 * function returns false then it is assumed that the callback has not processed
590 * the mesasge and the framework will continue to process accordingly.
592 * @param messageStruct The structure containing the parameters of the APS
593 * message to be sent. Ver.: always
594 * @param status A pointer to the status code value that will be returned to the
595 * caller. Ver.: always
597 bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberStatus * status);
599 /** @brief Message Sent
601 * This function is called by the application framework from the message sent
602 * handler, when it is informed by the stack regarding the message sent status.
603 * All of the values passed to the emberMessageSentHandler are passed on to this
604 * callback. This provides an opportunity for the application to verify that its
605 * message has been sent successfully and take the appropriate action. This
606 * callback should return a bool value of true or false. A value of true
607 * indicates that the message sent notification has been handled and should not
608 * be handled by the application framework.
610 * @param type Ver.: always
611 * @param indexOrDestination Ver.: always
612 * @param apsFrame Ver.: always
613 * @param msgLen Ver.: always
614 * @param message Ver.: always
615 * @param status Ver.: always
617 bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame,
618 uint16_t msgLen, uint8_t * message, EmberStatus status);
620 /** @brief Pre Attribute Change
622 * This function is called by the application framework before it changes an
623 * attribute value. The value passed into this callback is the value to which
624 * the attribute is to be set by the framework. The application should return
625 * ::EMBER_ZCL_STATUS_SUCCESS to permit the change or any other ::EmberAfStatus
628 * @param endpoint Ver.: always
629 * @param clusterId Ver.: always
630 * @param attributeId Ver.: always
631 * @param mask Ver.: always
632 * @param manufacturerCode Ver.: always
633 * @param type Ver.: always
634 * @param size Ver.: always
635 * @param value Ver.: always
637 EmberAfStatus emberAfPreAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
638 uint8_t mask, uint16_t manufacturerCode, uint8_t type, uint8_t size,
641 /** @brief Post Attribute Change
643 * This function is called by the application framework after it changes an
644 * attribute value. The value passed into this callback is the value to which
645 * the attribute was set by the framework.
647 * @param endpoint Ver.: always
648 * @param clusterId Ver.: always
649 * @param attributeId Ver.: always
650 * @param mask Ver.: always
651 * @param manufacturerCode Ver.: always
652 * @param type Ver.: always
653 * @param size Ver.: always
654 * @param value Ver.: always
656 void emberAfPostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
657 uint8_t mask, uint16_t manufacturerCode, uint8_t type, uint8_t size, uint8_t * value);
659 /** @brief Read Attributes Response
661 * This function is called by the application framework when a Read Attributes
662 * Response command is received from an external device. The application should
663 * return true if the message was processed or false if it was not.
665 * @param clusterId The cluster identifier of this response. Ver.: always
666 * @param buffer Buffer containing the list of read attribute status records.
668 * @param bufLen The length in bytes of the list. Ver.: always
670 bool emberAfReadAttributesResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
672 /** @brief External Attribute Read
674 * Like emberAfExternalAttributeWriteCallback above, this function is called
675 * when the framework needs to read an attribute that is not stored within the
676 * Application Framework's data structures.
678 * information about the attribute itself is passed as a pointer to an
679 * EmberAfAttributeMetadata struct, which is stored within the application and
680 * used to manage the attribute. A complete description of the
681 * EmberAfAttributeMetadata struct is provided in
682 * app/framework/include/af-types.h
683 This function assumes that the
684 * application is able to read the attribute, write it into the passed buffer,
685 * and return immediately. Any attributes that require a state machine for
686 * reading and writing are not really candidates for externalization at the
687 * present time. The Application Framework does not currently include a state
688 * machine for reading or writing attributes that must take place across a
689 * series of application ticks. Attributes that cannot be read in a timely
690 * manner should be stored within the Application Framework and updated
691 * occasionally by the application code from within the
692 * emberAfMainTickCallback.
693 If the application was successfully able to
694 * read the attribute and write it into the passed buffer, it should return a
695 * value of EMBER_ZCL_STATUS_SUCCESS. Ensure that the size of the externally
696 * managed attribute value is smaller than what the buffer can hold. In the case
697 * of a buffer overflow throw an appropriate error such as
698 * EMBER_ZCL_STATUS_INSUFFICIENT_SPACE. Any other return value indicates the
699 * application was not able to read the attribute.
701 * @param endpoint Ver.: always
702 * @param clusterId Ver.: always
703 * @param attributeMetadata Ver.: always
704 * @param manufacturerCode Ver.: always
705 * @param buffer Ver.: always
706 * @param maxReadLength Ver.: always
708 EmberAfStatus emberAfExternalAttributeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
709 EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
710 uint8_t * buffer, uint16_t maxReadLength);
712 /** @brief Write Attributes Response
714 * This function is called by the application framework when a Write Attributes
715 * Response command is received from an external device. The application should
716 * return true if the message was processed or false if it was not.
718 * @param clusterId The cluster identifier of this response. Ver.: always
719 * @param buffer Buffer containing the list of write attribute status records.
721 * @param bufLen The length in bytes of the list. Ver.: always
723 bool emberAfWriteAttributesResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
725 /** @brief External Attribute Write
727 * This function is called whenever the Application Framework needs to write an
728 * attribute which is not stored within the data structures of the Application
729 * Framework itself. One of the new features in Version 2 is the ability to
730 * store attributes outside the Framework. This is particularly useful for
731 * attributes that do not need to be stored because they can be read off the
732 * hardware when they are needed, or are stored in some central location used by
733 * many modules within the system. In this case, you can indicate that the
734 * attribute is stored externally. When the framework needs to write an external
735 * attribute, it makes a call to this callback.
736 This callback is very
737 * useful for host micros which need to store attributes in persistent memory.
738 * Because each host micro (used with an Ember NCP) has its own type of
739 * persistent memory storage, the Application Framework does not include the
740 * ability to mark attributes as stored in flash the way that it does for Ember
741 * SoCs like the EM35x. On a host micro, any attributes that need to be stored
742 * in persistent memory should be marked as external and accessed through the
743 * external read and write callbacks. Any host code associated with the
744 * persistent storage should be implemented within this callback.
746 * the important information about the attribute itself is passed as a pointer
747 * to an EmberAfAttributeMetadata struct, which is stored within the application
748 * and used to manage the attribute. A complete description of the
749 * EmberAfAttributeMetadata struct is provided in
750 * app/framework/include/af-types.h.
751 This function assumes that the
752 * application is able to write the attribute and return immediately. Any
753 * attributes that require a state machine for reading and writing are not
754 * candidates for externalization at the present time. The Application Framework
755 * does not currently include a state machine for reading or writing attributes
756 * that must take place across a series of application ticks. Attributes that
757 * cannot be written immediately should be stored within the Application
758 * Framework and updated occasionally by the application code from within the
759 * emberAfMainTickCallback.
760 If the application was successfully able to
761 * write the attribute, it returns a value of EMBER_ZCL_STATUS_SUCCESS. Any
762 * other return value indicates the application was not able to write the
765 * @param endpoint Ver.: always
766 * @param clusterId Ver.: always
767 * @param attributeMetadata Ver.: always
768 * @param manufacturerCode Ver.: always
769 * @param buffer Ver.: always
771 EmberAfStatus emberAfExternalAttributeWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
772 EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
775 /** @brief Report Attributes
777 * This function is called by the application framework when a Report Attributes
778 * command is received from an external device. The application should return
779 * true if the message was processed or false if it was not.
781 * @param clusterId The cluster identifier of this command. Ver.: always
782 * @param buffer Buffer containing the list of attribute report records. Ver.:
784 * @param bufLen The length in bytes of the list. Ver.: always
786 bool emberAfReportAttributesCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
788 /** @brief Get Current Time
790 * This callback is called when device attempts to get current time from the
791 * hardware. If this device has means to retrieve exact time, then this method
792 * should implement it. If the callback can't provide the exact time it should
793 * return 0 to indicate failure. Default action is to return 0, which indicates
794 * that device does not have access to real time.
797 uint32_t emberAfGetCurrentTimeCallback();
799 /** @brief Get Endpoint Info
801 * This function is a callback to an application implemented endpoint that
802 * operates outside the normal application framework. When the framework wishes
803 * to perform operations with that endpoint it uses this callback to retrieve
804 * the endpoint's information. If the endpoint exists and the application can
805 * provide data then true shall be returned. Otherwise the callback must return
808 * @param endpoint The endpoint to retrieve data for. Ver.: always
809 * @param returnNetworkIndex The index corresponding to the ZigBee network the
810 * endpoint belongs to. If not using a multi-network device, 0 must be
811 * returned. Otherwise on a multi-network device the stack will switch to this
812 * network before sending the message. Ver.: always
813 * @param returnEndpointInfo A pointer to a data struct that will be written
814 * with information about the endpoint. Ver.: always
816 bool emberAfGetEndpointInfoCallback(chip::EndpointId endpoint, uint8_t * returnNetworkIndex,
817 EmberAfEndpointInfoStruct * returnEndpointInfo);
819 /** @brief Get Source Route Overhead
821 * This function is called by the framework to determine the overhead required
822 * in the network frame for source routing to a particular destination.
824 * @param destination The node id of the destination Ver.: always
826 uint8_t emberAfGetSourceRouteOverheadCallback(chip::NodeId destination);
828 /** @brief Registration Abort
830 * This callback is called when the device should abort the registration
834 void emberAfRegistrationAbortCallback();
836 /** @brief Interpan Send Message
838 * This function will send a raw MAC message with interpan frame format using
839 * the passed parameters.
841 * @param header Interpan header info Ver.: always
842 * @param messageLength The length of the message received or to send Ver.:
844 * @param message The message data received or to send. Ver.: always
846 EmberStatus emberAfInterpanSendMessageCallback(EmberAfInterpanHeader * header, uint16_t messageLength, uint8_t * message);
848 /** @brief Start Move
850 * This function is called to initiate the process for a device to move (rejoin)
854 bool emberAfStartMoveCallback();