zigbee-on-host
    Preparing search index...

    Hierarchy

    • EventEmitter<AdapterDriverEventMap>
      • OTRCPDriver
    Index

    Constructors

    Properties

    Accessors

    Methods

    allowJoins assignNetworkAddress associate checkZigbeeNWKGPDuplicate computeDeviceLQA computeLQA disallowJoins disassociate findBestSourceRoute formNetwork getCoordinatorZDOResponse getLQITableResponse getOrGenerateAPPLinkKey getPHYCCAThreshold getPHYRSSI getPHYRXSensitivity getPHYTXPower getProperty getRoutingTableResponse gpEnterCommissioningMode gpExitCommissioningMode hasSourceRoute isNetworkUp loadState mapRSSIToLQI onFrame onStreamRawFrame onZigbeeAPSFrame processMACAssocReq processMACAssocRsp processMACBeaconReq processMACCommand processMACDataReq processZigbeeAPSCommand processZigbeeAPSConfirmKey processZigbeeAPSRelayMessageDownstream processZigbeeAPSRelayMessageUpstream processZigbeeAPSRemoveDevice processZigbeeAPSRequestKey processZigbeeAPSSwitchKey processZigbeeAPSTransportKey processZigbeeAPSTunnel processZigbeeAPSUpdateDevice processZigbeeAPSVerifyKey processZigbeeNWKCommand processZigbeeNWKCommissioningRequest processZigbeeNWKCommissioningResponse processZigbeeNWKEdTimeoutRequest processZigbeeNWKEdTimeoutResponse processZigbeeNWKGPFrame processZigbeeNWKLeave processZigbeeNWKLinkPwrDelta processZigbeeNWKLinkStatus processZigbeeNWKRejoinReq processZigbeeNWKRejoinResp processZigbeeNWKReport processZigbeeNWKRouteRecord processZigbeeNWKRouteReply processZigbeeNWKRouteReq processZigbeeNWKStatus processZigbeeNWKUpdate readNetworkState registerTimers resetIntoBootloader resetNetwork resetStack savePeriodicState saveState sendBroadcast sendCommand sendFrame sendGroupcast sendMACAssocRsp sendMACCommand sendMACFrame sendMACFrameDirect sendPeriodicManyToOneRouteRequest sendPeriodicZigbeeNWKLinkStatus sendUnicast sendZDO sendZigbeeAPSACK sendZigbeeAPSCommand sendZigbeeAPSConfirmKey sendZigbeeAPSData sendZigbeeAPSRemoveDevice sendZigbeeAPSRequestKey sendZigbeeAPSSwitchKey sendZigbeeAPSTransportKeyAPP sendZigbeeAPSTransportKeyNWK sendZigbeeAPSTransportKeyTC sendZigbeeAPSTunnel sendZigbeeAPSUpdateDevice sendZigbeeAPSVerifyKey sendZigbeeNWKCommand sendZigbeeNWKCommissioningResponse sendZigbeeNWKEdTimeoutResponse sendZigbeeNWKLeave sendZigbeeNWKLinkStatus sendZigbeeNWKRejoinResp sendZigbeeNWKRouteReply sendZigbeeNWKRouteReq sendZigbeeNWKStatus setManufacturerCode setPHYCCAThreshold setPHYTXPower setProperty start startEnergyScan startSniffer stop stopEnergyScan stopSniffer waitForReset waitForTID

    Constructors

    Properties

    address16ToAddress64: Map<number, bigint>

    Lookup synced with deviceTable, maps network address to IEEE address

    configAttributes: ConfigurationAttributes

    Several attributes are set by loadState

    deviceTable: Map<bigint, DeviceTableEntry>

    Master table of all known devices on the network. mapping by network64

    indirectTransmissions: Map<
        bigint,
        { sendFrame: () => Promise<boolean>; timestamp: number }[],
    >

    Indirect transmission for devices with rxOnWhenIdle set to false. Mapping by network64

    lqiMax: number = 250

    The maximum observed LQI

    lqiMin: number = 15

    The minimum observed LQI

    macNoACKs: Map<number, number>

    Count of MAC NO_ACK reported by Spinel for each device (only present if any). Mapping by network16

    parser: OTRCPParser
    pendingAssociations: Map<
        bigint,
        { sendResp: () => Promise<void>; timestamp: number },
    >

    Associations pending DATA_RQ from device. Mapping by network64

    routeFailures: Map<number, number>

    Count of route failures reported by the network for each device (only present if any). Mapping by network16

    rssiMax: number = -25

    The maximum observed RSSI

    rssiMin: number = -100

    The minimum observed RSSI

    savePath: string
    sourceRouteTable: Map<number, SourceRouteTableEntry[]>

    mapping by network16

    streamRawConfig: StreamRawConfig
    writer: OTRCPWriter

    Accessors

    Methods

    • Parameters

      • duration: number

        The length of time in seconds during which the trust center will allow joins. The value 0x00 and 0xff indicate that permission is disabled or enabled, respectively, without a specified time limit. 0xff is clamped to 0xfe for security reasons

      • macAssociationPermit: boolean

        If true, also allow association on coordinator itself. Ignored if duration 0.

      Returns void

    • Parameters

      • source16: undefined | number
      • source64: undefined | bigint

        Assumed valid if assocType === 0x00

      • initialJoin: boolean

        If false, rejoin.

      • capabilities: undefined | MACCapabilities

        MAC capabilities

      • neighbor: boolean

        True if the device associating is a neighbor of the coordinator

      • OptionaldenyOverride: boolean

        Treat as MACAssociationStatus.PAN_ACCESS_DENIED

      • OptionalallowOverride: boolean

        Treat as MACAssociationStatus.SUCCESS

      Returns Promise<[status: number, newAddress16: number]>

    • Compute the median LQA for a device from recentLQAs or using signalStrength directly if device unknown. If given, stores the computed LQA from given parameters in the recentLQAs list of the device before computing median.

      Parameters

      • address16: undefined | number

        Used to retrieve address64 if not given (must be valid if 64 is not)

      • address64: undefined | bigint

        The address 64 of the device

      • OptionalsignalStrength: number

        RSSI. Optional (only use existing entries if not given)

      • OptionalsignalQuality: number

        LQI. Optional (only use existing entries if not given)

      • maxRecent: number = 10

        The number of recentLQAs to keep for the device (only used if signal params given). Default: 10

      Returns number

      The computed LQA

      • Always 0 if device not found AND no signalStrength given.
      • Always 0 if the device does not have any recent LQAs AND no signalStrength given
    • LQA_raw (c, r) = 255 * (c - c_min) / (c_max - c_min) * (r - r_min) / (r_max - r_min)

      • c_min is the lowest signal quality ever reported, i.e. for a packet that can barely be received
      • c_max is the highest signal quality ever reported, i.e. for a packet received under ideal conditions
      • r_min is the lowest signal strength ever reported, i.e. for a packet close to receiver sensitivity
      • r_max is the highest signal strength ever reported, i.e. for a packet received from a strong, close-by transmitter

      Parameters

      • signalStrength: number
      • OptionalsignalQuality: number

      Returns number

    • Parameters

      • source16: undefined | number
      • source64: undefined | bigint

      Returns Promise<void>

    • Finds the best source route to the destination. Entries with relays with too many NO_ACK will be purged. Bails early if destination16 is broadcast. Throws if both 16/64 are undefined or if destination is unknown (not in device table). Throws if no route and device is not neighbor.

      Parameters

      • destination16: undefined | number
      • destination64: undefined | bigint

      Returns [relayIndex: number, relayAddresses: number[], pathCost: number]

      • request invalid or neighbor without source route entries: [undefined, undefined, undefined]
      • request valid and source route available and >=1 relay: [last index in relayAddresses, list of relay addresses, cost of the path]
      • request valid and source route available and 0 relay: [undefined, undefined, cost of the path]
    • Set the Spinel properties required to start a 802.15.4 MAC network.

      Should be called after start.

      Returns Promise<void>

    • Parameters

      • clusterId: number
      • requestData: Buffer

      Returns undefined | Buffer<ArrayBufferLike>

    • ZDO response to LQI_TABLE_REQUEST for coordinator

      Parameters

      • startIndex: number

      Returns Buffer

      05-3474-23 #2.4.4.3.2

    • Parameters

      • _device16: number
      • _partner64: bigint

      Returns Buffer

    • The CCA (clear-channel assessment) threshold. NOTE: Currently not implemented in: ot-ti

      Returns Promise<number>

      dBm (int8)

    • The current RSSI (Received signal strength indication) from the radio. This value can be used in energy scans and for determining the ambient noise floor for the operating environment.

      Returns Promise<number>

      dBm (int8)

    • The radio receive sensitivity. This value can be used as lower bound noise floor for link metrics computation.

      Returns Promise<number>

      dBm (int8)

    • ZDO response to ROUTING_TABLE_REQUEST for coordinator NOTE: Only outputs the best source route for each entry in the table (clipped to max 255 entries).

      Parameters

      • startIndex: number

      Returns Buffer

      05-3474-23 #2.4.4.3.3

    • Put the coordinator in Green Power commissioning mode.

      Parameters

      • commissioningWindow: number = 180

        Defaults to 180 if unspecified. Max 254. 0 means exit.

      Returns void

    • Check if a source route entry for the given address is already present. If existingEntries not given and address16 doesn't have any entries, always returns false.

      Parameters

      • address16: number

        The network address to check for

      • newEntry: SourceRouteTableEntry

        The entry to check

      • OptionalexistingEntries: SourceRouteTableEntry[]

        If given, skip the retrieval from sourceRouteTable and use these entries to check against instead

      Returns boolean

    • Load state from file system if exists, else save "initial" state. Afterwards, various keys are pre-hashed and descriptors pre-encoded.

      Returns Promise<void>

    • Apply logistic curve on standard mapping to LQI range [0..255]

      • Silabs EFR32: the RSSI range of [-100..-36] is mapped to an LQI range [0..255]
      • TI zstack: LQI = (MAC_SPEC_ED_MAX * (RSSIdbm - ED_RF_POWER_MIN_DBM)) / (ED_RF_POWER_MAX_DBM - ED_RF_POWER_MIN_DBM); where MAC_SPEC_ED_MAX = 255, ED_RF_POWER_MIN_DBM = -87, ED_RF_POWER_MAX_DBM = -10
      • Nordic: RSSI accuracy valid range -90 to -20 dBm

      Parameters

      • rssi: number

      Returns number

    • Process 802.15.4 MAC association request.

      Parameters

      • data: Buffer
      • offset: number
      • macHeader: MACHeader

      Returns Promise<number>

    • Process 802.15.4 MAC beacon request.

      Parameters

      • _data: Buffer
      • offset: number
      • _macHeader: MACHeader

      Returns Promise<number>

    • Process 802.15.4 MAC data request. Used by indirect transmission devices to retrieve information from parent.

      Parameters

      • _data: Buffer
      • offset: number
      • macHeader: MACHeader

      Returns Promise<number>

    • Performs a software reset into bootloader. If up, will stop network before.

      Returns Promise<void>

    • Remove the current state file and clear all related tables.

      Will throw if state already loaded (should be called before start).

      Returns Promise<void>

    • Performs a STACK reset after resetting a few PHY/MAC properties to default. If up, will stop network before.

      Returns Promise<void>

    • Format is:

      • network data: ${SaveConsts.NETWORK_STATE_SIZE} bytes
      • device count: 2 bytes
      • device data: ${SaveConsts.DEVICE_STATE_SIZE} bytes * ${device count}

      Returns Promise<void>

    • Wraps ZigBee APS DATA sending for broadcast. Throws if could not send.

      Parameters

      • payload: Buffer
      • profileId: number
      • clusterId: number
      • dest16: number

        The broadcast address to send to [0xfff8..0xffff]

      • destEp: number
      • sourceEp: number

      Returns Promise<number>

      The APS counter of the sent frame.

    • Wraps ZigBee APS DATA sending for groupcast. Throws if could not send.

      Parameters

      • payload: Buffer
      • profileId: number
      • clusterId: number
      • group: number

        The group to send to

      • sourceEp: number

      Returns Promise<number>

      The APS counter of the sent frame.

    • Send 802.15.4 MAC association response

      Parameters

      • dest64: bigint
      • newAddress16: number
      • status: number

      Returns Promise<boolean>

    • Send 802.15.4 MAC command

      Parameters

      • cmdId: MACCommandId
      • dest16: undefined | number
      • dest64: undefined | bigint
      • extSource: boolean
      • payload: Buffer

      Returns Promise<boolean>

      True if success sending

    • Send 802.15.4 MAC frame.

      Parameters

      • seqNum: number
      • payload: Buffer
      • dest16: undefined | number
      • dest64: undefined | bigint

      Returns Promise<undefined | boolean>

      True if success sending. Undefined if set for indirect transmission.

    • Send 802.15.4 MAC frame without checking for need to use indirect transmission.

      Parameters

      • seqNum: number
      • payload: Buffer
      • dest16: undefined | number
      • dest64: undefined | bigint

      Returns Promise<boolean>

      True if success sending

    • Wraps ZigBee APS DATA sending for unicast. Throws if could not send.

      Parameters

      • payload: Buffer
      • profileId: number
      • clusterId: number
      • dest16: number
      • dest64: undefined | bigint
      • destEp: number
      • sourceEp: number

      Returns Promise<number>

      The APS counter of the sent frame.

    • Wraps ZigBee APS DATA sending for ZDO. Throws if could not send.

      Parameters

      • payload: Buffer
      • nwkDest16: number
      • nwkDest64: undefined | bigint
      • clusterId: number

      Returns Promise<[number, number]>

      • The APS counter of the sent frame.
      • The ZDO counter of the sent frame.
    • 05-3474-R #4.4.11.8

      Parameters

      • nwkDest16: number
      • status: number

        1-byte status code indicating the result of the operation. See Table 2.27

      • keyType: number

        the type of key being verified

      • destination64: bigint

        SHALL be the 64-bit extended address of the source device of the Verify-Key message

      Returns Promise<boolean>

    • Send a ZigBee APS DATA frame. Throws if could not send.

      Parameters

      • finalPayload: Buffer
      • nwkDiscoverRoute: ZigbeeNWKRouteDiscovery
      • nwkDest16: undefined | number
      • nwkDest64: undefined | bigint
      • apsDeliveryMode: ZigbeeAPSDeliveryMode
      • clusterId: number
      • profileId: number
      • destEndpoint: undefined | number
      • sourceEndpoint: undefined | number
      • group: undefined | number

      Returns Promise<number>

      The APS counter of the sent frame.

    • 05-3474-R #4.4.11.3

      Parameters

      • nwkDest16: number

        parent

      • target64: bigint

      Returns Promise<boolean>

    • 05-3474-R #4.4.11.4

      Parameters

      • nwkDest16: number
      • keyType: 2

        SHALL be set to the key being requested

        • 0x02: App link key
        • 0x04: TC link key
      • partner64: bigint

        When the RequestKeyType field is 2 (that is, an application key), the partner address field SHALL contain the extended 64-bit address of the partner device that SHALL be sent the key. Both the partner device and the device originating the request-key command will be sent the key.

      Returns Promise<boolean>

    • 05-3474-R #4.4.11.4

      Parameters

      • nwkDest16: number
      • keyType: 4

        SHALL be set to the key being requested

        • 0x02: App link key
        • 0x04: TC link key

      Returns Promise<boolean>

    • 05-3474-R #4.4.11.5

      Parameters

      • nwkDest16: number
      • seqNum: number

        SHALL contain the sequence number identifying the network key to be made active.

      Returns Promise<boolean>

    • 05-3474-R #4.4.11.1 #4.4.11.1.3.3

      Parameters

      • nwkDest16: number
      • key: Buffer

        SHALL contain a link key that is shared with the device identified in the partner address sub-field

      • partner: bigint

        SHALL contain the address of the other device that was sent this link key

      • initiatorFlag: boolean

        SHALL be set to 1 if the device receiving this packet requested this key. Otherwise, this sub-field SHALL be set to 0.

      Returns Promise<boolean>

    • 05-3474-R #4.4.11.1 #4.4.11.1.3.2

      Parameters

      • nwkDest16: number
      • key: Buffer

        SHALL contain a network key

      • seqNum: number

        SHALL contain the sequence number associated with this network key

      • destination64: bigint

        SHALL contain the address of the device which SHOULD use this network key If the network key is sent to a broadcast address, the destination address subfield SHALL be set to the all-zero string and SHALL be ignored upon reception.

      Returns Promise<boolean>

    • 05-3474-R #4.4.11.1

      Parameters

      • nwkDest16: number
      • key: Buffer

        SHALL contain the link key that SHOULD be used for APS encryption

      • destination64: bigint

        SHALL contain the address of the device which SHOULD use this link key

      Returns Promise<boolean>

    • 05-3474-R #4.4.11.6

      Parameters

      • nwkDest16: number
      • destination64: bigint

        SHALL be the 64-bit extended address of the device that is to receive the tunneled command

      • tApsCmdFrame: Buffer

        SHALL be the APS command payload to be sent to the destination

      Returns Promise<boolean>

    • 05-3474-R #4.4.11.2

      Parameters

      • nwkDest16: number

        device that SHALL be sent the update information

      • device64: bigint

        device whose status is being updated

      • device16: number

        device whose status is being updated

      • status: number

        Indicates the updated status of the device given by the device64 parameter:

        • 0x00 = Standard Device Secured Rejoin
        • 0x01 = Standard Device Unsecured Join
        • 0x02 = Device Left
        • 0x03 = Standard Device Trust Center Rejoin
        • 0x04 – 0x07 = Reserved

      Returns Promise<boolean>

    • 05-3474-R #4.4.11.7

      Parameters

      • nwkDest16: number
      • keyType: number

        type of key being verified

      • source64: bigint

        SHALL be the 64-bit extended address of the partner device that the destination shares the link key with

      • hash: Buffer

        outcome of executing the specialized keyed hash function specified in section B.1.4 using a key with the 1-octet string ‘0x03’ as the input string The resulting value SHALL NOT be used as a key for encryption or decryption

      Returns Promise<boolean>

    • Parameters

      • cmdId: ZigbeeNWKCommandId
      • finalPayload: Buffer

        expected to contain the full payload (including cmdId)

      • nwkSecurity: boolean
      • nwkSource16: number
      • nwkDest16: number
      • nwkDest64: undefined | bigint
      • nwkRadius: number

      Returns Promise<boolean>

      True if success sending (or indirect transmission)

    • 05-3474-23 #3.4.15 Optional

      Parameters

      • requestSource16: number
      • newAddress16: number

        the new 16-bit network address assigned, may be same as requestDest16

      • status: number

      Returns Promise<boolean>

    • 05-3474-R #3.4.12

      Parameters

      • requestDest16: number
      • requestedTimeout: number

        Requested timeout enumeration [0-14] (mapping to actual timeout)

      Returns Promise<boolean>

      processZigbeeNWKEdTimeoutRequest

    • 05-3474-R #3.4.3

      NOTE: request option always true NOTE: removeChildren option should not be used (mesh disruption)

      Parameters

      • destination16: number
      • rejoin: boolean

        if true, the device that is leaving from its current parent will rejoin the network

      Returns Promise<boolean>

    • 05-3474-R #3.4.8

      Parameters

      • links: ZigbeeNWKLinkStatus[]

        set of link status entries derived from the neighbor table (SHALL be specific to the interface to be transmitted on) Links are expected sorted in ascending order by network address.

        • incoming cost contains device's estimate of the link cost for the neighbor
        • outgoing cost contains value of outgoing cost from neighbor table

      Returns Promise<void>

    • 05-3474-R #3.4.7 Optional

      Parameters

      • requestSource16: number

        new network address assigned to the rejoining device

      • newAddress16: number
      • status: number
      • capabilities: MACCapabilities

      Returns Promise<boolean>

    • 05-3474-R #3.4.2, #3.6.4.5.2

      Parameters

      • requestDest1stHop16: number

        SHALL be set to the network address of the first hop in the path back to the originator of the corresponding route request command frame

      • requestRadius: number
      • requestId: number

        8-bit sequence number of the route request to which this frame is a reply

      • originator16: number

        SHALL contain the 16-bit network address of the originator of the route request command frame to which this frame is a reply

      • responder16: number

        SHALL always be the same as the value in the destination address field of the corresponding route request command frame

      • Optionaloriginator64: bigint

        SHALL be 8 octets in length and SHALL contain the 64-bit address of the originator of the route request command frame to which this frame is a reply. This field SHALL only be present if the originator IEEE address sub-field of the command options field has a value of 1.

      • Optionalresponder64: bigint

        SHALL be 8 octets in length and SHALL contain the 64-bit address of the destination of the route request command frame to which this frame is a reply. This field SHALL only be present if the responder IEEE address sub-field of the command options field has a value of 1.

      Returns Promise<boolean>

    • 05-3474-R #3.4.1

      Parameters

      • manyToOne: ZigbeeNWKManyToOne
      • destination16: number

        intended destination of the route request command frame

      • Optionaldestination64: bigint

        SHOULD always be added if it is known

      Returns Promise<boolean>

    • 05-3474-R #3.4.3

      Parameters

      • requestSource16: number
      • status: ZigbeeNWKStatus
      • Optionaldestination: number

        Destination address (only if status is LINK_FAILURE or ADDRESS_CONFLICT)

        • in case of a routing failure, it SHALL contain the destination address from the data frame that encountered the failure
        • in case of an address conflict, it SHALL contain the offending network address.

      Returns Promise<boolean>

    • Set the manufacturer code in the pre-encoded node descriptor

      Parameters

      • code: number

      Returns void

    • The CCA (clear-channel assessment) threshold. Set to -128 to disable. The value will be rounded down to a value that is supported by the underlying radio hardware. NOTE: Currently not implemented in: ot-ti

      Parameters

      • ccaThreshold: number

        dBm (>= -128 and <= 127)

      Returns Promise<void>

    • The transmit power of the radio. The value will be rounded down to a value that is supported by the underlying radio hardware.

      Parameters

      • txPower: number

        dBm (>= -128 and <= 127)

      Returns Promise<void>

    • Parameters

      • payload: Buffer
      • timeout: number = 10000

      Returns Promise<void>

    • Start sniffing. Cannot be used after state is loaded or network is up. WARNING: This is expected to run in the "run-and-quit" pattern as it overrides the onStreamRawFrame function.

      Parameters

      • channel: number

        The channel to sniff on

      Returns Promise<void>