Developer Instructions (SDK 1.x)

Custom settings require the smartphone app httPebble, available in both the iTunes Store and Google Play.The httPebble application allows Pebble apps to access the Internet.

A detailed description of httPebble can be found at https://github.com/Katharine/httpebble-watch, and there are also links to example code.

From your Pebble app, you need to send a request using httPebble to this URL:
      http://setpebble.com/api/XXXX
where the "XXXX" characters are replaced by a unique key identifier associated with your specific app version.


 

Developer Instructions (SDK 2.0)

From your Pebble app, you need to send a request for settings to this URL:
      http://x.setpebble.com/api/XXXX/PEBBLE_TOKEN
where the "XXXX" characters are replaced by a unique key identifier associated with your specific app version and the PEBBLE_TOKEN is the 32-character unique identifier supplied by your Pebble app.

The custom configurations are set at this URL:
      http://x.setpebble.com/XXXX/PEBBLE_TOKEN
using your app identifier key (XXXX) and the 32-character Pebble token.


 

Example Code (SDK 1.x)

simplicity.c Source Code

The simplicity watchface example has been modified to receive settings from SETPEBBLE.COM. Here is a summary of the changes made to the simplicity code, which is included in the Pebble SDK:

UUID
Changed the UUID to the common UUID as recommended by httPebble instructions:#define MY_UUID {0x91,0x41,0xB6,0x28,0xBΩ,0x89,0x49,0x8Ω,0xB1,0x47,0x04,0x9F,0x49,0xC0,0x99,0xAD }
Constants
Added constants used in sending/receiving httPebble messages:const int kCookie = 1949327672;
const int kAppId = 0x12345678;
httPebble message handler
Created function to handle successful messages received from httPebble:void http_success_handler(int32_t request_id, int http_status, DictionaryIterator* received, void* ctx) {
  if (request_id == kCookie) {
    Tuple* data_tuple = dict_find(received, 1);
    if (data_tuple && strlen(data_tuple->value->cstring)) {
      if (data_tuple->value->cstring[0] == '1') {
        // invert screen - declare "static InverterLayer inverter_layer;" above
        inverter_layer_init(&inverter_layer, GRect(0, 0, 144, 168));
        layer_add_child(window_get_root_layer(&window), &inverter_layer.layer);
      }
    }
  }
}
Register httPebble callbacks
In Handler_init() function, register the callback functions used by httPebble:http_set_app_id(kAppId);
http_register_callbacks((HTTPCallbacks) {
  .success = http_success_handler
}, ctx);
Request settings
Send request to SETPEBBLE.COM using httPebble:DictionaryIterator* body;
HTTPResult http_result = http_out_get("http://setpebble.com/api/ABCD", kCookie, &body);
if (http_result == HTTP_OK) {
  http_result = http_out_send();
  if (http_result != HTTP_OK) {
    // possibly display error here
  }
}
Enable messaging
In pbl_main() function, declare messaging buffers:PebbleAppHandlers handlers = {
  .init_handler = &handle_init,
    ...
  .messaging_info = {
    .buffer_sizes = {
      .inbound = 124,
      .outbound = 124,
    }
  }
}

 

Simplicity International (SDK 1.0)

GitHub.com/SetPebble/Simplicity

The source code for Simplicity International is publically available on GitHub.com. The original Simplicity watchface included in the PebbleSDK-1.12 from Pebble.

This version also has special code that includes the Bluetooth address of the Pebble watch when requesting custom settings from SetPebble.com. Several Pebble watches that communicate through Android strip the serial number, and this code retrieves the Bluetooth address from Pebble memory so custom settings can be identified.


 

How do I test my app and custom settings? (SDK 1.0)

Even if your app and version are disabled, you can still access the settings page with direct URLs.

To change your app settings, use the following URL:
   http://setpebble.com/set?key=XXXX&sn=YYYYYYYYYYYY
Apps are supposed to reference this URL:
    http://setpebble.com/api/XXXX
and you have the option of appending your Pebble serial number to get your specific settings:
    http://setpebble.com/api/XXXX/YYYYYYYYYYYY
where the XXXX is your unique key associated with your app version, and YYYYYYYYYYYY is the 12-digit serial number (or bluetooth) of your watch.


 

Simplicity (SDK 2.0)

GitHub.com/SetPebble/Simplicity2

The easiest way to show how to interface your Pebble SDK 2.0 app with SetPebble.com is to show by example. Click on the GitHub link to download and review the Simplicity watchface code.

There is a README file available that has screenshots and more information: README.md


 

My app and version are ready - now what?

Check the Enable checkboxes for your app and version. Next contact us and we will approve your app to be listed with the other enabled apps.


 

I need help

Send an e-mail (info@setpebble.com) and we'll help.

You may also have suggestions for adding other types of customizable settings, for example checkboxes. We can help!