C# Class HueLibrary.Bridge

Represents a Hue bridge.
Mostrar archivo Open project: Microsoft/Windows-appsample-huelightcontroller Class Usage Examples

Public Methods

Method Description
Bridge ( ) : Newtonsoft.Json

Default constructor for the bridge. Requires manually setting the IP and userId.

Bridge ( string ip ) : Newtonsoft.Json

Constructor for the bridge with IP provided. Requires manually setting the userId.

Bridge ( string ip, string userId ) : Newtonsoft.Json

Constructor for the bridge with IP and username provided.

FindAsync ( ) : Task

Attempts to find a bridge on your network and create an object for it. Returns null if no bridge is found.

FindNewLightsAsync ( ) : System.Threading.Tasks.Task

Instructs the bridge to search for new, unknown lights.

GetLightAsync ( string id ) : Task

Gets a light with the given id known to the bridge, or null if no light is found.

GetLightsAsync ( ) : Task>

Gets all lights known to the bridge.

PingAsync ( ) : Task

Sends a basic command to the bridge and returns whether it receives the expected response.

RegisterAsync ( ) : Task

Registers the application with the bridge and returns if the authorization succeeded.

Private Methods

Method Description
HttpGetAsync ( string commandUrl ) : Task

Sends a GET command via HTTP and returns the response.

HttpPutAsync ( string commandUrl, string body ) : Task

Sends a PUT command via HTTP and returns the response.

Method Details

Bridge() public method

Default constructor for the bridge. Requires manually setting the IP and userId.
public Bridge ( ) : Newtonsoft.Json
return Newtonsoft.Json

Bridge() public method

Constructor for the bridge with IP provided. Requires manually setting the userId.
public Bridge ( string ip ) : Newtonsoft.Json
ip string
return Newtonsoft.Json

Bridge() public method

Constructor for the bridge with IP and username provided.
public Bridge ( string ip, string userId ) : Newtonsoft.Json
ip string
userId string
return Newtonsoft.Json

FindAsync() public static method

Attempts to find a bridge on your network and create an object for it. Returns null if no bridge is found.
public static FindAsync ( ) : Task
return Task

FindNewLightsAsync() public method

Instructs the bridge to search for new, unknown lights.
public FindNewLightsAsync ( ) : System.Threading.Tasks.Task
return System.Threading.Tasks.Task

GetLightAsync() public method

Gets a light with the given id known to the bridge, or null if no light is found.
public GetLightAsync ( string id ) : Task
id string
return Task

GetLightsAsync() public method

Gets all lights known to the bridge.
public GetLightsAsync ( ) : Task>
return Task>

PingAsync() public method

Sends a basic command to the bridge and returns whether it receives the expected response.
public PingAsync ( ) : Task
return Task

RegisterAsync() public method

Registers the application with the bridge and returns if the authorization succeeded.
public RegisterAsync ( ) : Task
return Task