" </interface>"
"</node>";
-GDBusNodeInfo *node_info = NULL;
+static gboolean name_acquired = FALSE;
static char *current_sender_playing = NULL;
gpointer user_data)
{
FN_START;
+
BT_DBG("Method[%s] Object Path[%s] Interface Name[%s]",
method_name, object_path, interface_name);
}
}
- BT_DBG("SERVICE TYPE [%d] SERVICE FUNC [%d]",
- service_type, service_function);
+ BT_DBG("Service type = %s, fn = %s (0x%x)", __bt_convert_service_type_to_string(service_type),
+ _bt_convert_service_function_to_string(service_function), service_function);
switch (service_type) {
case BT_BLUEZ_SERVICE:
result = __bt_bluez_request(service_function,
GVariant *temp = g_variant_new("(iv)", result, out_var);
g_dbus_method_invocation_return_value(invocation, temp);
-
- g_array_free(out_param1, TRUE);
- out_param1 = NULL;
}
}
+ g_array_free(out_param1, TRUE);
g_variant_unref(param1);
g_variant_unref(param2);
g_variant_unref(param3);
g_variant_unref(param4);
g_variant_unref(param5);
-// g_free(sender);
FN_END;
return;
fail:
- BT_ERR_C("Request is failed [%s] [%x]",
+ BT_ERR_C("Request is failed [%s] [0x%x]",
_bt_convert_error_to_string(result), result);
out_var = g_variant_new_from_data((const GVariantType *)"ay",
g_variant_unref(param3);
g_variant_unref(param4);
g_variant_unref(param5);
-// g_free(sender);
}
FN_END;
break;
}
case BT_LE_CONN_UPDATE: {
+ char *sender = NULL;
bluetooth_device_address_t local_address = { {0} };
bluetooth_le_connection_param_t parameters = {0};
+ sender = (char *)g_dbus_method_invocation_get_sender(context);
+
__bt_service_get_parameters(in_param1, &local_address,
sizeof(bluetooth_device_address_t));
__bt_service_get_parameters(in_param2, ¶meters,
sizeof(bluetooth_le_connection_param_t));
- result = _bt_le_conn_update(local_address.addr,
+ result = _bt_le_conn_update(sender,
+ local_address.addr,
parameters.interval_min,
parameters.interval_max,
parameters.latency,
break;
}
+ case BT_DISCONNECT_DEVICE: {
+ bluetooth_device_address_t addr = { {0} };
+ char address[BLUETOOTH_ADDRESS_STRING_LENGTH + 1];
+
+ __bt_service_get_parameters(in_param1,
+ &addr, sizeof(bluetooth_device_address_t));
+ _bt_convert_addr_type_to_string(address, addr.addr);
+
+ result = _bt_disconnect_all(address);
+ break;
+ }
case BT_BOND_DEVICE: {
bluetooth_device_address_t address = { {0} };
break;
}
case BT_UPDATE_LE_CONNECTION_MODE: {
+ char *sender = NULL;
bluetooth_device_address_t remote_address = { { 0 } };
bluetooth_le_connection_param_t param = { 0 };
bluetooth_le_connection_mode_t mode = BLUETOOTH_LE_CONNECTION_MODE_BALANCED;
if (result != BLUETOOTH_ERROR_NONE)
break;
- result = _bt_le_conn_update(remote_address.addr,
+ sender = (char *)g_dbus_method_invocation_get_sender(context);
+
+ result = _bt_le_conn_update(sender,
+ remote_address.addr,
param.interval_min,
param.interval_max,
param.latency,
meta_data.number = data.number;
meta_data.duration = (int64_t) data.duration;
+ if (meta_data.title)
+ BT_INFO("title [%s]", meta_data.title);
+ if (meta_data.artist)
+ BT_INFO("artist [%s]", meta_data.artist);
+ if (meta_data.album)
+ BT_INFO("album [%s]", meta_data.album);
+ if (meta_data.genre)
+ BT_INFO("genre [%s]", meta_data.genre);
+ BT_INFO("total_tracks[%d], number[%d], duration[%d]",
+ meta_data.total_tracks, meta_data.number, meta_data.duration);
+
result = _bt_avrcp_set_track_info(&meta_data);
g_free((gpointer)meta_data.title);
break;
}
case BT_RFCOMM_CLIENT_CONNECT: {
-#ifdef RFCOMM_DIRECT
+#ifdef TIZEN_FEATURE_BT_RFCOMM_DIRECT
result = BLUETOOTH_ERROR_NONE;
#else
bluetooth_device_address_t address = { {0} };
break;
}
case BT_RFCOMM_SOCKET_DISCONNECT: {
-#ifdef RFCOMM_DIRECT
+#ifdef TIZEN_FEATURE_BT_RFCOMM_DIRECT
result = BLUETOOTH_ERROR_NONE;
#else
int socket_fd;
break;
}
case BT_RFCOMM_SOCKET_WRITE: {
-#ifdef RFCOMM_DIRECT
+#ifdef TIZEN_FEATURE_BT_RFCOMM_DIRECT
result = BLUETOOTH_ERROR_NONE;
#else
int socket_fd;
break;
}
case BT_RFCOMM_CREATE_SOCKET: {
-#ifdef RFCOMM_DIRECT
+#ifdef TIZEN_FEATURE_BT_RFCOMM_DIRECT
result = BLUETOOTH_ERROR_NONE;
#else
char *sender;
break;
}
case BT_RFCOMM_REMOVE_SOCKET: {
-#ifdef RFCOMM_DIRECT
+#ifdef TIZEN_FEATURE_BT_RFCOMM_DIRECT
result = BLUETOOTH_ERROR_NONE;
#else
int socket_fd;
BT_DBG("BT_OPP_PUSH_FILES");
int i;
bluetooth_device_address_t address = { {0} };
- bt_file_path_t path;
+ bt_file_path_t *path;
char **file_path;
int file_count;
GArray *param2;
__bt_fill_garray_from_variant(in_param2, param2);
for (i = 0; i < file_count; i++) {
- path = g_array_index(param2, bt_file_path_t, i);
- file_path[i] = g_strdup(path.path);
+ path = &g_array_index(param2, bt_file_path_t, i);
+ file_path[i] = g_strdup(path->path);
}
BT_DBG("_bt_opp_client_push_files");
result = _bt_opp_client_push_files(request_id, context,
char err_msg[256] = {0, };
retv_if(unique_name == NULL, FALSE);
-
- BT_DBG("unique_name: %s", unique_name);
-
retv_if(bt_service_conn == NULL, FALSE);
ret_val = cynara_creds_get_default_client_method(&client_creds_method);
return FALSE;
}
- BT_DBG("client_creds: %s", client_creds);
-
ret_val = cynara_creds_gdbus_get_user(bt_service_conn, unique_name, user_creds_method, &user_creds);
if (ret_val != CYNARA_API_SUCCESS) {
cynara_strerror(ret_val, err_msg, sizeof(err_msg));
return FALSE;
}
- BT_DBG("user_creds: %s", user_creds);
+ BT_DBG("%s, %s, %s", unique_name, client_creds, user_creds);
switch (function_name) {
case BT_SET_LOCAL_NAME:
case BT_GATT_REGISTER_APPLICATION:
case BT_GATT_REGISTER_SERVICE:
case BT_GATT_SEND_RESPONSE:
+
+ case BT_REQ_ATT_MTU:
case BT_PBAP_CONNECT:
case BT_PBAP_DISCONNECT:
case BT_PBAP_GET_PHONEBOOK_SIZE:
case BT_PBAP_GET_LIST:
case BT_PBAP_PULL_VCARD:
case BT_PBAP_PHONEBOOK_SEARCH:
+ case BT_AUDIO_SELECT_ROLE:
ret_val = cynara_check(p_cynara, client_creds, client_session, user_creds,
BT_PRIVILEGE_PUBLIC);
case BT_REMOVE_WHITE_LIST:
case BT_CLEAR_WHITE_LIST:
case BT_SET_MANUFACTURER_DATA:
+ case BT_SET_PASSKEY_NOTIFICATION:
case BT_SET_PROFILE_RESTRICTED:
+ case BT_DISCONNECT_DEVICE:
case BT_CANCEL_SEARCH_SERVICE:
case BT_ENABLE_RSSI:
case BT_RFCOMM_ACCEPT_CONNECTION:
case BT_RFCOMM_REJECT_CONNECTION:
case BT_RFCOMM_LISTEN:
+ case BT_RFCOMM_CREATE_SOCKET_EX:
+ case BT_RFCOMM_REMOVE_SOCKET_EX:
+
+ case BT_HID_ENABLE_BARCODE_FEATURE:
case BT_AVRCP_CONTROL_GET_PROPERTY:
case BT_AVRCP_GET_TRACK_INFO:
+ case BT_AVRCP_TRANSPORT_SET_PROPERTY:
+
case BT_SET_CONTENT_PROTECT:
case BT_BOND_DEVICE_BY_TYPE:
case BT_SET_LE_PRIVACY:
+ case BT_SET_LE_STATIC_RANDOM_ADDRESS:
case BT_LE_CONN_UPDATE:
+ case BT_UPDATE_LE_CONNECTION_MODE:
+ case BT_GET_DEVICE_IDA:
+ case BT_ENABLE_FORCE_HCI_DUMP:
case BT_LE_READ_MAXIMUM_DATA_LENGTH:
case BT_LE_WRITE_HOST_SUGGESTED_DATA_LENGTH:
case BT_LE_READ_HOST_SUGGESTED_DATA_LENGTH:
case BT_LE_SET_DATA_LENGTH:
- case BT_GET_ATT_MTU:
-
case BT_LE_IPSP_INIT:
case BT_LE_IPSP_DEINIT:
case BT_LE_IPSP_CONNECT:
case BT_IS_LE_DISCOVERYING:
case BT_IS_CONNECTABLE:
case BT_GET_BONDED_DEVICES:
+ case BT_GET_PROFILE_CONNECTED_DEVICES:
case BT_GET_BONDED_DEVICE:
+ case BT_PASSKEY_REPLY:
+ case BT_PASSKEY_CONFIRMATION_REPLY:
case BT_GET_IS_ALIAS_SET:
case BT_IS_DEVICE_CONNECTED:
+ case BT_GET_CONNECTED_LINK_TYPE:
+ case BT_SET_PROFILE_TRUSTED:
+ case BT_GET_PROFILE_TRUSTED:
case BT_GET_SPEAKER_GAIN:
case BT_SET_SPEAKER_GAIN:
case BT_OOB_READ_LOCAL_DATA:
case BT_GET_ADVERTISING_DATA:
case BT_GET_SCAN_RESPONSE_DATA:
case BT_IS_ADVERTISING:
+ case BT_REGISTER_SCAN_FILTER:
+ case BT_UNREGISTER_SCAN_FILTER:
+ case BT_UNREGISTER_ALL_SCAN_FILTERS:
+ case BT_IS_SCAN_FILTER_SUPPORTED:
case BT_GET_PROFILE_RESTRICTED:
+ case BT_GET_ATT_MTU:
case BT_OBEX_SERVER_ALLOCATE:
case BT_OBEX_SERVER_DEALLOCATE:
+ case BT_OBEX_SERVER_IS_ACTIVATED:
+ case BT_OPP_GET_TRANSFER_PROGRESS:
/* Non-privilege control */
break;
default:
return 0;
}
+static void __bt_service_bus_acquired_handler(GDBusConnection *connection,
+ const gchar *name, gpointer user_data)
+{
+ GDBusNodeInfo *node_info = NULL;
+
+ BT_INFO("bus acquired");
+
+ ret_if(connection == NULL);
+
+ node_info = __bt_service_create_method_node_info(
+ bt_service_introspection_xml);
+ ret_if(node_info == NULL);
+
+ __bt_service_register_object(connection, node_info, TRUE);
+ g_dbus_node_info_unref(node_info);
+
+ bt_service_conn = connection;
+}
+
+static void __bt_service_name_acquired_handler(GDBusConnection *connection,
+ const gchar *name, gpointer user_data)
+{
+ BT_INFO("name acquired");
+ name_acquired = TRUE;
+}
+
+static void __bt_service_name_lost_handler(GDBusConnection *connection,
+ const gchar *name, gpointer user_data)
+{
+ BT_INFO("name lost");
+ name_acquired = FALSE;
+}
+
+gboolean _is_name_acquired(void)
+{
+ return name_acquired;
+}
+
int _bt_service_register(void)
{
GDBusConnection *conn;
GError *err = NULL;
- int result;
conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
+ bt_service_conn = conn;
owner_id = g_bus_own_name(G_BUS_TYPE_SYSTEM,
BT_SERVICE_NAME,
G_BUS_NAME_OWNER_FLAGS_NONE,
- NULL, NULL, NULL,
+ __bt_service_bus_acquired_handler,
+ __bt_service_name_acquired_handler,
+ __bt_service_name_lost_handler,
NULL, NULL);
BT_DBG("owner_id is [%d]", owner_id);
if (owner_id == 0)
goto fail;
- node_info = __bt_service_create_method_node_info(
- bt_service_introspection_xml);
-
- if (node_info == NULL)
- goto fail;
-
- result = __bt_service_register_object(conn, node_info, TRUE);
- g_dbus_node_info_unref(node_info);
- node_info = NULL;
-
- if (result != BLUETOOTH_ERROR_NONE)
- goto fail;
-
- bt_service_conn = conn;
-
return BLUETOOTH_ERROR_NONE;
fail:
g_object_unref(bt_service_conn);
bt_service_conn = NULL;
}
- if (node_info) {
- g_dbus_node_info_unref(node_info);
- node_info = NULL;
- }
if (owner_id > 0) {
g_bus_unown_name(owner_id);
owner_id = 0;