diff --git a/src/app/util/af-types.h b/src/app/util/af-types.h index 19aa9db11a20d3..70880f4e1f1653 100644 --- a/src/app/util/af-types.h +++ b/src/app/util/af-types.h @@ -40,10 +40,6 @@ #include -#ifdef EZSP_HOST -#include "app/util/ezsp/ezsp-enum.h" -#endif - /** * @brief Type for the cluster mask */ @@ -269,53 +265,6 @@ typedef enum EMBER_AF_STAY_AWAKE, } EmberAfEventSleepControl; -/** - * @brief An enum used to track the tasks that the Application - * framework cares about. These are intended to be tasks - * that should keep the device out of hibernation like an - * application level request / response. If the response does - * not come in as a data ack, then the application will need - * to stay out of hibernation to wait and poll for it. - * - * Of course some tasks do not necessarily have a response. For - * instance, a ZDO request may or may not have a response. In this - * case, the application framework cannot rely on the fact that - * a response will come in to end the wake cycle, so the Application - * framework must timeout the wake cycle if no expected - * response is received or no other event can be relied upon to - * end the wake cycle. - * - * Tasks of this type should be added to the wake timeout mask - * by calling ::emberAfSetWakeTimeoutBitmaskCallback so that they - * can be governed by a timeout instead of a request / response - * - * the current tasks bitmask is an uint32_t bitmask used to - * track which tasks are active at any given time. The bottom 16 bits, - * values 0x01 - 0x8000 are reserved for Ember's use. The top - * 16 bits are reserved for the customer, values 0x10000 - - * 0x80000000 - */ -#ifdef DOXYGEN_SHOULD_SKIP_THIS -enum EmberAfApplicationTask -#else -typedef uint32_t EmberAfApplicationTask; -enum -#endif -{ - // we may be able to remove these top two since they are - // handled by the stack on the SOC. - EMBER_AF_WAITING_FOR_DATA_ACK = 0x00000001, // not needed? - EMBER_AF_LAST_POLL_GOT_DATA = 0x00000002, // not needed? - EMBER_AF_WAITING_FOR_SERVICE_DISCOVERY = 0x00000004, - EMBER_AF_WAITING_FOR_ZDO_RESPONSE = 0x00000008, - EMBER_AF_WAITING_FOR_ZCL_RESPONSE = 0x00000010, - EMBER_AF_WAITING_FOR_REGISTRATION = 0x00000020, - EMBER_AF_WAITING_FOR_PARTNER_LINK_KEY_EXCHANGE = 0x00000040, - EMBER_AF_FORCE_SHORT_POLL = 0x00000080, - EMBER_AF_FRAGMENTATION_IN_PROGRESS = 0x00000100, - EMBER_AF_FORCE_SHORT_POLL_FOR_PARENT_CONNECTIVITY = 0x00000200, -}; - /** * @brief a structure used to keep track of cluster related events and * their sleep control values. The cluster code will not know at @@ -355,16 +304,6 @@ typedef struct EmberEventControl * eventControl; } EmberAfEventContext; -/** - * @brief Type for referring to the handler for network events. - */ -typedef void (*EmberAfNetworkEventHandler)(void); - -/** - * @brief Type for referring to the handler for endpoint events. - */ -typedef void (*EmberAfEndpointEventHandler)(chip::EndpointId endpoint); - /** * @brief Indicates the absence of a Scene table entry. */ @@ -428,365 +367,7 @@ typedef EmberAfStatus (*EmberAfClusterPreAttributeChangedCallback)(const chip::a EmberAfAttributeType attributeType, uint16_t size, uint8_t * value); -/** - * @brief The length of the hardware tag in the Ember Bootloader Query - * Response. - */ -#define EMBER_AF_STANDALONE_BOOTLOADER_HARDWARE_TAG_LENGTH 16 - -/** - * @brief A data structure used to describe the ZCL Date data type - */ - -/* Simple Metering Server Test Code */ -#define EMBER_AF_PLUGIN_SIMPLE_METERING_SERVER_ELECTRIC_METER 0 -#define EMBER_AF_PLUGIN_SIMPLE_METERING_SERVER_GAS_METER 1 - -// Functional Notification Flags -// Also #defined in enums.h under slightly different names -#define EMBER_AF_METERING_FNF_NEW_OTA_FIRMWARE 0x00000001 -#define EMBER_AF_METERING_FNF_CBKE_UPDATE_REQUEST 0x00000002 -#define EMBER_AF_METERING_FNF_TIME_SYNC 0x00000004 -#define EMBER_AF_METERING_FNF_STAY_AWAKE_REQUEST_HAN 0x00000010 -#define EMBER_AF_METERING_FNF_STAY_AWAKE_REQUEST_WAN 0x00000020 -#define EMBER_AF_METERING_FNF_PUSH_HISTORICAL_METERING_DATA_ATTRIBUTE_SET 0x000001C0 -#define EMBER_AF_METERING_FNF_PUSH_HISTORICAL_PREPAYMENT_DATA_ATTRIBUTE_SET 0x00000E00 -#define EMBER_AF_METERING_FNF_PUSH_ALL_STATIC_DATA_BASIC_CLUSTER 0x00001000 -#define EMBER_AF_METERING_FNF_PUSH_ALL_STATIC_DATA_METERING_CLUSTER 0x00002000 -#define EMBER_AF_METERING_FNF_PUSH_ALL_STATIC_DATA_PREPAYMENT_CLUSTER 0x00004000 -#define EMBER_AF_METERING_FNF_NETWORK_KEY_ACTIVE 0x00008000 -#define EMBER_AF_METERING_FNF_DISPLAY_MESSAGE 0x00010000 -#define EMBER_AF_METERING_FNF_CANCEL_ALL_MESSAGES 0x00020000 -#define EMBER_AF_METERING_FNF_CHANGE_SUPPLY 0x00040000 -#define EMBER_AF_METERING_FNF_LOCAL_CHANGE_SUPPLY 0x00080000 -#define EMBER_AF_METERING_FNF_SET_UNCONTROLLED_FLOW_THRESHOLD 0x00100000 -#define EMBER_AF_METERING_FNF_TUNNEL_MESSAGE_PENDING 0x00200000 -#define EMBER_AF_METERING_FNF_GET_SNAPSHOT 0x00400000 -#define EMBER_AF_METERING_FNF_GET_SAMPLED_DATA 0x00800000 -#define EMBER_AF_METERING_FNF_NEW_SUB_GHZ_CHANNEL_MASKS_AVAILABLE 0x01000000 -#define EMBER_AF_METERING_FNF_ENERGY_SCAN_PENDING 0x02000000 -#define EMBER_AF_METERING_FNF_CHANNEL_CHANGE_PENDING 0x04000000 - -// Notification Flags 2 -#define EMBER_AF_METERING_NF2_PUBLISH_PRICE 0x00000001 -#define EMBER_AF_METERING_NF2_PUBLISH_BLOCK_PERIOD 0x00000002 -#define EMBER_AF_METERING_NF2_PUBLISH_TARIFF_INFORMATION 0x00000004 -#define EMBER_AF_METERING_NF2_PUBLISH_CONVERSION_FACTOR 0x00000008 -#define EMBER_AF_METERING_NF2_PUBLISH_CALORIFIC_VALUE 0x00000010 -#define EMBER_AF_METERING_NF2_PUBLISH_CO2_VALUE 0x00000020 -#define EMBER_AF_METERING_NF2_PUBLISH_BILLING_PERIOD 0x00000040 -#define EMBER_AF_METERING_NF2_PUBLISH_CONSOLIDATED_BILL 0x00000080 -#define EMBER_AF_METERING_NF2_PUBLISH_PRICE_MATRIX 0x00000100 -#define EMBER_AF_METERING_NF2_PUBLISH_BLOCK_THRESHOLDS 0x00000200 -#define EMBER_AF_METERING_NF2_PUBLISH_CURRENCY_CONVERSION 0x00000400 -#define EMBER_AF_METERING_NF2_PUBLISH_CREDIT_PAYMENT_INFO 0x00001000 -#define EMBER_AF_METERING_NF2_PUBLISH_CPP_EVENT 0x00002000 -#define EMBER_AF_METERING_NF2_PUBLISH_TIER_LABELS 0x00004000 -#define EMBER_AF_METERING_NF2_CANCEL_TARIFF 0x00008000 - -// Notification Flags 3 -#define EMBER_AF_METERING_NF3_PUBLISH_CALENDAR 0x00000001 -#define EMBER_AF_METERING_NF3_PUBLISH_SPECIAL_DAYS 0x00000002 -#define EMBER_AF_METERING_NF3_PUBLISH_SEASONS 0x00000004 -#define EMBER_AF_METERING_NF3_PUBLISH_WEEK 0x00000008 -#define EMBER_AF_METERING_NF3_PUBLISH_DAY 0x00000010 -#define EMBER_AF_METERING_NF3_CANCEL_CALENDAR 0x00000020 - -// Notification Flags 4 -#define EMBER_AF_METERING_NF4_SELECT_AVAILABLE_EMERGENCY_CREDIT 0x00000001 -#define EMBER_AF_METERING_NF4_CHANGE_DEBT 0x00000002 -#define EMBER_AF_METERING_NF4_EMERGENCY_CREDIT_SETUP 0x00000004 -#define EMBER_AF_METERING_NF4_CONSUMER_TOP_UP 0x00000008 -#define EMBER_AF_METERING_NF4_CREDIT_ADJUSTMENT 0x00000010 -#define EMBER_AF_METERING_NF4_CHANGE_PAYMENT_MODE 0x00000020 -#define EMBER_AF_METERING_NF4_GET_PREPAY_SNAPSHOT 0x00000040 -#define EMBER_AF_METERING_NF4_GET_TOP_UP_LOG 0x00000080 -#define EMBER_AF_METERING_NF4_SET_LOW_CREDIT_WARNING_LEVEL 0x00000100 -#define EMBER_AF_METERING_NF4_GET_DEBT_REPAYMENT_LOG 0x00000200 -#define EMBER_AF_METERING_NF4_SET_MAXIMUM_CREDIT_LIMIT 0x00000400 -#define EMBER_AF_METERING_NF4_SET_OVERALL_DEBT_CAP 0x00000800 - -// Notification Flags 5 -#define EMBER_AF_METERING_NF5_PUBLISH_CHANGE_OF_TENANCY 0x00000001 -#define EMBER_AF_METERING_NF5_PUBLISH_CHANGE_OF_SUPPLIER 0x00000002 -#define EMBER_AF_METERING_NF5_REQUEST_NEW_PASSWORD_1_RESPONSE 0x00000004 -#define EMBER_AF_METERING_NF5_REQUEST_NEW_PASSWORD_2_RESPONSE 0x00000008 -#define EMBER_AF_METERING_NF5_REQUEST_NEW_PASSWORD_3_RESPONSE 0x00000010 -#define EMBER_AF_METERING_NF5_REQUEST_NEW_PASSWORD_4_RESPONSE 0x00000020 -#define EMBER_AF_METERING_NF5_UPDATE_SITE_ID 0x00000040 -#define EMBER_AF_METERING_NF5_RESET_BATTERY_COUNTER 0x00000080 -#define EMBER_AF_METERING_NF5_UPDATE_CIN 0x00000100 - -/** - * @brief Device Management plugin types - */ - -#define EMBER_AF_DEVICE_MANAGEMENT_MAXIMUM_PROPOSED_PROVIDER_NAME_LENGTH (16) -#define EMBER_AF_DEVICE_MANAGEMENT_MAXIMUM_PROPOSED_PROVIDER_CONTACT_DETAILS_LENGTH (18) -#define EMBER_AF_DEVICE_MANAGEMENT_MAXIMUM_SITE_ID_LENGTH (32) -#define EMBER_AF_DEVICE_MANAGEMENT_MAXIMUM_CIN_LENGTH (24) -#define EMBER_AF_DEVICE_MANAGEMENT_MAXIMUM_PASSWORD_LENGTH (10) - -#ifdef DOXYGEN_SHOULD_SKIP_THIS -enum EmberAfDeviceManagementPasswordType -#else -typedef uint16_t EmberAfDeviceManagementPasswordType; -enum -#endif -{ - UNUSED_PASSWORD = 0x00, - SERVICE_PASSWORD = 0x01, - CONSUMER_PASSWORD = 0x02, -}; - -#ifdef DOXYGEN_SHOULD_SKIP_THIS -enum EmberAfDeviceManagementChangePendingFlags -#else -typedef uint8_t EmberAfDeviceManagementChangePendingFlags; -enum -#endif -{ - EMBER_AF_DEVICE_MANAGEMENT_CHANGE_OF_TENANCY_PENDING_MASK = 0x01, - EMBER_AF_DEVICE_MANAGEMENT_CHANGE_OF_SUPPLIER_PENDING_MASK = 0x02, - EMBER_AF_DEVICE_MANAGEMENT_UPDATE_SITE_ID_PENDING_MASK = 0x04, - EMBER_AF_DEVICE_MANAGEMENT_UPDATE_CIN_PENDING_MASK = 0x08, - EMBER_AF_DEVICE_MANAGEMENT_UPDATE_SERVICE_PASSWORD_PENDING_MASK = 0x10, - EMBER_AF_DEVICE_MANAGEMENT_UPDATE_CONSUMER_PASSWORD_PENDING_MASK = 0x20, -}; - -typedef struct -{ - // Optional fields only used by Gas Proxy Function plugin. - uint32_t providerId; - uint32_t issuerEventId; - uint8_t tariffType; - - // always used fields - uint32_t implementationDateTime; - uint32_t tenancy; -} EmberAfDeviceManagementTenancy; - -typedef struct -{ - uint32_t proposedProviderId; - uint32_t implementationDateTime; - uint32_t providerChangeControl; - uint8_t proposedProviderName[EMBER_AF_DEVICE_MANAGEMENT_MAXIMUM_PROPOSED_PROVIDER_NAME_LENGTH + 1]; - uint8_t proposedProviderContactDetails[EMBER_AF_DEVICE_MANAGEMENT_MAXIMUM_PROPOSED_PROVIDER_CONTACT_DETAILS_LENGTH + 1]; -} EmberAfDeviceManagementSupplier; - -typedef struct -{ - uint32_t requestDateTime; - uint32_t implementationDateTime; - uint8_t supplyStatus; - uint8_t originatorIdSupplyControlBits; -} EmberAfDeviceManagementSupply; - -typedef struct -{ - uint8_t siteId[EMBER_AF_DEVICE_MANAGEMENT_MAXIMUM_SITE_ID_LENGTH + 1]; - uint32_t implementationDateTime; - uint32_t issuerEventId; -} EmberAfDeviceManagementSiteId; - -typedef struct -{ - uint8_t cin[EMBER_AF_DEVICE_MANAGEMENT_MAXIMUM_CIN_LENGTH + 1]; - uint32_t implementationDateTime; - uint32_t issuerEventId; -} EmberAfDeviceManagementCIN; - -typedef struct -{ - bool supplyTamperState; - bool supplyDepletionState; - bool supplyUncontrolledFlowState; - bool loadLimitSupplyState; -} EmberAfDeviceManagementSupplyStatusFlags; - -typedef struct -{ - uint16_t uncontrolledFlowThreshold; - uint16_t multiplier; - uint16_t divisor; - uint16_t measurementPeriod; - uint8_t unitOfMeasure; - uint8_t stabilisationPeriod; -} EmberAfDeviceManagementUncontrolledFlowThreshold; - -typedef struct -{ - uint32_t implementationDateTime; - uint8_t supplyStatus; -} EmberAfDeviceManagementSupplyStatus; - -typedef struct -{ - uint8_t password[EMBER_AF_DEVICE_MANAGEMENT_MAXIMUM_PASSWORD_LENGTH + 1]; - uint32_t implementationDateTime; - uint16_t durationInMinutes; - EmberAfDeviceManagementPasswordType passwordType; -} EmberAfDeviceManagementPassword; - -typedef struct -{ - uint8_t startIndex; - uint8_t endIndex; -} EmberAfDeviceManagementAttributeRange; - -// attrRange is a list of attributeId values in a cluster. It's needed to track contigous -// segments of valid attributeId's with gaps in the middle. -// attributeSetId is the value of the upper byte in the attributeId. It ranges from 0x01(Price) -// to 0x08(OTA Event Configuration) -// Eg. {0x00,0x05} and {0x08,0x0A} -// We're betting that there isn't a list of cluster attributes that has more than 5 gaps. -typedef struct -{ - uint8_t attributeSetId; - EmberAfDeviceManagementAttributeRange attributeRange[7]; -} EmberAfDeviceManagementAttributeTable; - -typedef struct -{ - bool encryption; - - uint8_t * plainPayload; - uint16_t plainPayloadLength; - - uint8_t * encryptedPayload; - uint16_t encryptedPayloadLength; -} EmberAfGbzMessageData; - -typedef struct -{ - uint8_t * gbzCommands; - uint16_t gbzCommandsLength; - uint8_t * gbzCommandsResponse; - uint16_t gbzCommandsResponseLength; - uint16_t messageCode; -} EmberAfGpfMessage; - -/** - * @brief Zigbee Internet Client/Server Remote Cluster Types - */ -typedef uint16_t EmberAfRemoteClusterType; - -#define EMBER_AF_REMOTE_CLUSTER_TYPE_NONE 0x0000 -#define EMBER_AF_REMOTE_CLUSTER_TYPE_SERVER 0x0001 -#define EMBER_AF_REMOTE_CLUSTER_TYPE_CLIENT 0x0002 -#define EMBER_AF_REMOTE_CLUSTER_TYPE_INVALID 0xFFFF - -/** - * @brief Zigbee Internet Client/Server remote cluster struct. - */ -typedef struct -{ - chip::ClusterId clusterId; - uint16_t deviceId; - chip::EndpointId endpoint; - EmberAfRemoteClusterType type; -} EmberAfRemoteClusterStruct; - -/** - * @brief Zigbee Internet Client/Server Remote Binding struct - */ -typedef struct -{ - EmberEUI64 targetEUI64; - chip::EndpointId sourceEndpoint; - chip::EndpointId destEndpoint; - chip::ClusterId clusterId; - EmberEUI64 destEUI64; - EmberEUI64 sourceEUI64; -} EmberAfRemoteBindingStruct; - -typedef struct -{ - chip::ClusterId clusterId; - bool server; -} EmberAfClusterInfo; - -#if !defined(EMBER_AF_MAX_CLUSTERS_PER_ENDPOINT) -#define EMBER_AF_MAX_CLUSTERS_PER_ENDPOINT 3 -#endif - -/** - * @brief A struct containing basic information about an endpoint. - */ -typedef struct -{ - EmberAfClusterInfo clusters[EMBER_AF_MAX_CLUSTERS_PER_ENDPOINT]; - uint16_t deviceId; - chip::EndpointId endpoint; - uint8_t clusterCount; -} EmberAfEndpointInfoStruct; - -#if !defined(EMBER_AF_MAX_ENDPOINTS_PER_DEVICE) -#define EMBER_AF_MAX_ENDPOINTS_PER_DEVICE 1 -#endif - -// Although we treat this like a bitmap, only 1 bit is set at a time. -// We use the bitmap feature to allow us to find all devices -// with any in a set of status codes using -// emberAfPluginDeviceDatabaseFindDeviceByStatus(). -typedef enum -{ - EMBER_AF_DEVICE_DISCOVERY_STATUS_NONE = 0x00, - EMBER_AF_DEVICE_DISCOVERY_STATUS_NEW = 0x01, - EMBER_AF_DEVICE_DISCOVERY_STATUS_FIND_ENDPOINTS = 0x02, - EMBER_AF_DEVICE_DISCOVERY_STATUS_FIND_CLUSTERS = 0x04, - EMBER_AF_DEVICE_DISCOVERY_STATUS_FIND_STACK_REVISION = 0x08, - - EMBER_AF_DEVICE_DISCOVERY_STATUS_DONE = 0x40, - EMBER_AF_DEVICE_DISCOVERY_STATUS_FAILED = 0x80, -} EmberAfDeviceDiscoveryStatus; - -/** - * @brief A struct containing endpoint information about a device. - */ -typedef struct -{ - EmberEUI64 eui64; - EmberAfEndpointInfoStruct endpoints[EMBER_AF_MAX_ENDPOINTS_PER_DEVICE]; - EmberAfDeviceDiscoveryStatus status; - uint8_t discoveryFailures; - uint8_t capabilities; - uint8_t endpointCount; - uint8_t stackRevision; -} EmberAfDeviceInfo; - -typedef struct -{ - uint16_t deviceIndex; -} EmberAfDeviceDatabaseIterator; - -typedef struct -{ - EmberNodeId emberNodeId; - uint32_t timeStamp; -} EmberAfJoiningDevice; - -/** - * @brief Permit join times - */ -#define EMBER_AF_PERMIT_JOIN_FOREVER 0xFF -#define EMBER_AF_PERMIT_JOIN_MAX_TIMEOUT 0xFE - #define MAX_INT32U_VALUE (0xFFFFFFFFUL) #define MAX_INT16U_VALUE (0xFFFF) -#define MAX_INT8U_VALUE (0xFF) - -/** - * @brief Returns the elapsed time between two 32 bit values. - * Result may not be valid if the time samples differ by more than 2147483647 - */ -#define elapsedTimeInt32u(oldTime, newTime) ((uint32_t)((uint32_t)(newTime) - (uint32_t)(oldTime))) - -/** - * @brief The overhead of the ZDO response. - * 1 byte for the sequence and 1 byte for the status code. - */ -#define EMBER_AF_ZDO_RESPONSE_OVERHEAD 2 /** @} END addtogroup */