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 Network Commissioning Cluster Init
54 * @param endpoint Endpoint that is being initialized
56 void emberAfNetworkCommissioningClusterInitCallback(chip::EndpointId endpoint);
58 /** @brief Temperature Measurement Cluster Init
62 * @param endpoint Endpoint that is being initialized
64 void emberAfTemperatureMeasurementClusterInitCallback(chip::EndpointId endpoint);
66 // Cluster Server/Client Init Functions
69 // Basic Cluster server
72 /** @brief Basic Cluster Server Init
76 * @param endpoint Endpoint that is being initialized
78 void emberAfBasicClusterServerInitCallback(chip::EndpointId endpoint);
80 /** @brief Basic Cluster Server Attribute Changed
82 * Server Attribute Changed
84 * @param endpoint Endpoint that is being initialized
85 * @param attributeId Attribute that changed
87 void emberAfBasicClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
89 /** @brief Basic Cluster Server Manufacturer Specific Attribute Changed
91 * Server Manufacturer Specific Attribute Changed
93 * @param endpoint Endpoint that is being initialized
94 * @param attributeId Attribute that changed
95 * @param manufacturerCode Manufacturer Code of the attribute that changed
97 void emberAfBasicClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
98 uint16_t manufacturerCode);
100 /** @brief Basic Cluster Server Message Sent
102 * Server Message Sent
104 * @param type The type of message sent
105 * @param indexOrDestination The destination or address to which the message was sent
106 * @param apsFrame The APS frame for the message
107 * @param msgLen The length of the message
108 * @param message The message that was sent
109 * @param status The status of the sent message
111 void emberAfBasicClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
112 EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message, EmberStatus status);
114 /** @brief Basic Cluster Server Pre Attribute Changed
116 * server Pre Attribute Changed
118 * @param endpoint Endpoint that is being initialized
119 * @param attributeId Attribute to be changed
120 * @param attributeType Attribute type
121 * @param size Attribute size
122 * @param value Attribute value
124 EmberAfStatus emberAfBasicClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId,
125 EmberAfAttributeType attributeType, uint8_t size,
128 /** @brief Basic Cluster Server Tick
132 * @param endpoint Endpoint that is being served
134 void emberAfBasicClusterServerTickCallback(chip::EndpointId endpoint);
137 // Network Commissioning Cluster server
140 /** @brief Network Commissioning Cluster Server Init
144 * @param endpoint Endpoint that is being initialized
146 void emberAfNetworkCommissioningClusterServerInitCallback(chip::EndpointId endpoint);
148 /** @brief Network Commissioning Cluster Server Attribute Changed
150 * Server Attribute Changed
152 * @param endpoint Endpoint that is being initialized
153 * @param attributeId Attribute that changed
155 void emberAfNetworkCommissioningClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
157 /** @brief Network Commissioning Cluster Server Manufacturer Specific Attribute Changed
159 * Server Manufacturer Specific Attribute Changed
161 * @param endpoint Endpoint that is being initialized
162 * @param attributeId Attribute that changed
163 * @param manufacturerCode Manufacturer Code of the attribute that changed
165 void emberAfNetworkCommissioningClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
166 chip::AttributeId attributeId,
167 uint16_t manufacturerCode);
169 /** @brief Network Commissioning Cluster Server Message Sent
171 * Server Message Sent
173 * @param type The type of message sent
174 * @param indexOrDestination The destination or address to which the message was sent
175 * @param apsFrame The APS frame for the message
176 * @param msgLen The length of the message
177 * @param message The message that was sent
178 * @param status The status of the sent message
180 void emberAfNetworkCommissioningClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
181 EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
184 /** @brief Network Commissioning Cluster Server Pre Attribute Changed
186 * server Pre Attribute Changed
188 * @param endpoint Endpoint that is being initialized
189 * @param attributeId Attribute to be changed
190 * @param attributeType Attribute type
191 * @param size Attribute size
192 * @param value Attribute value
194 EmberAfStatus emberAfNetworkCommissioningClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint,
195 chip::AttributeId attributeId,
196 EmberAfAttributeType attributeType, uint8_t size,
199 /** @brief Network Commissioning Cluster Server Tick
203 * @param endpoint Endpoint that is being served
205 void emberAfNetworkCommissioningClusterServerTickCallback(chip::EndpointId endpoint);
208 // Temperature Measurement Cluster server
211 /** @brief Temperature Measurement Cluster Server Init
215 * @param endpoint Endpoint that is being initialized
217 void emberAfTemperatureMeasurementClusterServerInitCallback(chip::EndpointId endpoint);
219 /** @brief Temperature Measurement Cluster Server Attribute Changed
221 * Server Attribute Changed
223 * @param endpoint Endpoint that is being initialized
224 * @param attributeId Attribute that changed
226 void emberAfTemperatureMeasurementClusterServerAttributeChangedCallback(chip::EndpointId endpoint, chip::AttributeId attributeId);
228 /** @brief Temperature Measurement Cluster Server Manufacturer Specific Attribute Changed
230 * Server Manufacturer Specific Attribute Changed
232 * @param endpoint Endpoint that is being initialized
233 * @param attributeId Attribute that changed
234 * @param manufacturerCode Manufacturer Code of the attribute that changed
236 void emberAfTemperatureMeasurementClusterServerManufacturerSpecificAttributeChangedCallback(chip::EndpointId endpoint,
237 chip::AttributeId attributeId,
238 uint16_t manufacturerCode);
240 /** @brief Temperature Measurement Cluster Server Message Sent
242 * Server Message Sent
244 * @param type The type of message sent
245 * @param indexOrDestination The destination or address to which the message was sent
246 * @param apsFrame The APS frame for the message
247 * @param msgLen The length of the message
248 * @param message The message that was sent
249 * @param status The status of the sent message
251 void emberAfTemperatureMeasurementClusterServerMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination,
252 EmberApsFrame * apsFrame, uint16_t msgLen, uint8_t * message,
255 /** @brief Temperature Measurement Cluster Server Pre Attribute Changed
257 * server Pre Attribute Changed
259 * @param endpoint Endpoint that is being initialized
260 * @param attributeId Attribute to be changed
261 * @param attributeType Attribute type
262 * @param size Attribute size
263 * @param value Attribute value
265 EmberAfStatus emberAfTemperatureMeasurementClusterServerPreAttributeChangedCallback(chip::EndpointId endpoint,
266 chip::AttributeId attributeId,
267 EmberAfAttributeType attributeType,
268 uint8_t size, uint8_t * value);
270 /** @brief Temperature Measurement Cluster Server Tick
274 * @param endpoint Endpoint that is being served
276 void emberAfTemperatureMeasurementClusterServerTickCallback(chip::EndpointId endpoint);
278 // Cluster Commands Callback
281 * @brief Network Commissioning Cluster AddThreadNetwork Command callback
282 * @param operationalDataset
287 bool emberAfNetworkCommissioningClusterAddThreadNetworkCallback(chip::ByteSpan operationalDataset, uint64_t breadcrumb,
291 * @brief Network Commissioning Cluster AddWiFiNetwork Command callback
298 bool emberAfNetworkCommissioningClusterAddWiFiNetworkCallback(chip::ByteSpan ssid, chip::ByteSpan credentials, uint64_t breadcrumb,
302 * @brief Network Commissioning Cluster DisableNetwork Command callback
308 bool emberAfNetworkCommissioningClusterDisableNetworkCallback(chip::ByteSpan networkID, uint64_t breadcrumb, uint32_t timeoutMs);
311 * @brief Network Commissioning Cluster EnableNetwork Command callback
317 bool emberAfNetworkCommissioningClusterEnableNetworkCallback(chip::ByteSpan networkID, uint64_t breadcrumb, uint32_t timeoutMs);
320 * @brief Network Commissioning Cluster GetLastNetworkCommissioningResult Command callback
324 bool emberAfNetworkCommissioningClusterGetLastNetworkCommissioningResultCallback(uint32_t timeoutMs);
327 * @brief Network Commissioning Cluster RemoveNetwork Command callback
333 bool emberAfNetworkCommissioningClusterRemoveNetworkCallback(chip::ByteSpan NetworkID, uint64_t Breadcrumb, uint32_t TimeoutMs);
336 * @brief Network Commissioning Cluster ScanNetworks Command callback
342 bool emberAfNetworkCommissioningClusterScanNetworksCallback(chip::ByteSpan ssid, uint64_t breadcrumb, uint32_t timeoutMs);
345 * @brief Network Commissioning Cluster UpdateThreadNetwork Command callback
346 * @param operationalDataset
351 bool emberAfNetworkCommissioningClusterUpdateThreadNetworkCallback(chip::ByteSpan operationalDataset, uint64_t breadcrumb,
355 * @brief Network Commissioning Cluster UpdateWiFiNetwork Command callback
362 bool emberAfNetworkCommissioningClusterUpdateWiFiNetworkCallback(chip::ByteSpan ssid, chip::ByteSpan credentials,
363 uint64_t breadcrumb, uint32_t timeoutMs);
366 // Non-Cluster Related Callbacks
369 /** @brief Add To Current App Tasks
371 * This function is only useful to sleepy end devices. This function will note
372 * the passed item as part of a set of tasks the application has outstanding
373 * (e.g. message sent requiring APS acknwoledgement). This will affect how the
374 * application behaves with regard to sleeping and polling. Until the
375 * outstanding task is completed, the device may poll more frequently and sleep
378 * @param tasks Ver.: always
380 void emberAfAddToCurrentAppTasksCallback(EmberAfApplicationTask tasks);
382 /** @brief Remove From Current App Tasks
384 * This function is only useful to sleepy end devices. This function will
385 * remove the passed item from the set of tasks the application has outstanding
386 * (e.g. message sent requiring APS acknwoledgement). This will affect how the
387 * application behaves with regard to sleeping and polling. Removing the item
388 * from the list of outstanding tasks may allow the device to sleep longer and
389 * poll less frequently. If there are other outstanding tasks the system may
390 * still have to stay away and poll more often.
392 * @param tasks Ver.: always
394 void emberAfRemoveFromCurrentAppTasksCallback(EmberAfApplicationTask tasks);
396 /** @brief Allow Network Write Attribute
398 * This function is called by the application framework before it writes an
399 * attribute in response to a write attribute request from an external device.
400 * The value passed into this callback is the value to which the attribute is to
401 * be set by the framework.
402 Example: In mirroring simple metering data
403 * on an Energy Services Interface (ESI) (formerly called Energy Service Portal
404 * (ESP) in SE 1.0).), a mirrored simple meter needs to write read-only
405 * attributes on its mirror. The-meter-mirror sample application, located in
406 * app/framework/sample-apps, uses this callback to allow the mirrored device to
407 * write simple metering attributes on the mirror regardless of the fact that
408 * most simple metering attributes are defined as read-only by the ZigBee
410 Note: The ZCL specification does not (as of this
411 * writing) specify any permission-level security for writing writeable
412 * attributes. As far as the ZCL specification is concerned, if an attribute is
413 * writeable, any device that has a link key for the device should be able to
414 * write that attribute. Furthermore if an attribute is read only, it should not
415 * be written over the air. Thus, if you implement permissions for writing
416 * attributes as a feature, you MAY be operating outside the specification. This
417 * is unlikely to be a problem for writing read-only attributes, but it may be a
418 * problem for attributes that are writeable according to the specification but
419 * restricted by the application implementing this callback.
421 * @param endpoint Ver.: always
422 * @param clusterId Ver.: always
423 * @param attributeId Ver.: always
424 * @param mask Ver.: always
425 * @param manufacturerCode Ver.: always
426 * @param value Ver.: always
427 * @param type Ver.: always
429 EmberAfAttributeWritePermission emberAfAllowNetworkWriteAttributeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
430 chip::AttributeId attributeId, uint8_t mask,
431 uint16_t manufacturerCode, uint8_t * value, uint8_t type);
433 /** @brief Attribute Read Access
435 * This function is called whenever the Application Framework needs to check
436 * access permission for an attribute read.
438 * @param endpoint Ver.: always
439 * @param clusterId Ver.: always
440 * @param manufacturerCode Ver.: always
441 * @param attributeId Ver.: always
443 bool emberAfAttributeReadAccessCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, uint16_t manufacturerCode,
444 chip::AttributeId attributeId);
446 /** @brief Attribute Write Access
448 * This function is called whenever the Application Framework needs to check
449 * access permission for an attribute write.
451 * @param endpoint Ver.: always
452 * @param clusterId Ver.: always
453 * @param manufacturerCode Ver.: always
454 * @param attributeId Ver.: always
456 bool emberAfAttributeWriteAccessCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, uint16_t manufacturerCode,
457 chip::AttributeId attributeId);
459 /** @brief Default Response
461 * This function is called by the application framework when a Default Response
462 * command is received from an external device. The application should return
463 * true if the message was processed or false if it was not.
465 * @param clusterId The cluster identifier of this response. Ver.: always
466 * @param commandId The command identifier to which this is a response. Ver.:
468 * @param status Specifies either SUCCESS or the nature of the error that was
469 * detected in the received command. Ver.: always
471 bool emberAfDefaultResponseCallback(chip::ClusterId clusterId, chip::CommandId commandId, EmberAfStatus status);
473 /** @brief Configure Reporting Response
475 * This function is called by the application framework when a Configure
476 * Reporting Response command is received from an external device. The
477 * application should return true if the message was processed or false if it
480 * @param clusterId The cluster identifier of this response. Ver.: always
481 * @param buffer Buffer containing the list of attribute status records. Ver.:
483 * @param bufLen The length in bytes of the list. Ver.: always
485 bool emberAfConfigureReportingResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
487 /** @brief Read Reporting Configuration Response
489 * This function is called by the application framework when a Read Reporting
490 * Configuration Response command is received from an external device. The
491 * application should return true if the message was processed or false if it
494 * @param clusterId The cluster identifier of this response. Ver.: always
495 * @param buffer Buffer containing the list of attribute reporting configuration
496 * records. Ver.: always
497 * @param bufLen The length in bytes of the list. Ver.: always
499 bool emberAfReadReportingConfigurationResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
501 /** @brief Discover Attributes Response
503 * This function is called by the application framework when a Discover
504 * Attributes Response or Discover Attributes Extended Response command is
505 * received from an external device. The Discover Attributes Response command
506 * contains a bool indicating if discovery is complete and a list of zero or
507 * more attribute identifier/type records. The final argument indicates whether
508 * the response is in the extended format or not. The application should return
509 * true if the message was processed or false if it was not.
511 * @param clusterId The cluster identifier of this response. Ver.: always
512 * @param discoveryComplete Indicates whether there are more attributes to be
513 * discovered. true if there are no more attributes to be discovered. Ver.:
515 * @param buffer Buffer containing the list of attribute identifier/type
516 * records. Ver.: always
517 * @param bufLen The length in bytes of the list. Ver.: always
518 * @param extended Indicates whether the response is in the extended format or
521 bool emberAfDiscoverAttributesResponseCallback(chip::ClusterId clusterId, bool discoveryComplete, uint8_t * buffer, uint16_t bufLen,
524 /** @brief Discover Commands Generated Response
526 * This function is called by the framework when Discover Commands Generated
527 * Response is received.
529 * @param clusterId The cluster identifier of this response. Ver.: always
530 * @param manufacturerCode Manufacturer code Ver.: always
531 * @param discoveryComplete Indicates whether there are more commands to be
532 * discovered. Ver.: always
533 * @param commandIds Buffer containing the list of command identifiers. Ver.:
535 * @param commandIdCount The length of bytes of the list, whish is the same as
536 * the number of identifiers. Ver.: always
538 bool emberAfDiscoverCommandsGeneratedResponseCallback(chip::ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete,
539 chip::CommandId * commandIds, uint16_t commandIdCount);
541 /** @brief Discover Commands Received Response
543 * This function is called by the framework when Discover Commands Received
544 * Response is received.
546 * @param clusterId The cluster identifier of this response. Ver.: always
547 * @param manufacturerCode Manufacturer code Ver.: always
548 * @param discoveryComplete Indicates whether there are more commands to be
549 * discovered. Ver.: always
550 * @param commandIds Buffer containing the list of command identifiers. Ver.:
552 * @param commandIdCount The length of bytes of the list, whish is the same as
553 * the number of identifiers. Ver.: always
555 bool emberAfDiscoverCommandsReceivedResponseCallback(chip::ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete,
556 chip::CommandId * commandIds, uint16_t commandIdCount);
558 /** @brief Pre Command Received
560 * This callback is the second in the Application Framework's message processing
561 * chain. At this point in the processing of incoming over-the-air messages, the
562 * application has determined that the incoming message is a ZCL command. It
563 * parses enough of the message to populate an EmberAfClusterCommand struct. The
564 * Application Framework defines this struct value in a local scope to the
565 * command processing but also makes it available through a global pointer
566 * called emberAfCurrentCommand, in app/framework/util/util.c. When command
567 * processing is complete, this pointer is cleared.
569 * @param cmd Ver.: always
571 bool emberAfPreCommandReceivedCallback(EmberAfClusterCommand * cmd);
573 /** @brief Pre Message Send
575 * This function is called by the framework when it is about to pass a message
576 * to the stack primitives for sending. This message may or may not be ZCL,
577 * ZDO, or some other protocol. This is called prior to
579 * fragmentation that may be done. If the function returns true it is assumed
580 * the callback has consumed and processed the message. The callback must also
581 * set the EmberStatus status code to be passed back to the caller. The
582 * framework will do no further processing on the message.
584 * function returns false then it is assumed that the callback has not processed
585 * the mesasge and the framework will continue to process accordingly.
587 * @param messageStruct The structure containing the parameters of the APS
588 * message to be sent. Ver.: always
589 * @param status A pointer to the status code value that will be returned to the
590 * caller. Ver.: always
592 bool emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberStatus * status);
594 /** @brief Message Sent
596 * This function is called by the application framework from the message sent
597 * handler, when it is informed by the stack regarding the message sent status.
598 * All of the values passed to the emberMessageSentHandler are passed on to this
599 * callback. This provides an opportunity for the application to verify that its
600 * message has been sent successfully and take the appropriate action. This
601 * callback should return a bool value of true or false. A value of true
602 * indicates that the message sent notification has been handled and should not
603 * be handled by the application framework.
605 * @param type Ver.: always
606 * @param indexOrDestination Ver.: always
607 * @param apsFrame Ver.: always
608 * @param msgLen Ver.: always
609 * @param message Ver.: always
610 * @param status Ver.: always
612 bool emberAfMessageSentCallback(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame,
613 uint16_t msgLen, uint8_t * message, EmberStatus status);
615 /** @brief Pre Attribute Change
617 * This function is called by the application framework before it changes an
618 * attribute value. The value passed into this callback is the value to which
619 * the attribute is to be set by the framework. The application should return
620 * ::EMBER_ZCL_STATUS_SUCCESS to permit the change or any other ::EmberAfStatus
623 * @param endpoint Ver.: always
624 * @param clusterId Ver.: always
625 * @param attributeId Ver.: always
626 * @param mask Ver.: always
627 * @param manufacturerCode Ver.: always
628 * @param type Ver.: always
629 * @param size Ver.: always
630 * @param value Ver.: always
632 EmberAfStatus emberAfPreAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
633 uint8_t mask, uint16_t manufacturerCode, uint8_t type, uint8_t size,
636 /** @brief Post Attribute Change
638 * This function is called by the application framework after it changes an
639 * attribute value. The value passed into this callback is the value to which
640 * the attribute was set by the framework.
642 * @param endpoint Ver.: always
643 * @param clusterId Ver.: always
644 * @param attributeId Ver.: always
645 * @param mask Ver.: always
646 * @param manufacturerCode Ver.: always
647 * @param type Ver.: always
648 * @param size Ver.: always
649 * @param value Ver.: always
651 void emberAfPostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
652 uint8_t mask, uint16_t manufacturerCode, uint8_t type, uint8_t size, uint8_t * value);
654 /** @brief Read Attributes Response
656 * This function is called by the application framework when a Read Attributes
657 * Response command is received from an external device. The application should
658 * return true if the message was processed or false if it was not.
660 * @param clusterId The cluster identifier of this response. Ver.: always
661 * @param buffer Buffer containing the list of read attribute status records.
663 * @param bufLen The length in bytes of the list. Ver.: always
665 bool emberAfReadAttributesResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
667 /** @brief External Attribute Read
669 * Like emberAfExternalAttributeWriteCallback above, this function is called
670 * when the framework needs to read an attribute that is not stored within the
671 * Application Framework's data structures.
673 * information about the attribute itself is passed as a pointer to an
674 * EmberAfAttributeMetadata struct, which is stored within the application and
675 * used to manage the attribute. A complete description of the
676 * EmberAfAttributeMetadata struct is provided in
677 * app/framework/include/af-types.h
678 This function assumes that the
679 * application is able to read the attribute, write it into the passed buffer,
680 * and return immediately. Any attributes that require a state machine for
681 * reading and writing are not really candidates for externalization at the
682 * present time. The Application Framework does not currently include a state
683 * machine for reading or writing attributes that must take place across a
684 * series of application ticks. Attributes that cannot be read in a timely
685 * manner should be stored within the Application Framework and updated
686 * occasionally by the application code from within the
687 * emberAfMainTickCallback.
688 If the application was successfully able to
689 * read the attribute and write it into the passed buffer, it should return a
690 * value of EMBER_ZCL_STATUS_SUCCESS. Ensure that the size of the externally
691 * managed attribute value is smaller than what the buffer can hold. In the case
692 * of a buffer overflow throw an appropriate error such as
693 * EMBER_ZCL_STATUS_INSUFFICIENT_SPACE. Any other return value indicates the
694 * application was not able to read the attribute.
696 * @param endpoint Ver.: always
697 * @param clusterId Ver.: always
698 * @param attributeMetadata Ver.: always
699 * @param manufacturerCode Ver.: always
700 * @param buffer Ver.: always
701 * @param maxReadLength Ver.: always
703 EmberAfStatus emberAfExternalAttributeReadCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
704 EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
705 uint8_t * buffer, uint16_t maxReadLength);
707 /** @brief Write Attributes Response
709 * This function is called by the application framework when a Write Attributes
710 * Response command is received from an external device. The application should
711 * return true if the message was processed or false if it was not.
713 * @param clusterId The cluster identifier of this response. Ver.: always
714 * @param buffer Buffer containing the list of write attribute status records.
716 * @param bufLen The length in bytes of the list. Ver.: always
718 bool emberAfWriteAttributesResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
720 /** @brief External Attribute Write
722 * This function is called whenever the Application Framework needs to write an
723 * attribute which is not stored within the data structures of the Application
724 * Framework itself. One of the new features in Version 2 is the ability to
725 * store attributes outside the Framework. This is particularly useful for
726 * attributes that do not need to be stored because they can be read off the
727 * hardware when they are needed, or are stored in some central location used by
728 * many modules within the system. In this case, you can indicate that the
729 * attribute is stored externally. When the framework needs to write an external
730 * attribute, it makes a call to this callback.
731 This callback is very
732 * useful for host micros which need to store attributes in persistent memory.
733 * Because each host micro (used with an Ember NCP) has its own type of
734 * persistent memory storage, the Application Framework does not include the
735 * ability to mark attributes as stored in flash the way that it does for Ember
736 * SoCs like the EM35x. On a host micro, any attributes that need to be stored
737 * in persistent memory should be marked as external and accessed through the
738 * external read and write callbacks. Any host code associated with the
739 * persistent storage should be implemented within this callback.
741 * the important information about the attribute itself is passed as a pointer
742 * to an EmberAfAttributeMetadata struct, which is stored within the application
743 * and used to manage the attribute. A complete description of the
744 * EmberAfAttributeMetadata struct is provided in
745 * app/framework/include/af-types.h.
746 This function assumes that the
747 * application is able to write the attribute and return immediately. Any
748 * attributes that require a state machine for reading and writing are not
749 * candidates for externalization at the present time. The Application Framework
750 * does not currently include a state machine for reading or writing attributes
751 * that must take place across a series of application ticks. Attributes that
752 * cannot be written immediately should be stored within the Application
753 * Framework and updated occasionally by the application code from within the
754 * emberAfMainTickCallback.
755 If the application was successfully able to
756 * write the attribute, it returns a value of EMBER_ZCL_STATUS_SUCCESS. Any
757 * other return value indicates the application was not able to write the
760 * @param endpoint Ver.: always
761 * @param clusterId Ver.: always
762 * @param attributeMetadata Ver.: always
763 * @param manufacturerCode Ver.: always
764 * @param buffer Ver.: always
766 EmberAfStatus emberAfExternalAttributeWriteCallback(chip::EndpointId endpoint, chip::ClusterId clusterId,
767 EmberAfAttributeMetadata * attributeMetadata, uint16_t manufacturerCode,
770 /** @brief Report Attributes
772 * This function is called by the application framework when a Report Attributes
773 * command is received from an external device. The application should return
774 * true if the message was processed or false if it was not.
776 * @param clusterId The cluster identifier of this command. Ver.: always
777 * @param buffer Buffer containing the list of attribute report records. Ver.:
779 * @param bufLen The length in bytes of the list. Ver.: always
781 bool emberAfReportAttributesCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);
783 /** @brief Get Current Time
785 * This callback is called when device attempts to get current time from the
786 * hardware. If this device has means to retrieve exact time, then this method
787 * should implement it. If the callback can't provide the exact time it should
788 * return 0 to indicate failure. Default action is to return 0, which indicates
789 * that device does not have access to real time.
792 uint32_t emberAfGetCurrentTimeCallback();
794 /** @brief Get Endpoint Info
796 * This function is a callback to an application implemented endpoint that
797 * operates outside the normal application framework. When the framework wishes
798 * to perform operations with that endpoint it uses this callback to retrieve
799 * the endpoint's information. If the endpoint exists and the application can
800 * provide data then true shall be returned. Otherwise the callback must return
803 * @param endpoint The endpoint to retrieve data for. Ver.: always
804 * @param returnNetworkIndex The index corresponding to the ZigBee network the
805 * endpoint belongs to. If not using a multi-network device, 0 must be
806 * returned. Otherwise on a multi-network device the stack will switch to this
807 * network before sending the message. Ver.: always
808 * @param returnEndpointInfo A pointer to a data struct that will be written
809 * with information about the endpoint. Ver.: always
811 bool emberAfGetEndpointInfoCallback(chip::EndpointId endpoint, uint8_t * returnNetworkIndex,
812 EmberAfEndpointInfoStruct * returnEndpointInfo);
814 /** @brief Get Source Route Overhead
816 * This function is called by the framework to determine the overhead required
817 * in the network frame for source routing to a particular destination.
819 * @param destination The node id of the destination Ver.: always
821 uint8_t emberAfGetSourceRouteOverheadCallback(chip::NodeId destination);
823 /** @brief Registration Abort
825 * This callback is called when the device should abort the registration
829 void emberAfRegistrationAbortCallback();
831 /** @brief Interpan Send Message
833 * This function will send a raw MAC message with interpan frame format using
834 * the passed parameters.
836 * @param header Interpan header info Ver.: always
837 * @param messageLength The length of the message received or to send Ver.:
839 * @param message The message data received or to send. Ver.: always
841 EmberStatus emberAfInterpanSendMessageCallback(EmberAfInterpanHeader * header, uint16_t messageLength, uint8_t * message);
843 /** @brief Start Move
845 * This function is called to initiate the process for a device to move (rejoin)
849 bool emberAfStartMoveCallback();