#include <oal-manager.h>
#include <oal-device-mgr.h>
+struct osp_server_t {
+ char *sender;
+ char *uuid;
+};
+static GSList *osp_server_list;
+
#ifdef TIZEN_FEATURE_BT_IPSP
static GDBusProxy *ipsp_proxy;
#endif
return TRUE;
}
-int _bt_register_osp_server_in_agent(int type, char *uuid, char *path, int fd)
+int _bt_register_osp_server_in_agent(const char *sender, int type, char *uuid, char *path, int fd)
{
+ retv_if(sender == NULL, BLUETOOTH_ERROR_INVALID_PARAM);
+ retv_if(uuid == NULL, BLUETOOTH_ERROR_INVALID_PARAM);
+ retv_if(path == NULL, BLUETOOTH_ERROR_INVALID_PARAM);
+
BT_DBG("+");
-#if TODO_40 /* Need to add this function */
- if (!_bt_agent_register_osp_server(type, uuid, path, fd))
- return BLUETOOTH_ERROR_INTERNAL;
-#else
+ if (type == OAL_OSP_SERVER_RFCOMM) {
+ struct osp_server_t *osp_server;
+ osp_server = g_malloc0(sizeof(struct osp_server_t));
+ osp_server->sender = g_strdup(sender);
+ osp_server->uuid = g_strdup(uuid);
+ osp_server_list = g_slist_append(osp_server_list, osp_server);
+ }
+
if (device_register_osp_server(type, uuid, path, fd) != 0)
return BLUETOOTH_ERROR_INTERNAL;
-#endif
return BLUETOOTH_ERROR_NONE;
}
+static void __bt_free_osp_server(struct osp_server_t *osp_server)
+{
+ g_free(osp_server->sender);
+ g_free(osp_server->uuid);
+ g_free(osp_server);
+}
+
int _bt_unregister_osp_server_in_agent(int type, char *uuid)
{
+ GSList *l;
+ struct osp_server_t *osp_server;
+ retv_if(uuid == NULL, BLUETOOTH_ERROR_INVALID_PARAM);
+
BT_DBG("+");
-#if TODO_40 /* Need to add this function */
- if (!_bt_agent_unregister_osp_server(type, uuid))
- return BLUETOOTH_ERROR_INTERNAL;
-#else
if (device_unregister_osp_server(type, uuid) != 0)
return BLUETOOTH_ERROR_INTERNAL;
-#endif
+
+ for (l = osp_server_list; l; l = g_slist_next(l)) {
+ osp_server = l->data;
+ if (!osp_server)
+ continue;
+ if (g_strcmp0(osp_server->uuid, uuid) == 0) {
+ osp_server_list = g_slist_remove(osp_server_list, osp_server);
+ __bt_free_osp_server(osp_server);
+ break;
+ }
+ }
+
+ return BLUETOOTH_ERROR_NONE;
+}
+
+int _bt_unregister_osp_server_in_agent_by_sender(const char *sender)
+{
+ GSList *l;
+ struct osp_server_t *osp_server;
+ retv_if(sender == NULL, BLUETOOTH_ERROR_INVALID_PARAM);
+
+ BT_DBG("Unregister osp server by sender: %s", sender);
+
+ /* App termination case, unregister all osp_server of sender */
+ for (l = osp_server_list; l; ) {
+ osp_server = l->data;
+ l = g_slist_next(l);
+ if (!osp_server)
+ continue;
+ if (g_strcmp0(osp_server->sender, sender) == 0) {
+ if (device_unregister_osp_server(OAL_OSP_SERVER_RFCOMM, osp_server->uuid) != 0)
+ return BLUETOOTH_ERROR_INTERNAL;
+ osp_server_list = g_slist_remove(osp_server_list, osp_server);
+ __bt_free_osp_server(osp_server);
+ }
+ }
+
return BLUETOOTH_ERROR_NONE;
}
+void _bt_deinit_osp_server()
+{
+ g_slist_free_full(osp_server_list, (GDestroyNotify)__bt_free_osp_server);
+ osp_server_list = NULL;
+}
+
int _bt_set_socket_non_blocking(int socket_fd)
{
/* Set Nonblocking */
}
+void _bt_free_paired_dev(void *paired_info)
+{
+ bt_remote_dev_info_t* dev_info = (bt_remote_dev_info_t*) paired_info;
+ unsigned int c;
+
+ ret_if(NULL == dev_info);
+
+ g_free(dev_info->address);
+ g_free(dev_info->name);
+ g_free(dev_info->alias);
+ g_free(dev_info->manufacturer_data);
+
+ for (c = 0; c < dev_info->uuid_count; c++)
+ g_free(dev_info->uuids[c]);
+ g_free(dev_info->uuids);
+ g_free(dev_info);
+}
+
static void __bt_get_service_list(bt_remote_dev_info_t *info, bluetooth_device_info_t *dev)
{
unsigned int i;
BT_ERR("vconf_set_int failed");
}
+#ifdef TIZEN_FEATURE_READOUT_NOTIFICATION
+void _bt_set_readout_notification_of_tts(void)
+{
+ int tts_setting;
+
+ if (vconf_get_int(VCONFKEY_TTS_SETTING_NOTIFICATION_TTS, &tts_setting) != 0) {
+ BT_ERR("vconf_get_int failed");
+ return;
+ }
+
+ BT_DBG("current value[%d]", tts_setting);
+
+ if (tts_setting == -1)
+ if (vconf_set_int(VCONFKEY_TTS_SETTING_NOTIFICATION_TTS, -1) != 0)
+ BT_ERR("vconf_set_int failed");
+}
+#endif
+
int _bt_get_ad_data_by_type(char *in_data, int in_len,
char in_type, char **data, int *data_len)
{