c - Q : Pebble + AppMessage delivers empty dictionary -
i'm trying add configuration watchface developped, reached complete standstill. configuration takes page 1 must select city. i've added app.js page catches value & redirects watchface :
pebble.addeventlistener("webviewclosed", function(e) { //get json dictionary var configuration = json.parse(decodeuricomponent(e.response)); console.log("[dbug] configuration window returned: " + json.stringify(configuration) + " " + configuration.basic); //send pebble, persist there pebble.sendappmessage( {'key_city': configuration.basic}, function(e) { console.log("[dbug] settings data sent "); }, function(e) { console.log("[fail] settings feedback failed!"); } ); }
);
this works great, , logs contain correct selected city. notice in_recv_handler callback function called :
[phone] pebble-app.js:?: skylines__0.0/pebble-js-app.js:12 [dbug] configuration window returned: {"basic":"brussels"} brussels [debug] main.c:106: [dbug] in_recv_handler - empty tuple [phone] pebble-app.js:?: skylines__0.0/pebble-js-app.js:18 [dbug] settings data sent
in c code, things go horribly wrong : appmessage seems correctly initialised in init() part :
app_message_register_inbox_received(in_recv_handler); app_message_register_inbox_dropped(inbox_dropped); app_message_open(app_message_inbox_size_maximum(), app_message_outbox_size_maximum());
the in_recv_handler problem :
static void in_recv_handler(dictionaryiterator *iterator, void *context) { //get data tuple *tup = dict_read_first(iterator); if (tup != null) { app_log(app_log_level_debug, "[dbug] in_recv_handler - nonempty tuple"); process_tuple(tup); } else { app_log(app_log_level_debug, "[dbug] in_recv_handler - empty tuple"); } }
the tuple/dictionary allways empty. seems in between app.js , loading of dictionary goes wrong, haven't clue here....
Comments
Post a Comment