[][src]Struct yeelight::Bulb

pub struct Bulb { /* fields omitted */ }

Bulb connection

Implementations

impl Bulb[src]

pub fn attach(stream: TcpStream) -> Bulb[src]

Attach to existing TcpStream.

Example

let stream = std::net::TcpStream::connect("192.168.1.204:55443")
    .expect("Connection failed");
let mut bulb = Bulb::attach(stream);
bulb.toggle().unwrap();

pub fn connect(addr: &str, port: u16) -> Result<Bulb, Error>[src]

Connect to bulb at the specified address and port.

Example

let my_bulb_ip = "192.168.1.204";
let mut bulb = Bulb::connect(my_bulb_ip, 55443)
    .expect("Connection failed");
bulb.toggle().unwrap();

impl Bulb[src]

Messages

This are all the methods as by the yeelight API spec. They all take the parameters specified by the spec, build a message, send it to the bulb and wait for the response which is parsed into a Response.

pub fn get_prop(&mut self, properties: &Properties) -> Result<Response, Error>[src]

pub fn set_ct_abx(
    &mut self,
    ct_value: u64,
    effect: Effect,
    duration: u64
) -> Result<Response, Error>
[src]

pub fn set_rgb(
    &mut self,
    rgb_value: u32,
    effect: Effect,
    duration: u64
) -> Result<Response, Error>
[src]

pub fn set_hsv(
    &mut self,
    hue: u16,
    sat: u8,
    effect: Effect,
    duration: u64
) -> Result<Response, Error>
[src]

pub fn set_bright(
    &mut self,
    brightness: u8,
    effect: Effect,
    duration: u64
) -> Result<Response, Error>
[src]

pub fn set_power(
    &mut self,
    power: Power,
    effect: Effect,
    duration: u64,
    mode: Mode
) -> Result<Response, Error>
[src]

pub fn toggle(&mut self) -> Result<Response, Error>[src]

pub fn set_default(&mut self) -> Result<Response, Error>[src]

pub fn start_cf(
    &mut self,
    count: u8,
    action: CfAction,
    flow_expression: FlowExpresion
) -> Result<Response, Error>
[src]

pub fn stop_cf(&mut self) -> Result<Response, Error>[src]

pub fn set_scene(
    &mut self,
    class: Class,
    val1: u64,
    val2: u64,
    val3: u64
) -> Result<Response, Error>
[src]

pub fn cron_add(
    &mut self,
    cron_type: CronType,
    value: u64
) -> Result<Response, Error>
[src]

pub fn cron_get(&mut self, cron_type: CronType) -> Result<Response, Error>[src]

pub fn cron_del(&mut self, cron_type: CronType) -> Result<Response, Error>[src]

pub fn set_adjust(
    &mut self,
    action: AdjustAction,
    prop: Prop
) -> Result<Response, Error>
[src]

pub fn set_music(
    &mut self,
    action: MusicAction,
    host: &str,
    port: u32
) -> Result<Response, Error>
[src]

pub fn set_name(&mut self, name: &str) -> Result<Response, Error>[src]

pub fn bg_set_rgb(
    &mut self,
    rgb_value: u32,
    effect: Effect,
    duration: u64
) -> Result<Response, Error>
[src]

pub fn bg_set_hsv(
    &mut self,
    hue: u16,
    sat: u8,
    effect: Effect,
    duration: u64
) -> Result<Response, Error>
[src]

pub fn bg_set_ct_abx(
    &mut self,
    ct_value: u64,
    effect: Effect,
    duration: u64
) -> Result<Response, Error>
[src]

pub fn bg_start_cf(
    &mut self,
    count: u8,
    action: CfAction,
    flow_expression: FlowExpresion
) -> Result<Response, Error>
[src]

pub fn bg_stop_cf(&mut self) -> Result<Response, Error>[src]

pub fn bg_set_scene(
    &mut self,
    class: Class,
    val1: u64,
    val2: u64,
    val3: u64
) -> Result<Response, Error>
[src]

pub fn bg_set_default(&mut self) -> Result<Response, Error>[src]

pub fn bg_set_power(
    &mut self,
    power: Power,
    effect: Effect,
    duration: u64,
    mode: Mode
) -> Result<Response, Error>
[src]

pub fn bg_set_bright(
    &mut self,
    brightness: u8,
    effect: Effect,
    duration: u64
) -> Result<Response, Error>
[src]

pub fn bg_set_adjust(
    &mut self,
    action: AdjustAction,
    prop: Prop
) -> Result<Response, Error>
[src]

pub fn bg_toggle(&mut self) -> Result<Response, Error>[src]

pub fn dev_toggle(&mut self) -> Result<Response, Error>[src]

pub fn adjust_bright(
    &mut self,
    percentage: u8,
    duration: u64
) -> Result<Response, Error>
[src]

pub fn adjust_ct(
    &mut self,
    percentage: u8,
    duration: u64
) -> Result<Response, Error>
[src]

pub fn adjust_color(
    &mut self,
    percentage: u8,
    duration: u64
) -> Result<Response, Error>
[src]

pub fn bg_adjust_bright(
    &mut self,
    percentage: u8,
    duration: u64
) -> Result<Response, Error>
[src]

pub fn bg_adjust_ct(
    &mut self,
    percentage: u8,
    duration: u64
) -> Result<Response, Error>
[src]

pub fn bg_adjust_color(
    &mut self,
    percentage: u8,
    duration: u64
) -> Result<Response, Error>
[src]

Auto Trait Implementations

impl RefUnwindSafe for Bulb

impl Send for Bulb

impl Sync for Bulb

impl Unpin for Bulb

impl UnwindSafe for Bulb

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.