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 #include <lib/support/Span.h>
29 /** @brief Cluster Init
31 * This function is called when a specific cluster is initialized. It gives the
32 * application an opportunity to take care of cluster initialization procedures.
33 * It is called exactly once for each endpoint where cluster is present.
35 * @param endpoint Ver.: always
36 * @param clusterId Ver.: always
38 void emberAfClusterInitCallback(chip::EndpointId endpoint, chip::ClusterId clusterId);
40 // Cluster Init Functions
42 /** @brief Basic Cluster Init
46 * @param endpoint Endpoint that is being initialized
48 void emberAfBasicClusterInitCallback(chip::EndpointId endpoint);
50 /** @brief Level Control Cluster Init
54 * @param endpoint Endpoint that is being initialized
56 void emberAfLevelControlClusterInitCallback(chip::EndpointId endpoint);
58 /** @brief Network Commissioning Cluster Init
62 * @param endpoint Endpoint that is being initialized
64 void emberAfNetworkCommissioningClusterInitCallback(chip::EndpointId endpoint);
66 /** @brief On/off Cluster Init
70 * @param endpoint Endpoint that is being initialized
72 void emberAfOnOffClusterInitCallback(chip::EndpointId endpoint);
74 // Cluster Server/Client Init Functions
77 // Basic Cluster server
80 /** @brief Basic Cluster Server Init
84 * @param endpoint Endpoint that is being initialized
86 void emberAfBasicClusterServerInitCallback(chip::EndpointId endpoint);
88 /** @brief Basic Cluster Server Attribute Changed
90 * Server Attribute Changed
92 * @param endpoint Endpoint that is being initialized
93 * @param attributeId Attribute that changed
95 void emberAfBasicClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
97 /** @brief Basic Cluster Server Manufacturer Specific Attribute Changed
99 * Server Manufacturer Specific Attribute Changed
101 * @param endpoint Endpoint that is being initialized
102 * @param attributeId Attribute that changed
103 * @param manufacturerCode Manufacturer Code of the attribute that changed
105 void emberAfBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
106 uint16_t manufacturerCode);
108 /** @brief Basic Cluster Server Message Sent
110 * Server Message Sent
112 * @param type The type of message sent
113 * @param indexOrDestination The destination or address to which the message was sent
114 * @param apsFrame The APS frame for the message
115 * @param msgLen The length of the message
116 * @param message The message that was sent
117 * @param status The status of the sent message
119 void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
120 EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status);
122 /** @brief Basic Cluster Server Pre Attribute Changed
124 * server Pre Attribute Changed
126 * @param endpoint Endpoint that is being initialized
127 * @param attributeId Attribute to be changed
128 * @param attributeType Attribute type
129 * @param size Attribute size
130 * @param value Attribute value
132 EmberAfStatus emberAfBasicClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
133 EmberAfAttributeType attributeType, uint8_t size,
136 /** @brief Basic Cluster Server Tick
140 * @param endpoint Endpoint that is being served
142 void emberAfBasicClusterServerTickCallback(chip::EndpointId endpoint);
145 // Level Control Cluster server
148 /** @brief Level Control Cluster Server Init
152 * @param endpoint Endpoint that is being initialized
154 void emberAfLevelControlClusterServerInitCallback(chip::EndpointId endpoint);
156 /** @brief Level Control Cluster Server Attribute Changed
158 * Server Attribute Changed
160 * @param endpoint Endpoint that is being initialized
161 * @param attributeId Attribute that changed
163 void emberAfLevelControlClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
165 /** @brief Level Control Cluster Server Manufacturer Specific Attribute Changed
167 * Server Manufacturer Specific Attribute Changed
169 * @param endpoint Endpoint that is being initialized
170 * @param attributeId Attribute that changed
171 * @param manufacturerCode Manufacturer Code of the attribute that changed
173 void emberAfLevelControlClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
174 chip::AttributeId attributeId,
175 uint16_t manufacturerCode);
177 /** @brief Level Control Cluster Server Message Sent
179 * Server Message Sent
181 * @param type The type of message sent
182 * @param indexOrDestination The destination or address to which the message was sent
183 * @param apsFrame The APS frame for the message
184 * @param msgLen The length of the message
185 * @param message The message that was sent
186 * @param status The status of the sent message
188 void emberAfLevelControlClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
189 EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
192 /** @brief Level Control Cluster Server Pre Attribute Changed
194 * server Pre Attribute Changed
196 * @param endpoint Endpoint that is being initialized
197 * @param attributeId Attribute to be changed
198 * @param attributeType Attribute type
199 * @param size Attribute size
200 * @param value Attribute value
202 EmberAfStatus emberAfLevelControlClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
203 EmberAfAttributeType attributeType, uint8_t size,
206 /** @brief Level Control Cluster Server Tick
210 * @param endpoint Endpoint that is being served
212 void emberAfLevelControlClusterServerTickCallback(chip::EndpointId endpoint);
215 // Network Commissioning Cluster server
218 /** @brief Network Commissioning Cluster Server Init
222 * @param endpoint Endpoint that is being initialized
224 void emberAfNetworkCommissioningClusterServerInitCallback(chip::EndpointId endpoint);
226 /** @brief Network Commissioning Cluster Server Attribute Changed
228 * Server Attribute Changed
230 * @param endpoint Endpoint that is being initialized
231 * @param attributeId Attribute that changed
233 void emberAfNetworkCommissioningClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
235 /** @brief Network Commissioning Cluster Server Manufacturer Specific Attribute Changed
237 * Server Manufacturer Specific Attribute Changed
239 * @param endpoint Endpoint that is being initialized
240 * @param attributeId Attribute that changed
241 * @param manufacturerCode Manufacturer Code of the attribute that changed
243 void emberAfNetworkCommissioningClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
244 chip::AttributeId attributeId,
245 uint16_t manufacturerCode);
247 /** @brief Network Commissioning Cluster Server Message Sent
249 * Server Message Sent
251 * @param type The type of message sent
252 * @param indexOrDestination The destination or address to which the message was sent
253 * @param apsFrame The APS frame for the message
254 * @param msgLen The length of the message
255 * @param message The message that was sent
256 * @param status The status of the sent message
258 void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
259 EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
262 /** @brief Network Commissioning Cluster Server Pre Attribute Changed
264 * server Pre Attribute Changed
266 * @param endpoint Endpoint that is being initialized
267 * @param attributeId Attribute to be changed
268 * @param attributeType Attribute type
269 * @param size Attribute size
270 * @param value Attribute value
272 EmberAfStatus emberAfNetworkCommissioningClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint,
273 chip::AttributeId attributeId,
274 EmberAfAttributeType attributeType, uint8_t size,
277 /** @brief Network Commissioning Cluster Server Tick
281 * @param endpoint Endpoint that is being served
283 void emberAfNetworkCommissioningClusterServerTickCallback(chip::EndpointId endpoint);
286 // On/off Cluster server
289 /** @brief On/off Cluster Server Init
293 * @param endpoint Endpoint that is being initialized
295 void emberAfOnOffClusterServerInitCallback(chip::EndpointId endpoint);
297 /** @brief On/off Cluster Server Attribute Changed
299 * Server Attribute Changed
301 * @param endpoint Endpoint that is being initialized
302 * @param attributeId Attribute that changed
304 void emberAfOnOffClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
306 /** @brief On/off Cluster Server Manufacturer Specific Attribute Changed
308 * Server Manufacturer Specific Attribute Changed
310 * @param endpoint Endpoint that is being initialized
311 * @param attributeId Attribute that changed
312 * @param manufacturerCode Manufacturer Code of the attribute that changed
314 void emberAfOnOffClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
315 uint16_t manufacturerCode);
317 /** @brief On/off Cluster Server Message Sent
319 * Server Message Sent
321 * @param type The type of message sent
322 * @param indexOrDestination The destination or address to which the message was sent
323 * @param apsFrame The APS frame for the message
324 * @param msgLen The length of the message
325 * @param message The message that was sent
326 * @param status The status of the sent message
328 void emberAfOnOffClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
329 EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status);
331 /** @brief On/off Cluster Server Pre Attribute Changed
333 * server Pre Attribute Changed
335 * @param endpoint Endpoint that is being initialized
336 * @param attributeId Attribute to be changed
337 * @param attributeType Attribute type
338 * @param size Attribute size
339 * @param value Attribute value
341 EmberAfStatus emberAfOnOffClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
342 EmberAfAttributeType attributeType, uint8_t size,
345 /** @brief On/off Cluster Server Tick
349 * @param endpoint Endpoint that is being served
351 void emberAfOnOffClusterServerTickCallback(chip::EndpointId endpoint);
353 // Cluster Commands Callback
356 * @brief Level Control Cluster Move Command callback
360 * @param optionOverride
363 bool emberAfLevelControlClusterMoveCallback(uint8_t moveMode, uint8_t rate, uint8_t optionMask, uint8_t optionOverride);
366 * @brief Level Control Cluster MoveToLevel Command callback
368 * @param transitionTime
370 * @param optionOverride
373 bool emberAfLevelControlClusterMoveToLevelCallback(uint8_t level, uint16_t transitionTime, uint8_t optionMask,
374 uint8_t optionOverride);
377 * @brief Level Control Cluster MoveToLevelWithOnOff Command callback
379 * @param transitionTime
382 bool emberAfLevelControlClusterMoveToLevelWithOnOffCallback(uint8_t level, uint16_t transitionTime);
385 * @brief Level Control Cluster MoveWithOnOff Command callback
390 bool emberAfLevelControlClusterMoveWithOnOffCallback(uint8_t moveMode, uint8_t rate);
393 * @brief Level Control Cluster Step Command callback
396 * @param transitionTime
398 * @param optionOverride
401 bool emberAfLevelControlClusterStepCallback(uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime, uint8_t optionMask,
402 uint8_t optionOverride);
405 * @brief Level Control Cluster StepWithOnOff Command callback
408 * @param transitionTime
411 bool emberAfLevelControlClusterStepWithOnOffCallback(uint8_t stepMode, uint8_t stepSize, uint16_t transitionTime);
414 * @brief Level Control Cluster Stop Command callback
416 * @param optionOverride
419 bool emberAfLevelControlClusterStopCallback(uint8_t optionMask, uint8_t optionOverride);
422 * @brief Level Control Cluster StopWithOnOff Command callback
425 bool emberAfLevelControlClusterStopWithOnOffCallback();
428 * @brief Network Commissioning Cluster AddThreadNetwork Command callback
429 * @param operationalDataset
434 bool emberAfNetworkCommissioningClusterAddThreadNetworkCallback(chip::ByteSpan operationalDataset, uint64_t breadcrumb,
438 * @brief Network Commissioning Cluster AddWiFiNetwork Command callback
445 bool emberAfNetworkCommissioningClusterAddWiFiNetworkCallback(chip::ByteSpan ssid, chip::ByteSpan credentials, uint64_t breadcrumb,
449 * @brief Network Commissioning Cluster DisableNetwork Command callback
455 bool emberAfNetworkCommissioningClusterDisableNetworkCallback(chip::ByteSpan networkID, uint64_t breadcrumb, uint32_t timeoutMs);
458 * @brief Network Commissioning Cluster EnableNetwork Command callback
464 bool emberAfNetworkCommissioningClusterEnableNetworkCallback(chip::ByteSpan networkID, uint64_t breadcrumb, uint32_t timeoutMs);
467 * @brief Network Commissioning Cluster GetLastNetworkCommissioningResult Command callback
471 bool emberAfNetworkCommissioningClusterGetLastNetworkCommissioningResultCallback(uint32_t timeoutMs);
474 * @brief Network Commissioning Cluster RemoveNetwork Command callback
480 bool emberAfNetworkCommissioningClusterRemoveNetworkCallback(chip::ByteSpan NetworkID, uint64_t Breadcrumb, uint32_t TimeoutMs);
483 * @brief Network Commissioning Cluster ScanNetworks Command callback
489 bool emberAfNetworkCommissioningClusterScanNetworksCallback(chip::ByteSpan ssid, uint64_t breadcrumb, uint32_t timeoutMs);
492 * @brief Network Commissioning Cluster UpdateThreadNetwork Command callback
493 * @param operationalDataset
498 bool emberAfNetworkCommissioningClusterUpdateThreadNetworkCallback(chip::ByteSpan operationalDataset, uint64_t breadcrumb,
502 * @brief Network Commissioning Cluster UpdateWiFiNetwork Command callback
509 bool emberAfNetworkCommissioningClusterUpdateWiFiNetworkCallback(chip::ByteSpan ssid, chip::ByteSpan credentials,
510 uint64_t breadcrumb, uint32_t timeoutMs);
513 * @brief On/off Cluster Off Command callback
516 bool emberAfOnOffClusterOffCallback();
519 * @brief On/off Cluster On Command callback
522 bool emberAfOnOffClusterOnCallback();
525 * @brief On/off Cluster Toggle Command callback
528 bool emberAfOnOffClusterToggleCallback();
531 // Non-Cluster Related Callbacks
534 /** @brief Add To Current App Tasks
536 * This function is only useful to sleepy end devices. This function will note
537 * the passed item as part of a set of tasks the application has outstanding
538 * (e.g. message sent requiring APS acknwoledgement). This will affect how the
539 * application behaves with regard to sleeping and polling. Until the
540 * outstanding task is completed, the device may poll more frequently and sleep
543 * @param tasks Ver.: always
545 void emberAfAddToCurrentAppTasksCallback(EmberAfApplicationTask tasks);
547 /** @brief Remove From Current App Tasks
549 * This function is only useful to sleepy end devices. This function will
550 * remove the passed item from the set of tasks the application has outstanding
551 * (e.g. message sent requiring APS acknwoledgement). This will affect how the
552 * application behaves with regard to sleeping and polling. Removing the item
553 * from the list of outstanding tasks may allow the device to sleep longer and
554 * poll less frequently. If there are other outstanding tasks the system may
555 * still have to stay away and poll more often.
557 * @param tasks Ver.: always
559 void emberAfRemoveFromCurrentAppTasksCallback(EmberAfApplicationTask tasks);
561 /** @brief Allow Network Write Attribute
563 * This function is called by the application framework before it writes an
564 * attribute in response to a write attribute request from an external device.
565 * The value passed into this callback is the value to which the attribute is to
566 * be set by the framework.
567 Example: In mirroring simple metering data
568 * on an Energy Services Interface (ESI) (formerly called Energy Service Portal
569 * (ESP) in SE 1.0).), a mirrored simple meter needs to write read-only
570 * attributes on its mirror. The-meter-mirror sample application, located in
571 * app/framework/sample-apps, uses this callback to allow the mirrored device to
572 * write simple metering attributes on the mirror regardless of the fact that
573 * most simple metering attributes are defined as read-only by the ZigBee
575 Note: The ZCL specification does not (as of this
576 * writing) specify any permission-level security for writing writeable
577 * attributes. As far as the ZCL specification is concerned, if an attribute is
578 * writeable, any device that has a link key for the device should be able to
579 * write that attribute. Furthermore if an attribute is read only, it should not
580 * be written over the air. Thus, if you implement permissions for writing
581 * attributes as a feature, you MAY be operating outside the specification. This
582 * is unlikely to be a problem for writing read-only attributes, but it may be a
583 * problem for attributes that are writeable according to the specification but
584 * restricted by the application implementing this callback.
586 * @param endpoint Ver.: always
587 * @param clusterId Ver.: always
588 * @param attributeId Ver.: always
589 * @param mask Ver.: always
590 * @param manufacturerCode Ver.: always
591 * @param value Ver.: always
592 * @param type Ver.: always
594 EmberAfAttributeWritePermission emberAfAllowNetworkWriteAttributeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
595 chip::AttributeId attributeId, uint8_t mask,
596 uint16_t manufacturerCode, uint8_t * value, uint8_t type);
598 /** @brief Attribute Read Access
600 * This function is called whenever the Application Framework needs to check
601 * access permission for an attribute read.
603 * @param endpoint Ver.: always
604 * @param clusterId Ver.: always
605 * @param manufacturerCode Ver.: always
606 * @param attributeId Ver.: always
608 bool emberAfAttributeReadAccessCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, uint16_t manufacturerCode,
609 chip::AttributeId attributeId);
611 /** @brief Attribute Write Access
613 * This function is called whenever the Application Framework needs to check
614 * access permission for an attribute write.
616 * @param endpoint Ver.: always
617 * @param clusterId Ver.: always
618 * @param manufacturerCode Ver.: always
619 * @param attributeId Ver.: always
621 bool emberAfAttributeWriteAccessCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, uint16_t manufacturerCode,
622 chip::AttributeId attributeId);
624 /** @brief Default Response
626 * This function is called by the application framework when a Default Response
627 * command is received from an external device. The application should return
628 * true if the message was processed or false if it was not.
630 * @param clusterId The cluster identifier of this response. Ver.: always
631 * @param commandId The command identifier to which this is a response. Ver.:
633 * @param status Specifies either SUCCESS or the nature of the error that was
634 * detected in the received command. Ver.: always
636 bool emberAfDefaultResponseCallback(chip::ClusterId clusterId, chip::CommandId commandId, EmberAfStatus status);
638 /** @brief Configure Reporting Response
640 * This function is called by the application framework when a Configure
641 * Reporting Response command is received from an external device. The
642 * application should return true if the message was processed or false if it
645 * @param clusterId The cluster identifier of this response. Ver.: always
646 * @param buffer Buffer containing the list of attribute status records. Ver.:
648 * @param bufLen The length in bytes of the list. Ver.: always
650 bool emberAfConfigureReportingResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
652 /** @brief Read Reporting Configuration Response
654 * This function is called by the application framework when a Read Reporting
655 * Configuration Response command is received from an external device. The
656 * application should return true if the message was processed or false if it
659 * @param clusterId The cluster identifier of this response. Ver.: always
660 * @param buffer Buffer containing the list of attribute reporting configuration
661 * records. Ver.: always
662 * @param bufLen The length in bytes of the list. Ver.: always
664 bool emberAfReadReportingConfigurationResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
666 /** @brief Discover Attributes Response
668 * This function is called by the application framework when a Discover
669 * Attributes Response or Discover Attributes Extended Response command is
670 * received from an external device. The Discover Attributes Response command
671 * contains a bool indicating if discovery is complete and a list of zero or
672 * more attribute identifier/type records. The final argument indicates whether
673 * the response is in the extended format or not. The application should return
674 * true if the message was processed or false if it was not.
676 * @param clusterId The cluster identifier of this response. Ver.: always
677 * @param discoveryComplete Indicates whether there are more attributes to be
678 * discovered. true if there are no more attributes to be discovered. Ver.:
680 * @param buffer Buffer containing the list of attribute identifier/type
681 * records. Ver.: always
682 * @param bufLen The length in bytes of the list. Ver.: always
683 * @param extended Indicates whether the response is in the extended format or
686 bool emberAfDiscoverAttributesResponseCallback(chip::ClusterId clusterId, bool discoveryComplete, uint8_t * buffer, uint16_t bufLen,
689 /** @brief Discover Commands Generated Response
691 * This function is called by the framework when Discover Commands Generated
692 * Response is received.
694 * @param clusterId The cluster identifier of this response. Ver.: always
695 * @param manufacturerCode Manufacturer code Ver.: always
696 * @param discoveryComplete Indicates whether there are more commands to be
697 * discovered. Ver.: always
698 * @param commandIds Buffer containing the list of command identifiers. Ver.:
700 * @param commandIdCount The length of bytes of the list, whish is the same as
701 * the number of identifiers. Ver.: always
703 bool emberAfDiscoverCommandsGeneratedResponseCallback(chip::ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete,
704 chip::CommandId * commandIds, uint16_t commandIdCount);
706 /** @brief Discover Commands Received Response
708 * This function is called by the framework when Discover Commands Received
709 * Response is received.
711 * @param clusterId The cluster identifier of this response. Ver.: always
712 * @param manufacturerCode Manufacturer code Ver.: always
713 * @param discoveryComplete Indicates whether there are more commands to be
714 * discovered. Ver.: always
715 * @param commandIds Buffer containing the list of command identifiers. Ver.:
717 * @param commandIdCount The length of bytes of the list, whish is the same as
718 * the number of identifiers. Ver.: always
720 bool emberAfDiscoverCommandsReceivedResponseCallback(chip::ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete,
721 chip::CommandId * commandIds, uint16_t commandIdCount);
723 /** @brief Pre Command Received
725 * This callback is the second in the Application Framework's message processing
726 * chain. At this point in the processing of incoming over-the-air messages, the
727 * application has determined that the incoming message is a ZCL command. It
728 * parses enough of the message to populate an EmberAfClusterCommand struct. The
729 * Application Framework defines this struct value in a local scope to the
730 * command processing but also makes it available through a global pointer
731 * called emberAfCurrentCommand, in app/framework/util/util.c. When command
732 * processing is complete, this pointer is cleared.
734 * @param cmd Ver.: always
736 bool emberAfPreCommandReceivedCallback(EmberAfClusterCommand * cmd);
738 /** @brief Pre Message Send
740 * This function is called by the framework when it is about to pass a message
741 * to the stack primitives for sending. This message may or may not be ZCL,
742 * ZDO, or some other protocol. This is called prior to
744 * fragmentation that may be done. If the function returns true it is assumed
745 * the callback has consumed and processed the message. The callback must also
746 * set the EmberStatus status code to be passed back to the caller. The
747 * framework will do no further processing on the message.
749 * function returns false then it is assumed that the callback has not processed
750 * the mesasge and the framework will continue to process accordingly.
752 * @param messageStruct The structure containing the parameters of the APS
753 * message to be sent. Ver.: always
754 * @param status A pointer to the status code value that will be returned to the
755 * caller. Ver.: always
757 bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberStatus * status);
759 /** @brief Message Sent
761 * This function is called by the application framework from the message sent
762 * handler, when it is informed by the stack regarding the message sent status.
763 * All of the values passed to the emberMessageSentHandler are passed on to this
764 * callback. This provides an opportunity for the application to verify that its
765 * message has been sent successfully and take the appropriate action. This
766 * callback should return a bool value of true or false. A value of true
767 * indicates that the message sent notification has been handled and should not
768 * be handled by the application framework.
770 * @param type Ver.: always
771 * @param indexOrDestination Ver.: always
772 * @param apsFrame Ver.: always
773 * @param msgLen Ver.: always
774 * @param message Ver.: always
775 * @param status Ver.: always
777 bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame,
778 uint16_t msgLen, uint8_t * message, EmberStatus status);
780 /** @brief Pre Attribute Change
782 * This function is called by the application framework before it changes an
783 * attribute value. The value passed into this callback is the value to which
784 * the attribute is to be set by the framework. The application should return
785 * ::EMBER_ZCL_STATUS_SUCCESS to permit the change or any other ::EmberAfStatus
788 * @param endpoint Ver.: always
789 * @param clusterId Ver.: always
790 * @param attributeId Ver.: always
791 * @param mask Ver.: always
792 * @param manufacturerCode Ver.: always
793 * @param type Ver.: always
794 * @param size Ver.: always
795 * @param value Ver.: always
797 EmberAfStatus emberAfPreAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
798 uint8_t mask, uint16_t manufacturerCode, uint8_t type, uint8_t size,
801 /** @brief Post Attribute Change
803 * This function is called by the application framework after it changes an
804 * attribute value. The value passed into this callback is the value to which
805 * the attribute was set by the framework.
807 * @param endpoint Ver.: always
808 * @param clusterId Ver.: always
809 * @param attributeId Ver.: always
810 * @param mask Ver.: always
811 * @param manufacturerCode Ver.: always
812 * @param type Ver.: always
813 * @param size Ver.: always
814 * @param value Ver.: always
816 void emberAfPostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
817 uint8_t mask, uint16_t manufacturerCode, uint8_t type, uint8_t size, uint8_t * value);
819 /** @brief Read Attributes Response
821 * This function is called by the application framework when a Read Attributes
822 * Response command is received from an external device. The application should
823 * return true if the message was processed or false if it was not.
825 * @param clusterId The cluster identifier of this response. Ver.: always
826 * @param buffer Buffer containing the list of read attribute status records.
828 * @param bufLen The length in bytes of the list. Ver.: always
830 bool emberAfReadAttributesResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
832 /** @brief External Attribute Read
834 * Like emberAfExternalAttributeWriteCallback above, this function is called
835 * when the framework needs to read an attribute that is not stored within the
836 * Application Framework's data structures.
838 * information about the attribute itself is passed as a pointer to an
839 * EmberAfAttributeMetadata struct, which is stored within the application and
840 * used to manage the attribute. A complete description of the
841 * EmberAfAttributeMetadata struct is provided in
842 * app/framework/include/af-types.h
843 This function assumes that the
844 * application is able to read the attribute, write it into the passed buffer,
845 * and return immediately. Any attributes that require a state machine for
846 * reading and writing are not really candidates for externalization at the
847 * present time. The Application Framework does not currently include a state
848 * machine for reading or writing attributes that must take place across a
849 * series of application ticks. Attributes that cannot be read in a timely
850 * manner should be stored within the Application Framework and updated
851 * occasionally by the application code from within the
852 * emberAfMainTickCallback.
853 If the application was successfully able to
854 * read the attribute and write it into the passed buffer, it should return a
855 * value of EMBER_ZCL_STATUS_SUCCESS. Ensure that the size of the externally
856 * managed attribute value is smaller than what the buffer can hold. In the case
857 * of a buffer overflow throw an appropriate error such as
858 * EMBER_ZCL_STATUS_INSUFFICIENT_SPACE. Any other return value indicates the
859 * application was not able to read the attribute.
861 * @param endpoint Ver.: always
862 * @param clusterId Ver.: always
863 * @param attributeMetadata Ver.: always
864 * @param manufacturerCode Ver.: always
865 * @param buffer Ver.: always
866 * @param maxReadLength Ver.: always
868 EmberAfStatus emberAfExternalAttributeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
869 EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
870 uint8_t * buffer, uint16_t maxReadLength);
872 /** @brief Write Attributes Response
874 * This function is called by the application framework when a Write Attributes
875 * Response command is received from an external device. The application should
876 * return true if the message was processed or false if it was not.
878 * @param clusterId The cluster identifier of this response. Ver.: always
879 * @param buffer Buffer containing the list of write attribute status records.
881 * @param bufLen The length in bytes of the list. Ver.: always
883 bool emberAfWriteAttributesResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
885 /** @brief External Attribute Write
887 * This function is called whenever the Application Framework needs to write an
888 * attribute which is not stored within the data structures of the Application
889 * Framework itself. One of the new features in Version 2 is the ability to
890 * store attributes outside the Framework. This is particularly useful for
891 * attributes that do not need to be stored because they can be read off the
892 * hardware when they are needed, or are stored in some central location used by
893 * many modules within the system. In this case, you can indicate that the
894 * attribute is stored externally. When the framework needs to write an external
895 * attribute, it makes a call to this callback.
896 This callback is very
897 * useful for host micros which need to store attributes in persistent memory.
898 * Because each host micro (used with an Ember NCP) has its own type of
899 * persistent memory storage, the Application Framework does not include the
900 * ability to mark attributes as stored in flash the way that it does for Ember
901 * SoCs like the EM35x. On a host micro, any attributes that need to be stored
902 * in persistent memory should be marked as external and accessed through the
903 * external read and write callbacks. Any host code associated with the
904 * persistent storage should be implemented within this callback.
906 * the important information about the attribute itself is passed as a pointer
907 * to an EmberAfAttributeMetadata struct, which is stored within the application
908 * and used to manage the attribute. A complete description of the
909 * EmberAfAttributeMetadata struct is provided in
910 * app/framework/include/af-types.h.
911 This function assumes that the
912 * application is able to write the attribute and return immediately. Any
913 * attributes that require a state machine for reading and writing are not
914 * candidates for externalization at the present time. The Application Framework
915 * does not currently include a state machine for reading or writing attributes
916 * that must take place across a series of application ticks. Attributes that
917 * cannot be written immediately should be stored within the Application
918 * Framework and updated occasionally by the application code from within the
919 * emberAfMainTickCallback.
920 If the application was successfully able to
921 * write the attribute, it returns a value of EMBER_ZCL_STATUS_SUCCESS. Any
922 * other return value indicates the application was not able to write the
925 * @param endpoint Ver.: always
926 * @param clusterId Ver.: always
927 * @param attributeMetadata Ver.: always
928 * @param manufacturerCode Ver.: always
929 * @param buffer Ver.: always
931 EmberAfStatus emberAfExternalAttributeWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
932 EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
935 /** @brief Report Attributes
937 * This function is called by the application framework when a Report Attributes
938 * command is received from an external device. The application should return
939 * true if the message was processed or false if it was not.
941 * @param clusterId The cluster identifier of this command. Ver.: always
942 * @param buffer Buffer containing the list of attribute report records. Ver.:
944 * @param bufLen The length in bytes of the list. Ver.: always
946 bool emberAfReportAttributesCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
948 /** @brief Get Current Time
950 * This callback is called when device attempts to get current time from the
951 * hardware. If this device has means to retrieve exact time, then this method
952 * should implement it. If the callback can't provide the exact time it should
953 * return 0 to indicate failure. Default action is to return 0, which indicates
954 * that device does not have access to real time.
957 uint32_t emberAfGetCurrentTimeCallback();
959 /** @brief Get Endpoint Info
961 * This function is a callback to an application implemented endpoint that
962 * operates outside the normal application framework. When the framework wishes
963 * to perform operations with that endpoint it uses this callback to retrieve
964 * the endpoint's information. If the endpoint exists and the application can
965 * provide data then true shall be returned. Otherwise the callback must return
968 * @param endpoint The endpoint to retrieve data for. Ver.: always
969 * @param returnNetworkIndex The index corresponding to the ZigBee network the
970 * endpoint belongs to. If not using a multi-network device, 0 must be
971 * returned. Otherwise on a multi-network device the stack will switch to this
972 * network before sending the message. Ver.: always
973 * @param returnEndpointInfo A pointer to a data struct that will be written
974 * with information about the endpoint. Ver.: always
976 bool emberAfGetEndpointInfoCallback(chip::EndpointId endpoint, uint8_t * returnNetworkIndex,
977 EmberAfEndpointInfoStruct * returnEndpointInfo);
979 /** @brief Get Source Route Overhead
981 * This function is called by the framework to determine the overhead required
982 * in the network frame for source routing to a particular destination.
984 * @param destination The node id of the destination Ver.: always
986 uint8_t emberAfGetSourceRouteOverheadCallback(chip::NodeId destination);
988 /** @brief Registration Abort
990 * This callback is called when the device should abort the registration
994 void emberAfRegistrationAbortCallback();
996 /** @brief Interpan Send Message
998 * This function will send a raw MAC message with interpan frame format using
999 * the passed parameters.
1001 * @param header Interpan header info Ver.: always
1002 * @param messageLength The length of the message received or to send Ver.:
1004 * @param message The message data received or to send. Ver.: always
1006 EmberStatus emberAfInterpanSendMessageCallback(EmberAfInterpanHeader * header, uint16_t messageLength, uint8_t * message);
1008 /** @brief Start Move
1010 * This function is called to initiate the process for a device to move (rejoin)
1014 bool emberAfStartMoveCallback();