Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

value_to_byte is given a float number #19

Open
grodino opened this issue May 13, 2016 · 0 comments
Open

value_to_byte is given a float number #19

grodino opened this issue May 13, 2016 · 0 comments

Comments

@grodino
Copy link

grodino commented May 13, 2016

Hi pebblers !

While trying to send a notification (via WebSocketTransport), a problem occured.
When the notification is built, it creates some TimelineItem objects and one of them has a float value. So when it is serialised by PebblePacket.serialize(), Field.value_to_byte() is called and this line breaks :

return struct.pack(str(self.endianness or default_endianness) + self.struct_format, value)

In deed, since the endianness is a little indian < (for this case), it can convert only python int value.

Rigth now I just cast the value into an int and it works perfectly but I don't know if the fact that this float is given is actually a lib problem.

Thanks for your help !

PS : If it can help, here is my code

from libpebble2.communication import PebbleConnection
from libpebble2.communication.transports.websocket import WebsocketTransport
from libpebble2.services.notifications import Notifications

pebble = PebbleConnection(WebsocketTransport("ws://192.168.0.13:9000/"))
pebble.connect()
pebble.run_async()

print(pebble.watch_info.serial)

notif = Notifications(pebble)
notif.send_notification(u'Star Wars', u'Luke, I am your father', u'Dark vador')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant