-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTemperatureDoubleManager.m
More file actions
73 lines (57 loc) · 1.3 KB
/
TemperatureDoubleManager.m
File metadata and controls
73 lines (57 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//
// TemperatureManager.m
// Temperature
//
// Created by Filippo Valle on 11/06/17.
// Copyright © 2017 Filippo Valle. All rights reserved.
//
#include "TemperatureDoubleManager.h"
@implementation TemperatureDoubleManager
-(id)init
{
SMCOpen();
return self;
}
-(void)dealloc{
SMCClose();
};
-(double) GetTemp
{
int max=50;
double t = -127.;
for(int i = 0; i < max; i++) {
t = SMCGetTemperature((char*)TEMPS[i][0]);
if (t <= -127)
continue;
printf("got ok for %s",TEMPS[i][1]);
}
return t;
}
-(double) GetTemp: (char*) key{
double t = -127.;
t = SMCGetTemperature(key);
if(t<-127) t=-127;
return t;
}
-(double) GetCPUTemp{
double t = -127.;
t = SMCGetTemperature((char*)TEMPS[22][0]);
if(t<-127) t=-127;
return t;
}
-(double) GetBatteryTemp{
double t = -127.;
t = SMCGetTemperature((char*)TEMPS[10][0]);
if(t<-127) t=-127;
return t;
}
-(double) GetHDTemp{
double t = -127.;
t = SMCGetTemperature((char*)TEMPS[48][0]);
if(t<-127) t=-127;
return t;
}
/*
got ok for Battery TS_MAXgot ok for Battery 1got ok for Battery 2got ok for CPU 0 Diegot ok for CPU 0 Proximitygot ok for got ok for Harddisk 0 Proximitygot ok for NB/CPU/GPU HeatPipe 1 Proximity
*/
@end