Hacking Pebble on iOS


Published on

This is a brief introduction to hacking the Pebble smart watch with iOS.
We cover the difference between Watch Face and Watch Apps, then how to send messages to and from the Pebble and your iPhone.

Published in: Technology, Design
1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Hacking Pebble on iOS

  1. 1. HACKING PEBBLE WITH IOS A brief introduction Aiden Montgomery http://www.constructivecoding.com @AidenMontgomery
  2. 2. WHAT IS PEBBLE? Where did it come from? http://getpebble.com
  3. 3. SPECIFICATION •Pebble OS, modified FreeRTOS •Cortex-M3 ARM microprocessor •1024KB Flash Memory •RAM between 64KB and 128KB •1.26” screen -144 x 168 pixels •Black and white “transflective LCD” (ePaper)
  4. 4. SPECIFICATION •Backlight (motion activated) •Vibrating motor •Ambient light sensor •Bluetooth 2.1 (supports 4.0 future update) •Three-axis accelerometer •Magnetometer •7 day battery (not too sure about that)
  5. 5. WHAT CAN IT DO? Control your phone’s music playback
  6. 6. WHAT CAN IT DO? Golf range finder?
  7. 7. WHAT CAN IT DO? Fitness applications. (Runkeeper)
  8. 8. WHAT CAN IT DO? Tell the time? Multiple watch faces? http://www.mypebblefaces.com/
  9. 9. WHAT CAN IT DO? Receive notifications
  10. 10. WHAT CAN IT DO? •Display SMS •Display Caller ID •Accept/Reject Calls Demo Time
  11. 11. WATCHFACES VS APPS What is the difference? A standard app: • Generally has the system status bar at the top of the display—showing the time. (Although apps can also be made “fullscreen” which removes the status bar.) • May update the display more frequently than a watch face. • Can respond to button presses. A watch face app: • Is displayed full screen without the system status bar. • Usually uses the minute or second handlers. • Is expected to be very careful with its use of system resources (e.g. power, display updates) in order to preserve battery life. • Can be made a “default” that is automatically displayed when the launcher menu times out.
  12. 12. KEY CONCEPTS •Event Handlers •Tick Handler •Input Handler •Resources •Types •Fonts •Bitmaps •Data •Build process converts •On-screen Layers •Object/Layer hierarchy •Layers are drawn on •Higher-level layers •TextLayer •BmpContainer resources into useable a format
  13. 13. ANATOMY OF AN APP There are certain things all Pebble watchapps need to have Headers Meta Data
  14. 14. ANATOMY OF AN APP There are certain things all Pebble watchapps need to have Window Handler + Event Loop
  15. 15. WHAT CAN IT DO? Anything we want?
  16. 16. PEBBLE IOS SDK •http://developer.getpebble.com/ •PebbleKit •Pebble SDK •Current version is 1.12 •11.6MB extracted
  17. 17. DEMO APPLICATION Sports Application
  18. 18. PREREQUISITES •Python Pebble relies heavily on Python based scripts •ARM toolchain Compile applications for the ARM architecture http://developer.getpebble.com/1/GettingStarted/MacOS/
  19. 19. HELLO WORLD Time for code.
  20. 20. PHONE/APP COMMS •Bi-directional Communication •Communication over Bluetooth •SDK abstracts communications (somewhat) •APIs for pushing messages called AppMessage •AppSync is a layer on top of AppMessage •iOS has a Communication Session •Single session for all 3rd party apps •Only opened from iOS •Last one in wins •Close the session when you are done -closeSession:
  21. 21. RECEIVING MESSAGES •Define Inbound Buffer •Messages are all dictionaries •Size calculation •1 + (n * 7) + D1 + ... + Dn •n = number of tuples •Dx sizes of the values •Define Handlers •in_received •in_dropped
  22. 22. IOS (FINALLY) Required Frameworks Additional Configuration •Add the value "com.getpebble.public" to the "Supported external accessory protocols" (UISupportedExternalAccessoryProtocols) array in your app's Info.plist •Optionally, add the value "App communicates with an accessory" (external-accessory) to the "Required background modes" (UIBackgroundModes) array in your app's Info.plist
  23. 23. HANDLING THE PEBBLE •Setup a delegate for Pebble Central •Get the last connected watch •Attempt to connect to the watch •Handle connection and disconnection events •Use the connected watch to send/receive messages Demo Time
  24. 24. MADE FOR IPHONE Pebble participate in the Made for iPhone program. To submit your app to the App Store Pebble need to whitelist your application. Once you have an App completed, email Pebble bizdev@getpebble.com
  25. 25. Links •http://kickstarter.com •http://getpebble.com •http://developer.getpebble.com •http://developer.getpebble.com/1/GettingStarted/MacOS/ •http://pebbledev.org/wiki/Main_Page Aiden Montgomery http://www.constructivecoding.com @AidenMontgomery
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.