/**
* @internal
* @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
+ * @brief Synchronously provides details about bluetooth usage
+ * @since_tizen 5.5
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/bluetooth.admin
+ *
+ * @details This function provides details such as session start time, session end time as well as total scan time and total connected time in a session
+ *
+ * @remarks An pointer of type bt_battery_info_s must be passed as argument which will contain the relevant information as the function returns.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #BT_ERROR_NOT_ENABLED Not enabled
+ * @retval #BT_ERROR_NOW_IN_PROGRESS Operation now in progress
+ * @retval #BT_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED
+ * @post
+ *
+ */
+int bt_adapter_read_battery_info(bt_battery_info_s *data);
+
+/**
+ * @internal
+ * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
* @brief Disables the local Bluetooth adapter, asynchronously.
* @since_tizen @if WEARABLE 2.3.1 @else 2.3 @endif
* @privlevel platform
{
#endif /* __cplusplus */
+#include <stdint.h>
#include <glib.h>
/* This variable will be added into bt_service_class_t in tizen 4.0 */
// int is_protected;
} bt_map_client_message_s;
+typedef struct {
+ time_t session_start_time;
+ time_t session_end_time;
+ uint16_t session_connected_time;
+ uint16_t session_scan_time;
+ GSList *atm_list;
+} bt_battery_info_s;
+
typedef bt_map_client_list_folders_filter_s *bt_map_client_list_folders_filter_h;
typedef bt_map_client_list_messages_filter_s *bt_map_client_list_messages_filter_h;
return error_code;
}
+int bt_adapter_read_battery_info(bt_battery_info_s *battery_data)
+{
+ bt_battery_data data;
+ int error_code = BT_ERROR_NONE;
+
+ BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON);
+ BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(battery_data);
+ error_code = _bt_get_error_code(bluetooth_read_battery_data(&data));
+
+ if (error_code != BT_ERROR_NONE) { /* LCOV_EXCL_LINE */
+ BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code),
+ error_code); /* LCOV_EXCL_LINE */
+ return error_code;
+ } /* LCOV_EXCL_LINE */
+
+ battery_data->session_start_time = data.session_start_time;
+ 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;
+
+ 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);
+ return error_code;
+}
+
int bt_adapter_disable(void)
{
int error_code = BT_ERROR_NONE;
, BT_UNIT_TEST_FUNCTION_ADAPTER_GET_LOCAL_OOB_EXT_DATA},
{"bt_adapter_set_remote_oob_ext_data"
, BT_UNIT_TEST_FUNCTION_ADAPTER_SET_REMOTE_OOB_EXT_DATA},
+ {"bt_adapter_read_battery_info"
+ , BT_UNIT_TEST_FUNCTION_ADAPTER_READ_BATTERY_INFO},
{"bt_adapter_set_visibility_mode_changed_cb"
, BT_UNIT_TEST_FUNCTION_ADAPTER_SET_VISIBILITY_MODE_CHANGED_CB},
{"bt_adapter_unset_visibility_mode_changed_cb"
}
break;
}
+ case BT_UNIT_TEST_FUNCTION_ADAPTER_READ_BATTERY_INFO: {
+ bt_battery_info_s data;
+ ret = bt_adapter_read_battery_info(&data);
+ if (ret < 0)
+ TC_PRT("returns %s\n", __bt_get_error_message(ret));
+ 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);
+ break;
+ }
case BT_UNIT_TEST_FUNCTION_ADAPTER_SET_REMOTE_OOB_EXT_DATA: {
char remote_addr[18];
unsigned char *param_data[4];
BT_UNIT_TEST_FUNCTION_ADAPTER_GET_LOCAL_OOB_EXT_DATA,
BT_UNIT_TEST_FUNCTION_ADAPTER_SET_REMOTE_OOB_EXT_DATA,
BT_UNIT_TEST_FUNCTION_ADAPTER_REMOVE_REMOTE_OOB_DATA,
+ BT_UNIT_TEST_FUNCTION_ADAPTER_READ_BATTERY_INFO,
BT_UNIT_TEST_FUNCTION_ADAPTER_SET_VISIBILITY_MODE_CHANGED_CB,
BT_UNIT_TEST_FUNCTION_ADAPTER_UNSET_VISIBILITY_MODE_CHANGED_CB,
BT_UNIT_TEST_FUNCTION_ADAPTER_SET_VISIBILITY_DURATION_CHANGED_CB,