[−][src]Struct huemanity::Bridge
Fields
ip: String
The bridge struct represents a HUE bridge.
The constructor for this struct link
, tries to
detect the light id's and is able to send new state to either
a single light or all of the ones detected.
Currently to register a new bridge, you need to know 2 things:
- the internal IP of the bridge (in future i'll implement ssdp)
- the key assigned to you by the
api/newdeveloper
POST request see the documentation for the HUE API in order to see this. I will implement the authentication handshake request flow in the near future and in the CLI I will cache the key somewhere
key: String
client: Client
base_url: String
light_ids: Vec<u8>
n_lights: u8
Methods
impl Bridge
[src]
pub fn link(ip: String, key: String) -> Self
[src]
Struct constructor that sets up the required interactions and also gets us the light id's as well as how many there are
pub fn send(
&self,
endpoint: &str,
req_type: RequestType,
params: Option<&Value>
) -> Result<Response, Box<dyn Error>>
[src]
&self,
endpoint: &str,
req_type: RequestType,
params: Option<&Value>
) -> Result<Response, Box<dyn Error>>
Sends the a request with set parameters to the HUE API endpoint
pub fn state(&self, light: u8, state: &Value) -> Result<(), Box<dyn Error>>
[src]
Given a light and a required state, send this state to the light.
pub fn state_all(&self, state: &Value) -> Result<(), Box<dyn Error>>
[src]
Given a state send it to all lights found on bridge
pub fn collect_ids(&mut self) -> Result<(), Box<dyn Error>>
[src]
Collect all found light ids
Trait Implementations
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,