Skip to content

Commit

Permalink
Add pebblekit js setup.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrissiQ committed Mar 27, 2015
1 parent 2dc9876 commit 82af053
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion appinfo.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"appKeys": {},
"capabilities": [
""
"location"
],
"companyName": "Chrissi",
"longName": "Tutorial 1",
Expand Down
27 changes: 27 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#define DATE_TEMPLATE "Sept 31"
#define FONT_SECONDS FONT_KEY_BITHAM_30_BLACK
#define FONT_MINUTES FONT_KEY_BITHAM_42_BOLD
#define KEY_TEMPERATURE 0
#define KEY_CONDITIONS 1

static Window *s_main_window;
static TextLayer *s_time_layer;
Expand Down Expand Up @@ -106,6 +108,21 @@ static void main_window_unload(Window *window) {
fonts_unload_custom_font(s_weather_font);
}

static void inbox_received_callback(DictionaryIterator *iterator, void *context) {

}
static void inbox_dropped_callback(AppMessageResult reason, void *context) {
APP_LOG(APP_LOG_LEVEL_ERROR, "Message dropped!");
}

static void outbox_failed_callback(DictionaryIterator *iterator, AppMessageResult reason, void *context) {
APP_LOG(APP_LOG_LEVEL_ERROR, "Outbox send failed!");
}

static void outbox_sent_callback(DictionaryIterator *iterator, void *context) {
APP_LOG(APP_LOG_LEVEL_INFO, "Outbox send success!");
}

static void init() {
// Create main Window element and assign to pointer
s_main_window = window_create();
Expand All @@ -124,6 +141,16 @@ static void init() {

// Register with TickTimerService
tick_timer_service_subscribe(MINUTE_UNIT, tick_handler);

// Register callbacks
app_message_register_inbox_received(inbox_received_callback);
app_message_register_inbox_dropped(inbox_dropped_callback);
app_message_register_outbox_failed(outbox_failed_callback);
app_message_register_outbox_sent(outbox_sent_callback);

// Open AppMessage
app_message_open(app_message_inbox_size_maximum(), app_message_outbox_size_maximum());

}

static void deinit() {
Expand Down
13 changes: 13 additions & 0 deletions src/weather.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Listen for when the watchface is opened
Pebble.addEventListener('ready',
function(e) {
console.log('PebbleKit JS ready!');
}
);

// Listen for when an AppMessage is received
Pebble.addEventListener('appmessage',
function(e) {
console.log('AppMessage received!');
}
);

0 comments on commit 82af053

Please sign in to comment.