#include <gio/gunixfdlist.h>
#include <cynara-client.h>
#include <cynara-creds-gdbus.h>
+#include <systemd/sd-daemon.h>
#include "bluetooth-api.h"
#include "bluetooth-audio-api.h"
" <arg type='i' name='output_param1' direction='out' />"
" <arg type='v' name='output_param2' direction='out' />"
" </method>"
+#ifdef TIZEN_FEATURE_BT_AVC_TARGET
+" <method name='get_avc_mode'>"
+ /* Out Parameters */
+" <arg type='u' name='avc_mode' direction='out' />"
+" </method>"
+#endif
" </interface>"
"</node>";
static gboolean __bt_is_sync_function(int service_function)
{
/*TODO: Keep adding sync methods with expect replies from bluetooth service */
- if (service_function == BT_ENABLE_ADAPTER
- || service_function == BT_DISABLE_ADAPTER
- || service_function == BT_GET_LOCAL_ADDRESS
+ if (service_function == BT_GET_LOCAL_ADDRESS
|| service_function == BT_GET_LOCAL_NAME
|| service_function == BT_GET_LOCAL_VERSION
|| service_function == BT_GET_BONDED_DEVICES
|| service_function == BT_GATT_SERVER_DELETE_SERVICE
|| service_function == BT_START_LE_DISCOVERY
|| service_function == BT_STOP_LE_DISCOVERY
+ || service_function == BT_GET_CONNECTABLE
#ifdef TIZEN_GATT_CLIENT
|| service_function == BT_GATT_CLIENT_REGISTER
|| service_function == BT_GATT_GET_PRIMARY_SERVICES
char *sender, int service_function,
gpointer invocation_data)
{
- BT_DBG("Saving the invocation context: service_function [%d]", service_function);
invocation_info_t *info;
info = g_malloc0(sizeof(invocation_info_t));
info->context = invocation;
}
+static int __bt_service_get_sender_pid(const char *unique_name, pid_t *pid)
+{
+ int ret;
+ char err_msg[256] = {0, };
+
+ retv_if(bt_service_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+ ret = cynara_creds_gdbus_get_pid(bt_service_conn, unique_name, pid);
+ if (ret != CYNARA_API_SUCCESS) {
+ cynara_strerror(ret, err_msg, sizeof(err_msg));
+ BT_ERR("Fail to get user credential: %s", err_msg);
+
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ return BLUETOOTH_ERROR_NONE;
+}
+
static int __bt_bm_request_data(_bt_battery_data_t *latest)
{
int ret = _bt_bm_read_data(latest);
if (request_type == BT_ASYNC_REQ ||
__bt_is_sync_function(service_function)) {
- BT_INFO("Do not send reply to bt-api over dbus,"
- " Invocation context is already saved in service_function");
+ /* Do not send reply to bt-api over dbus,
+ Invocation context is already saved in service_function */
goto done;
}
g_variant_unref(param4);
g_variant_unref(param5);
}
+#ifdef TIZEN_FEATURE_BT_AVC_TARGET
+ else if (g_strcmp0(method_name, "get_avc_mode") == 0) {
+ unsigned int mode = 0;
+
+ if (_bt_audio_get_avc_mode(&mode) != BLUETOOTH_ERROR_NONE)
+ BT_ERR("Fail to get the avc mode");
+
+ BT_DBG("Absolute Volume Control mode: %d", mode);
+
+ g_dbus_method_invocation_return_value(invocation,
+ g_variant_new("(u)", mode));
+ }
+#endif
FN_END;
return;
switch (function_name) {
case BT_ENABLE_ADAPTER: {
result = _bt_enable_adapter();
- /* Save invocation */
- if (result == BLUETOOTH_ERROR_NONE) {
- BT_DBG("_bt_enable_adapter scheduled successfully! save invocation context");
- sender = (char*)g_dbus_method_invocation_get_sender(context);
- _bt_save_invocation_context(context, result, sender,
- function_name, NULL);
- }
break;
}
case BT_DISABLE_ADAPTER: {
result = _bt_disable_adapter();
- /* Save invocation */
- if (result == BLUETOOTH_ERROR_NONE) {
- BT_DBG("_bt_disable_adapter scheduled successfully! save invocation context");
- sender = (char*)g_dbus_method_invocation_get_sender(context);
- _bt_save_invocation_context(context, result, sender,
- function_name, NULL);
- }
break;
}
case BT_RECOVER_ADAPTER:
dbus_data.session_end_time = data->session_end_time;
dbus_data.session_scan_time = data->session_scan_time;
dbus_data.session_connected_time = data->session_connected_time;
+ dbus_data.tx_time = data->tx_time;
+ dbus_data.rx_time = data->rx_time;
+ dbus_data.idle_time = data->idle_time;
/*Populating app data*/
int n = 0;
}
dbus_data.num_app = n;
g_array_append_vals(*out_param1, &dbus_data, sizeof(bt_battery_dbus_data_t));
- g_slist_free(data->atm_list);
+ g_slist_free_full(data->atm_list, g_free);
g_free(data);
data = NULL;
break;
unsigned short max_response;
unsigned short discovery_duration;
unsigned int classOfDeviceMask;
+ uid_t uid;
__bt_service_get_parameters(in_param1,
&max_response, sizeof(unsigned short));
&discovery_duration, sizeof(unsigned short));
__bt_service_get_parameters(in_param3,
&classOfDeviceMask, sizeof(unsigned int));
+ __bt_service_get_parameters(in_param4, &uid, sizeof(uid_t));
result = _bt_start_discovery(max_response, discovery_duration, classOfDeviceMask);
+
+ if (result == BLUETOOTH_ERROR_NONE) {
+ pid_t pid;
+
+ sender = (char*)g_dbus_method_invocation_get_sender(context);
+
+ if (__bt_service_get_sender_pid(sender, &pid) != BLUETOOTH_ERROR_NONE)
+ BT_ERR("Fail to get the sender pid");
+
+ BT_DBG("Remeber pid / uid for the scan operation");
+ _bt_bm_add_scan_app(SCAN_REGACY, uid, pid);
+ }
+
break;
}
case BT_START_CUSTOM_DISCOVERY: {
g_array_append_vals(*out_param1, &is_connectable, sizeof(gboolean));
break;
}
+ case BT_GET_CONNECTABLE: {
+ result = _bt_get_connectable();
+
+ /* Save invocation */
+ if (result == BLUETOOTH_ERROR_NONE) {
+ sender = (char*)g_dbus_method_invocation_get_sender(context);
+ _bt_save_invocation_context(context, result, sender,
+ function_name, NULL);
+ }
+ break;
+ }
case BT_SET_CONNECTABLE: {
gboolean is_connectable;
if (result == BLUETOOTH_ERROR_NONE) {
char * addr = g_malloc0(BT_ADDRESS_STRING_SIZE);
_bt_convert_addr_type_to_string(addr, address.addr);
- BT_DBG("_bt_bond_device scheduled successfully! save invocation context");
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
function_name, (gpointer)addr);
if (result == BLUETOOTH_ERROR_NONE) {
char * addr = g_malloc0(BT_ADDRESS_STRING_SIZE);
_bt_convert_addr_type_to_string(addr, address.addr);
- BT_DBG("_bt_bond_device_by_type invoked successfully! save invocation context");
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
function_name, (gpointer)addr);
if (result == BLUETOOTH_ERROR_NONE) {
char * addr = g_malloc0(BT_ADDRESS_STRING_SIZE);
_bt_convert_addr_type_to_string(addr, address.addr);
- BT_DBG("_bt_unbond_device scheduled successfully! save invocation context");
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
function_name, (gpointer)addr);
if (result == BLUETOOTH_ERROR_NONE) {
char * addr = g_malloc0(BT_ADDRESS_STRING_SIZE);
_bt_convert_addr_type_to_string(addr, address.addr);
- BT_DBG("BT Device Service Search Request scheduled successfully! save invocation context");
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender,
function_name, (gpointer)addr);
result = _bt_set_white_list(&address, address_type, is_add);
break;
}
+ case BT_UPDATE_LE_CONNECTION_MODE: {
+ char *sender = NULL;
+ bluetooth_device_address_t remote_address = { { 0 } };
+ bluetooth_le_connection_param_t parameters = { 0 };
+ bluetooth_le_connection_mode_t mode = BLUETOOTH_LE_CONNECTION_MODE_BALANCED;
+
+ __bt_service_get_parameters(in_param1, &remote_address,
+ sizeof(bluetooth_device_address_t));
+ __bt_service_get_parameters(in_param2, &mode,
+ sizeof(bluetooth_le_connection_mode_t));
+
+ result = _bt_get_le_connection_parameter(mode, ¶meters);
+ if (result != BLUETOOTH_ERROR_NONE)
+ break;
+
+ sender = (char *)g_dbus_method_invocation_get_sender(context);
+
+ result = _bt_le_connection_update(sender,
+ remote_address.addr,
+ parameters.interval_min,
+ parameters.interval_max,
+ parameters.latency,
+ parameters.timeout);
+ break;
+ }
case BT_SET_MANUFACTURER_DATA: {
bluetooth_manufacturer_data_t m_data = { 0 };
__bt_service_get_parameters(in_param1,
sizeof(bluetooth_rfcomm_connection_t));
} else {
char *addr = g_malloc0(BT_ADDRESS_STRING_SIZE);
- BT_ERR("BT_RFCOMM_CLIENT_CONNECT success, save context");
_bt_convert_addr_type_to_string(addr, address.addr);
sender = (char*)g_dbus_method_invocation_get_sender(context);
_bt_save_invocation_context(context, result, sender, function_name, addr);
result = _bt_rfcomm_socket_listen(sender, uuid, true);
if (result > 0) {
- BT_ERR("BT_RFCOMM_LISTEN_AND_ACCEPT success, save context");
-
result = BLUETOOTH_ERROR_NONE;
_bt_save_invocation_context(context,
result, sender, function_name, NULL);
result = _bt_rfcomm_socket_listen(sender, uuid, false);
if (result > 0) {
- BT_ERR("BT_RFCOMM_LISTEN success, save context");
-
result = BLUETOOTH_ERROR_NONE;
_bt_save_invocation_context(context,
result, sender, function_name, NULL);
BT_DBG("Sending details to bluetooth battery monitor: %ld, %ld, %d", (long int)uid, (long int)pid, size);
_bt_bm_add_transaction_details(uid, pid, size, TX_DATA);
break;
- }
+ }
+ case BT_RFCOMM_SERVER_UPDATE_CONNECTION_INFO: {
+ gboolean connected = FALSE;
+ int client_fd = -1;
+
+ sender = (char *)g_dbus_method_invocation_get_sender(context);
+
+ __bt_service_get_parameters(in_param1, &connected, sizeof(gboolean));
+ __bt_service_get_parameters(in_param2, &client_fd, sizeof(int));
+
+ if (connected == TRUE)
+ result = _bt_rfcomm_server_conn_added(sender, client_fd);
+ else
+ result = _bt_rfcomm_server_conn_removed(sender, client_fd);
+
+ break;
+ }
case BT_AUDIO_SELECT_ROLE: {
bluetooth_audio_role_t role;
}
break;
}
+#ifdef TIZEN_FEATURE_BT_AVC_TARGET
+ case BT_AUDIO_SET_ABSOLUTE_VOLUME: {
+ unsigned int volume = 0;
+
+ __bt_service_get_parameters(in_param1,
+ &volume, sizeof(unsigned int));
+
+ result = _bt_audio_set_absolute_volume(volume);
+ break;
+ }
+ case BT_AUDIO_GET_ABSOLUTE_VOLUME: {
+ unsigned int volume = 0;
+
+ result = _bt_audio_get_absolute_volume(&volume);
+ g_array_append_vals(*out_param1, &volume, sizeof(unsigned int));
+ break;
+ }
+ case BT_AUDIO_IS_AVC_ACTIVATED: {
+ bool activated = 0;
+
+ result = _bt_audio_is_avc_activated(&activated);
+ g_array_append_vals(*out_param1, &activated, sizeof(bool));
+ break;
+ }
+#endif
case BT_AV_CONNECT: {
bluetooth_device_address_t address = { {0} };
__bt_service_get_parameters(in_param1,
char *app;
app = (char *)g_dbus_method_invocation_get_sender(context);
- BT_INFO("GATT Server Unique Name [%s]", app);
+ BT_DBG("GATT Server Unique Name [%s]", app);
/* No ADV handle: Set 0 */
result = _bt_register_server_instance(app, 0);
- BT_INFO("GATT Server: Register Server result [%d]", result);
if (result != BLUETOOTH_ERROR_NONE) {
- BT_ERR("GATT Server registration failed!!");
+ BT_ERR("GATT Server registration failed. result %d", result);
} else {
_bt_save_invocation_context(context, result, app,
function_name, NULL);
__bt_service_get_parameters(in_param4, &instance_id,
sizeof(int));
- BT_INFO("GATT Server Service UUID [%s]", svc_uuid);
result = _bt_gatt_server_add_service(app, service_type, num_handles, svc_uuid, instance_id);
if (result != BLUETOOTH_ERROR_NONE) {
BT_ERR("GATT Server Add Service failed!!");
} else {
tmp_inst_id = g_malloc0(sizeof(int));
*tmp_inst_id = instance_id;
- BT_INFO("GATT Server: Save Instance ID in request Inst id [%d] request_id [%d]",
- *tmp_inst_id, instance_id);
_bt_save_invocation_context(context, result, app,
function_name, (gpointer)tmp_inst_id);
}
sizeof(bluetooth_gatt_server_attribute_params_t));
char_uuid = (char *)g_variant_get_data(in_param2);
- BT_INFO("GATT Server Characteristic UUID [%s]", char_uuid);
-
result = _bt_gatt_server_add_characteristic(app, char_uuid, ¶m);
if (result != BLUETOOTH_ERROR_NONE) {
BT_ERR("GATT Server Add Service failed!!");
} else {
tmp_inst_id = g_malloc0(sizeof(int));
*tmp_inst_id = param.instance_id;
- BT_INFO("GATT Server: Save Instance ID in request Inst id [%d] request_id [%d]",
- *tmp_inst_id, param.instance_id);
+
_bt_save_invocation_context(context, result, app,
function_name, (gpointer)tmp_inst_id);
}
__bt_service_get_parameters(in_param3, &perm,
sizeof(bt_gatt_permission_t));
- BT_INFO("GATT Server Descriptor UUID [%s]", desc_uuid);
-
result = _bt_gatt_server_add_descriptor(app, desc_uuid, &perm, service_handle, instance_id);
if (result != BLUETOOTH_ERROR_NONE) {
BT_ERR("GATT Server Add Service failed!!");
} else {
tmp_inst_id = g_malloc0(sizeof(int));
*tmp_inst_id = instance_id;
- BT_INFO("GATT Server: Save Instance ID in request Inst id [%d] request_id [%d]",
- *tmp_inst_id, instance_id);
_bt_save_invocation_context(context, result, app,
function_name, (gpointer)tmp_inst_id);
}
if (BLUETOOTH_ERROR_NONE == result) {
tmp_inst_id = g_malloc0(sizeof(int));
*tmp_inst_id = instance_id;
- BT_INFO("GATT Server: Save Instance ID in request Inst id [%d] request_id [%d]",
- *tmp_inst_id, instance_id);
_bt_save_invocation_context(context, result, app,
function_name, (gpointer)tmp_inst_id);
}
if (BLUETOOTH_ERROR_NONE == result) {
tmp_inst_id = g_malloc0(sizeof(int));
*tmp_inst_id = instance_id;
- BT_INFO("GATT Server: Save Instance ID in request Inst id [%d] request_id [%d]",
- *tmp_inst_id, instance_id);
_bt_save_invocation_context(context, result, app,
function_name, (gpointer)tmp_inst_id);
}
if (BLUETOOTH_ERROR_NONE == result) {
tmp_inst_id = g_malloc0(sizeof(int));
*tmp_inst_id = instance_id;
- BT_INFO("GATT Server: Save Instance ID in request Inst id [%d] request_id [%d]",
- *tmp_inst_id, instance_id);
_bt_save_invocation_context(context, result, app,
function_name, (gpointer)tmp_inst_id);
}
}
break;
}
+ case BT_REQ_ATT_MTU: {
+ bluetooth_device_address_t address = { {0} };
+ unsigned int mtu;
+ char *addr;
+
+ sender = (char*)g_dbus_method_invocation_get_sender(context);
+
+ __bt_service_get_parameters(in_param1,
+ &address, sizeof(bluetooth_device_address_t));
+ __bt_service_get_parameters(in_param2,
+ &mtu, sizeof(unsigned int));
+ BT_DBG("BT_REQ_ATT_MTU: %d", mtu);
+ result = _bt_request_att_mtu(&address, mtu);
+ if (BLUETOOTH_ERROR_NONE == result) {
+ addr = g_malloc0(BT_ADDRESS_STRING_SIZE);
+
+ _bt_convert_addr_type_to_string(addr, address.addr);
+
+ /* Save the informations to invocation */
+ _bt_save_invocation_context(context, result, sender,
+ function_name, (gpointer)addr);
+ } else {
+ g_array_append_vals(*out_param1, &address,
+ sizeof(bluetooth_device_address_t));
+ }
+ break;
+ }
+ case BT_GET_DEVICE_IDA: {
+ bluetooth_device_address_t address = { {0} };
+ bluetooth_device_address_t id_addr = { {0} };
+
+ __bt_service_get_parameters(in_param1,
+ &address, sizeof(bluetooth_device_address_t));
+
+ result = _bt_device_get_ida(&address, &id_addr);
+
+ if (result == BLUETOOTH_ERROR_NONE) {
+ g_array_append_vals(*out_param1, &id_addr,
+ sizeof(bluetooth_device_address_t));
+ }
+ break;
+ }
case BT_SET_LE_STATIC_RANDOM_ADDRESS: {
gboolean is_enable;
addr = g_malloc0(BT_ADDRESS_STRING_SIZE);
_bt_convert_addr_type_to_string(addr, address.addr);
- BT_INFO("GATT Client: Save Invocation data GATT CLient Register app[%s] address [%s]", sender, addr);
/* Save the informations to invocation */
_bt_save_invocation_context(context, result, sender,
int mtu = -1;
bluetooth_gatt_client_char_prop_info_t param;
- BT_INFO("GATT Client ACQUIRE WRITE recived");
-
sender = (char*)g_dbus_method_invocation_get_sender(context);
__bt_service_get_parameters(in_param1, ¶m,
g_array_append_vals(*out_param1, &mtu, sizeof(int));
if (BLUETOOTH_ERROR_NONE == result)
- BT_INFO("GATT Client: Save Invocation data for characteristic props app[%s] fd[ %d]", sender, fd);
+ BT_DBG("GATT Client: Save Invocation data for characteristic props app[%s] fd[ %d]", sender, fd);
else {
- BT_ERR("Gatt Client Acqure Write");
+ BT_ERR("GATT Client: gatt acquire write failed");
break;
}
__bt_service_get_parameters(in_param3,
&client_id, sizeof(int));
- BT_INFO("GATT Client: client_id[%d]", client_id);
+ BT_DBG("GATT Client: client_id[%d]", client_id);
result = _bt_connect_le_device(&address, auto_connect, client_id);
if (BLUETOOTH_ERROR_NONE == result) {
-
addr = g_malloc0(BT_ADDRESS_STRING_SIZE);
- BT_INFO("GATT Client: Save Invocation data Connect LE app[%s]", sender);
-
_bt_convert_addr_type_to_string(addr, address.addr);
/* Save the informations to invocation */
_bt_save_invocation_context(context, result, sender,
function_name, (gpointer)addr);
+
+ if (auto_connect)
+ _bt_handle_invocation_context(function_name, (void *)addr);
} else {
- BT_INFO("GATT Client: gatt connect failed");
+ BT_ERR("GATT Client: gatt connect failed. client_id[%d]", client_id);
g_array_append_vals(*out_param1, &address,
sizeof(bluetooth_device_address_t));
}
result = _bt_disconnect_le_device(&address, client_id);
if (BLUETOOTH_ERROR_NONE == result) {
addr = g_malloc0(BT_ADDRESS_STRING_SIZE);
- BT_INFO("GATT Client: Save Invocation data DisConnect LE app[%s]", sender);
_bt_convert_addr_type_to_string(addr, address.addr);
}
break;
}
+ /* Sync */
+ case BT_GET_GATT_DATA_BATCHING_AVAILABLE_PACKETS: {
+ guint available_packets = 0;
+
+ result = _bt_gatt_get_data_batching_available_packets(&available_packets);
+ BT_DBG("LE batching available packets %u", available_packets);
+ if (result == BLUETOOTH_ERROR_NONE) {
+ g_array_append_vals(*out_param1, &available_packets,
+ sizeof(guint));
+ }
+
+ break;
+ }
+ /* Sync */
+ case BT_ENABLE_GATT_DATA_BATCHING: {
+ bluetooth_device_address_t address = { {0} };
+ int packet_threshold;
+ int timeout;
+
+ __bt_service_get_parameters(in_param1,
+ &address, sizeof(bluetooth_device_address_t));
+ __bt_service_get_parameters(in_param2,
+ &packet_threshold, sizeof(int));
+ __bt_service_get_parameters(in_param3,
+ &timeout, sizeof(int));
+ result = _bt_gatt_enable_data_batching(&address, packet_threshold, timeout);
+
+ break;
+ }
+ /* Sync */
+ case BT_DISABLE_GATT_DATA_BATCHING: {
+ bluetooth_device_address_t address = { {0} };
+
+ __bt_service_get_parameters(in_param1,
+ &address, sizeof(bluetooth_device_address_t));
+ result = _bt_gatt_disable_data_batching(&address);
+
+ break;
+ }
+
case BT_GATT_GET_PRIMARY_SERVICES: {
char *addr;
result = _bt_gatt_get_primary_services(addr);
if (BLUETOOTH_ERROR_NONE == result) {
- BT_INFO("GATT Client: Save Remote GATT Server address addr [%s] app[%s]",
- addr, sender);
_bt_save_invocation_context(context, result, sender,
function_name, (gpointer)addr);
} else
result = _bt_gatt_get_all_characteristic(¶m);
if (BLUETOOTH_ERROR_NONE == result) {
- BT_INFO("GATT Client: Save Invocation data for Service props app[%s]", sender);
-
/* Save the informations to invocation */
_bt_save_invocation_context(context, result, sender,
function_name,
result = _bt_gatt_get_all_characteristic_properties(¶m);
if (BLUETOOTH_ERROR_NONE == result) {
- BT_INFO("GATT Client: Save Invocation data for characteristic props app[%s]", sender);
-
/* Save the informations to invocation */
_bt_save_invocation_context(context, result, sender,
function_name,
result = _bt_gatt_read_characteristic_value(¶m);
if (BLUETOOTH_ERROR_NONE == result) {
- BT_INFO("GATT Client: Save Invocation data for characteristic props app[%s]", sender);
-
/* Save the informations to invocation */
_bt_save_invocation_context(context, result, sender,
function_name,
result = _bt_gatt_read_descriptor_value(¶m);
if (BLUETOOTH_ERROR_NONE == result) {
- BT_INFO("GATT Client: Save Invocation data for Descriptor's props app[%s]", sender);
-
/* Save the informations to invocation */
_bt_save_invocation_context(context, result, sender,
function_name,
result = _bt_gatt_write_characteristic_value_by_type(¶m , &data, write_type);
if (BLUETOOTH_ERROR_NONE == result) {
- BT_INFO("GATT Client: Save Invocation data for characteristic props app[%s]", sender);
-
/* Save the informations to invocation */
_bt_save_invocation_context(context, result, sender,
function_name,
result = _bt_gatt_write_descriptor_value_by_type(¶m, &data, write_type);
if (BLUETOOTH_ERROR_NONE == result) {
- BT_INFO("GATT Client: Save Invocation data for descriptor props app[%s]", sender);
-
/* Save the informations to invocation */
_bt_save_invocation_context(context, result, sender,
function_name,
if (is_indicate == false) {
result = _bt_gatt_acquire_notify(¶m , &fd, &mtu);
if (BLUETOOTH_ERROR_NONE == result && fd > -1) {
- BT_INFO("GATT Client: Save Invocation data for characteristic props app[%s] fd[ %d]", sender, fd);
+ BT_DBG("GATT Client: Save Invocation data for characteristic props app[%s] fd[ %d]", sender, fd);
GUnixFDList *fd_list = NULL;
GError *error = NULL;
normal:
result = _bt_gatt_watch_characteristic(¶m , client_id, is_notify);
if (BLUETOOTH_ERROR_NONE == result) {
- BT_INFO("GATT Client: Save Invocation data for characteristic props app[%s]", sender);
-
/* Save the informations to invocation */
_bt_save_invocation_context(context, result, sender, function_name,
(gpointer)g_memdup(¶m, sizeof(bluetooth_gatt_client_char_prop_info_t)));
}
#endif
case BT_START_LE_DISCOVERY: {
+ uid_t uid = 0;
+ pid_t pid = 0;
+
+ __bt_service_get_parameters(in_param1, &uid, sizeof(uid_t));
+
sender = (char *)g_dbus_method_invocation_get_sender(context);
- result = _bt_start_le_scan(sender);
+
+ if (__bt_service_get_sender_pid(sender, &pid) != BLUETOOTH_ERROR_NONE)
+ BT_ERR("Fail to get the sender pid");
+
+ result = _bt_start_le_scan(sender, uid, pid);
if (result == BLUETOOTH_ERROR_NONE) {
_bt_save_invocation_context(context, result, sender,
function_name, NULL);
+
+ BT_DBG("Remeber pid / uid for the scan operation");
+ _bt_bm_add_scan_app(SCAN_LE, uid, pid);
}
break;
}
case BT_STOP_LE_DISCOVERY: {
+ uid_t uid = 0;
+ pid_t pid = 0;
+
+ __bt_service_get_parameters(in_param1, &uid, sizeof(uid_t));
+
sender = (char *)g_dbus_method_invocation_get_sender(context);
+
+ if (__bt_service_get_sender_pid(sender, &pid) != BLUETOOTH_ERROR_NONE)
+ BT_ERR("Fail to get the sender pid");
+
result = _bt_stop_le_scan(sender);
if (result == BLUETOOTH_ERROR_NONE) {
_bt_save_invocation_context(context, result, sender,
function_name, NULL);
}
+
+ BT_DBG("Remove pid / uid for the scan operation");
+ _bt_bm_remove_scan_app(SCAN_LE, uid, pid);
+
break;
}
case BT_IS_LE_DISCOVERYING: {
}
case BT_SET_SCAN_PARAMETERS: {
bluetooth_le_scan_params_t scan_params;
+
__bt_service_get_parameters(in_param1, &scan_params,
sizeof(bluetooth_le_scan_params_t));
char *uuid;
char *path;
int fd;
+ char *sender;
+ sender = (char *)g_dbus_method_invocation_get_sender(context);
__bt_service_get_parameters(in_param1, &type, sizeof(int));
uuid = (char *)g_variant_get_data(in_param2);
path = (char *)g_variant_get_data(in_param3);
__bt_service_get_parameters(in_param4, &fd, sizeof(int));
- result = _bt_register_osp_server_in_agent(type, uuid, path, fd);
+ result = _bt_register_osp_server_in_agent(sender, type, uuid, path, fd);
break;
}
case BT_UNSET_AUTHORIZATION: {
case BT_SEARCH_SERVICE:
case BT_RFCOMM_CLIENT_CONNECT:
+ if (function_name == BT_RFCOMM_CLIENT_CONNECT)
+ BT_PERMANENT_LOG("Connect socket");
case BT_RFCOMM_CLIENT_CANCEL_CONNECT:
case BT_RFCOMM_SOCKET_DISCONNECT:
+ if (function_name == BT_RFCOMM_SOCKET_DISCONNECT)
+ BT_PERMANENT_LOG("Disconnect socket");
case BT_RFCOMM_SOCKET_WRITE:
case BT_RFCOMM_CREATE_SOCKET:
case BT_RFCOMM_REMOVE_SOCKET:
+ case BT_RFCOMM_SEND_RX_DETAILS:
+ case BT_RFCOMM_SEND_TX_DETAILS:
+ case BT_RFCOMM_SERVER_UPDATE_CONNECTION_INFO:
case BT_OPP_PUSH_FILES:
case BT_OPP_CANCEL_PUSH:
case BT_AVRCP_SET_PROPERTIES:
case BT_AVRCP_CONTROL_SET_PROPERTY:
+#ifdef TIZEN_FEATURE_BT_AVC_TARGET
+ case BT_AUDIO_SET_ABSOLUTE_VOLUME:
+ case BT_AUDIO_GET_ABSOLUTE_VOLUME:
+ case BT_AUDIO_IS_AVC_ACTIVATED:
+#endif
+
case BT_HF_CONNECT:
case BT_HF_DISCONNECT:
}
break;
- case BT_RFCOMM_SEND_RX_DETAILS:
- case BT_RFCOMM_SEND_TX_DETAILS:
case BT_ENABLE_ADAPTER:
case BT_DISABLE_ADAPTER:
case BT_RESET_ADAPTER:
case BT_LE_OOB_READ_LOCAL_DATA:
case BT_LE_OOB_ADD_REMOTE_DATA:
+ case BT_GET_GATT_DATA_BATCHING_AVAILABLE_PACKETS:
+ case BT_ENABLE_GATT_DATA_BATCHING:
+ case BT_DISABLE_GATT_DATA_BATCHING:
+
case BT_LE_IPSP_INIT:
case BT_LE_IPSP_DEINIT:
case BT_LE_IPSP_CONNECT:
case BT_IS_DISCOVERYING:
case BT_IS_LE_DISCOVERYING:
case BT_IS_CONNECTABLE:
+ case BT_GET_CONNECTABLE:
case BT_GET_BONDED_DEVICES:
case BT_GET_PROFILE_CONNECTED_DEVICES:
case BT_GET_BONDED_DEVICE:
/* Check if le_scanning app is terminated */
_bt_check_le_scanner_app_termination(name);
+
+ /* Check if RFCOMM server is terminated */
+ _bt_rfcomm_server_check_termination(name);
}
static void __bt_service_bus_acquired_handler(GDBusConnection *connection,
return name_acquired;
}
+void _bt_service_unref_connection(void)
+{
+ BT_INFO("+");
+
+ if (bt_service_conn) {
+ g_dbus_connection_flush_sync(bt_service_conn, NULL, NULL);
+ g_object_unref(bt_service_conn);
+ bt_service_conn = NULL;
+ }
+
+ BT_INFO("-");
+}
+
int _bt_service_register(void)
{
GDBusConnection *conn;
void _bt_service_unregister(void)
{
if (bt_service_conn) {
+ sd_notify(0, "STOPPING=1");
+
if (owner_sig_id > 0) {
g_dbus_connection_signal_unsubscribe(
bt_service_conn, owner_sig_id);
owner_sig_id = 0;
}
- __bt_service_register_object(bt_service_conn, NULL, FALSE);
- if (bt_service_conn) {
- g_object_unref(bt_service_conn);
- bt_service_conn = NULL;
- }
if (owner_id > 0) {
g_bus_unown_name(owner_id);
owner_id = 0;
}
+
+ __bt_service_register_object(bt_service_conn, NULL, FALSE);
}
}
GArray *out_param, int result)
{
GVariant *out_var;
- BT_DBG("+");
+ BT_DBG("");
out_var = g_variant_new_from_data((const GVariantType *)"ay",
out_param->data, out_param->len, TRUE, NULL, NULL);
g_dbus_method_invocation_return_value(invocation,
g_variant_new("(iv)", result, out_var));
- BT_DBG("-");
}
void _bt_service_method_return_with_unix_fd_list(GDBusMethodInvocation *invocation,
GArray *out_param, int result, GUnixFDList *fd_list)
{
GVariant *out_var;
- BT_DBG("+");
+ BT_DBG("");
out_var = g_variant_new_from_data((const GVariantType *)"ay",
out_param->data, out_param->len, TRUE, NULL, NULL);
g_dbus_method_invocation_return_value_with_unix_fd_list(invocation,
g_variant_new("(iv)", result, out_var), fd_list);
- BT_DBG("-");
}