BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
BT_CHECK_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(battery_data);
+ memset(&data, 0, sizeof(bt_battery_data));
+
error_code = _bt_get_error_code(bluetooth_read_battery_data(&data));
if (error_code != BT_ERROR_NONE) { /* LCOV_EXCL_LINE */
battery_data->session_end_time = data.session_end_time;
battery_data->session_scan_time = data.session_scan_time;
battery_data->session_connected_time = data.session_connected_time;
+ battery_data->atm_list = data.atm_list;
BT_DBG("Battery Data in application layer: %ld %ld %d %d",
battery_data->session_start_time, battery_data->session_end_time,
battery_data->session_scan_time, battery_data->session_connected_time);
+
+ if(data.atm_list == NULL) {
+ BT_DBG("No data transaction in this session");
+ return error_code;
+ }
+
+ BT_DBG("App-wise data transaction details:");
+ for (GSList *l = battery_data->atm_list; l != NULL; l = g_slist_next(l)) {
+ bt_battery_app_info_s *t = (bt_battery_app_info_s *)(l->data);
+ BT_DBG("%ld %ld %d %d", (long int)(t->uid), (long int)(t->pid), t->rx_bytes, t->tx_bytes);
+ }
return error_code;
}
}
case BT_UNIT_TEST_FUNCTION_ADAPTER_READ_BATTERY_INFO: {
bt_battery_info_s data;
+ memset(&data, 0, sizeof(bt_battery_info_s));
ret = bt_adapter_read_battery_info(&data);
- if (ret < 0)
+ if (ret < 0) {
TC_PRT("returns %s\n", __bt_get_error_message(ret));
- else
+ } else {
TC_PRT("Battery data: %ld %ld %d %d", data.session_start_time,
data.session_end_time, data.session_scan_time, data.session_connected_time);
+ if(data.atm_list == NULL) {
+ TC_PRT("No data transaction in this session");
+ break;
+ }
+
+ TC_PRT("Displaying app-wise transaction details");
+ for (GSList *l = data.atm_list; l != NULL; l = g_slist_next(l)) {
+ bt_battery_app_info_s *t = (bt_battery_app_info_s *)(l->data);
+ TC_PRT("uid: %ld, pid: %ld, received bytes: %d, sent bytes: %d",
+ (long int)(t->uid), (long int)(t->pid), t->rx_bytes, t->tx_bytes);
+ }
+ }
break;
}
case BT_UNIT_TEST_FUNCTION_ADAPTER_SET_REMOTE_OOB_EXT_DATA: {