Files

51 lines
1.2 KiB
Objective-C

#ifndef MMSMCParser_h
#define MMSMCParser_h
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface MMSMCParser : NSObject
/**
* Decodes a signed 8.8 fixed-point format (sp78), used widely for Intel Mac temperature sensors.
*/
+ (float)decodeSP78:(const uint8_t *)bytes;
/**
* Decodes an unsigned 14.2 fixed-point format (fpe2), used for Fan RPM values.
*/
+ (float)decodeFPE2:(const uint8_t *)bytes;
/**
* Decodes a standard IEEE 754 32-bit floating point value (flt).
*/
+ (float)decodeFLT:(const uint8_t *)bytes;
/**
* Decodes an unsigned 8-bit integer (ui8).
*/
+ (uint8_t)decodeUI8:(const uint8_t *)bytes;
/**
* Decodes a big-endian unsigned 16-bit integer (ui16).
*/
+ (uint16_t)decodeUI16:(const uint8_t *)bytes;
/**
* Decodes a big-endian unsigned 32-bit integer (ui32).
*/
+ (uint32_t)decodeUI32:(const uint8_t *)bytes;
/**
* Generic parser taking an SMC dataType FourCC string ("sp78", "fpe2", "flt", "ui8 ", "ui16", "ui32", "flag")
* and returning a parsed NSNumber.
*/
+ (nullable NSNumber *)decodeValueWithDataType:(NSString *)dataType bytes:(const uint8_t *)bytes size:(NSUInteger)size;
@end
NS_ASSUME_NONNULL_END
#endif /* MMSMCParser_h */