forked from ASURT-ROV-18/RPI_18
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSensor.py
38 lines (34 loc) · 1.2 KB
/
Sensor.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
class SensorRegistry:
def __init__(self):
self._pokeInterval=1
self._sensors=[]
self._timerWakeUpCall=None
# self.eventTimer.start()
# self.thread=threading.Thread(target=self.timer)
# self.thread.start()
# self.process=Process(target=self.timer)
# self.process.start()
# def timer(self):
# while True:
# time.sleep(self._pokeInterval)
# self._trigger()
#
# def registerSensor(self,sensorClass):
# newSensor=sensorClass()
# self._sensors.append(newSensor)
def _trigger(self):
# dictToBeSent=self.mail()
strToBeSent="a"
# for key in dictToBeSent:
# strToBeSent+=(str(key)+" "+str(dictToBeSent[key])+";")
if self._timerWakeUpCall != None :
self._timerWakeUpCall("Sensors",strToBeSent)
# self.eventTimer.run()
def registerCallBack(self,callback):
self._timerWakeUpCall=callback
# def mail(self):
# receivedDictionaries={}
# for sensor in self._sensors:
# receivedDictionary=sensor.update()
# receivedDictionaries.update(receivedDictionary)
# return receivedDictionaries