Created
April 6, 2016 01:20
-
-
Save ArthurYidi/67ab053b0164eea101b2690f4f562108 to your computer and use it in GitHub Desktop.
Bluetooth Report HID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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