pebble
  • Tutorials
  • Get the SDK
  • Guides
  • Documentation
  • PebbleOS
  • Mobile App
  • Examples
  • Index 01
  • Community
  • Blog
  • More
Privacy
Cookies
Publish

PebbleOS

  • Overview
  • Start here
    • Getting started guide
    • Playground
  • Development
    • The pbl CLI
      • pbl configure
      • pbl build
      • pbl bundle
      • pbl menuconfig
      • pbl clean
      • pbl test
      • pbl itest
      • pbl run
      • pbl console
      • pbl debug
      • pbl emulator
      • pbl image_resources
      • pbl image_recovery
      • pbl erase
      • Extending pbl
    • Build system
    • Emulator and simulator
    • Testing
    • Debugging
    • Conventions
  • System
    • Architecture overview
    • Kernel
    • Subsystems
    • Drivers
    • Services
    • Libraries
    • Third-party
    • Application SDK
  • Hardware
    • Boards
    • Programmers
  • Community
    • Contribution Guidelines
  • Reference
    • Reference
    • Kconfig options
    • API reference

pbl emulator

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.

Screenshots

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 OUTPUT

Where to write the PNG (default: screenshot.png in the build)

Touch

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
x

x coordinate in screen pixels

y

y coordinate in screen pixels

--duration DURATION

how long the finger stays down, in seconds (default: 0.05)

pbl emulator swipe [-h] [-b DIR] [--dry-run] [--duration DURATION] x1 y1 x2 y2
x1

start x in screen pixels

y1

start y in screen pixels

x2

end x in screen pixels

y2

end y in screen pixels

--duration DURATION

total duration in seconds (default: 0.25)

Phone data

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 ...
calendar

A day of calendar events

music

A music player and its playlist

notifications

A day of messages from a few senders

weather

A forecast for a few cities

--host HOST

host: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.

Overview

  • Screenshots
  • Touch
  • Phone data