Thomas Sarlandie, Head Developer Evangelist at Pebble, welcomes everyone to the second ever Developer Retreat and goes through a detailed agenda of the next 4 days including some interesting facts about Pebble development over the past year.
Also featured:
New stuff in 2.6 - Background Workers
Coming up in 2.7 - Wakeup API
Day 1 - Video 2
15. ONE YEAR OF FIRMWARE
2.1 2.2 2.3 2.4 2.5 2.6
2.0
May June July
Feb Sep
Battery life
PebbleKit JS
Connectivity
+10% Battery Life
+50% Time Connected
16. AND MORE …
2.1 2.2 2.3 2.4 2.5 2.6 2.7
2.0
May June July
Feb Sep
WakeUp
21. FRAME BUFFER API
Directly manipulate the frame buffer
Overlay the frame buffer with UI elements
!
GBitmap* graphics_capture_frame_buffer(GContext* ctx);
Details later today in our Graphics talk
23. INTRODUCING THE BACKGROUND WORKER API
Build Activity Trackers
A separate executable in your app
Only one Worker running on Pebble
!
Limited to 12kB of RAM
Limited set of APIs
!
Can both exchange messages
Background app can launch the foreground app
Foreground App
Background Worker
PBW
24. "## appinfo.json
"## resources
"## src
$ &## bgexample.c
"## worker_src
$ &## worker.c
&## wscript
USING BACKGROUND WORKER
The new Pebble build script will automatically
look for worker files in the worker_src folder.
!
On CloudPebble, you can select to add a file to
the foreground app or background worker.
!
Worker must #include <pebble_worker.h>
!
You can also use pebble new-project --worker
25. STARTING THE BACKGROUND WORKER
The foreground process can launch the background worker
!
!
AppWorkerResult result = app_worker_launch();
!
Check the return value for errors.
26. ONE BACKGROUND WORKER AT A TIME
Starting an activity tracker while another one is running
will cause the system to show a confirmation popup
!
When the interrupting tracker is stopped, the previous
one is automatically restarted
27. POLLING FOR YOUR BACKGROUND WORKER
Your application can query the state of its background
worker
!
bool running = app_worker_is_running();
!
And of course stop it
!
app_worker_kill();
28. COMMUNICATING WITH BACKGROUND WORKER
Background worker and foreground app can communicate via a new
dedicated channel AppWorkerMessage:
bool app_worker_message_subscribe(AppWorkerMessageHandler handler);
typedef void (*AppWorkerMessageHandler)
(uint16_t type, AppWorkerMessage *data);
void app_worker_send_message(uint8_t type, AppWorkerMessage *data);
!
This channel can be used to synchronize status information, current stats,
user actions, etc.
AppWorkerMessage is limited to 3 bytes. Use Persistent Storage to
exchange more data.
29. COMMUNICATING WITH THE PHONE
Background worker do not have access to AppMessage and PebbleKit JS.
They do have access to Persistent Storage and Data Logging,
!
Possible strategies:
1. Continuously transfer data to a mobile app via Data Logging
2. Save data to Persistent Storage,
Start the foreground app to push data via AppMessage and JavaScript
30. BACKGROUND WORKERS
Designed and optimized for Activity Trackers
!
Only one running at a time
!
Compatible with DataLogging or PebbleKit JS (via Persistent Storage)
32. WAKE UP!
Background Worker is great for activity tracker …
But what about Timers, Alarms, Game Alerts?
!
The Wake Up API lets your app request a Wake Up call.
33. HOW TO REQUEST A WAKE UP CALL?
Your application can set a time in the future where it wants to be awoken:
!
WakeupID
app_wakeup_schedule(time_t timestamp, int32_t reason, bool notify);
34. HOW TO RECEIVE A WAKE UP CALL
If your application is not running, it will be started.
You can figure out why via a new AppLaunchReason API:
!
AppLaunchReason app_launch_reason(void);
!
typedef enum {
APP_LAUNCH_SYSTEM = 0, //!< App launched by the system
APP_LAUNCH_USER, //!< App launched by user selection
APP_LAUNCH_PHONE, //!< App launched by mobile or companion app
APP_LAUNCH_WAKEUP //!< App launched by wakeup event
} AppLaunchReason;
!
bool app_wakeup_get_launch_event(WakeupID *id, int32_t *reason);
35. HOW TO RECEIVE A WAKE UP CALL
If your application is running, you will receive an event. Just like all event
services, you need to register a handler first:
!
typedef void (*WakeupHandler)(WakeupID wakeup_id, int32_t reason);
void app_wakeup_service_subscribe(WakeupHandler handler);
36. SNOOZE
The system will refuse to schedule a WakeUp event with
less than 60 seconds margin to other WakeUp events.
Use the return value to re-schedule if needed.
!
If the watch is off, the WakeUp event will be missed but
you can notify the user via the notify parameter.
!
Each app can only schedule up to 8 events.
37. USING THE WAKE UP API TODAY
The WakeUp API is included in FW 2.7-beta1 distributed today to all
developer retreat attendees and to all registered Pebble developers who
request access to it.
39. Thursday Friday Saturday Sunday
Kickoff
Graphics
Battery
Workshop
Code Review
Hacking
and Robots
Hacking
Meetup in SF
Strap
Pebble Dev
Awards
Size
1010000
Bluetooth LE
Workshop
Computer
History Museum
Code Review Code Review
CloudPebble
Overlay
Pebble™
40. ADVANCED PEBBLE PROGRAMMING
1pm to 4pm
Heiko and Matthew will share our most advanced techniques and best tips!
!
Size
Graphics
1010000
42. Learn what really impacts battery life
!
Find out how much battery your application is really
using on user wrists
!
Discover best practices to save battery
BATTERY WORKSHOP
10:30 to 11:00
43. BLUETOOTH LOW ENERGY
11:00 to 11:30
This is what happens when we let our engineers loose
!
Martijn will distribute an experimental (!) firmware with
support for a BLE API and we will share a bunch of
BLE-enabled gadgets.
!
The rest is up to you …
44. Work with one of our engineer to improve your
code, reduce the size of your apps, battery usage,
speed of your graphics, etc!
CODE REVIEWS
45. CLOUDPEBBLE WORKSHOP
Discover CloudPebble new features
!
Tell us what you would like to see in
CloudPebble
14:30 to 15:00
47. USING RESOURCE SPACE FOR CODE
15:30 to 16:00
Have you ever struggled with the 24k limit?
!
Ron and Grégoire will show you how to split your code in several pieces
that will be dynamically loaded from the resources.
!
This is also a great presentation to learn more about Pebble memory system
and the SDK build tools.
48. USE OF THE “PEBBLE” BRAND
16:00 to 16:30
The name Pebble is becoming more and more
popular, especially among apps. As we keep on
growing we will need to change the rules regarding
how you can use our name.
!
Join the developer evangelism team and the legal
team to discuss how we should roll this out.
51. On Sunday morning, Cherie will give
awards to notable members of the
developer community.
PEBBLE AWARDS
52. Thursday Friday Saturday Sunday
Kickoff
Graphics
Battery
Workshop
Code Review
Hacking
and Robots
Hacking
Meetup in SF
Strap
Pebble Dev
Awards
Size
1010000
Bluetooth LE
Workshop
Computer
History Museum
Code Review Code Review
CloudPebble
Overlay
Pebble™
55. FEEDBACK THIS YEAR
We would like to hear all your feedbacks. There are no subjects that are
taboo. Please share all ideas and suggestions.
Appstore APIs flexibility
Paid apps
Firmware APIs
Phone2Watch
Communication
PebbleKit JS
Promotion
Mobile apps
Pebble.js
8 Apps limit?
UI / Design
Config view
Answering Notifications?
iOS Android
Communication
Hardware
Bands Accessories
Customization