abranson / rockpool

Pebble client application for Sailfish OS
41 stars 19 forks source link

Developer connection is missing in rockpoold #16

Closed rufferson closed 8 years ago

rufferson commented 8 years ago

The protocol implementation is in libpebble2 - https://github.com/pebble/libpebble2/blob/master/libpebble2/communication/__init__.py : PebbleConnection By default pebble-tool communicates with the phone on port 9000: def _connect_phone(self, phone): parts = phone.split(':') ip = parts[0] if len(parts) == 2: port = int(parts[1]) else: port = 9000 connection = PebbleConnection(WebsocketTransport("ws://{}:{}/".format(ip, port)), **self._get_debug_args()) connection.connect() connection.run_async() return connection

abranson commented 8 years ago

RockWork already supports Websockets, but I've had to ifdef it out because the QtWebsockets API was introduced in a newer version of Qt than Sailfish currently supports. Someone in the thread suggested an alternative implementation, but it might block this.

rufferson commented 8 years ago

According to this https://lists.sailfishos.org/pipermail/devel/2015-April/005917.html QtWebSockets could be built for 5.2 - but i think dragging statically linked library is a bit too much.

abranson commented 8 years ago

That would be cleaner than having to overlay some alternative implementation though. I will have a go of this because it's really limiting our future interactions with pebble.com too.

abranson commented 8 years ago

Coderus already built it:

https://openrepos.net/content/coderus/qt5websockets

rufferson commented 8 years ago

Interesting to note - mozilla implements certain websocket interface [SB2 sdk-install SailfishOS-armv7hl] root@SailfishSDK ~ # strings /usr/lib/xulrunner-qt5-38.0.5/libxul.so|grep nsIWebSocket 19nsIWebSocketChannel ]zs20nsIWebSocketListener [SB2 sdk-install SailfishOS-armv7hl] root@SailfishSDK ~ # strings /usr/lib/xulrunner-qt5-38.0.5/libxul.so|grep WebSocket:: PWebSocket::Msg_Close PWebSocket::Msg_SendMsg PWebSocket::Msg_SendBinaryMsg PWebSocket::Msg_DeleteSelf PWebSocket::Msg_OnStart PWebSocket::Msg_OnStop PWebSocket::Msg_OnMessageAvailable PWebSocket::Msg_OnBinaryMessageAvailable PWebSocket::Msg_OnAcknowledge PWebSocket::Msg_OnServerClose PWebSocket::Msg_delete PWebSocket::Msg_AsyncOpen PWebSocket::Msg_SendBinaryStream WebSocket::mMutex [SB2 sdk-install SailfishOS-armv7hl] root@SailfishSDK ~ #

not sure how practically it's usable yet, and anyway dragging mozilla context and parent/child threads to the daemon will be silly. however it may still be usable for devel connection - eg. to bridge/proxy it through the client's embedlite.

rufferson commented 8 years ago

or actually no, listener is not serverside glue, merely async helper for the client-side socket. a bit misleading.

rufferson commented 8 years ago

should be fixed by #36