Struct ether_dream_dac_emulator::broadcaster::Broadcaster
[−]
[src]
pub struct Broadcaster { /* fields omitted */ }
The broadcasting side of the DAC.
Once run
is called, the broadcaster will block and loop at a rate of once-per-second,
broadcasting the current state of the DAC on each iteration.
Methods
impl Broadcaster
[src]
pub fn new(
dac: Addressed,
bind_port: u16,
broadcast_ip: Ipv4Addr
) -> Result<Broadcaster>
[src]
dac: Addressed,
bind_port: u16,
broadcast_ip: Ipv4Addr
) -> Result<Broadcaster>
Create a new Broadcaster initialised with the given DAC state.
Produces an io::Error if creating the UDP socket fails or if enabling broadcast fails.
pub fn create_broadcast(&self) -> DacBroadcast
[src]
Creates a DacBroadcast from the current known DAC state.
This is used within the send method.
pub fn send(&mut self) -> Result<()>
[src]
Sends a single broadcast message over the inner UDP socket.
pub fn run(&mut self, rx: Rx) -> Result<()>
[src]
Run the Broadcaster.
The broadcaster will block on the given receiver, waiting to process Messages.
On each Message::Second received, the Broadcaster will send a message over UDP.
On each Message::Dac, the Broadcaster will update the current DAC state.
pub fn spawn(self) -> Result<Handle>
[src]
Consumes the Broadcaster and calls the run method on a separate thread.