diff --git a/README.md b/README.md index e63203c..a9d9ad8 100755 --- a/README.md +++ b/README.md @@ -10,12 +10,15 @@ A simple and easy to use library for Philips Hue Lights * starting to test with google test, google mock and gcov/lcov ## How to use -### Finding Bridges -If you want to find a Hue Bridge make a HueFinder object and call FindBridges() -it will return a vector containing the ip and mac address of all found Bridges. +### Searching for Bridges +To start searching for a Hue Bridge you will need to choose an IHttpHandler and create one. For now there is only one, the "HttpHandler". +Then create a HueFinder object with the handler. +The handler is needed, because it tells the finder which functions to use to communicate with a bridge or your local network. +After that you can call FindBridges(), which will return a vector containing the ip and mac address of all found Bridges. If no Bridges were found the vector is empty, so make sure that in that case you provide an ip and mac address. ```C++ -HueFinder finder; +handler = std::make_shared(); +HueFinder finder(handler); std::vector bridges = finder.FindBridges(); if (bridges.empty()) { @@ -23,10 +26,10 @@ if (bridges.empty()) } ``` -### Using Bridges +### Authenticate Bridges If you have found the Bridge you were looking for, you can then move on with the authentication process. To get a new username from the Bridge (for now) you simply call GetBridge(bridges[\]), -where index is your preferred Bridge from the part [Finding Bridges](#findingBridges). +where index is your preferred Bridge from the part [Searching for Bridges](#searchingBridges). ```C++ Hue bridge = finder.GetBridge(bridges[0]); ``` @@ -35,6 +38,12 @@ If you on the other hand already have a username you can add your bridge like so finder.AddUsername(bridges[0].mac, ""); Hue bridge = finder.GetBridge(bridges[0]); ``` +If you do not want to use the HueFinder or you already know the ip and username of your bridge you have the option to create your own Hue object. +Here you will need to provide the ip address, a username and an HttpHandler +```C++ +handler = std::make_shared(); +Hue bridge("192.168.2.102", "", handler); +``` ### Controlling lights If you have your Bridge all set up, you can now control its lights.