From: Matt Webb Date: Mon, 22 Sep 2014 18:41:03 +0000 (+0100) Subject: this is the first version that prints properly - although upside-down - to my test... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=02356cfe4f6e3d0222b7ee6919b9bcc15d5c1a23;p=sirius.git this is the first version that prints properly - although upside-down - to my test printergit add . --- diff --git a/app/__init__.py b/app/__init__.py index e800423..70b996d 100755 --- a/app/__init__.py +++ b/app/__init__.py @@ -19,7 +19,9 @@ from . import commands # for this to work, I have to put the following line at line 38 of # flask_sockets, to inject it into the environment # environment.environ['HTTP_SEC_WEBSOCKET_PROTOCOL'] = 'bergcloud-bridge-v1' - +def protocol_name(): + print "asked for protocol" + return 'bergcloud-bridge-v1' def create_app(config_name): app = Flask(__name__) @@ -29,7 +31,10 @@ def create_app(config_name): bootstrap.init_app(app) db.init_app(app) sockets.init_app(app) - + + # maybe this sets the HTTP_SEC_WEBSOCKET_PROTOCOL ? + app.protocol_name = protocol_name + # attach routes and custom error pages from .main import main as main_blueprint app.register_blueprint(main_blueprint) @@ -58,7 +63,7 @@ def create_app(config_name): #ws.send(j) if event['type'] == 'DeviceEvent': counting += 1 - if counting == 10: + if counting == 4: gevent.sleep(0.5) j = commands.set_delivery_and_print().to_json() ws.send(j) diff --git a/app/commands.py b/app/commands.py index fc3cbb0..8e14ded 100644 --- a/app/commands.py +++ b/app/commands.py @@ -19,7 +19,8 @@ import json # firmware_update TEST_FILE_ID = 1 -TEST_PNG_FN = '/Users/matt/Documents/dev-unversioned/sirius2/iconrethink.png' +#TEST_PNG_FN = '/Users/matt/Documents/dev-unversioned/sirius2/iconrethink.png' +TEST_PNG_FN = '/Users/matt/Documents/dev/sirius/tests/iconrethink.png' # some constants DEVICE_TYPE = '\x01' # rBergCloud::Barringer::DEVICE_TYPE in weminuche-server @@ -70,7 +71,7 @@ def set_delivery_and_print_payload(file_id, png_fn): # device type c, reserved byte c, # command_name