StreamDeck

Struct StreamDeck 

Source
pub struct StreamDeck { /* private fields */ }
Expand description

Interface for a Stream Deck device

Implementations§

Source§

impl StreamDeck

Static functions of the struct

Source

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

Attempts to connect to the device

Source§

impl StreamDeck

Instance methods of the struct

Source

pub fn kind(&self) -> Kind

Returns kind of the Stream Deck

Source

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

Returns manufacturer string of the device

Source

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

Returns product string of the device

Source

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

Returns serial number of the device

Source

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

Returns firmware version of the StreamDeck

Source

pub fn read_input( &self, timeout: Option<Duration>, ) -> Result<StreamDeckInput, StreamDeckError>

Reads all possible input from Stream Deck device

Source

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

Resets the device

Source

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

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

Source

pub 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 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 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;
let image_data = convert_image_with_format(device.kind().lcd_image_format(), image).unwrap();
device.write_lcd_fill(&image_data);
Source

pub 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 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 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 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 fn flush(&self) -> Result<(), StreamDeckError>

Flushes the button’s image to the device

Source

pub fn get_reader(self: &Arc<Self>) -> Arc<DeviceStateReader>

Returns button state reader for this device

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> 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, 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.