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

Function read_lcd_input

src/util.rs:80–97  ·  view source on GitHub ↗

Reads lcd screen input

(data: &[u8])

Source from the content-addressed store, hash-verified

78
79/// Reads lcd screen input
80pub fn read_lcd_input(data: &[u8]) -> Result<StreamDeckInput, StreamDeckError> {
81 let start_x = u16::from_le_bytes([data[6], data[7]]);
82 let start_y = u16::from_le_bytes([data[8], data[9]]);
83
84 match &data[4] {
85 0x1 => Ok(StreamDeckInput::TouchScreenPress(start_x, start_y)),
86 0x2 => Ok(StreamDeckInput::TouchScreenLongPress(start_x, start_y)),
87
88 0x3 => {
89 let end_x = u16::from_le_bytes([data[10], data[11]]);
90 let end_y = u16::from_le_bytes([data[12], data[13]]);
91
92 Ok(StreamDeckInput::TouchScreenSwipe((start_x, start_y), (end_x, end_y)))
93 }
94
95 _ => Err(StreamDeckError::BadData),
96 }
97}
98
99/// Reads encoder input
100pub fn read_encoder_input(kind: &Kind, data: &[u8]) -> Result<StreamDeckInput, StreamDeckError> {

Callers 1

read_inputMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected