[][src]Struct rn2xx3::Driver

pub struct Driver<F: Frequency, S> { /* fields omitted */ }

The main driver instance.

Methods

impl<F, S, E> Driver<F, S> where
    S: Read<u8, Error = E> + Write<u8, Error = E>,
    F: Frequency
[src]

Basic commands.

pub fn send_raw_command(&mut self, command: &[&str]) -> Result<&[u8], Error>[src]

Send a raw command to the module and return the response.

pub fn send_raw_command_str(&mut self, command: &[&str]) -> Result<&str, Error>[src]

Send a raw command and decode the resulting bytes to a &str.

impl<F, S, E> Driver<F, S> where
    S: Read<u8, Error = E> + Write<u8, Error = E>,
    F: Frequency
[src]

System commands.

pub fn reset(&mut self) -> Result<&str, Error>[src]

Reset and restart the RN module. Return the version string.

pub fn factory_reset(&mut self) -> Result<&str, Error>[src]

Reset the module's configuration data and user EEPROM to factory default values and restart the module.

All configuration parameters will be restored to factory default values. Return the version string.

pub fn hweui(&mut self) -> Result<&str, Error>[src]

Return the preprogrammed EUI node address as uppercase hex string.

pub fn version(&mut self) -> Result<&str, Error>[src]

Return the version string.

pub fn model(&mut self) -> Result<Model, Error>[src]

Return the model of the module.

pub fn vdd(&mut self) -> Result<u16, Error>[src]

Measure and return the Vdd voltage in millivolts.

pub fn nvm_set(&mut self, addr: u16, byte: u8) -> Result<(), Error>[src]

Set the NVM byte at addr to the specified value.

The address must be between 0x300 and 0x3ff, otherwise Error::BadParameter is returned.

pub fn nvm_get(&mut self, addr: u16) -> Result<u8, Error>[src]

Get the NVM byte at addr.

The address must be between 0x300 and 0x3ff, otherwise Error::BadParameter is returned.

impl<F, S, E> Driver<F, S> where
    S: Read<u8, Error = E> + Write<u8, Error = E>,
    F: Frequency
[src]

MAC commands.

pub fn save_config(&mut self) -> Result<(), Error>[src]

Save MAC configuration parameters.

This command will save LoRaWAN Class A protocol configuration parameters to the user EEPROM. When the next sys reset command is issued, the LoRaWAN Class A protocol configuration will be initialized with the last saved parameters.

The LoRaWAN Class A protocol configuration savable parameters are: band, deveui, appeui, appkey, nwkskey, appskey, devaddr, ch freq, ch dcycle, ch drrange, ch status.

pub fn set_dev_addr_hex(&mut self, val: &str) -> Result<(), Error>[src]

Set the unique network device address.

The parameter must be a 4-byte hex string, otherwise Error::BadParameter will be returned.

pub fn set_dev_addr_slice(&mut self, val: &[u8]) -> Result<(), Error>[src]

Set the unique network device address.

The parameter must be a 4-byte big endian byte slice, otherwise Error::BadParameter will be returned.

pub fn get_dev_addr_hex(&mut self) -> Result<&str, Error>[src]

Get the unique network device address as hex str.

pub fn get_dev_addr_slice(&mut self) -> Result<[u8; 4], Error>[src]

Get the unique network device address bytes.

pub fn set_dev_eui_hex(&mut self, val: &str) -> Result<(), Error>[src]

Set the globally unique device identifier.

The parameter must be a 8-byte hex string, otherwise Error::BadParameter will be returned.

pub fn set_dev_eui_slice(&mut self, val: &[u8]) -> Result<(), Error>[src]

Set the globally unique device identifier.

The parameter must be a 8-byte big endian byte slice, otherwise Error::BadParameter will be returned.

pub fn get_dev_eui_hex(&mut self) -> Result<&str, Error>[src]

Get the globally unique device identifier as hex str.

pub fn get_dev_eui_slice(&mut self) -> Result<[u8; 8], Error>[src]

Get the globally unique device identifier bytes.

pub fn set_app_eui_hex(&mut self, val: &str) -> Result<(), Error>[src]

Set the globally unique application identifier.

The parameter must be a 8-byte hex string, otherwise Error::BadParameter will be returned.

pub fn set_app_eui_slice(&mut self, val: &[u8]) -> Result<(), Error>[src]

Set the globally unique application identifier.

The parameter must be a 8-byte big endian byte slice, otherwise Error::BadParameter will be returned.

pub fn get_app_eui_hex(&mut self) -> Result<&str, Error>[src]

Get the globally unique application identifier as hex str.

pub fn get_app_eui_slice(&mut self) -> Result<[u8; 8], Error>[src]

Get the globally unique application identifier bytes.

pub fn set_network_session_key_hex(&mut self, val: &str) -> Result<(), Error>[src]

Set the network session key.

The parameter must be a 16-byte hex string, otherwise Error::BadParameter will be returned.

pub fn set_network_session_key_slice(&mut self, val: &[u8]) -> Result<(), Error>[src]

Set the network session key.

The parameter must be a 16-byte big endian byte slice, otherwise Error::BadParameter will be returned.

pub fn get_network_session_key_hex(&mut self) -> Result<&str, Error>[src]

Get the network session key as hex str.

pub fn get_network_session_key_slice(&mut self) -> Result<[u8; 16], Error>[src]

Get the network session key bytes.

pub fn set_app_session_key_hex(&mut self, val: &str) -> Result<(), Error>[src]

Set the application session key.

The parameter must be a 16-byte hex string, otherwise Error::BadParameter will be returned.

pub fn set_app_session_key_slice(&mut self, val: &[u8]) -> Result<(), Error>[src]

Set the application session key.

The parameter must be a 16-byte big endian byte slice, otherwise Error::BadParameter will be returned.

pub fn get_app_session_key_hex(&mut self) -> Result<&str, Error>[src]

Get the application session key as hex str.

pub fn get_app_session_key_slice(&mut self) -> Result<[u8; 16], Error>[src]

Get the application session key bytes.

pub fn set_app_key_hex(&mut self, val: &str) -> Result<(), Error>[src]

Set the application key.

The parameter must be a 16-byte hex string, otherwise Error::BadParameter will be returned.

pub fn set_app_key_slice(&mut self, val: &[u8]) -> Result<(), Error>[src]

Set the application key.

The parameter must be a 16-byte big endian byte slice, otherwise Error::BadParameter will be returned.

pub fn get_app_key_hex(&mut self) -> Result<&str, Error>[src]

Get the application key as hex str.

pub fn get_app_key_slice(&mut self) -> Result<[u8; 16], Error>[src]

Get the application key bytes.

pub fn join(&mut self, mode: JoinMode) -> Result<(), JoinError>[src]

Join the network.

pub fn transmit_hex(
    &mut self,
    mode: ConfirmationMode,
    port: u8,
    data: &str
) -> Result<Option<Downlink>, TxError>
[src]

Send a hex uplink on the specified port.

If a downlink is received, it is returned.

pub fn transmit_slice(
    &mut self,
    mode: ConfirmationMode,
    port: u8,
    data: &[u8]
) -> Result<Option<Downlink>, TxError>
[src]

Send an uplink on the specified port.

If a downlink is received, it is returned.

Auto Trait Implementations

impl<F, S> RefUnwindSafe for Driver<F, S> where
    F: RefUnwindSafe,
    S: RefUnwindSafe

impl<F, S> Send for Driver<F, S> where
    F: Send,
    S: Send

impl<F, S> Sync for Driver<F, S> where
    F: Sync,
    S: Sync

impl<F, S> Unpin for Driver<F, S> where
    F: Unpin,
    S: Unpin

impl<F, S> UnwindSafe for Driver<F, S> where
    F: UnwindSafe,
    S: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.