Send color data over the network when calling color update functions

This commit is contained in:
Adam Honse 2020-04-25 18:58:43 -05:00
parent 450f438538
commit 39c5aff864
6 changed files with 250 additions and 26 deletions

View file

@ -202,6 +202,7 @@ void NetworkServer::ListenThread(SOCKET * client_sock)
if(header.pkt_dev_idx < controllers.size())
{
controllers[header.pkt_dev_idx]->SetColorDescription((unsigned char *)data);
controllers[header.pkt_dev_idx]->UpdateLEDs();
}
break;
@ -209,12 +210,13 @@ void NetworkServer::ListenThread(SOCKET * client_sock)
case NET_PACKET_ID_RGBCONTROLLER_UPDATEZONELEDS:
printf( "NET_PACKET_ID_RGBCONTROLLER_UPDATEZONELEDS\r\n" );
if((header.pkt_dev_idx < controllers.size()) && (header.pkt_size == sizeof(int)))
if(header.pkt_dev_idx < controllers.size())
{
int zone;
memcpy(&zone, data, sizeof(int));
memcpy(&zone, &data[sizeof(unsigned int)], sizeof(int));
controllers[header.pkt_dev_idx]->SetZoneColorDescription((unsigned char *)data);
controllers[header.pkt_dev_idx]->UpdateZoneLEDs(zone);
}
break;
@ -222,12 +224,13 @@ void NetworkServer::ListenThread(SOCKET * client_sock)
case NET_PACKET_ID_RGBCONTROLLER_UPDATESINGLELED:
printf( "NET_PACKET_ID_RGBCONTROLLER_UPDATESINGLELED\r\n" );
if((header.pkt_dev_idx < controllers.size()) && (header.pkt_size == sizeof(int)))
if(header.pkt_dev_idx < controllers.size())
{
int led;
memcpy(&led, data, sizeof(int));
controllers[header.pkt_dev_idx]->SetSingleLEDColorDescription((unsigned char *)data);
controllers[header.pkt_dev_idx]->UpdateSingleLED(led);
}
break;