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 Network Commissioning Cluster Init
60 * @param endpoint Endpoint that is being initialized
62 void emberAfNetworkCommissioningClusterInitCallback(chip::EndpointId endpoint);
64 /** @brief On/off Cluster Init
68 * @param endpoint Endpoint that is being initialized
70 void emberAfOnOffClusterInitCallback(chip::EndpointId endpoint);
72 // Cluster Server/Client Init Functions
75 // Basic Cluster server
78 /** @brief Basic Cluster Server Init
82 * @param endpoint Endpoint that is being initialized
84 void emberAfBasicClusterServerInitCallback(chip::EndpointId endpoint);
86 /** @brief Basic Cluster Server Attribute Changed
88 * Server Attribute Changed
90 * @param endpoint Endpoint that is being initialized
91 * @param attributeId Attribute that changed
93 void emberAfBasicClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
95 /** @brief Basic Cluster Server Manufacturer Specific Attribute Changed
97 * Server Manufacturer Specific Attribute Changed
99 * @param endpoint Endpoint that is being initialized
100 * @param attributeId Attribute that changed
101 * @param manufacturerCode Manufacturer Code of the attribute that changed
103 void emberAfBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
104 uint16_t manufacturerCode);
106 /** @brief Basic Cluster Server Message Sent
108 * Server Message Sent
110 * @param type The type of message sent
111 * @param indexOrDestination The destination or address to which the message was sent
112 * @param apsFrame The APS frame for the message
113 * @param msgLen The length of the message
114 * @param message The message that was sent
115 * @param status The status of the sent message
117 void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
118 EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status);
120 /** @brief Basic Cluster Server Pre Attribute Changed
122 * server Pre Attribute Changed
124 * @param endpoint Endpoint that is being initialized
125 * @param attributeId Attribute to be changed
126 * @param attributeType Attribute type
127 * @param size Attribute size
128 * @param value Attribute value
130 EmberAfStatus emberAfBasicClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
131 EmberAfAttributeType attributeType, uint8_t size,
134 /** @brief Basic Cluster Server Tick
138 * @param endpoint Endpoint that is being served
140 void emberAfBasicClusterServerTickCallback(chip::EndpointId endpoint);
143 // Level Control Cluster server
146 /** @brief Level Control Cluster Server Init
150 * @param endpoint Endpoint that is being initialized
152 void emberAfLevelControlClusterServerInitCallback(chip::EndpointId endpoint);
154 /** @brief Level Control Cluster Server Attribute Changed
156 * Server Attribute Changed
158 * @param endpoint Endpoint that is being initialized
159 * @param attributeId Attribute that changed
161 void emberAfLevelControlClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
163 /** @brief Level Control Cluster Server Manufacturer Specific Attribute Changed
165 * Server Manufacturer Specific Attribute Changed
167 * @param endpoint Endpoint that is being initialized
168 * @param attributeId Attribute that changed
169 * @param manufacturerCode Manufacturer Code of the attribute that changed
171 void emberAfLevelControlClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
172 chip::AttributeId attributeId,
173 uint16_t manufacturerCode);
175 /** @brief Level Control Cluster Server Message Sent
177 * Server Message Sent
179 * @param type The type of message sent
180 * @param indexOrDestination The destination or address to which the message was sent
181 * @param apsFrame The APS frame for the message
182 * @param msgLen The length of the message
183 * @param message The message that was sent
184 * @param status The status of the sent message
186 void emberAfLevelControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
187 EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
190 /** @brief Level Control Cluster Server Pre Attribute Changed
192 * server Pre Attribute Changed
194 * @param endpoint Endpoint that is being initialized
195 * @param attributeId Attribute to be changed
196 * @param attributeType Attribute type
197 * @param size Attribute size
198 * @param value Attribute value
200 EmberAfStatus emberAfLevelControlClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
201 EmberAfAttributeType attributeType, uint8_t size,
204 /** @brief Level Control Cluster Server Tick
208 * @param endpoint Endpoint that is being served
210 void emberAfLevelControlClusterServerTickCallback(chip::EndpointId endpoint);
213 // Network Commissioning Cluster server
216 /** @brief Network Commissioning Cluster Server Init
220 * @param endpoint Endpoint that is being initialized
222 void emberAfNetworkCommissioningClusterServerInitCallback(chip::EndpointId endpoint);
224 /** @brief Network Commissioning Cluster Server Attribute Changed
226 * Server Attribute Changed
228 * @param endpoint Endpoint that is being initialized
229 * @param attributeId Attribute that changed
231 void emberAfNetworkCommissioningClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
233 /** @brief Network Commissioning Cluster Server Manufacturer Specific Attribute Changed
235 * Server Manufacturer Specific Attribute Changed
237 * @param endpoint Endpoint that is being initialized
238 * @param attributeId Attribute that changed
239 * @param manufacturerCode Manufacturer Code of the attribute that changed
241 void emberAfNetworkCommissioningClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
242 chip::AttributeId attributeId,
243 uint16_t manufacturerCode);
245 /** @brief Network Commissioning Cluster Server Message Sent
247 * Server Message Sent
249 * @param type The type of message sent
250 * @param indexOrDestination The destination or address to which the message was sent
251 * @param apsFrame The APS frame for the message
252 * @param msgLen The length of the message
253 * @param message The message that was sent
254 * @param status The status of the sent message
256 void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
257 EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
260 /** @brief Network Commissioning Cluster Server Pre Attribute Changed
262 * server Pre Attribute Changed
264 * @param endpoint Endpoint that is being initialized
265 * @param attributeId Attribute to be changed
266 * @param attributeType Attribute type
267 * @param size Attribute size
268 * @param value Attribute value
270 EmberAfStatus emberAfNetworkCommissioningClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint,
271 chip::AttributeId attributeId,
272 EmberAfAttributeType attributeType, uint8_t size,
275 /** @brief Network Commissioning Cluster Server Tick
279 * @param endpoint Endpoint that is being served
281 void emberAfNetworkCommissioningClusterServerTickCallback(chip::EndpointId endpoint);
284 // On/off Cluster server
287 /** @brief On/off Cluster Server Init
291 * @param endpoint Endpoint that is being initialized
293 void emberAfOnOffClusterServerInitCallback(chip::EndpointId endpoint);
295 /** @brief On/off Cluster Server Attribute Changed
297 * Server Attribute Changed
299 * @param endpoint Endpoint that is being initialized
300 * @param attributeId Attribute that changed
302 void emberAfOnOffClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
304 /** @brief On/off Cluster Server Manufacturer Specific Attribute Changed
306 * Server Manufacturer Specific Attribute Changed
308 * @param endpoint Endpoint that is being initialized
309 * @param attributeId Attribute that changed
310 * @param manufacturerCode Manufacturer Code of the attribute that changed
312 void emberAfOnOffClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
313 uint16_t manufacturerCode);
315 /** @brief On/off Cluster Server Message Sent
317 * Server Message Sent
319 * @param type The type of message sent
320 * @param indexOrDestination The destination or address to which the message was sent
321 * @param apsFrame The APS frame for the message
322 * @param msgLen The length of the message
323 * @param message The message that was sent
324 * @param status The status of the sent message
326 void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
327 EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status);
329 /** @brief On/off Cluster Server Pre Attribute Changed
331 * server Pre Attribute Changed
333 * @param endpoint Endpoint that is being initialized
334 * @param attributeId Attribute to be changed
335 * @param attributeType Attribute type
336 * @param size Attribute size
337 * @param value Attribute value
339 EmberAfStatus emberAfOnOffClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
340 EmberAfAttributeType attributeType, uint8_t size,
343 /** @brief On/off Cluster Server Tick
347 * @param endpoint Endpoint that is being served
349 void emberAfOnOffClusterServerTickCallback(chip::EndpointId endpoint);
351 // Cluster Commands Callback
354 * @brief Level Control Cluster Move Command callback
358 * @param optionOverride
361 bool emberAfLevelControlClusterMoveCallback(uint8_t moveMode, uint8_t rate, uint8_t optionMask, uint8_t optionOverride);
364 * @brief Level Control Cluster MoveToLevel Command callback
366 * @param transitionTime
368 * @param optionOverride
371 bool emberAfLevelControlClusterMoveToLevelCallback(uint8_t level, uint16_t transitionTime, uint8_t optionMask,
372 uint8_t optionOverride);
375 * @brief Level Control Cluster MoveToLevelWithOnOff Command callback
377 * @param transitionTime
380 bool emberAfLevelControlClusterMoveToLevelWithOnOffCallback(uint8_t level, uint16_t transitionTime);
383 * @brief Level Control Cluster MoveWithOnOff Command callback
388 bool emberAfLevelControlClusterMoveWithOnOffCallback(uint8_t moveMode, uint8_t rate);
391 * @brief Level Control Cluster Step Command callback
394 * @param transitionTime
396 * @param optionOverride
399 bool emberAfLevelControlClusterStepCallback(uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime, uint8_t optionMask,
400 uint8_t optionOverride);
403 * @brief Level Control Cluster StepWithOnOff Command callback
406 * @param transitionTime
409 bool emberAfLevelControlClusterStepWithOnOffCallback(uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime);
412 * @brief Level Control Cluster Stop Command callback
414 * @param optionOverride
417 bool emberAfLevelControlClusterStopCallback(uint8_t optionMask, uint8_t optionOverride);
420 * @brief Level Control Cluster StopWithOnOff Command callback
423 bool emberAfLevelControlClusterStopWithOnOffCallback();
426 * @brief Network Commissioning Cluster AddThreadNetwork Command callback
427 * @param operationalDataset
432 bool emberAfNetworkCommissioningClusterAddThreadNetworkCallback(uint8_t * operationalDataset, uint64_t breadcrumb,
436 * @brief Network Commissioning Cluster AddWiFiNetwork Command callback
443 bool emberAfNetworkCommissioningClusterAddWiFiNetworkCallback(uint8_t * ssid, uint8_t * credentials, uint64_t breadcrumb,
447 * @brief Network Commissioning Cluster DisableNetwork Command callback
453 bool emberAfNetworkCommissioningClusterDisableNetworkCallback(uint8_t * networkID, uint64_t breadcrumb, uint32_t timeoutMs);
456 * @brief Network Commissioning Cluster EnableNetwork Command callback
462 bool emberAfNetworkCommissioningClusterEnableNetworkCallback(uint8_t * networkID, uint64_t breadcrumb, uint32_t timeoutMs);
465 * @brief Network Commissioning Cluster GetLastNetworkCommissioningResult Command callback
469 bool emberAfNetworkCommissioningClusterGetLastNetworkCommissioningResultCallback(uint32_t timeoutMs);
472 * @brief Network Commissioning Cluster RemoveNetwork Command callback
478 bool emberAfNetworkCommissioningClusterRemoveNetworkCallback(uint8_t * NetworkID, uint64_t Breadcrumb, uint32_t TimeoutMs);
481 * @brief Network Commissioning Cluster ScanNetworks Command callback
487 bool emberAfNetworkCommissioningClusterScanNetworksCallback(uint8_t * ssid, uint64_t breadcrumb, uint32_t timeoutMs);
490 * @brief Network Commissioning Cluster UpdateThreadNetwork Command callback
491 * @param operationalDataset
496 bool emberAfNetworkCommissioningClusterUpdateThreadNetworkCallback(uint8_t * operationalDataset, uint64_t breadcrumb,
500 * @brief Network Commissioning Cluster UpdateWiFiNetwork Command callback
507 bool emberAfNetworkCommissioningClusterUpdateWiFiNetworkCallback(uint8_t * ssid, uint8_t * credentials, uint64_t breadcrumb,
511 * @brief On/off Cluster Off Command callback
514 bool emberAfOnOffClusterOffCallback();
517 * @brief On/off Cluster On Command callback
520 bool emberAfOnOffClusterOnCallback();
523 * @brief On/off Cluster Toggle Command callback
526 bool emberAfOnOffClusterToggleCallback();
529 // Non-Cluster Related Callbacks
532 /** @brief Add To Current App Tasks
534 * This function is only useful to sleepy end devices. This function will note
535 * the passed item as part of a set of tasks the application has outstanding
536 * (e.g. message sent requiring APS acknwoledgement). This will affect how the
537 * application behaves with regard to sleeping and polling. Until the
538 * outstanding task is completed, the device may poll more frequently and sleep
541 * @param tasks Ver.: always
543 void emberAfAddToCurrentAppTasksCallback(EmberAfApplicationTask tasks);
545 /** @brief Remove From Current App Tasks
547 * This function is only useful to sleepy end devices. This function will
548 * remove the passed item from the set of tasks the application has outstanding
549 * (e.g. message sent requiring APS acknwoledgement). This will affect how the
550 * application behaves with regard to sleeping and polling. Removing the item
551 * from the list of outstanding tasks may allow the device to sleep longer and
552 * poll less frequently. If there are other outstanding tasks the system may
553 * still have to stay away and poll more often.
555 * @param tasks Ver.: always
557 void emberAfRemoveFromCurrentAppTasksCallback(EmberAfApplicationTask tasks);
559 /** @brief Allow Network Write Attribute
561 * This function is called by the application framework before it writes an
562 * attribute in response to a write attribute request from an external device.
563 * The value passed into this callback is the value to which the attribute is to
564 * be set by the framework.
565 Example: In mirroring simple metering data
566 * on an Energy Services Interface (ESI) (formerly called Energy Service Portal
567 * (ESP) in SE 1.0).), a mirrored simple meter needs to write read-only
568 * attributes on its mirror. The-meter-mirror sample application, located in
569 * app/framework/sample-apps, uses this callback to allow the mirrored device to
570 * write simple metering attributes on the mirror regardless of the fact that
571 * most simple metering attributes are defined as read-only by the ZigBee
573 Note: The ZCL specification does not (as of this
574 * writing) specify any permission-level security for writing writeable
575 * attributes. As far as the ZCL specification is concerned, if an attribute is
576 * writeable, any device that has a link key for the device should be able to
577 * write that attribute. Furthermore if an attribute is read only, it should not
578 * be written over the air. Thus, if you implement permissions for writing
579 * attributes as a feature, you MAY be operating outside the specification. This
580 * is unlikely to be a problem for writing read-only attributes, but it may be a
581 * problem for attributes that are writeable according to the specification but
582 * restricted by the application implementing this callback.
584 * @param endpoint Ver.: always
585 * @param clusterId Ver.: always
586 * @param attributeId Ver.: always
587 * @param mask Ver.: always
588 * @param manufacturerCode Ver.: always
589 * @param value Ver.: always
590 * @param type Ver.: always
592 EmberAfAttributeWritePermission emberAfAllowNetworkWriteAttributeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
593 chip::AttributeId attributeId, uint8_t mask,
594 uint16_t manufacturerCode, uint8_t * value, uint8_t type);
596 /** @brief Attribute Read Access
598 * This function is called whenever the Application Framework needs to check
599 * access permission for an attribute read.
601 * @param endpoint Ver.: always
602 * @param clusterId Ver.: always
603 * @param manufacturerCode Ver.: always
604 * @param attributeId Ver.: always
606 bool emberAfAttributeReadAccessCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, uint16_t manufacturerCode,
607 chip::AttributeId attributeId);
609 /** @brief Attribute Write Access
611 * This function is called whenever the Application Framework needs to check
612 * access permission for an attribute write.
614 * @param endpoint Ver.: always
615 * @param clusterId Ver.: always
616 * @param manufacturerCode Ver.: always
617 * @param attributeId Ver.: always
619 bool emberAfAttributeWriteAccessCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, uint16_t manufacturerCode,
620 chip::AttributeId attributeId);
622 /** @brief Default Response
624 * This function is called by the application framework when a Default Response
625 * command is received from an external device. The application should return
626 * true if the message was processed or false if it was not.
628 * @param clusterId The cluster identifier of this response. Ver.: always
629 * @param commandId The command identifier to which this is a response. Ver.:
631 * @param status Specifies either SUCCESS or the nature of the error that was
632 * detected in the received command. Ver.: always
634 bool emberAfDefaultResponseCallback(chip::ClusterId clusterId, chip::CommandId commandId, EmberAfStatus status);
636 /** @brief Configure Reporting Response
638 * This function is called by the application framework when a Configure
639 * Reporting Response command is received from an external device. The
640 * application should return true if the message was processed or false if it
643 * @param clusterId The cluster identifier of this response. Ver.: always
644 * @param buffer Buffer containing the list of attribute status records. Ver.:
646 * @param bufLen The length in bytes of the list. Ver.: always
648 bool emberAfConfigureReportingResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
650 /** @brief Read Reporting Configuration Response
652 * This function is called by the application framework when a Read Reporting
653 * Configuration Response command is received from an external device. The
654 * application should return true if the message was processed or false if it
657 * @param clusterId The cluster identifier of this response. Ver.: always
658 * @param buffer Buffer containing the list of attribute reporting configuration
659 * records. Ver.: always
660 * @param bufLen The length in bytes of the list. Ver.: always
662 bool emberAfReadReportingConfigurationResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
664 /** @brief Discover Attributes Response
666 * This function is called by the application framework when a Discover
667 * Attributes Response or Discover Attributes Extended Response command is
668 * received from an external device. The Discover Attributes Response command
669 * contains a bool indicating if discovery is complete and a list of zero or
670 * more attribute identifier/type records. The final argument indicates whether
671 * the response is in the extended format or not. The application should return
672 * true if the message was processed or false if it was not.
674 * @param clusterId The cluster identifier of this response. Ver.: always
675 * @param discoveryComplete Indicates whether there are more attributes to be
676 * discovered. true if there are no more attributes to be discovered. Ver.:
678 * @param buffer Buffer containing the list of attribute identifier/type
679 * records. Ver.: always
680 * @param bufLen The length in bytes of the list. Ver.: always
681 * @param extended Indicates whether the response is in the extended format or
684 bool emberAfDiscoverAttributesResponseCallback(chip::ClusterId clusterId, bool discoveryComplete, uint8_t * buffer, uint16_t bufLen,
687 /** @brief Discover Commands Generated Response
689 * This function is called by the framework when Discover Commands Generated
690 * Response is received.
692 * @param clusterId The cluster identifier of this response. Ver.: always
693 * @param manufacturerCode Manufacturer code Ver.: always
694 * @param discoveryComplete Indicates whether there are more commands to be
695 * discovered. Ver.: always
696 * @param commandIds Buffer containing the list of command identifiers. Ver.:
698 * @param commandIdCount The length of bytes of the list, whish is the same as
699 * the number of identifiers. Ver.: always
701 bool emberAfDiscoverCommandsGeneratedResponseCallback(chip::ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete,
702 chip::CommandId * commandIds, uint16_t commandIdCount);
704 /** @brief Discover Commands Received Response
706 * This function is called by the framework when Discover Commands Received
707 * Response is received.
709 * @param clusterId The cluster identifier of this response. Ver.: always
710 * @param manufacturerCode Manufacturer code Ver.: always
711 * @param discoveryComplete Indicates whether there are more commands to be
712 * discovered. Ver.: always
713 * @param commandIds Buffer containing the list of command identifiers. Ver.:
715 * @param commandIdCount The length of bytes of the list, whish is the same as
716 * the number of identifiers. Ver.: always
718 bool emberAfDiscoverCommandsReceivedResponseCallback(chip::ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete,
719 chip::CommandId * commandIds, uint16_t commandIdCount);
721 /** @brief Pre Command Received
723 * This callback is the second in the Application Framework's message processing
724 * chain. At this point in the processing of incoming over-the-air messages, the
725 * application has determined that the incoming message is a ZCL command. It
726 * parses enough of the message to populate an EmberAfClusterCommand struct. The
727 * Application Framework defines this struct value in a local scope to the
728 * command processing but also makes it available through a global pointer
729 * called emberAfCurrentCommand, in app/framework/util/util.c. When command
730 * processing is complete, this pointer is cleared.
732 * @param cmd Ver.: always
734 bool emberAfPreCommandReceivedCallback(EmberAfClusterCommand * cmd);
736 /** @brief Pre Message Send
738 * This function is called by the framework when it is about to pass a message
739 * to the stack primitives for sending. This message may or may not be ZCL,
740 * ZDO, or some other protocol. This is called prior to
742 * fragmentation that may be done. If the function returns true it is assumed
743 * the callback has consumed and processed the message. The callback must also
744 * set the EmberStatus status code to be passed back to the caller. The
745 * framework will do no further processing on the message.
747 * function returns false then it is assumed that the callback has not processed
748 * the mesasge and the framework will continue to process accordingly.
750 * @param messageStruct The structure containing the parameters of the APS
751 * message to be sent. Ver.: always
752 * @param status A pointer to the status code value that will be returned to the
753 * caller. Ver.: always
755 bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberStatus * status);
757 /** @brief Message Sent
759 * This function is called by the application framework from the message sent
760 * handler, when it is informed by the stack regarding the message sent status.
761 * All of the values passed to the emberMessageSentHandler are passed on to this
762 * callback. This provides an opportunity for the application to verify that its
763 * message has been sent successfully and take the appropriate action. This
764 * callback should return a bool value of true or false. A value of true
765 * indicates that the message sent notification has been handled and should not
766 * be handled by the application framework.
768 * @param type Ver.: always
769 * @param indexOrDestination Ver.: always
770 * @param apsFrame Ver.: always
771 * @param msgLen Ver.: always
772 * @param message Ver.: always
773 * @param status Ver.: always
775 bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame,
776 uint16_t msgLen, uint8_t * message, EmberStatus status);
778 /** @brief Pre Attribute Change
780 * This function is called by the application framework before it changes an
781 * attribute value. The value passed into this callback is the value to which
782 * the attribute is to be set by the framework. The application should return
783 * ::EMBER_ZCL_STATUS_SUCCESS to permit the change or any other ::EmberAfStatus
786 * @param endpoint Ver.: always
787 * @param clusterId Ver.: always
788 * @param attributeId Ver.: always
789 * @param mask Ver.: always
790 * @param manufacturerCode Ver.: always
791 * @param type Ver.: always
792 * @param size Ver.: always
793 * @param value Ver.: always
795 EmberAfStatus emberAfPreAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
796 uint8_t mask, uint16_t manufacturerCode, uint8_t type, uint8_t size,
799 /** @brief Post Attribute Change
801 * This function is called by the application framework after it changes an
802 * attribute value. The value passed into this callback is the value to which
803 * the attribute was set by the framework.
805 * @param endpoint Ver.: always
806 * @param clusterId Ver.: always
807 * @param attributeId Ver.: always
808 * @param mask Ver.: always
809 * @param manufacturerCode Ver.: always
810 * @param type Ver.: always
811 * @param size Ver.: always
812 * @param value Ver.: always
814 void emberAfPostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
815 uint8_t mask, uint16_t manufacturerCode, uint8_t type, uint8_t size, uint8_t * value);
817 /** @brief Read Attributes Response
819 * This function is called by the application framework when a Read Attributes
820 * Response command is received from an external device. The application should
821 * return true if the message was processed or false if it was not.
823 * @param clusterId The cluster identifier of this response. Ver.: always
824 * @param buffer Buffer containing the list of read attribute status records.
826 * @param bufLen The length in bytes of the list. Ver.: always
828 bool emberAfReadAttributesResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
830 /** @brief External Attribute Read
832 * Like emberAfExternalAttributeWriteCallback above, this function is called
833 * when the framework needs to read an attribute that is not stored within the
834 * Application Framework's data structures.
836 * information about the attribute itself is passed as a pointer to an
837 * EmberAfAttributeMetadata struct, which is stored within the application and
838 * used to manage the attribute. A complete description of the
839 * EmberAfAttributeMetadata struct is provided in
840 * app/framework/include/af-types.h
841 This function assumes that the
842 * application is able to read the attribute, write it into the passed buffer,
843 * and return immediately. Any attributes that require a state machine for
844 * reading and writing are not really candidates for externalization at the
845 * present time. The Application Framework does not currently include a state
846 * machine for reading or writing attributes that must take place across a
847 * series of application ticks. Attributes that cannot be read in a timely
848 * manner should be stored within the Application Framework and updated
849 * occasionally by the application code from within the
850 * emberAfMainTickCallback.
851 If the application was successfully able to
852 * read the attribute and write it into the passed buffer, it should return a
853 * value of EMBER_ZCL_STATUS_SUCCESS. Ensure that the size of the externally
854 * managed attribute value is smaller than what the buffer can hold. In the case
855 * of a buffer overflow throw an appropriate error such as
856 * EMBER_ZCL_STATUS_INSUFFICIENT_SPACE. Any other return value indicates the
857 * application was not able to read the attribute.
859 * @param endpoint Ver.: always
860 * @param clusterId Ver.: always
861 * @param attributeMetadata Ver.: always
862 * @param manufacturerCode Ver.: always
863 * @param buffer Ver.: always
864 * @param maxReadLength Ver.: always
866 EmberAfStatus emberAfExternalAttributeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
867 EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
868 uint8_t * buffer, uint16_t maxReadLength);
870 /** @brief Write Attributes Response
872 * This function is called by the application framework when a Write Attributes
873 * Response command is received from an external device. The application should
874 * return true if the message was processed or false if it was not.
876 * @param clusterId The cluster identifier of this response. Ver.: always
877 * @param buffer Buffer containing the list of write attribute status records.
879 * @param bufLen The length in bytes of the list. Ver.: always
881 bool emberAfWriteAttributesResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
883 /** @brief External Attribute Write
885 * This function is called whenever the Application Framework needs to write an
886 * attribute which is not stored within the data structures of the Application
887 * Framework itself. One of the new features in Version 2 is the ability to
888 * store attributes outside the Framework. This is particularly useful for
889 * attributes that do not need to be stored because they can be read off the
890 * hardware when they are needed, or are stored in some central location used by
891 * many modules within the system. In this case, you can indicate that the
892 * attribute is stored externally. When the framework needs to write an external
893 * attribute, it makes a call to this callback.
894 This callback is very
895 * useful for host micros which need to store attributes in persistent memory.
896 * Because each host micro (used with an Ember NCP) has its own type of
897 * persistent memory storage, the Application Framework does not include the
898 * ability to mark attributes as stored in flash the way that it does for Ember
899 * SoCs like the EM35x. On a host micro, any attributes that need to be stored
900 * in persistent memory should be marked as external and accessed through the
901 * external read and write callbacks. Any host code associated with the
902 * persistent storage should be implemented within this callback.
904 * the important information about the attribute itself is passed as a pointer
905 * to an EmberAfAttributeMetadata struct, which is stored within the application
906 * and used to manage the attribute. A complete description of the
907 * EmberAfAttributeMetadata struct is provided in
908 * app/framework/include/af-types.h.
909 This function assumes that the
910 * application is able to write the attribute and return immediately. Any
911 * attributes that require a state machine for reading and writing are not
912 * candidates for externalization at the present time. The Application Framework
913 * does not currently include a state machine for reading or writing attributes
914 * that must take place across a series of application ticks. Attributes that
915 * cannot be written immediately should be stored within the Application
916 * Framework and updated occasionally by the application code from within the
917 * emberAfMainTickCallback.
918 If the application was successfully able to
919 * write the attribute, it returns a value of EMBER_ZCL_STATUS_SUCCESS. Any
920 * other return value indicates the application was not able to write the
923 * @param endpoint Ver.: always
924 * @param clusterId Ver.: always
925 * @param attributeMetadata Ver.: always
926 * @param manufacturerCode Ver.: always
927 * @param buffer Ver.: always
929 EmberAfStatus emberAfExternalAttributeWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
930 EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
933 /** @brief Report Attributes
935 * This function is called by the application framework when a Report Attributes
936 * command is received from an external device. The application should return
937 * true if the message was processed or false if it was not.
939 * @param clusterId The cluster identifier of this command. Ver.: always
940 * @param buffer Buffer containing the list of attribute report records. Ver.:
942 * @param bufLen The length in bytes of the list. Ver.: always
944 bool emberAfReportAttributesCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
946 /** @brief Get Current Time
948 * This callback is called when device attempts to get current time from the
949 * hardware. If this device has means to retrieve exact time, then this method
950 * should implement it. If the callback can't provide the exact time it should
951 * return 0 to indicate failure. Default action is to return 0, which indicates
952 * that device does not have access to real time.
955 uint32_t emberAfGetCurrentTimeCallback();
957 /** @brief Get Endpoint Info
959 * This function is a callback to an application implemented endpoint that
960 * operates outside the normal application framework. When the framework wishes
961 * to perform operations with that endpoint it uses this callback to retrieve
962 * the endpoint's information. If the endpoint exists and the application can
963 * provide data then true shall be returned. Otherwise the callback must return
966 * @param endpoint The endpoint to retrieve data for. Ver.: always
967 * @param returnNetworkIndex The index corresponding to the ZigBee network the
968 * endpoint belongs to. If not using a multi-network device, 0 must be
969 * returned. Otherwise on a multi-network device the stack will switch to this
970 * network before sending the message. Ver.: always
971 * @param returnEndpointInfo A pointer to a data struct that will be written
972 * with information about the endpoint. Ver.: always
974 bool emberAfGetEndpointInfoCallback(chip::EndpointId endpoint, uint8_t * returnNetworkIndex,
975 EmberAfEndpointInfoStruct * returnEndpointInfo);
977 /** @brief Get Source Route Overhead
979 * This function is called by the framework to determine the overhead required
980 * in the network frame for source routing to a particular destination.
982 * @param destination The node id of the destination Ver.: always
984 uint8_t emberAfGetSourceRouteOverheadCallback(chip::NodeId destination);
986 /** @brief Registration Abort
988 * This callback is called when the device should abort the registration
992 void emberAfRegistrationAbortCallback();
994 /** @brief Interpan Send Message
996 * This function will send a raw MAC message with interpan frame format using
997 * the passed parameters.
999 * @param header Interpan header info Ver.: always
1000 * @param messageLength The length of the message received or to send Ver.:
1002 * @param message The message data received or to send. Ver.: always
1004 EmberStatus emberAfInterpanSendMessageCallback(EmberAfInterpanHeader * header, uint16_t messageLength, uint8_t * message);
1006 /** @brief Start Move
1008 * This function is called to initiate the process for a device to move (rejoin)
1012 bool emberAfStartMoveCallback();