Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. #!/bin/python
  2. from libpebble2.communication import PebbleConnection
  3. from libpebble2.communication.transports.qemu import QemuTransport
  4. from libpebble2.services.notifications import Notifications
  5. from libpebble2.protocol import *
  6. from libpebble2.services import *
  7. import logging
  8. import time
  9. import os
  10.  
  11. logging.basicConfig(level=logging.DEBUG)
  12. pebble = PebbleConnection(QemuTransport("localhost", 63771), logging.DEBUG, logging.DEBUG)
  13. pebble.connect()
  14. pebble.run_async()
  15. print (pebble.watch_info.serial)
  16. print (pebble.watch_info.running.version_tag)
  17.  
  18. pebble.send_packet(WatchModel(data=ModelRequest()))
  19. pebble.read_from_endpoint(WatchModel)
  20.  
  21. pebble.send_packet(PingPong(message=Ping(), cookie=53))
  22. pebble.read_from_endpoint(PingPong)
  23.  
  24. pebble.send_packet(AppRunState(data=AppRunStateRequest()))
  25. pebble.read_from_endpoint(AppRunState)
  26.  
  27. pebble.send_packet(TimeMessage(message=GetTimeRequest()))
  28. msg = pebble.read_from_endpoint(TimeMessage)
  29. print time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(msg.message.time))
  30.  
  31. pebble.send_packet(TimeMessage(message=SetLocaltime(time=msg.message.time - 60)))
  32.  
  33. pebble.send_packet(TimeMessage(message=GetTimeRequest()))
  34. msg = pebble.read_from_endpoint(TimeMessage)
  35. print time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(msg.message.time))
  36.  
  37. pebble.send_packet(TimeMessage(message=SetUTC(unix_time=msg.message.time + 60, utc_offset=0, tz_name="UTC+0")))
  38.  
  39. pebble.send_packet(TimeMessage(message=GetTimeRequest()))
  40. msg = pebble.read_from_endpoint(TimeMessage)
  41. print time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(msg.message.time))
  42.  
  43. n = Notifications(pebble, None)
  44. n.send_notification(subject="helllo")
  45.  
  46. #pebble.send_packet(PhoneNotification(command_id=0x04, cookie=32, message=IncomingCall(name="hello", number="world")))
  47.  
  48. #msg = pebble.read_from_endpoint(PhoneNotification)
  49. #print msg
  50.  
  51. pebble.send_packet(MusicControl(command=0x10, data=MusicControlUpdateCurrentTrack(artist="Rebble-Os", album="version 0.2", title="protocol, next gen",track_length=100, track_count = 22, current_track=2)))
  52.  
  53. #time.sleep(5)
  54. #pebble.send_packet(PhoneNotification(command_id=0x08, cookie=32, message=CallStart()))
  55.  
  56. #time.sleep(5)
  57. #pebble.send_packet(PhoneNotification(cookie=32, message=CallEnd()))
  58.  
  59. #pebble.disconnect()
  60. #os.system("python phonesim.py")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement