diff --git a/appinfo.json b/appinfo.json index 3620e18..54d20b4 100644 --- a/appinfo.json +++ b/appinfo.json @@ -1,7 +1,7 @@ { "appKeys": {}, "capabilities": [ - "" + "location" ], "companyName": "Chrissi", "longName": "Tutorial 1", diff --git a/src/main.c b/src/main.c index c03bf85..054e0d6 100644 --- a/src/main.c +++ b/src/main.c @@ -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; @@ -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(); @@ -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() { diff --git a/src/weather.js b/src/weather.js new file mode 100644 index 0000000..a4f8b6e --- /dev/null +++ b/src/weather.js @@ -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!'); + } +); \ No newline at end of file