From a449862869986efbc6eebf7057526e5ddb07d828 Mon Sep 17 00:00:00 2001 From: Arman Uguray Date: Wed, 11 Feb 2015 19:17:31 -0800 Subject: [PATCH] shared/att: Add bt_att_get_fd Added the bt_att_get_fd function which returns the underlying file descriptor of a bt_att. --- src/shared/att.c | 8 ++++++++ src/shared/att.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/shared/att.c b/src/shared/att.c index d2468a0c6..90c794aef 100644 --- a/src/shared/att.c +++ b/src/shared/att.c @@ -917,6 +917,14 @@ bool bt_att_set_close_on_unref(struct bt_att *att, bool do_close) return io_set_close_on_destroy(att->io, do_close); } +int bt_att_get_fd(struct bt_att *att) +{ + if (!att) + return -1; + + return att->fd; +} + bool bt_att_set_debug(struct bt_att *att, bt_att_debug_func_t callback, void *user_data, bt_att_destroy_func_t destroy) { diff --git a/src/shared/att.h b/src/shared/att.h index f13fc7b82..5256ff9e4 100644 --- a/src/shared/att.h +++ b/src/shared/att.h @@ -35,6 +35,8 @@ void bt_att_unref(struct bt_att *att); bool bt_att_set_close_on_unref(struct bt_att *att, bool do_close); +int bt_att_get_fd(struct bt_att *att); + typedef void (*bt_att_response_func_t)(uint8_t opcode, const void *pdu, uint16_t length, void *user_data); typedef void (*bt_att_notify_func_t)(uint8_t opcode, const void *pdu, -- 2.47.3