MCPcopy Create free account
hub / github.com/OpenActionAPI/rust-elgato-streamdeck / read_input

Method read_input

src/asynchronous.rs:94–105  ·  view source on GitHub ↗

Reads button states, awaits until there's data. Poll rate determines how often button state gets checked

(&self, poll_rate: f32)

Source from the content-addressed store, hash-verified

92 /// Reads button states, awaits until there's data.
93 /// Poll rate determines how often button state gets checked
94 pub async fn read_input(&self, poll_rate: f32) -> Result<StreamDeckInput, StreamDeckError> {
95 loop {
96 let device = self.device.lock().await;
97 let data = block_in_place(move || device.read_input(None))?;
98
99 if !data.is_empty() {
100 return Ok(data);
101 }
102
103 sleep(Duration::from_secs_f32(1.0 / poll_rate)).await;
104 }
105 }
106
107 /// Resets the device
108 pub async fn reset(&self) -> Result<(), StreamDeckError> {

Callers 1

readMethod · 0.45

Calls 1

is_emptyMethod · 0.80

Tested by

no test coverage detected