diff options
Diffstat (limited to 'hcid')
-rw-r--r-- | hcid/dbus-common.c | 84 | ||||
-rw-r--r-- | hcid/dbus-common.h | 6 | ||||
-rw-r--r-- | hcid/main.c | 2 |
3 files changed, 0 insertions, 92 deletions
diff --git a/hcid/dbus-common.c b/hcid/dbus-common.c index ec04f797..c4874e16 100644 --- a/hcid/dbus-common.c +++ b/hcid/dbus-common.c @@ -50,7 +50,6 @@ #include <gdbus.h> #include "hcid.h" -#include "dbus-error.h" #include "manager.h" #include "adapter.h" #include "dbus-hci.h" @@ -66,8 +65,6 @@ #define MAX_CONN_NUMBER 10 #define RECONNECT_RETRY_TIMEOUT 5000 -static sdp_session_t *sess = NULL; - static int experimental = 0; int str2uuid(uuid_t *uuid, const char *string) @@ -350,84 +347,3 @@ int hcid_dbus_init(void) return 0; } - -static inline sdp_session_t *get_sdp_session(void) -{ - if (!sess) { - sess = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, 0); - if (!sess) { - error("Can't connect to SDP daemon:(%s, %d)", - strerror(errno), errno); - } - } - - return sess; -} - -void cleanup_sdp_session(void) -{ - if (sess) - sdp_close(sess); - - sess = NULL; -} - -int register_sdp_binary(uint8_t *data, uint32_t size, uint32_t *handle) -{ - int err; - - if (!get_sdp_session()) - return -1; - - err = sdp_device_record_register_binary(sess, BDADDR_ANY, - data, size, 0, handle); - if (err < 0) - cleanup_sdp_session(); - - return err; -} - -int register_sdp_record(bdaddr_t *src, sdp_record_t *rec) -{ - int err; - - if (!get_sdp_session()) - return -1; - - err = sdp_device_record_register(sess, src, rec, 0); - if (err < 0) - cleanup_sdp_session(); - - return err; -} - -int update_sdp_record(uint32_t handle, sdp_record_t *rec) -{ - if (!get_sdp_session()) - return -1; - - /* Update on the server */ - rec->handle = handle; - if (sdp_device_record_update(sess, BDADDR_ANY, rec)) { - cleanup_sdp_session(); - error("Service Record update failed: %s(%d).\n", - strerror(errno), errno); - return -1; - } - - return 0; -} - -int unregister_sdp_record(uint32_t handle) -{ - int err; - - if (!sess) - return -ENOENT; - - err = sdp_device_record_unregister_binary(sess, BDADDR_ANY, handle); - if (err < 0) - cleanup_sdp_session(); - - return err; -} diff --git a/hcid/dbus-common.h b/hcid/dbus-common.h index 3f794feb..54148f8f 100644 --- a/hcid/dbus-common.h +++ b/hcid/dbus-common.h @@ -37,9 +37,3 @@ int find_conn(int s, int dev_id, long arg); void hcid_dbus_exit(void); int hcid_dbus_init(void); - -int register_sdp_binary(uint8_t *data, uint32_t size, uint32_t *handle); -int register_sdp_record(bdaddr_t *src, sdp_record_t *rec); -int unregister_sdp_record(uint32_t handle); -int update_sdp_record(uint32_t handle, sdp_record_t *rec); -void cleanup_sdp_session(void); diff --git a/hcid/main.c b/hcid/main.c index 1afd3475..8cf89bfd 100644 --- a/hcid/main.c +++ b/hcid/main.c @@ -955,8 +955,6 @@ int main(int argc, char *argv[]) hcid_dbus_exit(); - cleanup_sdp_session(); - g_main_loop_unref(event_loop); if (config) |