From bf0cc95c334587e259593f786ce285cc734e1e0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20K=C3=B6gl?= Date: Sat, 15 Mar 2014 21:39:12 +0100 Subject: [PATCH] foo 2 --- sensors2osc/sensors2osc/common.py | 14 +------------- sensors2osc/sensors2osc/ekg2osc.py | 8 +++++--- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/sensors2osc/sensors2osc/common.py b/sensors2osc/sensors2osc/common.py index 267ae32..e488baa 100644 --- a/sensors2osc/sensors2osc/common.py +++ b/sensors2osc/sensors2osc/common.py @@ -68,19 +68,7 @@ def create_args(name): add_chaosc_group(arg_parser) args = finalize_arg_parser(arg_parser) - - - while 1: - try: - t = ord(serial_sock.read(1)) - print "got value", t - osc_message = OSCMessage("/%s/ekg" % actor) - osc_message.appendTypedArg(t, "i") - osc_sock.sendall(osc_message.encode_osc()) - except socket.error, msg: - # got disconnected? - print "lost connection!!!" - reconnect(args) + return args def init(name): args = create_args(name) diff --git a/sensors2osc/sensors2osc/ekg2osc.py b/sensors2osc/sensors2osc/ekg2osc.py index 1a270f0..4bf685b 100644 --- a/sensors2osc/sensors2osc/ekg2osc.py +++ b/sensors2osc/sensors2osc/ekg2osc.py @@ -20,12 +20,14 @@ from __future__ import absolute_import +import atexit +import socket from sensors2osc import common -atexit.register(close) +atexit.register(common.close) def main(): - args, osc_sock = init("ekg2osc") + args, osc_sock = common.init("ekg2osc") actor = args.actor @@ -39,7 +41,7 @@ def main(): except socket.error, msg: # got disconnected? print "lost connection!!!" - reconnect(args) + common.reconnect(args)