MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / SendReply_ControllerData

Method SendReply_ControllerData

NetworkServer.cpp:939–963  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

937}
938
939void NetworkServer::SendReply_ControllerData(SOCKET client_sock, unsigned int dev_idx, unsigned int protocol_version)
940{
941 if(dev_idx < controllers.size())
942 {
943 NetPacketHeader reply_hdr;
944 unsigned char *reply_data = controllers[dev_idx]->GetDeviceDescription(protocol_version);
945 unsigned int reply_size;
946
947 memcpy(&reply_size, reply_data, sizeof(reply_size));
948
949 reply_hdr.pkt_magic[0] = 'O';
950 reply_hdr.pkt_magic[1] = 'R';
951 reply_hdr.pkt_magic[2] = 'G';
952 reply_hdr.pkt_magic[3] = 'B';
953
954 reply_hdr.pkt_dev_idx = dev_idx;
955 reply_hdr.pkt_id = NET_PACKET_ID_REQUEST_CONTROLLER_DATA;
956 reply_hdr.pkt_size = reply_size;
957
958 send(client_sock, (const char *)&reply_hdr, sizeof(NetPacketHeader), 0);
959 send(client_sock, (const char *)reply_data, reply_size, 0);
960
961 delete[] reply_data;
962 }
963}
964
965void NetworkServer::SendReply_ProtocolVersion(SOCKET client_sock)
966{

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
GetDeviceDescriptionMethod · 0.45

Tested by

no test coverage detected