Open grodino opened 8 years ago
It is not freezed, it is waiting for you to send instructions. Try sending a Ping
message as described in the Docs
Thank you for your answer, In deed I tried to do it several times and it did not do anything. The only result I get when I set debug level to DEBUG is this :
DEBUG:libpebble2.communication:-> WatchVersion(command=None, data=WatchVersionRequest())
DEBUG:libpebble2.communication:-> 0001001000
And here is the code :
import logging
import serial
from libpebble2.communication import PebbleConnection
from libpebble2.communication.transports.serial import SerialTransport
from libpebble2.protocol import *
logging.basicConfig(level=logging.DEBUG)
pebble = PebbleConnection(
SerialTransport('COM10'),
log_protocol_level=logging.DEBUG,
log_packet_level=logging.DEBUG
)
pebble.connect()
pebble.run_async()
print(pebble.watch_info.serial)
pebble.send_packet(PingPong(message=Ping(), cookie=53))
pebble.read_from_endpoint(PingPong)
print(pebble.watch_info.serial)
Why don't you try print results from endpoint reading? You are just printing watch_info
property
Yes, I tried it but it is breaking before this.
Actually, the freeze occurs when the SerialTransport
calls serial.write()
when trying to fetch Watchversion
I've heard about Windows 10 problems with bluetooth COM ports, it might be something like that.
Could you provide some "breaking" code?
I'm sorry I don't understand what you mean by "breaking code" ?
Can you post code that actually "doesn't work"
Oh ok thank you for the explenation, The breaking code is the few lines I posted before :
import logging
import serial
from libpebble2.communication import PebbleConnection
from libpebble2.communication.transports.serial import SerialTransport
from libpebble2.protocol import *
logging.basicConfig(level=logging.DEBUG)
pebble = PebbleConnection(
SerialTransport('COM10'),
log_protocol_level=logging.DEBUG,
log_packet_level=logging.DEBUG
)
pebble.connect()
pebble.run_async() # The code freezes here
print(pebble.watch_info.serial)
pebble.send_packet(PingPong(message=Ping(), cookie=53))
pebble.read_from_endpoint(PingPong)
print(pebble.watch_info.serial)
Hi pebblers,
I'm currently trying to get libpebble2 running on windows 10. I'm using the serial transport to communicate with my watch. When I call
pebble.run_async()
the code doesn't do anything and never stop, without displaying anything.I first thought that the problem was coming from python 3.5 but I tried it too on python 2.7 and it didn't work.
I am on windows 10 and here is my code :
Thank you for your help !