mirror of
https://github.com/Schrolli91/BOSWatch.git
synced 2026-04-06 15:04:06 +00:00
rename globals. call to globalVars.
This commit is contained in:
parent
f8fcda94b6
commit
e938cdcd6d
27 changed files with 300 additions and 300 deletions
|
|
@ -68,15 +68,15 @@ def run(typ,freq,data):
|
|||
#
|
||||
# SOCK_DGRAM is the socket type to use for UDP sockets
|
||||
# SOCK_STREAM is the socket type to use for TCP sockets
|
||||
if globals.config.get("jsonSocket", "protocol") == "TCP":
|
||||
if globalVars.config.get("jsonSocket", "protocol") == "TCP":
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.connect((globals.config.get("jsonSocket", "server"), globals.config.getint("jsonSocket", "port")))
|
||||
sock.connect((globalVars.config.get("jsonSocket", "server"), globalVars.config.getint("jsonSocket", "port")))
|
||||
else:
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
|
||||
except:
|
||||
logging.error("cannot initialize %s-socket", globals.config.get("jsonSocket", "protocol"))
|
||||
logging.debug("cannot initialize %s-socket", globals.config.get("jsonSocket", "protocol"), exc_info=True)
|
||||
logging.error("cannot initialize %s-socket", globalVars.config.get("jsonSocket", "protocol"))
|
||||
logging.debug("cannot initialize %s-socket", globalVars.config.get("jsonSocket", "protocol"), exc_info=True)
|
||||
# Without connection, plugin couldn't work
|
||||
return
|
||||
|
||||
|
|
@ -84,22 +84,22 @@ def run(typ,freq,data):
|
|||
# toDo is equals for all types, so only check if typ is supported
|
||||
supportedTypes = ["FMS", "ZVEI", "POC"]
|
||||
if typ in supportedTypes:
|
||||
logging.debug("Start %s to %s", typ, globals.config.get("jsonSocket", "protocol"))
|
||||
logging.debug("Start %s to %s", typ, globalVars.config.get("jsonSocket", "protocol"))
|
||||
try:
|
||||
# dump data to json-string
|
||||
sendData = json.dumps(data)
|
||||
# send data
|
||||
sock.sendto(sendData, (globals.config.get("jsonSocket", "server"), globals.config.getint("jsonSocket", "port")))
|
||||
sock.sendto(sendData, (globalVars.config.get("jsonSocket", "server"), globalVars.config.getint("jsonSocket", "port")))
|
||||
except:
|
||||
logging.error("%s to %s failed", typ, globals.config.get("jsonSocket", "protocol"))
|
||||
logging.debug("%s to %s failed", typ, globals.config.get("jsonSocket", "protocol"), exc_info=True)
|
||||
logging.error("%s to %s failed", typ, globalVars.config.get("jsonSocket", "protocol"))
|
||||
logging.debug("%s to %s failed", typ, globalVars.config.get("jsonSocket", "protocol"), exc_info=True)
|
||||
return
|
||||
|
||||
else:
|
||||
logging.warning("Invalid Typ: %s", typ)
|
||||
|
||||
finally:
|
||||
logging.debug("close %s-Connection", globals.config.get("jsonSocket", "protocol"))
|
||||
logging.debug("close %s-Connection", globalVars.config.get("jsonSocket", "protocol"))
|
||||
try:
|
||||
sock.close()
|
||||
except:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue