forked from cbitstech/Purple-Robot-Django
/
device_info.py
45 lines (37 loc) · 1.22 KB
/
device_info.py
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
# pylint: disable=line-too-long
DEVICE_PROBES = {
'LGE: LGLS740': {
'name': 'LG Volt (LGLS740)',
'missing_probes': [
'edu.northwestern.cbits.purple_robot_manager.probes.sensors.LightSensorProbe',
]
},
'LGE: LGL34C': {
'name': 'Optimus Fuel (LGL34C)',
'missing_probes': [
'edu.northwestern.cbits.purple_robot_manager.probes.sensors.LightSensorProbe',
]
},
'LGE: LGLS660': {
'name': 'LG Tribute (LGLS660)',
'missing_probes': [
'edu.northwestern.cbits.purple_robot_manager.probes.sensors.LightSensorProbe',
]
},
'LGE: LGL41C': {
'name': 'LG Ultimate 2 (LGL41C)',
'missing_probes': [
'edu.northwestern.cbits.purple_robot_manager.probes.sensors.LightSensorProbe',
]
}
}
def can_sense(manufacturer, model, probe):
if manufacturer is None or model is None or probe is None:
return None
# Until contrary evidence surfaces, assume that all devices have all sensors.
key = manufacturer + ': ' + model
if key in DEVICE_PROBES:
device = DEVICE_PROBES[key]
if probe in device['missing_probes']:
return False
return True