mirror of
https://github.com/openplotter/openplotter-maiana.git
synced 2025-06-01 15:00:14 -07:00
check device and SK server settings
This commit is contained in:
parent
1aaffe8fda
commit
549a462afa
@ -199,6 +199,7 @@ class MyFrame(wx.Frame):
|
|||||||
device = ''
|
device = ''
|
||||||
baudrate = ''
|
baudrate = ''
|
||||||
connectionType = ''
|
connectionType = ''
|
||||||
|
suppress0183event = False
|
||||||
try:
|
try:
|
||||||
enabled = i['enabled']
|
enabled = i['enabled']
|
||||||
skID = i['id']
|
skID = i['id']
|
||||||
@ -207,7 +208,8 @@ class MyFrame(wx.Frame):
|
|||||||
device = dataSubOptions['device']
|
device = dataSubOptions['device']
|
||||||
baudrate = dataSubOptions['baudrate']
|
baudrate = dataSubOptions['baudrate']
|
||||||
connectionType = dataSubOptions['type']
|
connectionType = dataSubOptions['type']
|
||||||
if enabled and connectionType == 'serial' and baudrate == 38400 and dataType == 'NMEA0183':
|
if 'suppress0183event' in dataSubOptions: suppress0183event = dataSubOptions['suppress0183event']
|
||||||
|
if enabled and connectionType == 'serial' and baudrate == 38400 and dataType == 'NMEA0183' and not suppress0183event:
|
||||||
availableIDs.append(skID)
|
availableIDs.append(skID)
|
||||||
if device == self.device: selected = skID
|
if device == self.device: selected = skID
|
||||||
except: pass
|
except: pass
|
||||||
@ -437,7 +439,7 @@ class MyFrame(wx.Frame):
|
|||||||
test = subprocess.check_output(['ps','aux']).decode(sys.stdin.encoding)
|
test = subprocess.check_output(['ps','aux']).decode(sys.stdin.encoding)
|
||||||
if not 'openplotter-maiana-read' in test: self.restartRead()
|
if not 'openplotter-maiana-read' in test: self.restartRead()
|
||||||
else: subprocess.call(['pkill','-f','openplotter-maiana-read'])
|
else: subprocess.call(['pkill','-f','openplotter-maiana-read'])
|
||||||
|
|
||||||
self.onRead()
|
self.onRead()
|
||||||
|
|
||||||
def pageSettings(self):
|
def pageSettings(self):
|
||||||
|
@ -15,8 +15,9 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Openplotter. If not, see <http://www.gnu.org/licenses/>.
|
# along with Openplotter. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import time, os, subprocess, sys
|
import time, os, subprocess, sys, ujson
|
||||||
from openplotterSettings import language
|
from openplotterSettings import language
|
||||||
|
from openplotterSettings import platform
|
||||||
from openplotterSignalkInstaller import connections
|
from openplotterSignalkInstaller import connections
|
||||||
|
|
||||||
class Start():
|
class Start():
|
||||||
@ -41,6 +42,7 @@ class Start():
|
|||||||
class Check():
|
class Check():
|
||||||
def __init__(self, conf, currentLanguage):
|
def __init__(self, conf, currentLanguage):
|
||||||
self.conf = conf
|
self.conf = conf
|
||||||
|
self.platform = platform.Platform()
|
||||||
currentdir = os.path.dirname(os.path.abspath(__file__))
|
currentdir = os.path.dirname(os.path.abspath(__file__))
|
||||||
language.Language(currentdir,'openplotter-maiana',currentLanguage)
|
language.Language(currentdir,'openplotter-maiana',currentLanguage)
|
||||||
|
|
||||||
@ -50,8 +52,6 @@ class Check():
|
|||||||
green = ''
|
green = ''
|
||||||
black = ''
|
black = ''
|
||||||
red = ''
|
red = ''
|
||||||
|
|
||||||
#TODO check localhost 10110 and "Suppress nmea0183 event" in sk connection
|
|
||||||
|
|
||||||
#device
|
#device
|
||||||
device = self.conf.get('MAIANA', 'device')
|
device = self.conf.get('MAIANA', 'device')
|
||||||
@ -64,6 +64,51 @@ class Check():
|
|||||||
if not green: green = msg
|
if not green: green = msg
|
||||||
else: green+= ' | '+msg
|
else: green+= ' | '+msg
|
||||||
|
|
||||||
|
#check devie¡ce and server settings
|
||||||
|
if device:
|
||||||
|
settingsOK = False
|
||||||
|
nmeaOK = True
|
||||||
|
try:
|
||||||
|
setting_file = self.platform.skDir+'/settings.json'
|
||||||
|
with open(setting_file) as data_file:
|
||||||
|
data = ujson.load(data_file)
|
||||||
|
except: data = {}
|
||||||
|
if 'pipedProviders' in data: data2 = data['pipedProviders']
|
||||||
|
else: data2 = []
|
||||||
|
for i in data2:
|
||||||
|
enabled = ''
|
||||||
|
dataType = ''
|
||||||
|
baudrate = ''
|
||||||
|
connectionType = ''
|
||||||
|
suppress0183event = False
|
||||||
|
try:
|
||||||
|
dataSubOptions = i['pipeElements'][0]['options']['subOptions']
|
||||||
|
if device in dataSubOptions['device']:
|
||||||
|
enabled = i['enabled']
|
||||||
|
dataType = i['pipeElements'][0]['options']['type']
|
||||||
|
baudrate = dataSubOptions['baudrate']
|
||||||
|
connectionType = dataSubOptions['type']
|
||||||
|
if 'suppress0183event' in dataSubOptions: suppress0183event = dataSubOptions['suppress0183event']
|
||||||
|
if enabled and connectionType == 'serial' and baudrate == 38400 and dataType == 'NMEA0183' and not suppress0183event: settingsOK = True
|
||||||
|
except: pass
|
||||||
|
if settingsOK:
|
||||||
|
msg = _('device settings OK')
|
||||||
|
if not green: green = msg
|
||||||
|
else: green+= ' | '+msg
|
||||||
|
else:
|
||||||
|
msg = _('check device settings')
|
||||||
|
if not red: red = msg
|
||||||
|
else: red+= '\n '+msg
|
||||||
|
|
||||||
|
if 'interfaces' in data: data2 = data['interfaces']
|
||||||
|
else: data2 = []
|
||||||
|
if 'nmea-tcp' in data2:
|
||||||
|
if not data2['nmea-tcp']: nmeaOK = False
|
||||||
|
if not nmeaOK:
|
||||||
|
msg = _('NMEA 0183 over TCP (10110) interface is disabled. Check Signal K server settings')
|
||||||
|
if not red: red = msg
|
||||||
|
else: red+= '\n '+msg
|
||||||
|
|
||||||
#access
|
#access
|
||||||
skConnections = connections.Connections('MAIANA')
|
skConnections = connections.Connections('MAIANA')
|
||||||
result = skConnections.checkConnection()
|
result = skConnections.checkConnection()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user