Files
MacMonitor/Sources/Hardware/AppleSMC/MMAppleSMCClient.h

59 lines
1.5 KiB
Objective-C

#ifndef MMAppleSMCClient_h
#define MMAppleSMCClient_h
#import <Foundation/Foundation.h>
#import "MMSMCDefines.h"
#import "MMSMCParser.h"
NS_ASSUME_NONNULL_BEGIN
/**
* MMAppleSMCClient
* Thread-safe singleton providing direct communication with the AppleSMC driver
* on Intel Mac platforms via IOKit user client calls.
*/
@interface MMAppleSMCClient : NSObject
@property (class, readonly, strong) MMAppleSMCClient *sharedClient;
/**
* Whether the AppleSMC IOKit driver connection is open and active.
*/
@property (nonatomic, readonly, getter=isAvailable) BOOL available;
/**
* Total number of SMC keys advertised by hardware (#KEY), or 0 if unavailable.
*/
@property (nonatomic, readonly) NSInteger totalKeyCount;
/**
* Explicitly opens the IOKit AppleSMC connection.
*/
- (BOOL)openWithError:(NSError **)error;
/**
* Closes the active IOKit AppleSMC connection.
*/
- (void)close;
/**
* Reads raw bytes for a given 4-character SMC key (e.g. "TC0P", "F0Ac").
*/
- (nullable NSData *)readBytesForKey:(NSString *)key error:(NSError **)error;
/**
* Reads and automatically decodes a numeric value according to its SMC type descriptor.
*/
- (nullable NSNumber *)readNumericValueForKey:(NSString *)key error:(NSError **)error;
/**
* Returns the FourCC data type string for an SMC key (e.g. "sp78", "fpe2", "ui16").
*/
- (nullable NSString *)readDataTypeForKey:(NSString *)key error:(NSError **)error;
@end
NS_ASSUME_NONNULL_END
#endif /* MMAppleSMCClient_h */