This repository was archived by the owner on Oct 12, 2018. It is now read-only.
File tree 3 files changed +10
-4
lines changed
3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -730,7 +730,7 @@ - (void)updateSmcSensor:(HWMonitorSensor*)sensor addToArray:(NSMutableArray*)upd
730
730
if (![sensor genericDevice ]) {
731
731
SMCVal_t val;
732
732
733
- if (kIOReturnSuccess == SMCReadKey (_connection, sensor.key , &val)) {
733
+ if (kIOReturnSuccess == SMCReadKey (_connection, sensor.rawKey , &val)) {
734
734
735
735
// [sensor setType:[NSString stringWithCString:val.dataType encoding:NSASCIIStringEncoding]];
736
736
[sensor setData: [NSData dataWithBytes: val.bytes length: val.dataSize]];
Original file line number Diff line number Diff line change @@ -59,22 +59,22 @@ typedef enum {
59
59
60
60
@interface HWMonitorSensor : NSObject
61
61
{
62
- const char * _key ;
62
+ char _rawKey[ 5 ] ;
63
63
NSNumber *_rawValue;
64
64
NSMutableDictionary *_localizationCache;
65
65
}
66
66
67
67
@property (nonatomic , strong ) HWMonitorEngine* engine;
68
68
69
69
@property (nonatomic , strong ) NSString * name;
70
- @property (readonly ) const char * key;
71
70
@property (nonatomic , strong ) NSString * type;
72
71
@property (nonatomic , assign ) NSUInteger group;
73
72
@property (nonatomic , strong ) NSString * title;
74
73
@property (nonatomic , strong ) NSData * data;
75
74
@property (nonatomic , strong ) id genericDevice;
76
75
77
76
@property (nonatomic , assign ) HWSensorLevel level;
77
+ @property (readonly ) const char *rawKey;
78
78
@property (readonly ) NSNumber * rawValue;
79
79
@property (readonly ) NSString * stringValue;
80
80
@property (readonly ) NSInteger intValue;
Original file line number Diff line number Diff line change @@ -178,14 +178,20 @@ + (HWMonitorSensor*)sensor
178
178
return nil ;
179
179
}
180
180
181
+
181
182
-(void )setName : (NSString *)name
182
183
{
183
184
if (name != _name) {
184
185
_name = name;
185
- _key = [name cStringUsingEncoding : NSASCIIStringEncoding];
186
+ [name getCString: _rawKey maxLength: 5 encoding : NSASCIIStringEncoding];
186
187
}
187
188
}
188
189
190
+ -(const char *)rawKey
191
+ {
192
+ return _rawKey;
193
+ }
194
+
189
195
- (void )setType : (NSString *)newType
190
196
{
191
197
if (!_type || ![_type isEqualToString: newType]) {
You can’t perform that action at this time.
0 commit comments