Commit fd4bc31262926049713e763a5156a5e2304e273e

Authored by Moritz Wirger
Committed by GitHub
2 parents a49f68ca b6c1545c

Merge pull request #1 from Wulkop/master

Fix instanciation of unique HueLight pointers
hueplusplus/Hue.cpp
@@ -243,35 +243,35 @@ std::unique_ptr<HueLight> Hue::getLight(int id) @@ -243,35 +243,35 @@ std::unique_ptr<HueLight> Hue::getLight(int id)
243 if (type == "LCT001" || type == "LCT002" || type == "LCT003" || type == "LCT007" || type == "LLM001") 243 if (type == "LCT001" || type == "LCT002" || type == "LCT003" || type == "LCT007" || type == "LLM001")
244 { 244 {
245 // HueExtendedColorLight Gamut B 245 // HueExtendedColorLight Gamut B
246 - std::unique_ptr<HueLight> light = new HueExtendedColorLight(ip, username, id); 246 + std::unique_ptr<HueLight> light(new HueExtendedColorLight(ip, username, id));
247 light->colorType = ColorType::GAMUT_B; 247 light->colorType = ColorType::GAMUT_B;
248 return light; 248 return light;
249 } 249 }
250 else if (type == "LCT010" || type == "LCT011" || type == "LCT014" || type == "LLC020" || type == "LST002") 250 else if (type == "LCT010" || type == "LCT011" || type == "LCT014" || type == "LLC020" || type == "LST002")
251 { 251 {
252 // HueExtendedColorLight Gamut C 252 // HueExtendedColorLight Gamut C
253 - std::unique_ptr<HueLight> light = new HueExtendedColorLight(ip, username, id); 253 + std::unique_ptr<HueLight> light(new HueExtendedColorLight(ip, username, id));
254 light->colorType = ColorType::GAMUT_C; 254 light->colorType = ColorType::GAMUT_C;
255 return light; 255 return light;
256 } 256 }
257 else if (type == "LST001" || type == "LLC006" || type == "LLC007" || type == "LLC010" || type == "LLC011" || type == "LLC012" || type == "LLC013") 257 else if (type == "LST001" || type == "LLC006" || type == "LLC007" || type == "LLC010" || type == "LLC011" || type == "LLC012" || type == "LLC013")
258 { 258 {
259 // HueColorLight Gamut A 259 // HueColorLight Gamut A
260 - std::unique_ptr<HueLight> light = new HueColorLight(ip, username, id); 260 + std::unique_ptr<HueLight> light(new HueColorLight(ip, username, id));
261 light->colorType = ColorType::GAMUT_A; 261 light->colorType = ColorType::GAMUT_A;
262 return light; 262 return light;
263 } 263 }
264 else if (type == "LWB004" || type == "LWB006" || type == "LWB007" || type == "LWB010" || type == "LWB014") 264 else if (type == "LWB004" || type == "LWB006" || type == "LWB007" || type == "LWB010" || type == "LWB014")
265 { 265 {
266 // HueDimmableLight No Color Type 266 // HueDimmableLight No Color Type
267 - std::unique_ptr<HueLight> light = new HueDimmableLight(ip, username, id); 267 + std::unique_ptr<HueLight> light(new HueDimmableLight(ip, username, id));
268 light->colorType = ColorType::NONE; 268 light->colorType = ColorType::NONE;
269 return light; 269 return light;
270 } 270 }
271 else if (type == "LLM010" || type == "LLM011" || type == "LLM012" || type == "LTW001" || type == "LTW004" || type == "LTW013" || type == "LTW014") 271 else if (type == "LLM010" || type == "LLM011" || type == "LLM012" || type == "LTW001" || type == "LTW004" || type == "LTW013" || type == "LTW014")
272 { 272 {
273 // HueTemperatureLight 273 // HueTemperatureLight
274 - std::unique_ptr<HueLight> light = new HueTemperatureLight(ip, username, id); 274 + std::unique_ptr<HueLight> light(new HueTemperatureLight(ip, username, id));
275 light->colorType = ColorType::TEMPERATURE; 275 light->colorType = ColorType::TEMPERATURE;
276 return light; 276 return light;
277 } 277 }
@@ -311,4 +311,4 @@ void Hue::refreshState() @@ -311,4 +311,4 @@ void Hue::refreshState()
311 { 311 {
312 std::cout << "Answer in refreshState() of HttpHandler().sendRequestGetBody() is not expected!\n"; 312 std::cout << "Answer in refreshState() of HttpHandler().sendRequestGetBody() is not expected!\n";
313 } 313 }
314 -}  
315 \ No newline at end of file 314 \ No newline at end of file
  315 +}
hueplusplus/HueLight.cpp
@@ -696,14 +696,14 @@ bool HueColorLight::alertHueSaturation(uint16_t hue, uint8_t sat) @@ -696,14 +696,14 @@ bool HueColorLight::alertHueSaturation(uint16_t hue, uint8_t sat)
696 { 696 {
697 return false; 697 return false;
698 } 698 }
699 - std::this_thread::sleep_for(std::chrono::smilliseconds(1500)); 699 + std::this_thread::sleep_for(std::chrono::milliseconds(1500));
700 if (!on) 700 if (!on)
701 { 701 {
702 return OffNoRefresh(1); 702 return OffNoRefresh(1);
703 } 703 }
704 else 704 else
705 { 705 {
706 - return return setColorXY(oldX, oldY, 1); 706 + return setColorXY(oldX, oldY, 1);
707 } 707 }
708 } 708 }
709 else 709 else