framesmith 0.1.0

A Rust library for controlling Samsung Frame TVs over the local network
Documentation
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum DisplayBrightness {
    L0,
    L1,
    L2,
    L3,
    L4,
    L5,
    L6,
    L7,
    L8,
    L9,
    L10,
}

impl DisplayBrightness {
    pub fn as_value(&self) -> u8 {
        match self {
            Self::L0 => 0,
            Self::L1 => 1,
            Self::L2 => 2,
            Self::L3 => 3,
            Self::L4 => 4,
            Self::L5 => 5,
            Self::L6 => 6,
            Self::L7 => 7,
            Self::L8 => 8,
            Self::L9 => 9,
            Self::L10 => 10,
        }
    }

    pub fn from_value(value: u8) -> Option<Self> {
        match value {
            0 => Some(Self::L0),
            1 => Some(Self::L1),
            2 => Some(Self::L2),
            3 => Some(Self::L3),
            4 => Some(Self::L4),
            5 => Some(Self::L5),
            6 => Some(Self::L6),
            7 => Some(Self::L7),
            8 => Some(Self::L8),
            9 => Some(Self::L9),
            10 => Some(Self::L10),
            _ => None,
        }
    }
}