OSDN Git Service

gatttool: Remove unused code
authorEder Ruiz Maria <eder.ruiz@openbossa.org>
Fri, 19 Jul 2013 17:34:07 +0000 (13:34 -0400)
committerJohan Hedberg <johan.hedberg@intel.com>
Wed, 24 Jul 2013 15:41:25 +0000 (08:41 -0700)
Since commit 6a3a89774c6738df4d5b77636c4ce747b7497ae9 the code
removed here has no sense.

attrib/gatttool.c
attrib/interactive.c

index 2c11562..319419a 100644 (file)
@@ -255,14 +255,9 @@ done:
 static void char_read_by_uuid_cb(guint8 status, const guint8 *pdu,
                                        guint16 plen, gpointer user_data)
 {
-       struct characteristic_data *char_data = user_data;
        struct att_data_list *list;
        int i;
 
-       if (status == ATT_ECODE_ATTR_NOT_FOUND &&
-                                       char_data->start != opt_start)
-               goto done;
-
        if (status != 0) {
                g_printerr("Read characteristics by UUID failed: %s\n",
                                                        att_ecode2str(status));
@@ -277,8 +272,6 @@ static void char_read_by_uuid_cb(guint8 status, const guint8 *pdu,
                uint8_t *value = list->data[i];
                int j;
 
-               char_data->start = att_get_u16(value) + 1;
-
                g_print("handle: 0x%04x \t value: ", att_get_u16(value));
                value += 2;
                for (j = 0; j < list->len - 2; j++, value++)
@@ -289,7 +282,6 @@ static void char_read_by_uuid_cb(guint8 status, const guint8 *pdu,
        att_data_list_free(list);
 
 done:
-       g_free(char_data);
        g_main_loop_quit(event_loop);
 }
 
@@ -298,15 +290,9 @@ static gboolean characteristics_read(gpointer user_data)
        GAttrib *attrib = user_data;
 
        if (opt_uuid != NULL) {
-               struct characteristic_data *char_data;
-
-               char_data = g_new(struct characteristic_data, 1);
-               char_data->attrib = attrib;
-               char_data->start = opt_start;
-               char_data->end = opt_end;
 
                gatt_read_char_by_uuid(attrib, opt_start, opt_end, opt_uuid,
-                                               char_read_by_uuid_cb, char_data);
+                                               char_read_by_uuid_cb, NULL);
 
                return FALSE;
        }
index 4fd7276..23132cd 100644 (file)
@@ -60,13 +60,6 @@ static int opt_mtu = 0;
 static int start;
 static int end;
 
-struct characteristic_data {
-       uint16_t orig_start;
-       uint16_t start;
-       uint16_t end;
-       bt_uuid_t uuid;
-};
-
 static void cmd_help(int argcp, char **argvp);
 
 static enum state {
@@ -348,31 +341,25 @@ static void char_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
 static void char_read_by_uuid_cb(guint8 status, const guint8 *pdu,
                                        guint16 plen, gpointer user_data)
 {
-       struct characteristic_data *char_data = user_data;
        struct att_data_list *list;
        int i;
        GString *s;
 
-       if (status == ATT_ECODE_ATTR_NOT_FOUND &&
-                               char_data->start != char_data->orig_start)
-               goto done;
-
        if (status != 0) {
                error("Read characteristics by UUID failed: %s\n",
                                                        att_ecode2str(status));
-               goto done;
+               return;
        }
 
        list = dec_read_by_type_resp(pdu, plen);
        if (list == NULL)
-               goto done;
+               return;
 
        s = g_string_new(NULL);
        for (i = 0; i < list->num; i++) {
                uint8_t *value = list->data[i];
                int j;
 
-               char_data->start = att_get_u16(value) + 1;
                g_string_printf(s, "handle: 0x%04x \t value: ",
                                                        att_get_u16(value));
                value += 2;
@@ -384,9 +371,6 @@ static void char_read_by_uuid_cb(guint8 status, const guint8 *pdu,
 
        att_data_list_free(list);
        g_string_free(s, TRUE);
-
-done:
-       g_free(char_data);
 }
 
 static void cmd_exit(int argcp, char **argvp)
@@ -602,7 +586,6 @@ static void cmd_read_hnd(int argcp, char **argvp)
 
 static void cmd_read_uuid(int argcp, char **argvp)
 {
-       struct characteristic_data *char_data;
        int start = 0x0001;
        int end = 0xffff;
        bt_uuid_t uuid;
@@ -638,14 +621,8 @@ static void cmd_read_uuid(int argcp, char **argvp)
                }
        }
 
-       char_data = g_new(struct characteristic_data, 1);
-       char_data->orig_start = start;
-       char_data->start = start;
-       char_data->end = end;
-       char_data->uuid = uuid;
-
-       gatt_read_char_by_uuid(attrib, start, end, &char_data->uuid,
-                                       char_read_by_uuid_cb, char_data);
+       gatt_read_char_by_uuid(attrib, start, end, &uuid, char_read_by_uuid_cb,
+                                                                       NULL);
 }
 
 static void char_write_req_cb(guint8 status, const guint8 *pdu, guint16 plen,