Function huelib::bridge::register_user_with_clientkey [−][src]
pub fn register_user_with_clientkey<S>(
ip_address: IpAddr,
devicetype: S
) -> Result<(String, String)> where
S: AsRef<str>,
Expand description
Registers a new user on a bridge with a clientkey.
This function returns the new username and a random generated 16 byte clientkey encoded as ASCII
string of length 32. See the register_user
function if you don’t want to generate a
clientkey.
Examples
Register a user and print the username and clientkey:
use huelib::bridge;
use std::net::{IpAddr, Ipv4Addr};
let bridge_ip = IpAddr::V4(Ipv4Addr::new(192, 168, 1, 2));
let (username, clientkey) = bridge::register_user_with_clientkey(bridge_ip, "example")?;
println!("Registered user with username `{}` and clientkey `{}`", username, clientkey);