-
Notifications
You must be signed in to change notification settings - Fork 0
/
stacja.py
81 lines (69 loc) · 2.02 KB
/
stacja.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
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
74
75
76
77
78
79
80
81
from GUI.gui import *
from Modules.Communication import *
from Modules.EventManager import *
from Modules.Prediction import Predictor
import sys
from PyQt5.QtWidgets import QApplication
import threading
import time
def main_window(app, conf):
'''
em=Manager(conf['file'])
rds = DataSaver('dstest6.txt')#raw data sever
'''
dm=DataManager(None)
em=dm.em
rds=dm.ds
predictor = Predictor()
'''
r=Radio(port=conf['port'], baudrate = conf['baudrate'],
timeout=conf['timeout'], event_manager=em)
'''
radio={
'port':conf['port'],
'baudrate':conf['baudrate'],
'timeout':conf['timeout']
}
structure = [
{'id': 'elevation', 'text':'Start elevation:' , 'num': 0},
{'id': 'time', 'text':'Time:' , 'num': 9},
{'id': 'rssi', 'text':'RSSI:' , 'num': 1},
{'id':'positionX' , 'text': 'Pozycja X:' , 'num': 2},
{'id': 'positionY', 'text': 'Pozycja Y:' , 'num': 3},
{'id':'altitude' , 'text':'Wysokość:' , 'num': 4},
{'id': 'pressure', 'text':'Ciśnienie:' , 'num': 5},
{'id': 'temperature', 'text':'Temperatura:' , 'num': 6},
{'id': 'pm25', 'text':'PM-2,5:' , 'num': 7},
{'id': 'pm10', 'text':'PM-10:' , 'num': 8}
]
dr=DataReader(structure, radio, event_manager = em, rds=rds)
conf['dm']=dm
conf['labels']=structure
conf['predictor']=predictor
conf['time']=get_time
win=MainWidgetWindow(conf)
reader = threading.Thread(target=dr.keepReading, args=(True, ), kwargs={'call':win.update,})
reader.start()
app.exec_()
def call_update(data):
print(data)
def get_time():
return time.time()
def new_connection(app):
serials=SerialLoader().all_serials()
names=[]
for s in serials:
names.append(s.device)
win=ConfigureConnectionWindow(names)
app.exec_()
if(win.response):
main_window(app, win.response)
'''
r=Radio(port='COM11')
r.keepReading(condition=True, call=print)
'''
app = QApplication(sys.argv)
win = OpenWindow()
app.exec_()
if(win.response=='NC'):
new_connection(app)