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

pub struct Bridge { /* fields omitted */ }

A bridge with IP address and username.

Implementations

impl Bridge[src]

pub fn new<S>(ip_address: IpAddr, username: S) -> Self where
    S: Into<String>, 
[src]

Creates a new bridge.

Examples

Create a bridge with an already registered user:

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

let ip = IpAddr::V4(Ipv4Addr::new(192, 168, 1, 2));
let bridge = Bridge::new(ip, "username");

pub fn username(&self) -> &str[src]

Returns the name of the user that is connected to the bridge.

pub fn ip_address(&self) -> &IpAddr[src]

Returns the IP address of the bridge.

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

Modifies the configuration of the bridge.

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

Returns the configuration of the bridge.

pub fn set_light_attribute<S>(
    &self,
    id: S,
    modifier: &AttributeModifier
) -> Result<Vec<Response<Modified>>> where
    S: Into<String>, 
[src]

Modifies attributes of a light.

pub fn set_light_state<S>(
    &self,
    id: S,
    modifier: &StateModifier
) -> Result<Vec<Response<Modified>>> where
    S: Into<String>, 
[src]

Modifies the state of a light.

pub fn get_light<S>(&self, id: S) -> Result<Light> where
    S: Into<String>, 
[src]

Returns a light.

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

Returns all lights that are connected to the bridge.

pub fn search_new_lights(&self, scanner: &Scanner) -> Result<()>[src]

Starts searching for new lights.

The bridge will open the network for 40 seconds. The overall search might take longer since the configuration of 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 40 seconds.

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

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

Returns discovered lights.

pub fn delete_light<S>(&self, id: S) -> Result<()> where
    S: Into<String>, 
[src]

Deletes a light from the bridge.

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

Creates a new group.

pub fn set_group_attribute<S>(
    &self,
    id: S,
    modifier: &AttributeModifier
) -> Result<Vec<Response<Modified>>> where
    S: Into<String>, 
[src]

Modifies attributes of a group.

pub fn set_group_state<S>(
    &self,
    id: S,
    modifier: &StateModifier
) -> Result<Vec<Response<Modified>>> where
    S: Into<String>, 
[src]

Modifies the state of a group.

pub fn get_group<S>(&self, id: S) -> Result<Group> where
    S: Into<String>, 
[src]

Returns a group.

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

Returns all groups.

pub fn delete_group<S>(&self, id: S) -> Result<()> where
    S: Into<String>, 
[src]

Deletes a group from the bridge.

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

Creates a new scene.

pub fn set_scene<S>(
    &self,
    id: S,
    modifier: &Modifier
) -> Result<Vec<Response<Modified>>> where
    S: Into<String>, 
[src]

Modifies the state and attributes of a scene.

pub fn get_scene<S>(&self, id: S) -> Result<Scene> where
    S: Into<String>, 
[src]

Returns a scene.

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

Returns all scenes.

pub fn delete_scene<S>(&self, id: S) -> Result<()> where
    S: Into<String>, 
[src]

Deletes a scene.

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

Returns the capabilities of resources.

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

Creates a new schedule and returns the identifier.

pub fn set_schedule<S>(
    &self,
    id: S,
    modifier: &Modifier
) -> Result<Vec<Response<Modified>>> where
    S: Into<String>, 
[src]

Modifies attributes of a schedule.

pub fn get_schedule<S>(&self, id: S) -> Result<Schedule> where
    S: Into<String>, 
[src]

Returns a schedule.

pub fn get_all_schedules(&self) -> Result<Vec<Schedule>>[src]

Returns all schedules.

pub fn delete_schedule<S>(&self, id: S) -> Result<()> where
    S: Into<String>, 
[src]

Deletes a schedule.

Creates a new resourcelink and returns the identifier.

Modifies attributes of a resourcelink.

Returns a resourcelink.

Returns all resourcelinks.

Deletes a resourcelink.

pub fn set_sensor_attribute<S>(
    &self,
    id: S,
    modifier: &AttributeModifier
) -> Result<Vec<Response<Modified>>> where
    S: Into<String>, 
[src]

Modifies attributes of a sensor.

pub fn set_sensor_state<S>(
    &self,
    id: S,
    modifier: &StateModifier
) -> Result<Vec<Response<Modified>>> where
    S: Into<String>, 
[src]

Modifies the state of a sensor.

pub fn set_sensor_config<S>(
    &self,
    id: S,
    modifier: &ConfigModifier
) -> Result<Vec<Response<Modified>>> where
    S: Into<String>, 
[src]

Modifies the configuration of a sensor.

pub fn get_sensor<S>(&self, id: S) -> Result<Sensor> where
    S: Into<String>, 
[src]

Returns a sensor.

pub fn get_all_sensors(&self) -> Result<Vec<Sensor>>[src]

Returns all sensors that are connected to the bridge.

pub fn search_new_sensors(&self, scanner: &Scanner) -> Result<()>[src]

Starts searching for new sensors.

The bridge will open the network for 40 seconds. The overall search might take longer since the configuration of 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 40 seconds.

When the search has finished, new sensors will be available using the get_new_sensors function.

pub fn get_new_sensors(&self) -> Result<Scan>[src]

Returns discovered sensors.

pub fn delete_sensor<S>(&self, id: S) -> Result<()> where
    S: Into<String>, 
[src]

Deletes a sensor from the bridge.

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

Creates a new rule.

pub fn set_rule<S>(
    &self,
    id: S,
    modifier: &Modifier
) -> Result<Vec<Response<Modified>>> where
    S: Into<String>, 
[src]

Modifies attributes of a rule.

pub fn get_rule<S>(&self, id: S) -> Result<Rule> where
    S: Into<String>, 
[src]

Returns a rule.

pub fn get_all_rules(&self) -> Result<Vec<Rule>>[src]

Returns all rules.

pub fn delete_rule<S>(&self, id: S) -> Result<()> where
    S: Into<String>, 
[src]

Deletes a rule.

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

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.