pub fn start<
        ReadConnection: Clone + Send + 'static,
        WriteConnection: Clone + Send + 'static,
        Packet: LinkPacket + Send + 'static,
    >(
        control: CommsControlBlock<ReadConnection, WriteConnection>,
        telem: &Arc<Mutex<CommsTelemetry>>,
    ) -> CommsResult<()> {
        // If desired, spawn a read thread
        if control.read.is_some() {
            let telem_ref = telem.clone();
            let control_ref = control.clone();
            thread::Builder::new()
                .stack_size(16 * 1024)
                .spawn(move || {
                    read_thread::<ReadConnection, WriteConnection, Packet>(control_ref, &telem_ref)
                })
                .unwrap();
        }

        // For each provided `write()` function, spawn a downlink endpoint thread.
        if let Some(ports) = control.downlink_ports {
            for (_, (port, write)) in ports.iter().zip(control.write.iter()).enumerate() {
                let telem_ref = telem.clone();
                let port_ref = port.clone();
                let conn_ref = control.write_conn.clone();
                let write_ref = write.clone();
                let ip = control.ip;
                thread::Builder::new()
                    .stack_size(16 * 1024)
                    .spawn(move || {
                        downlink_endpoint::<ReadConnection, WriteConnection, Packet>(
                            &telem_ref, port_ref, conn_ref, &write_ref, ip,
                        );
                    })
                    .unwrap();
            }
        }

        info!("Communication service started");
        Ok(())
    }
/// Starts an instance of the Communication Service and its associated background threads.
Starts an instance of the Communication Service and its associated background threads.
Starts an instance of the Communication Service and its associated background threads .
pub fn start<
        ReadConnection: Clone + Send + 'static,
        WriteConnection: Clone + Send + 'static,
        Packet: LinkPacket + Send + 'static,
    >(
        control: CommsControlBlock<ReadConnection, WriteConnection>,
        telem: &Arc<Mutex<CommsTelemetry>>,
    ) -> CommsResult<()> {
        // If desired, spawn a read thread
        if control.read.is_some() {
            let telem_ref = telem.clone();
            let control_ref = control.clone();
            thread::Builder::new()
                .stack_size(16 * 1024)
                .spawn(move || {
                    read_thread::<ReadConnection, WriteConnection, Packet>(control_ref, &telem_ref)
                })
                .unwrap();
        }
        // For each provided `write()` function, spawn a downlink endpoint thread.
        if let Some(ports) = control.downlink_ports {
            for (_, (port, write)) in ports.iter().zip(control.write.iter()).enumerate() {
                let telem_ref = telem.clone();
                let port_ref = port.clone();
                let conn_ref = control.write_conn.clone();
                let write_ref = write.clone();
                let ip = control.ip;
                thread::Builder::new()
                    .stack_size(16 * 1024)
                    .spawn(move || {
                        downlink_endpoint::<ReadConnection, WriteConnection, Packet>(
                            &telem_ref, port_ref, conn_ref, &write_ref, ip,
                        );
                    })
                    .unwrap();
            }
        }
        info!("Communication service started");
        Ok(())
    }
pub fn start < ReadConnection : Clone + Send + ' static , WriteConnection : Clone + Send + ' static , Packet : LinkPacket + Send + ' static , > ( control : CommsControlBlock < ReadConnection , WriteConnection > , telem : & Arc < Mutex < CommsTelemetry > > , ) -> CommsResult < ( ) > { // If desired, spawn a read thread if control . read . is_some ( ) { let telem_ref = telem . clone ( ) ; let control_ref = control . clone ( ) ; thread :: Builder :: new ( ) . stack_size ( 16 * 1024 ) . spawn ( move | | { read_thread :: < ReadConnection , WriteConnection , Packet > ( control_ref , & telem_ref ) } ) . unwrap ( ) ; } // For each provided `write()` function, spawn a downlink endpoint thread. if let Some ( ports ) = control . downlink_ports { for ( _ , ( port , write ) ) in ports . iter ( ) . zip ( control . write . iter ( ) ) . enumerate ( ) { let telem_ref = telem . clone ( ) ; let port_ref = port . clone ( ) ; let conn_ref = control . write_conn . clone ( ) ; let write_ref = write . clone ( ) ; let ip = control . ip ; thread :: Builder :: new ( ) . stack_size ( 16 * 1024 ) . spawn ( move | | { downlink_endpoint :: < ReadConnection , WriteConnection , Packet > ( & telem_ref , port_ref , conn_ref , & write_ref , ip , ) ; } ) . unwrap ( ) ; } } info ! ( " " ) ; Ok ( ( ) ) }
Starts an instance of the Communication Service and its associated background threads.
Starts an instance of the Communication Service and its associated background threads .
control
CommsControlBlock<ReadConnection, WriteConnection>
telem
&Arc<Mutex<CommsTelemetry>>
control
CommsControlBlock<ReadConnection, WriteConnection>
telem
&Arc<Mutex<CommsTelemetry>>