#include "bt-common.h"
#include "bt-request-sender.h"
#include "bt-event-handler.h"
-#ifdef TIZEN_FEATURE_BT_DPM
#include "bt-dpm.h"
-#endif
BT_EXPORT_API int bluetooth_audio_init(bt_audio_func_ptr cb, void *user_data)
{
return BLUETOOTH_ERROR_PERMISSION_DEINED;
}
-#ifdef TIZEN_FEATURE_BT_DPM
if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)remote_address) == BT_DPM_RESTRICTED) {
BT_ERR("Blacklist device");
return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
}
}
-#endif
user_info = _bt_get_user_data(BT_AUDIO);
retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
in_param1, in_param2, in_param3, in_param4,
user_info->cb, user_info->user_data);
else /* default case - with or without DPM enabled */
+
result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_AUDIO_CONNECT,
in_param1, in_param2, in_param3, in_param4,
user_info->cb, user_info->user_data);
return BLUETOOTH_ERROR_PERMISSION_DEINED;
}
-#ifdef TIZEN_FEATURE_BT_DPM
if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)remote_address) == BT_DPM_RESTRICTED) {
BT_ERR("Blacklist device");
return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
}
}
-#endif
user_info = _bt_get_user_data(BT_AUDIO);
retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
g_array_append_vals(in_param1, remote_address, sizeof(bluetooth_device_address_t));
+ BT_INFO_C("### Disconnect AG");
result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_AG_DISCONNECT,
in_param1, in_param2, in_param3, in_param4,
user_info->cb, user_info->user_data);
return BLUETOOTH_ERROR_PERMISSION_DEINED;
}
-#ifdef TIZEN_FEATURE_BT_DPM
if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)remote_address) == BT_DPM_RESTRICTED) {
BT_ERR("Blacklist device");
return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
}
}
-#endif
user_info = _bt_get_user_data(BT_AUDIO);
retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
g_array_append_vals(in_param1, remote_address, sizeof(bluetooth_device_address_t));
+ BT_INFO_C("### Connect AV");
result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_AV_CONNECT,
in_param1, in_param2, in_param3, in_param4,
user_info->cb, user_info->user_data);
return BLUETOOTH_ERROR_PERMISSION_DEINED;
}
-#ifdef TIZEN_FEATURE_BT_DPM
if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)remote_address) == BT_DPM_RESTRICTED) {
BT_ERR("Blacklist device");
return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
BT_ERR("Not allow to use A2DP profile");
return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
}
-#endif
user_info = _bt_get_user_data(BT_AUDIO);
retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
g_array_append_vals(in_param1, remote_address, sizeof(bluetooth_device_address_t));
+ BT_INFO_C("### Connect AV Source");
result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_AV_SOURCE_CONNECT,
in_param1, in_param2, in_param3, in_param4,
user_info->cb, user_info->user_data);
g_array_append_vals(in_param1, remote_address, sizeof(bluetooth_device_address_t));
+ BT_INFO_C("### Disconnect AV");
result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_AV_DISCONNECT,
in_param1, in_param2, in_param3, in_param4,
user_info->cb, user_info->user_data);
g_array_append_vals(in_param1, remote_address, sizeof(bluetooth_device_address_t));
+ BT_INFO_C("### Disconnect AV Source");
result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_AV_SOURCE_DISCONNECT,
in_param1, in_param2, in_param3, in_param4,
user_info->cb, user_info->user_data);
return result;
}
+BT_EXPORT_API int bluetooth_audio_set_absolute_volume(unsigned int volume)
+{
+ int result;
+
+ BT_CHECK_ENABLED(return);
+
+ BT_INIT_PARAMS();
+ BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ g_array_append_vals(in_param1, &volume, sizeof(unsigned int));
+
+ result = _bt_send_request(BT_BLUEZ_SERVICE, BT_AUDIO_SET_ABSOLUTE_VOLUME,
+ in_param1, in_param2, in_param3, in_param4, &out_param);
+
+ BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+ return result;
+}
+
+BT_EXPORT_API int bluetooth_audio_get_absolute_volume(unsigned int *volume)
+{
+ int result;
+
+ BT_CHECK_PARAMETER(volume, return);
+ BT_CHECK_ENABLED(return);
+
+ BT_INIT_PARAMS();
+ BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ result = _bt_send_request(BT_BLUEZ_SERVICE, BT_AUDIO_GET_ABSOLUTE_VOLUME,
+ in_param1, in_param2, in_param3, in_param4, &out_param);
+
+ if (result == BLUETOOTH_ERROR_NONE) {
+ *volume = g_array_index(out_param,
+ unsigned int, 0);
+ }
+
+ BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ return result;
+}
+
+BT_EXPORT_API int bluetooth_audio_is_avc_activated(bool *activated)
+{
+ int result;
+
+ BT_CHECK_PARAMETER(activated, return);
+
+ if (bluetooth_check_adapter() == BLUETOOTH_ADAPTER_DISABLED) {
+ BT_DBG("BT is not enabled. So activated value is false");
+ *activated = false;
+ return BLUETOOTH_ERROR_NONE;
+ }
+
+ BT_INIT_PARAMS();
+ BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ result = _bt_send_request(BT_BLUEZ_SERVICE, BT_AUDIO_IS_AVC_ACTIVATED,
+ in_param1, in_param2, in_param3, in_param4, &out_param);
+
+ if (result == BLUETOOTH_ERROR_NONE) {
+ *activated = g_array_index(out_param,
+ bool, 0);
+ }
+
+ BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ return result;
+}
+
BT_EXPORT_API int bluetooth_ag_get_headset_volume(unsigned int *speaker_gain)
{
int result;
BT_CHECK_ENABLED(return);
-#ifdef TIZEN_FEATURE_BT_DPM
if (_bt_check_dpm(BT_DPM_HSP, NULL) == BT_DPM_RESTRICTED) {
BT_ERR("Not allow to use HSP profile");
return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
}
-#endif
BT_INIT_PARAMS();
BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
GDBusProxy *proxy = NULL;
GDBusConnection *conn = NULL;
- conn = _bt_gdbus_get_system_gconn();
+ conn = _bt_get_system_common_conn();
retv_if(conn == NULL, NULL);
- proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE,
+ proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
NULL, BT_HF_SERVICE_NAME, path, interface, NULL, err);
if (proxy == NULL) {
BT_ERR("Unable to allocate new proxy");
(*call_list)->list = g_list_append((*call_list)->list,
(gpointer)call_info);
}
+
+ g_variant_unref(var_temp);
BT_DBG("-");
return BLUETOOTH_ERROR_NONE;
}
g_array_append_vals(in_param1, remote_address, sizeof(bluetooth_device_address_t));
+ BT_INFO_C("### Disconnect HF");
result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_HF_DISCONNECT,
in_param1, in_param2, in_param3, in_param4,
user_info->cb, user_info->user_data);
return BLUETOOTH_ERROR_NONE;
}
+BT_EXPORT_API int bluetooth_hf_request_call_list_async(void)
+{
+ GVariant *reply = NULL;
+ GError *err = NULL;
+ int ret = BLUETOOTH_ERROR_INTERNAL;
+
+ BT_CHECK_ENABLED(return);
+
+ reply = __bt_hf_agent_dbus_send(BT_HF_OBJECT_PATH, BT_HF_INTERFACE,
+ "RequestCallListAsync", &err, NULL);
+ if (!reply) {
+ BT_ERR("Error returned in method call\n");
+ if (err) {
+ BT_ERR("Error = %s", err->message);
+ if (strstr(err->message, "No data"))
+ ret = BLUETOOTH_ERROR_NO_DATA;
+ else if (strstr(err->message, "NotConnected"))
+ ret = BLUETOOTH_ERROR_NOT_CONNECTED;
+ g_clear_error(&err);
+ }
+ return ret;
+ }
+
+ g_variant_unref(reply);
+ return BLUETOOTH_ERROR_NONE;
+}
+
BT_EXPORT_API int bluetooth_hf_get_codec(unsigned int *codec_id)
{
GVariant *reply = NULL;