MCPcopy Create free account
hub / github.com/awawa-dev/HyperHDR / prepareStreamData

Method prepareStreamData

sources/led-drivers/net/DriverNetPhilipsHue.cpp:1678–1707  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1676}
1677
1678std::vector<uint8_t> DriverNetPhilipsHue::prepareStreamData() const
1679{
1680 std::vector<uint8_t> payload;
1681
1682 payload.reserve(sizeof(HEADER) + 9 * _lights.size());
1683
1684 for (size_t i = 0; i < sizeof(HEADER); i++)
1685 payload.push_back(HEADER[i]);
1686
1687 for (const PhilipsHueLight& light : _lights)
1688 {
1689 CiColor lightC = light.getColor();
1690 quint64 R = lightC.x * 0xffff;
1691 quint64 G = lightC.y * 0xffff;
1692 quint64 B = lightC.bri * 0xffff;
1693 unsigned int id = light.getId();
1694
1695 payload.push_back(0x00);
1696 payload.push_back(0x00);
1697 payload.push_back(static_cast<uint8_t>(id));
1698 payload.push_back(static_cast<uint8_t>((R >> 8) & 0xff));
1699 payload.push_back(static_cast<uint8_t>(R & 0xff));
1700 payload.push_back(static_cast<uint8_t>((G >> 8) & 0xff));
1701 payload.push_back(static_cast<uint8_t>(G & 0xff));
1702 payload.push_back(static_cast<uint8_t>((B >> 8) & 0xff));
1703 payload.push_back(static_cast<uint8_t>(B & 0xff));
1704 }
1705
1706 return payload;
1707}
1708
1709int DriverNetPhilipsHue::close()
1710{

Callers

nothing calls this directly

Calls 3

getColorMethod · 0.80
sizeMethod · 0.45
getIdMethod · 0.45

Tested by

no test coverage detected