" <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>";
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_DBG("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;
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: {
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);
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);
int size;
__bt_service_get_parameters(in_param1, &uid, sizeof(uid_t));
__bt_service_get_parameters(in_param2, &pid, sizeof(pid_t));
- __bt_service_get_parameters(in_param3, &size, sizeof(int));
+ __bt_service_get_parameters(in_param3, &size, sizeof(unsigned int));
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, RX_DATA);
break;
int size;
__bt_service_get_parameters(in_param1, &uid, sizeof(uid_t));
__bt_service_get_parameters(in_param2, &pid, sizeof(pid_t));
- __bt_service_get_parameters(in_param3, &size, sizeof(int));
+ __bt_service_get_parameters(in_param3, &size, sizeof(unsigned int));
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_UPDATE_CONNECTION_INFO: {
+ gboolean connected = FALSE;
+ int socket_fd = -1;
+ int role = RFCOMM_ROLE_SERVER;
+
+ sender = (char *)g_dbus_method_invocation_get_sender(context);
+
+ __bt_service_get_parameters(in_param1, &role, sizeof(int));
+ __bt_service_get_parameters(in_param2, &connected, sizeof(gboolean));
+ __bt_service_get_parameters(in_param3, &socket_fd, sizeof(int));
+
+ if (connected == TRUE)
+ result = _bt_rfcomm_conn_added(sender, role, socket_fd);
+ else
+ result = _bt_rfcomm_conn_removed(sender, role, socket_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);
}
result = _bt_request_att_mtu(&address, mtu);
if (BLUETOOTH_ERROR_NONE == result) {
addr = g_malloc0(BT_ADDRESS_STRING_SIZE);
- BT_INFO("GATT Client: Save Invocation data for BT_REQ_ATT_MTU [%s]", sender);
_bt_convert_addr_type_to_string(addr, address.addr);
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,
/* 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_ERR("GATT Client: gatt connect failed. client_id[%d]", client_id);
g_array_append_vals(*out_param1, &address,
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: {
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_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_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:
/* Check if le_scanning app is terminated */
_bt_check_le_scanner_app_termination(name);
+
+ /* Check if RFCOMM app is terminated */
+ _bt_rfcomm_check_termination(name);
}
static void __bt_service_bus_acquired_handler(GDBusConnection *connection,