How to use the bellows.types.named function in bellows

To help you get started, we’ve selected a few bellows examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zigpy / bellows / bellows / types / struct.py View on Github external
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
        # method.
        ("channels", basic.uint32_t),
    ]
github zigpy / bellows / bellows / types / struct.py View on Github external
# be joined. It is usually NOT set prior to joining the network and
        # instead it is learned during the joining message exchange. This field
        # is only examined if HAVE_TRUST_CENTER_EUI64 is set in the
        # EmberInitialSecurityState::bitmask. Most devices should clear that
        # bit and leave this field alone. This field must be set when using
        # commissioning mode.
        ("preconfiguredTrustCenterEui64", named.EmberEUI64),
    ]


class EmberCurrentSecurityState(EzspStruct):
    # The security options and information currently used by the stack.
    _fields = [
        # A bitmask indicating the security options currently in use by a
        # device joined in the network.
        ("bitmask", named.EmberCurrentSecurityBitmask),
        # The IEEE Address of the Trust Center device.
        ("trustCenterLongAddress", named.EmberEUI64),
    ]


class EmberKeyStruct(EzspStruct):
    # A structure containing a key and its associated data.
    _fields = [
        # A bitmask indicating the presence of data within the various fields
        # in the structure.
        ("bitmask", named.EmberKeyStructBitmask),
        # The type of the key.
        ("type", named.EmberKeyType),
        # The actual key data.
        ("key", named.EmberKeyData),
        # The outgoing frame counter associated with the key.
github zigpy / bellows / bellows / types / struct.py View on Github external
("concentratorType", basic.uint8_t),
        # For a High RAM Concentrator, indicates whether a route record is
        # needed (2), has been sent (1), or is no long needed (0) because a
        # source routed message from the concentrator has been received.
        ("routeRecordState", basic.uint8_t),
    ]


class EmberInitialSecurityState(EzspStruct):
    # The security data used to set the configuration for the stack, or the
    # retrieved configuration currently in use.
    _fields = [
        # A bitmask indicating the security state used to indicate what the
        # security configuration will be when the device forms or joins the
        # network.
        ("bitmask", named.EmberInitialSecurityBitmask),
        # The pre-configured Key data that should be used when forming or
        # joining the network. The security bitmask must be set with the
        # HAVE_PRECONFIGURED_KEY bit to indicate that the key contains valid
        # data.
        ("preconfiguredKey", named.EmberKeyData),
        # The Network Key that should be used by the Trust Center when it forms
        # the network, or the Network Key currently in use by a joined device.
        # The security bitmask must be set with HAVE_NETWORK_KEY to indicate
        # that the key contains valid data.
        ("networkKey", named.EmberKeyData),
        # The sequence number associated with the network key. This is only
        # valid if the HAVE_NETWORK_KEY has been set in the security bitmask.
        ("networkKeySequenceNumber", basic.uint8_t),
        # This is the long address of the trust center on the network that will
        # be joined. It is usually NOT set prior to joining the network and
        # instead it is learned during the joining message exchange. This field
github zigpy / bellows / bellows / types / struct.py View on Github external
# 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
        # method.
        ("channels", basic.uint32_t),
    ]


class EmberZigbeeNetwork(EzspStruct):
    # The parameters of a ZigBee network.
    _fields = [
github zigpy / bellows / bellows / types / struct.py View on Github external
# A bitmask indicating the security options currently in use by a
        # device joined in the network.
        ("bitmask", named.EmberCurrentSecurityBitmask),
        # The IEEE Address of the Trust Center device.
        ("trustCenterLongAddress", named.EmberEUI64),
    ]


class EmberKeyStruct(EzspStruct):
    # A structure containing a key and its associated data.
    _fields = [
        # A bitmask indicating the presence of data within the various fields
        # in the structure.
        ("bitmask", named.EmberKeyStructBitmask),
        # The type of the key.
        ("type", named.EmberKeyType),
        # The actual key data.
        ("key", named.EmberKeyData),
        # The outgoing frame counter associated with the key.
        ("outgoingFrameCounter", basic.uint32_t),
        # The frame counter of the partner device associated with the key.
        ("incomingFrameCounter", basic.uint32_t),
        # The sequence number associated with the key.
        ("sequenceNumber", basic.uint8_t),
        # The IEEE address of the partner device also in possession of the key.
        ("partnerEUI64", named.EmberEUI64),
    ]


class EmberNetworkInitStruct(EzspStruct):
    # Network Initialization parameters.
    _fields = [
github zigpy / bellows / bellows / types / struct.py View on Github external
# The outgoing frame counter associated with the key.
        ("outgoingFrameCounter", basic.uint32_t),
        # The frame counter of the partner device associated with the key.
        ("incomingFrameCounter", basic.uint32_t),
        # The sequence number associated with the key.
        ("sequenceNumber", basic.uint8_t),
        # The IEEE address of the partner device also in possession of the key.
        ("partnerEUI64", named.EmberEUI64),
    ]


class EmberNetworkInitStruct(EzspStruct):
    # Network Initialization parameters.
    _fields = [
        # Configuration options for network init.
        ("bitmask", named.EmberNetworkInitBitmask)
    ]


class EmberZllSecurityAlgorithmData(EzspStruct):
    # Data associated with the ZLL security algorithm.
    _fields = [
        # Transaction identifier.
        ("transactionId", basic.uint32_t),
        # Response identifier.
        ("responseId", basic.uint32_t),
        # Bitmask.
        ("bitmask", basic.uint16_t),
    ]


class EmberZllNetwork(EzspStruct):
github zigpy / bellows / bellows / types / struct.py View on Github external
# method.
        ("channels", basic.uint32_t),
    ]


class EmberZigbeeNetwork(EzspStruct):
    # The parameters of a ZigBee network.
    _fields = [
        # The 802.15.4 channel associated with the network.
        ("channel", basic.uint8_t),
        # The network's PAN identifier.
        ("panId", basic.uint16_t),
        # The network's extended PAN identifier.
        ("extendedPanId", basic.fixed_list(8, basic.uint8_t)),
        # Whether the network is allowing MAC associations.
        ("allowingJoin", named.Bool),
        # The Stack Profile associated with the network.
        ("stackProfile", basic.uint8_t),
        # The instance of the Network.
        ("nwkUpdateId", basic.uint8_t),
    ]


class EmberApsFrame(EzspStruct):
    # ZigBee APS frame parameters.
    _fields = [
        # The application profile ID that describes the format of the message.
        ("profileId", basic.uint16_t),
        # The cluster ID for this message.
        ("clusterId", basic.uint16_t),
        # The source endpoint.
        ("sourceEndpoint", basic.uint8_t),
github zigpy / bellows / bellows / types / struct.py View on Github external
# The RF4CE vendor information block.
    _fields = [
        # The vendor identifier field shall contain the vendor identifier of
        # the node.
        ("vendorId", basic.uint16_t),
        # The vendor string field shall contain the vendor string of the node.
        ("vendorString", basic.fixed_list(7, basic.uint8_t)),
    ]


class EmberRf4ceApplicationInfo(EzspStruct):
    # The RF4CE application information block.
    _fields = [
        # The application capabilities field shall contain information relating
        # to the capabilities of the application of the node.
        ("capabilities", named.EmberRf4ceApplicationCapabilities),
        # The user string field shall contain the user specified identification
        # string.
        ("userString", basic.fixed_list(15, basic.uint8_t)),
        # The device type list field shall contain the list of device types
        # supported by the node.
        ("deviceTypeList", basic.fixed_list(3, basic.uint8_t)),
        # The profile ID list field shall contain the list of profile
        # identifiers disclosed as supported by the node.
        ("profileIdList", basic.fixed_list(7, basic.uint8_t)),
    ]


class EmberRf4cePairingTableEntry(EzspStruct):
    # The internal representation of an RF4CE pairing table entry.
    _fields = [
        # The link key to be used to secure this pairing link.
github zigpy / bellows / bellows / types / struct.py View on Github external
_fields = [
        # A bitmask indicating the presence of data within the various fields
        # in the structure.
        ("bitmask", named.EmberKeyStructBitmask),
        # The type of the key.
        ("type", named.EmberKeyType),
        # The actual key data.
        ("key", named.EmberKeyData),
        # The outgoing frame counter associated with the key.
        ("outgoingFrameCounter", basic.uint32_t),
        # The frame counter of the partner device associated with the key.
        ("incomingFrameCounter", basic.uint32_t),
        # The sequence number associated with the key.
        ("sequenceNumber", basic.uint8_t),
        # The IEEE address of the partner device also in possession of the key.
        ("partnerEUI64", named.EmberEUI64),
    ]


class EmberNetworkInitStruct(EzspStruct):
    # Network Initialization parameters.
    _fields = [
        # Configuration options for network init.
        ("bitmask", named.EmberNetworkInitBitmask)
    ]


class EmberZllSecurityAlgorithmData(EzspStruct):
    # Data associated with the ZLL security algorithm.
    _fields = [
        # Transaction identifier.
        ("transactionId", basic.uint32_t),
github vanviegen / hue-thief / hue-thief.py View on Github external
async def steal(device):
    s = await util.setup(device, baudrate=57600)
    eui64 = await getattr(s, 'getEui64')()
    eui64 = bellows.types.named.EmberEUI64(*eui64)

    v = await s.mfglibStart(True)
    util.check(v[0], "Unable to start mfglib")

    DLT_IEEE802_15_4 = 195
    pcap = pure_pcapy.Dumper("log.pcap", 128, DLT_IEEE802_15_4)
    prompt = Prompt()


    def dumpPcap(frame):
        ts = time.time()
        ts_sec = int(ts)
        ts_usec = int((ts - ts_sec) * 1000000)
        hdr = pure_pcapy.Pkthdr(ts_sec, ts_usec, len(frame), len(frame))
        pcap.dump(hdr, frame)