Erste funktionsfähige Tracker-Version
This commit is contained in:
26
appdata.py
26
appdata.py
@@ -12,6 +12,8 @@ class AppData():
|
||||
self.shutdown = False # Globaler Ausschalter
|
||||
self.track = Tracker('NONE')
|
||||
self.frontend = None
|
||||
self.bv_lat = None
|
||||
self.bv_lon = None
|
||||
|
||||
# Für u.a. Header-Indikatoren
|
||||
# TODO
|
||||
@@ -28,22 +30,38 @@ class AppData():
|
||||
|
||||
def setFrontend(self, frontend):
|
||||
self.frontend = frontend # Referenz zur GUI
|
||||
self.bv_lat = frontend.boatdata.getRef("LAT")
|
||||
self.bv_lon = frontend.boatdata.getRef("LON")
|
||||
|
||||
def refreshStatus(self):
|
||||
self.status['AP'] = False
|
||||
self.status['AP'] = False # nicht implementiert
|
||||
|
||||
self.status['TCP'] = False
|
||||
self.status['WIFI'] = False
|
||||
for intf in os.listdir('/sys/class/net'):
|
||||
statefile = os.path.join('/sys/class/net', interface, 'operstate')
|
||||
wififile = os.path.join('/sys/class/net', interface, 'wireless')
|
||||
statefile = os.path.join('/sys/class/net', intf, 'operstate')
|
||||
wififile = os.path.join('/sys/class/net', intf, 'wireless')
|
||||
if os.path.exists(statefile):
|
||||
with open(statefile) as fh:
|
||||
state = f.read().strip()
|
||||
state = fh.read().strip()
|
||||
if state == 'up':
|
||||
if os.path.exists(wififile):
|
||||
self.status['WIFI'] = True
|
||||
else:
|
||||
self.status['TCP'] = True
|
||||
|
||||
# TODO NMEA2000
|
||||
# can-Interface can0 im Netzwerk. Identifikation?
|
||||
|
||||
# TODO NMEA0183 tty auf Konfiguration
|
||||
# enabled in Konfiguration
|
||||
# port muß gültige Schnittstelle sein
|
||||
|
||||
# TODO USB /dev/ttyUSB0?
|
||||
|
||||
# GPS
|
||||
# Kann ein Empfänger am USB sein. Siehe Konfiguration
|
||||
self.status['GPS'] = self.bv_lat and self.bv_lon and self.bv_lat.valid and self.bv_lon.valid
|
||||
|
||||
# Tracker
|
||||
self.status['TRK'] = self.track.is_active()
|
||||
|
||||
Reference in New Issue
Block a user