Struct nannou_laser::Api
source · pub struct Api { /* private fields */ }
Expand description
A general API that allows for detecting and enumerating laser DACs on a network and establishing new streams of communication with them.
Implementations§
source§impl Api
impl Api
sourcepub fn detect_dacs(&self) -> Result<DetectDacs>
pub fn detect_dacs(&self) -> Result<DetectDacs>
An iterator yielding laser DACs available on the system as they are discovered.
Currently, the only laser protocol supported is the ether dream protocol. Thus, this enumerates ether dream DACs that are discovered on the LAN.
Note that the produced iterator will iterate forever and never terminate unless
set_timeout
is called on the returned DetectDacs
instance.
sourcepub fn detect_dac(&self, id: DacId) -> Result<DetectedDac>
pub fn detect_dac(&self, id: DacId) -> Result<DetectedDac>
Block and wait until the DAC with the given Id
is detected.
sourcepub fn detect_dacs_async<F>(
&self,
timeout: Option<Duration>,
callback: F
) -> Result<DetectDacsAsync>where
F: 'static + DetectedDacCallback + Send,
pub fn detect_dacs_async<F>(
&self,
timeout: Option<Duration>,
callback: F
) -> Result<DetectDacsAsync>where
F: 'static + DetectedDacCallback + Send,
Spawn a thread for DAC detection.
Calls the given callback
with broadcasts as they are received.
The thread is closed when the returned DetectDacsAsync
instance is dropped.
sourcepub fn new_frame_stream<M, F>(&self, model: M, render: F) -> Builder<M, F>where
F: RenderFn<M>,
pub fn new_frame_stream<M, F>(&self, model: M, render: F) -> Builder<M, F>where
F: RenderFn<M>,
Begin building a new laser frame stream.
The stream will call the render
function each time new points are needed to feed the
laser DAC buffer. The rate at which this will be called depends on the point_hz
,
frame_hz
and the latency_points
.
sourcepub fn new_raw_stream<M, F>(&self, model: M, render: F) -> Builder<M, F>where
F: RenderFn<M>,
pub fn new_raw_stream<M, F>(&self, model: M, render: F) -> Builder<M, F>where
F: RenderFn<M>,
Begin building a new laser raw stream.
The raw stream will call the given render
function with a request for as many points as
the DAC currently might need to fill the buffer based on the stream latency.