Skip to main content

Adapter

Trait Adapter 

Source
pub trait Adapter:
    Send
    + Sync
    + 'static {
    // Required methods
    fn info(&self) -> AdapterInfo;
    fn start(
        &self,
        mode: StartMode,
    ) -> impl Future<Output = Result<(StartOutcome, NetworkInfo), HostError>> + Send;
    fn permit_join(
        &self,
        seconds: u8,
        policy: &JoinPolicy,
    ) -> impl Future<Output = Result<(), HostError>> + Send;
    fn add_join_key(
        &self,
        ieee: Ieee,
        key: Key,
    ) -> impl Future<Output = Result<(), HostError>> + Send;
    fn send_unicast(
        &self,
        nwk: NodeId,
        aps: Aps,
        payload: Vec<u8>,
    ) -> impl Future<Output = Result<u16, HostError>> + Send;
    fn send_broadcast(
        &self,
        destination: NodeId,
        aps: Aps,
        payload: Vec<u8>,
    ) -> impl Future<Output = Result<(), HostError>> + Send;
    fn network_info(
        &self,
    ) -> impl Future<Output = Result<NetworkInfo, HostError>> + Send;
    fn backup(&self) -> impl Future<Output = Result<Backup, HostError>> + Send;
    fn active_scan(
        &self,
        channel_mask: u32,
    ) -> impl Future<Output = Result<Vec<Beacon>, HostError>> + Send;
    fn leave(&self) -> impl Future<Output = Result<(), HostError>> + Send;
    fn energy_scan(
        &self,
        channel_mask: u32,
    ) -> impl Future<Output = Result<Vec<(u8, i8)>, HostError>> + Send;
}
Expand description

A network co-processor family. Every method’s future is Send so the host can call it from any task.

Required Methods§

Source

fn info(&self) -> AdapterInfo

The NCP’s identity.

Source

fn start( &self, mode: StartMode, ) -> impl Future<Output = Result<(StartOutcome, NetworkInfo), HostError>> + Send

Configure the NCP and bring the network up.

Source

fn permit_join( &self, seconds: u8, policy: &JoinPolicy, ) -> impl Future<Output = Result<(), HostError>> + Send

Open (seconds > 0) or close (0) the coordinator for joining.

Source

fn add_join_key( &self, ieee: Ieee, key: Key, ) -> impl Future<Output = Result<(), HostError>> + Send

Let the device ieee join with key (from its install code).

Source

fn send_unicast( &self, nwk: NodeId, aps: Aps, payload: Vec<u8>, ) -> impl Future<Output = Result<u16, HostError>> + Send

Send an APS unicast. Returns a tag that a later AdapterEvent::Delivery names.

Source

fn send_broadcast( &self, destination: NodeId, aps: Aps, payload: Vec<u8>, ) -> impl Future<Output = Result<(), HostError>> + Send

Send an APS broadcast to 0xFFFF, 0xFFFD or 0xFFFC.

Source

fn network_info( &self, ) -> impl Future<Output = Result<NetworkInfo, HostError>> + Send

Read the running network’s parameters again (after a channel change).

Source

fn backup(&self) -> impl Future<Output = Result<Backup, HostError>> + Send

Export everything a restore needs.

Source

fn active_scan( &self, channel_mask: u32, ) -> impl Future<Output = Result<Vec<Beacon>, HostError>> + Send

Listen for other networks’ beacons on the channels in the mask (an active scan). Works before a network is formed. An NCP family that cannot scan returns none.

Source

fn leave(&self) -> impl Future<Output = Result<(), HostError>> + Send

Leave the NCP’s network and erase it (keys, PAN ids, frame counter) from the NCP, whether or not it was started.

Source

fn energy_scan( &self, channel_mask: u32, ) -> impl Future<Output = Result<Vec<(u8, i8)>, HostError>> + Send

Measure each channel’s energy; returns (channel, max RSSI dBm).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§