static int __bt_bm_request_data(_bt_battery_data_t *latest)
{
int ret = _bt_bm_read_data(latest);
- if (ret == BLUETOOTH_ERROR_NONE)
- BT_DBG("Received data from battery monitor plugin: %ld %ld %d %d",
+ if (ret == BLUETOOTH_ERROR_NONE) {
+ BT_DBG("Received data from bluetooth battery monitor: %ld %ld %d %d",
latest->session_start_time, latest->session_end_time,
latest->session_scan_time, latest->session_connected_time);
+
+ if (latest->atm_list == NULL) {
+ BT_DBG("No app data transaction for this session");
+ return ret;
+ }
+
+ for (GSList *l = latest->atm_list; l != NULL; l = g_slist_next(l)) {
+ _bt_battery_app_data_t *t = (_bt_battery_app_data_t *)(l->data);
+ BT_DBG("%ld %ld %d %d", (long int)(t->uid), (long int)(t->pid), t->rx_bytes, t->tx_bytes);
+ }
+ }
else
BT_ERR("Error encountered");
return ret;
result = _bt_reset_adapter();
break;
case BT_BATTERY_READ_DATA: {
- _bt_battery_data_t data;
- result = __bt_bm_request_data(&data);
- g_array_append_vals(*out_param1, &data, sizeof(_bt_battery_data_t));
+ _bt_battery_data_t *data = NULL;
+ data = g_malloc0(sizeof(_bt_battery_data_t));
+ result = __bt_bm_request_data(data);
+
+ bt_battery_dbus_data_t dbus_data;
+ memset(&dbus_data, 0, sizeof(bt_battery_dbus_data_t));
+ dbus_data.session_start_time = data->session_start_time;
+ 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;
+
+ /*Populating app data*/
+ int n = 0;
+ for (GSList *l = data->atm_list; l != NULL; l = g_slist_next(l)) {
+ bt_battery_app_data *t = (bt_battery_app_data *)(l->data);
+ memcpy(&dbus_data.app_data[n], t, sizeof(bt_battery_app_data));
+ n++;
+ }
+ 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_free(data);
+ data = NULL;
break;
}
case BT_CHECK_ADAPTER: {
result = _bt_set_authorization(&address, authorize);
break;
}
+ case BT_SET_LE_PRIVACY: {
+ gboolean set_privacy;
+ __bt_service_get_parameters(in_param1, &set_privacy,
+ sizeof(gboolean));
+ result = _bt_set_le_privacy(set_privacy);
+ break;
+ }
+ case BT_ADD_WHITE_LIST: {
+ bluetooth_device_address_t address = { {0} };
+ int address_type = 0;
+ bool is_add = true;
+ __bt_service_get_parameters(in_param1,
+ &address, sizeof(bluetooth_device_address_t));
+ __bt_service_get_parameters(in_param2,
+ &address_type, sizeof(int));
+ result = _bt_set_white_list(&address, address_type, is_add);
+ break;
+ }
+ case BT_REMOVE_WHITE_LIST: {
+ bluetooth_device_address_t address = { {0} };
+ int address_type = 0;
+ bool is_add = false;
+ __bt_service_get_parameters(in_param1,
+ &address, sizeof(bluetooth_device_address_t));
+ __bt_service_get_parameters(in_param2,
+ &address_type, sizeof(int));
+ result = _bt_set_white_list(&address, address_type, is_add);
+ break;
+ }
case BT_IS_DEVICE_CONNECTED: {
bluetooth_device_address_t address = { {0} };
gboolean connected = FALSE;
result = BLUETOOTH_ERROR_NONE;
break;
}
+ case BT_RFCOMM_SEND_RX_DETAILS: {
+ uid_t uid;
+ pid_t pid;
+ 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_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;
+ }
+ case BT_RFCOMM_SEND_TX_DETAILS: {
+ uid_t uid;
+ pid_t pid;
+ 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_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_AUDIO_SELECT_ROLE: {
bluetooth_audio_role_t role;
break;
}
+ case BT_LE_OOB_READ_LOCAL_DATA: {
+ bt_oob_data_t local_oob_data;
+
+ memset(&local_oob_data, 0x00, sizeof(bt_oob_data_t));
+ result = _bt_le_oob_read_local_data(&local_oob_data);
+
+ g_array_append_vals(*out_param1, &local_oob_data,
+ sizeof(bt_oob_data_t));
+
+ break;
+ }
+ case BT_LE_OOB_ADD_REMOTE_DATA: {
+ bluetooth_device_address_t address = { {0} };
+ unsigned short address_type;
+ bt_oob_data_t remote_oob_data;
+
+ __bt_service_get_parameters(in_param1,
+ &address, sizeof(bluetooth_device_address_t));
+ __bt_service_get_parameters(in_param2,
+ &address_type, sizeof(unsigned short));
+ __bt_service_get_parameters(in_param3,
+ &remote_oob_data, sizeof(bt_oob_data_t));
+
+ result = _bt_oob_add_remote_data(&address, address_type, &remote_oob_data);
+
+ break;
+ }
case BT_AVRCP_SET_TRACK_INFO: {
media_metadata_t data;
media_metadata_attributes_t meta_data;
}
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));
+
BT_DBG("bluetooth_le_scan_params_t [%f %f %d]",
scan_params.interval, scan_params.window,
scan_params.type);
- result = _bt_set_scan_parameters(&scan_params);
+
+ result = _bt_prepare_scan_parameters(&scan_params, 0);
+ break;
+ }
+ case BT_SET_SCAN_TYPE: {
+ int scan_type = 0;
+ __bt_service_get_parameters(in_param1, &scan_type, sizeof(int));
+
+ BT_DBG("bluetooth_le_scan_type [%d]", scan_type);
+ result = _bt_prepare_scan_parameters(NULL, scan_type);
break;
}
#ifdef TIZEN_FEATURE_BT_PAN_NAP
case BT_START_LE_DISCOVERY:
case BT_STOP_LE_DISCOVERY:
case BT_SET_SCAN_PARAMETERS:
+ case BT_SET_SCAN_TYPE:
case BT_BOND_DEVICE:
case BT_CANCEL_BONDING:
}
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_WRITE_HOST_SUGGESTED_DATA_LENGTH:
case BT_LE_READ_HOST_SUGGESTED_DATA_LENGTH:
case BT_LE_SET_DATA_LENGTH:
+ case BT_LE_OOB_READ_LOCAL_DATA:
+ case BT_LE_OOB_ADD_REMOTE_DATA:
case BT_LE_IPSP_INIT:
case BT_LE_IPSP_DEINIT: