OSDN Git Service

android/gatt: Move get_sec_level function
authorMarcin Kraglak <marcin.kraglak@tieto.com>
Tue, 17 Jun 2014 13:31:09 +0000 (15:31 +0200)
committerSzymon Janc <szymon.janc@gmail.com>
Tue, 17 Jun 2014 19:53:11 +0000 (21:53 +0200)
This will be used in read and write handlers functions.

android/gatt.c

index 943704a..5900fa8 100644 (file)
@@ -2715,6 +2715,22 @@ static void read_char_cb(guint8 status, const guint8 *pdu, guint16 len,
        free(data);
 }
 
+static int get_sec_level(struct gatt_device *dev)
+{
+       GIOChannel *io;
+       int sec_level;
+
+       io = g_attrib_get_channel(dev->attrib);
+
+       if (!bt_io_get(io, NULL, BT_IO_OPT_SEC_LEVEL, &sec_level,
+                                                       BT_IO_OPT_INVALID)) {
+               error("gatt: Failed to get sec_level");
+               return -1;
+       }
+
+       return sec_level;
+}
+
 static void handle_client_read_characteristic(const void *buf, uint16_t len)
 {
        const struct hal_cmd_gatt_client_read_characteristic *cmd = buf;
@@ -2835,22 +2851,6 @@ static bool signed_write_cmd(struct gatt_device *dev, uint16_t handle,
        return true;
 }
 
-static int get_sec_level(struct gatt_device *dev)
-{
-       GIOChannel *io;
-       int sec_level;
-
-       io = g_attrib_get_channel(dev->attrib);
-
-       if (!bt_io_get(io, NULL, BT_IO_OPT_SEC_LEVEL, &sec_level,
-                                                       BT_IO_OPT_INVALID)) {
-               error("gatt: Failed to get sec_level");
-               return -1;
-       }
-
-       return sec_level;
-}
-
 static void handle_client_write_characteristic(const void *buf, uint16_t len)
 {
        const struct hal_cmd_gatt_client_write_characteristic *cmd = buf;