HIDEventAccessors.m   [plain text]

//
// HIDEventAccessors.m
//

//
// DO NOT EDIT THIS FILE. IT IS AUTO-GENERATED
//

#import "HIDEvent.h"
#import <IOKit/hid/IOHIDEventPrivate.h>
#import <IOKit/hid/IOHIDEventData.h>

@implementation HIDEvent (HIDVendorDefinedEvent)

+ (instancetype)vendorDefinedEvent:(uint64_t)timestamp usagePage:(uint16_t)usagePage usage:(uint16_t)usage version:(uint32_t)version data:(uint8_t *)data length:(uint32_t)length options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDVendorDefinedEventData) + length;
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeVendorDefined, timestamp, options);
IOHIDVendorDefinedEventData *eventData = (IOHIDVendorDefinedEventData *)event->_event.eventData;

eventData->usagePage = (uint16_t)usagePage;
eventData->usage = (uint16_t)usage;
eventData->version = (uint32_t)version;
bcopy(data, eventData->data, length);
eventData->length = (uint32_t)length;

return event;
}

@end

@implementation HIDEvent (HIDVendorDefinedEventPrivate)

- (uint8_t *)vendorDefinedData {
return (uint8_t *)IOHIDEventGetDataValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldVendorDefinedData);
}

- (uint32_t)vendorDefinedDataLength {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldVendorDefinedDataLength);
}

- (uint16_t)vendorDefinedUsage {
return (uint16_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldVendorDefinedUsage);
}

- (void)setVendorDefinedUsage:(uint16_t)vendorDefinedUsage {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldVendorDefinedUsage, (CFIndex)vendorDefinedUsage);
}

- (uint16_t)vendorDefinedUsagePage {
return (uint16_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldVendorDefinedUsagePage);
}

- (void)setVendorDefinedUsagePage:(uint16_t)vendorDefinedUsagePage {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldVendorDefinedUsagePage, (CFIndex)vendorDefinedUsagePage);
}

- (uint32_t)vendorDefinedVersion {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldVendorDefinedVersion);
}

- (void)setVendorDefinedVersion:(uint32_t)vendorDefinedVersion {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldVendorDefinedVersion, (CFIndex)vendorDefinedVersion);
}

@end

@implementation HIDEvent (HIDTemperatureEvent)

+ (instancetype)temperatureEvent:(uint64_t)timestamp level:(double)level options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDTemperatureEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeTemperature, timestamp, options);
IOHIDTemperatureEventData *eventData = (IOHIDTemperatureEventData *)event->_event.eventData;

eventData->level = CAST_DOUBLE_TO_FIXED(level);

return event;
}

@end

@implementation HIDEvent (HIDTemperatureEventPrivate)

- (double)temperatureLevel {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldTemperatureLevel);
}

- (void)setTemperatureLevel:(double)temperatureLevel {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldTemperatureLevel, (IOHIDFloat)temperatureLevel);
}

@end

@implementation HIDEvent (HIDAccelerometerEvent)

+ (instancetype)accelerometerEvent:(uint64_t)timestamp x:(double)x y:(double)y z:(double)z options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDAccelerometerEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeAccelerometer, timestamp, options);
IOHIDAccelerometerEventData *eventData = (IOHIDAccelerometerEventData *)event->_event.eventData;

eventData->position.x = CAST_DOUBLE_TO_FIXED(x);
eventData->position.y = CAST_DOUBLE_TO_FIXED(y);
eventData->position.z = CAST_DOUBLE_TO_FIXED(z);

return event;
}

@end

@implementation HIDEvent (HIDAccelerometerEventPrivate)

- (uint32_t)accelerometerSequence {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAccelerometerSequence);
}

- (void)setAccelerometerSequence:(uint32_t)accelerometerSequence {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAccelerometerSequence, (CFIndex)accelerometerSequence);
}

- (uint32_t)accelerometerSubType {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAccelerometerSubType);
}

- (void)setAccelerometerSubType:(uint32_t)accelerometerSubType {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAccelerometerSubType, (CFIndex)accelerometerSubType);
}

- (uint32_t)accelerometerType {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAccelerometerType);
}

- (void)setAccelerometerType:(uint32_t)accelerometerType {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAccelerometerType, (CFIndex)accelerometerType);
}

- (double)accelerometerX {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAccelerometerX);
}

- (void)setAccelerometerX:(double)accelerometerX {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAccelerometerX, (IOHIDFloat)accelerometerX);
}

- (double)accelerometerY {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAccelerometerY);
}

- (void)setAccelerometerY:(double)accelerometerY {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAccelerometerY, (IOHIDFloat)accelerometerY);
}

- (double)accelerometerZ {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAccelerometerZ);
}

- (void)setAccelerometerZ:(double)accelerometerZ {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAccelerometerZ, (IOHIDFloat)accelerometerZ);
}

@end

@implementation HIDEvent (HIDGenericGestureEvent)

+ (instancetype)genericGestureEvent:(uint64_t)timestamp gestureType:(IOHIDGenericGestureType)gestureType options:(uint32_t)options
{
CFIndex eventSize = sizeof(__IOHIDGenericGestureEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeGenericGesture, timestamp, options);
__IOHIDGenericGestureEventData *eventData = (__IOHIDGenericGestureEventData *)event->_event.eventData;

eventData->gestureType = (IOHIDGenericGestureType)gestureType;

return event;
}

@end

@implementation HIDEvent (HIDGenericGestureEventPrivate)

- (IOHIDGenericGestureType)genericGestureType {
return (IOHIDGenericGestureType)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGenericGestureType);
}

- (double)genericGestureTypeSwipeProgress {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGenericGestureTypeSwipeProgress);
}

- (void)setGenericGestureTypeSwipeProgress:(double)genericGestureTypeSwipeProgress {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGenericGestureTypeSwipeProgress, (IOHIDFloat)genericGestureTypeSwipeProgress);
}

- (uint32_t)genericGestureTypeTapCount {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGenericGestureTypeTapCount);
}

- (void)setGenericGestureTypeTapCount:(uint32_t)genericGestureTypeTapCount {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGenericGestureTypeTapCount, (CFIndex)genericGestureTypeTapCount);
}

@end

@implementation HIDEvent (HIDAmbientLightSensorEvent)

+ (instancetype)ambientLightSensorEvent:(uint64_t)timestamp level:(uint32_t)level options:(uint32_t)options
{
CFIndex eventSize = sizeof(__IOHIDAmbientLightSensorEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeAmbientLightSensor, timestamp, options);
__IOHIDAmbientLightSensorEventData *eventData = (__IOHIDAmbientLightSensorEventData *)event->_event.eventData;

eventData->base.level = (uint32_t)level;

return event;
}

@end

@implementation HIDEvent (HIDAmbientLightSensorEventPrivate)

- (double)ambientLightColorComponent0 {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightColorComponent0);
}

- (void)setAmbientLightColorComponent0:(double)ambientLightColorComponent0 {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightColorComponent0, (IOHIDFloat)ambientLightColorComponent0);
}

- (double)ambientLightColorComponent1 {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightColorComponent1);
}

- (void)setAmbientLightColorComponent1:(double)ambientLightColorComponent1 {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightColorComponent1, (IOHIDFloat)ambientLightColorComponent1);
}

- (double)ambientLightColorComponent2 {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightColorComponent2);
}

- (void)setAmbientLightColorComponent2:(double)ambientLightColorComponent2 {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightColorComponent2, (IOHIDFloat)ambientLightColorComponent2);
}

- (IOHIDEventColorSpace)ambientLightColorSpace {
return (IOHIDEventColorSpace)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightColorSpace);
}

- (void)setAmbientLightColorSpace:(IOHIDEventColorSpace)ambientLightColorSpace {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightColorSpace, (CFIndex)ambientLightColorSpace);
}

- (bool)ambientLightDisplayBrightnessChanged {
return (bool)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightDisplayBrightnessChanged);
}

- (void)setAmbientLightDisplayBrightnessChanged:(bool)ambientLightDisplayBrightnessChanged {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightDisplayBrightnessChanged, (CFIndex)ambientLightDisplayBrightnessChanged);
}

- (double)ambientLightSensorColorTemperature {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightSensorColorTemperature);
}

- (void)setAmbientLightSensorColorTemperature:(double)ambientLightSensorColorTemperature {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightSensorColorTemperature, (IOHIDFloat)ambientLightSensorColorTemperature);
}

- (double)ambientLightSensorIlluminance {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightSensorIlluminance);
}

- (void)setAmbientLightSensorIlluminance:(double)ambientLightSensorIlluminance {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightSensorIlluminance, (IOHIDFloat)ambientLightSensorIlluminance);
}

- (uint32_t)ambientLightSensorLevel {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightSensorLevel);
}

- (void)setAmbientLightSensorLevel:(uint32_t)ambientLightSensorLevel {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightSensorLevel, (CFIndex)ambientLightSensorLevel);
}

- (uint32_t)ambientLightSensorRawChannel0 {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightSensorRawChannel0);
}

- (void)setAmbientLightSensorRawChannel0:(uint32_t)ambientLightSensorRawChannel0 {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightSensorRawChannel0, (CFIndex)ambientLightSensorRawChannel0);
}

- (uint32_t)ambientLightSensorRawChannel1 {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightSensorRawChannel1);
}

- (void)setAmbientLightSensorRawChannel1:(uint32_t)ambientLightSensorRawChannel1 {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightSensorRawChannel1, (CFIndex)ambientLightSensorRawChannel1);
}

- (uint32_t)ambientLightSensorRawChannel2 {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightSensorRawChannel2);
}

- (void)setAmbientLightSensorRawChannel2:(uint32_t)ambientLightSensorRawChannel2 {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightSensorRawChannel2, (CFIndex)ambientLightSensorRawChannel2);
}

- (uint32_t)ambientLightSensorRawChannel3 {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightSensorRawChannel3);
}

- (void)setAmbientLightSensorRawChannel3:(uint32_t)ambientLightSensorRawChannel3 {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAmbientLightSensorRawChannel3, (CFIndex)ambientLightSensorRawChannel3);
}

@end

@implementation HIDEvent (HIDPowerEventPrivate)

- (double)powerMeasurement {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldPowerMeasurement);
}

- (void)setPowerMeasurement:(double)powerMeasurement {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldPowerMeasurement, (IOHIDFloat)powerMeasurement);
}

- (uint32_t)powerSubType {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldPowerSubType);
}

- (void)setPowerSubType:(uint32_t)powerSubType {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldPowerSubType, (CFIndex)powerSubType);
}

- (uint32_t)powerType {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldPowerType);
}

- (void)setPowerType:(uint32_t)powerType {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldPowerType, (CFIndex)powerType);
}

@end

@implementation HIDEvent (HIDForceEvent)

+ (instancetype)forceEvent:(uint64_t)timestamp behavior:(uint32_t)behavior progress:(double)progress stage:(uint32_t)stage stageProgress:(double)stageProgress options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDForceEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeForce, timestamp, options);
IOHIDForceEventData *eventData = (IOHIDForceEventData *)event->_event.eventData;

eventData->behavior = (uint32_t)behavior;
eventData->progress = CAST_DOUBLE_TO_FIXED(progress);
eventData->stage = (uint32_t)stage;
eventData->stageProgress = CAST_DOUBLE_TO_FIXED(stageProgress);

return event;
}

@end

@implementation HIDEvent (HIDForceEventPrivate)

- (uint32_t)forceBehavior {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldForceBehavior);
}

- (void)setForceBehavior:(uint32_t)forceBehavior {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldForceBehavior, (CFIndex)forceBehavior);
}

- (double)forceProgress {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldForceProgress);
}

- (void)setForceProgress:(double)forceProgress {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldForceProgress, (IOHIDFloat)forceProgress);
}

- (uint32_t)forceStage {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldForceStage);
}

- (void)setForceStage:(uint32_t)forceStage {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldForceStage, (CFIndex)forceStage);
}

- (double)forceStagePressure {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldForceStagePressure);
}

- (void)setForceStagePressure:(double)forceStagePressure {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldForceStagePressure, (IOHIDFloat)forceStagePressure);
}

@end

@implementation HIDEvent (HIDMotionGestureEvent)

+ (instancetype)motionGestureEvent:(uint64_t)timestamp gestureType:(uint32_t)gestureType progress:(double)progress options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDMotionGestureEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeMotionGesture, timestamp, options);
IOHIDMotionGestureEventData *eventData = (IOHIDMotionGestureEventData *)event->_event.eventData;

eventData->gestureType = (uint32_t)gestureType;
eventData->progress = CAST_DOUBLE_TO_FIXED(progress);

return event;
}

@end

@implementation HIDEvent (HIDMotionGestureEventPrivate)

- (uint32_t)motionGestureGestureType {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldMotionGestureGestureType);
}

- (void)setMotionGestureGestureType:(uint32_t)motionGestureGestureType {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldMotionGestureGestureType, (CFIndex)motionGestureGestureType);
}

- (double)motionGestureProgress {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldMotionGestureProgress);
}

- (void)setMotionGestureProgress:(double)motionGestureProgress {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldMotionGestureProgress, (IOHIDFloat)motionGestureProgress);
}

@end

@implementation HIDEvent (HIDGameControllerEvent)

+ (instancetype)gameControllerEvent:(uint64_t)timestamp controllerType:(uint32_t)controllerType options:(uint32_t)options
{
CFIndex eventSize = sizeof(__IOHIDGameControllerEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeGameController, timestamp, options);
__IOHIDGameControllerEventData *eventData = (__IOHIDGameControllerEventData *)event->_event.eventData;

eventData->base.controllerType = (uint32_t)controllerType;

return event;
}

@end

@implementation HIDEvent (HIDGameControllerEventPrivate)

- (double)gameControllerDirectionPadDown {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerDirectionPadDown);
}

- (void)setGameControllerDirectionPadDown:(double)gameControllerDirectionPadDown {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerDirectionPadDown, (IOHIDFloat)gameControllerDirectionPadDown);
}

- (double)gameControllerDirectionPadLeft {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerDirectionPadLeft);
}

- (void)setGameControllerDirectionPadLeft:(double)gameControllerDirectionPadLeft {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerDirectionPadLeft, (IOHIDFloat)gameControllerDirectionPadLeft);
}

- (double)gameControllerDirectionPadRight {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerDirectionPadRight);
}

- (void)setGameControllerDirectionPadRight:(double)gameControllerDirectionPadRight {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerDirectionPadRight, (IOHIDFloat)gameControllerDirectionPadRight);
}

- (double)gameControllerDirectionPadUp {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerDirectionPadUp);
}

- (void)setGameControllerDirectionPadUp:(double)gameControllerDirectionPadUp {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerDirectionPadUp, (IOHIDFloat)gameControllerDirectionPadUp);
}

- (double)gameControllerFaceButtonA {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerFaceButtonA);
}

- (void)setGameControllerFaceButtonA:(double)gameControllerFaceButtonA {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerFaceButtonA, (IOHIDFloat)gameControllerFaceButtonA);
}

- (double)gameControllerFaceButtonB {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerFaceButtonB);
}

- (void)setGameControllerFaceButtonB:(double)gameControllerFaceButtonB {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerFaceButtonB, (IOHIDFloat)gameControllerFaceButtonB);
}

- (double)gameControllerFaceButtonX {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerFaceButtonX);
}

- (void)setGameControllerFaceButtonX:(double)gameControllerFaceButtonX {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerFaceButtonX, (IOHIDFloat)gameControllerFaceButtonX);
}

- (double)gameControllerFaceButtonY {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerFaceButtonY);
}

- (void)setGameControllerFaceButtonY:(double)gameControllerFaceButtonY {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerFaceButtonY, (IOHIDFloat)gameControllerFaceButtonY);
}

- (double)gameControllerJoyStickAxisRz {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerJoyStickAxisRz);
}

- (void)setGameControllerJoyStickAxisRz:(double)gameControllerJoyStickAxisRz {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerJoyStickAxisRz, (IOHIDFloat)gameControllerJoyStickAxisRz);
}

- (double)gameControllerJoyStickAxisX {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerJoyStickAxisX);
}

- (void)setGameControllerJoyStickAxisX:(double)gameControllerJoyStickAxisX {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerJoyStickAxisX, (IOHIDFloat)gameControllerJoyStickAxisX);
}

- (double)gameControllerJoyStickAxisY {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerJoyStickAxisY);
}

- (void)setGameControllerJoyStickAxisY:(double)gameControllerJoyStickAxisY {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerJoyStickAxisY, (IOHIDFloat)gameControllerJoyStickAxisY);
}

- (double)gameControllerJoyStickAxisZ {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerJoyStickAxisZ);
}

- (void)setGameControllerJoyStickAxisZ:(double)gameControllerJoyStickAxisZ {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerJoyStickAxisZ, (IOHIDFloat)gameControllerJoyStickAxisZ);
}

- (double)gameControllerShoulderButtonL1 {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerShoulderButtonL1);
}

- (void)setGameControllerShoulderButtonL1:(double)gameControllerShoulderButtonL1 {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerShoulderButtonL1, (IOHIDFloat)gameControllerShoulderButtonL1);
}

- (double)gameControllerShoulderButtonL2 {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerShoulderButtonL2);
}

- (void)setGameControllerShoulderButtonL2:(double)gameControllerShoulderButtonL2 {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerShoulderButtonL2, (IOHIDFloat)gameControllerShoulderButtonL2);
}

- (double)gameControllerShoulderButtonR1 {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerShoulderButtonR1);
}

- (void)setGameControllerShoulderButtonR1:(double)gameControllerShoulderButtonR1 {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerShoulderButtonR1, (IOHIDFloat)gameControllerShoulderButtonR1);
}

- (double)gameControllerShoulderButtonR2 {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerShoulderButtonR2);
}

- (void)setGameControllerShoulderButtonR2:(double)gameControllerShoulderButtonR2 {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerShoulderButtonR2, (IOHIDFloat)gameControllerShoulderButtonR2);
}

- (uint32_t)gameControllerThumbstickButtonLeft {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerThumbstickButtonLeft);
}

- (void)setGameControllerThumbstickButtonLeft:(uint32_t)gameControllerThumbstickButtonLeft {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerThumbstickButtonLeft, (CFIndex)gameControllerThumbstickButtonLeft);
}

- (uint32_t)gameControllerThumbstickButtonRight {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerThumbstickButtonRight);
}

- (void)setGameControllerThumbstickButtonRight:(uint32_t)gameControllerThumbstickButtonRight {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerThumbstickButtonRight, (CFIndex)gameControllerThumbstickButtonRight);
}

- (uint32_t)gameControllerType {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerType);
}

- (void)setGameControllerType:(uint32_t)gameControllerType {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGameControllerType, (CFIndex)gameControllerType);
}

@end

@implementation HIDEvent (HIDDigitizerEvent)

+ (instancetype)digitizerEvent:(uint64_t)timestamp transducerType:(uint32_t)transducerType x:(double)x y:(double)y z:(double)z options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDDigitizerEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeDigitizer, timestamp, options);
IOHIDDigitizerEventData *eventData = (IOHIDDigitizerEventData *)event->_event.eventData;

eventData->transducerType = (uint32_t)transducerType;
eventData->position.x = CAST_DOUBLE_TO_FIXED(x);
eventData->position.y = CAST_DOUBLE_TO_FIXED(y);
eventData->position.z = CAST_DOUBLE_TO_FIXED(z);

return event;
}

+ (instancetype)tiltDigitizerEvent:(uint64_t)timestamp x:(double)x y:(double)y options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDDigitizerEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeDigitizer, timestamp, options);
IOHIDDigitizerEventData *eventData = (IOHIDDigitizerEventData *)event->_event.eventData;

eventData->orientationType = kIOHIDDigitizerOrientationTypeTilt;
eventData->orientation.tilt.x = CAST_DOUBLE_TO_FIXED(x);
eventData->orientation.tilt.y = CAST_DOUBLE_TO_FIXED(y);

return event;
}

+ (instancetype)polarDigitizerEvent:(uint64_t)timestamp altitude:(double)altitude azimuth:(double)azimuth quality:(double)quality density:(double)density majorRadius:(double)majorRadius minorRadius:(double)minorRadius options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDDigitizerEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeDigitizer, timestamp, options);
IOHIDDigitizerEventData *eventData = (IOHIDDigitizerEventData *)event->_event.eventData;

eventData->orientationType = kIOHIDDigitizerOrientationTypePolar;
eventData->orientation.polar.altitude = CAST_DOUBLE_TO_FIXED(altitude);
eventData->orientation.polar.azimuth = CAST_DOUBLE_TO_FIXED(azimuth);
eventData->orientation.polar.quality = CAST_DOUBLE_TO_FIXED(quality);
eventData->orientation.polar.density = CAST_DOUBLE_TO_FIXED(density);
eventData->orientation.polar.majorRadius = CAST_DOUBLE_TO_FIXED(majorRadius);
eventData->orientation.polar.minorRadius = CAST_DOUBLE_TO_FIXED(minorRadius);

return event;
}

+ (instancetype)qualityDigitizerEvent:(uint64_t)timestamp quality:(double)quality density:(double)density irregularity:(double)irregularity majorRadius:(double)majorRadius minorRadius:(double)minorRadius accuracy:(double)accuracy options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDDigitizerEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeDigitizer, timestamp, options);
IOHIDDigitizerEventData *eventData = (IOHIDDigitizerEventData *)event->_event.eventData;

eventData->orientationType = kIOHIDDigitizerOrientationTypeQuality;
eventData->orientation.quality.quality = CAST_DOUBLE_TO_FIXED(quality);
eventData->orientation.quality.density = CAST_DOUBLE_TO_FIXED(density);
eventData->orientation.quality.irregularity = CAST_DOUBLE_TO_FIXED(irregularity);
eventData->orientation.quality.majorRadius = CAST_DOUBLE_TO_FIXED(majorRadius);
eventData->orientation.quality.minorRadius = CAST_DOUBLE_TO_FIXED(minorRadius);
eventData->orientation.quality.accuracy = CAST_DOUBLE_TO_FIXED(accuracy);

return event;
}

@end

@implementation HIDEvent (HIDDigitizerEventPrivate)

- (double)digitizerAltitude {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerAltitude);
}

- (void)setDigitizerAltitude:(double)digitizerAltitude {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerAltitude, (IOHIDFloat)digitizerAltitude);
}

- (double)digitizerAuxiliaryPressure {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerAuxiliaryPressure);
}

- (void)setDigitizerAuxiliaryPressure:(double)digitizerAuxiliaryPressure {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerAuxiliaryPressure, (IOHIDFloat)digitizerAuxiliaryPressure);
}

- (double)digitizerAzimuth {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerAzimuth);
}

- (void)setDigitizerAzimuth:(double)digitizerAzimuth {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerAzimuth, (IOHIDFloat)digitizerAzimuth);
}

- (uint32_t)digitizerButtonMask {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerButtonMask);
}

- (void)setDigitizerButtonMask:(uint32_t)digitizerButtonMask {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerButtonMask, (CFIndex)digitizerButtonMask);
}

- (uint32_t)digitizerChildEventMask {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerChildEventMask);
}

- (void)setDigitizerChildEventMask:(uint32_t)digitizerChildEventMask {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerChildEventMask, (CFIndex)digitizerChildEventMask);
}

- (uint32_t)digitizerCollection {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerCollection);
}

- (void)setDigitizerCollection:(uint32_t)digitizerCollection {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerCollection, (CFIndex)digitizerCollection);
}

- (double)digitizerDensity {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerDensity);
}

- (void)setDigitizerDensity:(double)digitizerDensity {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerDensity, (IOHIDFloat)digitizerDensity);
}

- (uint32_t)digitizerDidUpdateMask {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerDidUpdateMask);
}

- (void)setDigitizerDidUpdateMask:(uint32_t)digitizerDidUpdateMask {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerDidUpdateMask, (CFIndex)digitizerDidUpdateMask);
}

- (uint32_t)digitizerEventMask {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerEventMask);
}

- (void)setDigitizerEventMask:(uint32_t)digitizerEventMask {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerEventMask, (CFIndex)digitizerEventMask);
}

- (uint32_t)digitizerGenerationCount {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerGenerationCount);
}

- (void)setDigitizerGenerationCount:(uint32_t)digitizerGenerationCount {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerGenerationCount, (CFIndex)digitizerGenerationCount);
}

- (uint32_t)digitizerIdentity {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerIdentity);
}

- (void)setDigitizerIdentity:(uint32_t)digitizerIdentity {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerIdentity, (CFIndex)digitizerIdentity);
}

- (uint32_t)digitizerIndex {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerIndex);
}

- (void)setDigitizerIndex:(uint32_t)digitizerIndex {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerIndex, (CFIndex)digitizerIndex);
}

- (double)digitizerIrregularity {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerIrregularity);
}

- (void)setDigitizerIrregularity:(double)digitizerIrregularity {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerIrregularity, (IOHIDFloat)digitizerIrregularity);
}

- (uint32_t)digitizerIsDisplayIntegrated {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerIsDisplayIntegrated);
}

- (void)setDigitizerIsDisplayIntegrated:(uint32_t)digitizerIsDisplayIntegrated {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerIsDisplayIntegrated, (CFIndex)digitizerIsDisplayIntegrated);
}

- (double)digitizerMajorRadius {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerMajorRadius);
}

- (void)setDigitizerMajorRadius:(double)digitizerMajorRadius {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerMajorRadius, (IOHIDFloat)digitizerMajorRadius);
}

- (double)digitizerMinorRadius {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerMinorRadius);
}

- (void)setDigitizerMinorRadius:(double)digitizerMinorRadius {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerMinorRadius, (IOHIDFloat)digitizerMinorRadius);
}

- (uint32_t)digitizerOrientationType {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerOrientationType);
}

- (double)digitizerPressure {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerPressure);
}

- (void)setDigitizerPressure:(double)digitizerPressure {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerPressure, (IOHIDFloat)digitizerPressure);
}

- (double)digitizerQuality {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerQuality);
}

- (void)setDigitizerQuality:(double)digitizerQuality {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerQuality, (IOHIDFloat)digitizerQuality);
}

- (double)digitizerQualityRadiiAccuracy {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerQualityRadiiAccuracy);
}

- (void)setDigitizerQualityRadiiAccuracy:(double)digitizerQualityRadiiAccuracy {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerQualityRadiiAccuracy, (IOHIDFloat)digitizerQualityRadiiAccuracy);
}

- (uint32_t)digitizerRange {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerRange);
}

- (void)setDigitizerRange:(uint32_t)digitizerRange {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerRange, (CFIndex)digitizerRange);
}

- (double)digitizerTiltX {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerTiltX);
}

- (void)setDigitizerTiltX:(double)digitizerTiltX {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerTiltX, (IOHIDFloat)digitizerTiltX);
}

- (double)digitizerTiltY {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerTiltY);
}

- (void)setDigitizerTiltY:(double)digitizerTiltY {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerTiltY, (IOHIDFloat)digitizerTiltY);
}

- (uint32_t)digitizerTouch {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerTouch);
}

- (void)setDigitizerTouch:(uint32_t)digitizerTouch {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerTouch, (CFIndex)digitizerTouch);
}

- (double)digitizerTwist {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerTwist);
}

- (void)setDigitizerTwist:(double)digitizerTwist {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerTwist, (IOHIDFloat)digitizerTwist);
}

- (uint32_t)digitizerType {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerType);
}

- (void)setDigitizerType:(uint32_t)digitizerType {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerType, (CFIndex)digitizerType);
}

- (uint32_t)digitizerWillUpdateMask {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerWillUpdateMask);
}

- (void)setDigitizerWillUpdateMask:(uint32_t)digitizerWillUpdateMask {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerWillUpdateMask, (CFIndex)digitizerWillUpdateMask);
}

- (double)digitizerX {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerX);
}

- (void)setDigitizerX:(double)digitizerX {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerX, (IOHIDFloat)digitizerX);
}

- (double)digitizerY {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerY);
}

- (void)setDigitizerY:(double)digitizerY {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerY, (IOHIDFloat)digitizerY);
}

- (double)digitizerZ {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerZ);
}

- (void)setDigitizerZ:(double)digitizerZ {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldDigitizerZ, (IOHIDFloat)digitizerZ);
}

@end

@implementation HIDEvent (HIDCompassEvent)

+ (instancetype)compassEvent:(uint64_t)timestamp x:(double)x y:(double)y z:(double)z options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDCompassEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeCompass, timestamp, options);
IOHIDCompassEventData *eventData = (IOHIDCompassEventData *)event->_event.eventData;

eventData->position.x = CAST_DOUBLE_TO_FIXED(x);
eventData->position.y = CAST_DOUBLE_TO_FIXED(y);
eventData->position.z = CAST_DOUBLE_TO_FIXED(z);

return event;
}

@end

@implementation HIDEvent (HIDCompassEventPrivate)

- (uint32_t)compassSequence {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldCompassSequence);
}

- (void)setCompassSequence:(uint32_t)compassSequence {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldCompassSequence, (CFIndex)compassSequence);
}

- (uint32_t)compassSubType {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldCompassSubType);
}

- (void)setCompassSubType:(uint32_t)compassSubType {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldCompassSubType, (CFIndex)compassSubType);
}

- (uint32_t)compassType {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldCompassType);
}

- (void)setCompassType:(uint32_t)compassType {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldCompassType, (CFIndex)compassType);
}

- (double)compassX {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldCompassX);
}

- (void)setCompassX:(double)compassX {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldCompassX, (IOHIDFloat)compassX);
}

- (double)compassY {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldCompassY);
}

- (void)setCompassY:(double)compassY {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldCompassY, (IOHIDFloat)compassY);
}

- (double)compassZ {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldCompassZ);
}

- (void)setCompassZ:(double)compassZ {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldCompassZ, (IOHIDFloat)compassZ);
}

@end

@implementation HIDEvent (HIDMotionActivityEvent)

+ (instancetype)motionActivityEvent:(uint64_t)timestamp activityType:(uint32_t)activityType confidence:(double)confidence options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDMotionActivityEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeMotionActivity, timestamp, options);
IOHIDMotionActivityEventData *eventData = (IOHIDMotionActivityEventData *)event->_event.eventData;

eventData->activityType = (uint32_t)activityType;
eventData->confidence = CAST_DOUBLE_TO_FIXED(confidence);

return event;
}

@end

@implementation HIDEvent (HIDMotionActivityEventPrivate)

- (uint32_t)motionActivityActivityType {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldMotionActivityActivityType);
}

- (void)setMotionActivityActivityType:(uint32_t)motionActivityActivityType {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldMotionActivityActivityType, (CFIndex)motionActivityActivityType);
}

- (double)motionActivityConfidence {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldMotionActivityConfidence);
}

- (void)setMotionActivityConfidence:(double)motionActivityConfidence {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldMotionActivityConfidence, (IOHIDFloat)motionActivityConfidence);
}

@end

@implementation HIDEvent (HIDBrightnessEvent)

+ (instancetype)brightnessEvent:(uint64_t)timestamp currentBrightness:(double)currentBrightness targetBrightness:(double)targetBrightness transitionTime:(uint64_t)transitionTime options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDBrightnessEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeBrightness, timestamp, options);
IOHIDBrightnessEventData *eventData = (IOHIDBrightnessEventData *)event->_event.eventData;

eventData->currentBrightness = CAST_DOUBLE_TO_FIXED(currentBrightness);
eventData->targetBrightness = CAST_DOUBLE_TO_FIXED(targetBrightness);
eventData->transitionTime = (uint64_t)transitionTime;

return event;
}

@end

@implementation HIDEvent (HIDBrightnessEventPrivate)

- (double)currentBrightness {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldCurrentBrightness);
}

- (void)setCurrentBrightness:(double)currentBrightness {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldCurrentBrightness, (IOHIDFloat)currentBrightness);
}

- (double)targetBrightness {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldTargetBrightness);
}

- (void)setTargetBrightness:(double)targetBrightness {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldTargetBrightness, (IOHIDFloat)targetBrightness);
}

- (uint64_t)transitionTime {
return (uint64_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldTransitionTime);
}

- (void)setTransitionTime:(uint64_t)transitionTime {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldTransitionTime, (CFIndex)transitionTime);
}

@end

@implementation HIDEvent (HIDGyroEvent)

+ (instancetype)gyroEvent:(uint64_t)timestamp x:(double)x y:(double)y z:(double)z options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDGyroEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeGyro, timestamp, options);
IOHIDGyroEventData *eventData = (IOHIDGyroEventData *)event->_event.eventData;

eventData->position.x = CAST_DOUBLE_TO_FIXED(x);
eventData->position.y = CAST_DOUBLE_TO_FIXED(y);
eventData->position.z = CAST_DOUBLE_TO_FIXED(z);

return event;
}

@end

@implementation HIDEvent (HIDGyroEventPrivate)

- (uint32_t)gyroSequence {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGyroSequence);
}

- (void)setGyroSequence:(uint32_t)gyroSequence {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGyroSequence, (CFIndex)gyroSequence);
}

- (uint32_t)gyroSubType {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGyroSubType);
}

- (void)setGyroSubType:(uint32_t)gyroSubType {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGyroSubType, (CFIndex)gyroSubType);
}

- (uint32_t)gyroType {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGyroType);
}

- (void)setGyroType:(uint32_t)gyroType {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGyroType, (CFIndex)gyroType);
}

- (double)gyroX {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGyroX);
}

- (void)setGyroX:(double)gyroX {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGyroX, (IOHIDFloat)gyroX);
}

- (double)gyroY {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGyroY);
}

- (void)setGyroY:(double)gyroY {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGyroY, (IOHIDFloat)gyroY);
}

- (double)gyroZ {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGyroZ);
}

- (void)setGyroZ:(double)gyroZ {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldGyroZ, (IOHIDFloat)gyroZ);
}

@end

@implementation HIDEvent (HIDButtonEvent)

+ (instancetype)buttonEvent:(uint64_t)timestamp buttonMask:(uint32_t)buttonMask options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDButtonEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeButton, timestamp, options);
IOHIDButtonEventData *eventData = (IOHIDButtonEventData *)event->_event.eventData;

eventData->mask = (uint32_t)buttonMask;

return event;
}

@end

@implementation HIDEvent (HIDButtonEventPrivate)

- (uint8_t)buttonClickCount {
return (uint8_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldButtonClickCount);
}

- (void)setButtonClickCount:(uint8_t)buttonClickCount {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldButtonClickCount, (CFIndex)buttonClickCount);
}

- (uint32_t)buttonMask {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldButtonMask);
}

- (void)setButtonMask:(uint32_t)buttonMask {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldButtonMask, (CFIndex)buttonMask);
}

- (uint8_t)buttonNumber {
return (uint8_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldButtonNumber);
}

- (void)setButtonNumber:(uint8_t)buttonNumber {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldButtonNumber, (CFIndex)buttonNumber);
}

- (double)buttonPressure {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldButtonPressure);
}

- (void)setButtonPressure:(double)buttonPressure {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldButtonPressure, (IOHIDFloat)buttonPressure);
}

- (uint32_t)buttonState {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldButtonState);
}

- (void)setButtonState:(uint32_t)buttonState {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldButtonState, (CFIndex)buttonState);
}

@end

@implementation HIDEvent (HIDAtmosphericPressureEvent)

+ (instancetype)atmosphericPressureEvent:(uint64_t)timestamp level:(double)level sequence:(uint32_t)sequence options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDAtmosphericPressureEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeAtmosphericPressure, timestamp, options);
IOHIDAtmosphericPressureEventData *eventData = (IOHIDAtmosphericPressureEventData *)event->_event.eventData;

eventData->level = CAST_DOUBLE_TO_FIXED(level);
eventData->sequence = (uint32_t)sequence;

return event;
}

@end

@implementation HIDEvent (HIDAtmosphericPressureEventPrivate)

- (double)atmosphericPressureLevel {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAtmosphericPressureLevel);
}

- (void)setAtmosphericPressureLevel:(double)atmosphericPressureLevel {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAtmosphericPressureLevel, (IOHIDFloat)atmosphericPressureLevel);
}

- (uint32_t)atmosphericSequence {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAtmosphericSequence);
}

- (void)setAtmosphericSequence:(uint32_t)atmosphericSequence {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldAtmosphericSequence, (CFIndex)atmosphericSequence);
}

@end

@implementation HIDEvent (HIDHumidityEventPrivate)

- (double)humidityRH {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldHumidityRH);
}

- (void)setHumidityRH:(double)humidityRH {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldHumidityRH, (IOHIDFloat)humidityRH);
}

- (uint32_t)humiditySequence {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldHumiditySequence);
}

- (void)setHumiditySequence:(uint32_t)humiditySequence {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldHumiditySequence, (CFIndex)humiditySequence);
}

@end

@implementation HIDEvent (HIDScrollEvent)

+ (instancetype)scrollEvent:(uint64_t)timestamp x:(double)x y:(double)y z:(double)z options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDScrollEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeScroll, timestamp, options);
IOHIDScrollEventData *eventData = (IOHIDScrollEventData *)event->_event.eventData;

eventData->position.x = CAST_DOUBLE_TO_FIXED(x);
eventData->position.y = CAST_DOUBLE_TO_FIXED(y);
eventData->position.z = CAST_DOUBLE_TO_FIXED(z);

return event;
}

@end

@implementation HIDEvent (HIDScrollEventPrivate)

- (uint32_t)scrollIsPixels {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldScrollIsPixels);
}

- (void)setScrollIsPixels:(uint32_t)scrollIsPixels {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldScrollIsPixels, (CFIndex)scrollIsPixels);
}

- (double)scrollX {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldScrollX);
}

- (void)setScrollX:(double)scrollX {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldScrollX, (IOHIDFloat)scrollX);
}

- (double)scrollY {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldScrollY);
}

- (void)setScrollY:(double)scrollY {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldScrollY, (IOHIDFloat)scrollY);
}

- (double)scrollZ {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldScrollZ);
}

- (void)setScrollZ:(double)scrollZ {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldScrollZ, (IOHIDFloat)scrollZ);
}

@end

@implementation HIDEvent (HIDBiometricEvent)

+ (instancetype)biometricEvent:(uint64_t)timestamp eventType:(uint32_t)eventType level:(double)level options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDBiometricEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeBiometric, timestamp, options);
IOHIDBiometricEventData *eventData = (IOHIDBiometricEventData *)event->_event.eventData;

eventData->eventType = (uint32_t)eventType;
eventData->level = CAST_DOUBLE_TO_FIXED(level);

return event;
}

@end

@implementation HIDEvent (HIDBiometricEventPrivate)

- (uint32_t)biometricEventType {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldBiometricEventType);
}

- (void)setBiometricEventType:(uint32_t)biometricEventType {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldBiometricEventType, (CFIndex)biometricEventType);
}

- (double)biometricLevel {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldBiometricLevel);
}

- (void)setBiometricLevel:(double)biometricLevel {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldBiometricLevel, (IOHIDFloat)biometricLevel);
}

- (uint8_t)biometricTapCount {
return (uint8_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldBiometricTapCount);
}

- (void)setBiometricTapCount:(uint8_t)biometricTapCount {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldBiometricTapCount, (CFIndex)biometricTapCount);
}

- (uint16_t)biometricUsage {
return (uint16_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldBiometricUsage);
}

- (void)setBiometricUsage:(uint16_t)biometricUsage {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldBiometricUsage, (CFIndex)biometricUsage);
}

- (uint16_t)biometricUsagePage {
return (uint16_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldBiometricUsagePage);
}

- (void)setBiometricUsagePage:(uint16_t)biometricUsagePage {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldBiometricUsagePage, (CFIndex)biometricUsagePage);
}

@end

@implementation HIDEvent (HIDLEDEvent)

+ (instancetype)lEDEvent:(uint64_t)timestamp ledMask:(uint32_t)ledMask number:(uint8_t)number state:(uint32_t)state options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDLEDEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeLED, timestamp, options);
IOHIDLEDEventData *eventData = (IOHIDLEDEventData *)event->_event.eventData;

eventData->mask = (uint32_t)ledMask;
eventData->number = (uint8_t)number;
eventData->state = (uint32_t)state;

return event;
}

@end

@implementation HIDEvent (HIDLEDEventPrivate)

- (uint32_t)ledMask {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldLEDMask);
}

- (void)setLedMask:(uint32_t)ledMask {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldLEDMask, (CFIndex)ledMask);
}

- (uint8_t)ledNumber {
return (uint8_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldLEDNumber);
}

- (void)setLedNumber:(uint8_t)ledNumber {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldLEDNumber, (CFIndex)ledNumber);
}

- (uint32_t)ledState {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldLEDState);
}

- (void)setLedState:(uint32_t)ledState {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldLEDState, (CFIndex)ledState);
}

@end

@implementation HIDEvent (HIDOrientationEvent)

+ (instancetype)polarOrientationEvent:(uint64_t)timestamp radius:(double)radius azimuth:(double)azimuth altitude:(double)altitude options:(uint32_t)options
{
CFIndex eventSize = sizeof(__IOHIDOrientationEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeOrientation, timestamp, options);
__IOHIDOrientationEventData *eventData = (__IOHIDOrientationEventData *)event->_event.eventData;

eventData->orientationType = kIOHIDOrientationTypePolar;
eventData->base.orientation.polar.x = CAST_DOUBLE_TO_FIXED(radius);
eventData->base.orientation.polar.y = CAST_DOUBLE_TO_FIXED(azimuth);
eventData->base.orientation.polar.z = CAST_DOUBLE_TO_FIXED(altitude);

return event;
}

+ (instancetype)quaternionOrientationEvent:(uint64_t)timestamp w:(double)w x:(double)x y:(double)y z:(double)z options:(uint32_t)options
{
CFIndex eventSize = sizeof(__IOHIDOrientationEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeOrientation, timestamp, options);
__IOHIDOrientationEventData *eventData = (__IOHIDOrientationEventData *)event->_event.eventData;

eventData->orientationType = kIOHIDOrientationTypeQuaternion;
eventData->base.orientation.quaternion.w = CAST_DOUBLE_TO_FIXED(w);
eventData->base.orientation.quaternion.x = CAST_DOUBLE_TO_FIXED(x);
eventData->base.orientation.quaternion.y = CAST_DOUBLE_TO_FIXED(y);
eventData->base.orientation.quaternion.z = CAST_DOUBLE_TO_FIXED(z);

return event;
}

+ (instancetype)tiltOrientationEvent:(uint64_t)timestamp x:(double)x y:(double)y z:(double)z options:(uint32_t)options
{
CFIndex eventSize = sizeof(__IOHIDOrientationEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeOrientation, timestamp, options);
__IOHIDOrientationEventData *eventData = (__IOHIDOrientationEventData *)event->_event.eventData;

eventData->orientationType = kIOHIDOrientationTypeTilt;
eventData->base.orientation.tilt.x = CAST_DOUBLE_TO_FIXED(x);
eventData->base.orientation.tilt.y = CAST_DOUBLE_TO_FIXED(y);
eventData->base.orientation.tilt.z = CAST_DOUBLE_TO_FIXED(z);

return event;
}

@end

@implementation HIDEvent (HIDOrientationEventPrivate)

- (double)orientationAltitude {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationAltitude);
}

- (void)setOrientationAltitude:(double)orientationAltitude {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationAltitude, (IOHIDFloat)orientationAltitude);
}

- (double)orientationAzimuth {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationAzimuth);
}

- (void)setOrientationAzimuth:(double)orientationAzimuth {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationAzimuth, (IOHIDFloat)orientationAzimuth);
}

- (uint32_t)orientationDeviceOrientationUsage {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationDeviceOrientationUsage);
}

- (void)setOrientationDeviceOrientationUsage:(uint32_t)orientationDeviceOrientationUsage {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationDeviceOrientationUsage, (CFIndex)orientationDeviceOrientationUsage);
}

- (uint32_t)orientationOrientationType {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationOrientationType);
}

- (double)orientationQuatW {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationQuatW);
}

- (void)setOrientationQuatW:(double)orientationQuatW {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationQuatW, (IOHIDFloat)orientationQuatW);
}

- (double)orientationQuatX {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationQuatX);
}

- (void)setOrientationQuatX:(double)orientationQuatX {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationQuatX, (IOHIDFloat)orientationQuatX);
}

- (double)orientationQuatY {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationQuatY);
}

- (void)setOrientationQuatY:(double)orientationQuatY {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationQuatY, (IOHIDFloat)orientationQuatY);
}

- (double)orientationQuatZ {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationQuatZ);
}

- (void)setOrientationQuatZ:(double)orientationQuatZ {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationQuatZ, (IOHIDFloat)orientationQuatZ);
}

- (double)orientationRadius {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationRadius);
}

- (void)setOrientationRadius:(double)orientationRadius {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationRadius, (IOHIDFloat)orientationRadius);
}

- (double)orientationTiltX {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationTiltX);
}

- (void)setOrientationTiltX:(double)orientationTiltX {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationTiltX, (IOHIDFloat)orientationTiltX);
}

- (double)orientationTiltY {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationTiltY);
}

- (void)setOrientationTiltY:(double)orientationTiltY {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationTiltY, (IOHIDFloat)orientationTiltY);
}

- (double)orientationTiltZ {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationTiltZ);
}

- (void)setOrientationTiltZ:(double)orientationTiltZ {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldOrientationTiltZ, (IOHIDFloat)orientationTiltZ);
}

@end

@implementation HIDEvent (HIDProximityEvent)

+ (instancetype)proximityEvent:(uint64_t)timestamp detectionMask:(uint32_t)detectionMask options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDProximityEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeProximity, timestamp, options);
IOHIDProximityEventData *eventData = (IOHIDProximityEventData *)event->_event.eventData;

eventData->detectionMask = (uint32_t)detectionMask;

return event;
}

@end

@implementation HIDEvent (HIDProximityEventPrivate)

- (uint32_t)proximityDetectionMask {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldProximityDetectionMask);
}

- (void)setProximityDetectionMask:(uint32_t)proximityDetectionMask {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldProximityDetectionMask, (CFIndex)proximityDetectionMask);
}

- (uint32_t)proximityLevel {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldProximityLevel);
}

- (void)setProximityLevel:(uint32_t)proximityLevel {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldProximityLevel, (CFIndex)proximityLevel);
}

@end

@implementation HIDEvent (HIDKeyboardEvent)

+ (instancetype)keyboardEvent:(uint64_t)timestamp usagePage:(uint16_t)usagePage usage:(uint16_t)usage down:(uint32_t)down options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDKeyboardEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypeKeyboard, timestamp, options);
IOHIDKeyboardEventData *eventData = (IOHIDKeyboardEventData *)event->_event.eventData;

eventData->usagePage = (uint16_t)usagePage;
eventData->usage = (uint16_t)usage;
eventData->down = (uint32_t)down;

return event;
}

@end

@implementation HIDEvent (HIDKeyboardEventPrivate)

- (uint32_t)keyboardClickSpeed {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardClickSpeed);
}

- (void)setKeyboardClickSpeed:(uint32_t)keyboardClickSpeed {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardClickSpeed, (CFIndex)keyboardClickSpeed);
}

- (uint32_t)keyboardDown {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardDown);
}

- (void)setKeyboardDown:(uint32_t)keyboardDown {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardDown, (CFIndex)keyboardDown);
}

- (uint32_t)keyboardLongPress {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardLongPress);
}

- (void)setKeyboardLongPress:(uint32_t)keyboardLongPress {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardLongPress, (CFIndex)keyboardLongPress);
}

- (uint32_t)keyboardMouseKeyToggle {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardMouseKeyToggle);
}

- (void)setKeyboardMouseKeyToggle:(uint32_t)keyboardMouseKeyToggle {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardMouseKeyToggle, (CFIndex)keyboardMouseKeyToggle);
}

- (uint8_t)keyboardPressCount {
return (uint8_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardPressCount);
}

- (void)setKeyboardPressCount:(uint8_t)keyboardPressCount {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardPressCount, (CFIndex)keyboardPressCount);
}

- (uint32_t)keyboardRepeat {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardRepeat);
}

- (void)setKeyboardRepeat:(uint32_t)keyboardRepeat {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardRepeat, (CFIndex)keyboardRepeat);
}

- (uint32_t)keyboardSlowKeyPhase {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardSlowKeyPhase);
}

- (void)setKeyboardSlowKeyPhase:(uint32_t)keyboardSlowKeyPhase {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardSlowKeyPhase, (CFIndex)keyboardSlowKeyPhase);
}

- (uint32_t)keyboardStickyKeyPhase {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardStickyKeyPhase);
}

- (void)setKeyboardStickyKeyPhase:(uint32_t)keyboardStickyKeyPhase {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardStickyKeyPhase, (CFIndex)keyboardStickyKeyPhase);
}

- (uint32_t)keyboardStickyKeyToggle {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardStickyKeyToggle);
}

- (void)setKeyboardStickyKeyToggle:(uint32_t)keyboardStickyKeyToggle {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardStickyKeyToggle, (CFIndex)keyboardStickyKeyToggle);
}

- (uint16_t)keyboardUsage {
return (uint16_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardUsage);
}

- (void)setKeyboardUsage:(uint16_t)keyboardUsage {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardUsage, (CFIndex)keyboardUsage);
}

- (uint16_t)keyboardUsagePage {
return (uint16_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardUsagePage);
}

- (void)setKeyboardUsagePage:(uint16_t)keyboardUsagePage {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldKeyboardUsagePage, (CFIndex)keyboardUsagePage);
}

@end

@implementation HIDEvent (HIDPointerEvent)

+ (instancetype)pointerEvent:(uint64_t)timestamp x:(double)x y:(double)y z:(double)z buttonMask:(uint32_t)buttonMask options:(uint32_t)options
{
CFIndex eventSize = sizeof(IOHIDPointerEventData);
HIDEvent *event = (__bridge_transfer HIDEvent *)_IOHIDEventCreate(kCFAllocatorDefault, eventSize, kIOHIDEventTypePointer, timestamp, options);
IOHIDPointerEventData *eventData = (IOHIDPointerEventData *)event->_event.eventData;

eventData->position.x = CAST_DOUBLE_TO_FIXED(x);
eventData->position.y = CAST_DOUBLE_TO_FIXED(y);
eventData->position.z = CAST_DOUBLE_TO_FIXED(z);
eventData->button.mask = (uint32_t)buttonMask;

return event;
}

@end

@implementation HIDEvent (HIDPointerEventPrivate)

- (uint32_t)pointerButtonMask {
return (uint32_t)IOHIDEventGetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldPointerButtonMask);
}

- (void)setPointerButtonMask:(uint32_t)pointerButtonMask {
IOHIDEventSetIntegerValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldPointerButtonMask, (CFIndex)pointerButtonMask);
}

- (double)pointerX {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldPointerX);
}

- (void)setPointerX:(double)pointerX {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldPointerX, (IOHIDFloat)pointerX);
}

- (double)pointerY {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldPointerY);
}

- (void)setPointerY:(double)pointerY {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldPointerY, (IOHIDFloat)pointerY);
}

- (double)pointerZ {
return (double)IOHIDEventGetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldPointerZ);
}

- (void)setPointerZ:(double)pointerZ {
IOHIDEventSetFloatValue((__bridge IOHIDEventRef)self, kIOHIDEventFieldPointerZ, (IOHIDFloat)pointerZ);
}

@end