BT_EXPORT_API int bluetooth_check_adapter(void)
{
- int value = VCONFKEY_BT_STATUS_OFF;
+#ifndef TIZEN_BLUEDROID_PORTING
int ret;
-
ret = _bt_get_adapter_path(_bt_get_system_common_conn(), NULL);
-
- if (ret != BLUETOOTH_ERROR_NONE)
- return BLUETOOTH_ADAPTER_DISABLED;
+ return ret == BLUETOOTH_ERROR_NONE ? BLUETOOTH_ADAPTER_ENABLED :
+ BLUETOOTH_ADAPTER_DISABLED;
+#else
+ int value = VCONFKEY_BT_STATUS_OFF;
/* check VCONFKEY_BT_STATUS */
if (vconf_get_int(VCONFKEY_BT_STATUS, &value) != 0) {
return value == VCONFKEY_BT_STATUS_OFF ? BLUETOOTH_ADAPTER_DISABLED :
BLUETOOTH_ADAPTER_ENABLED;
+#endif
}
BT_EXPORT_API int bluetooth_enable_adapter(void)
{
if (system_common_conn == NULL) {
GError *error = NULL;
- system_common_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (access(CONTAINER_FILE, F_OK) == 0)
+ system_common_conn = g_dbus_connection_new_for_address_sync(
+ DBUS_HOST_SYSTEM_BUS_ADDRESS,
+ G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT | G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION,
+ NULL, NULL, &error);
+ else
+ system_common_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
if (error) {
BT_ERR("GDBus connection Error : %s \n", error->message);
g_clear_error(&error);
{
if (system_shared_conn == NULL) {
GError *error = NULL;
- system_shared_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (access(CONTAINER_FILE, F_OK) == 0)
+ system_shared_conn = g_dbus_connection_new_for_address_sync(
+ DBUS_HOST_SYSTEM_BUS_ADDRESS,
+ G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT | G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION,
+ NULL, NULL, &error);
+ else
+ system_shared_conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
if (error) {
BT_ERR("GDBus connection Error : %s \n", error->message);
g_clear_error(&error);
return 0;
}
+ if (access(CONTAINER_FILE, F_OK) == 0) {
+ BT_INFO("bt-service is not running in container");
+ return 0;
+ }
+
memset(&sa, 0, sizeof(sa));
sa.sa_sigaction = __bt_sigterm_handler;
sa.sa_flags = SA_SIGINFO;
#define TIZEN_FEATURE_PBAP_SUPPORTED (get_tizen_feature_supported(BT_FEATURE_PBAP) == true)
#define TIZEN_FEATURE_ROBOT_REFERENCE ((get_tizen_model()) == _MODEL_ROBOT)
+#define CONTAINER_FILE "/run/systemd/container"
+#define DBUS_HOST_SYSTEM_BUS_ADDRESS "unix:path=/run/host/dbus/system_bus_socket"
+
#ifdef __cplusplus
}
#endif /* __cplusplus */