Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Randomly generated 64-bit number.
# Both NCP and Host contribute this number to create the Session ID,
# which is used in the nonce.
pass
class SecureEzspSessionId(basic.uint64_t):
# Generated 64-bit Session ID, using random numbers from Host and NCP.
# It is generated at each reboot (during negotiation phase).
# Having both sides contribute to the value prevents one side from
# choosing a number that might have been previously
# used (either because of a bug or by malicious intent).
pass
class Bool(basic.uint8_t, enum.Enum):
# Boolean type with values true and false.
false = 0x00 # An alias for zero, used for clarity.
true = 0x01 # An alias for one, used for clarity.
class EzspConfigId(basic.uint8_t, enum.Enum):
# Identifies a configuration value.
# The number of packet buffers available to the stack. When set to the
# special value 0xFF, the NCP will allocate all remaining configuration RAM
# towards packet buffers, such that the resulting count will be the largest
# whole number of packet buffers that can fit into the available memory.
CONFIG_PACKET_BUFFER_COUNT = 0x01
# The maximum number of router neighbors the stack can keep track of. A
# neighbor is a node within radio range.
VALUE_RETRY_DEVICE_TYPE = 0x25
# The device RF4CE base channel
VALUE_RF4CE_BASE_CHANNEL2 = 0x26
# The RF4CE device types supported by the node
VALUE_RF4CE_SUPPORTED_DEVICE_TYPES_LIST2 = 0x27
# The RF4CE profiles supported by the node
VALUE_RF4CE_SUPPORTED_PROFILES_LIST2 = 0x28
# Enable or disable packet traffic arbitration.
VALUE_ENABLE_PTA = 0x31
# Set packet traffic arbitration configuration options.
VALUE_PTA_OPTIONS = 0x32
# Configure manufacturing library options(0-non-CSMA transmits,1-CSMA transmits).
VALUE_MFGLIB_OPTIONS = 0x33
class EzspExtendedValueId(basic.uint8_t, enum.Enum):
# Identifies a value based on specified characteristics. Each set of
# characteristics is unique to that value and is specified during the call
# to get the extended value.
# The flags field associated with the specified endpoint.
EXTENDED_VALUE_ENDPOINT_FLAGS = 0x00
# This is the reason for the node to leave the network as well as the
# device that told it to leave. The leave reason is the 1st byte of the
# value while the node ID is the 2nd and 3rd byte. If the leave was caused
# due to an API call rather than an over the air message, the node ID will
# be UNKNOWN_NODE_ID (0xFFFD).
EXTENDED_VALUE_LAST_LEAVE_REASON = 0x01
# This number of bytes of overhead required in the network frame for source
# routing to a particular destination.
EXTENDED_VALUE_GET_SOURCE_ROUTE_OVERHEAD = 0x02
import enum
import zigpy.types as ztypes
from . import basic
EmberEUI64 = ztypes.EUI64
class NcpResetCode(basic.uint8_t, enum.Enum):
# Reset and Error Codes for NCP
RESET_UNKNOWN_REASON = 0x00
RESET_EXTERNAL = 0x01
RESET_POWER_ON = 0x02
RESET_WATCHDOG = 0x03
RESET_ASSERT = 0x06
RESET_BOOTLOADER = 0x09
RESET_SOFTWARE = 0x0B
ERROR_EXCEEDED_MAXIMUM_ACK_TIMEOUT_COUNT = 0x51
ERROR_UNKNOWN_EM3XX_ERROR = 0x80
class EmberRf4ceTxOption(basic.uint8_t):
# RF4CE transmission options.
pass
OUTGOING_VIA_BINDING = 0x02
# Multicast message. This value is passed to emberMessageSentHandler()
# only. It may not be passed to emberSendUnicast().
OUTGOING_MULTICAST = 0x03
# Aliased multicast message. This value is passed to emberMessageSentHandler() only.
# It may not be passed to emberSendUnicast().
OUTGOING_MULTICAST_WITH_ALIAS = 0x04
# Aliased Broadcast message. This value is passed to emberMessageSentHandler() only.
# It may not be passed to emberSendUnicast().
OUTGOING_BROADCAST_WITH_ALIAS = 0x05
# Broadcast message. This value is passed to emberMessageSentHandler()
# only. It may not be passed to emberSendUnicast().
OUTGOING_BROADCAST = 0x06
class EmberMacPassthroughType(basic.uint8_t, enum.Enum):
# MAC passthrough message type flags.
# No MAC passthrough messages.
MAC_PASSTHROUGH_NONE = 0x00
# SE InterPAN messages.
MAC_PASSTHROUGH_SE_INTERPAN = 0x01
# Legacy EmberNet messages.
MAC_PASSTHROUGH_EMBERNET = 0x02
# Legacy EmberNet messages filtered by their source address.
MAC_PASSTHROUGH_EMBERNET_SOURCE = 0x04
MAC_PASSTHROUGH_APPLICATION = 0x08
MAC_PASSTHROUGH_CUSTOM = 0x10
MAC_PASSTHROUGH_INTERNAL_GP = 0x40
MAC_PASSTHROUGH_INTERNAL = 0x80
# it to use an Ember Mobile node rejoin, which is functionally equivalent.
USE_NWK_REJOIN = 0x1
# For those networks where the "permit joining" flag is never turned on,
# they will need to use a NWK Rejoin. If those devices have been
# preconfigured with the NWK key (including sequence number) they can use a
# secured rejoin. This is only necessary for end devices since they need a
# parent. Routers can simply use the ::USE_NWK_COMMISSIONING join method
# below.
USE_NWK_REJOIN_HAVE_NWK_KEY = 0x2
# For those networks where all network and security information is known
# ahead of time, a router device may be commissioned such that it does not
# need to send any messages to begin communicating on the network.
USE_NWK_COMMISSIONING = 0x3
class EmberZdoConfigurationFlags(basic.uint8_t, enum.Enum):
# Flags for controlling which incoming ZDO requests are passed to the
# application. To see if the application is required to send a ZDO response
# to an incoming message, the application must check the APS options
# bitfield within the incomingMessageHandler callback to see if the
# APS_OPTION_ZDO_RESPONSE_REQUIRED flag is set.
# Set this flag in order to receive supported ZDO request messages via the
# incomingMessageHandler callback. A supported ZDO request is one that is
# handled by the EmberZNet stack. The stack will continue to handle the
# request and send the appropriate ZDO response even if this configuration
# option is enabled.
APP_RECEIVES_SUPPORTED_ZDO_REQUESTS = 0x01
# Set this flag in order to receive unsupported ZDO request messages via
# the incomingMessageHandler callback. An unsupported ZDO request is one
# that is not handled by the EmberZNet stack, other than to send a 'not
# supported' ZDO response. If this configuration option is enabled, the
# The possible join states for a node.
# The node is not associated with a network in any way.
NO_NETWORK = 0x00
# The node is currently attempting to join a network.
JOINING_NETWORK = 0x01
# The node is joined to a network.
JOINED_NETWORK = 0x02
# The node is an end device joined to a network but its parent is not
# responding.
JOINED_NETWORK_NO_PARENT = 0x03
# The node is in the process of leaving its current network.
LEAVING_NETWORK = 0x04
class EmberIncomingMessageType(basic.uint8_t, enum.Enum):
# Incoming message types.
# Unicast.
INCOMING_UNICAST = 0x00
# Unicast reply.
INCOMING_UNICAST_REPLY = 0x01
# Multicast.
INCOMING_MULTICAST = 0x02
# Multicast sent by the local device.
INCOMING_MULTICAST_LOOPBACK = 0x03
# Broadcast.
INCOMING_BROADCAST = 0x04
# Broadcast sent by the local device.
INCOMING_BROADCAST_LOOPBACK = 0x05
# Many to one route request.
INCOMING_MANY_TO_ONE_ROUTE_REQUEST = 0x06
class NcpResetCode(basic.uint8_t, enum.Enum):
# Reset and Error Codes for NCP
RESET_UNKNOWN_REASON = 0x00
RESET_EXTERNAL = 0x01
RESET_POWER_ON = 0x02
RESET_WATCHDOG = 0x03
RESET_ASSERT = 0x06
RESET_BOOTLOADER = 0x09
RESET_SOFTWARE = 0x0B
ERROR_EXCEEDED_MAXIMUM_ACK_TIMEOUT_COUNT = 0x51
ERROR_UNKNOWN_EM3XX_ERROR = 0x80
class EmberRf4ceTxOption(basic.uint8_t):
# RF4CE transmission options.
pass
class EmberRf4ceNodeCapabilities(basic.uint8_t):
# The RF4CE node capabilities.
pass
class EmberRf4ceApplicationCapabilities(basic.uint8_t):
# The RF4CE application capabilities.
pass
class EmberNodeId(basic.HexRepr, basic.uint16_t):
# 16-bit ZigBee network address.
class EmberMulticastId(basic.HexRepr, basic.uint16_t):
# 16-bit ZigBee multicast group identifier.
_hex_len = 4
class EmberLibraryStatus(basic.uint8_t):
# The presence and status of the Ember library.
pass
class SecureEzspSecurityType(basic.uint32_t):
# Security type of the Secure EZSP Protocol.
pass
class SecureEzspSecurityLevel(basic.uint8_t):
# Security level of the Secure EZSP Protocol.
pass
class EmberGpSecurityLevel(basic.uint8_t):
# The security level of the GPD.
pass
class EmberGpKeyType(basic.uint8_t):
# The type of security key to use for the GPD.
pass
class SecureEzspRandomNumber(basic.uint64_t):
# Randomly generated 64-bit number.
r += " ".join(
["%s=%s" % (f[0], getattr(self, f[0], None)) for f in self._fields]
)
r += ">"
return r
class EmberNetworkParameters(EzspStruct):
# Network parameters.
_fields = [
# The network's extended PAN identifier.
("extendedPanId", basic.fixed_list(8, basic.uint8_t)),
# The network's PAN identifier.
("panId", basic.uint16_t),
# A power setting, in dBm.
("radioTxPower", basic.uint8_t),
# A radio channel.
("radioChannel", basic.uint8_t),
# The method used to initially join the network.
("joinMethod", named.EmberJoinMethod),
# NWK Manager ID. The ID of the network manager in the current network.
# This may only be set at joining when using USE_NWK_COMMISSIONING as
# the join method.
("nwkManagerId", named.EmberNodeId),
# NWK Update ID. The value of the ZigBee nwkUpdateId known by the
# stack. This is used to determine the newest instance of the network
# after a PAN ID or channel change. This may only be set at joining
# when using USE_NWK_COMMISSIONING as the join method.
("nwkUpdateId", basic.uint8_t),
# NWK channel mask. The list of preferred channels that the NWK manager
# has told this device to use when searching for the network. This may
# only be set at joining when using USE_NWK_COMMISSIONING as the join