pub fn new(
        interface_name: String,
        worker_name: String,
        id: String,
        timeout: u64,
        rng: Arc<Mutex<StdRng>>,
        r_type: RadioTypes,
        logger: Logger,
    ) -> Result<(WifiRadio, Box<dyn Listener>), MeshSimError> {
        let address = WifiRadio::get_radio_address(&interface_name)?;
        let interface_index = WifiRadio::get_interface_index(&interface_name)
            .expect("Could not get index for specified interface.");
        debug!(logger, "Obtained address {}", &address);
        let address = format!("[{}]:{}", address, DNS_SERVICE_PORT);
        let listener = WifiRadio::init(interface_index, timeout, r_type, &rng, &logger)?;
        let radio = WifiRadio {
            interface_name,
            interface_index,
            id,
            name: worker_name,
            address,
            rng,
            r_type,
            logger,
            last_transmission: Default::default(),
            timeout,
        };
        Ok((radio, listener))
    }
/// Function for creating a new DeviceRadio. It should ALWAYS be used for creating new DeviceRadios since it calculates
///  the address based on the DeviceRadio's properties.
Function for creating a new DeviceRadio. It should ALWAYS be used for creating new DeviceRadios since it calculates
the address based on the DeviceRadio's properties.
Function for creating a new DeviceRadio . It should ALWAYS be used for creating new DeviceRadios since it calculates the address based on the DeviceRadio ' s properties .
pub fn new(
        interface_name: String,
        worker_name: String,
        id: String,
        timeout: u64,
        rng: Arc<Mutex<StdRng>>,
        r_type: RadioTypes,
        logger: Logger,
    ) -> Result<(WifiRadio, Box<dyn Listener>), MeshSimError> {
        let address = WifiRadio::get_radio_address(&interface_name)?;
        let interface_index = WifiRadio::get_interface_index(&interface_name)
            .expect("Could not get index for specified interface.");
        debug!(logger, "Obtained address {}", &address);
        let address = format!("[{}]:{}", address, DNS_SERVICE_PORT);
        let listener = WifiRadio::init(interface_index, timeout, r_type, &rng, &logger)?;
        let radio = WifiRadio {
            interface_name,
            interface_index,
            id,
            name: worker_name,
            address,
            rng,
            r_type,
            logger,
            last_transmission: Default::default(),
            timeout,
        };
        Ok((radio, listener))
    }
pub fn new ( interface_name : String , worker_name : String , id : String , timeout : u64 , rng : Arc < Mutex < StdRng > > , r_type : RadioTypes , logger : Logger , ) -> Result < ( WifiRadio , Box < dyn Listener > ) , MeshSimError > { let address = WifiRadio :: get_radio_address ( & interface_name ) ? ; let interface_index = WifiRadio :: get_interface_index ( & interface_name ) . expect ( " " ) ; debug ! ( logger " " address ) ; let address = format ! ( " " address DNS_SERVICE_PORT ) ; let listener = WifiRadio :: init ( interface_index , timeout , r_type , & rng , & logger ) ? ; let radio = WifiRadio { interface_name , interface_index , id , name : worker_name , address , rng , r_type , logger , last_transmission : Default :: default ( ) , timeout , } ; Ok ( ( radio , listener ) ) }
Function for creating a new DeviceRadio.
Function for creating a new DeviceRadio .
interface_name
String
worker_name
String
id
String
timeout
u64
rng
Arc<Mutex<StdRng>>
r_type
RadioTypes
logger
Logger