Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion webservice_serial/target/android/adb.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(self, command="adb", log=None):
self.log = log

def start(self, port, activity):
#self.execute('shell am start -n {}'.format(activity))
self.execute('shell am start -n {}'.format(activity))
#self.execute('forward --remove-all')
self.execute('forward tcp:{} tcp:{}'.format(port, port))

Expand Down
2 changes: 1 addition & 1 deletion webservice_serial/target/android/android_display_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


class AndroidDisplayView(Target):
activity = 'io.github.pedalpi.pedalpi_display/io.github.pedalpi.displayview.activity.ResumeActivity'
activity = 'io.github.pedalpi.displayview/io.github.pedalpi.displayview.activity.resume.ResumeActivity'

def __init__(self):
super(AndroidDisplayView, self).__init__()
Expand Down
12 changes: 7 additions & 5 deletions webservice_serial/webservice_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
# limitations under the License.

from application.component.component import Component
from webservice_serial.protocol.response_verb import ResponseVerb

from tornado import gen
from tornado.ioloop import IOLoop
from webservice_serial.request_message_processor import RequestMessageProcessor
from webservice_serial.webservice_serial_client import WebServiceSerialClient
from webservice_serial.websocket_client import WebSocketClient

from time import sleep


class WebServiceSerial(Component):
port = 8888
Expand Down Expand Up @@ -53,9 +51,13 @@ def init(self):
self._try_connect()

def _try_connect(self, delay=0):
IOLoop.current().spawn_callback(self.__try_connect, delay)

@gen.coroutine
def __try_connect(self, delay=0):
self._log('Trying to connect with {}', self.target.name)
self.target.init(self.application, WebServiceSerial.port)
sleep(delay)
yield gen.sleep(delay)
self._client.connect()

def _on_token_defined(self, token):
Expand Down
2 changes: 1 addition & 1 deletion webservice_serial/webservice_serial_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, address, port, encoding="utf-8"):
self.disconnected_listener = lambda: print('Disconnected :(')

def connect(self):
IOLoop.current().spawn_callback(lambda: self._connect())
IOLoop.current().spawn_callback(self._connect)

@gen.coroutine
def _connect(self):
Expand Down