Struct AsyncStreamDeck

Source
pub struct AsyncStreamDeck { /* private fields */ }
Available on crate feature async only.
Expand description

Stream Deck interface suitable to be used in async, uses block_in_place so this wrapper cannot be used in current_thread runtimes

Implementations§

Source§

impl AsyncStreamDeck

Static functions of the struct

Source

pub fn connect( hidapi: &HidApi, kind: Kind, serial: &str, ) -> Result<AsyncStreamDeck, StreamDeckError>

Attempts to connect to the device, can be safely ran inside multi_thread runtime

Source§

impl AsyncStreamDeck

Instance methods of the struct

Source

pub fn kind(&self) -> Kind

Returns kind of the Stream Deck

Source

pub async fn manufacturer(&self) -> Result<String, StreamDeckError>

Returns manufacturer string of the device

Source

pub async fn product(&self) -> Result<String, StreamDeckError>

Returns product string of the device

Source

pub async fn serial_number(&self) -> Result<String, StreamDeckError>

Returns serial number of the device

Source

pub async fn firmware_version(&self) -> Result<String, StreamDeckError>

Returns firmware version of the StreamDeck

Source

pub async fn read_input( &self, poll_rate: f32, ) -> Result<StreamDeckInput, StreamDeckError>

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

Source

pub async fn reset(&self) -> Result<(), StreamDeckError>

Resets the device

Source

pub async fn set_brightness(&self, percent: u8) -> Result<(), StreamDeckError>

Sets brightness of the device, value range is 0 - 100

Source

pub async fn write_image( &self, key: u8, image_data: &[u8], ) -> Result<(), StreamDeckError>

Writes image data to Stream Deck device, changes must be flushed with .flush() before they will appear on the device!

Source

pub async fn write_lcd( &self, x: u16, y: u16, rect: &ImageRect, ) -> Result<(), StreamDeckError>

Writes image data to Stream Deck device’s lcd strip/screen as region. Only Stream Deck Plus supports writing LCD regions, for Stream Deck Neo use write_lcd_fill

Source

pub async fn write_lcd_fill( &self, image_data: &[u8], ) -> Result<(), StreamDeckError>

Writes image data to Stream Deck device’s lcd strip/screen as full fill

You can convert your images into proper image_data like this:

use elgato_streamdeck::images::{convert_image_with_format_async};
let image_data = convert_image_with_format_async(device.kind().lcd_image_format(), image).await.unwrap();
device.write_lcd_fill(&image_data).await;
Source

pub async fn clear_button_image(&self, key: u8) -> Result<(), StreamDeckError>

Sets button’s image to blank, changes must be flushed with .flush() before they will appear on the device!

Source

pub async fn clear_all_button_images(&self) -> Result<(), StreamDeckError>

Sets blank images to every button, changes must be flushed with .flush() before they will appear on the device!

Source

pub async fn set_button_image( &self, key: u8, image: DynamicImage, ) -> Result<(), StreamDeckError>

Sets specified button’s image, changes must be flushed with .flush() before they will appear on the device!

Source

pub async fn set_logo_image( &self, image: DynamicImage, ) -> Result<(), StreamDeckError>

Set logo image

Source

pub async fn set_touchpoint_color( &self, point: u8, red: u8, green: u8, blue: u8, ) -> Result<(), StreamDeckError>

Sets specified touch point’s led strip color

Source

pub async fn sleep(&self) -> Result<(), StreamDeckError>

Sleeps the device

Source

pub async fn keep_alive(&self) -> Result<(), StreamDeckError>

Make periodic events to the device, to keep it alive

Source

pub async fn shutdown(&self) -> Result<(), StreamDeckError>

Shutdown the device

Source

pub async fn flush(&self) -> Result<(), StreamDeckError>

Flushes the button’s image to the device

Source

pub fn get_reader(&self) -> Arc<AsyncDeviceStateReader>

Returns button state reader for this device

Trait Implementations§

Source§

impl Clone for AsyncStreamDeck

Source§

fn clone(&self) -> AsyncStreamDeck

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.