MCPcopy Create free account
hub / github.com/360Controller/360Controller / receivedMessage

Method receivedMessage

WirelessGamingReceiver/WirelessHIDDevice.cpp:181–219  ·  view source on GitHub ↗

Process new data

Source from the content-addressed store, hash-verified

179
180// Process new data
181void WirelessHIDDevice::receivedMessage(IOMemoryDescriptor *data)
182{
183 unsigned char buf[29];
184
185 if (data->getLength() != 29)
186 return;
187
188 data->readBytes(0, buf, 29);
189
190 switch (buf[1])
191 {
192 case 0x0f: // Initial info
193 if (buf[16] == 0x13)
194 receivedUpdate(0x13, buf + 17);
195 serialString[0] = HexData[(buf[0x0A] & 0xF0) >> 4];
196 serialString[1] = HexData[buf[0x0A] & 0x0F];
197 serialString[2] = HexData[(buf[0x0B] & 0xF0) >> 4];
198 serialString[3] = HexData[buf[0x0B] & 0x0F];
199 serialString[4] = HexData[(buf[0x0C] & 0xF0) >> 4];
200 serialString[5] = HexData[buf[0x0C] & 0x0F];
201 serialString[6] = HexData[(buf[0x0D] & 0xF0) >> 4];
202 serialString[7] = HexData[buf[0x0D] & 0x0F];
203 serialString[8] = '\0';
204 IOLog("Got serial number: %s", serialString);
205 break;
206
207 case 0x01: // HID info update
208 if (buf[3] == 0xf0)
209 receivedHIDupdate(buf + 4, buf[5]);
210 break;
211
212 case 0x00: // Info update
213 receivedUpdate(buf[3], buf + 4);
214 break;
215
216 default:
217 break;
218 }
219}
220
221// Received an update of a specific value
222void WirelessHIDDevice::receivedUpdate(unsigned char type, unsigned char *data)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected