Skip to content

Instantly share code, notes, and snippets.

@ArthurYidi
Created April 6, 2016 01:20
Show Gist options
  • Save ArthurYidi/67ab053b0164eea101b2690f4f562108 to your computer and use it in GitHub Desktop.
Save ArthurYidi/67ab053b0164eea101b2690f4f562108 to your computer and use it in GitHub Desktop.
Bluetooth Report HID
print("Device Connected \(device.addressString)")
let services = device.services?[1] as? IOBluetoothSDPServiceRecord
let report = services?.getAttributeDataElement(518)?.getArrayValue()
let reportDict = report?[0] as? IOBluetoothSDPDataElement
let reportDescriptorElement = reportDict?.getArrayValue()[1] as? IOBluetoothSDPDataElement
if let reportDescriptor = reportDescriptorElement?.getDataValue() {
var data = [UInt8](count: reportDescriptor.length, repeatedValue: 0)
reportDescriptor.getBytes(&data, length: reportDescriptor.length)
print(hex(data))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment