added staged stuff

This commit is contained in:
Stefan Kögl 2014-04-03 17:44:36 +02:00
parent 4621abe17c
commit 8711d45ab6
3 changed files with 26 additions and 31 deletions

View File

@ -1,6 +1,6 @@
host=tommy;port=8000;label=tommy-live host=lucas;port=8000;label=lucas-dump
host=tommy;port=8001;label=tommy-max
host=lucas;port=8000;label=lucas
host=stefan;port=8000;label=stefan
host=mario;port=8000;label=mario-resolume host=mario;port=8000;label=mario-resolume
host=mario;port=8001;label=mario-max host=mario;port=8001;label=mario-max
host=stefan;port=8000;label=stefan-dump
host=tommy;port=8000;label=tommy-live
host=tommy;port=8001;label=tommy-max

View File

@ -335,11 +335,6 @@ class EkgPlot(object):
class MyHandler(BaseHTTPRequestHandler): class MyHandler(BaseHTTPRequestHandler):
def __del__(self):
if hasattr(self, "thread"):
self.thread.running = False
self.thread.join()
def do_GET(self): def do_GET(self):
try: try:
@ -352,23 +347,22 @@ class MyHandler(BaseHTTPRequestHandler):
directory = os.path.dirname(os.path.abspath(__file__)) directory = os.path.dirname(os.path.abspath(__file__))
data = open(os.path.join(directory, self.path), "rb").read() data = open(os.path.join(directory, self.path), "rb").read()
self.send_response(200) self.send_response(200)
self.send_header('Content-type', 'text/html') self.send_header('Content-type', 'text/html')
self.end_headers() self.end_headers()
self.wfile.write(data) self.wfile.write(data)
elif self.path.endswith(".mjpeg"): elif self.path.endswith(".mjpeg"):
self.thread = thread = OSCThread(self.server.args) self.thread = thread = OSCThread(self.server.args)
thread.daemon = True thread.daemon = True
thread.start() thread.start()
self.send_response(200)
actor_names = ["bjoern", "merle", "uwe"] actor_names = ["bjoern", "merle", "uwe"]
num_data = 100 num_data = 100
colors = ["r", "g", "b"] colors = ["r", "g", "b"]
qtapp = QtGui.QApplication([]) qtapp = QtGui.QApplication([])
plotter = EkgPlot(actor_names, num_data, colors) plotter = EkgPlot(actor_names, num_data, colors)
self.send_response(200)
self.wfile.write("Content-Type: multipart/x-mixed-replace; boundary=--aaboundary\r\n\r\n") self.send_header("Content-Type", "multipart/x-mixed-replace; boundary=--aaboundary")
self.end_headers()
#lastTime = time.time() #lastTime = time.time()
#fps = None #fps = None
event_loop = QtCore.QEventLoop() event_loop = QtCore.QEventLoop()
@ -432,15 +426,15 @@ class JustAHTTPServer(HTTPServer):
def main(): def main():
arg_parser = create_arg_parser("ekgplotter") arg_parser = ArgParser("ekgplotter")
own_group = add_main_group(arg_parser) own_group = arg_parser.add_main_group()
own_group.add_argument('-x', "--http_host", default="::", arg_parser.add_argument(own_group, '-x', "--http_host", default="::",
help='my host, defaults to "::"') help='my host, defaults to "::"')
own_group.add_argument('-X', "--http_port", default=9000, arg_parser.add_argument(own_group, '-X', "--http_port", default=9000,
type=int, help='my port, defaults to 9000') type=int, help='my port, defaults to 9000')
add_chaosc_group(arg_parser) arg_parser.add_chaosc_group()
add_subscriber_group(arg_parser, "ekgplotter") add_subscriber_group()
args = finalize_arg_parser(arg_parser) args = arg_parser.finalize()
http_host, http_port = resolve_host(args.http_host, args.http_port, args.address_family) http_host, http_port = resolve_host(args.http_host, args.http_port, args.address_family)

View File

@ -26,7 +26,7 @@ import serial
import socket import socket
import time import time
from chaosc.argparser_groups import create_arg_parser, finalize_arg_parser, add_chaosc_group from chaosc.argparser_groups import ArgParser
try: try:
@ -75,17 +75,18 @@ class Platform(object):
def create_args(name): def create_args(name):
arg_parser = create_arg_parser(name) arg_parser = ArgParser(name)
arg_parser.add_global_group()
main_group = arg_parser.add_argument_group("main") main_group = arg_parser.add_argument_group("main")
main_group.add_argument("-d", '--device', required=True, arg_parser.add_argument(main_group, "-D", '--device', required=True,
type=str, help='device node under /dev') type=str, help='device node under /dev')
main_group.add_argument("-a", '--actor', required=True, arg_parser.add_argument(main_group, "-a", '--actor', required=True,
type=str, help='actor name') type=str, help='actor name')
main_group.add_argument('-4', '--ipv4_only', action="store_true", arg_parser.add_argument(main_group, '-b', '--baudrate', type=int, default=115200, choices=sorted(serial.baudrate_constants.keys()),
help='select ipv4 sockets, defaults tp ipv6"') help='selects the baudrate, default=115200, for valid values execute "import serial;print sorted(serial.baudrate_constants.keys())"')
add_chaosc_group(arg_parser) arg_parser.add_chaosc_group()
args = finalize_arg_parser(arg_parser) args = arg_parser.finalize()
return args return args