Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/python
- from libpebble2.communication import PebbleConnection
- from libpebble2.communication.transports.qemu import QemuTransport
- from libpebble2.services.notifications import Notifications
- from libpebble2.protocol import *
- from libpebble2.services import *
- import logging
- import time
- import os
- logging.basicConfig(level=logging.DEBUG)
- pebble = PebbleConnection(QemuTransport("localhost", 63771), logging.DEBUG, logging.DEBUG)
- pebble.connect()
- pebble.run_async()
- print (pebble.watch_info.serial)
- print (pebble.watch_info.running.version_tag)
- pebble.send_packet(WatchModel(data=ModelRequest()))
- pebble.read_from_endpoint(WatchModel)
- pebble.send_packet(PingPong(message=Ping(), cookie=53))
- pebble.read_from_endpoint(PingPong)
- pebble.send_packet(AppRunState(data=AppRunStateRequest()))
- pebble.read_from_endpoint(AppRunState)
- pebble.send_packet(TimeMessage(message=GetTimeRequest()))
- msg = pebble.read_from_endpoint(TimeMessage)
- print time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(msg.message.time))
- pebble.send_packet(TimeMessage(message=SetLocaltime(time=msg.message.time - 60)))
- pebble.send_packet(TimeMessage(message=GetTimeRequest()))
- msg = pebble.read_from_endpoint(TimeMessage)
- print time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(msg.message.time))
- pebble.send_packet(TimeMessage(message=SetUTC(unix_time=msg.message.time + 60, utc_offset=0, tz_name="UTC+0")))
- pebble.send_packet(TimeMessage(message=GetTimeRequest()))
- msg = pebble.read_from_endpoint(TimeMessage)
- print time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(msg.message.time))
- n = Notifications(pebble, None)
- n.send_notification(subject="helllo")
- #pebble.send_packet(PhoneNotification(command_id=0x04, cookie=32, message=IncomingCall(name="hello", number="world")))
- #msg = pebble.read_from_endpoint(PhoneNotification)
- #print msg
- 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)))
- #time.sleep(5)
- #pebble.send_packet(PhoneNotification(command_id=0x08, cookie=32, message=CallStart()))
- #time.sleep(5)
- #pebble.send_packet(PhoneNotification(cookie=32, message=CallEnd()))
- #pebble.disconnect()
- #os.system("python phonesim.py")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement