Interact with the emulator pbl run is running: QEMU on a qemu_* board,
or the native simulator
on a native_* one. Each action is a subcommand.
On QEMU, screenshots go through the socket monitor and touches through the QMP socket, on the emulated touch controller’s input path. The native simulator has neither: both go over its Pebble protocol port, to the firmware’s screenshot and remote input endpoints. That port serves one client at a time, so they fail there while a feed holds it.
pbl emulator screenshot # build/screenshot.png
pbl emulator screenshot --output /tmp/foo.png
pbl emulator screenshot [-h] [-b DIR] [--dry-run] [-o OUTPUT]
-o, --output OUTPUTWhere to write the PNG (default: screenshot.png in the build)
On touch-capable boards, tap or swipe the screen. Coordinates are screen pixels. A tap is a finger down then up; a swipe moves the finger from the first point to the second through intermediate steps, so drag gestures are seen as continuous.
pbl emulator touch 130 130
pbl emulator swipe 130 220 130 40 # swipe up
pbl emulator swipe 130 220 130 40 --duration 0.4
pbl emulator touch [-h] [-b DIR] [--dry-run] [--duration DURATION] x y
xx coordinate in screen pixels
yy coordinate in screen pixels
--duration DURATIONhow long the finger stays down, in seconds (default: 0.05)
pbl emulator swipe [-h] [-b DIR] [--dry-run] [--duration DURATION] x1 y1 x2 y2
x1start x in screen pixels
y1start y in screen pixels
x2end x in screen pixels
y2end y in screen pixels
--duration DURATIONtotal duration in seconds (default: 0.25)
Write into the running emulator what the phone app would, over the Pebble protocol port, so features that depend on the phone can be exercised without one. Each kind of data is a subcommand:
pbl emulator feed weather # a forecast for a few built-in cities
pbl emulator feed weather Tokyo Sydney --seed 3 # a subset; the first is the current location
pbl emulator feed weather --clear # remove every location
pbl emulator feed music # a player and playlist; keeps serving until Ctrl-C
pbl emulator feed music --title "Demo" --paused # a single track of your own
pbl emulator feed calendar # a day of events around now
pbl emulator feed calendar --title "Dentist" --start 15 --location "Downtown"
pbl emulator feed calendar --clear # remove every pin
pbl emulator feed notifications # a few messages from two senders
pbl emulator feed notifications --sender Anna --body "Lunch?" --app WhatsApp
pbl emulator feed notifications --clear # remove every notification
pbl emulator feed <feed> --help lists a feed’s own options. A feed that
writes a database, like weather, exits once the data is stored. One that
stands in for the phone, like music, keeps running: it acts on the watch’s
controls, advances playback and draws album art when asked (album art is
off by default, under Settings > Music). The emulator’s port serves one
host client at a time, so run one such feed at once.
The feeds live in tools/libs/pbl-cli/pbl/feeds/, one module per kind of
data; Extending pbl shows how to add one.
pbl emulator feed [-h] [-b DIR] [--dry-run] [--host HOST] FEED ...
calendarA day of calendar events
musicA music player and its playlist
notificationsA day of messages from a few senders
weatherA forecast for a few cities
--host HOSThost:port of the emulator’s Pebble protocol serial port (default: 127.0.0.1:12344)
Generated from PebbleOS 105df6122. This page is maintained in the pebbleos repository: docs/pbl/emulator.md.