3 * Copyright (c) 2020 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.
20 * Copyright (c) 2020 Silicon Labs
22 * Licensed under the Apache License, Version 2.0 (the "License");
23 * you may not use this file except in compliance with the License.
24 * You may obtain a copy of the License at
26 * http://www.apache.org/licenses/LICENSE-2.0
28 * Unless required by applicable law or agreed to in writing, software
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
34 /***************************************************************************/
37 * @brief The include file for all the types for Ember
39 *******************************************************************************
40 ******************************************************************************/
44 /** @addtogroup aftypes Zigbee Application Framework Types Reference
45 * This documentation describes the types used by the Zigbee
46 * Application Framework.
50 #include <stdbool.h> // For bool
51 #include <stddef.h> // For NULL.
52 #include <stdint.h> // For various uint*_t types
55 #include "basic-types.h"
56 #include "types_stub.h" // For various types.
59 #include "app/util/ezsp/ezsp-enum.h"
63 * @brief Type for referring to ZCL attribute type
65 typedef uint8_t EmberAfAttributeType;
68 * @brief Type for the cluster mask
70 typedef uint8_t EmberAfClusterMask;
73 * @brief Type for the attribute mask
75 typedef uint8_t EmberAfAttributeMask;
78 * @brief Generic function type, used for either of the cluster function.
80 * This type is used for the array of the cluster functions, and should
81 * always be cast into one of the specific functions before being called.
83 typedef void (*EmberAfGenericClusterFunction)(void);
86 * @brief A distinguished manufacturer code that is used to indicate the
87 * absence of a manufacturer-specific cluster, command, or attribute.
89 #define EMBER_AF_NULL_MANUFACTURER_CODE 0x0000
92 * @brief Type for default values.
94 * Default value is either a value itself, if it is 2 bytes or less,
95 * or a pointer to the value itself, if attribute type is longer than
101 * Points to data if size is more than 2 bytes.
102 * If size is more than 2 bytes, and this value is NULL,
103 * then the default value is all zeroes.
105 uint8_t * ptrToDefaultValue;
107 * Actual default value if the attribute size is 2 bytes or less.
109 uint16_t defaultValue;
110 } EmberAfDefaultAttributeValue;
113 * @brief Type describing the attribute default, min and max values.
115 * This struct is required if the attribute mask specifies that this
116 * attribute has a known min and max values.
121 * Default value of the attribute.
123 EmberAfDefaultAttributeValue defaultValue;
125 * Minimum allowed value
127 EmberAfDefaultAttributeValue minValue;
129 * Maximum allowed value.
131 EmberAfDefaultAttributeValue maxValue;
132 } EmberAfAttributeMinMaxValue;
135 * @brief Union describing the attribute default/min/max values.
140 * Points to data if size is more than 2 bytes.
141 * If size is more than 2 bytes, and this value is NULL,
142 * then the default value is all zeroes.
144 uint8_t * ptrToDefaultValue;
146 * Actual default value if the attribute size is 2 bytes or less.
148 uint16_t defaultValue;
150 * Points to the min max attribute value structure, if min/max is
151 * supported for this attribute.
153 EmberAfAttributeMinMaxValue * ptrToMinMaxValue;
154 } EmberAfDefaultOrMinMaxAttributeValue;
157 * @brief Each attribute has it's metadata stored in such struct.
159 * There is only one of these per attribute across all endpoints.
164 * Attribute ID, according to ZCL specs.
166 chip::AttributeId attributeId;
168 * Attribute type, according to ZCL specs.
170 EmberAfAttributeType attributeType;
172 * Size of this attribute in bytes.
176 * Attribute mask, tagging attribute with specific
177 * functionality. See ATTRIBUTE_MASK_ macros defined
180 EmberAfAttributeMask mask;
182 * Pointer to the default value union. Actual value stored
183 * depends on the mask.
185 EmberAfDefaultOrMinMaxAttributeValue defaultValue;
186 } EmberAfAttributeMetadata;
189 * @brief Struct describing cluster
194 * ID of cluster according to ZCL spec
196 chip::ClusterId clusterId;
198 * Pointer to attribute metadata array for this cluster.
200 EmberAfAttributeMetadata * attributes;
202 * Total number of attributes
204 uint16_t attributeCount;
206 * Total size of non-external, non-singleton attribute for this cluster.
208 uint16_t clusterSize;
210 * Mask with additional functionality for cluster. See CLUSTER_MASK
213 EmberAfClusterMask mask;
216 * An array into the cluster functions. The length of the array
217 * is determined by the function bits in mask. This may be null
218 * if this cluster has no functions.
220 const EmberAfGenericClusterFunction * functions;
224 * @brief Struct used to find an attribute in storage. Together the elements
225 * in this search record constitute the "primary key" used to identify a unique
226 * attribute value in attribute storage.
231 * Endpoint that the attribute is located on
233 chip::EndpointId endpoint;
236 * Cluster that the attribute is located on. If the cluster
237 * id is inside the manufacturer specific range, 0xfc00 - 0xffff,
238 * The manufacturer code should also be set to the code associated
239 * with the manufacturer specific cluster.
241 chip::ClusterId clusterId;
244 * Cluster mask for the cluster, used to determine if it is
245 * the server or client version of the cluster. See CLUSTER_MASK_
246 * macros defined in att-storage.h
248 EmberAfClusterMask clusterMask;
251 * The two byte identifier for the attribute. If the cluster id is
252 * inside the manufacturer specific range 0xfc00 - 0xffff, or the manufacturer
253 * code is NOT 0, the attribute is assumed to be manufacturer specific.
255 chip::AttributeId attributeId;
258 * Manufacturer Code associated with the cluster and or attribute.
259 * If the cluster id is inside the manufacturer specific
260 * range, this value should indicate the manufacturer code for the
261 * manufacturer specific cluster. Otherwise if this value is non zero,
262 * and the cluster id is a standard ZCL cluster,
263 * it is assumed that the attribute being sought is a manufacturer specific
264 * extension to the standard ZCL cluster indicated by the cluster id.
266 uint16_t manufacturerCode;
267 } EmberAfAttributeSearchRecord;
270 * A struct used to construct a table of manufacturer codes for
271 * manufacturer specific attributes and clusters.
276 uint16_t manufacturerCode;
277 } EmberAfManufacturerCodeEntry;
280 * This type is used to compare two ZCL attribute values. The size of this data
281 * type depends on the platform.
284 typedef uint64_t EmberAfDifferenceType;
286 typedef uint32_t EmberAfDifferenceType;
290 * @brief a struct containing the superset of values
291 * passed to both emberIncomingMessageHandler on the SOC and
292 * ezspIncomingMessageHandler on the host.
297 * The type of the incoming message
299 EmberIncomingMessageType type;
301 * APS frame for the incoming message
303 EmberApsFrame * apsFrame;
305 * The message copied into a flat buffer
309 * Length of the incoming message
313 * Two byte node id of the sending node.
317 * Link quality from the node that last relayed
322 * The energy level (in units of dBm) observed during the reception.
326 * The index of a binding that matches the message
327 * or 0xFF if there is no matching binding.
329 uint8_t bindingTableIndex;
331 * The index of the entry in the address table
332 * that matches the sender of the message or 0xFF
333 * if there is no matching entry.
335 uint8_t addressTableIndex;
337 * The index of the network on which this message was received.
339 uint8_t networkIndex;
340 } EmberAfIncomingMessage;
343 * @brief Interpan Message type: unicast, broadcast, or multicast.
345 typedef uint8_t EmberAfInterpanMessageType;
346 #define EMBER_AF_INTER_PAN_UNICAST 0x00
347 #define EMBER_AF_INTER_PAN_BROADCAST 0x08
348 #define EMBER_AF_INTER_PAN_MULTICAST 0x0C
351 #define INTER_PAN_UNICAST EMBER_AF_INTER_PAN_UNICAST
352 #define INTER_PAN_BROADCAST EMBER_AF_INTER_PAN_BROADCAST
353 #define INTER_PAN_MULTICAST EMBER_AF_INTER_PAN_MULTICAST
355 #define EMBER_AF_INTERPAN_OPTION_NONE 0x0000
356 #define EMBER_AF_INTERPAN_OPTION_APS_ENCRYPT 0x0001
357 #define EMBER_AF_INTERPAN_OPTION_MAC_HAS_LONG_ADDRESS 0x0002
360 * @brief The options for sending/receiving interpan messages.
362 typedef uint16_t EmberAfInterpanOptions;
365 * @brief Interpan header used for sending and receiving interpan
370 EmberAfInterpanMessageType messageType;
374 * For outgoing messages this is the destination. For incoming messages
375 * it is the source, which always has a long address.
377 EmberEUI64 longAddress;
378 EmberNodeId shortAddress;
384 chip::ClusterId clusterId;
386 * The groupId is only used for
387 * EMBER_AF_INTERPAN_MULTICAST
389 chip::GroupId groupId;
390 EmberAfInterpanOptions options;
391 } EmberAfInterpanHeader;
394 #define InterPanHeader EmberAfInterpanHeader
397 * @brief The options for what interpan messages are allowed.
399 typedef uint8_t EmberAfAllowedInterpanOptions;
401 #define EMBER_AF_INTERPAN_DIRECTION_CLIENT_TO_SERVER 0x01
402 #define EMBER_AF_INTERPAN_DIRECTION_SERVER_TO_CLIENT 0x02
403 #define EMBER_AF_INTERPAN_DIRECTION_BOTH 0x03
404 #define EMBER_AF_INTERPAN_GLOBAL_COMMAND 0x04
405 #define EMBER_AF_INTERPAN_MANUFACTURER_SPECIFIC 0x08
408 * @brief This structure is used define an interpan message that
409 * will be accepted by the interpan filters.
413 chip::ClusterId clusterId;
414 chip::CommandId commandId;
415 EmberAfAllowedInterpanOptions options;
416 } EmberAfAllowedInterPanMessage;
419 * @brief The EmberAFClusterCommand is a struct wrapper
420 * for all the data pertaining to a command which comes
421 * in over the air. This enables struct is used to
422 * encapsulate a command in a single place on the stack
423 * and pass a pointer to that location around during
429 * APS frame for the incoming message
431 EmberApsFrame * apsFrame;
432 EmberIncomingMessageType type;
436 bool clusterSpecific;
440 chip::CommandId commandId;
441 uint8_t payloadStartIndex;
443 EmberAfInterpanHeader * interPanHeader;
444 uint8_t networkIndex;
445 } EmberAfClusterCommand;
448 * @brief Endpoint type struct describes clusters that are on the endpoint.
453 * Pointer to the cluster structs, describing clusters on this
456 EmberAfCluster * cluster;
458 * Number of clusters in this endpoint type.
460 uint8_t clusterCount;
462 * Size of all non-external, non-singlet attribute in this endpoint type.
464 uint16_t endpointSize;
465 } EmberAfEndpointType;
468 typedef EzspDecisionId EmberAfTcLinkKeyRequestPolicy;
469 typedef EzspDecisionId EmberAfAppLinkKeyRequestPolicy;
470 #define EMBER_AF_ALLOW_TC_KEY_REQUESTS EZSP_ALLOW_TC_KEY_REQUESTS_AND_SEND_CURRENT_KEY
471 #define EMBER_AF_DENY_TC_KEY_REQUESTS EZSP_DENY_TC_KEY_REQUESTS
472 #define EMBER_AF_ALLOW_APP_KEY_REQUESTS EZSP_ALLOW_APP_KEY_REQUESTS
473 #define EMBER_AF_DENY_APP_KEY_REQUESTS EZSP_DENY_APP_KEY_REQUESTS
475 typedef EmberTcLinkKeyRequestPolicy EmberAfTcLinkKeyRequestPolicy;
476 typedef EmberAppLinkKeyRequestPolicy EmberAfAppLinkKeyRequestPolicy;
477 #define EMBER_AF_ALLOW_TC_KEY_REQUESTS EMBER_ALLOW_TC_LINK_KEY_REQUEST_AND_SEND_CURRENT_KEY
478 #define EMBER_AF_DENY_TC_KEY_REQUESTS EMBER_DENY_TC_LINK_KEY_REQUESTS
479 #define EMBER_AF_ALLOW_APP_KEY_REQUESTS EMBER_ALLOW_APP_LINK_KEY_REQUEST
480 #define EMBER_AF_DENY_APP_KEY_REQUESTS EMBER_DENY_APP_LINK_KEY_REQUESTS
483 #ifdef DOXYGEN_SHOULD_SKIP_THIS
484 enum EmberAfEndpointBitmask;
486 typedef uint8_t EmberAfEndpointBitmask;
489 { EMBER_AF_ENDPOINT_DISABLED = 0x00,
490 EMBER_AF_ENDPOINT_ENABLED = 0x01,
494 * @brief Struct that maps actual endpoint type, onto a specific endpoint.
499 * Actual zigbee endpoint number.
501 chip::EndpointId endpoint;
503 * Device ID of the device on this endpoint.
507 * Version of the device.
509 uint8_t deviceVersion;
511 * Endpoint type for this endpoint.
513 EmberAfEndpointType * endpointType;
515 * Network index for this endpoint.
517 uint8_t networkIndex;
519 * Meta-data about the endpoint
521 EmberAfEndpointBitmask bitmask;
522 } EmberAfDefinedEndpoint;
524 // Cluster specific types
527 * @brief Bitmask data type for storing one bit of information for each ESI in
530 #if (EMBER_AF_PLUGIN_ESI_MANAGEMENT_ESI_TABLE_SIZE <= 8)
531 typedef uint8_t EmberAfPluginEsiManagementBitmask;
532 #elif (EMBER_AF_PLUGIN_ESI_MANAGEMENT_ESI_TABLE_SIZE <= 16)
533 typedef uint16_t EmberAfPluginEsiManagementBitmask;
534 #elif (EMBER_AF_PLUGIN_ESI_MANAGEMENT_ESI_TABLE_SIZE <= 32)
535 typedef uint32_t EmberAfPluginEsiManagementBitmask;
537 #error "EMBER_AF_PLUGIN_ESI_MANAGEMENT_ESI_TABLE_SIZE cannot exceed 32"
541 * @brief Struct that describes a load control event.
543 * This is used in the load control event callback and
544 * within the demand response load control cluster code.
549 #ifdef EMBER_AF_PLUGIN_DRLC_SERVER
551 chip::EndpointId sourceEndpoint;
552 #endif // EMBER_AF_PLUGIN_DRLC_SERVER
554 #ifdef EMBER_AF_PLUGIN_DRLC
555 EmberAfPluginEsiManagementBitmask esiBitmask;
556 #endif // EMBER_AF_PLUGIN_DRLC
558 chip::EndpointId destinationEndpoint;
559 uint16_t deviceClass;
560 uint8_t utilityEnrollmentGroup;
562 * Start time in seconds
566 * Duration in minutes
569 uint8_t criticalityLevel;
570 uint8_t coolingTempOffset;
571 uint8_t heatingTempOffset;
572 int16_t coolingTempSetPoint;
573 int16_t heatingTempSetPoint;
574 int8_t avgLoadPercentage;
576 uint8_t eventControl;
578 uint32_t durationRand;
579 uint8_t optionControl;
580 } EmberAfLoadControlEvent;
583 * @brief This is an enum used to indicate the result of the
584 * service discovery. Unicast discoveries are completed
585 * as soon as a response is received. Broadcast discoveries
586 * wait a period of time for multiple responses to be received.
590 EMBER_AF_BROADCAST_SERVICE_DISCOVERY_COMPLETE = 0x00,
591 EMBER_AF_BROADCAST_SERVICE_DISCOVERY_RESPONSE_RECEIVED = 0x01,
592 EMBER_AF_UNICAST_SERVICE_DISCOVERY_TIMEOUT = 0x02,
593 EMBER_AF_UNICAST_SERVICE_DISCOVERY_COMPLETE_WITH_RESPONSE = 0x03,
594 EMBER_AF_BROADCAST_SERVICE_DISCOVERY_COMPLETE_WITH_RESPONSE = 0x04,
595 EMBER_AF_UNICAST_SERVICE_DISCOVERY_COMPLETE_WITH_EMPTY_RESPONSE = 0x05,
596 EMBER_AF_BROADCAST_SERVICE_DISCOVERY_COMPLETE_WITH_EMPTY_RESPONSE = 0x06,
597 } EmberAfServiceDiscoveryStatus;
599 #define EM_AF_DISCOVERY_RESPONSE_MASK (0x05)
602 * @brief A simple way to determine if the service discovery callback
605 #define emberAfHaveDiscoveryResponseStatus(status) ((status) &EM_AF_DISCOVERY_RESPONSE_MASK)
608 * @brief A structure containing general information about the service discovery.
613 * The status indicates both the type of request (broadcast or unicast)
614 * and whether a response has been received.
616 EmberAfServiceDiscoveryStatus status;
619 * This indicates what ZDO request cluster was associated with the request.
620 * It is helpful for a callback that may be used for multiple ZDO request types
621 * to determine the type of data returned. This will be based on the
622 * ZDO cluster values defined in ember-types.h.
624 uint16_t zdoRequestClusterId;
627 * This is the address of the device that matched the request, which may
628 * be different than the device that *actually* is responding. This occurs
629 * when parents respond on behalf of their children.
631 EmberNodeId matchAddress;
634 * Only if the status code indicates a response will this data be non-NULL.
635 * When there is data, the type is according to the ZDO cluster ID sent out.
636 * For NETWORK_ADDRESS_REQUEST or IEEE_ADDRESS_REQUEST, the long ID will
637 * be contained in the responseData, so it will be a value of type ::EmberEUI64.
638 * The short ID will be in the matchAddress parameter field.
639 * For the MATCH_DESCRIPTORS_REQUEST the responseData will point
640 * to an ::EmberAfEndpointList structure.
642 const void * responseData;
643 } EmberAfServiceDiscoveryResult;
646 * @brief A list of endpoints received during a service discovery attempt.
647 * This will be returned for a match descriptor request and a
648 * active endpoint request.
653 const chip::EndpointId * list;
654 } EmberAfEndpointList;
657 * @brief A list of clusters received during a service discovery attempt.
658 * This will be returned for a simple descriptor request.
662 uint8_t inClusterCount;
663 const chip::ClusterId * inClusterList;
664 uint8_t outClusterCount;
665 const chip::ClusterId * outClusterList;
667 chip::EndpointId endpoint;
668 } EmberAfClusterList;
671 * @brief This defines a callback where a code element or cluster can be informed
672 * as to the result of a service discovery they have requested.
673 * For each match, the callback is fired with all the resulting matches from
674 * that source. If the discovery was unicast to a specific device, then
675 * the callback will only be fired once with either MATCH_FOUND or COMPLETE
676 * (no matches found). If the discovery is broadcast then multiple callbacks
677 * may be fired with ::EMBER_AF_SERVICE_DISCOVERY_RESPONSE_RECEIVED.
678 * After a couple seconds the callback will then be fired with
679 * ::EMBER_AF_SERVICE_DISCOVERY_COMPLETE as the result.
681 typedef void(EmberAfServiceDiscoveryCallback)(const EmberAfServiceDiscoveryResult * result);
684 * @brief This defines a callback where a code element or cluster can be
685 * informed as to the result of a request to initiate a partner link key
686 * exchange. The callback will be triggered with success equal to true if the
687 * exchange completed successfully.
689 typedef void(EmberAfPartnerLinkKeyExchangeCallback)(bool success);
692 * @brief This is an enum used to control how the device will poll for a given
693 * active cluster-related event. When the event is scheduled, the application
694 * can pass a poll control value which will be stored along with the event.
695 * The processor is only allowed to poll according to the most restrictive
696 * value for all active event. For instance, if two events are active, one
697 * with EMBER_AF_LONG_POLL and the other with EMBER_AF_SHORT_POLL, then the
698 * processor will short poll until the second event is deactivated.
704 } EmberAfEventPollControl;
707 * @brief This is an enum used to control how the device
708 * will sleep for a given active cluster related event.
709 * When the event is scheduled, the scheduling code can
710 * pass a sleep control value which will be stored along
711 * with the event. The processor is only allowed to sleep
712 * according to the most restrictive sleep control value
713 * for any active event. For instance, if two events
714 * are active, one with EMBER_AF_OK_TO_HIBERNATE and the
715 * other with EMBER_AF_OK_TO_NAP, then the processor
716 * will only be allowed to nap until the second event
721 EMBER_AF_OK_TO_SLEEP,
723 EMBER_AF_OK_TO_HIBERNATE = EMBER_AF_OK_TO_SLEEP,
727 } EmberAfEventSleepControl;
730 * @brief An enum used to track the tasks that the Application
731 * framework cares about. These are intended to be tasks
732 * that should keep the device out of hibernation like an
733 * application level request / response. If the response does
734 * not come in as a data ack, then the application will need
735 * to stay out of hibernation to wait and poll for it.
737 * Of course some tasks do not necessarily have a response. For
738 * instance, a ZDO request may or may not have a response. In this
739 * case, the application framework cannot rely on the fact that
740 * a response will come in to end the wake cycle, so the Application
741 * framework must timeout the wake cycle if no expected
742 * response is received or no other event can be relied upon to
743 * end the wake cycle.
745 * Tasks of this type should be added to the wake timeout mask
746 * by calling ::emberAfSetWakeTimeoutBitmaskCallback so that they
747 * can be governed by a timeout instead of a request / response
749 * the current tasks bitmask is an uint32_t bitmask used to
750 * track which tasks are active at any given time. The bottom 16 bits,
751 * values 0x01 - 0x8000 are reserved for Ember's use. The top
752 * 16 bits are reserved for the customer, values 0x10000 -
755 #ifdef DOXYGEN_SHOULD_SKIP_THIS
756 enum EmberAfApplicationTask
758 typedef uint32_t EmberAfApplicationTask;
762 // we may be able to remove these top two since they are
763 // handled by the stack on the SOC.
764 EMBER_AF_WAITING_FOR_DATA_ACK = 0x00000001, // not needed?
765 EMBER_AF_LAST_POLL_GOT_DATA = 0x00000002, // not needed?
766 EMBER_AF_WAITING_FOR_SERVICE_DISCOVERY = 0x00000004,
767 EMBER_AF_WAITING_FOR_ZDO_RESPONSE = 0x00000008,
768 EMBER_AF_WAITING_FOR_ZCL_RESPONSE = 0x00000010,
769 EMBER_AF_WAITING_FOR_REGISTRATION = 0x00000020,
770 EMBER_AF_WAITING_FOR_PARTNER_LINK_KEY_EXCHANGE = 0x00000040,
771 EMBER_AF_FORCE_SHORT_POLL = 0x00000080,
772 EMBER_AF_FRAGMENTATION_IN_PROGRESS = 0x00000100,
773 EMBER_AF_FORCE_SHORT_POLL_FOR_PARENT_CONNECTIVITY = 0x00000200,
777 * @brief a structure used to keep track of cluster related events and
778 * their sleep control values. The cluster code will not know at
779 * runtime all of the events that it has access to in the event table
780 * This structure is stored by the application framework in an event
781 * context table which along with helper functions allows the cluster
782 * code to schedule and deactivate its associated events.
787 * The endpoint of the associated cluster event.
789 chip::EndpointId endpoint;
791 * The cluster id of the associated cluster event.
793 chip::ClusterId clusterId;
795 * The server/client identity of the associated cluster event.
799 * A poll control value used to control the network polling behavior while
800 * the event is active.
802 EmberAfEventPollControl pollControl;
804 * A sleep control value used to control the processor's sleep
805 * behavior while the event is active.
807 EmberAfEventSleepControl sleepControl;
809 * A pointer to the event control value which is stored in the event table
810 * and is used to actually schedule the event.
812 EmberEventControl * eventControl;
813 } EmberAfEventContext;
816 * @brief Type for referring to the handler for network events.
818 typedef void (*EmberAfNetworkEventHandler)(void);
821 * @brief Type for referring to the handler for endpoint events.
823 typedef void (*EmberAfEndpointEventHandler)(chip::EndpointId endpoint);
825 #ifdef EMBER_AF_PLUGIN_GROUPS_SERVER
827 * @brief Indicates the absence of a Group table entry.
829 #define EMBER_AF_GROUP_TABLE_NULL_INDEX 0xFF
831 * @brief Value used when setting or getting the endpoint in a Group table
832 * entry. It indicates that the entry is not in use.
834 #define EMBER_AF_GROUP_TABLE_UNUSED_ENDPOINT_ID 0x00
836 * @brief Maximum length of Group names, not including the length byte.
838 #define ZCL_GROUPS_CLUSTER_MAXIMUM_NAME_LENGTH 16
840 * @brief A structure used to store group table entries in RAM or in tokens,
841 * depending on the platform. If the endpoint field is
842 * ::EMBER_AF_GROUP_TABLE_UNUSED_ENDPOINT_ID, the entry is unused.
846 chip::EndpointId endpoint; // 0x00 when not in use
847 chip::GroupId groupId;
848 uint8_t bindingIndex;
849 #ifdef EMBER_AF_PLUGIN_GROUPS_SERVER_NAME_SUPPORT
850 uint8_t name[ZCL_GROUPS_CLUSTER_MAXIMUM_NAME_LENGTH + 1];
852 } EmberAfGroupTableEntry;
853 #endif // EMBER_AF_PLUGIN_GROUPS_SERVER
856 * @brief Indicates the absence of a Scene table entry.
858 #define EMBER_AF_SCENE_TABLE_NULL_INDEX 0xFF
860 * @brief Value used when setting or getting the endpoint in a Scene table
861 * entry. It indicates that the entry is not in use.
863 #define EMBER_AF_SCENE_TABLE_UNUSED_ENDPOINT_ID 0x00
865 * @brief Maximum length of Scene names, not including the length byte.
867 #define ZCL_SCENES_CLUSTER_MAXIMUM_NAME_LENGTH 16
869 * @brief The group identifier for the global scene.
871 #define ZCL_SCENES_GLOBAL_SCENE_GROUP_ID 0x0000
873 * @brief The scene identifier for the global scene.
875 #define ZCL_SCENES_GLOBAL_SCENE_SCENE_ID 0x00
877 * @brief A structure used to store scene table entries in RAM or in tokens,
878 * depending on a plugin setting. If endpoint field is
879 * ::EMBER_AF_SCENE_TABLE_UNUSED_ENDPOINT_ID, the entry is unused.
883 chip::EndpointId endpoint; // 0x00 when this record is not in use
884 chip::GroupId groupId; // 0x0000 if not associated with a group
886 #ifdef EMBER_AF_PLUGIN_SCENES_NAME_SUPPORT
887 uint8_t name[ZCL_SCENES_CLUSTER_MAXIMUM_NAME_LENGTH + 1];
889 uint16_t transitionTime; // in seconds
890 uint8_t transitionTime100ms; // in tenths of a seconds
891 #ifdef ZCL_USING_ON_OFF_CLUSTER_SERVER
895 #ifdef ZCL_USING_LEVEL_CONTROL_CLUSTER_SERVER
896 bool hasCurrentLevelValue;
897 uint8_t currentLevelValue;
899 #ifdef ZCL_USING_THERMOSTAT_CLUSTER_SERVER
900 bool hasOccupiedCoolingSetpointValue;
901 int16_t occupiedCoolingSetpointValue;
902 bool hasOccupiedHeatingSetpointValue;
903 int16_t occupiedHeatingSetpointValue;
904 bool hasSystemModeValue;
905 uint8_t systemModeValue;
907 #ifdef ZCL_USING_COLOR_CONTROL_CLUSTER_SERVER
908 bool hasCurrentXValue;
909 uint16_t currentXValue;
910 bool hasCurrentYValue;
911 uint16_t currentYValue;
912 bool hasEnhancedCurrentHueValue;
913 uint16_t enhancedCurrentHueValue;
914 bool hasCurrentSaturationValue;
915 uint8_t currentSaturationValue;
916 bool hasColorLoopActiveValue;
917 uint8_t colorLoopActiveValue;
918 bool hasColorLoopDirectionValue;
919 uint8_t colorLoopDirectionValue;
920 bool hasColorLoopTimeValue;
921 uint16_t colorLoopTimeValue;
922 bool hasColorTemperatureMiredsValue;
923 uint16_t colorTemperatureMiredsValue;
924 #endif // ZCL_USING_COLOR_CONTROL_CLUSTER_SERVER
925 #ifdef ZCL_USING_DOOR_LOCK_CLUSTER_SERVER
926 bool hasLockStateValue;
927 uint8_t lockStateValue;
929 #ifdef ZCL_USING_WINDOW_COVERING_CLUSTER_SERVER
930 bool hasCurrentPositionLiftPercentageValue;
931 uint8_t currentPositionLiftPercentageValue;
932 bool hasCurrentPositionTiltPercentageValue;
933 uint8_t currentPositionTiltPercentageValue;
935 } EmberAfSceneTableEntry;
937 #if !defined(EMBER_AF_PLUGIN_MESSAGING_CLIENT)
938 // In order to be able to forward declare callbacks regardless of whether the plugin
939 // is enabled, we need to define all data structures. In order to be able to define
940 // the messaging client data struct, we need to declare this variable.
941 #define EMBER_AF_PLUGIN_MESSAGING_CLIENT_MESSAGE_SIZE 0
948 EmberAfPluginEsiManagementBitmask esiBitmask;
949 chip::EndpointId clientEndpoint;
951 uint8_t messageControl;
954 uint16_t durationInMinutes;
955 uint8_t message[EMBER_AF_PLUGIN_MESSAGING_CLIENT_MESSAGE_SIZE + 1];
956 } EmberAfPluginMessagingClientMessage;
958 #define ZCL_PRICE_CLUSTER_MAXIMUM_RATE_LABEL_LENGTH 11
963 chip::EndpointId clientEndpoint;
965 uint8_t rateLabel[ZCL_PRICE_CLUSTER_MAXIMUM_RATE_LABEL_LENGTH + 1];
966 uint32_t issuerEventId;
967 uint32_t currentTime;
968 uint8_t unitOfMeasure;
970 uint8_t priceTrailingDigitAndPriceTier;
971 uint8_t numberOfPriceTiersAndRegisterTier;
974 uint16_t durationInMinutes;
977 uint32_t generationPrice;
978 uint8_t generationPriceRatio;
979 uint32_t alternateCostDelivered;
980 uint8_t alternateCostUnit;
981 uint8_t alternateCostTrailingDigit;
982 uint8_t numberOfBlockThresholds;
983 uint8_t priceControl;
984 } EmberAfPluginPriceClientPrice;
987 * @brief Specifies CPP Authorization values
989 #ifdef DOXYGEN_SHOULD_SKIP_THIS
990 enum EmberAfPluginPriceCppAuth
992 typedef uint8_t EmberAfPluginPriceCppAuth;
996 EMBER_AF_PLUGIN_PRICE_CPP_AUTH_PENDING = 0,
997 EMBER_AF_PLUGIN_PRICE_CPP_AUTH_ACCEPTED = 1,
998 EMBER_AF_PLUGIN_PRICE_CPP_AUTH_REJECTED = 2,
999 EMBER_AF_PLUGIN_PRICE_CPP_AUTH_FORCED = 3,
1000 EMBER_AF_PLUGIN_PRICE_CPP_AUTH_RESERVED = 4
1004 * @brief Value used when setting or getting the endpoint in a report table
1005 * entry. It indicates that the entry is not in use.
1007 #define EMBER_AF_PLUGIN_REPORTING_UNUSED_ENDPOINT_ID 0x00
1009 * @brief A structure used to store reporting configurations. If endpoint
1010 * field is ::EMBER_AF_PLUGIN_REPORTING_UNUSED_ENDPOINT_ID, the entry is
1015 /** EMBER_ZCL_REPORTING_DIRECTION_REPORTED for reports sent from the local
1016 * device or EMBER_ZCL_REPORTING_DIRECTION_RECEIVED for reports received
1017 * from a remote device.
1019 EmberAfReportingDirection direction;
1020 /** The local endpoint from which the attribute is reported or to which the
1021 * report is received. If ::EMBER_AF_PLUGIN_REPORTING_UNUSED_ENDPOINT_ID,
1022 * the entry is unused.
1024 chip::EndpointId endpoint;
1025 /** The cluster where the attribute is located. */
1026 chip::ClusterId clusterId;
1027 /** The id of the attribute being reported or received. */
1028 chip::AttributeId attributeId;
1029 /** CLUSTER_MASK_SERVER for server-side attributes or CLUSTER_MASK_CLIENT for
1030 * client-side attributes.
1033 /** Manufacturer code associated with the cluster and/or attribute. If the
1034 * cluster id is inside the manufacturer-specific range, this value
1035 * indicates the manufacturer code for the cluster. Otherwise, if this
1036 * value is non-zero and the cluster id is a standard ZCL cluster, it
1037 * indicates the manufacturer code for attribute.
1039 uint16_t manufacturerCode;
1044 /** The minimum reporting interval, measured in seconds. */
1045 uint16_t minInterval;
1046 /** The maximum reporting interval, measured in seconds. */
1047 uint16_t maxInterval;
1048 /** The minimum change to the attribute that will result in a report
1051 uint32_t reportableChange;
1055 /** The node id of the source of the received reports. */
1056 chip::NodeId source;
1057 /** The remote endpoint from which the attribute is reported. */
1058 chip::EndpointId endpoint;
1059 /** The maximum expected time between reports, measured in seconds. */
1063 } EmberAfPluginReportingEntry;
1067 EMBER_AF_PLUGIN_TUNNELING_CLIENT_SUCCESS = 0x00,
1068 EMBER_AF_PLUGIN_TUNNELING_CLIENT_BUSY = 0x01,
1069 EMBER_AF_PLUGIN_TUNNELING_CLIENT_NO_MORE_TUNNEL_IDS = 0x02,
1070 EMBER_AF_PLUGIN_TUNNELING_CLIENT_PROTOCOL_NOT_SUPPORTED = 0x03,
1071 EMBER_AF_PLUGIN_TUNNELING_CLIENT_FLOW_CONTROL_NOT_SUPPORTED = 0x04,
1072 EMBER_AF_PLUGIN_TUNNELING_CLIENT_IEEE_ADDRESS_REQUEST_FAILED = 0xF9,
1073 EMBER_AF_PLUGIN_TUNNELING_CLIENT_IEEE_ADDRESS_NOT_FOUND = 0xFA,
1074 EMBER_AF_PLUGIN_TUNNELING_CLIENT_ADDRESS_TABLE_FULL = 0xFB,
1075 EMBER_AF_PLUGIN_TUNNELING_CLIENT_LINK_KEY_EXCHANGE_REQUEST_FAILED = 0xFC,
1076 EMBER_AF_PLUGIN_TUNNELING_CLIENT_LINK_KEY_EXCHANGE_FAILED = 0xFD,
1077 EMBER_AF_PLUGIN_TUNNELING_CLIENT_REQUEST_TUNNEL_FAILED = 0xFE,
1078 EMBER_AF_PLUGIN_TUNNELING_CLIENT_REQUEST_TUNNEL_TIMEOUT = 0xFF,
1079 } EmberAfPluginTunnelingClientStatus;
1081 #ifdef EMBER_AF_PLUGIN_ZLL_COMMISSIONING_COMMON
1083 * @brief Status codes used by the ZLL Commissioning plugin.
1085 #ifdef DOXYGEN_SHOULD_SKIP_THIS
1086 enum EmberAfZllCommissioningStatus
1088 typedef uint8_t EmberAfZllCommissioningStatus;
1092 EMBER_AF_ZLL_ABORTED_BY_APPLICATION = 0x00,
1093 EMBER_AF_ZLL_CHANNEL_CHANGE_FAILED = 0x01,
1094 EMBER_AF_ZLL_JOINING_FAILED = 0x02,
1095 EMBER_AF_ZLL_NO_NETWORKS_FOUND = 0x03,
1096 EMBER_AF_ZLL_PREEMPTED_BY_STACK = 0x04,
1097 EMBER_AF_ZLL_SENDING_START_JOIN_FAILED = 0x05,
1098 EMBER_AF_ZLL_SENDING_DEVICE_INFORMATION_REQUEST_FAILED = 0x06,
1099 EMBER_AF_ZLL_SENDING_IDENTIFY_REQUEST_FAILED = 0x07,
1100 EMBER_AF_ZLL_SENDING_RESET_TO_FACTORY_NEW_REQUEST_FAILED = 0x08,
1101 EMBER_AF_ZLL_NETWORK_FORMATION_FAILED = 0x09,
1102 EMBER_AF_ZLL_NETWORK_UPDATE_OPERATION = 0x0A,
1106 * @brief A structure used to represent Group Information Records used by ZLL
1111 chip::GroupId groupId;
1113 } EmberAfPluginZllCommissioningGroupInformationRecord;
1116 * @brief A structure used to represent Endpoint Information Records used by
1117 * ZLL Commissioning.
1121 EmberNodeId networkAddress;
1122 chip::EndpointId endpointId;
1125 } EmberAfPluginZllCommissioningEndpointInformationRecord;
1131 RECEIVED_PARTNER_CERTIFICATE = 1,
1132 GENERATING_EPHEMERAL_KEYS = 2,
1133 GENERATING_SHARED_SECRET = 3,
1134 KEY_GENERATION_DONE = 4,
1135 GENERATE_SHARED_SECRET_DONE = 5,
1137 * LINK_KEY_ESTABLISHED indicates Success,
1138 * key establishment done.
1140 LINK_KEY_ESTABLISHED = 6,
1144 * Transient failures where Key Establishment could be retried
1146 NO_LOCAL_RESOURCES = 7,
1147 PARTNER_NO_RESOURCES = 8,
1148 TIMEOUT_OCCURRED = 9,
1149 INVALID_APP_COMMAND = 10,
1150 MESSAGE_SEND_FAILURE = 11,
1151 PARTNER_SENT_TERMINATE = 12,
1152 INVALID_PARTNER_MESSAGE = 13,
1153 PARTNER_SENT_DEFAULT_RESPONSE_ERROR = 14,
1157 * These results are not worth retrying because the outcome
1160 BAD_CERTIFICATE_ISSUER = 15,
1161 KEY_CONFIRM_FAILURE = 16,
1162 BAD_KEY_ESTABLISHMENT_SUITE = 17,
1164 KEY_TABLE_FULL = 18,
1167 * Neither initiator nor responder is an
1168 * ESP/TC so the key establishment is not
1169 * allowed per the spec.
1171 NO_ESTABLISHMENT_ALLOWED = 19,
1173 /* 283k1 certificates need to have valid key usage
1175 INVALID_CERTIFICATE_KEY_USAGE = 20,
1176 } EmberAfKeyEstablishmentNotifyMessage;
1178 #define APP_NOTIFY_ERROR_CODE_START NO_LOCAL_RESOURCES
1179 #define APP_NOTIFY_MESSAGE_TEXT \
1181 "None", "Received Cert", "Generate keys", "Generate secret", "Key generate done", "Generate secret done", \
1182 "Link key verified", \
1184 /* Transient Error codes */ \
1185 "No local resources", "Partner no resources", "Timeout", "Invalid app. command", "Message send failure", \
1186 "Partner sent terminate", "Bad message", "Partner sent Default Rsp", \
1188 /* Fatal errors */ \
1189 "Bad cert issuer", "Key confirm failure", "Bad key est. suite", "Key table full", "Not allowed", "Invalid Key Usage", \
1193 * @brief Type for referring to the tick callback for cluster.
1195 * Tick function will be called once for each tick for each endpoint in
1196 * the cluster. The rate of tick is determined by the metadata of the
1199 typedef void (*EmberAfTickFunction)(chip::EndpointId endpoint);
1202 * @brief Type for referring to the init callback for cluster.
1204 * Init function is called when the application starts up, once for
1205 * each cluster/endpoint combination.
1207 typedef void (*EmberAfInitFunction)(chip::EndpointId endpoint);
1210 * @brief Type for referring to the attribute changed callback function.
1212 * This function is called just after an attribute changes.
1214 typedef void (*EmberAfClusterAttributeChangedCallback)(chip::EndpointId endpoint, chip::AttributeId attributeId);
1217 * @brief Type for referring to the manufacturer specific
1218 * attribute changed callback function.
1220 * This function is called just after a manufacturer specific attribute changes.
1222 typedef void (*EmberAfManufacturerSpecificClusterAttributeChangedCallback)(chip::EndpointId endpoint, chip::AttributeId attributeId,
1223 uint16_t manufacturerCode);
1226 * @brief Type for referring to the pre-attribute changed callback function.
1228 * This function is called before an attribute changes.
1230 typedef EmberAfStatus (*EmberAfClusterPreAttributeChangedCallback)(chip::EndpointId endpoint, chip::AttributeId attributeId,
1231 EmberAfAttributeType attributeType, uint8_t size,
1235 * @brief Type for referring to the default response callback function.
1237 * This function is called when default response is received, before
1238 * the global callback. Global callback is called immediately afterwards.
1240 typedef void (*EmberAfDefaultResponseFunction)(chip::EndpointId endpoint, chip::CommandId commandId, EmberAfStatus status);
1243 * @brief Type for referring to the message sent callback function.
1245 * This function is called when a message is sent.
1247 typedef void (*EmberAfMessageSentFunction)(EmberOutgoingMessageType type, uint64_t indexOrDestination, EmberApsFrame * apsFrame,
1248 uint16_t msgLen, uint8_t * message, EmberStatus status);
1251 * @brief The EmberAfMessageStruct is a struct wrapper that
1252 * contains all the data about a low-level message to be
1253 * sent (it may be ZCL or may be some other protocol).
1257 EmberAfMessageSentFunction callback;
1258 EmberApsFrame * apsFrame;
1260 uint64_t indexOrDestination;
1261 uint16_t messageLength;
1262 EmberOutgoingMessageType type;
1264 } EmberAfMessageStruct;
1267 * @brief A data struct for a link key backup.
1269 * Each entry notes the EUI64 of the device it is paired to and the key data.
1270 * This key may be hashed and not the actual link key currently in use.
1275 EmberEUI64 deviceId;
1277 } EmberAfLinkKeyBackupData;
1280 * @brief A data struct for all the trust center backup data.
1282 * The 'keyList' pointer must point to an array and 'maxKeyListLength'
1283 * must be populated with the maximum number of entries the array can hold.
1285 * Functions that modify this data structure will populate 'keyListLength'
1286 * indicating how many keys were actually written into 'keyList'.
1291 EmberEUI64 extendedPanId;
1292 uint8_t keyListLength;
1293 uint8_t maxKeyListLength;
1294 EmberAfLinkKeyBackupData * keyList;
1295 } EmberAfTrustCenterBackupData;
1298 * @brief The length of the hardware tag in the Ember Bootloader Query
1301 #define EMBER_AF_STANDALONE_BOOTLOADER_HARDWARE_TAG_LENGTH 16
1304 * @brief A data struct for the information retrieved during a response
1305 * to an Ember Bootloader over-the-air query.
1309 uint8_t hardwareTag[EMBER_AF_STANDALONE_BOOTLOADER_HARDWARE_TAG_LENGTH];
1310 uint8_t eui64[EUI64_SIZE];
1312 uint16_t bootloaderVersion;
1313 uint8_t capabilities;
1317 bool bootloaderActive;
1318 } EmberAfStandaloneBootloaderQueryResponseData;
1321 * @brief A data struct used to keep track of incoming and outgoing
1322 * commands for command discovery
1327 chip::CommandId commandId;
1329 } EmberAfCommandMetadata;
1332 * @brief A data structure used to describe the time in a human
1333 * understandable format (as opposed to 32-bit UTC)
1344 } EmberAfTimeStruct;
1347 * @brief A data structure used to describe the ZCL Date data type
1358 /* Simple Metering Server Test Code */
1359 #define EMBER_AF_PLUGIN_SIMPLE_METERING_SERVER_ELECTRIC_METER 0
1360 #define EMBER_AF_PLUGIN_SIMPLE_METERING_SERVER_GAS_METER 1
1362 // Functional Notification Flags
1363 // Also #defined in enums.h under slightly different names
1364 #define EMBER_AF_METERING_FNF_NEW_OTA_FIRMWARE 0x00000001
1365 #define EMBER_AF_METERING_FNF_CBKE_UPDATE_REQUEST 0x00000002
1366 #define EMBER_AF_METERING_FNF_TIME_SYNC 0x00000004
1367 #define EMBER_AF_METERING_FNF_STAY_AWAKE_REQUEST_HAN 0x00000010
1368 #define EMBER_AF_METERING_FNF_STAY_AWAKE_REQUEST_WAN 0x00000020
1369 #define EMBER_AF_METERING_FNF_PUSH_HISTORICAL_METERING_DATA_ATTRIBUTE_SET 0x000001C0
1370 #define EMBER_AF_METERING_FNF_PUSH_HISTORICAL_PREPAYMENT_DATA_ATTRIBUTE_SET 0x00000E00
1371 #define EMBER_AF_METERING_FNF_PUSH_ALL_STATIC_DATA_BASIC_CLUSTER 0x00001000
1372 #define EMBER_AF_METERING_FNF_PUSH_ALL_STATIC_DATA_METERING_CLUSTER 0x00002000
1373 #define EMBER_AF_METERING_FNF_PUSH_ALL_STATIC_DATA_PREPAYMENT_CLUSTER 0x00004000
1374 #define EMBER_AF_METERING_FNF_NETWORK_KEY_ACTIVE 0x00008000
1375 #define EMBER_AF_METERING_FNF_DISPLAY_MESSAGE 0x00010000
1376 #define EMBER_AF_METERING_FNF_CANCEL_ALL_MESSAGES 0x00020000
1377 #define EMBER_AF_METERING_FNF_CHANGE_SUPPLY 0x00040000
1378 #define EMBER_AF_METERING_FNF_LOCAL_CHANGE_SUPPLY 0x00080000
1379 #define EMBER_AF_METERING_FNF_SET_UNCONTROLLED_FLOW_THRESHOLD 0x00100000
1380 #define EMBER_AF_METERING_FNF_TUNNEL_MESSAGE_PENDING 0x00200000
1381 #define EMBER_AF_METERING_FNF_GET_SNAPSHOT 0x00400000
1382 #define EMBER_AF_METERING_FNF_GET_SAMPLED_DATA 0x00800000
1383 #define EMBER_AF_METERING_FNF_NEW_SUB_GHZ_CHANNEL_MASKS_AVAILABLE 0x01000000
1384 #define EMBER_AF_METERING_FNF_ENERGY_SCAN_PENDING 0x02000000
1385 #define EMBER_AF_METERING_FNF_CHANNEL_CHANGE_PENDING 0x04000000
1387 // Notification Flags 2
1388 #define EMBER_AF_METERING_NF2_PUBLISH_PRICE 0x00000001
1389 #define EMBER_AF_METERING_NF2_PUBLISH_BLOCK_PERIOD 0x00000002
1390 #define EMBER_AF_METERING_NF2_PUBLISH_TARIFF_INFORMATION 0x00000004
1391 #define EMBER_AF_METERING_NF2_PUBLISH_CONVERSION_FACTOR 0x00000008
1392 #define EMBER_AF_METERING_NF2_PUBLISH_CALORIFIC_VALUE 0x00000010
1393 #define EMBER_AF_METERING_NF2_PUBLISH_CO2_VALUE 0x00000020
1394 #define EMBER_AF_METERING_NF2_PUBLISH_BILLING_PERIOD 0x00000040
1395 #define EMBER_AF_METERING_NF2_PUBLISH_CONSOLIDATED_BILL 0x00000080
1396 #define EMBER_AF_METERING_NF2_PUBLISH_PRICE_MATRIX 0x00000100
1397 #define EMBER_AF_METERING_NF2_PUBLISH_BLOCK_THRESHOLDS 0x00000200
1398 #define EMBER_AF_METERING_NF2_PUBLISH_CURRENCY_CONVERSION 0x00000400
1399 #define EMBER_AF_METERING_NF2_PUBLISH_CREDIT_PAYMENT_INFO 0x00001000
1400 #define EMBER_AF_METERING_NF2_PUBLISH_CPP_EVENT 0x00002000
1401 #define EMBER_AF_METERING_NF2_PUBLISH_TIER_LABELS 0x00004000
1402 #define EMBER_AF_METERING_NF2_CANCEL_TARIFF 0x00008000
1404 // Notification Flags 3
1405 #define EMBER_AF_METERING_NF3_PUBLISH_CALENDAR 0x00000001
1406 #define EMBER_AF_METERING_NF3_PUBLISH_SPECIAL_DAYS 0x00000002
1407 #define EMBER_AF_METERING_NF3_PUBLISH_SEASONS 0x00000004
1408 #define EMBER_AF_METERING_NF3_PUBLISH_WEEK 0x00000008
1409 #define EMBER_AF_METERING_NF3_PUBLISH_DAY 0x00000010
1410 #define EMBER_AF_METERING_NF3_CANCEL_CALENDAR 0x00000020
1412 // Notification Flags 4
1413 #define EMBER_AF_METERING_NF4_SELECT_AVAILABLE_EMERGENCY_CREDIT 0x00000001
1414 #define EMBER_AF_METERING_NF4_CHANGE_DEBT 0x00000002
1415 #define EMBER_AF_METERING_NF4_EMERGENCY_CREDIT_SETUP 0x00000004
1416 #define EMBER_AF_METERING_NF4_CONSUMER_TOP_UP 0x00000008
1417 #define EMBER_AF_METERING_NF4_CREDIT_ADJUSTMENT 0x00000010
1418 #define EMBER_AF_METERING_NF4_CHANGE_PAYMENT_MODE 0x00000020
1419 #define EMBER_AF_METERING_NF4_GET_PREPAY_SNAPSHOT 0x00000040
1420 #define EMBER_AF_METERING_NF4_GET_TOP_UP_LOG 0x00000080
1421 #define EMBER_AF_METERING_NF4_SET_LOW_CREDIT_WARNING_LEVEL 0x00000100
1422 #define EMBER_AF_METERING_NF4_GET_DEBT_REPAYMENT_LOG 0x00000200
1423 #define EMBER_AF_METERING_NF4_SET_MAXIMUM_CREDIT_LIMIT 0x00000400
1424 #define EMBER_AF_METERING_NF4_SET_OVERALL_DEBT_CAP 0x00000800
1426 // Notification Flags 5
1427 #define EMBER_AF_METERING_NF5_PUBLISH_CHANGE_OF_TENANCY 0x00000001
1428 #define EMBER_AF_METERING_NF5_PUBLISH_CHANGE_OF_SUPPLIER 0x00000002
1429 #define EMBER_AF_METERING_NF5_REQUEST_NEW_PASSWORD_1_RESPONSE 0x00000004
1430 #define EMBER_AF_METERING_NF5_REQUEST_NEW_PASSWORD_2_RESPONSE 0x00000008
1431 #define EMBER_AF_METERING_NF5_REQUEST_NEW_PASSWORD_3_RESPONSE 0x00000010
1432 #define EMBER_AF_METERING_NF5_REQUEST_NEW_PASSWORD_4_RESPONSE 0x00000020
1433 #define EMBER_AF_METERING_NF5_UPDATE_SITE_ID 0x00000040
1434 #define EMBER_AF_METERING_NF5_RESET_BATTERY_COUNTER 0x00000080
1435 #define EMBER_AF_METERING_NF5_UPDATE_CIN 0x00000100
1438 * @brief Device Management plugin types
1441 #define EMBER_AF_DEVICE_MANAGEMENT_MAXIMUM_PROPOSED_PROVIDER_NAME_LENGTH (16)
1442 #define EMBER_AF_DEVICE_MANAGEMENT_MAXIMUM_PROPOSED_PROVIDER_CONTACT_DETAILS_LENGTH (18)
1443 #define EMBER_AF_DEVICE_MANAGEMENT_MAXIMUM_SITE_ID_LENGTH (32)
1444 #define EMBER_AF_DEVICE_MANAGEMENT_MAXIMUM_CIN_LENGTH (24)
1445 #define EMBER_AF_DEVICE_MANAGEMENT_MAXIMUM_PASSWORD_LENGTH (10)
1447 #ifdef DOXYGEN_SHOULD_SKIP_THIS
1448 enum EmberAfDeviceManagementPasswordType
1450 typedef uint16_t EmberAfDeviceManagementPasswordType;
1454 UNUSED_PASSWORD = 0x00,
1455 SERVICE_PASSWORD = 0x01,
1456 CONSUMER_PASSWORD = 0x02,
1459 #ifdef DOXYGEN_SHOULD_SKIP_THIS
1460 enum EmberAfDeviceManagementChangePendingFlags
1462 typedef uint8_t EmberAfDeviceManagementChangePendingFlags;
1466 EMBER_AF_DEVICE_MANAGEMENT_CHANGE_OF_TENANCY_PENDING_MASK = 0x01,
1467 EMBER_AF_DEVICE_MANAGEMENT_CHANGE_OF_SUPPLIER_PENDING_MASK = 0x02,
1468 EMBER_AF_DEVICE_MANAGEMENT_UPDATE_SITE_ID_PENDING_MASK = 0x04,
1469 EMBER_AF_DEVICE_MANAGEMENT_UPDATE_CIN_PENDING_MASK = 0x08,
1470 EMBER_AF_DEVICE_MANAGEMENT_UPDATE_SERVICE_PASSWORD_PENDING_MASK = 0x10,
1471 EMBER_AF_DEVICE_MANAGEMENT_UPDATE_CONSUMER_PASSWORD_PENDING_MASK = 0x20,
1476 // Optional fields only used by Gas Proxy Function plugin.
1477 uint32_t providerId;
1478 uint32_t issuerEventId;
1481 // always used fields
1482 uint32_t implementationDateTime;
1484 } EmberAfDeviceManagementTenancy;
1488 uint32_t proposedProviderId;
1489 uint32_t implementationDateTime;
1490 uint32_t providerChangeControl;
1491 uint8_t proposedProviderName[EMBER_AF_DEVICE_MANAGEMENT_MAXIMUM_PROPOSED_PROVIDER_NAME_LENGTH + 1];
1492 uint8_t proposedProviderContactDetails[EMBER_AF_DEVICE_MANAGEMENT_MAXIMUM_PROPOSED_PROVIDER_CONTACT_DETAILS_LENGTH + 1];
1493 } EmberAfDeviceManagementSupplier;
1497 uint32_t requestDateTime;
1498 uint32_t implementationDateTime;
1499 uint8_t supplyStatus;
1500 uint8_t originatorIdSupplyControlBits;
1501 } EmberAfDeviceManagementSupply;
1505 uint8_t siteId[EMBER_AF_DEVICE_MANAGEMENT_MAXIMUM_SITE_ID_LENGTH + 1];
1506 uint32_t implementationDateTime;
1507 uint32_t issuerEventId;
1508 } EmberAfDeviceManagementSiteId;
1512 uint8_t cin[EMBER_AF_DEVICE_MANAGEMENT_MAXIMUM_CIN_LENGTH + 1];
1513 uint32_t implementationDateTime;
1514 uint32_t issuerEventId;
1515 } EmberAfDeviceManagementCIN;
1519 bool supplyTamperState;
1520 bool supplyDepletionState;
1521 bool supplyUncontrolledFlowState;
1522 bool loadLimitSupplyState;
1523 } EmberAfDeviceManagementSupplyStatusFlags;
1527 uint16_t uncontrolledFlowThreshold;
1528 uint16_t multiplier;
1530 uint16_t measurementPeriod;
1531 uint8_t unitOfMeasure;
1532 uint8_t stabilisationPeriod;
1533 } EmberAfDeviceManagementUncontrolledFlowThreshold;
1537 uint32_t implementationDateTime;
1538 uint8_t supplyStatus;
1539 } EmberAfDeviceManagementSupplyStatus;
1543 uint8_t password[EMBER_AF_DEVICE_MANAGEMENT_MAXIMUM_PASSWORD_LENGTH + 1];
1544 uint32_t implementationDateTime;
1545 uint16_t durationInMinutes;
1546 EmberAfDeviceManagementPasswordType passwordType;
1547 } EmberAfDeviceManagementPassword;
1553 } EmberAfDeviceManagementAttributeRange;
1555 // attrRange is a list of attributeId values in a cluster. It's needed to track contigous
1556 // segments of valid attributeId's with gaps in the middle.
1557 // attributeSetId is the value of the upper byte in the attributeId. It ranges from 0x01(Price)
1558 // to 0x08(OTA Event Configuration)
1559 // Eg. {0x00,0x05} and {0x08,0x0A}
1560 // We're betting that there isn't a list of cluster attributes that has more than 5 gaps.
1563 uint8_t attributeSetId;
1564 EmberAfDeviceManagementAttributeRange attributeRange[7];
1565 } EmberAfDeviceManagementAttributeTable;
1571 uint8_t * plainPayload;
1572 uint16_t plainPayloadLength;
1574 uint8_t * encryptedPayload;
1575 uint16_t encryptedPayloadLength;
1576 } EmberAfGbzMessageData;
1580 uint8_t * gbzCommands;
1581 uint16_t gbzCommandsLength;
1582 uint8_t * gbzCommandsResponse;
1583 uint16_t gbzCommandsResponseLength;
1584 uint16_t messageCode;
1585 } EmberAfGpfMessage;
1588 * @brief Zigbee Internet Client/Server Remote Cluster Types
1590 typedef uint16_t EmberAfRemoteClusterType;
1592 #define EMBER_AF_REMOTE_CLUSTER_TYPE_NONE 0x0000
1593 #define EMBER_AF_REMOTE_CLUSTER_TYPE_SERVER 0x0001
1594 #define EMBER_AF_REMOTE_CLUSTER_TYPE_CLIENT 0x0002
1595 #define EMBER_AF_REMOTE_CLUSTER_TYPE_INVALID 0xFFFF
1598 * @brief Zigbee Internet Client/Server remote cluster struct.
1602 chip::ClusterId clusterId;
1604 chip::EndpointId endpoint;
1605 EmberAfRemoteClusterType type;
1606 } EmberAfRemoteClusterStruct;
1609 * @brief Zigbee Internet Client/Server Remote Binding struct
1613 EmberEUI64 targetEUI64;
1614 chip::EndpointId sourceEndpoint;
1615 chip::EndpointId destEndpoint;
1616 chip::ClusterId clusterId;
1617 EmberEUI64 destEUI64;
1618 EmberEUI64 sourceEUI64;
1619 } EmberAfRemoteBindingStruct;
1623 chip::ClusterId clusterId;
1625 } EmberAfClusterInfo;
1627 #if !defined(EMBER_AF_MAX_CLUSTERS_PER_ENDPOINT)
1628 #define EMBER_AF_MAX_CLUSTERS_PER_ENDPOINT 3
1632 * @brief A struct containing basic information about an endpoint.
1636 EmberAfClusterInfo clusters[EMBER_AF_MAX_CLUSTERS_PER_ENDPOINT];
1638 chip::EndpointId endpoint;
1639 uint8_t clusterCount;
1640 } EmberAfEndpointInfoStruct;
1642 #if !defined(EMBER_AF_MAX_ENDPOINTS_PER_DEVICE)
1643 #define EMBER_AF_MAX_ENDPOINTS_PER_DEVICE 1
1646 // Although we treat this like a bitmap, only 1 bit is set at a time.
1647 // We use the bitmap feature to allow us to find all devices
1648 // with any in a set of status codes using
1649 // emberAfPluginDeviceDatabaseFindDeviceByStatus().
1652 EMBER_AF_DEVICE_DISCOVERY_STATUS_NONE = 0x00,
1653 EMBER_AF_DEVICE_DISCOVERY_STATUS_NEW = 0x01,
1654 EMBER_AF_DEVICE_DISCOVERY_STATUS_FIND_ENDPOINTS = 0x02,
1655 EMBER_AF_DEVICE_DISCOVERY_STATUS_FIND_CLUSTERS = 0x04,
1656 EMBER_AF_DEVICE_DISCOVERY_STATUS_FIND_STACK_REVISION = 0x08,
1658 EMBER_AF_DEVICE_DISCOVERY_STATUS_DONE = 0x40,
1659 EMBER_AF_DEVICE_DISCOVERY_STATUS_FAILED = 0x80,
1660 } EmberAfDeviceDiscoveryStatus;
1663 * @brief A struct containing endpoint information about a device.
1668 EmberAfEndpointInfoStruct endpoints[EMBER_AF_MAX_ENDPOINTS_PER_DEVICE];
1669 EmberAfDeviceDiscoveryStatus status;
1670 uint8_t discoveryFailures;
1671 uint8_t capabilities;
1672 uint8_t endpointCount;
1673 uint8_t stackRevision;
1674 } EmberAfDeviceInfo;
1678 uint16_t deviceIndex;
1679 } EmberAfDeviceDatabaseIterator;
1683 EmberNodeId emberNodeId;
1685 } EmberAfJoiningDevice;
1687 #define EMBER_AF_INVALID_CLUSTER_ID 0xFFFF
1689 #define EMBER_AF_INVALID_ENDPOINT 0xFF
1691 #define EMBER_AF_INVALID_PAN_ID 0xFFFF
1694 * @brief Permit join times
1696 #define EMBER_AF_PERMIT_JOIN_FOREVER 0xFF
1697 #define EMBER_AF_PERMIT_JOIN_MAX_TIMEOUT 0xFE
1699 #define MAX_INT32U_VALUE (0xFFFFFFFFUL)
1700 #define MAX_INT16U_VALUE (0xFFFF)
1701 #define MAX_INT8U_VALUE (0xFF)
1704 * @brief Returns the elapsed time between two 32 bit values.
1705 * Result may not be valid if the time samples differ by more than 2147483647
1707 #define elapsedTimeInt32u(oldTime, newTime) ((uint32_t)((uint32_t)(newTime) - (uint32_t)(oldTime)))
1710 * @brief The overhead of the ZDO response.
1711 * 1 byte for the sequence and 1 byte for the status code.
1713 #define EMBER_AF_ZDO_RESPONSE_OVERHEAD 2
1715 /** @} END addtogroup */