Skip to main content

Callback

Enum Callback 

Source
pub enum Callback {
Show 17 variants StackStatus { status: Status, }, MessageSent { status: Status, kind: u8, destination: NodeId, aps: ApsFrame, tag: u16, }, IncomingMessage { kind: u8, aps: ApsFrame, info: RxPacketInfo, payload: Vec<u8>, }, TrustCenterJoin { node_id: NodeId, ieee: Ieee, status: u8, decision: u8, parent: NodeId, }, ChildJoin { index: u8, joining: bool, node_id: NodeId, ieee: Ieee, node_type: u8, }, IncomingRouteRecord { source: NodeId, ieee: Ieee, last_hop_lqi: u8, last_hop_rssi: i8, relays: Vec<NodeId>, }, ZigbeeKeyEstablishment { partner: Ieee, status: u8, }, EnergyScanResult { channel: u8, max_rssi: i8, }, NetworkFound { channel: u8, pan_id: u16, extended_pan_id: ExtPanId, allowing_join: bool, stack_profile: u8, nwk_update_id: u8, lqi: u8, rssi: i8, }, ScanComplete { channel: u8, status: Status, }, IdConflict { node_id: NodeId, }, IncomingRouteError { status: Status, target: NodeId, }, IncomingNetworkStatus { code: u8, target: NodeId, }, IncomingManyToOneRouteRequest { source: NodeId, ieee: Ieee, cost: u8, }, StackTokenChanged { token: u16, }, NoCallbacks, Other { frame_id: u16, params: Vec<u8>, },
}
Expand description

A callback from the NCP.

Variants§

§

StackStatus

The network came up, went down, opened or closed for joining.

Fields

§status: Status

The new state.

§

MessageSent

The outcome of a sendUnicast or sendBroadcast.

Fields

§status: Status

Delivery status.

§destination: NodeId

Destination address or table index.

§aps: ApsFrame

The APS frame sent.

§tag: u16

The tag given when sending.

§

IncomingMessage

A message for the host.

Fields

§aps: ApsFrame

The APS frame.

§info: RxPacketInfo

Sender and link quality.

§payload: Vec<u8>

The APS payload (ZDO or ZCL frame).

§

TrustCenterJoin

A device joined, rejoined or left (trust center view).

Fields

§node_id: NodeId

Its network address.

§ieee: Ieee

Its IEEE address.

§decision: u8

crate::ids::join_decision the trust center took.

§parent: NodeId

Its parent’s network address.

§

ChildJoin

A child of the coordinator joined or left.

Fields

§index: u8

Child table index.

§joining: bool

Joined (true) or left.

§node_id: NodeId

Its network address.

§ieee: Ieee

Its IEEE address.

§

IncomingRouteRecord

A route record: the path a device’s message took to the coordinator.

Fields

§source: NodeId

The originator.

§ieee: Ieee

The originator’s IEEE address.

§last_hop_lqi: u8

Link quality of the last hop.

§last_hop_rssi: i8

Signal strength of the last hop, dBm.

§relays: Vec<NodeId>

Relays, from the one nearest the source to the one nearest the coordinator.

§

ZigbeeKeyEstablishment

Key establishment with a partner progressed or failed.

Fields

§partner: Ieee

The partner.

§

EnergyScanResult

One channel’s result of an energy scan.

Fields

§channel: u8

Channel.

§max_rssi: i8

Strongest signal heard, dBm.

§

NetworkFound

An active scan heard a network’s beacon.

Fields

§channel: u8

Channel.

§pan_id: u16

PAN id.

§extended_pan_id: ExtPanId

Extended PAN id.

§allowing_join: bool

Its routers accept joins.

§stack_profile: u8

Stack profile (2: Zigbee PRO).

§nwk_update_id: u8

Network update id.

§lqi: u8

Link quality of the beacon.

§rssi: i8

Signal strength of the beacon, dBm.

§

ScanComplete

A scan finished (or failed on channel).

Fields

§channel: u8

Channel that failed, or the last channel.

§status: Status

Outcome.

§

IdConflict

Two devices share a network address.

Fields

§node_id: NodeId

The address.

§

IncomingRouteError

A route error arrived.

Fields

§status: Status

The error.

§target: NodeId

The unreachable target.

§

IncomingNetworkStatus

A network status command arrived.

Fields

§code: u8

The network status code.

§target: NodeId

Its target.

§

IncomingManyToOneRouteRequest

A concentrator’s many-to-one route request was heard.

Fields

§source: NodeId

The concentrator.

§ieee: Ieee

Its IEEE address.

§cost: u8

Path cost.

§

StackTokenChanged

A stack token changed.

Fields

§token: u16

The token’s address.

§

NoCallbacks

The NCP had no callbacks waiting.

§

Other

A callback this crate does not decode, passed through.

Fields

§frame_id: u16

Frame id.

§params: Vec<u8>

Raw parameters.

Implementations§

Source§

impl Callback

Source

pub fn frame_id(&self) -> u16

The frame id.

Source

pub fn decode( v: ProtocolVersion, frame_id: u16, params: &[u8], ) -> Result<Callback, DecodeError>

Decode a callback. Unknown frame ids become Callback::Other; malformed known ones are errors.

Source

pub fn encode(&self, v: ProtocolVersion) -> Vec<u8> ⓘ

Encode the parameters (the NCP side).

Trait Implementations§

Source§

impl Clone for Callback

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Callback

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Callback

Source§

impl PartialEq for Callback

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Callback

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more