iohidmanager 0.7.1

Safe Rust bindings for Apple's IOKit HID — enumerate, inspect, and subscribe to HID devices on macOS
Documentation
import Foundation

private let servicePlugInBytes: [[UInt8]] = [
    [0x13, 0xAA, 0x9C, 0x44, 0x6F, 0x1B, 0x11, 0xD4, 0x90, 0x7C, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5],
    [0x7D, 0xDE, 0xEC, 0xA8, 0xA7, 0xB4, 0x11, 0xDA, 0x8A, 0x0E, 0x00, 0x14, 0x51, 0x97, 0x58, 0xEF],
    [0x47, 0x4B, 0xDC, 0x8E, 0x9F, 0x4A, 0x11, 0xDA, 0xB3, 0x66, 0x00, 0x0D, 0x93, 0x6D, 0x06, 0xD2],
    [0xB4, 0x73, 0x25, 0x6C, 0x6A, 0x72, 0x4E, 0x04, 0xB6, 0x94, 0xC4, 0x00, 0x1D, 0x20, 0x20, 0x20],
    [0x2E, 0xC7, 0x8B, 0xDB, 0x9F, 0x4E, 0x11, 0xDA, 0xB6, 0x5C, 0x00, 0x0D, 0x93, 0x6D, 0x06, 0xD2],
    [0x1F, 0x2E, 0x78, 0xFA, 0x9F, 0xFA, 0x11, 0xDA, 0x90, 0xB4, 0x00, 0x0D, 0x93, 0x6D, 0x06, 0xD2],
]

@_cdecl("iohidmanager_swift_service_plugin_uuid")
public func iohidmanager_swift_service_plugin_uuid(
    _ kind: UInt32,
    _ outBytes: UnsafeMutablePointer<UInt8>?
) -> Bool {
    guard let outBytes, Int(kind) < servicePlugInBytes.count else {
        return false
    }
    for (index, value) in servicePlugInBytes[Int(kind)].enumerated() {
        outBytes[index] = value
    }
    return true
}