46 lines
1.4 KiB
Objective-C
46 lines
1.4 KiB
Objective-C
#ifndef MMPowerTelemetryProvider_h
|
|
#define MMPowerTelemetryProvider_h
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#import "MMTelemetryProvider.h"
|
|
#import "MMAppleSMCClient.h"
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
/**
|
|
* MMPowerTelemetryProvider
|
|
* Samples system power draw, CPU/GPU package wattage, rail voltages, and currents
|
|
* via AppleSMC and AppleSmartBattery IOKit interfaces.
|
|
*/
|
|
@interface MMPowerTelemetryProvider : NSObject <MMTelemetryProvider>
|
|
|
|
@property (nonatomic, strong, readonly) MMAppleSMCClient *smcClient;
|
|
@property (nonatomic, readonly) NSArray<NSString *> *discoveredPowerKeys;
|
|
@property (nonatomic, readonly) NSArray<NSString *> *discoveredVoltageKeys;
|
|
@property (nonatomic, readonly) NSArray<NSString *> *discoveredCurrentKeys;
|
|
|
|
- (instancetype)init;
|
|
- (instancetype)initWithSMCClient:(MMAppleSMCClient *)client;
|
|
|
|
/**
|
|
* Friendly name for power, voltage, and current SMC keys.
|
|
*/
|
|
+ (NSString *)humanReadableNameForKey:(NSString *)key;
|
|
|
|
/**
|
|
* Unit of measurement for SMC key ("W", "V", "A").
|
|
*/
|
|
+ (NSString *)unitForKey:(NSString *)key;
|
|
|
|
/**
|
|
* Pure calculator method for deterministic unit testing.
|
|
*/
|
|
+ (NSDictionary<NSString *, id> *)calculatePowerMetricsWithReadings:(NSDictionary<NSString *, NSNumber *> *)readings
|
|
batteryInfo:(nullable NSDictionary<NSString *, id> *)batteryInfo;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|
|
|
|
#endif /* MMPowerTelemetryProvider_h */
|