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
import Axios from 'axios'
import {
REQUEST_CONFIG, CONTROLL_TEMPERATURE, CONTROLL_SOFTWARE, CONTROLL_HARDWARE,
CONTROLL_FANSTATUS, CONTROLL_REBOOT
} from '../../utils/RequestUrls'
var staticMethods = {
// 获取设备温度
getDeviceTemperature: function (panelsDeviceKey) {
return Axios.put(CONTROLL_TEMPERATURE, panelsDeviceKey, REQUEST_CONFIG)
},
// 获取软件版本
getDeviceSoftware: function (panelsDeviceKey) {
return Axios.get(CONTROLL_SOFTWARE + panelsDeviceKey + '/', REQUEST_CONFIG)
},
// 获取硬件版本
getDeviceHardware: function (panelsDeviceKey) {
return Axios.get(CONTROLL_HARDWARE + panelsDeviceKey + '/', REQUEST_CONFIG)
},
// 获取风扇状态
getDevcieFanstatus: function (panelsDeviceKey) {
// return Axios.get(CONTROLL_FANSTATUS+panelsDeviceKey+"/",REQUEST_CONFIG);
return Axios.put(CONTROLL_FANSTATUS, panelsDeviceKey, REQUEST_CONFIG)
},
// 重启设备
getRestartDevice: function (panelsDeviceKey) {
return Axios.get(CONTROLL_REBOOT + panelsDeviceKey + '/', REQUEST_CONFIG)
}
}
function DeviceControllAPI (websocketService = null) {
return Object.freeze(Object.assign(
{
// object methods comes here
},
staticMethods
))
}
// inject static methods
Object.assign(DeviceControllAPI, staticMethods)
export default DeviceControllAPI