[gnome-bluetooth] wizard: Add "confirm" ret for PIN detection



commit aa0a7db4024edf86af5658324386bb01a9cf841b
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Dec 4 20:37:30 2013 +0100

    wizard: Add "confirm" ret for PIN detection

 wizard/main.c |    3 ++-
 wizard/pin.c  |   11 ++++++++++-
 wizard/pin.h  |    6 +++++-
 3 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/wizard/main.c b/wizard/main.c
index 61cc689..74e88e8 100644
--- a/wizard/main.c
+++ b/wizard/main.c
@@ -221,7 +221,8 @@ update_user_pincode (void)
        pincode = get_pincode_for_device (target_type,
                                          target_address,
                                          target_name,
-                                         &target_max_digits);
+                                         &target_max_digits,
+                                         NULL);
        if (pincode != NULL) {
                if (g_str_equal (pincode, "KEYBOARD"))
                        target_ui_behaviour = PAIRING_UI_KEYBOARD;
diff --git a/wizard/pin.c b/wizard/pin.c
index 5751773..ddced64 100644
--- a/wizard/pin.c
+++ b/wizard/pin.c
@@ -62,6 +62,7 @@ typedef struct {
        guint type;
        const char *address;
        const char *name;
+       gboolean confirm;
 } PinParseData;
 
 static void
@@ -94,6 +95,7 @@ pin_db_parse_start_tag (GMarkupParseContext *ctx,
                                return;
                        if (strstr (pdata->name, *attr_values) == NULL)
                                return;
+                       pdata->confirm = FALSE;
                } else if (g_str_equal (*attr_names, "pin")) {
                        if (g_str_has_prefix (*attr_values, MAX_DIGITS_PIN_PREFIX) != FALSE) {
                                pdata->max_digits = strtoul (*attr_values + strlen (MAX_DIGITS_PIN_PREFIX), 
NULL, 0);
@@ -110,7 +112,11 @@ pin_db_parse_start_tag (GMarkupParseContext *ctx,
 }
 
 char *
-get_pincode_for_device (guint type, const char *address, const char *name, guint *max_digits)
+get_pincode_for_device (guint       type,
+                       const char *address,
+                       const char *name,
+                       guint      *max_digits,
+                       gboolean   *confirm)
 {
        GMarkupParseContext *ctx;
        GMarkupParser parser = { pin_db_parse_start_tag, NULL, NULL, NULL, NULL };
@@ -142,6 +148,7 @@ get_pincode_for_device (guint type, const char *address, const char *name, guint
        data.type = type;
        data.address = address;
        data.name = name;
+       data.confirm = TRUE;
 
        ctx = g_markup_parse_context_new (&parser, 0, &data, NULL);
 
@@ -155,6 +162,8 @@ get_pincode_for_device (guint type, const char *address, const char *name, guint
 
        if (max_digits != NULL)
                *max_digits = data.max_digits;
+       if (confirm != NULL)
+               *confirm = data.confirm;
 
        g_debug ("Got pin '%s' (max digits: %d) for device '%s' (type: %s address: %s)",
                 data.ret_pin, data.max_digits,
diff --git a/wizard/pin.h b/wizard/pin.h
index aae8601..815969d 100644
--- a/wizard/pin.h
+++ b/wizard/pin.h
@@ -25,5 +25,9 @@
 
 #define PIN_NUM_DIGITS 6
 
-char *get_pincode_for_device (guint type, const char *address, const char *name, guint *max_digits);
+char *get_pincode_for_device (guint       type,
+                             const char *address,
+                             const char *name,
+                             guint      *max_digits,
+                             gboolean   *confirm);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]