Removed useless reading of IOHID properties.
This commit is contained in:
@@ -109,15 +109,13 @@ NS_ASSUME_NONNULL_END
|
||||
|
||||
for( id o in services )
|
||||
{
|
||||
IOHIDServiceClientRef service = ( __bridge IOHIDServiceClientRef )o;
|
||||
NSString * name = CFBridgingRelease( IOHIDServiceClientCopyProperty( service, CFSTR( "Product" ) ) );
|
||||
NSArray * keys = @[ @"IOClass", @"IOProviderClass", @"IONameMatch", @"Product", @"DeviceUsagePairs" ];
|
||||
NSDictionary * properties = CFBridgingRelease( IOHIDServiceClientCopyProperties( service, ( __bridge CFArrayRef )keys ) );
|
||||
IOHIDServiceClientRef service = ( __bridge IOHIDServiceClientRef )o;
|
||||
NSString * name = CFBridgingRelease( IOHIDServiceClientCopyProperty( service, CFSTR( "Product" ) ) );
|
||||
CFTypeRef event = IOHIDServiceClientCopyEvent( service, eventType, 0, 0 );
|
||||
|
||||
if( name != nil && event != nil )
|
||||
{
|
||||
values[ name ] = [ [ IOHIDData alloc ] initWithName: name value: IOHIDEventGetFloatValue( event, eventField ) properties: properties ];
|
||||
values[ name ] = [ [ IOHIDData alloc ] initWithName: name value: IOHIDEventGetFloatValue( event, eventField ) ];
|
||||
}
|
||||
|
||||
if( event != nil )
|
||||
|
||||
@@ -27,15 +27,13 @@ import Foundation
|
||||
@objc
|
||||
public class IOHIDData: NSObject
|
||||
{
|
||||
@objc public dynamic var name: String
|
||||
@objc public dynamic var value: Double
|
||||
@objc public dynamic var properties: [ AnyHashable: Any ]
|
||||
@objc public dynamic var name: String
|
||||
@objc public dynamic var value: Double
|
||||
|
||||
@objc
|
||||
public init( name: String, value: Double, properties: [ AnyHashable: Any ] )
|
||||
public init( name: String, value: Double )
|
||||
{
|
||||
self.name = name
|
||||
self.value = value
|
||||
self.properties = properties
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,10 +61,9 @@ public class SensorHistoryData: NSObject, Synchronizable
|
||||
}
|
||||
}
|
||||
|
||||
@objc public private( set ) dynamic var source: Source
|
||||
@objc public private( set ) dynamic var kind: Kind
|
||||
@objc public private( set ) dynamic var name: String
|
||||
@objc public private( set ) dynamic var properties: [ AnyHashable: Any ]?
|
||||
@objc public private( set ) dynamic var source: Source
|
||||
@objc public private( set ) dynamic var kind: Kind
|
||||
@objc public private( set ) dynamic var name: String
|
||||
|
||||
private var data: [ Double ] = []
|
||||
|
||||
@@ -119,12 +118,11 @@ public class SensorHistoryData: NSObject, Synchronizable
|
||||
}
|
||||
|
||||
@objc
|
||||
public init( source: Source, kind: Kind, name: String, properties: [ AnyHashable: Any ]? )
|
||||
public init( source: Source, kind: Kind, name: String )
|
||||
{
|
||||
self.source = source
|
||||
self.kind = kind
|
||||
self.name = name
|
||||
self.properties = properties
|
||||
self.source = source
|
||||
self.kind = kind
|
||||
self.name = name
|
||||
}
|
||||
|
||||
@objc( addValue: )
|
||||
|
||||
@@ -115,7 +115,7 @@ public class Sensors: NSObject
|
||||
|
||||
if self.sensors[ key ] == nil
|
||||
{
|
||||
self.sensors[ key ] = SensorHistoryData( source: .hid, kind: kind, name: data.name, properties: data.properties )
|
||||
self.sensors[ key ] = SensorHistoryData( source: .hid, kind: kind, name: data.name )
|
||||
}
|
||||
|
||||
self.sensors[ key ]?.add( value: data.value )
|
||||
@@ -142,7 +142,7 @@ public class Sensors: NSObject
|
||||
|
||||
if self.sensors[ key ] == nil
|
||||
{
|
||||
self.sensors[ key ] = SensorHistoryData( source: .smc, kind: kind, name: data.keyName, properties: [ : ] )
|
||||
self.sensors[ key ] = SensorHistoryData( source: .smc, kind: kind, name: data.keyName )
|
||||
}
|
||||
|
||||
self.sensors[ key ]?.add( value: value )
|
||||
|
||||
Reference in New Issue
Block a user