Browse code

adding callback for auth

Louis authored on14/03/2019 22:43:30
Showing2 changed files
1 1
Binary files a/build/synocam_home_switch.pbw and b/build/synocam_home_switch.pbw differ
... ...
@@ -9,6 +9,7 @@ const uint32_t inbox_size = 64;
9 9
 const uint32_t outbox_size = 64;
10 10
 
11 11
 
12
+static char s_auth[40];
12 13
 static char s_api[40];
13 14
 static char s_username[40];
14 15
 static char s_password[40];
... ...
@@ -257,6 +258,18 @@ static void inbox_received_callback(DictionaryIterator *iter, void *context) {
257 258
     APP_LOG(APP_LOG_LEVEL_DEBUG, "received jsready message on watch... ");
258 259
   }
259 260
 
261
+  // Read Auth returns
262
+  Tuple *auth_tuple = dict_find(iter, MESSAGE_KEY_auth);
263
+
264
+  if(auth_tuple) {
265
+    strncpy(s_auth, auth_tuple->value->cstring, 40);
266
+    // Display in the TextLayer
267
+    text_layer_set_text(s_text_layer, s_auth);
268
+    APP_LOG(APP_LOG_LEVEL_DEBUG, "Auth message received ... ");
269
+  }else{
270
+    APP_LOG(APP_LOG_LEVEL_DEBUG, "not auth message... ");
271
+  }
272
+
260 273
   // Read API returns
261 274
   Tuple *api_tuple = dict_find(iter, MESSAGE_KEY_status);
262 275