#[non_exhaustive]pub enum ServerMessage {
Hello {
api: u32,
server: String,
},
State {
device: Option<DeviceInfo>,
lock: bool,
lcd: Option<bool>,
},
Device {
device: Option<DeviceInfo>,
},
Motion {
t: [i16; 3],
r: [i16; 3],
},
Key {
key: String,
id: u8,
press: Press,
down: bool,
},
Lock {
on: bool,
},
Lcd {
owner: bool,
brightness: u8,
text_size: TextSize,
theme: Theme,
},
Command {
id: String,
env: String,
key: String,
press: Press,
},
Screen {
png: String,
},
Error {
message: String,
},
Unknown,
}Expand description
What smed sends.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Hello
State
Fields
§
device: Option<DeviceInfo>Device
Fields
§
device: Option<DeviceInfo>Motion
Translation t and rotation r in the raw device frame, rotation zeroed while locked.
Key
Lock
Lcd
API 2: whether this connection has the LCD, and the LCD settings.
Command
API 2: a key the focused client assigned a command to went down: id of the command,
env the environment it is assigned in, key the key’s name, press short or long.
Screen
API 2: the answer to get_screen: the current LCD page as a PNG (base64), drawn as it
goes to the device.
Error
Unknown
A message type this crate does not know (from a newer smed); ignore it.
Implementations§
Source§impl ServerMessage
impl ServerMessage
Sourcepub fn screen_png(&self) -> Option<Vec<u8>>
pub fn screen_png(&self) -> Option<Vec<u8>>
The PNG of a screen message, decoded; None for other messages or invalid base64.
Trait Implementations§
Source§impl Clone for ServerMessage
impl Clone for ServerMessage
Source§impl Debug for ServerMessage
impl Debug for ServerMessage
Source§impl<'de> Deserialize<'de> for ServerMessage
impl<'de> Deserialize<'de> for ServerMessage
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ServerMessage
impl PartialEq for ServerMessage
Source§impl Serialize for ServerMessage
impl Serialize for ServerMessage
impl StructuralPartialEq for ServerMessage
Auto Trait Implementations§
impl Forget for ServerMessage
impl Freeze for ServerMessage
impl Move for ServerMessage
impl RefUnwindSafe for ServerMessage
impl Send for ServerMessagewhere
RawVecInner: Send,
impl Sync for ServerMessagewhere
RawVecInner: Sync,
impl Unpin for ServerMessage
impl UnsafeUnpin for ServerMessage
impl UnwindSafe for ServerMessagewhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more