From 3eeb297edae0b9cb78f0a01c3c8730f00c78ec7d Mon Sep 17 00:00:00 2001 From: dyedgreen Date: Wed, 22 Jun 2016 20:38:53 +0200 Subject: [PATCH] complies but not working yet * The thing is crashing :/ --- package.json | 26 ++++- resources/images/error_api.png | Bin 0 -> 895 bytes resources/images/error_network.png | Bin 0 -> 1348 bytes resources/images/error_other.png | Bin 0 -> 1345 bytes src/colors.h | 2 + src/directions_window.c | 168 +++++++++++++++++++++++++++-- src/error_window.c | 112 +++++++++++++++++++ src/error_window.h | 13 +++ src/js/app.js | 134 +++++++++++++++++++---- src/select_window.c | 2 +- 10 files changed, 421 insertions(+), 36 deletions(-) create mode 100644 resources/images/error_api.png create mode 100644 resources/images/error_network.png create mode 100644 resources/images/error_other.png create mode 100644 src/error_window.c create mode 100644 src/error_window.h diff --git a/package.json b/package.json index 9cc1a91..90f3dd5 100644 --- a/package.json +++ b/package.json @@ -18,15 +18,17 @@ "location" ], "watchapp": { - "watchface": false + "watchface": false, + "hiddenApp": false, + "onlyShownOnCommunication": false }, "messageKeys": [ + "READY", "SEARCH", "SUCCESS", "DISTANCE", "TIME", - "STEPS", - "STEPS_DISTANCES" + "INSTRUCTIONS[20]" ], "resources": { "media": [ @@ -77,6 +79,24 @@ "name": "ICON_WALK_WHITE", "targetPlatforms": null, "type": "bitmap" + }, + { + "file": "images/error_network.png", + "name": "ICON_ERROR_NETWORK", + "targetPlatforms": null, + "type": "bitmap" + }, + { + "file": "images/error_api.png", + "name": "ICON_ERROR_API", + "targetPlatforms": null, + "type": "bitmap" + }, + { + "file": "images/error_other.png", + "name": "ICON_ERROR_OTHER", + "targetPlatforms": null, + "type": "bitmap" } ] } diff --git a/resources/images/error_api.png b/resources/images/error_api.png new file mode 100644 index 0000000000000000000000000000000000000000..e74681edf2208cfe96aa2168d82e53df6ce16f37 GIT binary patch literal 895 zcmeAS@N?(olHy`uVBq!ia0vp^0U*r51|<6gKdl8)Ea{HEjtmSN`?>!lvNA9*n|Zo8 zhEy=VogIDYmH|&|{jP33&U=wgyDhI>`2LQ$?83g_`6fwAR5optW$)-ux7p`4%|2fE z&~{;Ypsn-OQ1qHufbVI8eT z^#H}&Uww{j5|vo0SW@zO!+hHVbN!b8{#v!SnlJVE9 zuiZXJO`wMkXmiRqKfZoZ*>Ach!-pq(%OKZE&ULe`<;Pb`NkJ#*E4D#FPlbgESY`VcI#E|^&eO2lvL=M?hbl7@7}et z>bK`UMc1#%WoW(j_3M!-sc))ZxMc56U$CcV+5f7NX)74Tc_wd3e;ia7ynDLTmrqB2 zC{Eemw(QV?GbbufP5jSut;_yS*&AdxwRut0_D)5^4%QDBp8LM3o2@?a^wT1a z1zGIBb)T9`dR{HQJnzhsrpSyhCxm=kFU{kcnwff0m)9_Nr614FnF77*L@YGtZ;Na@ ztrsL~k8TV*7wk5j!K;-!_nc|^vz$^{16j5J{#TQY3$=Gow%ER7!np^X zp`rrYH$2ZHdn9Q7$WB;a+;~S`{n}YD63|H)D_LUCR85ltl6Ze t(B&WYFMi?DyZ*BdWT`kX!BMsH2Y!$BN?ubGu7GkBgQu&X%Q~loCIE`)ro8|F literal 0 HcmV?d00001 diff --git a/resources/images/error_network.png b/resources/images/error_network.png new file mode 100644 index 0000000000000000000000000000000000000000..f4012ee2bc7d5115b03b01e851d8dd70e0f74365 GIT binary patch literal 1348 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 D55S59 literal 0 HcmV?d00001 diff --git a/src/colors.h b/src/colors.h index d42ca98..fbd0204 100644 --- a/src/colors.h +++ b/src/colors.h @@ -4,3 +4,5 @@ #define COLOR_BIKE GColorTiffanyBlue #define COLOR_TRAIN GColorSunsetOrange #define COLOR_WALK GColorChromeYellow + +#define COLOR_ERROR GColorLightGray diff --git a/src/directions_window.c b/src/directions_window.c index de30092..eafa55e 100644 --- a/src/directions_window.c +++ b/src/directions_window.c @@ -1,11 +1,11 @@ -#include -#include "colors.h" -#include "directions_window.h" - #include #include "colors.h" #include "select_window.h" #include "directions_window.h" +#include "error_window.h" + +#define MAX_STEP_COUNT 20 +#define MAX_STEP_CHARS 128 // The main window static Window *window; @@ -17,6 +17,18 @@ static GColor selected_type_color; static DictationSession *dictation_session; static char *address; +// TODO: implement a timer, that kills the proccess if the message is never send (needed?) +static bool AppMessageIsReady; +static bool AppMessageSendOnCallback; +static int RouteDataDistance; +static int RouteDataTime; +static char RouteDataSteps[MAX_STEP_COUNT][MAX_STEP_CHARS]; +static int RouteDataStepsCount; + +// Function declarations +static void app_message_send_search_data(); +void window_display_error(enum ErrorType err); + // ****************************** // * DIRECTON LIST (MENU LAYER) * @@ -51,6 +63,7 @@ static void draw_row_callback(GContext *ctx, const Layer *cell_layer, MenuIndex } } +// FIXME: Will probably not be necessary later! static void selection_will_change_callback(struct MenuLayer *menu_layer, MenuIndex *new_index, MenuIndex old_index, void *context) { // Change the highlight color #ifdef PBL_COLOR @@ -62,7 +75,6 @@ static void selection_will_change_callback(struct MenuLayer *menu_layer, MenuInd // All other cells default: menu_layer_set_highlight_colors(directions_list, GColorWhite, selected_type_color); - break; } #endif } @@ -77,22 +89,150 @@ static void dictation_session_callback(DictationSession *session, DictationSessi if (status == DictationSessionStatusSuccess) { // Store the address and load a route address = transcript; - // TODO load route data + // Send the search data + app_message_send_search_data(); } else { - // TODO display proper error window + // Dictation failed, remove this window window_stack_remove(window, true); } } -// ****************** -// * APP SYNC STUFF * -// ****************** +// ********************* +// * APP MESSAGE STUFF * +// ********************* + +// Accept data from the watch +static void app_message_inbox_recived_callback(DictionaryIterator *iter, void *context) { + // Test all possible message types + Tuple *message; + + // Test if the recived message is for key READY + message = dict_find(iter, MESSAGE_KEY_READY); + if (message) { + // Set status to ready + AppMessageIsReady = (bool)message->value->int16; + // Send pending search data + if (AppMessageSendOnCallback) { + app_message_send_search_data(); + } + } + + // Test if the recived message is for key SUCCESS + message = dict_find(iter, MESSAGE_KEY_SUCCESS); + if (message) { + // Respond with the correct UI + switch ((int)message->value->int32) { + // Success + case 0: + // TODO: update the ui in some way + window_display_error(Other); + break; + // Route not found / api error + case 1: + window_display_error(Api); + break; + // Too many steps (== route not found error) + case 2: + window_display_error(Api); + break; + default: + window_display_error(Other); + } + } + + // Test if the recived message is for key DISTANCE + message = dict_find(iter, MESSAGE_KEY_DISTANCE); + if (message) { + RouteDataDistance = (int)message->value->int32; + } + + // Test if the recived message is for key TIME + message = dict_find(iter, MESSAGE_KEY_TIME); + if (message) { + RouteDataTime = (int)message->value->int32; + } + + // Test if the recived message is for key INSTRUCTIONS + for (int i = 0; i < MAX_STEP_COUNT; i++) { + message = dict_find(iter, MESSAGE_KEY_INSTRUCTIONS + i); + if (message) { + // Copy the string into the string array + static char *empty; + strncat(empty, message->value->cstring, MAX_STEP_CHARS); + strcpy(RouteDataSteps[i], empty); + // Store the new length of the RouteDataSteps + RouteDataStepsCount = i + 1; + } + } +} + +// Respond with error, if any data is lost +static void app_message_inbox_dropped_callback(AppMessageResult reason, void *context) { + // Display the network error + window_display_error(Network); +} + +// Respond with error, if data can not be send to watch +static void app_message_outbox_failed_callback(DictionaryIterator *iter, AppMessageResult reason, void *context) { + // Display the network error + window_display_error(Network); +} + +// Send the search data to the phone +static void app_message_send_search_data() { + // Send the data to the phone if conn is ready + if (AppMessageIsReady) { + // Create a string with the correct length + char message[sizeof(address) + 1]; + // Add the type as the first char + message[0] = '0' + selected_type_enum; + // Add the address + strcat(message, address); + // Make sure the string is terminated correctely, just in case + message[sizeof(message) - 1] = '\n'; + + // Write string to bluetooth storage + DictionaryIterator *iter; + if (app_message_outbox_begin(&iter) == APP_MSG_OK) { + dict_write_cstring(iter, MESSAGE_KEY_SEARCH, message); + // Send the outbox + app_message_outbox_send(); + } else { + // Display network error + window_display_error(Network); + } + } else { + AppMessageSendOnCallback = true; + } +} + +// Set up the whole app message thing (once the address is worked out) +static void app_message_start() { + // Set initial values + AppMessageIsReady = true; + AppMessageSendOnCallback = false; + // Register all callbacks + app_message_register_inbox_received(app_message_inbox_recived_callback); + app_message_register_inbox_dropped(app_message_inbox_dropped_callback); + app_message_register_outbox_failed(app_message_outbox_failed_callback); + // Open the app-message + app_message_open(APP_MESSAGE_INBOX_SIZE_MINIMUM, APP_MESSAGE_OUTBOX_SIZE_MINIMUM); +} + // ******************** // * WINDOW LIFECYCLE * // ******************** +// Network error callback +void window_display_error(enum ErrorType err) { + // Show the error window + error_window_push(err); + // Remove this window from the window stack + window_stack_remove(window, false); +} + // Window unload handler static void window_unload() { // Destroy the menu layer @@ -101,6 +241,9 @@ static void window_unload() { // Destroy the dictation session dictation_session_destroy(dictation_session); + // Remove all app message callbacks + app_message_deregister_callbacks(); + // Destroy the window window_destroy(window); window = NULL; @@ -175,4 +318,9 @@ void directions_window_push() { // Start the dictation session TODO: Change this, once app sync stuff is working // dictation_session_start(dictation_session); address = "Meerbusch Brockhofweg 9"; // WIP address string + + // Open the connection to the phone + app_message_start(); + // TODO: Remove this for final version; this is a playeholder implementation (skipping the dictation) + app_message_send_search_data(); } diff --git a/src/error_window.c b/src/error_window.c new file mode 100644 index 0000000..6fd1ca7 --- /dev/null +++ b/src/error_window.c @@ -0,0 +1,112 @@ +#include +#include "colors.h" +#include "error_window.h" + +// The main window +static Window *window; +static BitmapLayer *error_icon_layer; +static TextLayer *error_text_layer; + +// The error to be displayed +int display_error_type; + +// Error icon / text +static GBitmap *icon_error; +static char *text_error; + + +static void window_unload() { + // Destroy the text layer & the error icon layer + bitmap_layer_destroy(error_icon_layer); + text_layer_destroy(error_text_layer); + + // Destroy the image resource + gbitmap_destroy(icon_error); + + // Destroy the window + window_destroy(window); + window = NULL; +} + +static void window_load() { + // Get the root layer + Layer *window_layer = window_get_root_layer(window); + GRect bounds = layer_get_bounds(window_layer); + + switch(display_error_type) { + // Network + case 0: + icon_error = gbitmap_create_with_resource(RESOURCE_ID_ICON_ERROR_NETWORK); + text_error = "Could not reach phone"; + break; + // Api + case 1: + icon_error = gbitmap_create_with_resource(RESOURCE_ID_ICON_ERROR_API); + text_error = "No route could be found"; + break; + // Other / Undefined + case 2: + icon_error = gbitmap_create_with_resource(RESOURCE_ID_ICON_ERROR_OTHER); + text_error = "Something went wrong"; + break; + } + + // Set up the error image layer GRect(x, y, w, h) + #ifdef PBL_ROUND + // Round spacing / Align + error_icon_layer = bitmap_layer_create(GRect(0, 0, bounds.size.w, 110)); + bitmap_layer_set_alignment(error_icon_layer, GAlignBottom); + #else + // Square spacing / Align + error_icon_layer = bitmap_layer_create(GRect(0, 0, bounds.size.w, 100)); + bitmap_layer_set_alignment(error_icon_layer, GAlignCenter); + #endif + bitmap_layer_set_bitmap(error_icon_layer, icon_error); + bitmap_layer_set_compositing_mode(error_icon_layer, GCompOpSet); + #ifdef PBL_COLOR + // Color only + bitmap_layer_set_background_color(error_icon_layer, COLOR_ERROR); + #endif + + layer_add_child(window_layer, (Layer *)error_icon_layer); + + // Set up the error text + #ifdef PBL_ROUND + // Round spacing + error_text_layer = text_layer_create(GRect(0, 110, bounds.size.w, bounds.size.h - 110)); + #else + // Square spacing + error_text_layer = text_layer_create(GRect(0, 100, bounds.size.w, bounds.size.h - 100)); + #endif + text_layer_set_text(error_text_layer, text_error); + text_layer_set_font(error_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD)); + text_layer_set_text_alignment(error_text_layer, GTextAlignmentCenter); + text_layer_set_text_color(error_text_layer, GColorBlack); + #ifdef PBL_COLOR + // Color only + text_layer_set_background_color(error_text_layer, COLOR_ERROR); + #endif + + layer_add_child(window_layer, (Layer *)error_text_layer); + #ifdef PBL_ROUND + // Round text insets + text_layer_enable_screen_text_flow_and_paging(error_text_layer, 0); + #endif +} + +void error_window_push(enum ErrorType error_type) { + display_error_type = error_type; + if (!window) { + // Create the window + window = window_create(); + + // Set up the window handlers + window_set_window_handlers(window, (WindowHandlers) { + .load = window_load, + .unload = window_unload, + }); + } + + // Display the window + window_stack_push(window, true); +} diff --git a/src/error_window.h b/src/error_window.h new file mode 100644 index 0000000..2cd1c43 --- /dev/null +++ b/src/error_window.h @@ -0,0 +1,13 @@ +#pragma once +#include + +enum ErrorType { + // Problem connection to phone + Network = 0, + // Error response from api + Api = 1, + // Something simply went wrong + Other = 2 +}; + +void error_window_push(enum ErrorType); diff --git a/src/js/app.js b/src/js/app.js index 51a2531..54556c2 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -1,33 +1,123 @@ +/** +* SETUP OVERVIEW +* +* About the send messages +* ––– +* (1) Overview data is send (distance, time needed) +* (2) Step data array is send (each step string, max 20 entrys) -> THE LAST SEND INDEX IS THE LENGTH! +* (3) Success value is send (terminates the transmittion; it's true/false +* value determines whether the transmition was successfull or not (E.g. +* if false is send as the success first, no route was found) +* +* About the success codes: +* ––– +* 0 = Success; 1 = Route not found; 2 = Too many steps; ... +* +* About the recived message: +* ––– +* Field: SEARCH +* Contents: {selected_type}{address} (e.g. 0Brockhofweg 9) +* The first character is always the type selected, the rest +* is the written address. +* {selected_type} vals: 0 = Car; 1 = Bike; 2 = Train; 3 = Walk; +*/ + + // Data keys var keys = require('message_keys'); +var maxStepCount = 20; -// Common functions -function createData(success, distance, time, steps, stepsDistances) { + +// App Message functions +function sendSuccess(code) { + // Build message + var key = keys.SUCCESS; var dict = {}; - dict[keys.SUCCESS] = success; - dict[keys.DISTANCE] = distance; - dict[keys.TIME] = time; - dict[keys.STEPS] = steps; - dict[keys.STEPS_DISTANCES] = stepsDistances; - return dict; + dict[key] = +code; + + // Send message to pebble + Pebble.sendAppMessage(dict, function() { + // Success! + console.log('Transmission completed'); + }, function() { + // Error + console.log('Transmission failed at [SUCCESS MESSAGE]'); + }); } -// Some dummy data (let's make the c app work first ;) +function sendStepItem(stepList, index) { + // Build message + var key = keys.INSTRUCTIONS + index; + var dict = {}; + dict[key] = stepList[index]; + + // Send message to pebble + Pebble.sendAppMessage(dict, function() { + // Success, send next item + index ++; + if (index < stepList.length && index < maxStepCount) { + // Recursive callbacks, hell yeah! + sendStepItem(stepList, index); + } else { + // We are finished + sendSuccess(0); + } + }, function() { + // Error + console.log('Transmission failed at index '.concat(index)); + }); +} + +function sendRoute(success, distance, time, stepList) { + // Send message to pebble if a route was found + if (success) { + // Build message + var keyDistance = keys.DISTANCE; + var keyTime = keys.TIME; + dict[keyDistance] = +distance; + dict[keyTime] = +time; + + // Transmit + Pebble.sendAppMessage(dict, function() { + // Success! + sendStepItem(stepList, 0); + }, function() { + // Error + console.log('Transmission failed at [OVERVIEW]'); + }); + } else { + // Send error message (route not found) + sendSuccess(1); + } +} + +// Api data functions FIXME: Acutally use api +function fetchAndSendRoute(routeType, destination) { + // TODO: Add api data here (+ use geolocation etc) + console.log(routeType); + console.log(destination); + /* dummy data: */ + sendRoute(true, 560, 16, ['This is the first step', 'This is the second step', 'This is the third step', 'This is the final step']); +} + +// Accept data from the pebble watch Pebble.addEventListener('appmessage', function(e) { // Get the dictionary from the message var dict = e.payload; - console.log(dict.SEARCH); - var message = createData( - true, - 140, - 13, - ["Do sometoing", "Step 3", "the very last step"], - [11, 0, 5321] - ); - Pebble.sendAppMessage(message, function() { - console.log('Message sent successfully: ' + JSON.stringify(message)); - }, function(e) { - console.log('Message failed: ' + JSON.stringify(message)); - }); + // Does the SEARCH field exist? + if (dict['SEARCH']) { + fetchAndSendRoute(dict['SEARCH'].substr(0, 1), dict['SEARCH'].substr(1)); + } +}); + +// Ready event +Pebble.addEventListener('ready', function() { + // Tell the watch that the js part is ready + var key = keys.READY; + var dict = {}; + dict[key] = true; + Pebble.sendAppMessage(dict); + + console.log('Js part is ready!'); }); diff --git a/src/select_window.c b/src/select_window.c index 2270fa5..0b211b5 100644 --- a/src/select_window.c +++ b/src/select_window.c @@ -27,7 +27,7 @@ static uint16_t get_num_rows_callback(struct MenuLayer *menu_layer, uint16_t sec static int16_t get_cell_height_callback(struct MenuLayer *menu_layer, MenuIndex *cell_index, void *context) { // This part is for round watches only - #if defined(PBL_ROUND) + #ifdef PBL_ROUND // Round bool selected = menu_layer_is_index_selected(menu_layer, cell_index); if (selected) {