-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from sidoh/udp_presets
Add support for UDP presets
- Loading branch information
Showing
10 changed files
with
207 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,53 @@ | ||
#include <V6CctCommandHandler.h> | ||
|
||
bool V6CctCommandHandler::handlePreset( | ||
MiLightClient* client, | ||
uint8_t commandLsb, | ||
uint32_t commandArg) | ||
{ | ||
return false; | ||
} | ||
|
||
bool V6CctCommandHandler::handleCommand( | ||
MiLightClient* client, | ||
uint16_t deviceId, | ||
uint8_t group, | ||
MiLightClient* client, | ||
uint32_t command, | ||
uint32_t commandArg) | ||
{ | ||
const uint8_t cmd = command & 0xFF; | ||
const uint8_t arg = commandArg >> 24; | ||
|
||
client->prepare(MilightCctConfig, deviceId, group); | ||
|
||
|
||
if (cmd == V2_CCT_COMMAND_PREFIX) { | ||
switch (arg) { | ||
case V2_CCT_ON: | ||
client->updateStatus(ON); | ||
break; | ||
|
||
case V2_CCT_OFF: | ||
client->updateStatus(OFF); | ||
break; | ||
|
||
case V2_CCT_BRIGHTNESS_DOWN: | ||
client->decreaseBrightness(); | ||
break; | ||
|
||
case V2_CCT_BRIGHTNESS_UP: | ||
client->increaseBrightness(); | ||
break; | ||
|
||
case V2_CCT_TEMPERATURE_DOWN: | ||
client->decreaseTemperature(); | ||
break; | ||
|
||
case V2_CCT_TEMPERATURE_UP: | ||
client->increaseTemperature(); | ||
break; | ||
|
||
default: | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.