Adding a name to the LIFX controller
This commit is contained in:
parent
223ec45a75
commit
4d7fe885c9
5 changed files with 28 additions and 7 deletions
|
|
@ -11,8 +11,10 @@
|
|||
using json = nlohmann::json;
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
LIFXController::LIFXController(std::string ip)
|
||||
LIFXController::LIFXController(std::string ip, std::string name)
|
||||
{
|
||||
this->name = name;
|
||||
|
||||
/*-----------------------------------------------------------------*\
|
||||
| Fill in location string with device's IP address |
|
||||
\*-----------------------------------------------------------------*/
|
||||
|
|
@ -36,7 +38,7 @@ std::string LIFXController::GetLocation()
|
|||
|
||||
std::string LIFXController::GetName()
|
||||
{
|
||||
return("LIFX");
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string LIFXController::GetVersion()
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ enum
|
|||
class LIFXController
|
||||
{
|
||||
public:
|
||||
LIFXController(std::string ip);
|
||||
LIFXController(std::string ip, std::string name);
|
||||
~LIFXController();
|
||||
|
||||
std::string GetLocation();
|
||||
|
|
@ -58,6 +58,7 @@ private:
|
|||
unsigned char* data;
|
||||
unsigned char sequence;
|
||||
unsigned int source;
|
||||
std::string name;
|
||||
std::string firmware_version;
|
||||
std::string module_name;
|
||||
std::string module_mac;
|
||||
|
|
|
|||
|
|
@ -34,8 +34,9 @@ void DetectLIFXControllers(std::vector<RGBController*> &rgb_controllers)
|
|||
if(lifx_settings["devices"][device_idx].contains("ip"))
|
||||
{
|
||||
std::string lifx_ip = lifx_settings["devices"][device_idx]["ip"];
|
||||
std::string name = lifx_settings["devices"][device_idx]["name"];
|
||||
|
||||
LIFXController* controller = new LIFXController(lifx_ip);
|
||||
LIFXController* controller = new LIFXController(lifx_ip, name);
|
||||
RGBController_LIFX* rgb_controller = new RGBController_LIFX(controller);
|
||||
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue