This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| HOST = "KemperSystem80009000" | |
| PORT = 4223 | |
| from tinkerforge.ip_connection import IPConnection | |
| # Print incoming enumeration | |
| def cb_enumerate(uid, connected_uid, position, hardware_version, firmware_version, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| simon@ubuntu:~/Documents/resin-preload-image-script$ sudo ./preload.sh --app 206443 --api-token "nononoapitokenhere" --img ~/Documents/airwatch2production-uart.img | |
| [sudo] Passwort für simon: | |
| Sending build context to Docker daemon 249.9 kB | |
| Step 1 : FROM docker:1.10-dind | |
| ---> 305c151749f4 | |
| Step 2 : RUN apk update && apk add --no-cache bash curl jq parted btrfs-progs docker util-linux | |
| ---> Using cache | |
| ---> 83a39ee72017 | |
| Step 3 : COPY ./src /usr/src/app | |
| ---> Using cache |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BublitzB2(object): | |
| def __init__(self): | |
| self.serial_port = None | |
| self.lock = Semaphore() | |
| self.status = {} | |
| self.bridge = serial.Serial(mraa.Uart(0).getDevicePath(), | |
| 38400, | |
| timeout=0.1, | |
| parity=serial.PARITY_NONE, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| \ Syncing to /usr/src/app on 6980943...debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 | |
| debug2: channel 0: rcvd eof | |
| debug2: channel 0: output open -> drain | |
| debug2: channel 0: obuf empty | |
| debug2: channel 0: close_write | |
| debug2: channel 0: output drain -> closed | |
| debug2: channel 0: rcvd close | |
| debug2: channel 0: close_read | |
| debug2: channel 0: input open -> closed | |
| debug2: channel 0: almost dead |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask | |
| from flask_socketio import SocketIO, emit | |
| import eventlet | |
| from eventlet import semaphore | |
| from eventlet.queue import Empty, Full | |
| import os | |
| eventlet.monkey_patch() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask | |
| from flask_socketio import SocketIO, emit | |
| import eventlet | |
| from eventlet import semaphore | |
| from eventlet.queue import Empty | |
| import os | |
| eventlet.monkey_patch() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from autobahn.asyncio.websocket import WebSocketServerProtocol, WebSocketServerFactory | |
| import asyncio | |
| import serial.aio | |
| from serial.aio import SerialTransport | |
| class BridgeQueue(object): | |
| def __init__(self, queue): | |
| self.queue = queue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| async def onMessage(self, payload, isBinary): | |
| print("Binary message received: {0} bytes -> Putting in Queue".format(len(payload))) | |
| await self.factory.queue.put(self.print_async(payload)) | |
| # Start Queue Worker Here | |
| print('Starting Queue Worker') | |
| global counter | |
| counter += 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| AsyncIO Web-Socket und UART Server der im Falle eingehender Daten (über Web Socket oder UART) | |
| entsprechende Tasks erstellt und diese Tasks an eine AsyncIO Queue übergibt. | |
| Ein dritter Part - der Worker - kümmert sich dabei um die "Abholung" der Tasks aus der Queue | |
| und dessen Ausführung. Idee ist es hier, dass multiple Clients nicht parallel auf den Serial Port | |
| zugreifen können und dass ggf. bei vorhandenem Zugriff Locking des UARTs einfacher ausgeführt | |
| werden kann. Die Queue ist eine serielle Abfolge von AsyncIO coroutines. Durch hinzufügen weiterer | |
| Worker kann man Parallelität realisieren. Die serielle Abfolge ist aber hier explizit gewollt!!! | |
| Ist' nur Demo. Habe das Ding nur für mich geschrieben um AsyncIO und Queues besser verstehen zu |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pi@garagepi:~/garagepi $ sudo systemctl status homebridge | |
| ● homebridge.service - Node.js HomeKit Server | |
| Loaded: loaded (/etc/systemd/system/homebridge.service; enabled) | |
| Active: active (running) since Mo 2017-01-02 23:15:21 CET; 1min 9s ago | |
| Main PID: 8669 (homebridge) | |
| CGroup: /system.slice/homebridge.service | |
| └─8669 homebridge | |
| Jan 02 23:16:17 garagepi homebridge[8669]: Mon, 02 Jan 2017 22:16:17 GMT EventedHTTPServer [::ffff:192.168.1.122] HTTP connection was closed | |
| Jan 02 23:16:17 garagepi homebridge[8669]: Mon, 02 Jan 2017 22:16:17 GMT EventedHTTPServer [::ffff:192.168.1.122] HTTP server was closed |