[][src]Struct huelib::bridge::Bridge

pub struct Bridge {
    pub username: String,
    pub ip_address: IpAddr,
    // some fields omitted
}

A bridge with IP address and username.

Fields

username: String

Name of the user that is connected to the bridge.

ip_address: IpAddr

IP address of the bridge.

Methods

impl Bridge[src]

pub fn new(ip_address: IpAddr, username: &str) -> Self[src]

Creates a new bridge.

Examples

Create a bridge with an already registered user.

use std::net::{IpAddr, Ipv4Addr};

let bridge_ip = IpAddr::V4(Ipv4Addr::new(192, 168, 1, 2));
let bridge = huelib::Bridge::new(bridge_ip, "example-username");

pub fn get_config(&self) -> Result<Config, Error>[src]

Returns the configuration of the bridge.

pub fn set_config(
    &self,
    modifier: &Modifier
) -> Result<Vec<Response<Modified>>, Error>
[src]

Modifies the configuration of the bridge

pub fn set_light_attribute(
    &self,
    id: &str,
    modifier: &AttributeModifier
) -> Result<Vec<Response<Modified>>, Error>
[src]

Modifies attributes of a light.

pub fn set_light_state(
    &self,
    id: &str,
    modifier: &StateModifier
) -> Result<Vec<Response<Modified>>, Error>
[src]

Modifies the state of a light.

pub fn delete_light(&self, id: &str) -> Result<(), Error>[src]

Deletes a light from the bridge.

pub fn get_light(&self, id: &str) -> Result<Light, Error>[src]

Returns a light.

pub fn get_all_lights(&self) -> Result<Vec<Light>, Error>[src]

Returns all lights that are connected to the bridge.

pub fn search_new_lights(
    &self,
    device_ids: Option<&[&str]>
) -> Result<(), Error>
[src]

Starts searching for new lights.

The bridge will open the network for 40s. The overall search might take longer since the configuration of (multiple) new devices can take longer. If many devices are found the command will have to be issued a second time after discovery time has elapsed. If the command is received again during search the search will continue for at least an additional 40s.

When the search has finished, new lights will be available using the get_new_lights function.

pub fn get_new_lights(&self) -> Result<Scan, Error>[src]

Returns lights that were discovered the last time a search for new lights was performed. The list of new lights is always deleted when a new search is started.

pub fn create_group(&self, creator: &Creator) -> Result<String, Error>[src]

Creates a new group.

pub fn set_group_attribute(
    &self,
    id: &str,
    modifier: &AttributeModifier
) -> Result<Vec<Response<Modified>>, Error>
[src]

Modifies attributes of a group.

pub fn set_group_state(
    &self,
    id: &str,
    modifier: &StateModifier
) -> Result<Vec<Response<Modified>>, Error>
[src]

Modifies the state of a group.

pub fn delete_group(&self, id: &str) -> Result<(), Error>[src]

Deletes a group from the bridge.

pub fn get_group(&self, id: &str) -> Result<Group, Error>[src]

Returns a group.

pub fn get_all_groups(&self) -> Result<Vec<Group>, Error>[src]

Returns all groups.

pub fn create_scene(&self, creator: &Creator) -> Result<String, Error>[src]

Creates a new scene.

pub fn set_scene(
    &self,
    id: &str,
    modifier: &Modifier
) -> Result<Vec<Response<Modified>>, Error>
[src]

Modifies light states of a scene.

pub fn delete_scene(&self, id: &str) -> Result<(), Error>[src]

Deletes a scene.

pub fn get_scene(&self, id: &str) -> Result<Scene, Error>[src]

Returns a scene.

pub fn get_all_scenes(&self) -> Result<Vec<Scene>, Error>[src]

Returns all scenes.

pub fn get_capabilities(&self) -> Result<Capabilities, Error>[src]

Returns the capabilities of resources.

Trait Implementations

impl Clone for Bridge[src]

impl Debug for Bridge[src]

impl Eq for Bridge[src]

impl PartialEq<Bridge> for Bridge[src]

impl StructuralEq for Bridge[src]

impl StructuralPartialEq for Bridge[src]

Auto Trait Implementations

impl RefUnwindSafe for Bridge

impl Send for Bridge

impl Sync for Bridge

impl Unpin for Bridge

impl UnwindSafe for Bridge

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.